diff --git a/Dict.md b/Dict.md new file mode 100644 index 0000000000..23207f3f93 --- /dev/null +++ b/Dict.md @@ -0,0 +1,151 @@ + + +
Linux中国术语词典
+
+
[Linux中国](http://www.linux.cn)出品
+**************************************************** +**************************************************** +本词典为规范Linux中国翻译组(LCTT)技术术语翻译而编写,同时也方便广大翻译志愿者查阅。限于编写者的水平,其中可能有不完善或疏漏的地方,希望广大翻译志愿者不吝指正。同时,希望广大翻译志愿者能提供相关术语的翻译供大家参考。另外,若在翻译过程中对某些术语有疑虑,可在我们的QQ专门群中进行讨论。在此,谨代表LCTT感谢各位志愿者的辛勤劳动和无私奉献。 +

LCTT翻译组

+**************************************************** + +#### A #### +### 1. APM:高级电源管理 +### 2. +#### B #### +### 1. Backbone:骨干 +>是一个网络的一部分,其作为所有网络运输的一个基本通道,其需要非常高的带宽。一个骨干网络的服务提供者连接许多企业子网和较小服务提供者的网络。一个企业骨干网络连接许多局域网和数据中心。 + +### 2. B channel(Bearer channel):承载信道 +>承载信道(Bearer Channel),也叫做B channel,是一个全双工DS0时间槽(64-kbps),其携带模拟语音或数字资料通过综合服务数字网(ISDN)。 + +### 3. Backchannel:反向通道 +>是指当其他实时在线会话在进行中时,习惯使用网络化的计算机来维持一个实时的在线会话。 + +### 4. Back End:后台 +>在一个计算机系统中,是指为一个前台作业提供服务的一个节点或软件程序。前台直接影响用户,后台可能与其他系统相连接,如数据库和其它系统。 + +### 5. Back-haul:回程线路 +>是一个通信信道,它使携带信息流到远于最终目的地的地方,然后将它送回。这样做是因为传输到更远的远程区域的代价要远比直接发送的代价低地多。 + +### 6. Backoff:退避 +>是指当一个主机已经在有MAC 协议的网络中经历了一个冲突之后试图去重发之前的等待时期。这个退避时间通常是任意的来最小化相同节点再次冲突的可能性。在每次冲突后增加退避时期也能帮助预防重复碰撞,特别当这个网络负担很重时。 + +### 7. Backplane:附加卡 +>在许多网络中是一个物理接口模块,例如,连接在一个界面处理器或卡和在一个总线机箱内数据总线和功率分配总线之间的一个路由器或转换器。 + +### 8. Back Pressure:背压 +>在计算机系统中,是指网络拥塞信息逆流通过一个Internet网络。 + +### 9. Balun(balanced-unbalanced):不平衡变压器 +>意味着平衡-非平衡。不平衡变压器是一个设计用来转换平衡和不平衡之间的电信号的设备。 + +### 10. Baseband:基带 +>是一种类型的网络技术,在那里仅仅一种载波频率被使用。在一个基带网中,信息在传送介质中以数字的形式被携带在一个单一的多元信号通道中。 + +### 11. Bastion Host:防御主机 +>是在内部网络和外部网络之间的一个网关,它被设计来防御针对内部网络的攻击。这个系统在非武装区(DMZ)的公共一边,不被防火墙或过滤路由器保护,它对攻击是完全暴露的。 + +### 12: Bc(Committed Burst):约定资讯讯务 +>是一个用在帧中继系统的术语,是一个帧中继交互网约定接受和传输和通过一个帧中继网络数据链路控制(DLC)和一个特殊的时帧的最大数据量(用比特表示)。 + +### 13. BCP(Best Current Practices):最优现行方法 +>是副系列的IETF RFCs,其被用于描述在Internet上的最优配置技术。 + +### 14. BCU(Balanced Configuration Unit):平衡配置单元 +>是一个综合的IBM解决方法,它由软件和硬件组成。BCUs是综合的和测试作为数据仓库系统的预配置功能块。 + +### 15. BECN(Backward Explicit Congestion Notification):显式拥塞通知 +>是在帧中继报头的一个1比特域,其发信号到任何接收帧的事物(转换器和数据终端设备),拥塞就发生在帧的反面(后面)。帧中继转换器和数据终端设备可能遵照显式拥塞通知位来减慢那个方向的数据传输率。 + +### 16. BER(Bit Error Rate):误码率 +>是接收到的位包含错误的比率。BER通常被表示成十足的负面力量。 + +### 17. BIP(Bit Interleaved Parity):位交叉奇偶校验 +>一个用在ATM中的术语,是一个通常用来检测链接错误的一种方法。一个检测位或字被嵌入到以前发生阻塞或帧的链接中。位错误在有效载荷中能够作为维护信息被删除和报告。 + +#### C #### + +#### D #### +### 1. daemon:守护进程 +### 2. +#### F #### + +#### G #### + +#### H #### +### 1. Home Directory:家目录 +#### I #### + +#### J #### + +#### K #### + +#### L #### +### 1. LTS(Long Term Support):长期支持 +>该缩写词多见于操作系统发行版或者软件发行版名称中,表明该版本属于长期支持版。 + +#### M #### + +#### N #### + +#### O #### + +#### P #### +### 1.P-code(Pseudo-code):伪代码语言 +>一种解释型语言,执行方式介于编译型语言和解释型语言之间。和解释型语言一样,伪代码编程语言无需编译,在执行时自动转换成二进制形式。然而,和编译型语言不同的是,这种可执行的二进制文件是以伪代码的形式而不是机器语言的形式存储的。伪代码语言的例子有 Java、Python 和 REXX/Object REXX。 + +### 2. PAM(Pluggable Authentication Modules):可插拔认证模块 +>用于系统安全性的可替换的用户认证模块,它允许在不知道将使用何种认证方案的情况下进行编程。这允许将来用其它模块来替换某个模块,却无需重写软件。 + +### 3. Port/Ported/Porting:移植 +>一个过程,即获取为某个操作系统平台编写的程序,并对其进行修改使之能在另一 OS 上运行,并且具有类似的功能。 + +### 4. POSIX(Portable Operating System Interface for uniX):UNIX 可移植操作系统接口 +>一组编程接口标准,它们规定如何编写应用程序源代码以便应用程序可在操作系统之间移植。POSIX 基于 UNIX,它是 The Open Group 的 X/Open 规范的基础。 + +#### Q #### + +#### R #### +### 1. RCS(Revision Control System):修订控制系统 +>一组程序,它们控制组环境下文件的共享访问并跟踪文本文件的变化。常用于维护源代码模块的编码工作。 + +### 2. RFS(Remote File Sharing):远程文件共享 +>一个程序,它让用户访问其它计算机上的文件,就好象文件在用户的系统上一样。 + +#### S #### +### 1. shebang [ʃɪ'bæŋ]:释伴 +>Shebang(也称为Hashbang)是一个由井号和叹号构成的字符序列(#!),出现在文本文件的第一行的前两个字符,后跟解释器路径,如:#!/bin/sh,这通常是Linux中shell脚本的标准起始行。 +>长期以来,shebang都没有正式的中文名称。Linux中国翻译组将其翻译为:释伴,即解释伴随行的简称,同时又是shebang的音译。 + +### 2. Spool(Simultaneous Peripheral Operation On-Line):假脱机 +>将数据发送给一个程序,该程序将该数据信息放入队列以备将来使用(例如,打印假脱机程序) + +### 2. Steganography:隐写术 +>将一段信息隐藏在另一段信息中的做法。一个示例是在数字化照片中放置不可见的数字水印。 + +### 3. Swap:交换 +>暂时将数据(程序和/或数据文件)从随机存取存储器移到磁盘存储器(换出),或反方向移动(换入),以允许处理比物理内存所能容纳的更多的程序和数据。 + +#### T #### +### 1. Time-sharing:分时 +>一种允许多个用户分享处理器的方法,它以时间为基础给每个用户分配一部分处理器资源,按照这些时间段轮流运行每个用户的进程。 + +### 2. TL;DR:长篇摘要 +>Too Long;Didn't Read的缩写词,即太长,未阅的意思。该词多见于互联网社区论坛中,用于指出该文太长,没有阅读,或者标示出一篇长文章的摘要。在论坛回复中,该缩写词也多作为灌水用。因此,Linux中国翻译组将其翻译为:长篇摘要。 + +#### U #### + +#### V #### +### 1. VRML(Virtual Reality Modeling Language):虚拟现实建模语言 +>一种主要基于 Web 的语言,用于 3D 效果(如构建遍历)。 + +#### W #### +### 1. Wrapper:封装器 +>用于启动另一个程序的程序。 + +#### X #### + +#### Y #### + +#### Z #### \ No newline at end of file diff --git a/README.md b/README.md index 02fc5a8227..968c8434a1 100644 --- a/README.md +++ b/README.md @@ -49,93 +49,127 @@ LCTT的组成 * 2014/10/08 提升bazz2为Core Translators成员。 * 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成员。 活跃成员 ------------------------------- -目前活跃成员有: -- CORE [wxy](https://github.com/wxy), -- CORE [carolinewuyan](https://github.com/carolinewuyan), -- CORE [DeadFire](https://github.com/DeadFire), -- CORE [geekpi](https://github.com/geekpi), -- CORE [GOLinux](https://github.com/GOLinux), -- CORE [reinoir](https://github.com/reinoir), -- CORE [bazz2](https://github.com/bazz2), -- CORE [zpl1025](https://github.com/zpl1025), -- Senior [tinyeyeser](https://github.com/tinyeyeser), -- Senior [vito-L](https://github.com/vito-L), -- Senior [jasminepeng](https://github.com/jasminepeng), -- Senior [willqian](https://github.com/willqian), -- Senior [vizv](https://github.com/vizv), -- [runningwater](https://github.com/runningwater), -- [luoxcat](https://github.com/Luoxcat), -- [Vic020](https://github.com/Vic020), -- [KayGuoWhu](https://github.com/KayGuoWhu), -- [alim0x](https://github.com/alim0x), -- [ZTinoZ](https://github.com/ZTinoZ), -- [2q1w2007](https://github.com/2q1w2007), -- [flsf](https://github.com/flsf), -- [blueabysm](https://github.com/blueabysm), -- [barney-ro](https://github.com/barney-ro), -- [su-kaiyao](https://github.com/su-kaiyao), -- [crowner](https://github.com/crowner), -- [Linchenguang](https://github.com/Linchenguang), -- [Linux-pdz](https://github.com/Linux-pdz), -- [linuhap](https://github.com/linuhap), -- [yechunxiao19](https://github.com/yechunxiao19), -- [woodboow](https://github.com/woodboow), -- [SPccman](https://github.com/SPccman), -- [disylee](https://github.com/disylee), -- [cvsher](https://github.com/cvsher), -- [ThomazL](https://github.com/ThomazL), -- [Stevearzh](https://github.com/Stevearzh), -- [felixonmars](https://github.com/felixonmars), -- [scusjs](https://github.com/scusjs), -- [johnhoow](https://github.com/johnhoow), -- [hyaocuk](https://github.com/hyaocuk), -- [MikeCoder](https://github.com/MikeCoder), -- [theo-l](https://github.com/theo-l), -- [wangjiezhe](https://github.com/wangjiezhe), -- [jiajia9linuxer](https://github.com/jiajia9linuxer), -- [NearTan](https://github.com/NearTan), -- [l3b2w1](https://github.com/l3b2w1), -- [shipsw](https://github.com/shipsw), -- [boredivan](https://github.com/boredivan), -- [Love-xuan](https://github.com/Love-xuan), -- [JonathanKang](https://github.com/JonathanKang), -- [luoyutiantang](https://github.com/luoyutiantang), -- [owen-carter](https://github.com/owen-carter), -- [icybreaker](https://github.com/icybreaker), -- [tenght](https://github.com/tenght), -- [rogetfan](https://github.com/rogetfan), -- [liuaiping](https://github.com/liuaiping), -- [nd0104](https://github.com/nd0104), -- [szrlee](https://github.com/szrlee), -- [lfzark](https://github.com/lfzark), -- [ggaaooppeenngg](https://github.com/ggaaooppeenngg), -- [CNprober](https://github.com/CNprober), -- [coloka](https://github.com/coloka), -- [213edu](https://github.com/213edu), -- [guodongxiaren](https://github.com/guodongxiaren), -- [Tanete](https://github.com/Tanete), -- [zzlyzq](https://github.com/zzlyzq), -- [yujianxuechuan](https://github.com/yujianxuechuan), -- [ailurus1991](https://github.com/ailurus1991), -- [FineFan](https://github.com/FineFan), -- [shaohaolin](https://github.com/shaohaolin), -- [tomatoKiller](https://github.com/tomatoKiller), -- [CHINAANSHE](https://github.com/CHINAANSHE), -- [stduolc](https://github.com/stduolc), -- [Maclauring](https://github.com/Maclauring), -- [Hao-Ding](https://github.com/Hao-Ding), -- [zsJacky](https://github.com/zsJacky), -- [small-Wood](https://github.com/small-Wood), -- [cereuz](https://github.com/cereuz), -- [lijhg](https://github.com/lijhg), -- [fbigun](https://github.com/fbigun), +目前 TP 活跃成员有: +- CORE @wxy, +- CORE @carolinewuyan, +- CORE @DeadFire, +- CORE @geekpi, +- CORE @GOLinux, +- CORE @reinoir, +- CORE @bazz2, +- CORE @zpl1025, +- CORE @ictlyh, +- CORE @dongfengweixiao +- Senior @tinyeyeser, +- Senior @vito-L, +- Senior @jasminepeng, +- Senior @willqian, +- Senior @vizv, +- @ZTinoZ, +- @Vic020, +- @runningwater, +- @KayGuoWhu, +- @luoxcat, +- @alim0x, +- @2q1w2007, +- @theo-l, +- @FSSlc, +- @su-kaiyao, +- @blueabysm, +- @flsf, +- @martin2011qi, +- @SPccman, +- @wi-cuckoo, +- @Linchenguang, +- @linuhap, +- @crowner, +- @Linux-pdz, +- @H-mudcup, +- @yechunxiao19, +- @woodboow, +- @Stevearzh, +- @disylee, +- @cvsher, +- @wwy-hust, +- @johnhoow, +- @felixonmars, +- @TxmszLou, +- @shipsw, +- @scusjs, +- @wangjiezhe, +- @hyaocuk, +- @MikeCoder, +- @ZhouJ-sh, +- @boredivan, +- @goreliu, +- @l3b2w1, +- @JonathanKang, +- @NearTan, +- @jiajia9linuxer, +- @Love-xuan, +- @coloka, +- @owen-carter, +- @luoyutiantang, +- @JeffDing, +- @icybreaker, +- @tenght, +- @liuaiping, +- @mtunique, +- @rogetfan, +- @nd0104, +- @mr-ping, +- @szrlee, +- @lfzark, +- @CNprober, +- @DongShuaike, +- @ggaaooppeenngg, +- @haimingfg, +- @213edu, +- @Tanete, +- @guodongxiaren, +- @zzlyzq, +- @FineFan, +- @yujianxuechuan, +- @Medusar, +- @shaohaolin, +- @ailurus1991, +- @liaoishere, +- @CHINAANSHE, +- @stduolc, +- @yupmoon, +- @tomatoKiller, +- @zhangboyue, +- @kingname, +- @KevinSJ, +- @zsJacky, +- @willqian, +- @Hao-Ding, +- @JygjHappy, +- @Maclauring, +- @small-Wood, +- @cereuz, +- @fbigun, +- @lijhg, +- @soooogreen, -(更新于2014/12/02,以Github contributors列表排名) +LFS 项目活跃成员有: + +- @ictlyh +- @dongfengweixiao +- @wxy +- @H-mudcup +- @zpl1025 +- @KevinSJ +- @Yuking-net + +(更新于2015/06/09,以Github contributors列表排名) 谢谢大家的支持! diff --git a/published/20150126 Installing Cisco Packet tracer in Linux.md b/published/20150126 Installing Cisco Packet tracer in Linux.md new file mode 100644 index 0000000000..578f65f756 --- /dev/null +++ b/published/20150126 Installing Cisco Packet tracer in Linux.md @@ -0,0 +1,187 @@ +Linux中安装Cisco Packet Tracer +================================================================================ +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Main_picture.png) + +### Cisco Packet tracer是什么? ### + +**Cisco Packet Tracer**是一个强大的网络模拟工具,用于进行Cisco认证时的培训。它为我们提供了各个路由器和网络设备的良好的接口视图,这些模拟设备带有很多选项,跟使用物理机一样,我们可以在网络中使用无限的设备。我们能在单个工程中创建多个网络,以获得专业化的训练。Packet Tracer将提供给我们模拟的应用层协议,如**HTTP**,**DNS**,以及像**RIP**,**OSPF**,**EIGRP**等路由协议。 + +现在,它发布了包含有**ASA 5505防火墙**命令行配置的版本。Packet Tracer通常用于Windows版本,但没有Linux版本。这里,我们可以下载并安装Cisco Packet Tracer。 + +#### 新发布的Cisco Packet Tracer版本: #### + +下一代Cisco Packet Tracer版本将会是Cisco Packet Tracer 6.2,当前还处于开发中。 + +### 我的环境设置: ### + +**主机名** : desktop1.unixmen.com + +**IP地址** : 192.168.0.167 + +**操作系统** : Ubuntu 14.04 LTS Desktop + + # hostname + + # ifconfig | grep inet + + # lsb_release -a + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_001.png) + +### 步骤 1: 首先,我们需要下载Cisco Packet Tracer。 ### + +要从官方网站下载Packet Tracer,我们需要持有一个令牌,登入Cisco NetSpace,然后从Offering菜单选择CCNA > Cisco Packet Tracer来开始下载。如果我们没有令牌,可以从下面的链接中获得,我已经将它上传到了Droppox。 + +官方站点: [https://www.netacad.com/][1] + +大多数人没有下载Packet Tracer的令牌,出于该原因,我已经将它上传到了dropbox,你可以从下面的URL获得Packet Tracer。 + +[下载Cisco Packet Tracer 6.1.1][2] + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_002.png) + +### 步骤 2: 安装Java: ### + +要安装Packet Tracer,我们需要安装java。我们可以使用默认的仓库安装java;或者添加PPA仓库,然后更新包缓存来安装java。 + +使用以下命令来安装默认的jre + + # sudo apt-get install default-jre + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_003.png) + +(或者) + +使用下面的步骤来安装Java Run-time并设置环境。 + +从官方站点下载Java:[下载Java][3] + + # tar -zxvf jre-8u31-linux-x64.tar.gz + # sudo mkdir -p /usr/lib/jvm + # sudo mv -v jre1.8.0_31 /usr/lib/jvm/ + # cd /usr/lib/jvm/ + # sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.8.0_31/bin/java" 1 + # sudo update-alternatives --set "java" "/usr/lib/jvm/jre1.8.0_31/bin/java" + +通过编辑用户参数文件来设置Java环境,并添加路径相关的参数。当我们添加进用户参数文件后,我们机器上的每个用户都可以用java了。 + + # sudo vi /etc/profile + +将以下条目添加到/etc/profile文件中: + + export JAVA_HOME=/usr/lib/jvm/jre1.8.0_31 + export PATH=$PATH:/usr/java/jre1.8.0_31/bin + +运行以下命令来立即激活java路径。 + + # . /etc/profile + +检查Java版本和环境: + + # echo $JAVA_HOME + # java -version + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_004.png) + +### 步骤 3: 启用32位架构支持: ### + +对于Packet Tracer,我们需要一些32位包。要安装32位包,我们需要使用以下命令来安装一些依赖。 + + # sudo dpkg --add-architecture i386 + # sudo apt-get update + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_005.png) + + # sudo apt-get install libc6:i386 + # sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 + # sudo apt-get install libnss3-1d:i386 libqt4-qt3support:i386 libssl1.0.0:i386 libqtwebkit4:i386 libqt4-scripttools:i386 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_006.png) + +### 步骤 4: 解压并安装软件包: ### + +使用tar命令来解压下载的包。 + + # mv Cisco\ Packet\ Tracer\ 6.1.1\ Linux.tar.gz\?dl\=0 Cisco_Packet_tracer.tar.gz + + # tar -zxvf Cisco_Packet_tracer.tar.gz + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_007.png) + +导航到解压后的目录 + + # cd PacketTracer611Student + +现在,该开始安装了。安装过程很简单,只需几秒钟即可搞定。 + + # sudo ./install + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_008.png) + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_009.png) + +要使用Packet Tracer工作,我们需要设置环境,Cisco已经提供了环境脚本,我们需要以root用户来运行该脚本以设置环境变量。 + + # sudo ./set_ptenv.sh + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_010.png) + +安装到此结束。接下来,我们需要为Packet Tracer创建桌面图标。 + +通过创建下面的桌面文件来创建桌面图标。 + + # sudo su + # cd /usr/share/applications + # sudo vim packettracer.desktop + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_011.png) + +使用vim编辑器或你喜爱的那个编辑器来添加以下内容到文件。 + + [Desktop Entry] + Name= Packettracer + Comment=Networking + GenericName=Cisco Packettracer + Exec=/opt/packettracer/packettracer + Icon=/usr/share/icons/packettracer.jpeg + StartupNotify=true + Terminal=false + Type=Application + +使用wq!来保存并退出vim。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_012.png) + +### 步骤 5: 运行Packet Tracer ### + + # sudo packettracer + +好了,我们已经成功将Packet Tracer安装到Linux中。上述安装步骤适用于所有基于Debian的Linux发行版。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_013.png) + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/pkt_014.png) + +### 资源 ### + +主页:[Netacad][4] + +### 尾声: ### + +这里,我们展示了如何安装Packet Tracer到Linux发行版中。希望你们找到了将你们所钟爱的模拟器安装到Linux中的方法。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/installing-cisco-packet-tracer-linux/ + +作者:[babin][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/babin/ +[1]:https://www.netacad.com/ +[2]:https://www.dropbox.com/s/5evz8gyqqvq3o3v/Cisco%20Packet%20Tracer%206.1.1%20Linux.tar.gz?dl=0 +[3]:http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html +[4]:https://www.netacad.com/ diff --git a/published/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md b/published/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md new file mode 100644 index 0000000000..31d432f445 --- /dev/null +++ b/published/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md @@ -0,0 +1,64 @@ +iptraf:TCP/UDP网络监控工具 +================================================================================ +[iptraf][1]是一个基于ncurses开发的IP局域网监控工具,它可以生成各种网络统计数据,包括TCP信息、UDP统计、ICMP和OSPF信息、以太网负载信息、节点统计、IP校验和错误和其它一些信息。 + +它基于ncurses的用户界面也会把使用者从命令行选项的梦靥中拯救出来。 + +### 功能 ### + +- 一个用于显示通过网络的IP流量信息的IP流量监控器,包括TCP标识信息、包和字节统计、ICMP详情、OSPF包类型 +- 显示IP、TCP、UDP、ICMP、非IP和其它IP包计数、IP校验和错误、接口活动、包大小计数的综合详细的接口统计数据 +- 一个用于计数常用TCP和UDP应用端口的流入和流出包的TCP和UDP服务监控器 +- 一个用于发现活动主机和显示这些活动主机的数据活动的局域网统计模块 +- TCP、UDP和其它协议的显示过滤器,允许你查看你做感兴趣的流量 +- 日志记录 +- 支持以太网、FDDI、ISDN、SLIP、PPP和回环接口类型 +- 利用Linux内核内建的原生套接口界面,可以用于大范围支持的网卡 +- 全屏、菜单驱动操作 + +###要安装### + +**Ubuntu及其衍生版** + + sudo apt-get install iptraf + +**Arch Linux及其衍生版** + + sudo pacman -S iptra + +**Fedora及其衍生版** + + sudo yum install iptraf + +### 用法 ### + +如果**iptraf**命令不带任何命令行选项执行,该程序就会以交互模式显现,可以通过主菜单获得各种各样的工具。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_1.png) + +易于导航的菜单。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_2.png) + +选择监控的接口。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_3.png) + +来自**ppp0**接口的流量 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_4.png) + +希望你喜欢。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/iptraf-tcpudp-network-monitoring-utility/ + +作者:[Enock Seth Nyamador][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/seth/ +[1]:http://iptraf.seul.org/about.html diff --git a/translated/share/20140819 Top 4 Linux download managers.md b/published/201502/20140819 Top 4 Linux download managers.md similarity index 69% rename from translated/share/20140819 Top 4 Linux download managers.md rename to published/201502/20140819 Top 4 Linux download managers.md index 78c5b9ec12..5896665a80 100644 --- a/translated/share/20140819 Top 4 Linux download managers.md +++ b/published/201502/20140819 Top 4 Linux download managers.md @@ -1,17 +1,16 @@ -Translated By H-mudcup - -Linux排名前四的下载管理器 +Linux下的四大下载管理器 ================================================================================ -**改善并更好的管理你的网页下载,不论是镜像、抓取数据包还是仅仅更好的掌控你的文件。** +**改善你的网页下载,以便更好的管理文件镜像、批量下载还是仅仅希望更好的管理你的文件。** -下载管理器现在似乎已经是旧闻了,但是他们仍然非常有用。我们来比较一下Linux上排名前四的下载管理器。 +下载管理器现在似乎已经不新鲜了,但是他们仍然非常有用。我们来比较一下Linux上排名前四的下载管理器。 ### [uGet][1] ### -如同很多其他的Linux应用一样uGet把体积轻巧和功能全面作为宣传亮点。它能处理有着过滤器的多线程数据流,还能与任何网络浏览器进行整合。它从当初的UrlGet开始,如今已经经过了十年。它还能在Windows上运行。 +如同很多其他的Linux应用一样,uGet把体积轻巧和功能全面作为宣传亮点。它能处理多线程下载,支持过滤器,还能与任何网络浏览器进行整合。它从当初的UrlGet开始,如今已经经过了十年。它还能在Windows上运行。 ![uGet is actually very full-featured, with a lot of the kind of functions that advanced torrent clients use](http://www.linuxuser.co.uk/wp-content/uploads/2014/08/uget1.png) -uGet的功能其实非常全面,有很多先进的BT下载客户端所拥有的功能 + +*uGet的功能其实非常全面,有很多先进的BT下载客户端所拥有的功能* #### 界面 #### @@ -23,40 +22,41 @@ uGet让我们想起了许多BT下载客户端的界面:有着活跃、结束 #### 功能 #### -成熟的uGet完备了各种功能,包括按计划进行下载任务的启动和终止的高级功能,通过剪贴板批量下载,还能改变它在剪贴板里查找的文件的类型。虽然有插件选项,但不多。 +成熟的uGet完备了各种功能,包括按计划启动和终止下载任务的高级功能,通过剪贴板批量下载,还能改变它在剪贴板里查找的文件的类型。虽然有插件选项,但不多。 -#### 可得性 #### +#### 可获得性 #### -虽然在多数主要的发行版的软件库中都能得到它,但uGet网站上有着定期更新的适用于各种流行的发行版的二进制安装文件,还能轻易获得源代码。它的运行基于GTK 3+的图形库,所以它在某些桌面环境上的封装要比其他的小,然而我们得说,在KDE或其他Qt桌面上值得有这么一个额外的从属。 +虽然在多数主要的发行版的软件库中都能得到它,但uGet网站上有着定期更新的适用于各种流行的发行版的二进制安装文件,还能轻易获得源代码。它的运行基于GTK 3+的图形库,所以它在某些桌面环境上的封装要比其他的小,然而我们得说,在KDE或其他Qt桌面上值得为此添加额外的依赖库。 #### 总体评价 #### 8/10 -我们非常喜欢uGet——它种类繁多的功能和极高的人气,让它成为了能与Linux浏览器优雅结合的,万能的下载管理器。 +我们非常喜欢uGet——它种类繁多的功能和极高的人气,让它成为了能与Linux浏览器优雅结合的万能下载管理器。 ### [KGet][2] ### -KDE自家的下载管理器貌似原本是设计成与KDE的网页浏览器,Konqueror,一同工作的。它带来了我们这次测试中所期待的功能:多下载控制和对下载完成的文件计算校验和的能力。 +KDE自家的下载管理器貌似原本是设计成与KDE的网页浏览器 Konqueror 一同工作的。它带来了我们这次测试中所期待的功能:多下载控制和对下载完成的文件计算校验和的能力。 ![You need to manually activate the ability to keep an eye on the clipboard for links](http://www.linuxuser.co.uk/wp-content/uploads/2014/08/kget1.png) -你需要手动激活查看剪贴板中下载链接的功能 + +*你需要手动激活查看剪贴板中下载链接的功能* #### 界面 #### -作为一个备受期待的KDE应用软件,KGet用一贯的图标和线条,与桌面环境的审美风格完美融合。它的设计也相当简洁,在主工具栏里只显示最必要的功能,当前下载也以最小界面显示。 +作为一个备受期待的KDE应用软件,KGet采用一贯的图标和线条,与桌面环境的审美风格完美融合。它的设计也相当简洁,在主工具栏里只显示最必要的功能,当前下载也以最小界面显示。 #### 集成 #### -KGet会集成到本地的KDE的Konqueror浏览器里,虽然它并不是最流行的浏览器。Firefox对KGet的支持是一如往常的是通过FlashGot完成的,但是在Chromium里并没有任何一种方法能真正的将它集成进去。你可以打开一个询问你是否想下载已复制的URL的功能,然而KGet对于剪贴板的分析并不是很好,有的时候会把文本下载下来。 +KGet会集成到本地的KDE的Konqueror浏览器里,虽然它并不是最流行的浏览器。Firefox对KGet的支持是一如既往的是通过FlashGot完成的,但是在Chromium里并没有任何一种方法能真正的将它集成进去。你可以打开一个“询问你是否想下载已复制好的URL”的功能,然而KGet对于剪贴板的分析并不是很好,有的时候会把文本下载下来。 #### 功能 #### -能够选择的功能并不多。没有计划任务,没有批量下载,而且通常情况下,下载功能的数量几乎是光秃秃的。剪贴板扫描功能,想法很不错就是有点问题。设置菜单看起来有点怪怪的,因为它看起来应该设计有更多的功能。 +能够选择的功能并不多。没有计划任务,没有批量下载,基本上没有什么特色的下载功能。剪贴板扫描功能,想法很不错就是有点问题。设置菜单看起来有点怪怪的,因为它看起来应该设计有更多的功能。 -#### 可得性 #### +#### 可获得性 #### -虽然它不会随着KDE默认安装,但可以在任何支持KDE的发行版里得到它。虽然它的运行需要几个KDE库,找到它的源代码也很困难。支持如此少的发行版,二进制安装文件也没什么可选的。 +虽然它不会随着KDE默认安装,但可以在任何支持KDE的发行版里得到它。虽然它的运行需要几个KDE库,找到它的源代码也很困难。除了少数几个发行版之外也没有什么二进制安装文件。 #### 总体评价 #### @@ -66,14 +66,15 @@ KGet并没有真正的给予用户比大多数主流浏览器内置下载管理 ### [DownThemAll!][3] ### -经由Firefox的附件进入Linux的DownThemAll某种程度上可以说是跨平台。这让它只能通过Firefox使用,然而作为世界上最流行的浏览器之一,它这更加紧凑的集成也许正是某些人对下载管理器所期望的。 +经由Firefox的附属组件进入Linux的DownThemAll从某种程度上可以说是跨平台。这让它只能通过Firefox使用,然而作为世界上最流行的浏览器之一,它这更加紧凑的集成也许正是某些人对下载管理器所期望的。 ![There are actually a whole lot of options available for DownThemAll! that make it very flexible](http://www.linuxuser.co.uk/wp-content/uploads/2014/08/down1.png) -其实在DownThemALL!上有很多选项可以设置,这让它非常的灵活 + +*其实在DownThemALL!上有很多选项可以设置,这让它非常的灵活* #### 界面 #### -与Firefox的集成使得DownThemAll!的风格符合浏览器的审美标准,右键单击可以唤出普通下载和DownThemAll选项。额外的对话框菜单通常和Firefox使用相同的主题,然而主下载窗口则非常整洁并且是基于它本身的设计。 +与Firefox的集成使得DownThemAll!的风格符合浏览器的审美标准,右键单击可以唤出普通下载和DownThemAll选项。额外的对话框菜单通常和Firefox的主题风格一致,然而主下载窗口则非常整洁并采用了它自己的设计。 #### 集成 #### @@ -81,11 +82,11 @@ KGet并没有真正的给予用户比大多数主流浏览器内置下载管理 #### 功能 #### -拥有着能同时控制多个下载任务的能力,限制而不荒废带宽以及先进的自动或手动过滤功能,DownThemAll!有着一大堆有助于大规模下载的优秀功能。“一键”功能还让它能非常迅速的启动到预定的文件夹中的下载。这比普通下载功能快多了。 +拥有着能同时控制多个下载任务的能力,限制而不浪费带宽以及先进的自动或手动过滤功能,DownThemAll!有着一大堆有助于大规模下载的优秀功能。“一键”功能还让它能非常迅速的启动预定文件夹的下载。这比普通下载功能快多了。 -#### 可得性 #### +#### 可获得性 #### -Firefox几乎能在所有的发行版和Linux以外的操作系统中获得。这让DownThemAll!也和它一样多产。不幸的是,这是一把双刃剑,因为Firefox可能不是你喜欢的浏览器。它还给浏览器增加了一些负担,让它的启动不再那么轻松。 +Firefox几乎能在所有的发行版和Linux以外的操作系统中获得。这让DownThemAll!也和它一样多能。不幸的是,这是一把双刃剑,因为Firefox可能不是你喜欢的浏览器。它还给浏览器增加了一些负担,让它的启动不再那么轻松。 #### 总体评价 #### @@ -95,10 +96,11 @@ DownThemAll!是很优秀的,如果你使用Firefox你也许就不再需要用 ### [Steadyflow][4] ### -Steadyflow很容易在Ubuntu和一些基于Debian的发行版中获得,获取到它的方式可能受到了限制,但它在某些圈子里一直被认为是你能得到的任何发行版里最好的管理器。它能查找剪贴板里的URL,使用GNOME的预设代理,还有许多其他的功能。 +Steadyflow很容易在Ubuntu和一些基于Debian的发行版中获得,获取它的方式可能受到了一些制约,但它在某些圈子里一直被认为是你能得到的任何发行版里最好的管理器。它能查找剪贴板里的URL,使用GNOME的预设代理,还有许多其他的功能。 ![The settings in Steady flow are extremely limiting and somewhat difficult to access](http://www.linuxuser.co.uk/wp-content/uploads/2014/08/steady1.png) -Steady flow里的设置非常受限,而且有点难以使用。 + +*Steady flow里的设置非常少,而且有点难以使用。* #### 界面 #### @@ -112,7 +114,7 @@ Steadyflow的形象相当简洁,令人愉悦的、干净的界面并没有让 极度缺少功能,选项菜单也受到很大限制。暂停和恢复功能看起来也不怎么好使——这是任何浏览器文件下载功能的最基本的部分。文件下载结束的通知和默认行为是可以设置的,还可以选择在文件下载完成之后运行脚本。 -#### 可得性 #### +#### 可获得性 #### 只能在Ubuntu上获取,还不容易得到这个应用的源代码。这意味着虽然在所有基于Ubuntu的发行版中都能很容易的得到它,但也仅限于这些发行版。由于它不是Linux上能得到的最好的下载管理器,所以也不用想太多。 @@ -126,7 +128,7 @@ Steadyflow的形象相当简洁,令人愉悦的、干净的界面并没有让 #### uGet #### -在此次测试中,我们已经证明了现代电脑中还是有下载管理器的一席之地的,即便它们中的佼佼者们从BT下载客户端中抄袭了某些功能,貌似侵犯了他们的权益。对于某些人来说BT下载可能是个更有效率的方式,随着ISP们对待BT流量越来越机智,一些人可能用一个好的下载管理器就得到更好的效果。大多数主流ISP不仅仅强加了数据转移标记,在高峰时段他们中的一些甚至开始减慢或封掉BT流量——甚至连发行版的ISO文件和其他免费软件的合法数据流都被限制了。 +在此次测试中,我们已经证明了现代电脑中还是有下载管理器的一席之地的,即便它们中的佼佼者们从BT下载客户端中抄袭了某些功能,貌似侵犯了他们的权益。对于某些人来说BT下载可能是个更有效率的方式,随着ISP们对待BT流量越来越机智,一些人可能用一个好的下载管理器就得到更好的效果。大多数主流ISP不仅仅强加了数据传输限额,在高峰时段他们中的一些甚至开始减慢或封掉BT流量——甚至连发行版的ISO文件和其他免费软件的合法数据流都被限制了。 对于这类问题Steadyflow看起来是非常受欢迎的解决方式,但我们的使用和测试显示出,它是一个未完成的简陋的产品。更加古老的uGet则是这场表演的明星,有着惊人数量的可选功能,这些功能既能在下载单一文件中有所帮助,还能在整个网页里过滤出相关元素进行抓取。DownThemAll!与之类似,优秀的Firefox有加分,但它也离不开Firefox,有着几乎同级别的功能,但集成效果更好。 @@ -140,7 +142,7 @@ via: http://www.linuxuser.co.uk/reviews/top-4-linux-download-managers 作者:Rob Zwetsloot 译者:[H-mudcup](https://github.com/H-mudcup) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/share/20140821 What is a good EPUB reader on Linux.md b/published/201502/20140821 What is a good EPUB reader on Linux.md similarity index 65% rename from translated/share/20140821 What is a good EPUB reader on Linux.md rename to published/201502/20140821 What is a good EPUB reader on Linux.md index 2b919ee6bb..7c3c4ea287 100644 --- a/translated/share/20140821 What is a good EPUB reader on Linux.md +++ b/published/201502/20140821 What is a good EPUB reader on Linux.md @@ -1,25 +1,25 @@ Linux版EPUB阅读器 ================================================================================ -如果说用平板电脑看书尚属主流的话,那么在电脑上读书就非常少见了。专注阅读16世纪的书是非常困难的了,没人希望后台蹦出Facebook聊天窗口。但是如果你非要在电脑上打开电子书的话,那么你需要一个电子书阅读软件。大多数编辑支持使用EPUB格式来存放电子书(电子出版物)。幸运的书,linux上从不缺乏此类软件。以下书一些Linux上比较好的EPUB阅读软件。 +如果说用平板电脑看书尚属主流的话,那么在电脑上读书就非常少见了。专注阅读16世纪的书是非常困难的了,没人希望后台蹦出QQ聊天窗口。但是如果你非要在电脑上打开电子书的话,那么你需要一个电子书阅读软件。大多数出版物支持使用EPUB格式的电子书(电子出版物)。幸运的是,linux上从不缺乏EPUB阅读器类的软件。以下是一些Linux上不错的EPUB阅读软件。 ### 1. Calibre ### ![](https://farm6.staticflickr.com/5577/14975176155_0989766bb3_z.jpg) -先从列表中最有名的软件开始: [Calibre][1]。Calibre 不仅仅是个阅读器,他还是个电子图书馆。软件支持几乎所有的格式,集成了阅读器,管理器,一个可以从互联网下载书籍封面的元数据编辑器,一个EPUB编辑器,新闻阅读器和一个用来下载电子书的搜索引擎。可喜的是,界面丝毫不逊色专业的阅读软件。唯一的缺点书如果你只想要一个EPUB阅读器的话,这个软件还是太大了。 +先从列表中最有名的软件开始: [Calibre][1]。Calibre 不仅仅是个阅读器,它还是个电子图书馆。软件支持几乎所有的格式,集成了阅读器、管理器、一个可以从互联网下载书籍封面的元数据编辑器、一个EPUB编辑器、新闻阅读器和一个用来下载电子书的搜索引擎。可喜的是,界面丝毫不逊色专业的阅读软件。唯一的缺点是如果你只想要一个EPUB阅读器的话,这个软件还是太大了。 ### 2. FBReader ### ![](https://farm4.staticflickr.com/3900/14975176165_f2e4afd2fa_o.jpg) -[FBReader][2] 也是一个图书馆管理软件,但是比Calibre小。界面简洁分为两个部分:左边书文件管理、元数据编辑、和下载新书等功能;右边书阅读区。如果你喜欢简洁,这个软件挺不错。我个人非常喜欢这类直观标记书籍和分类的做法。 +[FBReader][2] 也是一个图书馆管理软件,但是比Calibre小。界面简洁分为两个部分:左边是文件管理、元数据编辑和下载新书等功能;右边是阅读区。如果你喜欢简洁,这个软件挺不错。我个人非常喜欢这类直观标记书籍和分类的做法。 ### 3. Cool Reader ### ![](https://farm6.staticflickr.com/5594/14975176195_ac46952150.jpg) -对于那些只想想看EPUB书内容的用户,我推荐 [Cool Reader][5]。遵循Linux应用程序的规则,Cool Reader 做了优化,每次只打开一个EPUB文件,可以使用简单的快捷键进行阅读和导航。由于程序书基于Qt开发的,所以他也遵循Qt的规则,需要大量的设置项。 +对于那些只想想看EPUB书内容的用户,我推荐 [Cool Reader][5]。遵循Linux应用程序的文化,Cool Reader 做了优化,每次只打开一个EPUB文件,可以使用简单的快捷键进行阅读和导航。由于程序书基于Qt开发的,所以他也遵循Qt的风格,需要大量的设置项。 ### 4. Okular ### @@ -31,19 +31,19 @@ Linux版EPUB阅读器 ![](https://farm4.staticflickr.com/3835/14788504789_e7c742fa20_z.jpg) -[pPub][4]是个老项目,Github上可以找到这个项目,他最后的更新已经是在两年前了。尽管如此,这个软件还是值得使用的,pPub是用Python编写的,基于GTK3和WebKit,是个简单轻量的软件。界面可能需要一些更新,不够简洁,但是内部却非常好。软件支持JavaScript。所以,谁来捡起这个项目呢? +[pPub][4]是个老项目,Github上可以找到这个项目,它最后的更新已经是在两年前了。尽管如此,这个软件还是值得使用的,pPub是用Python编写的,基于GTK3和WebKit,是个简单轻量的软件。界面可能需要一些更新,不够简洁,但是内部却非常好。软件支持JavaScript。所以,谁来捡起这个项目呢? ### 6. epub ### ![](https://farm4.staticflickr.com/3871/14788844378_16fb51a1b9_z.jpg) -如果你只是想快速简单的查看EPUB文件的内容,不关心任何图形化界面功能的话,最好使用命令行模式打开EPUB。[epub][6] 是一个用Python编写的阅读器,可以在终端环境读取EPUB文件的内容。软件可以在章节、页面见切换,没有其他的功能。这是最简洁的EPUB阅读器了。 +如果你只是想快速简单的查看EPUB文件的内容,不关心任何图形化界面功能的话,最好使用命令行模式打开EPUB。[epub][6] 是一个用Python编写的阅读器,可以在终端环境读取EPUB文件的内容。软件可以在章节、页面间切换,没有其他的功能。这是最简洁的EPUB阅读器了。 ### 7. Sigil ### ![](https://farm4.staticflickr.com/3921/14788640417_7940627871_z.jpg) -最后介绍的这个实际上不是个EPUB阅读器,应该是个独立的编辑器。[Sigil][7] 可以提取EPUB文件的内容并转换成其他格式:xhtml文本,图像,格式,还有其他的内容,比如音频等。界面比基本的阅读器复杂,但是功能还是比较丰富的。我很喜欢他的标签体系,如果你对网页比较熟悉的话,这个软件书很好使用的。 +最后介绍的这个实际上不是个EPUB阅读器,应该是个独立的编辑器。[Sigil][7] 可以提取EPUB文件的内容并将其分离成其他格式:xhtml文本、图像、css,及其他的内容比如音频等。界面比基本的阅读器复杂,但是功能还是比较丰富的。我很喜它的标签体系,如果你对网页比较熟悉的话,这个软件是很好使用的。 总结,有很多的开源的EPUB阅读器,有一些只有最基本的功能, 另外一些功能却太多了。一般来说,我建议你选择一个最合适的使用。如果你有更好的EPUB阅读器,请在评论里告诉我们! @@ -53,7 +53,7 @@ via: http://xmodulo.com/2014/08/good-epub-reader-linux.html 作者:[Adrien Brochard][a] 译者:[shipsw](https://github.com/shipsw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20140917 How to create a software RAID-1 array with mdadm on Linux.md b/published/201502/20140917 How to create a software RAID-1 array with mdadm on Linux.md similarity index 83% rename from translated/tech/20140917 How to create a software RAID-1 array with mdadm on Linux.md rename to published/201502/20140917 How to create a software RAID-1 array with mdadm on Linux.md index ddbdfc8689..4c183956d3 100644 --- a/translated/tech/20140917 How to create a software RAID-1 array with mdadm on Linux.md +++ b/published/201502/20140917 How to create a software RAID-1 array with mdadm on Linux.md @@ -1,10 +1,10 @@ 如何使用linux程序mdadm创建软件RAID1软阵列 ================================================================================ -磁盘冗余阵列(RAID)是将多个物理磁盘结合成一个逻辑磁盘的技术,该技术可以提高磁盘容错性能,提高磁盘的读写速度。根据数据存储的排列(如 条带存储,镜像存储,奇偶或者他们的组合),定义了几个不同级别的RAID(RAID-0,RAID-1,RAID-5 等等)。磁盘阵列可以使用软件或者硬件方式实现。现代Linux操作系统中,基本的软件RAID功能是默认安装的。 +磁盘冗余阵列(RAID)是将多个物理磁盘结合成一个逻辑磁盘的技术,该技术可以提高磁盘容错性能,提高磁盘的读写速度。根据数据存储的排列(如:条带存储,镜像存储,奇偶或者他们的组合),定义了几个不同级别的RAID(RAID-0,RAID-1,RAID-5 等等)。磁盘阵列可以使用软件或者硬件方式实现。现代Linux操作系统中,基本的软件RAID功能是默认安装的。 本文中,我们将介绍软件方式构建RAID-1阵列(镜像阵列),RAID-1将相同的数据写到不同的设备中。虽然可以使用同一个磁盘的两个分区实现RAID-1,但是如果磁盘坏了的话数据就都丢了,所以没什么意义。实际上,这也是为什么大多数RAID级别都使用多个物理磁盘提供冗余。当单盘失效后不影响整个阵列的运行,并且可以在线更换磁盘,最重要的是数据不会丢失。尽管如此,阵列不能取代外部存储的定期备份。 -由于RAID-1阵列的大小是最小磁盘的大小,一般来说应该使用两个大小相同的磁盘来组建RAID-1。 +由于RAID-1阵列的大小是阵列中最小磁盘的大小,一般来说应该使用两个大小相同的磁盘来组建RAID-1。 ### 安装mdadm ### @@ -28,7 +28,7 @@ # aptitude install mdadm -Ubuntu系统中,会要求为电子邮件通知配置后缀MTA。你可以跳过去。 +Ubuntu系统中,会要求配置Postfix MTA 以发送电子邮件通知。你可以跳过去。 Debian系统中,安装程序会显示以下解释信息,用来帮助我们去判断是否将根目录安装到RAID阵列中。下面的所有操作都有赖于这一步,所以应该仔细阅读他。 @@ -38,13 +38,13 @@ Debian系统中,安装程序会显示以下解释信息,用来帮助我们 ![](https://farm6.staticflickr.com/5555/15198241896_29e08b977f.jpg) -提示是否开机启动阵列的时候,选择是。注意,这里需要往/etc/fstab 文件中添加一个条目使得系统启动的时候正确挂载阵列。 +提示是否开机启动阵列的时候,选择“是”。注意,这里需要往/etc/fstab 文件中添加一个条目使得系统启动的时候正确挂载阵列。 ![](https://farm4.staticflickr.com/3875/15220883342_2b1d689a0a_z.jpg) ### 硬盘分区 ### -现在开始准备建立阵列需要的硬盘。这里往插入两个8GB的usb磁盘,使用dmesg命令设备显示设备 /dev/sdb 和 /dev/sdc +现在开始准备建立阵列需要的硬盘。这里插入两个8GB的usb磁盘,使用dmesg命令设备显示设备 /dev/sdb 和 /dev/sdc # dmesg | less @@ -107,7 +107,7 @@ Debian系统中,安装程序会显示以下解释信息,用来帮助我们 ![](https://farm6.staticflickr.com/5583/15034683868_6c28564e5a_z.jpg) -'mdadm -D'命令提供的信息中,最重要就是阵列状态类。激活状态说明阵列正在进行读写操作。其他几个状态分别为 完成(读写完成)、降级(有一块磁盘失效或丢失)或者恢复中(一张新盘已插入,系统正在写入数据)。这几个状态涵盖类大多数情况。 +'mdadm -D'命令提供的信息中,最重要就是阵列状态类。激活状态说明阵列正在进行读写操作。其他几个状态分别为:完成(读写完成)、降级(有一块磁盘失效或丢失)或者恢复中(一张新盘已插入,系统正在写入数据)。这几个状态涵盖了大多数情况。 ### 格式化或加载磁盘阵列 ### @@ -128,7 +128,7 @@ Debian系统中,安装程序会显示以下解释信息,用来帮助我们 mdadm工具内置有磁盘阵列监控功能。当mdadm作为守护程序运行的时候(就像我们上文那样),会周期性的检测阵列运行状态,将检测到的信息通过电子邮件或者系统日志报告上来。当然,也可以配置其在发生致命性错误的时候调用紧急命令。 -mdadm默认会记录所有已知分区和阵列的事件,并将他们记录到 /var/log/syslog中。或者你可以在配置文件中(/etc/mdadm/mdadm.conf debian系统 /etc/mdadm.conf 红帽子系统)以以下格式指定监控设备或者阵列。如果mdadm.conf文件不存在,你可以创建一个。 +mdadm默认会记录所有已知分区和阵列的事件,并将他们记录到 /var/log/syslog中。或者你可以在配置文件中(debian系统:/etc/mdadm/mdadm.conf ,红帽子系统:/etc/mdadm.conf )用以下格式指定监控设备或者阵列。如果mdadm.conf文件不存在,你可以创建一个。 DEVICE /dev/sd[bcde]1 /dev/sd[ab]1 @@ -169,7 +169,7 @@ CentOS或者RHEL 6: ![](https://farm6.staticflickr.com/5563/15218183681_63a10da704_z.jpg) -现在我们的阵列已经可以访问类,拷贝文件/etc/passwd到/mnt中测试一下: +现在我们的阵列已经可以访问了,拷贝文件/etc/passwd到/mnt中测试一下: ![](https://farm6.staticflickr.com/5593/15034475219_a3476aec0a_o.png) @@ -179,7 +179,7 @@ Debian系统中,需要在/etc/default/mdadm 设置 AUTOSTART 变量为 true ### 模拟磁盘丢失故障 ### -我们将使用以下命令卸载磁盘来模拟磁盘故障。注意,在实际应用中,磁盘已经上故障状态了,不需要卸载。 +我们将使用以下命令卸载磁盘来模拟磁盘故障。注意,在实际应用中,磁盘如果已经是故障状态了,不需要卸载。 首先,卸载阵列: @@ -190,7 +190,7 @@ Debian系统中,需要在/etc/default/mdadm 设置 AUTOSTART 变量为 true # mdadm /dev/md0 --fail /dev/sdb1 #Marks /dev/sdb1 as faulty # mdadm --remove /dev/md0 /dev/sdb1 #Removes /dev/sdb1 from the array -然后,如果你有个备用盘的话,重新添加以下: +然后,如果你有个备用盘的话,重新添加一下: # mdadm /dev/md0 --add /dev/sdb1 @@ -208,7 +208,7 @@ Debian系统中,需要在/etc/default/mdadm 设置 AUTOSTART 变量为 true # mdadm /dev/md0 --add /dev/sdb1 # mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 -希望本文对你有所帮助 +希望本文对你有所帮助。 -------------------------------------------------------------------------------- @@ -216,7 +216,7 @@ via: http://xmodulo.com/2014/09/create-software-raid1-array-mdadm-linux.html 作者:[Gabriel Cánepa][a] 译者:[shipsw](https://github.com/shipsw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20141029 How to Install and Setup My Weather Indicator in Ubuntu 14.10.md b/published/201502/20141029 How to Install and Setup My Weather Indicator in Ubuntu 14.10.md similarity index 83% rename from translated/tech/20141029 How to Install and Setup My Weather Indicator in Ubuntu 14.10.md rename to published/201502/20141029 How to Install and Setup My Weather Indicator in Ubuntu 14.10.md index 37c497511c..15c6896b3e 100644 --- a/translated/tech/20141029 How to Install and Setup My Weather Indicator in Ubuntu 14.10.md +++ b/published/201502/20141029 How to Install and Setup My Weather Indicator in Ubuntu 14.10.md @@ -1,10 +1,10 @@ -在Ubuntu 14.10中如何安装和配置‘My Weather Indicator’ +在Ubuntu 14.10中如何安装和配置‘天气信息指示器’ ================================================================================ ![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/10/my-weather-indicator.jpg) -**在Ubuntu桌面中不缺乏若干应用同时提供天气信息的方法,你可以使用Unity Dash和桌面应用,比如[Typhoon][1],来获得天气信息。** +**在Ubuntu桌面中有各种提供天气信息的方法,你可以使用Unity Dash和桌面应用来获得天气信息,比如[Typhoon][1]。** -但是可以提供快速查询天气状况和温度数据,并且只需要一次鼠标点击而获得大量气象数据的面板插件,是到目前为止Linux平台下最受欢迎的天气应用。 +但是可以提供快速查询天气状况和温度数据,并且只需要一次鼠标点击而获得大量气象数据的面板插件,才是到目前为止Linux平台下最受欢迎的天气应用。 Atareao开发的[My Weather Indicator][2]就是这类应用中的一个,也可以说是最好的一个。 @@ -18,7 +18,7 @@ My Weather Indicator无法从Ubuntu软件商店中直接获取。不过开发者 - 下载My Weather Indicator (.deb安装包) -为了确保你的应用最是最新版本,我建议将[Atareao PPA][3]添加到你的软件镜像源然后通过PPA来安装。 +为了确保你的应用是最新版本,我建议将[Atareao PPA][3]添加到你的软件镜像源,然后通过PPA来安装。 怎么做?**打开一个新的终端**窗口(Unity Dash > 终端,或者按Ctrl+Alt+T快捷键),然后**输入下面的两行命令**,期间你需要在提示处输入你的系统密码: @@ -36,7 +36,7 @@ My Weather Indicator无法从Ubuntu软件商店中直接获取。不过开发者 ![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/10/Screen-Shot-2014-10-27-at-17.39.07.jpeg) -如果你正在旅行(或者是出于聊天需要),**你可以添加一个第二地区**。这个设置和第一地区的设置相同,只不过是在“第二地区”的标签栏罢了。 +如果你正在旅行(或者是出于聊天的需要),**你可以添加一个第二地区**。这个设置和第一地区的设置相同,只不过是出现在“第二地区”的标签栏罢了。 在“**小部件设置**”区域勾选“**显示桌面小部件**”选项就会在你的桌面上添加一个小的天气小部件。小部件提供许多不同的皮肤,所以你一定要精心挑选你最喜欢的一个(注释:点击“确定”后对小部件的更改才会保存)。 @@ -55,7 +55,7 @@ My Weather Indicator使用[Open Weather Map][4]作为默认的天气数据提供 最后,在‘General Options‘标签页,你可以设置数据更新间隔、设置开机自动运行选项以及从两个图标中选择一个作为面板图标。 -如果你不喜欢该应用,你可以尝试[Linux下查看天气数据的方法][5]。 +如果你是命令行控,你也可以尝试[Linux下查看天气数据的方法][5]。 -------------------------------------------------------------------------------- @@ -63,7 +63,7 @@ via: http://www.omgubuntu.co.uk/2014/10/install-weather-indicator-ubuntu-14-10 作者:[Joey-Elijah Sneddon][a] 译者:[JonathanKang](https://github.com/JonathanKang) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20141030 Test drive Linux with nothing but a flash drive.md b/published/201502/20141030 Test drive Linux with nothing but a flash drive.md similarity index 83% rename from translated/tech/20141030 Test drive Linux with nothing but a flash drive.md rename to published/201502/20141030 Test drive Linux with nothing but a flash drive.md index 9c1c8684d6..602c99eb18 100644 --- a/translated/tech/20141030 Test drive Linux with nothing but a flash drive.md +++ b/published/201502/20141030 Test drive Linux with nothing but a flash drive.md @@ -1,7 +1,5 @@ 试试只用U盘加载Linux系统 ================================================================================ -![Penguins gathered together: Linux for the win](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png) -图片来源:Opensource.com 也许你听过Linux并对它有点好奇,终于想要实际体验一下,但可能不知道从哪儿开始。 @@ -9,25 +7,27 @@ 如果你手上正好有个U盘的话,那就可以试试做一个USB Linux启动盘。它是一个包含了整个操作系统并可以直接引导开机的U盘。创建它并不需要什么专业技术能力,让我们来看看怎么做,以及如何从USB引导进入Linux系统。 +![Penguins gathered together: Linux for the win](https://opensource.com/sites/default/files/styles/image-full-size/public/images/life/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png) + ### 你需要准备的 ### 除了一台台式机或笔记本电脑外,你还需要: - 一个空白的U盘-最好容量能有4GB或更多。 - 一个你想尝试的Linux发行版[ISO镜像][1](一种把所有磁盘内容打包起来的档案文件)。待会再详细介绍。 -- 一个叫[Unetbootin][2]的应用程序,它是一个开源的,跨平台的工具,用来创建USB启动盘。运行它并不需要启动Linux。在下面的教程中,我是在MacBook上运行的Unetbootiin。 +- 一个叫[Unetbootin][2]的应用程序,它是一个开源的,跨平台的工具,用来创建USB启动盘。运行它并不需要启动Linux。在下面的教程中,我是在MacBook上运行的Unetbootiin(LCTT 译注:它还有 Windows 和 Linux 版本)。 ### 开始干活 ### -把U盘插到你电脑的USB端口上,然后启动Unetbootin。然后会要求你输入电脑的登录密码。 +把U盘插到你电脑的USB端口上,然后启动Unetbootin。然后会要求你输入当前电脑的登录密码。 ![Unetbootin main window](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-main.png) -还记得之前提到的ISO镜像文件吗?有两种方式可以获得:要么自己从你想尝试的Linux发行版网站上下载,或者让Unetbootin帮你下载。还是选后者,在窗口顶部点击**选择发行版**,选择你想下载的发行版,然后点击**选择版本**来选择你希望尝试的发行版版本。 +还记得之前提到的ISO镜像文件吗?有两种方式可以获得:要么自己从你想尝试的Linux发行版网站上下载,或者让Unetbootin帮你下载。如果选后者,在窗口顶部点击**选择发行版**,选择你想下载的发行版,然后点击**选择版本**来选择你希望尝试的发行版版本。 ![Downloading a Linux distribution](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-download-distro.png) -或者,你也可以自己下载发行版。通常,我想尝试的Linux发行版都没有在列表中。如果选择另一个方向,点击**磁盘镜像**,然后点击按钮来选择你下载好的.iso文件。 +或者,你也可以自己下载发行版。通常,我想尝试的Linux发行版都没有在列表中。如果选择自己下载,那么点击**磁盘镜像**,然后点击按钮来选择你下载好的.iso文件。 注意到下面的选项**预留每次重新启动后保存文件的空间(仅Ubuntu有效)**吗?如果你尝试的是Ubuntu或它的任一个衍生版(比如Lubuntu或Xubuntu),你可以在U盘上留出几M空间用来保存文件,比如网页书签或你自己创建的文档。当用这个U盘下次启动Ubuntu的时候,你可以继续使用这些文件。 @@ -39,21 +39,21 @@ ### 检验USB启动盘 ### -这个时候,你需要拥抱一下自己内在的极客精神。不会太难,不过你将需要进入[BIOS][3]去偷看一下你电脑内部空间。你的电脑的BIOS会加载各种硬件,并控制电脑操作系统的引导或启动。 +这个时候,你需要拥抱一下自己内在的极客精神。这不会太难,不过你将需要进入[BIOS][3]去偷看一下你的电脑内部空间。你的电脑的BIOS会加载各种硬件,并控制电脑操作系统的引导或启动。 -BIOS通常会按这个顺序搜索操作系统(或者类似的顺序):硬盘,然后是CD/DVD光驱,然后是外部存储设备。你需要调整这个顺序,让外部存储设备(在这里,意味着你的U盘启动盘)成为BIOS第一个搜索的设备。 +BIOS通常会按这个顺序搜索操作系统(或者类似的顺序):硬盘,然后是CD/DVD光驱,然后是外部存储设备。你需要调整这个顺序,让外部存储设备(在这里,指的是你的U盘启动盘)成为BIOS第一个搜索的设备。 -要做到这个,把U盘插到电脑上再重启电脑。在看到提示信息**Press F2 to enter setup**之后,按它要求的做。在有的电脑上,这个键可能是F10。 +要做到这一点,请把U盘插到电脑上再重启电脑。在看到提示信息**Press F2 to enter setup**之后,按它要求的做。在有的电脑上,这个键可能是F10。 在BIOS里,用键盘上的向右方向键切换到**Boot**菜单。然后你将看到你电脑上的驱动器列表。使用键盘上的向下方向键选中名字为**USB HDD**的选项,然后按下**F6**移动这个选项到列表的顶部。 -完成后,按下**F10**来保存改动。然后你会从BIOS里被踢出来,然后电脑会自己启动。等一小会,你就会看到一个你正在尝试的Linux发行版的启动菜单。选择**Run without installing**(或者最接近的选项)。 +完成后,按下**F10**来保存改动。然后你会从BIOS里被踢出来,然后电脑会自己启动。等一小会,你就会看到一个你正在尝试的Linux发行版的启动菜单。选择**Run without installing**(或者最类似的选项)。 在进入桌面后,你可以连接上无线或有线网络,看看网页,试一试预装的软件。你还可以看看,比如说,你的打印机或扫描仪是否能在你试的这个发行版下正常工作。你要是真的想不开,也可以去摸一下命令行。 ### 能干什么 ### -根据你尝试的Linux发行版和你使用的U盘的速度,操作系统可能会需要更长的时间来加载,而且很可能比直接装到硬盘上会慢一点。 +根据你尝试的Linux发行版和你使用的U盘的速度,操作系统可能会需要较长的时间来加载,而且很可能比直接装到硬盘上会慢一点。 还有,你也只能运行Linux发行版里预装好的基本软件。通常会有网页浏览器,一个文字处理软件,一个文本编辑器,一个媒体播放器,一个相片浏览器,以及一套实用工具。这些应该足够给你使用Linux的感觉了。 @@ -65,7 +65,7 @@ via: https://opensource.com/life/14/10/test-drive-linux-nothing-flash-drive 作者:[Scott Nesbitt][a] 译者:[zpl1025](https://github.com/zpl1025) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20141108 Adding Ubuntu 14.10, Ubuntu 14.04 and Debian 7 to PXE Network Boot Environment Setup on RHEL or CentOS 7.md b/published/201502/20141108 Adding Ubuntu 14.10, Ubuntu 14.04 and Debian 7 to PXE Network Boot Environment Setup on RHEL or CentOS 7.md similarity index 91% rename from translated/tech/20141108 Adding Ubuntu 14.10, Ubuntu 14.04 and Debian 7 to PXE Network Boot Environment Setup on RHEL or CentOS 7.md rename to published/201502/20141108 Adding Ubuntu 14.10, Ubuntu 14.04 and Debian 7 to PXE Network Boot Environment Setup on RHEL or CentOS 7.md index 35936459d3..e131acbbc7 100644 --- a/translated/tech/20141108 Adding Ubuntu 14.10, Ubuntu 14.04 and Debian 7 to PXE Network Boot Environment Setup on RHEL or CentOS 7.md +++ b/published/201502/20141108 Adding Ubuntu 14.10, Ubuntu 14.04 and Debian 7 to PXE Network Boot Environment Setup on RHEL or CentOS 7.md @@ -1,24 +1,26 @@ 添加Ubuntu 14.10,Ubuntu 14.04和Debian 7到RHEL/CentOS 7的PXE网络启动环境 ================================================================================ 本教程将指引你添加**Ubuntu 14.10 Server, Ubuntu 14.04 Server**和**Debian 7 Wheezy**发行版到**RHEL/CentOS 7**的PXE网络启动环境中。 + ![Add Ubuntu and Debian to PXE Network](http://www.tecmint.com/wp-content/uploads/2014/11/Add-Ubuntu-and-Debian-to-PXE.png) -添加Ubuntu和Debian到PXE网络 + +*添加Ubuntu和Debian到PXE网络* 虽然对于本教程,我只会演示怎样来添加**64位**网络安装镜像,但对于Ubuntu或者Debian的**32位**系统,或者其它架构的镜像,操作步骤也基本相同。同时,就我而言,我会解释添加Ubuntu 32位源的方法,但不会演示配置。 从PXE服务器安装 **Ubuntu**或者**Debian**要求你的客户机必须激活网络连接,最好是使用**DHCP**通过**NAT**来进行动态分配地址。以便安装器拉取所需的包并完成安装过程。 -#### 需求 #### +#### 前置阅读 #### - [在RHEL/CentOS 7中为多种Linux发行版安装PXE网络启动服务器][1] ## 步骤 1: 添加Ubuntu 14.10和Ubuntu 14.04服务器到PXE菜单 ## -**1.** 为**Ubuntu 14.10**和**Ubuntu 14.04**添加网络安装源到PXE菜单可以通过两种方式实现:其一是通过下载Ubuntu CD ISO镜像并挂载到PXE服务器机器上以便可以读取Ubuntu网络启动文件,其二是通过直接下载Ubuntu网络启动归档包并将其解压缩到系统中。下面,我将进一步讨论这两种方法: +**1.** 要将**Ubuntu 14.10**和**Ubuntu 14.04**添加网络安装源到PXE菜单可以通过两种方式实现:其一是通过下载Ubuntu CD ISO镜像并挂载到PXE服务器机器上,以便可以读取Ubuntu网络启动文件,其二是通过直接下载Ubuntu网络启动归档包并将其解压缩到系统中。下面,我将进一步讨论这两种方法: ### 使用Ubuntu 14.10和Ubuntu 14.04 CD ISO镜像 ### -为了能使用此方法,你的PXE服务器需要有一台可工作的CD/DVD驱动器。在一台专有计算机上,转到[Ubuntu 14.10下载][2]和[Ubuntu 14.04 下载][3]页,获取64位**服务器安装镜像**,将它烧录到CD,并将CD镜像放到PXE服务器DVD/CD驱动器,然后使用以下命令挂载到系统。 +为了能使用此方法,你的PXE服务器需要有一台可工作的CD/DVD驱动器(LCTT 译注:也可以不用,参考下面内容)。在一台专用的计算机上,转到[Ubuntu 14.10下载][2]和[Ubuntu 14.04 下载][3]页,获取64位**服务器安装镜像**,将它烧录到CD,并将CD镜像放到PXE服务器DVD/CD驱动器,然后使用以下命令挂载到系统。 # mount /dev/cdrom /mnt @@ -160,16 +162,20 @@ 下面是**Ubuntu 14.04**PXE客户端安装测试的截图。 ![Select Ubuntu from PXE Menu](http://www.tecmint.com/wp-content/uploads/2014/11/Select-Ubuntu-from-PXE-Menu.jpg) -从PXE菜单选择Ubuntu + +*从PXE菜单选择Ubuntu* ![Choose Ubuntu Installation Language](http://www.tecmint.com/wp-content/uploads/2014/11/Select-Ubuntu-Installation-Language.jpg) -选择Ubuntu安装语言 + +*选择Ubuntu安装语言* ![Choose Ubuntu Rescue Mode](http://www.tecmint.com/wp-content/uploads/2014/11/Select-Ubuntu-Rescue-Mode.jpg) -选择Ubuntu救援模式 + +*选择Ubuntu救援模式* ![Ubuntu Rescue Mode Shell](http://www.tecmint.com/wp-content/uploads/2014/11/Ubuntu-Rescue-Mode-Shell.jpg) -Ubuntu救援模式Shell + +*Ubuntu救援模式Shell* ## 步骤 2: 添加Debian 7 Wheezy到PXE菜单 ## @@ -184,7 +190,8 @@ Ubuntu救援模式Shell # wget http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-amd64/current/images/netboot/netboot.tar.gz ![Download Debain 7 Netboot](http://www.tecmint.com/wp-content/uploads/2014/11/Download-Debain-7-Netboot.jpg) -下载Debian 7网络启动包 + +*下载Debian 7网络启动包* **6.** 在**wget**下载完成**netboot.tar.gz**文件后,请将其解压缩并运行以下命令拷贝**debian-installer**目录到tftp服务器默认路径。 @@ -192,10 +199,12 @@ Ubuntu救援模式Shell # cp -rf debian-installer/ /var/lib/tftpboot/ ![Extract Debain 7 Netboot](http://www.tecmint.com/wp-content/uploads/2014/11/Extract-Debain-7-Netboot.jpg) -解压缩Debian 7网络启动包 + +*解压缩Debian 7网络启动包* ![Copy Debain 7 Netboot to FTP](http://www.tecmint.com/wp-content/uploads/2014/11/Copy-Debain-7-Netboot-to-FTP.jpg) -拷贝Debian 7网络启动文件到FTP + +*拷贝Debian 7网络启动文件到FTP* **7.** 要添加**Debian Wheezy**标签到**PXE菜单**,请用你最喜爱的文本编辑器打开PXE服务器默认配置文件并添加以下标签。 @@ -214,7 +223,8 @@ Debian Wheezy 64位的PXE标签菜单。 append auto=true priority=critical vga=788 initrd=debian-installer/amd64/initrd.gz -- quiet ![Add Debian to PXE Boot](http://www.tecmint.com/wp-content/uploads/2014/11/Add-Debian-to-PXE-Boot.jpg) -添加Debian到PXE启动 + +*添加Debian到PXE启动* **注**:如果你想要添加其它Debian架构,请重复上述步骤,并相应替换PXE默认菜单配置文件中的标签号和**debian-installer/$architecture_name/**目录。 @@ -225,10 +235,12 @@ Debian Wheezy 64位的PXE标签菜单。 **9.** 然后通过网络启动一台客户机,选择从PXE菜单安装Debian,并像正常安装一样进一步下去。 ![Select Install Debian from PXE](http://www.tecmint.com/wp-content/uploads/2014/11/Select-Install-Debian-from-PXE.jpg) -选择从PXE安装Debian + +*选择从PXE安装Debian* ![Select Debian Install Language](http://www.tecmint.com/wp-content/uploads/2014/11/Select-Debian-Install-Language.jpg) -选择Debian安装语言 + +*选择Debian安装语言* 以上是要求添加并从RHEL/CentOS 7 PXE服务器安装**Ubuntu**或**Debian**到客户机上的全部步骤。在我的下一篇文章中,我将讨论一种更为复杂的方法,如何使用RHEL/CentOS 7 PXE网络启动服务器来安装**Windows 7**到客户机。 @@ -243,7 +255,7 @@ via: http://www.tecmint.com/add-ubuntu-to-pxe-network-boot/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.tecmint.com/author/cezarmatei/ -[1]:http://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/ +[1]:http://linux.cn/article-4902-1.html [2]:http://releases.ubuntu.com/14.10/ [3]:http://releases.ubuntu.com/14.04/ [4]:http://cdimage.ubuntu.com/netboot/14.10/ diff --git a/published/201502/20141114 How To Use Emoji Anywhere With Twitter's Open Source Library.md b/published/201502/20141114 How To Use Emoji Anywhere With Twitter's Open Source Library.md new file mode 100644 index 0000000000..ab8046d43e --- /dev/null +++ b/published/201502/20141114 How To Use Emoji Anywhere With Twitter's Open Source Library.md @@ -0,0 +1,91 @@ +怎样通过 Twitter 的开源库来随处使用 Emoji 表情符号 +================================================================================ +> 通过 GitHub 将它们嵌入到网页和其他项目中。 + +![](http://a3.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2OTIyNTI3MjcxNTU1.png) + +Emoji, 来自日本的小巧符号,通过图像表达感情,已经征服了移动互联网的信息世界。 + +现在,你可以在虚拟世界中随处使用它们了。 Twitter 最近[开源了][1]他们的 emoji 符号库,使得你可以在你自己的网站,应用,和项目中使用它们。 + +但这需要一点体力活。 Unicode 已经识别甚至标准化了 emoji 字母表, 然而 emoji 仍然[不能完全与所有的网络浏览器相兼容][2],这意味着大多数情况下,它们将呈现为 “豆腐块”或“空白盒子”。当 Twitter 想使得 emoji 到处可用时,这家社交网络联合了一家名为[Icon Factory][3]的公司来渲染浏览器以模仿文本信息符号的效果。Twiter 认为人们对他们的 emoji 库有很大的需求。 + +现在, 你可以从 [GitHub][4] 上克隆 Twitter 的整个库,从而在你的开发项目中使用它们。 下面将为你介绍如何达到上面的目的以及如何使得 emoji 更容易被使用。 + +### 为 Emoji 得到 Unicode 支持 ### + +Unicode 是国际编码标准,它为任意的符号、字母或人们想在网络上使用的数字配置了一串编码。换句话说,它是你如何在计算机上阅读文本与计算机如何读取文本之间的缺失环节。例如,对于你正看到的位于这些句子中的`空格`(LCTT 译注:英文分词中间的空格),计算机读取为 “ ”。 + +Unicode 甚至拥有其自己的[原始 emoji][5],它们可以在没有你的任何努力的情况下在浏览器中被阅读。例如,当你看到了 一个 ❤ 符号,你的计算机正在解码字符串 “2665” 。 + +要在大多数情况下使用 Twitter 的 emoji 库,你只需在你的 HTML 网页中的 ``块中添加如下脚本: + + + +这样就使得你的项目可以访问包含有已经在 Twitter 中可使用的数以百计的 Emoji 符号的 JavaScript 库。然而,创建一个仅仅包含这个脚本的文档并不能使得在你的网站中呈现出 emoji 符号,实际上,你仍需要嵌入这些 emoji 符号! + +在 ``块中,粘贴一些可以在 Twitter 的[preview.html 文件源代码][6] 中找到的 emoji 字符串。我使用了 🎹 和 🏁,当然我并不知道在浏览器窗口中它们的样子。是的,你必须粘贴并猜测它们。你已经看出了问题,我们将在第二小节中予以解决。 + +无论如何,通过一些尝试,你可以将一个如下图的原始 HTML 文件--- + +![](http://a4.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODQyNTMzNTQ1OTk0.png) + +---显示为如下图的网页: + +![](http://a1.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODExNjYzNDU1NTA2.png) + +### 将 Emoji 转换为可阅读的语言 ### + +对于一个网站或应用,Twitter 的解决方案是非常适用的。但如果你想通过 HTML 轻易地插入你喜爱的 emoji 符号,你需要一个更易实现的解决方案,而不是记住所有代表 emoji 的 Unicode 字符串。 + +那正是程序员 Elle Kasai 的 [Twemoji Awesome][7] 样式大展身手的地方。 + +通过向任意网页中添加 Elle 的开源样式表,你可以适用 英语单词来理解你正插入的 emoji 符号的意义。所以如若你想展示一个 心形 emoji 符号,你可以简单地输入: + + + +为了实现上面的目的,让我们下载 Elle 的项目,通过点击在 GitHub 上 “Download ZIP” 按钮。 + +接着,我们在桌面上新建一个文件夹,然后进入该文件夹,并将 emoji.html---我先前向你展示的 HTML 源文件--- 和 Elle 的 [twemoji-awesome.css][8] 一同放进去。 + +我们还需要 HTML 文件识别这个 CSS 文件,所以在 html 网页中的 `` 块中,为 CSS 文件添加一个链接: + + + +一旦你将上面的代码添加了进去,你便可以删除先前添加的 Twitter 的脚本链接。 + +现在,找到 `body` 块部分的代码,然后添加一些 emoji 符号。我使用了 ``, ``, `` 和 ``。 + +最终,你将得到如下的代码: + +![](http://a2.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODcyMDYxNDU2MzU0.png) + +保存并在浏览器中查看上面的文件: + +![](http://a1.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODExOTMxODkwOTYy.png) + +Duang!这样你不仅得到了一个可以在浏览器中支持 emoji 符号的基本网页,而且还知道了如何简单地实现它。你可以随意的在[我的 GitHub][9] 中查看这个教程,并且可以克隆这些实际的文件而不只是看看这些截图。 + +题图来自于[得到 Emoji][10]; Lauren Orsini 截图。 + +-------------------------------------------------------------------------------- + +via: http://readwrite.com/2014/11/12/how-to-use-emoji-in-the-browser-window + +作者:[Lauren Orsini][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://readwrite.com/author/lauren-orsini +[1]:https://blog.twitter.com/2014/open-sourcing-twitter-emoji-for-everyone +[2]:http://www.unicode.org/reports/tr51/full-emoji-list.html +[3]:https://twitter.com/iconfactory +[4]:https://github.com/twitter/twemoji +[5]:http://www.unicode.org/reports/tr51/full-emoji-list.html +[6]:https://github.com/twitter/twemoji/blob/gh-pages/preview.html +[7]:http://ellekasai.github.io/twemoji-awesome/ +[8]:https://github.com/ellekasai/twemoji-awesome/blob/gh-pages/twemoji-awesome.css +[9]:https://github.com/laurenorsini/Emoji-Everywhere +[10]:http://getemoji.com/ diff --git a/translated/tech/20141120 How to install Xen hypervisor on unused old hardware.md b/published/201502/20141120 How to install Xen hypervisor on unused old hardware.md similarity index 82% rename from translated/tech/20141120 How to install Xen hypervisor on unused old hardware.md rename to published/201502/20141120 How to install Xen hypervisor on unused old hardware.md index 87a28c57fc..f26d753e00 100644 --- a/translated/tech/20141120 How to install Xen hypervisor on unused old hardware.md +++ b/published/201502/20141120 How to install Xen hypervisor on unused old hardware.md @@ -1,11 +1,11 @@ - 怎样在废旧的硬件上安装 Xen 虚拟机监视器 ================================================================================ -Xen 是一个直接运行在硬件上的虚拟机监视器,这意味着你必须准备一个裸机来安装和运行 Xen。KVM 和 Xen 有一些不同 —— 你可以把它安装在任何已经正在运行 Linux 的机器上。本教程描述了如何在废旧的硬件上安装和配置 Xen 虚拟机监视器。 +Xen 是一个直接运行在硬件上的虚拟机监视器,这意味着你必须准备一个裸机来安装和运行 Xen。而 KVM 则和 Xen 有一些不同 —— 你可以把它添加到任何已经正在运行 Linux 的机器上。本教程描述了如何在废旧的硬件上安装和配置 Xen 虚拟机监视器。 整个安装过程使用 Debian Jessie(Debian 的测试发行版)作为宿主机操作系统(也称作 [Dom0][1])。Jessie 并不是唯一的选择 —— Xen 的支持是内建在 Linux 内核中的,[许多 Linux 发行版][2] 都包含支持 Xen 的内核。 ### 找点废旧的硬件 ### + 首先,找一个可以格式化的合适的工作站,比如一台旧的笔记本或者台式机。旧的硬件可能不适合玩游戏,但是足够安装一个宿主机和一些客户机了。一个满足下面这些要求的 PC 机就可以了。 - 一个双核 CPU(64 位) @@ -14,7 +14,7 @@ Xen 是一个直接运行在硬件上的虚拟机监视器,这意味着你必 - 能够从 CD,DVD 或者 USB 引导启动 - 一块网卡 -注意 CPU 必须是 64 位的,因为 Debian 已经不再支持 32 位的 Xen 安装包。如果你没有空余的硬件,你可以花点钱投资一台旧机器。2010 年值 $1000 的旗舰级笔记本现在只需要 $100。从 eBay 买台二手笔记本并升级下内存也可以满足需求。 +注意 **CPU 必须是 64 位的,因为 Debian 已经不再支持 32 位的 Xen 安装包**。如果你没有空余的硬件,你可以花点钱买一台旧机器。2010 年值 $1000 的旗舰级笔记本现在只需要 $100。从 eBay 买台二手笔记本并升级下内存也可以满足需求。 ### 刻录一个引导 CD/USB ### @@ -41,19 +41,19 @@ Xen 是一个直接运行在硬件上的虚拟机监视器,这意味着你必 这里的设置使用了四个分区。自动安装时通常会创建一个包含逻辑分区的扩展分区。像下面这样给硬盘分四个区。 - sda1 挂载至 /boot,200MB -- sda2 /, 20GB, Ubuntu 占用 4GB -- sda3 swap, 6GB (4GB x 1.5 = 6) +- sda2 做为 /, 20GB, Ubuntu 占用 4GB +- sda3 做为 swap, 6GB (4GB x 1.5 = 6) - sda4 保留用作 LVM, 不挂载,大小为剩余的硬盘大小 ### 安装基本的系统 ### -这里尽可能的让系统的安装更简单快速一些。一个基本的工作用系统可以稍后再添加。Debian 的 APT(Advanced Package Tool)使得添加软件非常的简单。在一个工作站上安装 Deibian 可能会有一些很浪费时间的问题。可能显卡驱动与内核不监控或者可能老旧的 CD-ROM 驱动器只能间歇性的工作。 +这里尽可能的让系统的安装更简单快速一些。一个基本的工作用系统可以稍后再添加。Debian 的 APT(Advanced Package Tool)使得添加软件非常的简单。在机器上安装 Debian 可能会有一些很浪费时间的问题。可能显卡驱动与内核不监控或者可能老旧的 CD-ROM 驱动器只能间歇性的工作。 当选择安装软件时,选择安装一个 SSH 服务器,不要安装桌面环境如 Gnome。 ![](https://farm9.staticflickr.com/8541/15176520633_5d31beda9c_z.jpg) -安装一个图形桌面需要安装成百上千的包 —— 这些额外的工作可以稍后再进行。如果你遇到问题了,等到图形桌面的安装会浪费很多事件。同时,没有桌面组件,系统的启动可以更快一些 —— 只需要几十秒而不是几分钟。整个安装过程会需要重启几次,因此这样做可以节省不少时间。 +安装一个图形桌面需要安装成百上千的包 —— 这些额外的工作可以稍后再进行。如果你遇到问题了,等待图形桌面的安装会浪费很多时间。同时,没有桌面组件,系统的启动可以更快一些 —— 只需要几十秒而不是几分钟。整个安装过程会需要重启几次,因此这样做可以节省不少时间。 一个 SSH 服务器可以让你从另一台电脑来配置这台工作站。这可以避免一些旧硬件的问题 —— 可能旧机器的键盘少了几个键,LCD 屏幕有坏点或者触摸板没有反应等等。 @@ -79,9 +79,9 @@ Xen 是一个直接运行在硬件上的虚拟机监视器,这意味着你必 检查 LVM 状态。 - # pvs (to view information about physical volumes) - # vgs (to view information about volume groups) - # lvs (to view information about logical volumes) + # pvs (查看物理卷的信息) + # vgs (查看卷组的信息) + # lvs (查看逻辑卷的信息) ### 添加一个 Linux 网桥 ### @@ -92,7 +92,6 @@ Xen 是一个直接运行在硬件上的虚拟机监视器,这意味着你必 # apt-get install bridge-utils 查看在哪块网卡配置桥接。 -See what interfaces are configured. # ip addr @@ -156,13 +155,13 @@ See what interfaces are configured. ![](https://farm8.staticflickr.com/7535/15794086091_bf1bce6b4b_z.jpg) -第一个选项会在 5 秒钟内自动启动(在 /etc/default/grub 的 GRUB_TIMEOUT 这行设置),因此这点时间还来不及喝咖啡的。 +第一个选项会在 5 秒钟内自动启动(在 /etc/default/grub 的 GRUB_TIMEOUT 这行设置),因此这点时间可来不及喝咖啡。 按下方向键选择 "Debian GNU/Linux, with Xen hypervisor" 这个选项,然后按回车。这时屏幕会出现很多行信息,接着是正常的登录界面。 ### 检查 Xen 工作是否正常 ### -Xen 虚拟机监视器嗲有一个管理 Xen 的命令行工序叫做 xl,可以用来创建和管理 Xen 虚拟机。使用 xl 命令来检查 Xen 是否成功安装了。 +Xen 虚拟机监视器带有一个管理 Xen 的命令行程序叫做 xl,可以用来创建和管理 Xen 虚拟机。使用 xl 命令来检查 Xen 是否成功安装了。 以 root 用户登录,执行: @@ -206,9 +205,11 @@ Xen 虚拟机监视器嗲有一个管理 Xen 的命令行工序叫做 xl,可 ### 最后 ### -如果你使用这台主机作为你的工作站,可以安装一个图形桌面。Debian 包好几种[桌面环境][6]。如果你想要一个包含所有东西的图形桌面,那么安装 Gnome 吧。如果图形效果并不是你的菜,试试 Awesome 吧。 +如果你使用这台主机作为你的工作站,可以安装一个图形桌面。Debian 包括好几种[桌面环境][6]。如果你想要一个包含所有东西的图形桌面,那么安装 Gnome 吧。如果它的图形效果并不是你的菜,试试 Awesome 吧。 -注意 Debian 的默认 Gnome 环境有大量的额外应用程序包括办公套件 LibreOffice,Iceweasel 浏览器和 Rhythmbox 音乐播放器。安装命令 "apt-get install gnome" 会安装 1,000 多个包并需要将近 2GB 的硬盘空间。运行这个重量级的桌面环境需要占用 1GB 的内存。 +注意 Debian 的默认 Gnome 环境有大量的额外应用程序包括办公套件 LibreOffice,Iceweasel 浏览器和 Rhythmbox 音乐播放器。安装命令 "apt-get install gnome" 会安装 1,000 多个包并需要将近 2GB 的硬盘空间。运行这个重量级的桌面环境需要占用 1GB 的内存。 + +(LCTT 译注:本文没有涉及如何安装 guest 虚拟机,请关注后继文章) -------------------------------------------------------------------------------- @@ -216,7 +217,7 @@ via: http://xmodulo.com/install-xen-hypervisor.html 作者:[Nick Hardiman][a] 译者:[Liao](https://github.com/liaoishere) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201502/20141203 Undelete Files on Linux Systems.md b/published/201502/20141203 Undelete Files on Linux Systems.md new file mode 100644 index 0000000000..59367ed918 --- /dev/null +++ b/published/201502/20141203 Undelete Files on Linux Systems.md @@ -0,0 +1,127 @@ +怎样在 Linux 系统中恢复已删除文件 +================================================================================ + +当用户意外地删除了一个仍然需要的文件时,大多数情况下,是没有简便的方法可以重新找回或重建这个文件。不过,幸运的是文件是可以通过一些方法恢复的。当用户删除了一个文件,该文件并没有消失,只是被隐藏了一段时间。 + +这里将解释它是如何工作的。在一个文件系统中,有一个叫做 `文件分配表` 的东西,这个表跟踪文件在存储单元(如硬盘, MicroSD 卡,闪存驱动器等等)中的位置。当一个文件被删除,文件系统将会在`文件分配表`中执行以下两个任务之一:这个文件在`文件分配表`上的条目被标记为 “自由空间” 或删除`文件分配表`里这个文件的条目,且将相应的空间被标记为自由空间 。现在,如果有一个新的文件需要被放置在一个存储单元上,操作系统将会把这个文件放置到标记为空位的地方。在新文件被写入到这个空位后,被删除的文件就彻底消失了。当需要恢复一个已经删除的文件时,用户绝对不能再对任何文件进行操作,因为假如该文件对应的“空位”被占用,这个文件就永远也不能恢复了。 + +### 恢复软件是如何工作的? ### + +大多数的文件系统(在删除文件时)只是标记空间为空白。在这些文件系统下,恢复软件查看`文件分配表`这个文件,然后复制被删除的文件到另外的存储单元中。假如该文件被复制到其它需要恢复的被删除的存储单元中,那么用户将有可能会失去那个所需的删除文件。 + +文件系统很少会擦除`文件分配表`中的条目。假如文件系统真的这样做了, 这便是恢复软件在恢复文件了。恢复软件在存储单元中扫描文件头,所有文件都拥有一个特殊的编码字符串,它们位于文件的最前面,也被叫做 `魔法数字`。例如,一个编译的 JAVA 类文件的魔法数字在十六进制中是“CAFEBABE”。所以,假如要恢复该类型的文件,恢复软件会查找 “CAFEBABE” 然后复制文件到另一个存储单元。一些恢复软件可以查找某种特殊的文件类型。若用户想恢复一个 PDF 文件,则恢复软件将会查找十六进制的魔法数字 “25504446”,这恰恰是 ASCII 编码中的 “%PDF”。恢复软件将会查找所有的魔法数字,然后用户可以选择恢复哪个已删除的文件。 + +假如一个文件的部分被覆写了,则整个文件就会被损坏。通常这个文件可以被恢复,但是其中的内容可能已经没有什么用处。例如,恢复一个已损坏的 JPEG 文件将会是无意义的,因为图片查看器不能从这个损坏的文件产生一幅图片。因此,即使用户拥有了这个文件,该文件也将毫无用处。 + +### 设备的位置:### + +在我们继续之前,下面的一些信息将会对指引恢复软件找到正确的存储单元起到一定的帮助。所有的设备均挂载在 `/dev/` 目录下。操作系统赋予每个设备的名称(并不是管理员给予每个分区或设备的名称)遵循一定的命名规律。 + +第一个 SATA 硬盘的第二个分区的名称将会是 sda2。名称的第一个字母暗示了存储类型,在这里指的是 SATA,但字母 “s” 也可能指的是 SCSI、 FireWire(火线端口)或 USB。第二个字母 “d” 指的是 disk(硬盘)。第三个字母指的是设备序数,即字母 “a” 指的是第一个 SATA 而 “b” 指的是第二个。最后的数字代表分区。没有分区数字的设备名代表该设置的所有分区。对于上面的例子,对应的名称为 sda 。作为命名的第一个字母还可能是 “h” ,这对应 PATA 硬盘(IDE)。 + +以下为命名规律的一些例子。假如一个用户有一个 SATA 硬盘(sda),这个设备有 4 个分区- sda1、 sda2、 sda3 和 sda4 。该用户删除了第三个分区,但直到格式化第四个分区之前,第四个分区名 sda4 都将保留不变。然后该用户插入了一个带有一个分区 - 即sdb1- 的 usb 存储卡(sdb),又增加了一个带有一个分区 -hda1- 的 IDE 硬盘 ,接着该用户又增加了一个 SCSI 硬盘 - sdc1 。接着用户移除了 USB 存储卡(sdb)。现在,SCSI 硬盘的名称仍然为 sdc,但如果这个 SCSI 被移除接着再被插入,则它的名称将变为 sdb。虽然还有其他的存储设备存在, 那个 IDE 硬盘的名称仍会有一个 “a”, 因为它是第一个 IDE 硬盘,IDE 设备的命名与 SCSI、 SATA、 FireWire 和 USB 设备要分开计数。 + +### 使用 TestDisk 进行恢复:### + +每个恢复软件有其不同的功能,特征及支持的不同文件系统。下面是一些关于 使用 TestDisk 在各种文件系统中恢复文件的指南。 + +####FAT16、 FAT32、 exFAT (FAT64)、 NTFS 以及 ext2/3/4:#### + +TestDisk 是一个运行在 Linux、 *BSD、 SunOS、 Mac OS X、 DOS 和 Windows 等操作系统下的开源的自由软件。 TestDisk 可以从下面的链接中找到 :[http://www.cgsecurity.org/wiki/TestDisk][1]。TestDisk 也可以通过键入 `sudo apt-get install testdisk` 来安装。TestDisk 有着许多的功能,但这篇文章将只关注恢复文件这个功能。 + +使用 root 权限从终端中打开 TestDisk 可以通过键入 `sudo testdisk` 命令。 + +现在, TestDisk 命令行应用将会被执行。终端的显示将会改变。TestDisk 询问用户它是否可以保留日志,这完全由用户决定。假如一个用户正从系统存储中恢复文件,则不必保留日志。可选择的选项有“生成”、 “追加” 和 “无日志”。假如用户想保留日志,则日志将会保留在该用户的主目录。 + +![](http://www.linux.org/attachments/screen1-jpg.342/?.jpg) + +在接着的屏幕中,存储设备以 `/dev/*`的方式被罗列出来。对于我的系统,系统的存储单元为 `/dev/sda`,这意味着我的存储单元为 一个 SATA硬盘(sd)且它是第一个硬盘(a)。每个存储单元的容量以 Gigabyte(千兆字节)为单位显示的。使用上下键来选择一个存储设备然后点击进入。 + +![](http://www.linux.org/attachments/screen2-jpg.343/?.jpg) + +下一屏显示出一个列有分区表(也叫做分区映射表)的清单。正如文件有`文件配置表`,分区有着分区表。分区是存储设备上的分段。例如在几乎所有的 Linux 系统中,至少存在两种分区类型 - EXT3/4 和 Swap 。每一个分区表将会在下面被简要地描述。TestDisk 并不支持所有类型的分区表,所以这并不是完整的列表。 + +![](http://www.linux.org/attachments/screen3-jpg.344/?.jpg) + +- **Intel** - 这类分区表在 Windows 系统和许多的 Linux 系统中非常普遍,它也常常称作 MBR 分区表。 +- **EFI GPT** - 这种类型的分区表通常用在 Linux 系统中。对于 Linux 系统,这种分区表是最为推荐的, 因为逻辑分区或扩展分区的概念并不适用于 GPT (GUID Partition Table) 分区表。 这意味着,如果每个分区中有一个 Linux 系统,一个 Linux 用户可以从多种类型的 Linux 系统中进行多重启动。当然使用 GPT 分区表还有其他的优势,但那些已超出了本文的讨论范围。 +- **Humax** - Humax 分区映射表适用于韩国公司 Humax 生产的设备。 +- **Mac** - Apple 分区映射表 (APM) 适用于 Apple 的设备。 +- **None** - 某些设备并没有分区表。例如,许多 Subor 游戏控制台不使用分区映射表。如果一个用户试图以其它分区表类型从这类设备中恢复文件,用户就会困扰 TestDisk 为何找卟到任何的文件系统或者文件。 +- **Sun** - Sun 分区表适用于 Sun 系统。 +- **Xbox** -Xbox 适用于使用 Xbox 分区映射表的存储设备。 + +假如用户选择了 “Xbox” ,尽管他的系统使用了 GPT 分区表, 那么 TestDisk 将不能找到任何分区或文件系统。假如 TestDisk 按照用户的选择执行,则它可能猜测错误。(下面的图片显示的是当分区表类型错误时的输出) + +![](http://www.linux.org/attachments/xbox-jpg.350/?.jpg) + +当用户为他们的设备选择了正确的选项,则在下一屏中,选择 “高级” 选项。 + +![](http://www.linux.org/attachments/screen4-jpg.345/?.jpg) + +现在,用户将看到一个列有用户存储设备中所有的文件系统或分区的列表。假如用户选择了错误的分区映射表,则在这一步中用户就将会知道他们做出了错误的选择。假如没有错误,通过移动文字光标来高亮选择含有被删除文件的分区。使用 左右键来高亮位于终端底部的 “列表”。接着,按下回车确认。 + +![](http://www.linux.org/attachments/screen5-jpg.346/?.jpg) + +新的一屏便会呈现出列有文件和目录的列表。那些白色的文件名就是未被删除的文件,而红色的文件名是那些已被删除的文件。最右边的一列是文件的名称,从右到左方向的接着一列是文件的创建日期,再往左的一列是文件的大小(以 byte/ 比特为单位),最左边带有“-”,“d” ,“r”, “w” 和"x"的一列则代表的是文件的权限情况。“d” 表示该文件为一个目录,其他的权限术语与本文关系不大。在列表的最顶端以“.”代表的一项表示当前目录,第二行以".."代表的一项表示当前目录的上级目录,所以用户可以通过选择目录所在行到达该目录。 + +![](http://www.linux.org/attachments/screen6-jpg.347/?.jpg) + +举个例子,我想进入"Xaiml\_Dataset" 目录,该目录基本上由被删除的文件组成。通过按键盘上的 "c"键,我将恢复文件 "computers.xaiml",接着我被询问选择一个目标目录,当然,我应该放置该文件到另一个分区中。现在,当我在我的家目录时,按下了“c”键。(选择目标目录时)哪个目录被高亮并没有什么影响,当前目录就是目标目录,在屏幕的上方,将会显示“复制完成”的消息。在我的家目录中便会有一个名为"Xaiml_Dataset"的目录,里面里有一个 Xaiml 文件。 假如我在更多的已删除文件上按“c” 键,则这些文件将会被放置到新的文件夹中而无需再向我询问目标目录。 + +![](http://www.linux.org/attachments/screen7-jpg.348/?.jpg) + +![](http://www.linux.org/attachments/screen8-jpg.349/?.jpg) + +当这些步骤完成后,重复按“q”键直到看到正常的终端模样。目录"Xaiml_Dataset" 只能被 root 用户访问。为了解决这个问题,使用 root 权限改变该目录及其子目录的权限。做完这些后,文件便被恢复了且用户可以访问它们。 + +### 特别的 ReiserFS:### + +为了从 ReiserFS 文件系统中恢复一个文件,首先需将分区中的所有文件做一个备份。因为如果发生某些错误, 这个方法可能会引起文件丢失。接着执行下面的命令,其中 `DEVICE`指的是那些以 sda2 形式命名的设备。一些文件将被放入 lost+found 目录而其他则会保存到原先被删除的位置。 + + reiserfsck --rebuild-tree --scan-whole-partition /dev/DEVICE + +### 恢复被某个程序打开的删除文件: ### + +假设用户意外地删除了一个文件,且该文件被某个程序打开。虽然在硬盘中该文件被删除了,但这个程序正使用着位于 RAM 中的该文件的副本。幸好,我们有两种简单的解决方法来恢复该文件。 + +假如这个软件有保存功能,如文本编辑器,则用户可以重新保存该文件,这样,文本编辑器可以将该文件写入硬盘中。 + +假设在音乐播放器中有一个 MP3 文件,而该音乐播放器并不能保存该 MP3 文件,则这种情形下需要比先前花更多的时间来恢复文件。不幸的是,这种方法并不能保证在所有的系统和应用中有效。首先,键入下面的命令。 + + lsof -c smplayer | grep mp3 + +上面的命令会列出所有由 smplayer 使用的文件,这个列表由 `grep` 命令通过管道搜索 mp3 。命令的输入类似于下面: + + smplayer 10037 collier mp3 169r 8,1 676376 1704294 /usr/bin/smplayer + +现在,键入下面的命令来直接从 RAM(在 Linux 系统中,`/proc/`映射到 RAM)中恢复文件,并复制该文件到选定的文件夹中。其中 `cp` 指的是复制命令,输出中的数字 10037 来自于进程数,输出中的数字 169 指的是文件描述符,"~/Music/"为目标目录,最后的 "music.mp3" 为用户想恢复的文件的名称。 + + cp /proc/10037/fd/169 ~/Music/music.mp3 + +### 真正的删除: ### + +为确保一个文件不能被恢复,可以使用一个命令来 “擦除” 硬盘。擦除硬盘实际上是向硬盘中写入无意义的数据。例如,许多擦除程序向硬盘中写入零,随机字母或随机数据。不会有空间被占用或丢失,擦除程序只是对空位进行重写覆盖。假如存储单元被文件占满而没有空余空间,则所有先前被删除的文件将会消失而不能恢复。 + +擦除硬盘的目的是确保隐私数据不被他人看见。举个例子,一个公司可能预订了一些新的电脑,总经理决定将旧的电脑卖掉,然而,新的电脑拥有者可能会看到公司的一些机密或诸如信用卡号码,地址等顾客信息。幸好,公司的电脑技术人员可以在卖掉这些旧电脑之前,擦除这些硬盘。 + +为了安装擦除程序 secure-delete,键入 `sudo apt-get install secure-delete`,这个命令将会安装一个包含 4 个程序的程序集,用以确保被删除的文件不能被恢复。 + +- srm - 永久删除一个文件。使用方法: `srm -f ./secret_file.txt` +- sfill - 擦除空白空间。使用方法: `sfill -f /mount/point/of/partition` +- sswap - 擦除 swap 空间。使用方法: `sswap -f /dev/SWAP_DEVICE` + +假如电脑实际去清除那些删除的文件,那么就需要花费更长的时间去执行删除任务。将某些空间标记为空位是快速且容易的,但使得文件永远消失需要花费一定的时间。例如,擦除一个存储单元,可能需要花费几个小时的时间(根据磁盘容量大小)。总之,现在的系统工作的就挺好,因为即便用户清空了垃圾箱,他们仍然有另一次机会来改变他们当初的想法(或错误)。 + +-------------------------------------------------------------------------------- + +via: http://www.linux.org/threads/undelete-files-on-linux-systems.4316/ + +作者:[DevynCJohnson][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linux.org/members/devyncjohnson.4843/ +[1]:http://www.cgsecurity.org/wiki/TestDisk diff --git a/published/20141204 The Easy Way to Keep Track of Multiple Time Zones in Ubuntu.md b/published/201502/20141204 The Easy Way to Keep Track of Multiple Time Zones in Ubuntu.md similarity index 100% rename from published/20141204 The Easy Way to Keep Track of Multiple Time Zones in Ubuntu.md rename to published/201502/20141204 The Easy Way to Keep Track of Multiple Time Zones in Ubuntu.md diff --git a/translated/tech/20141205 What is a good free control panel for VPS.md b/published/201502/20141205 What is a good free control panel for VPS.md similarity index 61% rename from translated/tech/20141205 What is a good free control panel for VPS.md rename to published/201502/20141205 What is a good free control panel for VPS.md index b9c3f3fafd..dbd1759145 100644 --- a/translated/tech/20141205 What is a good free control panel for VPS.md +++ b/published/201502/20141205 What is a good free control panel for VPS.md @@ -1,18 +1,18 @@ -VPS上好的控制面板是什么 +推荐一款不错的 VPS 控制面板:Ajenti ================================================================================ -任何有经验的Linux人员都认为没有一款控制面板可以打败纯命令行界面来管理[虚拟主机][1](VPS)。也有人争论有一款好的面板的一席之地,因为流线型的界面让常规管理操作可以通过点几下鼠标就可以完成。 +任何有经验的Linux人员都认为没有任何一款控制面板可以打败纯命令行界面来管理[虚拟主机][1](VPS)。也有人争辩说好的控制面板还是应该有一席之地,因为顺滑的操作界面让常规管理操作通过点几下鼠标就可以完成。 -至于控制面板,有共恩那个强大的充满警铃和汽笛的商业控制面板,也有不同免费的但也强大多功能的免费开源面板替代。这之中杰出的代表是[Ajenti][2]控制面板。 +至于控制面板,有那种强大的充满警铃和汽笛的商业控制面板,也有不同免费的但也强大多功能的免费开源面板替代品。这之中杰出的代表是[Ajenti][2]控制面板。 -Ajenti可以让你很简单地配置不同的通用服务程序,如Apache/nginx、Samba、BIND、Squid、MySQL、cron、防火墙等等,对管理通用VPS实例可以节省大量的时间。对于生产环境,Ajenti同样提供了插件和平台来支持虚拟web主机管理和自定义web UI开发。 +Ajenti可以让你很简单地配置不同的常规服务程序,如Apache/nginx、Samba、BIND、Squid、MySQL、cron、防火墙等等,对管理常规的 VPS 实例可以节省大量的时间。对于生产环境,Ajenti同样提供了插件和平台来支持虚拟 web 主机管理和自定义 web UI开发。 -Ajenti有[双重授权][3];一个是个人、企业内部或者教育用途免费使用的AGPLv3。然而,如果你是一家托管企业或者硬件提供商,那么你需要购买商业授权来使用Ajenti作为商业供应。 +Ajenti有[双重授权][3];一个是针对个人、企业内部或者教育用途免费使用的AGPLv3。然而,如果你是一家托管企业或者硬件提供商,那么你需要购买商业授权来使用Ajenti作为商业服务。 ### 在Linux上安装Ajenti ### 为了简化安装,Ajenti为主流Linux发行版提供了自己的仓库。安装Ajenti要做的就是配置目标仓库,并用默认包管理器来安装。 -安装前,一个RSA密钥和证书会生成用于SSL,Ajenti会见在8000端口监听HTTPS的web请求。如果你正在使用防火墙,你需要在防火墙中允许8000端口。为了安全,最好默认禁止8000端口的访问,并添加少数IP地址到白名单中。 +安装前会生成用于SSL的一个RSA密钥和证书,Ajenti会在8000端口监听HTTPS的web请求。如果你正在使用防火墙,你需要在防火墙中允许8000端口访问。为了安全,最好默认禁止8000端口的公开访问,并添加你的少数IP地址到白名单中。 #### 在Debian上安装Ajenti #### @@ -54,7 +54,7 @@ Ajenti有[双重授权][3];一个是个人、企业内部或者教育用途免 $ sudo service ajenti restart -直接在浏览器中输入https://:8000,你就会看到下面的Ajenti的登录界面。 +直接在浏览器中输入https://\:8000,你就会看到下面的Ajenti的登录界面。 ![](https://farm8.staticflickr.com/7512/15712738197_eeccd0f9dd_z.jpg) @@ -62,7 +62,7 @@ Ajenti有[双重授权][3];一个是个人、企业内部或者教育用途免 ![](https://farm8.staticflickr.com/7498/15897850312_d2ca46fa4b_z.jpg) -在左边面板的"SOFTWARE"选项下,你会看接一列安装的服务。当你安装了任何Ajenti支持的服务端程序时,软件会在重启ajenti服务后被自动加入列表。 +在左边面板的"SOFTWARE"选项下,你会看带一些已安装的服务。当你安装了任何Ajenti支持的服务端程序时,软件会在重启ajenti服务后被自动加入列表。 $ sudo service ajenti restart @@ -84,7 +84,7 @@ Ajenti提供了一个web界面来安装和升级VPS上的包。 #### 防火墙配置 #### -Ajenti允许你用两种方法管理防火墙规则(iptables或者CSF)。一种是使用用户友好的web面板,另一种是直接编辑原生的防火墙规则。 +Ajenti允许你用两种方法管理防火墙规则(使用iptables或者CSF)。一种方法是使用用户友好的web面板,另一种是直接编辑原始的防火墙规则。 ![](https://farm8.staticflickr.com/7490/15276234634_a220f2a555_z.jpg) @@ -98,25 +98,25 @@ Ajenti允许你用两种方法管理防火墙规则(iptables或者CSF)。一 #### 进程监控 #### -你可以u看见按照CPU和内存使用率排序的进程列表,按需可以结束它们。 +你可以看见按照CPU和内存使用率排序的进程列表,如果需要的话,也可以干掉它们。 ![](https://farm8.staticflickr.com/7556/15711008948_ed359c284d_z.jpg) #### 终端访问 #### -对于底层VPS访问,Ajenti提供了基于web的终端界面,你在这可以输入Linux命令。你也可以像下面那样在一个面板中打开多个终端。 +如果需要更低层面的VPS访问,Ajenti提供了基于web的终端界面,你在这可以输入Linux命令。你也可以像下面那样在一个面板中打开多个终端。 ![](https://farm8.staticflickr.com/7568/15896505251_8271ac16dd_z.jpg) #### Apache Web服务管理 #### -你可以编辑Apache配额文件,并管理apche2服务。 +你可以编辑Apache配置文件,并管理apache2服务。 ![](https://farm8.staticflickr.com/7572/15711009108_bb806d2dcd_z.jpg) #### MySQL/MariaDB 管理 #### -你可以访问MySQL/MariaDB服务并直接在上面执行原生SQL命令。 +你可以访问MySQL/MariaDB服务并直接在上面执行原始SQL命令。 ![](https://farm8.staticflickr.com/7580/15276234754_02375fd17b_z.jpg) @@ -128,13 +128,13 @@ Ajenti允许你用两种方法管理防火墙规则(iptables或者CSF)。一 #### 启动服务管理 #### -你可以浏览、启动、停止、重启安装的服务。 +你可以浏览、启动、停止、重启已安装的服务。 ![](https://farm8.staticflickr.com/7538/15898503935_1edf5c67ae_z.jpg) ### 总结 ### -Ajenti是一款易于使用的服务器管理控制面板,可以加入你开发的[自定义插件][5]。然而,记住任何好的控制面板都不会排除你学习面板后[VPS][6]上发生的情况的需求。一款面板会在你完全了解你正在做的事情的时候成会一款真正节省时间的利器,并且不依赖于控制面版来处理你行动的结果。 +Ajenti是一款易于使用的服务器管理控制面板,可以加入你开发的[自定义插件][5]。然而请记住,任何好的控制面板都不是阻止你学习在控制面板之后[VPS][6]里发生了什么的原因。一款好的面板会在你完全了解你正在做的事情时成会一款真正节省时间的利器,并且不依赖于控制面版来达成你所需要的目标。 -------------------------------------------------------------------------------- @@ -142,7 +142,7 @@ via: http://xmodulo.com/free-control-panel-for-vps.html 作者:[Dan Nanni][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/) 荣誉推出 @@ -150,6 +150,6 @@ via: http://xmodulo.com/free-control-panel-for-vps.html [1]:http://xmodulo.com/go/digitalocean [2]:http://ajenti.org/ [3]:http://ajenti.org/licensing -[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html +[4]:http://linux.cn/article-2324-1.html [5]:http://docs.ajenti.org/en/latest/dev/intro.html [6]:http://xmodulo.com/go/digitalocean \ No newline at end of file diff --git a/published/20141210 How to configure rsyslog client for remote logging on CentOS.md b/published/201502/20141210 How to configure rsyslog client for remote logging on CentOS.md similarity index 100% rename from published/20141210 How to configure rsyslog client for remote logging on CentOS.md rename to published/201502/20141210 How to configure rsyslog client for remote logging on CentOS.md diff --git a/published/201502/20141211 How to use matplotlib for scientific plotting on Linux.md b/published/201502/20141211 How to use matplotlib for scientific plotting on Linux.md new file mode 100644 index 0000000000..00ae499ed7 --- /dev/null +++ b/published/201502/20141211 How to use matplotlib for scientific plotting on Linux.md @@ -0,0 +1,164 @@ +在Linux中使用matplotlib进行科学画图 +================================================================================ + +如果你想要在Linxu中获得一个高效、自动化、高质量的科学画图的解决方案,应该考虑尝试下matplotlib库。Matplotlib是基于python的开源科学测绘包,基于python软件基金会许可证发布。大量的文档和例子、集成了Python和Numpy科学计算包、以及自动化能力,是作为Linux环境中进行科学画图的可靠选择的几个原因。这个教程将提供几个用matplotlib画图的例子。 + +###特性### + +- 支持众多的图表类型,如:bar,box,contour,histogram,scatter,line plots.... +- 基于python的语法 +- 集成Numpy科学计算包 +- 数据源可以是 python 的列表、键值对和数组 +- 可定制的图表格式(坐标轴缩放、标签位置及标签内容等) +- 可定制文本(字体,大小,位置...) +- 支持TeX格式(等式,符号,希腊字体...) +- 与IPython相兼容(允许在 python shell 中与图表交互) +- 自动化(使用 Python 循环创建图表) +- 用Python 的循环迭代生成图片 +- 保存所绘图片格式为图片文件,如:png,pdf,ps,eps,svg等 + +基于Python语法的matplotlib是其许多特性和高效工作流的基础。世面上有许多用于绘制高质量图的科学绘图包,但是这些包允许你直接在你的Python代码中去使用吗?除此以外,这些包允许你创建可以保存为图片文件的图片吗?Matplotlib允许你完成所有的这些任务。从而你可以节省时间,使用它你能够花更少的时间创建更多的图片。 + +###安装### +安装Python和Numpy包是使用Matplotlib的前提,安装Numpy的指引请见[该链接][1]。 + + +可以通过如下命令在Debian或Ubuntu中安装Matplotlib: + + $ sudo apt-get install python-matplotlib + +在Fedora或CentOS/RHEL环境则可用如下命令: + + $ sudo yum install python-matplotlib + + +###Matplotlib 例子### + +本教程会提供几个绘图例子演示如何使用matplotlib: + +- 离散图和线性图 +- 柱状图 +- 饼状图 + +在这些例子中我们将用Python脚本来执行Mapplotlib命令。注意numpy和matplotlib模块需要通过import命令在脚本中进行导入。 + +np为nuupy模块的命名空间引用,plt为matplotlib.pyplot的命名空间引用: + + import numpy as np + import matplotlib.pyplot as plt + + +###例1:离散和线性图### + +第一个脚本,script1.py 完成如下任务: + +- 创建3个数据集(xData,yData1和yData2) +- 创建一个宽8英寸、高6英寸的图(赋值1) +- 设置图画的标题、x轴标签、y轴标签(字号均为14) +- 绘制第一个数据集:yData1为xData数据集的函数,用圆点标识的离散蓝线,标识为"y1 data" +- 绘制第二个数据集:yData2为xData数据集的函数,采用红实线,标识为"y2 data" +- 把图例放置在图的左上角 +- 保存图片为PNG格式文件 + +script1.py的内容如下: + + import numpy as np + import matplotlib.pyplot as plt + + xData = np.arange(0, 10, 1) + yData1 = xData.__pow__(2.0) + yData2 = np.arange(15, 61, 5) + plt.figure(num=1, figsize=(8, 6)) + plt.title('Plot 1', size=14) + plt.xlabel('x-axis', size=14) + plt.ylabel('y-axis', size=14) + plt.plot(xData, yData1, color='b', linestyle='--', marker='o', label='y1 data') + plt.plot(xData, yData2, color='r', linestyle='-', label='y2 data') + plt.legend(loc='upper left') + plt.savefig('images/plot1.png', format='png') + + +所画之图如下: + +![](https://farm8.staticflickr.com/7529/15927002365_f5ae11cf02_z.jpg) + + +###例2:柱状图### + +第二个脚本,script2.py 完成如下任务: + +- 创建一个包含1000个随机样本的正态分布数据集。 +- 创建一个宽8英寸、高6英寸的图(赋值1) +- 设置图的标题、x轴标签、y轴标签(字号均为14) +- 用samples这个数据集画一个40个柱状,边从-10到10的柱状图 +- 添加文本,用TeX格式显示希腊字母mu和sigma(字号为16) +- 保存图片为PNG格式。 + +script2.py代码如下: + + import numpy as np + import matplotlib.pyplot as plt + + mu = 0.0 + sigma = 2.0 + samples = np.random.normal(loc=mu, scale=sigma, size=1000) + plt.figure(num=1, figsize=(8, 6)) + plt.title('Plot 2', size=14) + plt.xlabel('value', size=14) + plt.ylabel('counts', size=14) + plt.hist(samples, bins=40, range=(-10, 10)) + plt.text(-9, 100, r'$\mu$ = 0.0, $\sigma$ = 2.0', size=16) + plt.savefig('images/plot2.png', format='png') + + +结果见如下链接: + +![](https://farm8.staticflickr.com/7531/15304765024_1cc271b6e0_z.jpg) + + +###例3:饼状图### + +第三个脚本,script3.py 完成如下任务: + +- 创建一个包含5个整数的列表 +- 创建一个宽6英寸、高6英寸的图(赋值1) +- 添加一个长宽比为1的轴图 +- 设置图的标题(字号为14) +- 用data列表画一个包含标签的饼状图 +- 保存图为PNG格式 + +脚本script3.py的代码如下: + + import numpy as np + import matplotlib.pyplot as plt + + data = [33, 25, 20, 12, 10] + plt.figure(num=1, figsize=(6, 6)) + plt.axes(aspect=1) + plt.title('Plot 3', size=14) + plt.pie(data, labels=('Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5')) + plt.savefig('images/plot3.png', format='png') + + +结果如下链接所示: + +![](https://farm8.staticflickr.com/7504/15926356092_7c3e5217aa_z.jpg) + + +###总结### + +这个教程提供了几个用matplotlib科学画图包进行画图的例子,Matplotlib是在Linux环境中用于解决科学画图的绝佳方案,表现在其无缝地和Python、Numpy连接、自动化能力,和提供多种自定义的高质量的画图产品。matplotlib包的文档和例子详见[这里][2]。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/matplotlib-scientific-plotting-linux.html + +作者:[Joshua Reed][a] +译者:[ideas4u](https://github.com/ideas4u) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/joshua +[1]:http://xmodulo.com/numpy-scientific-computing-linux.html +[2]:http://matplotlib.org/ diff --git a/translated/tech/20141219 How to block unwanted IP addresses on Linux efficiently.md b/published/201502/20141219 How to block unwanted IP addresses on Linux efficiently.md similarity index 75% rename from translated/tech/20141219 How to block unwanted IP addresses on Linux efficiently.md rename to published/201502/20141219 How to block unwanted IP addresses on Linux efficiently.md index 5d45755066..feb53945b0 100644 --- a/translated/tech/20141219 How to block unwanted IP addresses on Linux efficiently.md +++ b/published/201502/20141219 How to block unwanted IP addresses on Linux efficiently.md @@ -1,6 +1,7 @@ -如何在Linux有效地屏蔽不需要的IP +如何在 Linux 下大量屏蔽恶意 IP 地址 ================================================================================ -你可能需要在Linux的不同的环境下屏蔽IP地址。比如,作为一个终端用户,你可能想要免受间谍软件或者IP追踪的困扰。或者当你在运行P2P软件时。你可能想要过滤反P2P活动的网络链接。如果你是一名系统管理员,你可能想要禁止垃圾IP地址访问你们的生产邮件服务器。或者你因一些原因想要禁止某些国家访问web服务。在许多情况下,然而,你的IP地址屏蔽列表可能会很快地增长到几万的IP。该如何处理这个? + +很多情况下,你可能需要在Linux下屏蔽IP地址。比如,作为一个终端用户,你可能想要免受间谍软件或者IP追踪的困扰。或者当你在运行P2P软件时。你可能想要过滤反P2P活动的网络链接。如果你是一名系统管理员,你可能想要禁止垃圾IP地址访问你们的公司邮件服务器。或者你因一些原因想要禁止某些国家访问你的web服务。在许多情况下,然而,你的IP地址屏蔽列表可能会很快地增长到几万的IP。该如何处理这个? ### Netfilter/IPtables 的问题 ### @@ -8,11 +9,11 @@ $ sudo iptables -A INPUT -s 1.1.1.1 -p TCP -j DROP -如果你想要完全屏蔽一个IP地址,你可以用下面的命令很简单地做到: +如果你想要完全屏蔽一个IP地址段,你可以用下面的命令很简单地做到: $ sudo iptables -A INPUT -s 1.1.2.0/24 -p TCP -j DROP -然而,当你有1000个独立IP地址,且不带CIDR(无类别域间路由)前缀,你该怎么做?你要有1000条iptable规则!这显然无法扩展。 +然而,当你有1000个独立IP地址,且不带CIDR(无类别域间路由)前缀,你该怎么做?你要有1000条iptable规则!这显然这并不适于大规模屏蔽。 $ sudo iptables -A INPUT -s 1.1.1.1 -p TCP -j DROP $ sudo iptables -A INPUT -s 2.2.2.2 -p TCP -j DROP @@ -21,13 +22,13 @@ ### 什么是IP集? ### -这时候就是[IP集][1]登场了。IP集是一个内核特性,它允许多个(独立)IP地址、MAC地址或者甚至是端口号编码并有效地存储在位图/哈希内核数据结构中。一旦IP集创建之后,你可以创建一条iptable规则来匹配这个集合。 +这时候就是[IP集][1]登场了。IP集是一个内核特性,它允许多个(独立)IP地址、MAC地址或者甚至是端口号被编码和有效地存储在位图/哈希内核数据结构中。一旦IP集创建之后,你可以创建一条iptables规则来匹配这个集合。 -你应该马上看见IP集合的好处了,它可以让你用一条iptable规则匹配多个ip地址!你可以用多个IP地址和端口号的方式来构造IP集,并且可以动态地更新规则而没有请能影响。 +你马上就会看见IP集合的好处了,它可以让你用一条iptable规则匹配多个ip地址!你可以用多个IP地址和端口号的方式来构造IP集,并且可以动态地更新规则而没有性能影响。 ### 在Linux中安装IPset工具 ### -为了创建和管理IP集,你需要使用成为ipset的用户空间工具。 +为了创建和管理IP集,你需要使用称为ipset的用户空间工具。 要在Debian、Ubuntu或者Linux Mint上安装: @@ -45,7 +46,7 @@ Fedora或者CentOS/RHEL 7上安装: $ sudo ipset create banthis hash:net -第二个参数(hash:net)是必须的,代表的是集合的类型。IP集有[多个类型][2]。hash:net类型的IP集使用哈希来存储多个CIDR块。如果你想要在一个集合中存储独立的IP地址,你可以使用hash:ip类型。 +第二个参数(hash:net)是必须的,代表的是集合的类型。IP集有[多个类型][2]。hash:net类型的IP集使用哈希来存储多个CIDR块。如果你想要在一个集合中存储单独的IP地址,你可以使用hash:ip类型。 一旦创建了一个IP集之后,你可以用下面的命令来检查: @@ -70,25 +71,25 @@ Fedora或者CentOS/RHEL 7上安装: ![](https://farm8.staticflickr.com/7518/15380353474_4d6b9dbf63_z.jpg) -现在是时候去创建一个使用IP集的iptable规则了。这里的关键是使用"-m set --match-set "选项。 +现在是时候去创建一个使用IP集的iptables规则了。这里的关键是使用"-m set --match-set "选项。 现在让我们创建一条让之前那些IP块不能通过80端口访问web服务的iptable规则。可以通过下面的命令: $ sudo iptables -I INPUT -m set --match-set banthis src -p tcp --destination-port 80 -j DROP -如果你想,你可以保存特定的IP集到一个文件中,以后可以从文件中还原: +如果你愿意,你可以保存特定的IP集到一个文件中,以后可以从文件中还原: $ sudo ipset save banthis -f banthis.txt $ sudo ipset destroy banthis $ sudo ipset restore -f banthis.txt -上面的命令中,我使用了destory选项来删除一个已有的IP集来见证我可以还原它。 +上面的命令中,我使用了destory选项来删除一个已有的IP集来看看我是否可以还原它。 ### 自动IP地址禁用 ### -现在你应该看到了IP集合的强大了。维护IP黑名单是一件繁琐和费时的工作。实际上,有很多免费或者收费的服务可以来帮你完成这个。一个额外的好处是,让我们看看如何自动将IP黑名单家到IP集中。 +现在你应该看到了IP集合的强大了。维护IP黑名单是一件繁琐和费时的工作。实际上,有很多免费或者收费的服务可以来帮你完成这个。一个额外的好处是,让我们看看如何自动将IP黑名单加到IP集中。 -首先让我们从[iblocklist.com][3]抓取免费的黑名单,这个网站u有不同的免费和收费的名单。免费的版本是P2P格式。 +首先让我们从[iblocklist.com][3]得到免费的黑名单,这个网站有不同的免费和收费的名单。免费的版本是P2P格式。 接下来我要使用一个名为iblocklist2ipset的开源Python工具来将P2P格式的黑名单转化成IP集。 @@ -131,14 +132,13 @@ Fedora或者CentOS/RHEL 7上安装: $ sudo ipset list banthis - 在写这篇文章时候,“level1”类表包含了237,000个屏蔽的IP列表。你可以看到很多IP地址已经加入到IP集中了。 -最后,创建一条iptable命令来屏蔽它们! +最后,创建一条iptables命令来屏蔽这些坏蛋! ### 总结 ### -这篇文章中,我描述了你该如何用强大的ipset来·屏蔽不想要的IP地址。同时结合了第三方工具iblocklist2ipset,这样你就可以流畅地维护你的IP屏蔽列表了。对于那些对于ipset的速度提升好奇的人来说,下图显示了iptables在使用和不使用ipset的基准测试结果。 +这篇文章中,我描述了你该如何用强大的ipset来屏蔽不想要的IP地址。同时结合了第三方工具iblocklist2ipset,这样你就可以流畅地维护你的IP屏蔽列表了。那些对ipset的性能提升好奇的人,下图显示了iptables在使用和不使用ipset的基准测试结果。 ![](https://farm8.staticflickr.com/7575/15815220998_e1935c94c0_z.jpg) @@ -150,7 +150,7 @@ via: http://xmodulo.com/block-unwanted-ip-addresses-linux.html 作者:[Dan Nanni][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/) 荣誉推出 diff --git a/translated/tech/20141219 How to schedule appointments and to-do tasks in a Linux terminal.md b/published/201502/20141219 How to schedule appointments and to-do tasks in a Linux terminal.md similarity index 76% rename from translated/tech/20141219 How to schedule appointments and to-do tasks in a Linux terminal.md rename to published/201502/20141219 How to schedule appointments and to-do tasks in a Linux terminal.md index c419029716..1e2d5c39cd 100644 --- a/translated/tech/20141219 How to schedule appointments and to-do tasks in a Linux terminal.md +++ b/published/201502/20141219 How to schedule appointments and to-do tasks in a Linux terminal.md @@ -1,12 +1,12 @@ -如何在Linux终端下安排约会和待办事项 +在Linux终端下使用 calcurse 安排约会和待办事项 ================================================================================ -如果你是一个享受linux终端的系统管理员,但同样需要一中方法来安排每天最重要的任务、约会和会议,你会发现[calcurse][1]是一个很有用的工具。calcurse包含了日历、一个待办事项管理、一个调度程序和一个可配置的通知系统,这些都集成进了一个软件中,基于的都是ncurse的接口。同时,它不会限制你在终端中,你可以将你的日历和笔记导出成可以打印的格式。 +如果你是一个享受linux终端的系统管理员,但同样需要一种方法来安排每天最重要的任务、约会和会议,你会发现[calcurse][1]是一个很有用的工具。calcurse包含了日历、一个待办事项管理、一个调度程序和一个可配置的通知系统,这些都集成进了一个软件中,基于的都是ncurse的接口。同时,它不会限制你在终端中,你可以将你的日历和笔记导出成可以打印的格式。 -本片文章我们会探索如何在Linux上安装calcurse,并且教你如何利用它的特性。 +本篇文章我们会探索如何在Linux上安装calcurse,并且教你如何利用它的特性。 ### 在Linux上安装Culcurse ### -calcurse在大多数Linux发行版的标准仓库都有。万一在你的发行版上没有(比如CentOS/RHEL),一旦你安装了gcc和ncurse开发文件后就可以很简单地从源码安装。 +calcurse在大多数Linux发行版的标准仓库都有。万一在你的发行版上没有(比如CentOS/RHEL),只要你安装了gcc和ncurse开发文件后就可以很简单地从源码安装。 Debian、Ubuntu或者Linux Mint @@ -32,22 +32,22 @@ CentOS/RHEL $ calcurse -你将会看到下面的空白界面。如果配色不吸引你,你可以以后改变它们。 +你将会看到下面的空白界面。如果这配色不吸引你,你可以以后换一个。 ![](https://farm8.staticflickr.com/7567/15410270544_0af50a4eb6_c.jpg) -我们现在可以按下回车-‘q’- 再次按下回车- ‘y’来退出主界面。这个序列会告诉地不的菜单退出、保存当前的笔记并确认退出。 +我们现在可以按下回车-‘q’- 再次按下回车- ‘y’来退出主界面。这个按键序列激活界面底部的主菜单,并告诉它保存当前的笔记并确认退出。 -When we run calcurse for the first time, the following directory structure is created in our home directory: +我们第一次运行 calcurse 时,会在主目录创建如下子目录: ![](https://farm8.staticflickr.com/7482/15845194188_2ba15035e7_o.png) -这里是每一项的简要描述: +这里是每一个子目录的简要描述: -- **apts** 文件包含了用户所有的约会和事项,todo文件包含了所有的**todo** 列表。 +- **apts**文件包含了用户所有的约会和事项,todo文件包含了所有的**待办事项** 列表。 - **conf**文件,如你所想的那样,包含当前用户的独立设置。 -- **keys**文件包含了用户定义的按键绑定(比如:q或者Q推出,x或者X导出内容等等)。 -- 在**notes**子目录你会看到包含了笔记描述的文件,你可以附到任何一个安排事项中。 +- **keys**文件包含了用户定义的按键绑定(比如:q或者Q退出,x或者X导出内容等等)。 +- 在**notes**子目录你会看到包含了笔记描述的文件,这些笔记你可以附到任何一个安排事项中。 ### 改变配色 ### @@ -55,13 +55,13 @@ When we run calcurse for the first time, the following directory structure is cr ![](https://farm9.staticflickr.com/8595/16006755476_5289384f81_z.jpg) -使用最后一幅图的按键绑定来选色前景色和背景色配置来更好地适应你的需求: +使用最后一幅图的按键绑定来选择前景色和背景色配置,以更好地适应你的需求: ![](https://farm8.staticflickr.com/7499/15845274420_70bb95c221_b.jpg) -### A添加约会和待办任务 ### +### 添加约会和待办任务 ### -在前面的选项卡中浏览命令菜单时,我们看到按下‘o’可以从一个菜单到下一个菜单。我们可以把第二个菜单作为**安排编辑菜单**。 +在前面的选项卡中浏览命令菜单时,我们看到按下‘o’可以从一个菜单跳到下一个菜单。我们可以把第二个菜单作为**安排编辑菜单**。 ![](https://farm9.staticflickr.com/8634/16031851732_b947951f76_c.jpg) @@ -87,7 +87,7 @@ When we run calcurse for the first time, the following directory structure is cr ### 为事项设置通知 ### -你可以在通知菜单下配置通知。按照相同的步骤来以防改变了配色,但是选择**Notify**而不是**Colour**: +你可以在通知菜单下配置通知。按照相同的步骤来改变配色方案,但是选择**Notify**而不是**Colour**: ![](https://farm8.staticflickr.com/7569/15412900863_eaf2767e19_z.jpg) @@ -103,7 +103,7 @@ When we run calcurse for the first time, the following directory structure is cr ### 总结 ### -本篇教程中我们展示了如何设置一个多样化的调度器和提醒器来帮助你组织每日的活动和提前安排重要的事项。你或许还要calcurse的[PDF 手册][2],还请随意在下面的评论中提出你的疑问。欢迎你的评论,我也很高兴看到这些。 +本篇教程中我们展示了如何设置一个多样化的调度器和提醒器来帮助你组织每日的活动和提前安排重要的事项。你或许还要看看calcurse的[PDF 手册][2],请随意在下面的评论中提出你的疑问。欢迎你的评论,我也很高兴看到这些。 -------------------------------------------------------------------------------- @@ -111,7 +111,7 @@ via: http://xmodulo.com/schedule-appointments-todo-tasks-linux-terminal.html 作者:[Gabriel Cánepa][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/) 荣誉推出 diff --git a/published/20141223 20 Linux Commands Interview Questions & Answers.md b/published/201502/20141223 20 Linux Commands Interview Questions & Answers.md similarity index 100% rename from published/20141223 20 Linux Commands Interview Questions & Answers.md rename to published/201502/20141223 20 Linux Commands Interview Questions & Answers.md diff --git a/translated/tech/20141223 Setting up a 'PXE Network Boot Server' for Multiple Linux Distribution Installations in RHEL or CentOS 7.md b/published/201502/20141223 Setting up a 'PXE Network Boot Server' for Multiple Linux Distribution Installations in RHEL or CentOS 7.md similarity index 86% rename from translated/tech/20141223 Setting up a 'PXE Network Boot Server' for Multiple Linux Distribution Installations in RHEL or CentOS 7.md rename to published/201502/20141223 Setting up a 'PXE Network Boot Server' for Multiple Linux Distribution Installations in RHEL or CentOS 7.md index db3cd3b706..046cee4f98 100644 --- a/translated/tech/20141223 Setting up a 'PXE Network Boot Server' for Multiple Linux Distribution Installations in RHEL or CentOS 7.md +++ b/published/201502/20141223 Setting up a 'PXE Network Boot Server' for Multiple Linux Distribution Installations in RHEL or CentOS 7.md @@ -1,12 +1,13 @@ RHEL/CentOS 7中配置用于多版本Linux安装的“PXE网络启动服务器” ================================================================================ -**PXE服务器**——预启动执行环境——指示客户端计算机直接从网络接口启动、运行或安装操作系统,而不需要烧录CD/DVD或使用某个物理介质,它也可以减轻你网络中多台机器同时安装Linux发行版的工作。 +**PXE服务器**——预启动执行环境——指示客户端计算机直接从网络接口启动、运行或安装操作系统,而不需要烧录CD/DVD或使用某个物理介质,它可以减轻你网络中多台机器同时安装Linux发行版的工作。 ![Setting PXE Network Boot in RHEL/CentOS 7](http://www.tecmint.com/wp-content/uploads/2014/10/Setting-PXE-Network-Boot-in-CentOS.png) -在RHEL/CentOS 7中设置PXE网络启动 -#### 需求 #### +*在RHEL/CentOS 7中设置PXE网络启动* + +#### 前置阅读 #### - [CentOS 7最小化安装步骤][1] - [RHEL 7最小化安装步骤][2] @@ -14,7 +15,7 @@ RHEL/CentOS 7中配置用于多版本Linux安装的“PXE网络启动服务器 - [移除RHEL/CentOS 7中不要的服务][4] - [安装NTP服务器以设置RHEL/CentOS 7的正确时间][5] -本文将介绍如何在配置有本地镜像安装仓库的**RHEL/CentOS 7** 64位上安装并配置一台**PXE服务器**,仓库源由CentOS 7 DVD ISO镜像提供,并由**DNSMASQ**服务器提供解析。 +本文将介绍如何在配置有本地镜像安装仓库的**RHEL/CentOS 7** 64位上安装并配置一台**PXE服务器**,仓库源由CentOS 7 DVD 的 ISO镜像提供,并由**DNSMASQ**服务器提供解析。 该机器提供了**DNS**和**DHCP**服务,用于网络启动引导的**Syslinux**包,**TFTP-Server**——提供了可通过网络使用**小文件传输协议**下载的可启动镜像,以及提供本地挂载DVD镜像的**VSFTPD**服务器——它将扮演官方RHEL/CentOS 7镜像安装仓库的角色,安装器将从这里提取所需的包。 @@ -27,11 +28,12 @@ RHEL/CentOS 7中配置用于多版本Linux安装的“PXE网络启动服务器 # yum install dnsmasq ![Install dnsmasq Package](http://www.tecmint.com/wp-content/uploads/2014/10/Install-dnsmasq-in-CentOS.jpg) -安装dnsmasq包 -**2.** DNSMASQ的默认主配置文件位于**/etc**目录中,虽然不需要任何说明就能看懂,但编辑起来确实相当困难的,即使有很详细的说明性注释。 +*安装dnsmasq包* -首先,确保你备份了该文件,以便你需要在以后对它进行恢复。然后使用你喜爱的文本编辑器创建一个新的空配置文件,命令如下。 +**2.** DNSMASQ的默认的主配置文件位于**/etc**目录中,虽然不需要任何说明就能看懂,但编辑起来确实相当困难的,即使有很详细的说明性注释。 + +首先,确保你备份了该文件,以便你需要在以后对它进行恢复。然后使用你爱用的文本编辑器创建一个新的空配置文件,命令如下。 # mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup # nano /etc/dnsmasq.conf @@ -61,7 +63,8 @@ RHEL/CentOS 7中配置用于多版本Linux安装的“PXE网络启动服务器 tftp-root=/var/lib/tftpboot ![Dnsmasq Configuration](http://www.tecmint.com/wp-content/uploads/2014/10/dnsmasq-configuration.jpg) -Dnsmasq配置 + +*Dnsmasq配置* 你需要修改的声明有以下这些: @@ -89,14 +92,16 @@ Dnsmasq配置 # yum install syslinux ![Install Syslinux Bootloaders](http://www.tecmint.com/wp-content/uploads/2014/10/install-syslinux-bootloaders.jpg) -安装Syslinux启动加载器 + +*安装Syslinux启动加载器* **5.** PXE启动加载器文件位于**/usr/share/syslinux**系统绝对路径下,你可以通过列出该路径下的内容来查看。该步骤不是必须的,但你可能需要知道该路径,因为在下一步中,我们将拷贝该路径下的所有内容到**TFTP服务器**路径下。 # ls /usr/share/syslinux ![Syslinux Files](http://www.tecmint.com/wp-content/uploads/2014/10/syslinux-files.jpg) -Syslinux文件 + +*Syslinux文件* ### 步骤3: 安装TFTP-Server并加入SYSLINUX加载启动器 ### @@ -106,7 +111,8 @@ Syslinux文件 # cp -r /usr/share/syslinux/* /var/lib/tftpboot ![Install TFTP Server](http://www.tecmint.com/wp-content/uploads/2014/10/install-tftp-server.jpg) -安装TFTP服务器 + +*安装TFTP服务器* ### 步骤4: 设置PXE服务器配置文件 ### @@ -117,13 +123,13 @@ Syslinux文件 # mkdir /var/lib/tftpboot/pxelinux.cfg # touch /var/lib/tftpboot/pxelinux.cfg/default -**8.** 现在,该来编辑**PXE服务器**配置文件了,为它添加合法的Linux发行版安装选项。请注意,该文件中使用的所有路径必须是相对于**/var/lib/tftpboot**目录的。 +**8.** 现在,该来编辑**PXE服务器**配置文件了,为它添加合理的Linux发行版安装选项。请注意,该文件中使用的所有路径必须是相对于**/var/lib/tftpboot**目录的。 -下面,你可以看到配置文件的样例,你可以使用该模板,但请修改安装镜像(kernel和initrd文件)、协议(FTP、HTTP、HTTPS、NFS)以及映射你网络安装源仓库和路径的IP地址。 +下面,你可以看到配置文件的样例,你可以使用该模板,但请修改安装镜像(kernel和initrd文件)、协议(FTP、HTTP、HTTPS、NFS)以及映射你网络安装源仓库和路径的IP地址等参数。 # nano /var/lib/tftpboot/pxelinux.cfg/default -添加一下整个节录到文件中。 +添加以下整个节录到文件中。 default menu.c32 prompt 0 @@ -151,17 +157,18 @@ Syslinux文件 menu label ^4) Boot from local drive ![Configure PXE Server](http://www.tecmint.com/wp-content/uploads/2014/10/configure-pxe-server.jpg) -配置PXE服务器 + +*配置PXE服务器* 正如你所见,CentOS 7启动镜像(kernel和initrd)位于名为**centos7**的目录,该目录是**/var/lib/tftpboot**目录的相对路径(其系统绝对路径为**/var/lib/tftpboot/centos7**),而安装器仓库位于可通过FTP协议访问的**192.168.1.20/pub**网络位置中——在本例中,这些仓库位于本地,因为IP地址和PXE服务器地址相同。 同时,菜单**label 3**指定客户端安装应该通过**VNC**从一个远程位置实现(这里替换VNC密码为一个健壮的密码),如果你在一台没有输入输出的客户端上安装,菜单**label 2**指定了作为安装源的一个CentOS 7官方互联网镜像(这种情况要求客户端通过DHCP和NAT连接到互联网)。 -**重要**:正如你在上述配置中说看到的,我们使用了CentOS 7进行演示,但是你也可以定义RHEL 7镜像。而下面的完整说明和配置都只是基于CentOS 7的,所以在选在发行版时要当心。 +**重要**:正如你在上述配置中所看到的,我们使用了CentOS 7进行演示,但是你也可以定义一个 RHEL 7镜像。而下面的整个的说明和配置都只是基于CentOS 7的,所以在选发行版时要注意一下。 ### 步骤5: 添加CentOS 7启动镜像到PXE服务器 ### -**9.** 对于此步骤,需要用到CentOS的kernel和initrd文件。要获取这些文件,你需要**CentOS 7 DVD ISO**镜像。所以,去下载CentOS DVD镜像吧,然后把它放入你的DVD驱动器并挂载镜像到**/mnt**路径,命令见下面。 +**9.** 对于此步骤,需要用到CentOS的kernel和initrd文件。要获取这些文件,你需要**CentOS 7 DVD ISO**镜像。所以,去下载CentOS DVD镜像吧,然后把它(刻录成光盘)放入你的DVD驱动器并挂载镜像到**/mnt**路径,命令见下面。 使用DVD,而不是最小化CD镜像的原因在于,在后面我们将使用该DVD的内容为**FTP**源创建本地安装器仓库。 @@ -169,27 +176,29 @@ Syslinux文件 # ls /mnt ![Mount CentOS DVD](http://www.tecmint.com/wp-content/uploads/2014/10/mount-centos-dvd.jpg) -挂载CentOS DVD + +*挂载CentOS DVD* 如果你的机器没有DVD驱动器,你也可以使用**wget**或**curl**工具从[CentOS镜像站][7]下载**CentOS 7 DVD ISO**到本地并挂载。 # wget http://mirrors.xservers.ro/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso # mount -o loop /path/to/centos-dvd.iso /mnt -**10.** 在DVD内容可供使用后,创建**centos7**目录并将CentOS 7可启动kernel和initrd映像文件从DVD挂载位置拷贝到centos7文件夹。 +**10.** 在DVD内容可供使用后,创建**centos7**目录并将CentOS 7 的可启动的 kernel和initrd映像文件从DVD挂载位置拷贝到centos7文件夹。 # mkdir /var/lib/tftpboot/centos7 # cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7 # cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7 ![Copy CentOS Bootable Files](http://www.tecmint.com/wp-content/uploads/2014/10/copy-centos-bootable-files.jpg) -拷贝CentOS可启动文件 + +*拷贝CentOS可启动文件* 使用该方法的原因在于,今后你可能会在**/var/lib/tftpboot**路径中创建新的独立的目录,并添加其它Linux发行版到PXE菜单中,你就不会将整个目录结构弄得一团糟了。 ### 步骤6: 创建CentOS 7本地镜像安装源 ### -**11.** 虽然你可以通过多种协议设置**安装源镜像**,如HTTP、HTTPS或NFS,但对于本指南,我选择使用**FTP**协议。因为通过**vsftpd**,你可以很便捷地配置,而且它也很稳定。 +**11.** 虽然你可以通过多种协议设置**安装源镜像**,如HTTP、HTTPS或NFS,但对于本指南,我选择了使用**FTP**协议。因为通过**vsftpd**,你可以很便捷地配置,而且它也很稳定。 接下里,安装vsftpd进程,然后复制所有DVD挂载目录中的内容到**vsftpd**默认服务器路径下(**/var/ftp/pub**)——这会花费一些时间,这取决于你的系统资源。然后为该路径设置可读权限,命令如下。 @@ -198,17 +207,20 @@ Syslinux文件 # chmod -R 755 /var/ftp/pub ![Install Vsftpd Server](http://www.tecmint.com/wp-content/uploads/2014/10/install-vsftpd-in-centos.jpg) -安装Vsftpd服务器 + +*安装Vsftpd服务器* ![Copy Files to FTP Path](http://www.tecmint.com/wp-content/uploads/2014/10/copy-files-to-ftp-path.jpg) -拷贝Files到FTP路径 + +*拷贝Files到FTP路径* ![Set Permissions on FTP Path](http://www.tecmint.com/wp-content/uploads/2014/10/set-permission-on-ftp-path.jpg) -设置FTP路径的权限 + +*设置FTP路径的权限* ### 步骤7: 在系统范围内启动并启用进程 ### -**12.** 既然PXE服务器配置已经完成,那么就来启动**DNSMASQ**和**VSFTPD**服务器吧。验证它们的状况并在系统范围内启用,以便让这些服务在每次系统重启后都能随系统启动,命令如下。 +**12.** 既然PXE服务器配置已经完成,那么就来启动**DNSMASQ**和**VSFTPD**服务器吧。验证它们的状况并在系统上启用,以便让这些服务在每次系统重启后都能随系统启动,命令如下。 # systemctl start dnsmasq # systemctl status dnsmasq @@ -218,10 +230,12 @@ Syslinux文件 # systemctl enable vsftpd ![Start Dnsmasq Service](http://www.tecmint.com/wp-content/uploads/2014/10/start-dnsmasq.jpg) -启动Dnsmasq服务 + +*启动Dnsmasq服务* ![Start Vsftpd Service](http://www.tecmint.com/wp-content/uploads/2014/10/start-vsftpd.jpg) -启动Vsftpd服务 + +*启动Vsftpd服务* ### 步骤8: 打开防火墙并测试FTP安装源 ### @@ -236,53 +250,62 @@ Syslinux文件 # firewall-cmd --reload ## Apply rules ![Check Listening Ports](http://www.tecmint.com/wp-content/uploads/2014/10/check-listening-ports.jpg) -检查监听端口 + +*检查监听端口* ![Open Ports in Firewall](http://www.tecmint.com/wp-content/uploads/2014/10/open-ports-on-firewall.jpg) -在防火墙上开启端口 + +*在防火墙上开启端口* **14.** 要测试FTP安装源网络路径,请在本地或另外一台计算机上打开浏览器([**lynx**][8]就可以做此事),然后输入你架设有FTP服务的PXE服务器的IP地址,并在填入的URL后面加上**/pub**网络位置,结果应该和截图中看到的一样。 ftp://192.168.1.20/pub ![Access FTP Files via Browser](http://www.tecmint.com/wp-content/uploads/2014/10/browse-ftp-files.jpg) -通过浏览器访问FTP文件 + +*通过浏览器访问FTP文件* **15.** 要解决PXE服务器最终的配置或其它信息产生的问题,请在live模式下诊断,命令如下: # tailf /var/log/messages ![Check PXE Logs for Errors](http://www.tecmint.com/wp-content/uploads/2014/10/check-pxe-errors.jpg) -检查PXE日志错误 -**16.** 最后,最后所需的步骤就是卸载CentOS 7 DVD,并移除物理介质。 +*检查PXE日志错误* + +**16.** 最后,最终所需的步骤就是卸载CentOS 7 DVD,并移除物理介质。 # umount /mnt ### 步骤9: 配置客户端从网络启动 ### -**17.** 现在,你的客户端可以通过它们的系统BIOS或在**BIOS开机自检**时按指定键来配置网络启动作为**首要启动设备**,具体方法见主板说明手册。 +**17.** 现在,你的客户端可以通过它们的系统BIOS或在**BIOS开机自检**时按指定键来配置网络启动作为**首选启动设备**,具体方法见主板说明手册。 为了选择网络启动,在第一次PXE提示符出现时,请按下**F8**键进入到PXE安装界面,然后敲**回车**键继续进入PXE菜单。 ![PXE Network Boot](http://www.tecmint.com/wp-content/uploads/2014/10/pxe-network-boot.jpg) -PXE网络启动 + +*PXE网络启动* ![PXE Network OS Boot](http://www.tecmint.com/wp-content/uploads/2014/10/pxe-network-os-boot.jpg) -PXE网络OS启动 + +*PXE网络OS启动* **18.** 一旦你进入PXE菜单,请选择你的CentOS 7安装类型,敲**回车**键继续安装过程,就像你使用本地启动介质安装一样。 -请记下这一点,使用菜单中的变体2需要激活目标客户端上的互联网连接。在下面的屏幕截图中,你可以通过VNC看到远程安装的实例。 +请记住这一点,使用菜单中的变体2需要激活目标客户端上的互联网连接。在下面的屏幕截图中,你可以通过VNC看到远程安装的实例。 ![PXE Menu](http://www.tecmint.com/wp-content/uploads/2014/10/pxe-menu.jpg) -PXE菜单 + +*PXE菜单* ![Remote Linux Installation via VNC](http://www.tecmint.com/wp-content/uploads/2014/10/os-installation-via-vnc.jpg) -通过VNC远程安装Linux + +*通过VNC远程安装Linux* ![Remote Installation of CentOS](http://www.tecmint.com/wp-content/uploads/2014/10/remote-centos-installation.jpg) -远程安装CentOS + +*远程安装CentOS* 以上是**CentOS 7**上配置最小化**PXE服务器**的所有内容。在我的本系列下一篇文章中,我将讨论其它PXE服务器配置过程中的其它问题,如怎样使用**Kickstart**文件来配置自动化安装**CentOS 7**,以及添加其它Linux发行版到PXE菜单——**Ubuntu Server**和**Debian 7**。 @@ -292,14 +315,14 @@ via: http://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/ 作者:[Matei Cezar][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/) 荣誉推出 [a]:http://www.tecmint.com/author/cezarmatei/ [1]:http://www.tecmint.com/centos-7-installation/ [2]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ -[3]:http://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/ +[3]:http://linux.cn/article-3977-1.html [4]:http://www.tecmint.com/remove-unwanted-services-in-centos-7/ [5]:http://www.tecmint.com/install-ntp-server-in-centos/ [6]:http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html diff --git a/published/20141224 Linux FAQs with Answers--How to install Kingsoft Office on Linux.md b/published/201502/20141224 Linux FAQs with Answers--How to install Kingsoft Office on Linux.md similarity index 100% rename from published/20141224 Linux FAQs with Answers--How to install Kingsoft Office on Linux.md rename to published/201502/20141224 Linux FAQs with Answers--How to install Kingsoft Office on Linux.md diff --git a/translated/tech/20141224 Linux FAQs with Answers--How to rename multiple files on Linux.md b/published/201502/20141224 Linux FAQs with Answers--How to rename multiple files on Linux.md similarity index 67% rename from translated/tech/20141224 Linux FAQs with Answers--How to rename multiple files on Linux.md rename to published/201502/20141224 Linux FAQs with Answers--How to rename multiple files on Linux.md index 24120bd386..d804bd390e 100644 --- a/translated/tech/20141224 Linux FAQs with Answers--How to rename multiple files on Linux.md +++ b/published/201502/20141224 Linux FAQs with Answers--How to rename multiple files on Linux.md @@ -1,21 +1,20 @@ -Linux有问必答-- 如何在Linux重命名多个文件 +Linux有问必答:如何在Linux下重命名多个文件 ================================================================================ > **提问**:我知道我可以用mv命令重命名文件。但是当我想重命名很多文件怎么办?如果为每个文件都这么做将会是很乏味的。有没有办法一次性重命名多个文件? -在Linux中,当你想要改变一个文件名,使用mv命令就好了。然而mv不能使用通配符重命名多个文件。可以用sed、awk或者与[xargs][1]结合使用来处理多个文件的情况。然而,这些命令行即繁琐u又不友好,并且如果不小心的话还很容易出错。你不会想要撤销1000个文件的错误名的。 +在Linux中,当你想要改变一个文件名,使用mv命令就好了。然而mv不能使用通配符重命名多个文件。可以用sed、awk或者与[xargs][1]结合使用来处理多个文件的情况。然而,这些命令行即繁琐又不友好,并且如果不小心的话还很容易出错。你不会想要撤销1000个文件的错误名吧! -When it comes to renaming multiple files, the rename utility is probably the easiest, the safest, and the most powerful command-line tool. The rename command is actually a Perl script, and comes pre-installed on all modern Linux distributions. -当你想要重命名多个文件的时候,重命名的工具或许是最简单、最安全和最强大的命令行工具。重命名命令实际上是一个Perl脚本,它预安装在所有的现在Linux发行班上 +当你想要重命名多个文件的时候,rename 工具或许是最简单、最安全和最强大的命令行工具。这个rename命令实际上是一个Perl脚本,它预安装在所有的现在Linux发行版上。 下面是重命名命令的基本语法。 rename [-v -n -f] - 是Perl兼容正则表达式,它表示的是要重命名的文件和该怎么做。正则表达式的形式是‘s/old-name/new-name/’。 +\ 是Perl兼容正则表达式,它表示的是要重命名的文件和该怎么做。正则表达式的形式是‘s/old-name/new-name/’。 ‘-v’选项会显示文件名改变的细节(比如:XXX重命名成YYY)。 -‘-n’选项告诉rename会在不实际改变名称的情况下显示文件将会重命名的情况。这个选项在你想要在不改变文件名的情况下模拟改变文件名的情况下很有用。 +‘-n’选项告诉rename命令在不实际改变名称的情况下显示文件将会重命名的情况。这个选项在你想要在不改变文件名的情况下模拟改变文件名的情况下很有用。 ‘-f’选项强制覆盖存在的文件。 @@ -43,7 +42,7 @@ When it comes to renaming multiple files, the rename utility is probably the eas ### 更改文件名模式 ### -现在让我们考虑包含子模式的更复杂的正则表达式。在PCRE中,子模式包含在圆括号中,$符后接上数字(比如$1,$2)。 +现在让我们考虑更复杂的包含子模式的正则表达式。在PCRE中,子模式包含在圆括号中,$符后接上数字(比如$1,$2)。 比如,下面的命令会将‘img_NNNN.jpeg’变成‘dan_NNNN.jpg’。 @@ -57,7 +56,7 @@ When it comes to renaming multiple files, the rename utility is probably the eas img_5420.jpeg renamed as dan_5420.jpg img_5421.jpeg renamed as dan_5421.jpg -比如,下面的命令会将‘img_000NNNN.jpeg’变成‘dan_NNNN.jpg’。 +比如,下面的命令会将‘img\_000NNNN.jpeg’变成‘dan\_NNNN.jpg’。 # rename -v 's/img_\d{3}(\d{4})\.jpeg$/dan_$1\.jpg/' *jpeg @@ -76,7 +75,7 @@ When it comes to renaming multiple files, the rename utility is probably the eas via: http://ask.xmodulo.com/rename-multiple-files-linux.html 译者:[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/) 荣誉推出 diff --git a/translated/share/20141226 How to Download Music from Grooveshark with a Linux OS.md b/published/201502/20141226 How to Download Music from Grooveshark with a Linux OS.md similarity index 86% rename from translated/share/20141226 How to Download Music from Grooveshark with a Linux OS.md rename to published/201502/20141226 How to Download Music from Grooveshark with a Linux OS.md index 0af3e996d3..b6ecc8acbd 100644 --- a/translated/share/20141226 How to Download Music from Grooveshark with a Linux OS.md +++ b/published/201502/20141226 How to Download Music from Grooveshark with a Linux OS.md @@ -6,7 +6,7 @@ **Grooveshark 对于喜欢音乐的人来说是一个不错的在线平台,同时有多种从上面下载音乐的方法。Groovesquid 是众多允许用户从 Grooveshark 上下载音乐的应用之一,并且是支持多平台的。** -只要有在线流媒体服务,就一定有方法从获取你之前看过或听过的视频及音乐。即使下载接口关闭了,也不是什么大不了的事,因为还有很多种解决方法,无论你用的什么操作系统。比如,网络上就有许多种 YouTube 下载器,同样的道理,从 Grooveshark 上下载音乐也并非难事。 +只要有在线流媒体服务,就一定有方法将你看过或听过的视频及音乐保存到本地。即使下载接口关闭了,也不是什么大不了的事,因为还有很多种解决方法,无论你用的什么操作系统。比如,网络上就有许多种 YouTube 下载器,同样的道理,从 Grooveshark 上下载音乐也并非难事。 现在,得考虑合法性的问题。与许多其他应用一样,Groovesquid 并非是完全不合法的。如果有用户使用应用去做一些非法的事情,那责任应归咎于用户。同样的道理也适用于 utorrent 或者 Bittorrent。只要你不触及版权问题,那你就可以无所顾忌的使用 Groovesquid 了。 @@ -14,7 +14,7 @@ 你能够找到的 Groovesquid 的唯一缺点是,它是基于 Java 而编写的,这从来都不是一个好的兆头。虽然为了确保应用的可移植性这样做确实是一个好方法,但这样做的结果导致了其糟糕的界面。确实是非常糟糕的的界面,不过这一点并不会影响到用户的使用体验,特别是这款应用所完成的工作时如此的有用。 -有一点需要注意的地方。Groovesquid 是一款免费的应用,但为了将免费保持下去,它会在菜单栏的右侧显示一则广告。这对大多数人来说都应该不是问题,不过最好在打开应用后注意下菜单栏右侧。 +有一点需要注意的地方。Groovesquid 是一款免费的应用,但为了将免费保持下去,它会在菜单栏的右侧显示一则广告。这对大多数人来说都应该不是问题,不过最好在打开应用后注意下菜单栏右侧(那不是应用的一部分)。 从易用性的角度来看,这款应用非常简洁。用户可以通过在顶部地址栏里输入链接直接下载单曲,地址栏的位置可以通过其左侧的下拉菜单进行修改。在下拉菜单中,也可以修改为歌曲名称、流行度、专辑名称、播放列表以及艺术家。有些选项向你提供了诸如查看 Grooveshark 上最流行的音乐,或者下载整个播放列表等。 @@ -38,7 +38,7 @@ via: http://news.softpedia.com/news/How-to-Download-Music-from-Grooveshark-with- 作者:[Silviu Stahie][a] 译者:[Stevearzh](https://github.com/Stevearzh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201502/20141229 4 Steps to Setup Local Repository in Ubuntu using APT-mirror.md b/published/201502/20141229 4 Steps to Setup Local Repository in Ubuntu using APT-mirror.md new file mode 100644 index 0000000000..dc9d72ef77 --- /dev/null +++ b/published/201502/20141229 4 Steps to Setup Local Repository in Ubuntu using APT-mirror.md @@ -0,0 +1,125 @@ +使用 APT-mirror 四步配置 Ubuntu 本地软件仓库 +================================================================================ +今天,我们将向你展示如何在你的 Ubuntu 个人电脑或 Ubuntu 服务器中,直接通过 Ubuntu 官方软件仓库来配置本地软件仓库。在你的电脑中创建一个本地软件仓库有着许多的好处。假如你有许多电脑需要安装软件 、安全升级和修复补丁,那么配置一个本地软件仓库是一个做这些事情的高效方法。因为,所有需要安装的软件包都可以通过快速的局域网连接从你的本地服务器中下载,这样可以节省你的网络带宽,降低互联网接入的年度开支 ... + +你可以使用多种工具在你的本地个人电脑或服务器中配置一个 Ubuntu 的本地软件仓库,但在本教程中,我们将为你介绍 APT-Mirror。这里,我们将把默认的镜像包镜像到我们本地的服务器或个人电脑中,并且在你的本地或外置硬盘中,我们至少需要 **120 GB** 或更多的可用空间才行。 我们可以通过配置一个 **HTTP** 或 **FTP** 服务器来与本地系统客户端共享这个软件仓库。 + +我们需要安装 Apache 网络服务器和 APT-Mirror 来使得我们的工作得以开始。下面是配置一个可工作的本地软件仓库的步骤: + +### 1. 安装需要的软件包 ### + +我们需要从 Ubuntu 的公共软件包仓库中取得所有的软件包,然后在我们本地的 Ubuntu 服务器硬盘中保存它们。 + +首先我们安装一个Web 服务器来承载我们的本地软件仓库。这里我们将安装 Apache Web 服务器,但你可以安装任何你中意的 Web 服务器。对于 http 协议,Web 服务器是必须的。假如你需要配置 ftp 协议 及 rsync 协议,你还可以再分别额外安装 FTP 服务器,如 proftpd, vsftpd 等等 和 Rsync 。 + + $ sudo apt-get install apache2 + +然后我们需要安装 apt-mirror: + + $ sudo apt-get install apt-mirror + +![apt-mirror-installation](http://blog.linoxide.com/wp-content/uploads/2014/12/apt-mirror-install.png) + +**注: 正如我先前提到的,我们需要至少 120 GB 的可用空间来使得所有的软件包被镜像或下载。** + +### 2. 配置 APT-Mirror ### + +现在,在你的硬盘上创建一个目录来保存所有的软件包。例如,我们创建一个名为 `/linoxide`的目录,我们将在这个目录中保存所有的软件包: + + $ sudo mkdir /linoxide + +![repo-dir](http://blog.linoxide.com/wp-content/uploads/2014/12/mkdir-linoxide.png) + +现在,打开文件 **/etc/apt/mirror.list** : + + $ sudo nano /etc/apt/mirror.list + +![apt-mirror-edit](http://blog.linoxide.com/wp-content/uploads/2014/12/edit-mirror-list-300x7.png) + +复制下面的命令行配置到 `mirror.list`文件中并按照你的需求进行修改: + + ############# config ################## + # + set base_path /linoxide + # + # set mirror_path $base_path/mirror + # set skel_path $base_path/skel + # set var_path $base_path/var + # set cleanscript $var_path/clean.sh + # set defaultarch + # set postmirror_script $var_path/postmirror.sh + # set run_postmirror 0 + set nthreads 20 + set _tilde 0 + # + ############# end config ############## + + deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse + #deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse + #deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse + + deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse + deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse + deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse + #deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse + #deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse + + clean http://archive.ubuntu.com/ubuntu + +![mirror-list-config](http://blog.linoxide.com/wp-content/uploads/2014/12/mirror-list-config.png) + +**注: 你可以将上面的官方镜像服务器网址更改为离你最近的服务器的网址,可以通过访问 [Ubuntu Mirror Server][1]来找到这些服务器地址。假如你并不太在意镜像完成的时间,你可以沿用默认的官方镜像服务器网址。** + +这里,我们将要镜像最新和最大的 Ubuntu LTS 发行版 --- 即 Ubuntu 14.04 LTS (Trusty Tahr) --- 的软件包仓库,所以在上面的配置中发行版本号为 trusty 。假如我们需要镜像 Saucy 或其他的 Ubuntu 发行版本,请修改上面的 trusy 为相应的代号。 + +现在,我们必须运行 apt-mirror 来下载或镜像官方仓库中的所有软件包。 + + sudo apt-mirror + +从 Ubuntu 服务器中下载所有的软件包所花费的时间取决于你和镜像服务器之间的网络连接速率和性能。这里我中断了下载,因为我已经下载好了 ... + +![downloading-packages](http://blog.linoxide.com/wp-content/uploads/2014/12/downloading-index.png) + +### 3.配置网络服务器 ### + +为了使得其他的电脑能够访问这个软件仓库,你需要一个Web服务器。你也可以通过 ftp 来完成这件事,但我选择使用一个Web服务器因为在上面的步骤 1 中我提及到使用Web服务器。因此,我们现在要对 Apache 服务器进行配置: + +我们将为我们本地的软件仓库目录 建立一个到 Apache 托管目录 --- 即 `/var/www/ubuntu` --- 的符号链接。 + + $ sudo ln -s /linoxide /var/www/ubuntu + $ sudo service apache2 start + +![symlinks-apache2](http://blog.linoxide.com/wp-content/uploads/2014/12/symblink-apache2.png) + +上面的命令将允许我们从本地主机(localhost) --- 即 http://127.0.0.1(默认情况下) --- 浏览我们的镜像软件仓库。 + +### 4. 配置客户端 ### + +最后,我们需要在其他的电脑中添加软件源,来使得它们可以从我们的电脑中取得软件包或软件仓库。为达到此目的,我们需要编辑 `/etc/apt/sources.list` 文件并添加下面的命令: + + $ sudo nano /etc/apt/sources.list + +添加下面的一行到` /etc/apt/sources.list`中并保存。 + + deb http://192.168.0.100/ubuntu/ trusty main restricted universe + +**注: 这里的 192.168.0.100 是我们的服务器电脑的局域网 IP 地址,你需要替换为你的服务器电脑的局域网 IP 地址** + + $ sudo apt-get update + +最终,我们完成了任务。现在,你可以使用`sudo apt-get install packagename` 命令来从你的本地 Ubuntu 软件仓库中安装所需的软件包,这将会是高速的且消耗很少的带宽。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/setup-local-repository-ubuntu/ + +作者:[Arun Pyasi][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://launchpad.net/ubuntu/+archivemirrors diff --git a/translated/tech/20141229 How to Create Btrfs Filesystem in Linux and its Features.md b/published/201502/20141229 How to Create Btrfs Filesystem in Linux and its Features.md similarity index 91% rename from translated/tech/20141229 How to Create Btrfs Filesystem in Linux and its Features.md rename to published/201502/20141229 How to Create Btrfs Filesystem in Linux and its Features.md index 8ab85e81dc..9439ace204 100644 --- a/translated/tech/20141229 How to Create Btrfs Filesystem in Linux and its Features.md +++ b/published/201502/20141229 How to Create Btrfs Filesystem in Linux and its Features.md @@ -28,7 +28,7 @@ Btrfs文件系统在Linux中的创建及其特性 ### 转换到Btrfs ### -**警告:在尝试转换文件系统前,请务必备份数据。虽然此操作很稳定,也很安全,但它仍然可能导致数据丢失,而防止此情况发生的唯一途径就是进行数据备份。** +**警告:在尝试转换文件系统前,请务必备份数据!虽然此操作很稳定,也很安全,但它仍然可能导致数据丢失,而防止此情况发生的唯一途径就是进行数据备份。** 将现存的ext4文件系统转换到btrfs是相当简单而易懂的。你首先需要使用fsck来检查你现存分区上是否存在错误,然后使用btrfs-convert命令进行转换。如果你想要对/dev/sda3分区进行转换,你可以进行以下操作: @@ -41,7 +41,7 @@ Btrfs文件系统在Linux中的创建及其特性 ### 转换根分区 ### -如果你想要对你系统上的根分区进行转换,你首先需要使用Live CD启动。对于Ubuntu,你可以使用Ubuntu安装CD来完成此操作,在启动后第一个屏幕选择“尝试Ubuntu”。对于其它系统,你同样可以使用Live CD镜像,操作类似。 +如果你想要对你系统上的根分区进行转换,你首先需要使用Live CD启动。对于Ubuntu,你可以使用Ubuntu安装盘来完成此操作,在启动后第一个屏幕选择“尝试Ubuntu”。对于其它系统,你同样可以使用Live CD镜像,操作类似。 在启动后,打开终端,使用下面的命令来转换文件系统。 @@ -57,7 +57,7 @@ Btrfs文件系统在Linux中的创建及其特性 ![btrfs-root-convert](http://blog.linoxide.com/wp-content/uploads/2014/11/btrfs-root-convert.jpg) -现在来编辑fstab,并根据blkid输出的结果来修改当前/文件系统的UUID,并将它的文件系统类型修改为btrfs,修改后的行如下: +现在来编辑fstab,并根据blkid输出的结果来修改当前“/”文件系统的UUID,并将它的文件系统类型修改为btrfs,修改后的行如下: UUID=8e7e80aa-337e-4179-966d-d60128bd3714 / btrfs defaults 0 1 @@ -74,7 +74,7 @@ via: http://linoxide.com/file-system/create-btrfs-features/ 作者:[Adrian Dinu][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/) 荣誉推出 diff --git a/translated/tech/20150104 Auditd--Tool for Security Auditing on Linux Server.md b/published/201502/20150104 Auditd--Tool for Security Auditing on Linux Server.md similarity index 73% rename from translated/tech/20150104 Auditd--Tool for Security Auditing on Linux Server.md rename to published/201502/20150104 Auditd--Tool for Security Auditing on Linux Server.md index 1071e1521b..3e528fffa6 100644 --- a/translated/tech/20150104 Auditd--Tool for Security Auditing on Linux Server.md +++ b/published/201502/20150104 Auditd--Tool for Security Auditing on Linux Server.md @@ -1,14 +1,14 @@ Auditd - Linux 服务器安全审计工具 ================================================================================ -首先,Linoxide组祝读者 **2015新年快乐万事如意!** 。下面开始这个新年版审计工具的介绍。 +首先,Linux中国祝贺读者 **2015羊年春节快乐,万事如意!** 。下面开始这个新年版审计工具的介绍。 -安全防护是首先要考虑的问题。为了避免别人盗取我们的数据,我们需要维护它。安全防护包括很多东西,审计是其中一个。 +安全防护是首先要考虑的问题。为了避免别人盗取我们的数据,我们需要时刻关注它。安全防护包括很多东西,审计是其中之一。 -我们知道Linux系统上有一个叫 **auditd** 的审计工具。这个工具在大多数Linux操作系统中是默认安装的。审计工具是什么?如何使用?下面我们开始介绍。 +我们知道Linux系统上有一个叫 **auditd** 的审计工具。这个工具在大多数Linux操作系统中是默认安装的。那么auditd 是什么?如何使用呢?下面我们开始介绍。 ### 什么是审计? ### -审计(或审计监控)是Linux审计系统中用户部分的一个组件,负责将审计记录写入磁盘。 +auditd(或 auditd 守护进程)是Linux审计系统中用户空间的一个组件,其负责将审计记录写入磁盘。 ![](http://blog.linoxide.com/wp-content/uploads/2014/12/what_is_auditd.png) @@ -20,16 +20,17 @@ Ubuntu系统中,我们可以使用 [wajig][1] 工具或者 **apt-get 工具** 按照下面的说明安装auditd,安装完毕后将自动安装以下auditd和相关的工具: -- **auditctl ;** 运行过程中控制守护进程的工具,比如如添加规则等等。 -- **/etc/audit/audit.rules ;** 记录审计规则的文件。 -- **aureport ;** 查看和生成审计报告的工具。 -- **ausearch ;** 查找审计事件的工具 -- **auditspd ;** 转发事件通知给其他应用程序,不写审计日志文件。 -- **autrace ;** 跟踪处理过程的命令。 -- **/etc/audit/auditd.conf ;** auditd工具的配置文件。 -- 首次安装 **auditd** 后, 审计规则是空的。 +- **auditctl :** 即时控制审计守护进程的行为的工具,比如如添加规则等等。 +- **/etc/audit/audit.rules :** 记录审计规则的文件。 +- **aureport :** 查看和生成审计报告的工具。 +- **ausearch :** 查找审计事件的工具 +- **auditspd :** 转发事件通知给其他应用程序,而不是写入到审计日志文件中。 +- **autrace :** 一个用于跟踪进程的命令。 +- **/etc/audit/auditd.conf :** auditd工具的配置文件。 -可以使用以下命令查看 +首次安装 **auditd** 后, 审计规则是空的。 + +可以使用以下命令查看: $ sudo auditctl -l @@ -41,7 +42,7 @@ Ubuntu系统中,我们可以使用 [wajig][1] 工具或者 **apt-get 工具** #### Audit 文件和目录访问审计 #### -我们使用审计工具的一个目的是监控文件和目录的更改。对于auditd工具,我们可使用命令来配置(注意,以下命令需要root权限)。 +我们使用审计工具的一个基本的需求是监控文件和目录的更改。使用auditd工具,我们可通过如下命令来配置(注意,以下命令需要root权限)。 **文件审计** @@ -51,9 +52,9 @@ Ubuntu系统中,我们可以使用 [wajig][1] 工具或者 **apt-get 工具** **选项 :** -- **-w path ;** 监控指定的路径,上面的命令指定监控路径 /etc/passwd -- **-p ; ** 指定触发审计的文件和目录的访问权限 -- **rwxa ;** 指定的触发条件,r 读取权限,w 写入权限,x 执行权限 +- **-w path :** 指定要监控的路径,上面的命令指定了监控的文件路径 /etc/passwd +- **-p :** 指定触发审计的文件/目录的访问权限 +- **rwxa :** 指定的触发条件,r 读取权限,w 写入权限,x 执行权限,a 属性(attr) #### 目录审计 #### @@ -79,31 +80,41 @@ Ubuntu系统中,我们可以使用 [wajig][1] 工具或者 **apt-get 工具** $ sudo ausearch -f /etc/passwd -- **-f** 设定ausearch审计/etc/passwd文件 -- 下面是输出 : +- **-f** 设定ausearch 调出 /etc/passwd文件的审计内容 + +下面是输出 : + > **time**->Mon Dec 22 09:39:16 2014 + > type=PATH msg=audit(1419215956.471:194): item=0 **name="/etc/passwd"** inode=142512 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL + > type=CWD msg=audit(1419215956.471:194): **cwd="/home/pungki"** + > type=SYSCALL msg=audit(1419215956.471:194): arch=40000003 **syscall=5** success=yes exit=3 a0=b779694b a1=80000 a2=1b6 a3=b8776aa8 items=1 ppid=2090 pid=2231 **auid=4294967295 uid=1000 gid=1000** euid=0 suid=0 fsuid=0 egid=1000 sgid=1000 fsgid=1000 tty=pts0 ses=4294967295 **comm="sudo" exe="/usr/bin/sudo"** key=(null) 下面开始解读输出结果。 -- **time ;** 审计时间。 -- **name ;** 审计对象 -- **cwd ;** 当前路径 -- **syscall ;** 相关的系统调用 -- **auid ;** 审计用户ID -- **uid and gid ;** 访问文件的用户ID和用户组ID -- **comm ;** 用户访问文件的命令 -- **exe ;** 上面命令的可执行文件路径 -- 以上审计日志显示文件未被改动。 +- **time :** 审计时间。 +- **name :** 审计对象 +- **cwd :** 当前路径 +- **syscall :** 相关的系统调用 +- **auid :** 审计用户ID +- **uid 和 gid :** 访问文件的用户ID和用户组ID +- **comm :** 用户访问文件的命令 +- **exe :** 上面命令的可执行文件路径 - 以下我们将要添加一个用户,看看auditd如何记录文件 /etc/passwd的改动的。 +以上审计日志显示文件未被改动。 + +以下我们将要添加一个用户,看看auditd如何记录文件 /etc/passwd的改动的。 > **time->**Mon Dec 22 11:25:23 2014 + > type=PATH msg=audit(1419222323.628:510): item=1 **name="/etc/passwd.lock"** inode=143992 dev=08:01 mode=0100600 ouid=0 ogid=0 rdev=00:00 nametype=DELETE + > type=PATH msg=audit(1419222323.628:510): item=0 **name="/etc/"** inode=131073 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT + > type=CWD msg=audit(1419222323.628:510): **cwd="/root"** + > type=SYSCALL msg=audit(1419222323.628:510): arch=40000003 **syscall=10** success=yes exit=0 a0=bfc0ceec a1=0 a2=bfc0ceec a3=897764c items=2 ppid=2978 pid=2994 **auid=4294967295 uid=0 gid=0** euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=4294967295 **comm="chfn" exe="/usr/bin/chfn"** key=(null) 我们可以看到,在指定的时间,**/etc/passwd ** 被root用户(uid =0, gid=0)在/root目录下修改。/etc/passwd 文件是使用**/usr/bin/chfn** 访问的。 @@ -133,7 +144,7 @@ Ubuntu系统中,我们可以使用 [wajig][1] 工具或者 **apt-get 工具** 一旦定义审计规则后,它会自动运行。过一段时间后,我们可以看看auditd是如何帮我们跟踪审计的。 -Auditd提供了另一个工具叫 **aureport** 。从名字上可以猜到, **aureport** 是使用系统日志生成简要报告的工具。 +Auditd提供了另一个工具叫 **aureport** 。从名字上可以猜到, **aureport** 是使用系统审计日志生成简要报告的工具。 我们已经配置auditd去跟踪/etc/passwd文件。auditd参数设置后一段时间后,audit.log 文件就创建出来了。 @@ -155,7 +166,7 @@ Auditd提供了另一个工具叫 **aureport** 。从名字上可以猜到, * 从上图可以看出,由两个用户在特定的时间授权失败。 -如果我们想看所有相关账户修改的事件,可以使用-m参数。 +如果我们想看所有账户修改相关的事件,可以使用-m参数。 $ sudo aureport -m @@ -165,8 +176,10 @@ Auditd提供了另一个工具叫 **aureport** 。从名字上可以猜到, * 我们已经添加如下规则: +- $ sudo auditctl -w /etc/passwd -p rwxa - $ sudo auditctl -w /production/ -- 现在,如果确信这些规则正常,我们可以将其添加到**/etc/audit/audit.rules**中使得规则永久有效。以下介绍如何将他们添加到/etc/audit/audit.rules中去。 + +现在,如果确信这些规则可以正常工作,我们可以将其添加到**/etc/audit/audit.rules**中使得规则永久有效。以下介绍如何将他们添加到/etc/audit/audit.rules中去。 ![](http://blog.linoxide.com/wp-content/uploads/2014/12/audit_rules_file.png) @@ -192,7 +205,7 @@ via: http://linoxide.com/how-tos/auditd-tool-security-auditing/ 作者:[Pungki Arianto][a] 译者:[shipsw](https://github.com/shipsw) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150104 How To Install Websvn In CentOS 7.md b/published/201502/20150104 How To Install Websvn In CentOS 7.md similarity index 80% rename from translated/tech/20150104 How To Install Websvn In CentOS 7.md rename to published/201502/20150104 How To Install Websvn In CentOS 7.md index c636f06da0..b1b8f87407 100644 --- a/translated/tech/20150104 How To Install Websvn In CentOS 7.md +++ b/published/201502/20150104 How To Install Websvn In CentOS 7.md @@ -1,6 +1,6 @@ -CentOS 7中安装Websvn +在 CentOS 7中安装Websvn ================================================================================ -**WebSVN**为你的Subversion提供了一个试图,它设计用来反映Subversion的一整套方法。你可以检查任何文件或目录的日志,以及查看任何指定修改库中修改、添加或删除过的文件列表。你也可以检查同一文件两个版本的不同之处,以便确切地查看某个特性修订版中的修改。 +**WebSVN**为你的Subversion提供了一个视图,其设计用来对应Subversion的各种功能。你可以检查任何文件或目录的日志,以及查看任何指定版本中所修改、添加或删除过的文件列表。你也可以检查同一文件两个版本的不同之处,以便确切地查看某个特定的修订版本的变化。 ### 特性 ### @@ -8,31 +8,25 @@ WebSVN提供了以下这些特性: - 易于使用的界面; - 可自定义的模板系统; -- 文件列表的着色; +- 彩色文件列表; - 过错视图; - 日志信息搜索; - 支持RSS订阅; ### 安装 ### -我使用以下链接来将Subversion安装到CentOS 7。 +我按以下链接来将Subversion安装到CentOS 7。 - [CentOS 7上如何安装Subversion][1] **1 – 下载websvn到/var/www/html。** cd /var/www/html - ----------- - wget http://websvn.tigris.org/files/documents/1380/49057/websvn-2.3.3.zip **2 – 解压zip包。** unzip websvn-2.3.3.zip - ----------- - mv websvn-2.3.3 websvn **3 – 安装php到你的系统。** @@ -42,13 +36,7 @@ WebSVN提供了以下这些特性: **4 – 编辑web svn配置。** cd /var/www/html/websvn/include - ----------- - cp distconfig.php config.php - ----------- - vi config.php ---------- @@ -96,7 +84,7 @@ via: http://www.unixmen.com/install-websvn-centos-7/ 作者:[M.el Khamlichi][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/) 荣誉推出 diff --git a/published/201502/20150105 How To Install Kodi 14 (XBMC) In Ubuntu 14.04 and Linux Mint 17.md b/published/201502/20150105 How To Install Kodi 14 (XBMC) In Ubuntu 14.04 and Linux Mint 17.md new file mode 100644 index 0000000000..64e065fa5b --- /dev/null +++ b/published/201502/20150105 How To Install Kodi 14 (XBMC) In Ubuntu 14.04 and Linux Mint 17.md @@ -0,0 +1,50 @@ +如何在 Ubuntu 14.04 和 Linux Mint 17 中安装 Kodi14(XBMC) +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Kodi_Xmas.jpg) + +[Kodi][1],原名就是大名鼎鼎的XBMC,发布了开发代号为Helix的[最新版本14][2]。感谢官方XMBC提供的PPA,现在可以很简单地在Ubuntu14.04中安装了。 + +有些人可能还不了解Kodi,它是一个媒体中心软件,支持所有平台,如Windows、Linux、 Mac, Android等。此软件拥有全屏的媒体中心,可以管理所有音乐和视频,不单支持本地文件还支持网络播放,如Tube、[Netflix][3]、 Hulu, Amazon Prime和其他流媒体服务商。 + +### 在 Ubuntu 14.04 和 Linux Mint 17 中安装 XBMC 14 Kodi Helix ### + +再次感谢官方的PPA,让我们可以轻松安装Kodi 14。支持Ubuntu 14.04、Ubuntu 12.04、Linux Mint 17、Pinguy OS 14.04、Deepin 2014、LXLE 14.04、Linux Lite 2.0, Elementary OS 以及其他基于 Ubuntu 的 Linux 发行版。 + +打开终端(Ctrl+Alt+T)然后使用下列命令。 + + sudo add-apt-repository ppa:team-xbmc/ppa + sudo apt-get update + sudo apt-get install kodi + +需要下载大约100MB,在我看来,这不是很大。若需安装解码插件,使用下列命令: + + sudo apt-get install kodi-audioencoder-* kodi-pvr-* + +#### 从 Ubuntu 中移除 Kodi 14 #### + +从系统中移除 Kodi 14,使用下列命令: + + sudo apt-get remove kodi + +同样也应该移除PPA软件源: + + sudo add-apt-repository --remove ppa:team-xbmc/ppa + +我希望这篇简单的文章可以帮助到你在Ubuntu、Linux Mint 和其他 Linux 版本中轻松安装 Kodi 14。你是怎么发现 Kodi 14 Helix 的? + +你有没有使用其他的媒体中心来作为 XBMC 的替代?可以在下面的评论区分享你的观点。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-kodi-14-xbmc-in-ubuntu-14-04-linux-mint-17/ + +作者:[Abhishek][a] +译者:[Vic020/VicYu](http://www.vicyu.net) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/Abhishek/ +[1]:http://kodi.tv/ +[2]:http://kodi.tv/kodi-14-0-helix-unwinds/ +[3]:http://itsfoss.com/watch-netflix-in-ubuntu-14-04/ diff --git a/published/201502/20150105 How To Install Winusb In Ubuntu 14.04.md b/published/201502/20150105 How To Install Winusb In Ubuntu 14.04.md new file mode 100644 index 0000000000..8fb636c6d2 --- /dev/null +++ b/published/201502/20150105 How To Install Winusb In Ubuntu 14.04.md @@ -0,0 +1,47 @@ +如何在 Ubuntu 14.04 中安装 Winusb +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/WinUSB_Ubuntu_1404.jpeg) + +[WinUSB][1]是一款即简单又有用的工具,可以让你从 Windows ISO 镜像或者 DVD 中创建 USB 安装盘(LCTT译注:支持将 Windows Vista/7/8/PE 制作成 USB 安装盘)。它支持 GUI 和命令行,你可以根据你的喜好决定使用哪种。 + +在本文中我们会展示**如何在 Ubuntu 14.04、14.10 和 Linux Mint 17 中安装 WinUSB**。 + +### 在 Ubuntu 14.04、14.10 和 Linux Mint 17 中安装 WinUSB ### + +在 Ubuntu 13.10 之前, WinUSB 一直都在积极开发,且在官方 PPA 中可以找到。但这个 PPA 还没有为 Ubuntu 14.04 和 14.10 更新,不过其二进制文件仍旧可在更新版本的 Ubuntu 和 Linux Mint 中运行。基于[你使用的系统是32位还是64位][2],使用下面的命令来下载二进制文件: + +打开终端,32位的系统下使用下面的命令: + + wget https://launchpad.net/~colingille/+archive/freshlight/+files/winusb_1.0.11+saucy1_i386.deb + +对于64位的系统,使用下面的命令: + + wget https://launchpad.net/~colingille/+archive/freshlight/+files/winusb_1.0.11+saucy1_amd64.deb + +当你下载了正确的二进制包,你可以用下面的命令安装WinUSB: + + sudo dpkg -i winusb* + +不要担心在你安装WinUSB时看到的错误。使用这条命令修复依赖错误: + + sudo apt-get -f install + +之后,你就可以在 Unity Dash 中查找 WinUSB 并且用它在 Ubuntu 14.04 中创建 Windows 的 live USB 了。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/WinUSB_Ubuntu.png) + +我希望这篇文章能够帮到你**在 Ubuntu 14.04、14.10 和 Linux Mint 17 中安装 WinUSB**。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-winusb-in-ubuntu-14-04/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/Abhishek/ +[1]:http://en.congelli.eu/prog_info_winusb.html +[2]:http://itsfoss.com/how-to-know-ubuntu-unity-version/ diff --git a/translated/tech/20150105 Ubuntu apt-get and apt-cache commands with practical examples.md b/published/201502/20150105 Ubuntu apt-get and apt-cache commands with practical examples.md similarity index 90% rename from translated/tech/20150105 Ubuntu apt-get and apt-cache commands with practical examples.md rename to published/201502/20150105 Ubuntu apt-get and apt-cache commands with practical examples.md index 7574a065f8..0b581084a5 100644 --- a/translated/tech/20150105 Ubuntu apt-get and apt-cache commands with practical examples.md +++ b/published/201502/20150105 Ubuntu apt-get and apt-cache commands with practical examples.md @@ -1,6 +1,6 @@ -实例展示Ubuntu中apt-get和apt-cache命令的使用 +apt-get 和 apt-cache 命令实例展示 ================================================================================ -apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具。 apt-get的GUI版本是Synaptic包管理器,本篇中我们会讨论apt-get和apt-cache命令的不同。 +apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具。 apt-get的GUI版本是Synaptic包管理器。本篇中我们会展示apt-get和apt-cache命令的15个不同例子。 ### 示例:1 列出所有可用包 ### @@ -16,7 +16,7 @@ apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具 ### 示例:2 用关键字搜索包 ### -这个命令在你不确定包名时很有用,只要在apt-cache(这里原文是apt-get,应为笔误)后面输入与包相关的关键字即可/ +这个命令在你不确定包名时很有用,只要在apt-cache(LCTT 译注:这里原文是apt-get,应为笔误)后面输入与包相关的关键字即可。 linuxtechi@localhost:~$ apt-cache search "web server" apache2 - Apache HTTP Server @@ -37,7 +37,7 @@ apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具 pnp4nagios-bin: /etc/pnp4nagios/nagios.cfg pnp4nagios-bin: /usr/share/doc/pnp4nagios/examples/nagios.cfg -### 示例:3 显示特定包的基本信息 ### +### 示例:3 显示特定包的基本信息 ### linuxtechi@localhost:~$ apt-cache show postfix Package: postfix @@ -92,7 +92,7 @@ apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具 ### 示例:6 使用 “apt-get update” 更新仓库 ### -使用命令“apt-get update”, 我们可以重新从源仓库中同步文件索引。包的索引从“/etc/apt/sources.list”中检索 +使用命令“apt-get update”, 我们可以重新从源仓库中同步文件索引。包的索引从“/etc/apt/sources.list”中检索。 linuxtechi@localhost:~$ sudo apt-get update Ign http://extras.ubuntu.com utopic InRelease @@ -106,7 +106,7 @@ apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具 Ign http://in.archive.ubuntu.com utopic-backports InRelease ................................................................ -### 示例:7 使用apt-get安装包 ### +### 示例:7 使用apt-get安装包 ### linuxtechi@localhost:~$ sudo apt-get install icinga @@ -140,15 +140,15 @@ apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具 Get:1 http://in.archive.ubuntu.com/ubuntu/ utopic/universe icinga amd64 1.11.6-1build1 [1,474 B] Fetched 1,474 B in 1s (1,363 B/s) -上面的目录会从你当前的目录下载icinga包。 +上面的目录会把icinga包下载到你的当前工作目录。 ### 示例:12 清理本地包占用的磁盘空间 ### linuxtechi@localhost:~$ sudo apt-get clean -上面的命令会清零apt-get在下载包时占用的磁盘空间。 +上面的命令会清空apt-get所下载的包占用的磁盘空间。 -我们也可以使用“**autoclean**”选项来代替“**clean**“,两者之间主要的区别是autoclean清理不再使用且没用的下载。 +我们也可以使用“**autoclean**”选项来代替“**clean**”,两者之间主要的区别是autoclean清理不再使用且没用的下载。 linuxtechi@localhost:~$ sudo apt-get autoclean Reading package lists... Done @@ -167,9 +167,9 @@ apt-get和apt-cache是**Ubuntu Linux**中的命令行下的**包管理**工具 Get:1 Changelog for apache2 (http://changelogs.ubuntu.com/changelogs/pool/main/a/apache2/apache2_2.4.10-1ubuntu1/changelog) [195 kB] Fetched 195 kB in 3s (60.9 kB/s) -上面的命令会下载apache2的更新日志,并在你屏幕上显示。 +上面的命令会下载apache2的更新日志,并在你屏幕上分页显示。 -### 示例15 使用 “check” 选项显示损坏的依赖 ### +### 示例:15 使用 “check” 选项显示损坏的依赖关系 ### linuxtechi@localhost:~$ sudo apt-get check Reading package lists... Done @@ -182,7 +182,7 @@ via: http://www.linuxtechi.com/ubuntu-apt-get-apt-cache-commands-examples/ 作者:[Pradeep Kumar][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/) 荣誉推出 diff --git a/translated/tech/20150106 How to deduplicate files on Linux with dupeGuru.md b/published/201502/20150106 How to deduplicate files on Linux with dupeGuru.md similarity index 51% rename from translated/tech/20150106 How to deduplicate files on Linux with dupeGuru.md rename to published/201502/20150106 How to deduplicate files on Linux with dupeGuru.md index b8ffbd37e8..143e786e09 100644 --- a/translated/tech/20150106 How to deduplicate files on Linux with dupeGuru.md +++ b/published/201502/20150106 How to deduplicate files on Linux with dupeGuru.md @@ -1,10 +1,10 @@ -如何在Linux上使用dupeGuru删除重复文件 +删除重复文件的神器:dupeGuru ================================================================================ -最近,我被要求清理我父亲的文件和文件夹。有一个难题是,里面存在很多不正确的名字的重复文件。有移动硬盘的备份,同时还为同一个文件编辑了多个版本,甚至改变的目录结构,同一个文件被复制了好几次,改变名字,改变位置等,这些挤满了磁盘空间。追踪每一个文件成了一个最大的问题。万幸的是,有一个小巧的软件可以帮助你省下很多时间来找到删除你系统中重复的文件:[dupeGuru][1]。它用Python写成,这个去重软件几个小时钱前切换到了GPLv3许可证。因此是时候用它来清理你的文件了! +最近,我需要清理我父亲的文件和文件夹。有一个难题是,里面存在很多不正确的名字的重复文件。有移动硬盘的备份,同时还为同一个文件编辑了多个版本,甚至改变的目录结构,同一个文件被复制了好几次,名字改变,位置改变等,这些文件挤满了磁盘空间。追踪每一个文件成了一个最大的问题。万幸的是,有一个小巧的软件可以帮助你省下很多时间来找到删除你系统中重复的文件:[dupeGuru][1]。它用Python写成,这个去重软件几个小时前切换到了GPLv3许可证。因此是时候用它来清理你的文件了! ### dupeGuru的安装 ### -在Ubuntu上, 你可以加入Hardcoded的软件PPA: +在Ubuntu上, 你可以加入如下硬编码的软件PPA: $ sudo apt-add-repository ppa:hsoft/ppa $ sudo apt-get update @@ -33,29 +33,29 @@ DupeGuru的构想是既快又安全。这意味着程序不会在你的系统上 ![](https://farm9.staticflickr.com/8600/16016041367_5ab2834efb_z.jpg) -注意的是默认上dupeGuru基于文件的内容匹配,而不是他们的名字。为了防止意外地删除了重要的文件,匹配那列列出了使用的匹配算法。在这里,你可以选择你想要删除的匹配文件,并按下“Action” 按钮来看到可用的操作。 +注意的是默认上dupeGuru基于文件的内容匹配,而不是他们的名字。为了防止意外地删除了重要的文件,匹配列列出了其使用的匹配算法。在这里,你可以选择你想要删除的匹配文件,并按下“Action” 按钮来看到可用的操作。 ![](https://farm8.staticflickr.com/7516/16199976361_c8f919b06e_b.jpg) -可用的选项是相当广泛的。简而言之,你可以删除重复、移动到另外的位置、忽略它们、打开它们、重命名它们甚至用自定义命令运行它们。如果你选择删除重复文件,你可能会像我一样非常意外竟然还有删除选项。 +可用的选项相当广泛。简而言之,你可以删除重复、移动到另外的位置、忽略它们、打开它们、重命名它们甚至用自定义命令运行它们。如果你希望删除重复文件,你可能会像我一样非常意外竟然有这么多种删除方式。 ![](https://farm8.staticflickr.com/7503/16014366568_54f70e3140.jpg) -你不及可以将删除文件移到垃圾箱或者永久删除,还可以选择留下指向原文件的链接(软链接或者硬链接)。也就是说,重复文件按将会删除但是会保留下指向原文件的链接。这将会省下大量的磁盘空间。如果你将这些文件导入到工作空间或者它们有一些依赖时很有用。 +你不仅可以将删除的文件移到垃圾箱或者永久删除,还可以选择留下指向原文件的链接(软链接或者硬链接)。也就是说,重复文件将会删除文件存储,但是会保留下一个指向原文件的链接。这将会省下大量的磁盘空间。如果你将这些文件导入到工作空间或者它们有一些依赖时很有用。 -还有一个奇特的选项:你可以用HTML或者CSV文件导出结果。不确定你会不会这么做,但是我假设你想追踪重复文件而不是想让dupeGuru处理它们时会有用。 +还有一个奇特的选项:你可以用HTML或者CSV文件导出结果。我不确定你会不会需要这么做,但是我假设你想追踪重复文件而不是想让dupeGuru处理它们时会有用。 -最后但并不是最不重要的是,偏好菜单可以让你对去重的想法成真。 +最后但并不是最不重要的是,偏好菜单可以让你按照你的想法来操作去重这件事。 ![](https://farm8.staticflickr.com/7493/16015755749_a9f343b943_z.jpg) -这里你可以选择扫描的标准,基于内容还是基于文字,并且有一个阈值来控制结果的数量。这里同样可以定义自定义在执行中可以选择的命令。在无数其他小的选项中,要注意的是dupeGuru默认忽略小于10KB的文件。 +这里你可以选择扫描的标准,基于内容还是基于名字,并且有一个阈值来控制结果的数量。这里同样可以定义自定义在执行中可以选择的命令。混在其他那些小的选项中,要注意的是dupeGuru默认忽略小于10KB的文件。 -要了解更多的信息,我建议你到[official website][4]官方网站看下,这里有很多文档、论坛支持和其他好东西。 +要了解更多的信息,我建议你到[官方网站][4]看下,这里有很多文档、论坛支持和其他好东西。 -总结一下,dupeGuru是我无论何时准备备份或者释放空间时想到的软件。我发现这对高级用户而言也足够强大了,对新人而言也很直观。锦上添花的是:dupeGuru是跨平台的额,这意味着你可以在Mac或者在Windows PC上都可以使用。如果你有特定的需求,想要清理音乐或者图片。这里有两个变种:[dupeguru-me][5]和 [dupeguru-pe][6], 相应地可以清理音频和图片文件。与常规版本的不同是它不仅比较文件格式还比较特定的媒体数据像质量和码率。 +总结一下,dupeGuru是我无论何时准备备份或者释放空间时所想到的软件。我发现这对高级用户而言也足够强大了,对新人而言也很直观。锦上添花的是:dupeGuru是跨平台的,这意味着你可以在Mac或者在Windows PC上都可以使用。如果你有特定的需求,想要清理音乐或者图片。这里有两个变种:[dupeguru-me][5]和 [dupeguru-pe][6], 相应地可以清理音频和图片文件。与常规版本的不同是它不仅比较文件格式还比较特定的媒体数据像质量和码率。 -你dupeGuru怎么样?你会考虑使用它么?或者你有任何可以替代的软件的建议么?让我在评论区知道你们的想法。 +你觉得dupeGuru怎么样?你会考虑使用它么?或者你有任何可以替代的软件的建议么?让我在评论区知道你们的想法。 -------------------------------------------------------------------------------- @@ -63,7 +63,7 @@ via: http://xmodulo.com/dupeguru-deduplicate-files-linux.html 作者:[Adrien Brochard][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/) 荣誉推出 diff --git a/translated/tech/20150106 Managing Linux server configs with the SaltStack.md b/published/201502/20150106 Managing Linux server configs with the SaltStack.md similarity index 90% rename from translated/tech/20150106 Managing Linux server configs with the SaltStack.md rename to published/201502/20150106 Managing Linux server configs with the SaltStack.md index 1acf7c2434..44c980dddc 100644 --- a/translated/tech/20150106 Managing Linux server configs with the SaltStack.md +++ b/published/201502/20150106 Managing Linux server configs with the SaltStack.md @@ -1,20 +1,21 @@ -SaltStack:Linux服务器配置管理神器 +通过 SaltStack 管理服务器配置 ================================================================================ ![](http://techarena51.com/wp-content/uploads/2015/01/SaltStack+logo+-+black+on+white.png) 我在搜索[Puppet][1]的替代品时,偶然间碰到了Salt。我喜欢puppet,但是我又爱上Salt了:)。我发现Salt在配置和使用上都要比Puppet简单,当然这只是一家之言,你大可不必介怀。另外一个爱上Salt的理由是,它可以让你从命令行管理服务器配置,比如: -要通过Salt来更新所有服务器,你只需运行以下命令 +要通过Salt来更新所有服务器,你只需运行以下命令即可 - salt ‘*’ pkg.upgrade + salt '*' pkg.upgrade -**安装SaltStack到Linux上。** -如果你是在CentOS 6/7上安装的话,那么Salt可以通过EPEL仓库获取到。而对于Pi和Ubuntu Linux用户,你可以从[这里][2]添加Salt仓库。Salt是基于python的,所以你也可以使用‘pip’来安装,但是你得用yum-utils或是其它包管理器来自己处理它的依赖关系哦。 +##安装SaltStack到Linux上## -Salt遵循服务器-客户端模式,服务器端称为领主,而客户端则称为下属。 +如果你是在CentOS 6/7上安装的话,那么Salt可以通过EPEL仓库获取到。而对于Pi和Ubuntu Linux用户,你可以从[这里][2]添加Salt仓库。Salt是基于python的,所以你也可以使用‘pip’来安装,但是你得用yum-utils或是其它包管理器来自己处理它的依赖关系。 -**安装并配置Salt领主** +Salt采用服务器-客户端模式,服务器端称为领主,而客户端则称为下属。 + +###安装并配置Salt领主### [root@salt-master~]# yum install salt-master @@ -27,7 +28,7 @@ Salt配置文件位于/etc/salt和/srv/salt。Salt虽然可以开箱即用,但 [root@salt-master ~]# systemctl start salt-master -**安装并配置Salt下属** +###安装并配置Salt下属### [root@salt-minion~]#yum install salt-minion @@ -39,7 +40,7 @@ Salt配置文件位于/etc/salt和/srv/salt。Salt虽然可以开箱即用,但 在启动时,下属客户机会生成一个密钥和一个id。然后,它会连接到Salt领主服务器并验证自己的身份。Salt领主服务器在允许下属客户机下载配置之前,必须接受下属的密钥。 -**在Salt领主服务器上列出并接受密钥** +###在Salt领主服务器上列出并接受密钥### # 列出所有密钥 [root@salt-master~] salt-key -L @@ -59,7 +60,7 @@ Salt配置文件位于/etc/salt和/srv/salt。Salt虽然可以开箱即用,但 在接受下属客户机的密钥后,你可以使用‘salt’命令来立即获取信息。 -**Salt命令行实例** +##Salt命令行实例## # 检查下属是否启动并运行 [root@salt-master~] salt 'minion.com' test.ping @@ -75,15 +76,15 @@ Salt配置文件位于/etc/salt和/srv/salt。Salt虽然可以开箱即用,但 # 安装/更新所有服务器上的软件 [root@salt-master ~]# salt '*' pkg.install git -salt命令需要一些组件来发送信息,其中之一是mimion id,而另一个是下属客户机上要调用的函数。 +salt命令需要一些组件来发送信息,其中之一是下属客户机的id,而另一个是下属客户机上要调用的函数。 在第一个实例中,我使用‘test’模块的‘ping’函数来检查系统是否启动。该函数并不是真的实施一次ping,它仅仅是在下属客户机作出回应时返回‘真’。 ‘cmd.run’用于执行远程命令,而‘pkg’模块包含了包管理的函数。本文结尾提供了全部内建模块的列表。 -**颗粒实例** +###颗粒实例### -Salt使用一个名为**颗粒**的界面来获取系统信息。你可以使用颗粒在指定属性的系统上运行命令。 +Salt使用一个名为**颗粒(Grains)**的界面来获取系统信息。你可以使用颗粒在指定属性的系统上运行命令。 [root@vps4544 ~]# salt -G 'os:Centos' test.ping minion: @@ -91,11 +92,11 @@ Salt使用一个名为**颗粒**的界面来获取系统信息。你可以使用 更多颗粒实例,请访问http://docs.saltstack.com/en/latest/topics/targeting/grains.html -**通过状态文件系统进行包管理。** +##通过状态文件系统进行包管理## -为了是软件配置自动化,你需要使用状态系统,并创建状态文件。这些文件使用YAML格式和python字典、列表、字符串以及编号来构成数据结构。将这些文件从头到尾研读一遍,这将有助于你更好地理解它的配置。 +为了使软件配置自动化,你需要使用状态系统,并创建状态文件。这些文件使用YAML格式和python字典、列表、字符串以及编号来构成数据结构。将这些文件从头到尾研读一遍,这将有助于你更好地理解它的配置。 -**VIM状态文件实例** +###VIM状态文件实例### [root@salt-master~]# vim /srv/salt/vim.sls vim-enhanced: @@ -107,7 +108,7 @@ Salt使用一个名为**颗粒**的界面来获取系统信息。你可以使用 - group: root - mode: 644 -该文件的第一和第三行成为状态id,它们必须包含有需要管理的包或文件的确切名称或路径。在状态id之后是状态和函数声明,‘pkg’和‘file’是状态声明,而‘installed’和‘managed’是函数声明。函数接受参数,用户、组、模式和源都是函数‘managed’的参数。 +该文件的第一和第三行称为状态id,它们必须包含有需要管理的包或文件的确切名称或路径。在状态id之后是状态和函数声明,‘pkg’和‘file’是状态声明,而‘installed’和‘managed’是函数声明。函数接受参数,用户、组、模式和源都是函数‘managed’的参数。 要将该配置应用到下属客户端,请移动你的‘vimrc’文件到‘/src/salt’,然后运行以下命令。 @@ -253,7 +254,7 @@ Salt使用一个名为**颗粒**的界面来获取系统信息。你可以使用 [root@vps4544 ssh]# cp /etc/ssh/sshd_config /srv/salt/ssh/ [root@vps4544 ssh]# salt 'minion.com' state.sls ssh -**Top文件和环境。** +###Top文件和环境### top文件(top.sls)是用来定义你的环境的文件,它允许你映射下属客户机到包,默认环境是‘base’。你需要定义在基本环境下,哪个包会被安装到哪台服务器。 @@ -268,7 +269,7 @@ top文件(top.sls)是用来定义你的环境的文件,它允许你映射 dev: - /srv/salt/dev -现在,添加一个top.sls文件到/src/salt +现在,添加一个top.sls文件到/src/salt。 [root@salt-master ~]# vim /srv/salt/top.sls base: @@ -299,7 +300,9 @@ top文件(top.sls)是用来定义你的环境的文件,它允许你映射 下属客户机将下载top文件并搜索用于它的配置,领主服务器也会将配置应用到所有下属客户机。 -这仅仅是一个Salt的简明教程,如果你想要深入学习并理解,你可以访问以下链接。如果你已经在使用Salt,那么请告诉我你的建议和意见吧。 +--- + +这仅仅是一个Salt的简明教程,如果你想要深入学习并理解,你可以访问下面的链接。如果你已经在使用Salt,那么请告诉我你的建议和意见吧。 更新: [Foreman][3] 已经通过[插件][4]支持salt。 @@ -329,7 +332,7 @@ via: http://techarena51.com/index.php/getting-started-with-saltstack/ 作者:[Leo G][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/) 荣誉推出 diff --git a/translated/tech/20150108 How to Install SSL on Apache 2.4 in Ubuntu 14.0.4.md b/published/201502/20150108 How to Install SSL on Apache 2.4 in Ubuntu 14.0.4.md similarity index 61% rename from translated/tech/20150108 How to Install SSL on Apache 2.4 in Ubuntu 14.0.4.md rename to published/201502/20150108 How to Install SSL on Apache 2.4 in Ubuntu 14.0.4.md index 6f5a53fdee..638bb2f67f 100644 --- a/translated/tech/20150108 How to Install SSL on Apache 2.4 in Ubuntu 14.0.4.md +++ b/published/201502/20150108 How to Install SSL on Apache 2.4 in Ubuntu 14.0.4.md @@ -1,15 +1,14 @@ -如何在Ubuntu 14.04 上为Apache 2.4 安装SSL +如何在Ubuntu 14.04 上为Apache 2.4 安装SSL支持 ================================================================================ -今天我会站如如何为你的个人网站或者博客安装**SSL 证书**,来保护你的访问者和网站之间通信的安全。 +今天我会讲述如何为你的个人网站或者博客安装**SSL 证书**,来保护你的访问者和网站之间通信的安全。 -安全套接字层或称SSL,是一种加密网站和浏览器之间连接的标准安全技术。这确保服务器和浏览器之间传输的数据保持隐私和安全。这被成千上万的人使用来保护他们与客户的通信。要启用SSL链接,web服务器需要安装SSL证书。 +安全套接字层或称SSL,是一种加密网站和浏览器之间连接的标准安全技术。这确保服务器和浏览器之间传输的数据保持隐私和安全。它被成千上万的人使用来保护他们与客户的通信。要启用SSL链接,Web服务器需要安装SSL证书。 -你可以创建你自己的SSL证书,但是这默认不会被浏览器信任,要修复这个问题,你需要从受信任的证书机构(CA)处购买证书,我们会向你展示如何 -或者证书并在apache中安装。 +你可以创建你自己的SSL证书,但是这默认不会被浏览器所信任,要解决这个问题,你需要从受信任的证书机构(CA)处购买证书,我们会向你展示如何获取证书并在apache中安装。 ### 生成一个证书签名请求 ### -证书机构(CA)会要求你在你的服务器上生成一个证书签名请求(CSR)。这是一个很简单的过程,只需要一会就行,你需要运行下面的命令并输入需要的信息: +证书机构(CA)会要求你在你的服务器上生成一个证书签名请求(CSR)。这是一个很简单的过程,只需要一会儿就行,你需要在你的服务器上运行下面的命令并输入需要的信息: # openssl req -new -newkey rsa:2048 -nodes -keyout yourdomainname.key -out yourdomainname.csr @@ -17,13 +16,13 @@ ![generate csr](http://blog.linoxide.com/wp-content/uploads/2015/01/generate-csr.jpg) -这一步会生成两个文件按:一个用于解密SSL证书的私钥文件,一个证书签名请求(CSR)文件(用于申请你的SSL证书)。 +这一步会生成两个文件:一个用于解密SSL证书的私钥文件,一个证书签名请求(CSR)文件(用于申请你的SSL证书)。 -根据你申请的机构,你会需要上传csr文件或者在网站表格中粘帖他的内容。 +根据你申请的机构,你会需要上传csr文件或者在网站表格中粘帖该文件内容。 ### 在Apache中安装实际的证书 ### -生成步骤完成之后,你会收到新的数字证书,本篇教程中我们使用[Comodo SSL][1]并在一个zip文件中收到了证书。要在apache中使用它,你首先需要用下面的命令为收到的证书创建一个组合的证书: +生成步骤完成之后,你会收到新的数字证书。本篇教程中我们使用[Comodo SSL][1],并在一个它发给我们的zip文件中收到了证书。要在apache中使用它,你首先需要用下面的命令用收到的证书创建一个组合的证书: # cat COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt > bundle.crt @@ -48,12 +47,12 @@ 你现在应该可以用https://YOURDOMAIN/(注意使用‘https’而不是‘http’)来访问你的网站了,并可以看到SSL的进度条了(通常在你浏览器中用一把锁来表示)。 -**NOTE:** All the links must now point to https, if some of the content on the website (like images or css files) still point to http links you will get a warning in the browser, to fix this you have to make sure that every link points to https. -**注意:** 现在所有的链接都必须指向https,如果网站上的一些内容(像图片或者css文件等)仍旧指向http链接的话,你会在浏览器中得到一个警告,要修复这个问题,请确保每个链接都指向了https。 + +**注意:** 现在所有的内容链接都必须指向https,如果网站上的一些内容(像图片或者css文件等)仍旧指向http链接的话,你会在浏览器中得到一个警告,要修复这个问题,请确保每个链接都指向了https。 ### 在你的网站上重定向HTTP请求到HTTPS中 ### -如果你希望重定向常规的HTTP请求到HTTPS,添加下面的文本到你希望的虚拟主机或者如果希望给服务器上所有网站都添加的话就加入到apache.conf中: +如果你希望重定向常规的HTTP请求到HTTPS,添加下面的文本到你希望修改的虚拟主机,或者如果希望给服务器上所有网站都添加的话就加入到apache.conf中: RewriteEngine On RewriteCond %{HTTPS} off @@ -65,7 +64,7 @@ via: http://linoxide.com/ubuntu-how-to/install-ssl-apache-2-4-in-ubuntu/ 作者:[Adrian Dinu][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/) 荣誉推出 diff --git a/translated/share/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md b/published/201502/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md similarity index 64% rename from translated/share/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md rename to published/201502/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md index 339ef5f836..1b414e71c0 100644 --- a/translated/share/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md +++ b/published/201502/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md @@ -2,7 +2,7 @@ Ubuntu 14.04 上 最好的 GNOME Shell 主题 ================================================================================ ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Best_Gnome_Shell_Themes.jpeg) -自定义主题是自定义你的 Linux 桌面的最好方式。假如你在 [Ubuntu 14.04 中安装 GNOME][1] 或 在 Ubuntu 14.10 中安装了 GNOME,你或许想改变默认的主题以呈现出不同的外观。在这里,为帮助你完成该任务,我已经编制好了一个 **Ubuntu 或其他已经安装了 GNOME shell 的 Linux 操作系统中,最好的 GNOME Shell 主题** 的清单 。但在我们揭晓这份清单之前, 让我们先了解如何在 GNOME shell 中安装和应用新的主题。 +最好的方式来自定义你的 Linux 桌面就是使用自定义主题。假如你在 [Ubuntu 14.04 中安装 GNOME][1] 或 在 Ubuntu 14.10 中安装了 GNOME,你或许想改变默认的主题以呈现出不同的外观。在这里,为了帮助你完成该任务,我已经编制好了一个列表—— **Ubuntu 或其他已经安装了 GNOME shell 的 Linux 操作系统中,最好的 GNOME Shell 主题** 。但在我们揭晓这份列表之前, 让我们先了解如何在 GNOME shell 中安装和应用新的主题。 ### 在 GNOME Shell 中安装主题 ### @@ -12,7 +12,7 @@ Ubuntu 14.04 上 最好的 GNOME Shell 主题 sudo apt-get install gnome-tweak-tool ``` -或者,你可以使用新主题通过把它们放置到 `~/.themes` 目录中。如果你需要,我已经写了一个关于 [如何安装和使用 GNOME shell][2]的具体教程。 +或者,你可以通过把主题放置到 `~/.themes` 目录中来使用。如果你需要,我已经写了一个关于 [如何安装和使用 GNOME shell][2]的具体教程。 ### 最好的 GNOME Shell 主题 ### @@ -22,7 +22,7 @@ sudo apt-get install gnome-tweak-tool ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/02/mockups_numix_5.jpeg) -任何没有提到 [Numix 主题][3] 的清单都是不完整的。这个主题是如此地受欢迎以至于 [Numix 团队开发出一个新的 Linux 操作系统, Ozon][4]。考虑到他们的设计作品 Numix 主题,称在不久的将来发行的 `Ozon` 为 [最美丽的 Linux 操作系统][5] 也不为过。 +任何没有提到 [Numix 主题][3] 的列表都是不完整的。这个主题是如此地受欢迎以至于 [Numix 团队开发出一个新的 Linux 操作系统, Ozon][4]。考虑到他们的设计作品 Numix 主题,把不久将发行的 `Ozon` 称为 [最美丽的 Linux 操作系统][5] 也不为过。 使用下面的命令,在基于 Ubuntu 的发行版本中安装 Numix 主题: @@ -36,7 +36,7 @@ sudo apt-get install numix-icon-theme-circle ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Elegance_Colors_Theme_GNOME_Shell.jpeg) -另一个来自 Numix 团队的成员之一的 Satyajit Sahoo 的美丽主题 。[Elegance Colors][6] 拥有自己的 PPA (译者注: 即 Personal Package Archive 的缩写) 使得你可以轻易地安装它: +另一个美丽主题来自 Numix 团队成员之一 Satyajit Sahoo。[Elegance Colors][6] 拥有自己的 PPA (译者注: 即 Personal Package Archive 的缩写) 使得你可以轻松安装它: ``` sudo add-apt-repository ppa:satyajit-happy/themes @@ -48,7 +48,7 @@ sudo apt-get install gnome-shell-theme-elegance-colors ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Moka_GNOME_Shell.jpeg) -[Moka][7] 是另一个迷人的主题,它总是位于美丽的主题的清单之中。它是由给我们带来 Unity Tweak Tool 的开发者所设计。 Moka 是你绝对要尝试的主题之一: +[Moka][7] 是另一个迷人的主题,它总是位于美丽的主题列表之中。它是由 Unity Tweak Tool 的开发者所设计。 Moka 是你一定要尝试的主题: ``` sudo add-apt-repository ppa:moka/stable @@ -68,7 +68,7 @@ sudo apt-get install moka-gnome-shell-theme ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Ciliora_Prima_Gnome_Shell.jpeg) -以前它以 Zukitwo Dark 的名字为人们熟知, Ciliora-Prima 是一个拥有方块图标的主题,可得到的三种版本之间相互略有不同。你可以从下面的链接中下载它们: +以前它以 Zukitwo Dark 的名字为人们熟知, Ciliora-Prima 是一个拥有方块图标的主题,可使用的三种版本之间彼此略有不同。你可以从下面的链接中下载它们: - [Download Ciliora-Prima GNOME Shell Theme][9] @@ -76,7 +76,7 @@ sudo apt-get install moka-gnome-shell-theme ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Faience_GNOME_Shell_Theme.jpeg) -Faience 作为一个受欢迎的主题已经有一段时间了。你可以通过下面的 PPA 为 GNOME 3.10 及更高版本 安装 Faience: +Faience 作为一个受欢迎的主题已经有一段时间了。你可以通过下面的 PPA 为 GNOME 3.10 及更高版本安装 Faience: ``` sudo add-apt-repository ppa:tiheum/equinox @@ -88,7 +88,7 @@ sudo apt-get install faience-theme ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Paper_GTK_Theme.jpeg) -自从 Google 提出 `Material Design`,人们一直为之疯狂。Paper GTK 主题受 Google Material design 启发, 作者为 Sam Hewitt( Moka 项目开发者之一); 它正处于开发中,这意味着当前你将不能对 Paper 拥有最好的体验。假如你和我一样,具有一点实验精神,你绝对可以试一试。 +自从 Google 提出 `Material Design`,人们一直为之疯狂。Paper GTK 主题受 Google Material design 启发,作者为 Sam Hewitt( Moka 项目开发者之一);它正处于开发中,这意味着当前你还不能拥有 Paper 的最好体验。假如你和我一样,具有一点实验精神,你绝对可以试一试。 ``` sudo add-apt-repository ppa:snwh/pulp @@ -96,9 +96,9 @@ sudo apt-get update sudo apt-get install paper-gtk-theme ``` -以上就是我的清单。假如你正试着给你的 Ubuntu 换一个不同的模样,你也应该试试这个清单: [Ubuntu 14.04 中最好的图标主题][10]。 +以上就是我的列表。如果你正试着给你的 Ubuntu 换一个不同的模样,你也应该试试这个列表: [Ubuntu 14.04 中最好的图标主题][10]。 -你是怎样找到这份 **最好的 GNOME shell 主题** 清单的呢?在上面列举的主题中,哪个是你最中意的呢? 如果它没有在这里列出,请一定让我们知道那个你心目中最好的 GNOME shell 主题 。 +你是怎样找到这份 **最好的 GNOME shell 主题** 列表的呢?在上面列举的主题中,哪个是你最中意的? 如果它没有在这里列出,请一定在评论中告诉我们哪个是你心目中最好的 GNOME shell 主题 。 -------------------------------------------------------------------------------- @@ -106,7 +106,7 @@ via: http://itsfoss.com/gnome-shell-themes-ubuntu-1404/ 作者:[Abhishek][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201502/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md b/published/201502/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md new file mode 100644 index 0000000000..250b223b2a --- /dev/null +++ b/published/201502/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md @@ -0,0 +1,146 @@ +如何在 Ubuntu 14.04 里面配置 chroot 环境 +================================================================================ +你可能会有很多理由想要把一个应用、一个用户或者一个环境与你的 linux 系统隔离开来。不同的操作系统有不同的实现方式,而在 linux 中,一个典型的方式就是 chroot 环境。 + +在这份教程中,我会一步一步指导你怎么使用 chroot 命令去配置一个与真实系统分离出来的独立环境。这个功能主要可以用于测试项目,以下这些步骤都在 **Ubuntu 14.04** 虚拟专用服务器(VPS)上执行。 + +学会快速搭建一个简单的 chroot 环境是一项非常实用的技能,绝大多数系统管理员都能从中受益。 + +### Chroot 环境 ### + +一个 chroot 环境就是通过系统调用,将一个本地目录临时变成根目录。一般所说的系统根目录就是挂载点"/",然而使用 chroot 命令后,你可以使用其它目录作为根目录。 + +原则上,任何运行在 chroot 环境内的应用都不能访问系统中其他信息(LCTT译注:使用 chroot 把一个目录变成根目录,在里面运行的应用只能访问本目录内的文件,无法访问到目录外的文件。然而,运行在 chroot 环境的应用可以通过 sysfs 文件系统访问到环境外的信息,所以,这里有个“原则上”的修饰语)。 + +### Chroot 环境的用处 ### + +> - 测试一个不稳定的应用服务不会影响到整个主机系统。 +> +> - 就算使用 root 权限做了些不当的操作,把 chroot 环境搞得一塌糊涂,也不会影响到主机系统。 +> +> - 可以在你的系统中运行另外一个操作系统。 + +举个例子,你可以在 chroot 环境中编译、安装、测试软件,而不去动真实的系统。你也可以**在64位环境下使用 chroot 创建一个32位环境,然后运行一个32位的程序**(LCTT泽注:如果你的真实环境是32位的,那就不能 chroot 一个64位的环境了)。 + +但是为了安全考虑,chroot 环境为非特权用户设立了非常严格的限制,而不是提供完整的安全策略。如果你需要的是有完善的安全策略的隔离方案,可以考虑下 LXC、Docker、vservers等等。 + +### Debootstrap 和 Schroot ### + +使用 chroot 环境需要安装 **debootstrap** 和 **schroot**,这两个软件都在 Ubuntu 的镜像源中。其中 schroot 用于创建 chroot 环境。 + +**Debootstrap** 可以让你通过镜像源安装任何 Debian(或基于 Debian 的)系统,装好的系统会包含最基本的命令。 + +**Schroot** 命令允许用户使用相同的机制去创建 chroot 环境,但在访问 chroot 环境时会做些权限检查,并且会允许用户做些额外的自动设置,比如挂载一些文件系统。 + +在 Ubuntu 14.04 LTS 上,我们可以通过两步来实现这个功能: + +### 1. 安装软件包 ### + +第一步,在Ubuntu 14.04 LTS 主机系统上安装 debootstrap 和 schroot: + + $ sudo apt-get install debootstrap + $ sudo apt-get install schroot + +### 2. 配置 Schroot ### + +现在我们有工具在手,需要指定一个目录作为我们的 chroot 环境。这里创建一个目录先: + + sudo mkdir /linoxide + +编辑 schroot 的配置文件: + + sudo nano /etc/schroot/schroot.conf + +再提醒一下,我们现在是在 Ubuntu 14.04 LTS 系统上。如果我们想测试一个软件包能不能在 Ubuntu 13.10(代号是“Saucy Salamander”) 上运行,就可以在配置文件中添加下面的内容: + + [saucy] + description=Ubuntu Saucy + location=/linoxide + priority=3 + users=arun + root-groups=root + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/schroot-config.png) + +根据你的系统要求,调整上面的配置信息。 + +### 3. 使用 debootstrap 安装32位 Ubuntu 系统 ### + +Debootstrap 命令会在你的 **chroot 环境**里面下载安装一个最小系统。只要你能访问镜像源,你就可以安装任何基于 Debian 的系统版本。 + +前面我们已经创建了 **/linoxide** 目录用于放置 chroot 环境,现在我们可以在这个目录里面运行 debootstrap 了: + + cd /linoxide + sudo debootstrap --variant=buildd --arch amd64 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/ + sudo chroot /linoxide /debootstrap/debootstrap --second-stage + +你可以将 --arch 的参数换成 i386 或其他架构,只要存在这种架构的镜像源。你也可以把镜像源 http://archive.ubuntu.com/ubuntu/ 换成离你最近的镜像源,具体可参考 [Ubuntu 官方镜像主页][1]。 + +**注意:如果你是在64位系统中创建32位系统,你需要在上面第3行命令中加入 --foreign 选项,就像下面的命令:** + + sudo debootstrap --variant=buildd --foreign --arch i386 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/ + +下载需要一段时间,看你网络带宽性能。最小系统大概有500M。 + +### 4. 完成 chroot 环境 ### + +安装完系统后,我们需要做一些收尾工作,确保系统运行正常。首先,保证主机的 fstab 程序能意识到 chroot 环境的存在: + + sudo nano /etc/fstab + +在文件最后面添加下面的配置: + + proc /linoxide/proc proc defaults 0 0 + sysfs /linoxide/sys sysfs defaults 0 0 + +保存并关闭文件。 + +挂载一些文件系统到 chroot 环境: + + $ sudo mount proc /linoxide/proc -t proc + $ sudo mount sysfs /linoxide/sys -t sysfs + +复制 /etc/hosts 文件到 chroot 环境,这样 chroot 环境就可以使用网络了: + + $ sudo cp /etc/hosts /linoxide/etc/hosts + +最后使用 schroot -l 命令列出系统上所有的 chroot 环境: + + $ schroot -l + +使用下面的命令进入 chroot 环境: + + $ sudo chroot /linoxide/ /bin/bash + +测试安装的版本: + + # lsb_release -a + # uname -a + +为了在 chroot 环境中使用图形界面,你需要设置 DISPLAY 环境变量: + + $ DISPLAY=:0.0 ./apps + +目前为止,我已经成功地在 Ubuntu 14.04 LTS 上安装了 Ubuntu 13.10。 + +退出 chroot 环境: + + # exit + +清理一下,卸载文件系统: + + $ sudo umount /test/proc + $ sudo umount /test/sys + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/configure-chroot-environment-ubuntu-14-04/ + +作者:[Arun Pyasi][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://launchpad.net/ubuntu/+archivemirrors diff --git a/translated/tech/20150114 How to Install Ghost on Ubuntu Server 14.04 LTS (Trusty).md b/published/201502/20150114 How to Install Ghost on Ubuntu Server 14.04 LTS (Trusty).md similarity index 84% rename from translated/tech/20150114 How to Install Ghost on Ubuntu Server 14.04 LTS (Trusty).md rename to published/201502/20150114 How to Install Ghost on Ubuntu Server 14.04 LTS (Trusty).md index 95dca20588..ccbee5e704 100644 --- a/translated/tech/20150114 How to Install Ghost on Ubuntu Server 14.04 LTS (Trusty).md +++ b/published/201502/20150114 How to Install Ghost on Ubuntu Server 14.04 LTS (Trusty).md @@ -2,7 +2,7 @@ ================================================================================ 今天我们将会在Ubuntu Server 14.04 LTS (Trusty)上安装一个博客平台Ghost。 -Ghost是一款设计优美的发布平台,很容易使用且对任何人都免费。它是免费的开源软件(FOSS),它的源码在Github上。截至2014年1月,它的界面很简单还有分析面板。编辑使用的是分屏显示。 +Ghost是一款设计优美的发布平台,很容易使用且对任何人都免费。它是免费的开源软件(FOSS),它的源码在Github上。截至2015年1月(LCTT 译注:原文为2014,应为2015),它的界面很简单还有分析面板。编辑使用的是很便利的分屏显示。 因此有了这篇步骤明确的在Ubuntu Server上安装Ghost的教程: @@ -52,12 +52,12 @@ Ghost是一款设计优美的发布平台,很容易使用且对任何人都免 sudo adduser --shell /bin/bash --gecos 'Ghost application' ghost sudo chown -R ghost:ghost /var/www/ghost/ -现在启动Ghost,你需要以“ghsot”用户登录。 +现在启动Ghost,你需要以“ghost”用户登录。 su - ghost cd /var/www/ghost/ -现在,你已经以“ghsot”用户登录,并可启动Ghost: +现在,你已经以“ghost”用户登录,并可启动Ghost: npm start --production @@ -67,7 +67,7 @@ via: http://linoxide.com/ubuntu-how-to/install-ghost-ubuntu-server-14-04/ 作者:[Arun Pyasi][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150114 How to Manage Network using nmcli Tool in RedHat or CentOS 7.x.md b/published/201502/20150114 How to Manage Network using nmcli Tool in RedHat or CentOS 7.x.md similarity index 73% rename from translated/tech/20150114 How to Manage Network using nmcli Tool in RedHat or CentOS 7.x.md rename to published/201502/20150114 How to Manage Network using nmcli Tool in RedHat or CentOS 7.x.md index 10c19b2d92..62bb475206 100644 --- a/translated/tech/20150114 How to Manage Network using nmcli Tool in RedHat or CentOS 7.x.md +++ b/published/201502/20150114 How to Manage Network using nmcli Tool in RedHat or CentOS 7.x.md @@ -10,7 +10,7 @@ nmcli的通常语法是: # nmcli [ OPTIONS ] OBJECT { COMMAND | help } -一件很酷的事情是你可以使用tab键来补全操作,这样你在何时忘记了语法你都可以用tab来看到可用的选项了。 +一件很酷的事情是你可以使用tab键来补全操作,这样你在何时忘记了语法你都可以按下tab来看到可用的选项了。 ![nmcli tab](http://blog.linoxide.com/wp-content/uploads/2014/12/nmcli-tab.jpg) @@ -46,33 +46,33 @@ nmcli通常用法的一些例子: # nmcli device connect eno16777736 -### 使用静态IP添加一个以太网连接 ### +### 添加一个使用静态IP的以太网连接 ### 要用静态IP添加一个以太网连接可以使用下面的命令: - # nmcli connection add type ethernet con-name NAME_OF_CONNECTION ifname interface-name ip4 IP_ADDRESS gw4 GW_ADDRESS + # nmcli connection add type ethernet con-name NAME_OF_CONNECTION ifname INTERFACE-NAME ip4 IP_ADDRESS gw4 GW_ADDRESS -将NAME_OF_CONNECTION替换成新的连接名,IP_ADDRESS替换成你要的IP地址,GW_ADDRESS替换成你使用的网关地址(如果你并不使用网关,你可以忽略这部分)。 +将NAME_OF_CONNECTION替换成新的连接名(LCTT 译注:这个名字以后可以用来对其操作,可以使用任何简单明了的名称),INTERFACE-NAME 替换成你的接口名,IP_ADDRESS替换成你要的IP地址,GW_ADDRESS替换成你使用的网关地址(如果你并不使用网关,你可以忽略这部分)。 - # nmcli connection add type ethernet con-name NEW ifname eno16777736 ip4 192.168.1.141 gw4 192.168.1.1 + # nmcli connection add type ethernet con-name NEW_STATIC ifname eno16777736 ip4 192.168.1.141 gw4 192.168.1.1 -=要设置这个连接的DNS服务器使用下面的命令: +要设置这个连接所使用的DNS服务器使用下面的命令: - # nmcli connection modify NEW ipv4.dns "8.8.8.8 8.8.4.4" + # nmcli connection modify NEW_STATIC ipv4.dns "8.8.8.8 8.8.4.4" 要启用新的以太网连接,使用下面的命令: - # nmcli connection up NEW ifname eno16777736 + # nmcli connection up NEW_STATIC ifname eno16777736 要查看新配置连接的详细信息,使用下面的命令: - # nmcli -p connection show NEW + # nmcli -p connection show NEW_STATIC ![nmcli add static](http://blog.linoxide.com/wp-content/uploads/2014/12/nmcli-add-static.jpg) ### 添加一个使用DHCP的连接 ### -如果你想要添加一个使用DHCP来配置接口IP地址、网关地址和dns服务器地址的新的连接,你要做的就是忽略命令中的ip/gw部分,NetworkManager会自动使用DHCP来获取配置细节。 +如果你想要添加一个使用DHCP来配置接口IP地址、网关地址和dns服务器地址的新的连接,你要做的就是忽略上述命令中的ip/gw部分,NetworkManager会自动使用DHCP来获取配置细节。 比如,要创建一个新的叫NEW_DHCP的DHCP连接,在设备eno16777736上你可以使用下面的命令: @@ -84,7 +84,7 @@ via: http://linoxide.com/linux-command/nmcli-tool-red-hat-centos-7/ 作者:[Adrian Dinu][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/) 荣誉推出 diff --git a/translated/tech/20150114 Installing Telnet In CentOS or RHEL or Scientific Linux 6 & 7.md b/published/201502/20150114 Installing Telnet In CentOS or RHEL or Scientific Linux 6 & 7.md similarity index 97% rename from translated/tech/20150114 Installing Telnet In CentOS or RHEL or Scientific Linux 6 & 7.md rename to published/201502/20150114 Installing Telnet In CentOS or RHEL or Scientific Linux 6 & 7.md index 901ce4380f..0777cc4d0d 100644 --- a/translated/tech/20150114 Installing Telnet In CentOS or RHEL or Scientific Linux 6 & 7.md +++ b/published/201502/20150114 Installing Telnet In CentOS or RHEL or Scientific Linux 6 & 7.md @@ -65,7 +65,7 @@ vi /etc/sysconfig/iptables -加入红色显示的行: +加入如下行“-A INPUT -p tcp -m state --state NEW --dport 23 -j ACCEPT”: # Firewall configuration written by system-config-firewall # Manual customization of this file is not recommended. @@ -151,7 +151,7 @@ via: http://www.unixmen.com/installing-telnet-centosrhelscientific-linux-6-7/ 作者:[SK][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/) 荣誉推出 diff --git a/translated/talk/20150114 Why Mac users don't switch to Linux.md b/published/201502/20150114 Why Mac users don't switch to Linux.md similarity index 100% rename from translated/talk/20150114 Why Mac users don't switch to Linux.md rename to published/201502/20150114 Why Mac users don't switch to Linux.md diff --git a/translated/tech/20150115 Configure Mate Desktop With Mate Tweak.md b/published/201502/20150115 Configure Mate Desktop With Mate Tweak.md similarity index 92% rename from translated/tech/20150115 Configure Mate Desktop With Mate Tweak.md rename to published/201502/20150115 Configure Mate Desktop With Mate Tweak.md index 7ae68abaae..3b2f1c972b 100644 --- a/translated/tech/20150115 Configure Mate Desktop With Mate Tweak.md +++ b/published/201502/20150115 Configure Mate Desktop With Mate Tweak.md @@ -4,7 +4,7 @@ [在Ubuntu中安装Mate桌面][1]是一码事但是你或许想要知道如何**配置Mate桌面**? 大多数桌面环境都有它们自己的调整工具。比如Unity有Unity Tweak,Gnome有Gnome Tweak,Elementary OS有 Elementary OS Teweak。好消息是Mate桌面也有它自己的调整工具,叫Mate Tweak][2]。 -Mate Tweak是[mintDesktop][3]的克隆分支,一款Linux Mint的配置工具。 +Mate Tweak是[mintDesktop][3]的克隆分支,那是一款Linux Mint的配置工具。 ### 安装Mate Tweak来配置Mate桌面 ### @@ -22,7 +22,7 @@ via: http://itsfoss.com/configure-mate-desktop-mate-tweak/ 作者:[Abhishek][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/) 荣誉推出 diff --git a/published/20150115 How To Extract a Tar Files To a Different Directory on a Linux or Unix-like Systems.md b/published/201502/20150115 How To Extract a Tar Files To a Different Directory on a Linux or Unix-like Systems.md similarity index 100% rename from published/20150115 How To Extract a Tar Files To a Different Directory on a Linux or Unix-like Systems.md rename to published/201502/20150115 How To Extract a Tar Files To a Different Directory on a Linux or Unix-like Systems.md diff --git a/published/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md b/published/201502/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md similarity index 100% rename from published/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md rename to published/201502/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md diff --git a/translated/share/20150116 A Step By Step Guide To Installing Xubuntu Linux.md b/published/201502/20150116 A Step By Step Guide To Installing Xubuntu Linux.md similarity index 76% rename from translated/share/20150116 A Step By Step Guide To Installing Xubuntu Linux.md rename to published/201502/20150116 A Step By Step Guide To Installing Xubuntu Linux.md index 3fc83ba9ef..ed6c31e46e 100644 --- a/translated/share/20150116 A Step By Step Guide To Installing Xubuntu Linux.md +++ b/published/201502/20150116 A Step By Step Guide To Installing Xubuntu Linux.md @@ -5,17 +5,17 @@ ![Xubuntu](http://f.tqn.com/y/linux/1/S/J/J/1/fulldesktop.png) -这个教程会一步一步的教你如何安装Xubuntu Linux。 +这个教程会一步步教你如何安装Xubuntu Linux。 为什么你会想要安装Xubuntu呢?这里有三个原因: 1. 你有一台安装Windows XP的计算机,但是微软已经不再对Windows XP提供支持 -2. 你的[电脑运行很慢][1],并且你想要一个轻量级并且跟得上时代潮流的操作系统 -3. 你想要增加一些DIY经验 +2. 你的[电脑运行很慢][1],你想要一个轻量级并且跟得上时代潮流的操作系统 +3. 你想要自定义你的电脑使用体验 -首先,你需要[下载Xubuntu,并且创建一个启动优盘][2]。 +首先,你需要[下载Xubuntu,并且创建一个可启动的USB驱动器][2]。 -完成以后,用优盘启动到Xubuntu,然后点击安装Xubuntu图标。 +完成以后,用优盘启动到当前版本的Xubuntu,然后点击安装Xubuntu图标。 ### 选择你的安装语言 ### @@ -29,9 +29,9 @@ ![选择无线网络](http://f.tqn.com/y/linux/1/S/L/J/1/xubuntuinstall2.png) -第二步,需要你来选择你的网络链接。这个步骤不是必须的。 +第二步,需要你来选择你的网络链接。这个步骤不是必须的,你在这个阶段可能会选择不设置网络链接是有原因的。 -如果你[网络状况十分糟糕][3],直接跳过是一个明智的选择,因为安装程序会在安装过程中从网络上下载一些更新包。那么可想而知,你的安装过程就会花费很长的时间。 +如果你的[网络状况十分糟糕][3],不选无线网络是一个明智的选择,因为安装程序会在安装过程中从网络上下载一些更新包。那么可想而知,你的安装过程就会花费很长的时间。 当然,如果你的[网速很快][4],选择一个无线网,然后输入密码就行了。 @@ -51,17 +51,19 @@ 安装过程中,如果电池电量耗完的话,你才必须要链接到到电源。 +请注意,如果你连网了,这里有一个关闭安装过程中下载更新包的复选框。 + 这里还有一个复选框,提示你是否安装用于[播放MP3][5]或者[Flash视频][6]的第三方软件,当然,这些内容也可以在安装完成以后进行。 ### 选择安装类型 ### ![选择安装类型](http://f.tqn.com/y/linux/1/S/N/J/1/xubuntuinstall4.png) -接下来的步骤是选择安装类型。显示那些选项,取决于之前电脑上安装了什么系统。 +接下来的步骤是选择安装类型。显示哪些选项,取决于之前电脑上安装了什么系统。 -在我的示例中,我已经安装了[Ubuntu MATE][7],所以,我的选项是重装Ubuntu、删除并且重装、Xubuntu和Ubuntu双系统、以及其他。 +在我的示例中,我已经安装了[Ubuntu MATE][7],所以,我的选项是重装Ubuntu、删除并且重装、安装Xubuntu和Ubuntu双系统,或者其它。 -如果你的计算机上安装了Windows,那么你得到的选项就是,安装双系统、使用Xubuntu替换Windows以及其他。 +如果你的计算机上安装了Windows,那么你得到的选项就是,安装双系统,使用Xubuntu替换Windows或者其他。 这个教程只是用来说明如何在计算机上安装Xubuntu,而不是怎么安装双系统,那将是一个完全不同的教程。 @@ -73,11 +75,11 @@ ![清除磁盘并且安装Xubuntu](http://f.tqn.com/y/linux/1/S/O/J/1/xubuntuinstall5.png) -选择你要在那个磁盘上安装的Xubuntu。 +选择你要安装Xubuntu的磁盘。 点击“Install Now”。 -这时候会弹出一个警告窗口,会提示你,选择的磁盘驱动器会被完全清除,然后会显示一个新创建的分区列表。 +这时候会弹出一个警告窗口,会提示你选择的磁盘驱动器会被完全清除,然后会显示一个新创建的分区列表。 > 备注:这是你改变主意的最后一个机会,如果你点击继续,磁盘就会被完全清除,然后开始安装Xubuntu。 @@ -103,7 +105,7 @@ 如果你需要确认键盘布局是否正确,可以在“Type here to test your keyboard”输入字符。你需要特别注意fn键和一些符号,例如英镑和美元符号。 -如果在安装过程中没有设对也没关系,安装完成以后在Xubuntu系统设置中也可以进行调整。 +如果在安装过程中没有设置正确也没关系,安装完成以后在Xubuntu系统设置中也可以进行调整。 ### 新增用户 ### @@ -115,9 +117,9 @@ 为用户选择一个用户名并且[创建一个密码][8]。为了保证你的密码输入正确,你需要输入两遍。 -如果你想要系统自动登入,而不是在每次启动的时候输入密码,选择“Log in automatically”。尽管对于我来说,我肯定不会选择这个选项。 +如果你想要系统自动登入,而不是在每次启动的时候输入密码,选择“Log in automatically”。对于我来说,我肯定不会选择这个选项。 -更好的选项是“Require my password to log in”,并且如果你想要更高的安全等级,勾选“Encrypt my home fodler”选项。 +更好的选项是“Require my password to log in”,并且如果你想要更高的安全等级,勾选“Encrypt my home folder”选项。 点击“Continue”然后继续。 @@ -125,9 +127,9 @@ ![等待安装完成](http://f.tqn.com/y/linux/1/S/S/J/1/xubuntuinstall10.png) -这个步骤中,将会会拷贝文件到你的电脑,并且安装Xubuntu。 +这个步骤中,将会拷贝文件到你的电脑,并且安装Xubuntu。 -在这个过程中,你会看到一个简短的幻灯片。在这个时候你可以去[泡一杯咖啡][9]或者放松一下什么的。 +在这个过程中,你会看到一个简短的幻灯片。在这个时候你可以去[泡一杯咖啡][9]或者放松一下。 安装完成以后,会弹出提示告诉你是否重新启动,并且开始体验一下新安装的Xubuntu系统。 @@ -139,7 +141,7 @@ via : http://linux.about.com/od/howtos/ss/A-Step-By-Step-Guide-To-Installing-Xu 作者:[Gary Newell][a] 译者:[zhouj-sh](https://github.com/zhouj-sh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 @@ -152,4 +154,4 @@ via : http://linux.about.com/od/howtos/ss/A-Step-By-Step-Guide-To-Installing-Xu [6]:http://animation.about.com/od/2danimationtutorials/ss/2d_fla_lesson1.htm [7]:http://www.everydaylinuxuser.com/2014/11/ubuntu-mate-vs-lubuntu-on-old-netbook.html [8]:http://netsecurity.about.com/cs/generalsecurity/a/aa112103b.htm -[9]:http://coffeetea.about.com/od/preparationandrecipes/ \ No newline at end of file +[9]:http://coffeetea.about.com/od/preparationandrecipes/ diff --git a/translated/share/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md b/published/201502/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md similarity index 87% rename from translated/share/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md rename to published/201502/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md index 8025e91aa1..df7266a7a1 100644 --- a/translated/share/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md +++ b/published/201502/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md @@ -1,4 +1,4 @@ -3种创建轻量、持久化的Xubuntu Linux USB系统盘的方法 +3种方法来创建轻量、持久化的Xubuntu Linux USB系统盘 ================================================================================ ### 使用Universal USB Install创建持久化USB Xubuntu系统盘 ### @@ -9,13 +9,13 @@ > 译者注:持久化Linux USB系统盘(Persistent Linux USB drive),安装在优盘的Linux系统,允许用户保存数据到优盘而不是仅仅将这些修改留在内存中。这些数据可以在重启后恢复并且重新使用,甚至是在其他的机器上面启动也没有关系。一般情况下,持久化系统盘会安装一个压缩过的Linux操作系统。 -为什么你需要做这些事情呢,这里有5个很好的理由: +为什么要这样做呢,这里有5个很好的理由: -1. 你想要在你的电脑上安装一个轻量的并且功能完善的Linux版本。 +1. 你想要在你的电脑上安装一个轻量并且功能完善的Linux版本。 2. 你的电脑没有硬盘,那么一个Linux USB系统盘就可以让这台电脑摆脱被扔到垃圾堆的命运。 3. 你想体验一下Linux,但是你却不想花太多的时间去准备。 4. 你想创建一个USB系统恢复盘,并且在优盘上安装一些特定的应用程序。 -5. 你想要一个可以装在屁股口袋或者可以挂在钥匙圈上面的可定制的Linux版本。 +5. 你想要一个可定制的Linux版本,能装在后兜或者挂在钥匙圈上。 现在,我们有了充足的理由,那么开始做一些准备工作吧。 @@ -51,7 +51,7 @@ 14.04版是一个长期维护的版本,维护周期会持续3年。14.10是最新版本,但是只提供9个月的维护。 -你选择了下载站点以后,会提示你选择32位版本或者64位版本。如果你的电脑是32位,就选32位版本,同样,如果你的电脑是64位选64位版本就行了。 +你选择了下载站点以后,会提示你选择32位版本或者64位版本。如果你的电脑是32位,就选32位版本,同样,如果你的电脑是64位,那就选64位版本。 [点击这里,有一个教程来教你辨别你的电脑是32位还是64位][5]。 @@ -105,7 +105,7 @@ Universal USB Installer主界面出现以后,从下拉列表中选择你想要 Startup Disk Creator使用起来很简单。 -界面被划分成两个部分。在上面部分指定下载的系统盘路径,在下面指定安装的优盘。 +界面被划分成两个部分。上部分指定下载的系统盘路径,下部分指定安装的优盘。 首先,点击“Other”按钮,第二步,选择你所下载的Xubuntu ISO文件。 @@ -119,7 +119,7 @@ Startup Disk Creator使用起来很简单。 你创建的过程中,你可能需要输入几次你的系统密码,USB系统盘创建完成以后,你就可以使用它启动到Xubuntu了。 -### 使用UNetbootin创建持久化Xubuntu系统盘 ### +### 使用UNetbootin创建持久化的Xubuntu系统盘 ### ![](http://f.tqn.com/y/linux/1/S/I/J/1/unetbootin1.png) @@ -127,7 +127,7 @@ Startup Disk Creator使用起来很简单。 个人来说,在Windows系统上面我喜欢用Universal USB Installer,但Linux的话,UNetbootin更合适一些。 -> 注:UNetbootin并不是100%完美的,它并不支持所有的Linux发行版。 +> 注:UNetbootin并不是100%完美的,不是所有的Linux发行版都支持。 Windows平台可以点击[这里][8]下载UNetbootin。 @@ -141,11 +141,11 @@ Linux平台可以使用package manager安装UNetbootin。 > sudo unetbootin -UNetbootin的界面分为两个部分。你可以在上面的部分选择一个Linux发行版,然后下载它,如果已经下载了某个发行版,可以在下半部分选择已经下载的系统盘。 +UNetbootin的界面分为两个部分。你可以在上半部分选择一个Linux发行版,然后下载它,如果已经下载了某个发行版,可以在下半部分选择已经下载的系统盘。 点击“Diskimage”单选框,然后点击三个点的按钮。找到已经下载的Xubuntu ISO文件。路径会显示到按钮旁边的文本框里面。 -修改“Space used to preserve files across reboots”的值,来指定你想要用来存储“持久化”数据的空间大小。 +设置“Space used to preserve files across reboots”的值,来指定你想要用来存储“持久化”数据的空间大小。 类型选择USB drive,然后选择优盘的盘符。 @@ -159,7 +159,7 @@ via : http://linux.about.com/od/howtos/ss/How-To-Create-A-Persistent-Bootable-Xu 作者:[Gary Newell][a] 译者:[zhouj-sh](https://github.com/Zhouj-sh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 @@ -171,4 +171,4 @@ via : http://linux.about.com/od/howtos/ss/How-To-Create-A-Persistent-Bootable-Xu [5]:http://pcsupport.about.com/od/fixtheproblem/f/32-bit-64-bit-windows.htm [6]:http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/ [7]:http://linux.about.com/od/howtos/fl/Learn-Ubuntu-The-Unity-Dash.htm -[8]:http://linux.about.com/od/howtos/ss/How-To-Create-A-UEFI-Bootable-Ubuntu-USB-Drive-Using-Windows.htm \ No newline at end of file +[8]:http://linux.about.com/od/howtos/ss/How-To-Create-A-UEFI-Bootable-Ubuntu-USB-Drive-Using-Windows.htm diff --git a/published/201502/20150119 Cutegram--A Better Telegram Client For GNU or Linux.md b/published/201502/20150119 Cutegram--A Better Telegram Client For GNU or Linux.md new file mode 100644 index 0000000000..57511dd73c --- /dev/null +++ b/published/201502/20150119 Cutegram--A Better Telegram Client For GNU or Linux.md @@ -0,0 +1,76 @@ +Cutegram: 一个GNU/Linux下不错的Telegram客户端 +================================================================================ +不需要再介绍**Telegram**了,对吧。Telegram是一款流行的免费即时通信工具,帮助你在全球与朋友聊天。不像Whatsapp,Telegram是永久免费、没有广告、没有订阅费用的。并且Telegram客户端也是开源的。Telegram在许多不同的平台中都有,包括Linux、Android、iOS、Windows Phone和Mac OS X。使用telegram发送的消息是高度加密且会自我销毁。它很安全,并且没有对你的多媒体和聊天的大小作限制。 + +在[先前的教程][1]中我们已经提到你可以在Ubuntu/Debian中安装Telegram。然而,有一个新的Telegram客户端叫**Cutegram**出现了,可以使你的聊天体验更加有趣和简单。 + +### Cutegram是什么? ### + +Cutegram是一款专注于用户友好、与Linux桌面环境兼容和易于使用的开源 telegram 的 GNU/Linux客户端。Cutegram使用Qt5、QML、libqtelegram、libappindication、AsemanQtTools技术和Faenzatu图标和Twitter emojie图片集。它在GPLv3许可证下免费发布。 + +### 安装 Cutegram ### + +进入Cutegrm的首页病根据你的发行版版本选择最新的版本。我使用的是Ubuntu 64位版,所以我下载的是.deb文件。 + + wget http://aseman.co/downloads/cutegram/cutegram_1.0.2-1-amd64.deb + +现在,如下安装Cutegram: + + sudo apt-get install gdebi + sudo gdebi cutegram_1.0.2-1-amd64.deb + +对于其他发行版,运行下面的命令。 + +**64位:** + + wget http://aseman.co/downloads/cutegram/cutegram-1.0.2-linux-x64-installer.run + +**32位:** + + wget http://aseman.co/downloads/cutegram/cutegram-1.0.2-linux-installer.run + +设置执行权限: + + chmod a+x cutegram-1.0.2-linux*.run + +如下进行安装。 + + sudo ./cutegram-1.0.2-linux*.run + +### 使用 ### + +在菜单或者Unity dash中启动Cutegram。在登录界面,选择你的国家并输入电话号码,最好点击**Login** + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Cutegram_005.png) + +一个验证码将会发送到你手机上。输入验证码并点击**Sign in** + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Cutegram_002.png) + +你会看到 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Cutegram_003.png) + +开始聊天吧! + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Cutegram_004.png) + +接着,你可以设置头像,开始新的聊天/群聊,或者使用左边面板的按钮开始秘密聊天。 + +玩得开心!干杯!! + +更多细节,请关注[Cutegram 网站][2] + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/cutegram-better-telegram-client-gnulinux/ + +作者:[SK][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:http://www.unixmen.com/install-telegram-desktop-via-ppa/ +[2]:http://aseman.co/en/products/cutegram/ diff --git a/translated/tech/20150119 How To Disable IPv6 In CentOS 7.md b/published/201502/20150119 How To Disable IPv6 In CentOS 7.md similarity index 88% rename from translated/tech/20150119 How To Disable IPv6 In CentOS 7.md rename to published/201502/20150119 How To Disable IPv6 In CentOS 7.md index 080799f17c..a148053251 100644 --- a/translated/tech/20150119 How To Disable IPv6 In CentOS 7.md +++ b/published/201502/20150119 How To Disable IPv6 In CentOS 7.md @@ -1,6 +1,6 @@ 如何在CentOS 7中禁止IPv6 ================================================================================ -最近,我的一位朋友问我该如何禁止IPv6。在搜索了一番之后,我找到了下面的方案。下面就是我在CentOS 7迷你版中禁止IPv6的方法。 +最近,我的一位朋友问我该如何禁止IPv6。在搜索了一番之后,我找到了下面的方案。下面就是在我的CentOS 7 迷你服务器禁止IPv6的方法。 你可以用两个方法做到这个。 @@ -41,7 +41,6 @@ ### 我在禁止IPv6后遇到问题怎么办 ### -You may get problems after disabling IPv6. 你可能在禁止IPv6后遇到一些问题 #### 问题1: #### @@ -60,9 +59,7 @@ vi /etc/ssh/sshd_config AddressFamily inet -或者, - -在这行的前面去掉注释**(#)**: +或者,在这行的前面去掉注释**(#)**: #ListenAddress 0.0.0.0 @@ -89,7 +86,7 @@ via: http://www.unixmen.com/disable-ipv6-centos-7/ 作者:[SK][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/) 荣誉推出 diff --git a/translated/tech/20150119 Quick Tip--How To Restart Cinnamon After Crash.md b/published/201502/20150119 Quick Tip--How To Restart Cinnamon After Crash.md similarity index 83% rename from translated/tech/20150119 Quick Tip--How To Restart Cinnamon After Crash.md rename to published/201502/20150119 Quick Tip--How To Restart Cinnamon After Crash.md index eee9d41d0c..e5b6cbae5a 100644 --- a/translated/tech/20150119 Quick Tip--How To Restart Cinnamon After Crash.md +++ b/published/201502/20150119 Quick Tip--How To Restart Cinnamon After Crash.md @@ -1,6 +1,6 @@ 如何在崩溃后重启Cinnamon ================================================================================ -Cinnamon是一个提供了高级创新特性和传统用户体验的Linux桌面环境。桌面布局和Gnome 2相似。底层的技术与Gnome Shell相似。它的重点是让用户有宾至如归的感觉并提供一个简单和舒适的桌面体验。 +Cinnamon是一个提供了高级创新特性和传统用户体验的Linux桌面环境。桌面布局和Gnome 2相似。底层的技术与Gnome Shell相似。它的重点是让用户以熟悉的方式得到简单和舒适的桌面体验。 本篇中我们会展示一个快速的方法来重启Cinnamon而不用在崩溃后登出或者重启。 @@ -18,15 +18,15 @@ Cinnamon应该会重新在面板和菜单中显示图标和文本了。 ![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/linux_mint_cinnamon_menu.png) -享受吧! +试试吧! -------------------------------------------------------------------------------- via: http://www.unixmen.com/quick-tip-restart-cinnamon-crash/ 作者:[Enock Seth Nyamador][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/talk/20150121 If a 32-bit integer overflows.md b/published/201502/20150121 If a 32-bit integer overflows.md similarity index 87% rename from translated/talk/20150121 If a 32-bit integer overflows.md rename to published/201502/20150121 If a 32-bit integer overflows.md index 651e829189..30687f4bc8 100644 --- a/translated/talk/20150121 If a 32-bit integer overflows.md +++ b/published/201502/20150121 If a 32-bit integer overflows.md @@ -1,16 +1,17 @@ 如果使用32位整型会溢出,那么是否可以使用一个40位结构体代替64位长整型? ---------- +====== + +###问题: -#问题: 假如说,使用32位的整型会溢出,在不考虑使用长整型的情况下,如果我们只需要表示2的40次方范围内的数,是否可以利用某些40位长的数据类型来表示呢?这样的话,每个整型数就可以节省24位的空间。 如果可以,该怎么做? 需求是:我现在必须处理数以亿计的数字,所以在存储空间上受到了很大的限制。 -#回答: +###回答: -##可以是可以,但是…… +可以是可以,但是…… 这种方法的确可行,但这么做通常没什么意义(因为几乎没有程序需要处理多达十亿的数字): @@ -22,14 +23,15 @@ struct bad_idea }; ``` -在这里,变量var占据40位大小,但是以生成代码时拥有非常低的运行效率来换取的(事实证明“非常”二字言过其实了——测试中程序开销仅仅增加了1%到2%,正如下面的测试时间所示),而且这么做通常没什么用。除非你还需要保存一个24位的值(或者是8位、16位的值),这样你皆可以它们放到同一个结构中。不然的话,因为对齐内存地址产生的开销会抵消这么做带来的好处。 +在这里,变量var占据40位大小,但是这是以生成代码时拥有非常低的运行效率来换取的(事实证明“非常”二字言过其实了——测试中程序开销仅仅增加了1%到2%,正如下面的测试时间所示),而且这么做通常没什么用。除非你还需要保存一个24位的值(或者是8位、16位的值),这样你皆可以它们放到同一个结构中。不然的话,因为对齐内存地址产生的开销会抵消这么做带来的好处。 在任何情况下,除非你是真的需要保存数以亿计的数字,否则这样做给内存消耗带来的好处是可以忽略不计的(但是为了处理这些位字段的额外代码量是不可忽略的!)。 ###说明: 在此期间,这个问题已经被更新了,是为了说明实际上确实有需要处理数以亿计数字的情况。假设,采取某些措施来防止因为结构体对齐和填充抵消好处(比如在后24位中存储其它的内容,或者使用多个8位来存储40位),那么这么做就变得有意义了。 -如果有十亿个数,每个数都节省三个字节的空间,那么这么做就非常有用了。因为使用更小的空间存储要求更少的内存页,也就会产生更少的cache和TLB不命中和内存缺页(单个缺页会产生数以千万计的指令(译者注:直译是这样,但语义说不通!))。 + +如果有十亿个数,每个数都节省三个字节的空间,那么这么做就非常有用了。因为使用更小的空间存储要求更少的内存页,也就会产生更少的cache和TLB不命中和内存缺页(单个缺页会产生数以千万计的指令 [译者注:直译是这样,但语义说不通!])。 尽管上面提到的情况不足以充分利用到剩余的24位(它仅仅使用了40位部分),如果确实在剩余位中放入了有用的数据,那么使用类似下面的方法会使得这种思路就管理内存而言显得非常有用。 @@ -43,9 +45,10 @@ struct using_gaps ``` 结构体大小和对齐长度等于64位整型的大小,所以只要使用得当就不会浪费空间,比如对一个保存10亿个数的数组使用这个结构(不考虑使用指定编译器的扩展)。如果你不会用到一个8位的值,那么你可以使用一个48位和16位的值(giving a bigger overflow margin)。 + 或者以牺牲可用性为代价,把8个64位的值放入这样的结构体中(或者使用40和64的组合使得其和满足320)。当然,在这种情况下,通过代码去访问数组结构体中的元素会变得非常麻烦(尽管一种方法是实现一个operator[]在功能上还原线性数组,隐藏结构体的复杂性)。 -更新: +###更新: 我写了一个快速测试工具,只是为了获得位字段的开销(以及伴随位字段引用的重载操作)。由于长度限制将代码发布在gcc.godbolt.org上,在本人64位Win7上的测试结果如下: @@ -85,7 +88,7 @@ via:[stackoverflow](http://stackoverflow.com/questions/27705409/if-a-32-bit-inte 作者:[Damon][a][Michael Kohne][b] 译者:[KayGuoWhu](https://github.com/KayGuoWhu) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md b/published/201502/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md similarity index 100% rename from published/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md rename to published/201502/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md diff --git a/translated/tech/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md b/published/201502/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md similarity index 81% rename from translated/tech/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md rename to published/201502/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md index 6f0a5effe3..70326e249f 100644 --- a/translated/tech/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md +++ b/published/201502/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md @@ -2,7 +2,7 @@ Linux 有问必答: 如何在Linux中加入cron任务 ================================================================================ > **提问**: 我想在我的Linux中安排一个计划任务,该任务在固定时间周期性地运行。我该如何在Linux中添加一个cron任务? -cron是Linux中默认的计划任务。使用cron,你可以安排一个计划(比如:命令或者shell脚本)周期性地运行或者在指定的小时、天、周、月等特定时间运行。cron在你安排不同的常规维护任务时是很有用的,比如周期性地备份、日志循环、检查文件系统、监测磁盘空间等等。 +cron是Linux中默认的计划任务。使用cron,你可以安排一个计划(比如:命令或者shell脚本)周期性地运行或者在指定的分钟、小时、天、周、月等特定时间运行。cron在你安排不同的常规维护任务时是很有用的,比如周期性地备份、日志循环、检查文件系统、监测磁盘空间等等。 ### 从命令行中添加cron任务 ### @@ -22,7 +22,7 @@ cron是Linux中默认的计划任务。使用cron,你可以安排一个计划 每个cron任务的格式如下。 - + <分钟> <小时> <日> <月> <星期> <命令> 前5个元素定义了任务的计划,最后一个元素是命令或者脚本的完整路径。 @@ -30,13 +30,13 @@ cron是Linux中默认的计划任务。使用cron,你可以安排一个计划 下面是一些cron任务示例。 -- *** * * * * /home/dan/bin/script.sh**: 每分钟运行。 +- **\* * * * * /home/dan/bin/script.sh**: 每分钟运行。 - **0 * * * * /home/dan/bin/script.sh**: 每小时运行。 -- **0 0 * * * /home/dan/bin/script.sh**: 每12小时运行。 +- **0 0 * * * /home/dan/bin/script.sh**: 每天零点运行。 - **0 9,18 * * * /home/dan/bin/script.sh**: 在每天的9AM和6PM运行。 - **0 9-18 * * * /home/dan/bin/script.sh**: 在9AM到6PM的每个小时运行。 - **0 9-18 * * 1-5 /home/dan/bin/script.sh**: 周一到周五的9AM到6PM每小时运行。 -- ***/10 * * * * /home/dan/bin/script.sh**: 每10分钟运行。 +- **\*/10 * * * * /home/dan/bin/script.sh**: 每10分钟运行。 一旦完成上面的设置步骤后,按下Ctrl+X来保存并退出编辑器。此时,新增的计划任务应该已经激活了。 @@ -61,6 +61,6 @@ cron是Linux中默认的计划任务。使用cron,你可以安排一个计划 via: http://ask.xmodulo.com/add-cron-job-linux.html 译者:[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/) 荣誉推出 \ No newline at end of file diff --git a/published/20150122 Linux FAQs with Answers--How to check memory usage on Linux.md b/published/201502/20150122 Linux FAQs with Answers--How to check memory usage on Linux.md similarity index 100% rename from published/20150122 Linux FAQs with Answers--How to check memory usage on Linux.md rename to published/201502/20150122 Linux FAQs with Answers--How to check memory usage on Linux.md diff --git a/translated/tech/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md b/published/201502/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md similarity index 94% rename from translated/tech/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md rename to published/201502/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md index 7c382558eb..145ef9168e 100644 --- a/translated/tech/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md +++ b/published/201502/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md @@ -6,7 +6,7 @@ curl是一个强大的命令行工具,它可以通过网络将信息传递给 ![](https://farm8.staticflickr.com/7568/16225032086_fb8f1c508a_b.jpg) -在一些个例中,或许你想要在一个HTTP请求中覆盖掉默认的HTTP头或者添加一个新的自定义头部字段。例如,你或许想要重写“HOST”字段来测试一个[负载均衡][1],或者通过重写"User-Agent"字符串来欺骗特定浏览器以解决其访问限制的问题。 +在一些个例中,或许你想要在一个HTTP请求中覆盖掉默认的HTTP头或者添加一个新的自定义头部字段。例如,你或许想要重写“HOST”字段来测试一个[负载均衡][1],或者通过重写"User-Agent"字符串来假冒特定浏览器以解决一些访问限制的问题。 为了解决所有这些问题,curl提供了一个简单的方法来完全控制传出HTTP请求的HTTP头。你需要的这个参数是“-H” 或者 “--header”。 @@ -36,7 +36,7 @@ wget是另外一个类似于curl,可以用来获取URL的命令行工具。并 via: http://ask.xmodulo.com/custom-http-header-curl.html 译者:[Ping](http://mr-ping.com) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/20150125 4 Best Modern Open Source Code Editors For Linux.md b/published/201502/20150125 4 Best Modern Open Source Code Editors For Linux.md similarity index 100% rename from published/20150125 4 Best Modern Open Source Code Editors For Linux.md rename to published/201502/20150125 4 Best Modern Open Source Code Editors For Linux.md diff --git a/published/20150126 Ubuntu 15.04 to Integrate Linux Kernel 3.19 Branch Soon.md b/published/201502/20150126 Ubuntu 15.04 to Integrate Linux Kernel 3.19 Branch Soon.md similarity index 100% rename from published/20150126 Ubuntu 15.04 to Integrate Linux Kernel 3.19 Branch Soon.md rename to published/201502/20150126 Ubuntu 15.04 to Integrate Linux Kernel 3.19 Branch Soon.md diff --git a/published/20150127 Bug in Wi-Fi Direct Android Implementation Causes Denial of Service.md b/published/201502/20150127 Bug in Wi-Fi Direct Android Implementation Causes Denial of Service.md similarity index 100% rename from published/20150127 Bug in Wi-Fi Direct Android Implementation Causes Denial of Service.md rename to published/201502/20150127 Bug in Wi-Fi Direct Android Implementation Causes Denial of Service.md diff --git a/published/20150127 Install Jetty Web Server On CentOS 7.md b/published/201502/20150127 Install Jetty Web Server On CentOS 7.md similarity index 100% rename from published/20150127 Install Jetty Web Server On CentOS 7.md rename to published/201502/20150127 Install Jetty Web Server On CentOS 7.md diff --git a/published/201502/20150128 Meet Vivaldi--A New Web Browser Built for Power Users.md b/published/201502/20150128 Meet Vivaldi--A New Web Browser Built for Power Users.md new file mode 100644 index 0000000000..f82ca8965d --- /dev/null +++ b/published/201502/20150128 Meet Vivaldi--A New Web Browser Built for Power Users.md @@ -0,0 +1,60 @@ +认识Vivaldi——一款为高手级用户定制的全新网页浏览器 +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/Screen-Shot-2015-01-27-at-17.36.jpg) + +**这周一个为了满足高手级用户的需要而定制的全新网页浏览器已然来临——而且它已经可以在Linux上使用了。** + +Vivaldi就是这个新浏览器的名字,而且它还面向64位Linux、Windows 和 Mac 机发布了技术预览版(注解:无责任测试版)。它是建立在已测试过的Chromium开源框架,Blink和Google的开源V8 JavaScript引擎(以及其他项目)的基础上。 + +这个世界真的还需要一个浏览器吗?Opera软件前首席执行官Jon S.von Tetzchner的构想——Vivaldi不怎么关注所要,更关注所需。 + +Vivaldi被制造成带有着偏向于键盘操作的tab键痴迷者所需的那种功能。并没有为那些认为Firefox复杂或是批评Chrome改动了书签按钮的用户而进行修改。 + +这也并不是什么俗气的营销噱头。尽管它带有‘技术预览版’标签,Vivaldi已经有了明显偏向于高手级用户们的功能。 + +相当多的人觉得自己被其他软件公司所生产的简化的,配对后发行的产品遗弃了、糊弄了。Vivaldi——即使在这个过渡期的早期——看起来适逢其会,可以打败其他产品。 + +### Vivaldi功能### + +以下是几个Vivaldi已展示过的关键功能: + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/quick.jpg) + +**快捷命令** (Ctrl + Q)是个内置的HUD应用,它可以让你快速过滤设置、选项和功能,用它打开一个书签或是隐藏状态栏,只需用你的键盘,无需鼠标点击。 + +**标签堆** 让你可以通过把多个不同标签分到一组来清理你的工作区,然后可以通过键盘命令或者可预览标签选择器在标签组之间进行切换。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/tab-stacks.jpg) + +一个可折叠的**侧边栏**藏有额外功能(就像旧Opera)包括一个(目前还不能工作的)邮箱客户端,链接,书签浏览器和可以让你截屏并做注释的笔记专区。 + +还提供了一大堆其他的功能,包括设置键盘快捷键,一个可以被设置在浏览器任何一个边(或完全隐藏)的标签栏,隐私选项和一个快速打开文件夹的功能。 + +### Opera二代的印记 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/vivaldi-settings-in-ubuntu-750x434.jpg) + +把Vivaldi当作Opera post-Presto(Opera拥有版权的旧引擎)的真正继承者并不是什么值得惊奇的事。当Opera(今天也推出了一个小更新)追求一个更轻、更好管理的一套功能时,已经剔除了它很多“高手级用户”功能。 + +Vivaldi想要捡起Opera曾急于脱手的负担。虽然这么做没有帮它抓住什么预期的市场份额,但是它吸引了高手级用户的眼球。他们大多数无疑已经在使用Linux了。 + +### 下载 ### + +有兴趣尝尝鲜?完全可以。Vivaldi可以下载到Windows,Mac以及64位Linux版本。不久的将来你还能选择Debian或RPM安装器。 + +请记住,它还没有完成,而且更多的功能(包括扩展、同步等等)正计划着在将来加入。 + +- [Download Vivaldi Tech Preview for Linux][1] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/01/vivaldi-web-browser-linux-download-power-users + +作者:[Joey-Elijah Sneddon][a] +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://vivaldi.com/#Download diff --git a/published/201502/20150130 OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10.md b/published/201502/20150130 OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10.md new file mode 100644 index 0000000000..e49dd12654 --- /dev/null +++ b/published/201502/20150130 OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10.md @@ -0,0 +1,29 @@ +OpenJDK 7的漏洞已经在Ubuntu 14.04 和Ubuntu 14.10中解决了 +---- +*建议用户尽快升级* + +**Canonical发布新 OpenJDK 7 的安全公告,它已经提交到Ubuntu 14.04 LTS和Ubuntu 14.10 的仓库中。该更新修复了大量的问题和漏洞。** + +Ubuntu维护者已经升级了仓库中的OpenJDK包,并且含有大量的修复。这是一个重要的更新,其涵盖了少量的库。 + +安全公告中说“OpenJDK JRE中发现了一些信息泄露、数据完整性和可用性的漏洞。攻击者可以利用这些通过网络执行拒绝服务或者泄露信息。” + +同样,“OpenJDK JRE中发现了关于信息泄露和完整性的漏洞。攻击者可以利用这点通过网络泄露敏感信息。” + +这里有几个漏洞被开发者确认,并且由维护人员解决。关于该问题的详细描述,你可以参考Canonical的安全通告。建议用户尽快升级系统。 + +这个漏洞只要你升级到最新的openjdk 7相关的包就可以修复。要应用该补丁,用户需要运行升级管理程序。通常上,一个标准系统更新就会安装必要的更新。所有java相关的程序需要重新启动。 + +-------------------------------------------------------------------------------- + +via: http://linux.softpedia.com/blog/OpenJDK-7-Vulnerabilities-Closed-in-Ubuntu-14-04-and-Ubuntu-14-10-471605.shtml + +本文发布时间:29 Jan 2015, 16:53 GMT + +作者:[Silviu Stahie][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/silviu-stahie diff --git a/published/201502/20150202 How to create and show a presentation from the command line on Linux.md b/published/201502/20150202 How to create and show a presentation from the command line on Linux.md new file mode 100644 index 0000000000..04deb0264c --- /dev/null +++ b/published/201502/20150202 How to create and show a presentation from the command line on Linux.md @@ -0,0 +1,186 @@ +如何在Linux命令行中创建以及展示演示稿 +================================================================================ +你在准备一场演讲的时候,脑海可能会先被图文并茂、形象华丽的演示图稿所占据。诚然,没有人会否认一份生动形象的演讲稿所带来的积极作用。然而,并非所有的演讲都需要TED Talk的质量。更多时候,演讲稿只为传达特定的信息。 而这个,使用文本信息足以完成。在这种情况下,你的时间可以更好的花在信息的搜集和核实上面,而不是在谷歌图片搜索(Google Image)上寻找好看的图片。 + +在Linux的世界里,有几个不同的方式供你选择来做演讲。比如带有大量多媒体展示、视觉冲击效果极佳的[Impress.js][1],专为LaTex用户提供的Beamer,等等。而如果你苦于寻找一种简单的方式来创建并且展示文本演示稿,[mdp][2] 就能帮你实现。 + +### 什么是Mdp? ### + +mdp是Linux下一款基于ncurses的命令行演示工具。我喜欢mdp在于它对[markdown][3]的支持,使得我很容易以熟悉的markdown格式来创建幻灯片。自然,它还可以很轻松地用HTML格式来发布幻灯片。另一个好处是它支持UTF-8字符编码,这让非英语字符(如希腊或西里尔字母)的展示也变得很方便。 + +### 在Linux中安装Mdp ### + +mdp的依赖需求很少(如 ncursesw),这使得安装非常简单。 + +#### Debian、Ubuntu或者它们的衍生版 #### + + $ sudo apt-get install git gcc make libncursesw5-dev + $ git clone https://github.com/visit1985/mdp.git + $ cd mdp + $ make + $ sudo make install + +#### Fedora或者CentOS/RHEL #### + + $ sudo yum install git gcc make ncurses-devel + $ git clone https://github.com/visit1985/mdp.git + $ cd mdp + $ make + $ sudo make install + +#### Arch Linux #### + +Arch Linux可以通过[AUR][4]轻松安装mdp。 + +### 在命令行中创建演示稿 ### + +安装mdp完毕,你可以使用你喜欢的文本编辑器来轻松创建一个演示稿。如果你熟悉markdown的话,很快就可以驾驭mdp。而对于那些不熟悉markdown的人来说,学习mdp最好的方式就是从一个实例着手。 + +这里有一份6页的演示稿样本可供参考。 + + %title: Sample Presentation made with mdp (Xmodulo.com) + %author: Dan Nanni + %date: 2015-01-28 + + -> This is a slide title <- + ========= + + -> mdp is a command-line based presentation tool with markdown support. <- + + *_Features_* + + * Multi-level headers + * Code block formatting + * Nested quotes + * Nested list + * Text highlight and underline + * Citation + * UTF-8 special characters + + ------------------------------------------------- + + -> # Example of nested list <- + + This is an example of multi-level headers and a nested list. + + # first-level title + + second-level + ------------ + + - *item 1* + - sub-item 1 + - sub-sub-item 1 + - sub-sub-item 2 + - sub-sub-item 3 + - sub-item 2 + + ------------------------------------------------- + + -> # Example of code block formatting <- + + This example shows how to format a code snippet. + + 1 /* Hello World program */ + 2 + 3 #include + 4 + 5 int main() + 6 { + 7 printf("Hello World"); + 8 return 0; + 9 } + + This example shows inline code: `sudo reboot` + + ------------------------------------------------- + + -> # Example of nested quotes <- + + This is an example of nested quotes. + + # three-level nested quotes + + > This is the first-level quote. + >> This is the second-level quote + >> and continues. + >>> *This is the third-level quote, and so on.* + + ------------------------------------------------- + + -> # Example of citations <- + + This example shows how to place a citation inside a presentation. + + This tutorial is published at [Xmodulo](http://xmodulo.com) + + You are welcome to connect with me at [LinkedIn](http://www.linkedin.com/in/xmodulo) + + Pretty cool, huh? + + ------------------------------------------------- + + -> # Example of UTF-8 special characters <- + + This example shows UTF-8 special characters. + + ae = ä, oe = ö, ue = ü, ss = ß + alpha = ?, beta = ?, upsilon = ?, phi = ? + Omega = ?, Delta = ?, Sigma = ? + + ??????????? + ?rectangle? + ??????????? + +### 在命令行中展示演示稿 ### + +当你把以上代码保存为slide.md的文本文件后,你可以运行以下命令来展示演示稿: + + $ mdp slide.md + +你可以通过按键 回车/空格/下翻页/向下光标键 (下一张幻灯)、回退/上翻页/向上光标键 (上一张幻灯)、Home (幻灯首页)、 End (幻灯末页)或者 数字N (第N页幻灯)来操作你的演示稿。 + +演示稿的标题将在每页幻灯的顶部展示,而你的名字和页码则会出现在幻灯的底部。 + +![](https://farm9.staticflickr.com/8637/16392457702_ec732d0094_c.jpg) + +这是嵌套列表和多层次标题的实例效果。 + +![](https://farm9.staticflickr.com/8567/16367397606_29be7df633_c.jpg) + +这是代码片段和内联代码的实例效果。 + +![](https://farm9.staticflickr.com/8682/15770926144_0f982b0863_b.jpg) + +这是嵌套引用的实例效果。 + +![](https://farm9.staticflickr.com/8587/16393383115_0865c8b89b_c.jpg) + +这是放置引文的实例效果。 + +![](https://farm8.staticflickr.com/7409/16392457712_ed36c14bc2_c.jpg) + +这是UTF-8编码特殊字符支持的实例效果。 + +![](https://farm9.staticflickr.com/8648/16205981560_7fa3debc75_c.jpg) + +### 总结 ### + +在本教程中,我演示了在命令行中如何使用mdp来创建并且展示一个演示稿。mdp的markdown兼容性让我们省去了学习其它新格式的麻烦,这相对于另一种名为[tpp][5]的演示工具来说是一个优势。拘于mdp的局限性,它可能无法作为你的默认演示工具。但是,值得肯定的是它一定能在某个场合下派上用场。你觉得mdp怎么样呢?你还喜欢其它的什么东西吗? + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/presentation-command-line-linux.html + +作者:[Dan Nanni][a] +译者:[soooogreen](https://github.com/soooogreen) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://bartaz.github.io/impress.js/ +[2]:https://github.com/visit1985/mdp +[3]:http://daringfireball.net/projects/markdown/ +[4]:https://aur.archlinux.org/packages/mdp-git/ +[5]:http://www.ngolde.de/tpp.html \ No newline at end of file diff --git a/published/201502/20150203 Linux FAQs with Answers--How to fix 'Your profile could not be opened correctly' on Google Chrome.md b/published/201502/20150203 Linux FAQs with Answers--How to fix 'Your profile could not be opened correctly' on Google Chrome.md new file mode 100644 index 0000000000..faf724786c --- /dev/null +++ b/published/201502/20150203 Linux FAQs with Answers--How to fix 'Your profile could not be opened correctly' on Google Chrome.md @@ -0,0 +1,50 @@ +Linux有问必答——如何修复Google Chrome 的“Your profile could not be opened correctly”错误 +================================================================================ +> **提问**:当我在linux打开Google Chrome 浏览器时,我已经几次收到弹出窗口,提示我的档案文件没有被正确打开(Your profile could not be opened correctly.)。每次我打开Chrome都要弹出来,我应该如何修复这个问题? + +当你在你的Chrome上看见"Your profile could not be opened correctly"错误信息时,从某种程度上讲,那是因为你的Chrome配置文件数据已经损坏。这个问题经常发生在手动升级Google Chrome的时候。 + +![](https://farm8.staticflickr.com/7428/16238502737_27bdda6685_o.png) + +修复取决于到底哪个文件损坏,你可以试试下面的几个方法。 + +### 方法一 ### + +关掉所有Chrome窗口和标签页。 + +进入~/.config/google-chrome/Default,移除或者重命名"Web Data"文件。 + + $ cd ~/.config/google-chrome/Default + $ rm "Web Data" + +再次开打Google Chrome浏览器。 + +### 方法二 ### + +关掉所有Chrome窗口和标签页。 + +进入~/.config/google-chrome/"Profile 1",并重命名"History"文件。 + + $ cd ~/.config/google-chrome/"Profile 1" + $ mv History History.bak + +再次开打Google Chrome浏览器。 + +### 方法三 ### + +如果依然没有解决,你可以试试移除所有默认配置文件夹(~/.config/google-chrome/Default)。注意:如果这样做,你将会遗失所有之前打开的Google标签、导入的书签,浏览记录和登录数据等。 + +在移除之前,先关掉所有Chrome窗口和标签页 + + $ rm -rf ~/.config/google-chrome/Default + +之后重启Google Chrome,文件夹~/.config/google-chrome/Default会自动生成。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/your-profile-could-not-be-opened-correctly-google-chrome.html + +译者:[VicYu/Vic020](http://vicyu.net) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150205 Linux FAQs with Answers--How to install Go language on Linux.md b/published/201502/20150205 Linux FAQs with Answers--How to install Go language on Linux.md similarity index 71% rename from translated/tech/20150205 Linux FAQs with Answers--How to install Go language on Linux.md rename to published/201502/20150205 Linux FAQs with Answers--How to install Go language on Linux.md index d7dd2bb1c6..110fe965a5 100644 --- a/translated/tech/20150205 Linux FAQs with Answers--How to install Go language on Linux.md +++ b/published/201502/20150205 Linux FAQs with Answers--How to install Go language on Linux.md @@ -1,6 +1,6 @@ 如何在Linux中安装Go语言 ================================================================================ -Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几个设计原则:简单、安全、速度。Go语言发行版拥有各种调试、测试、调优和代码审查工具。如今Go语言和它的工具链在大多数Linux发行版的基础仓库都有了,用默认的包管理器就可以安装。 +Go (也叫 "golang")是一款由Google最初开发的编程语言。它的诞生有几个设计原则:简单、安全、速度。Go语言发行版拥有各种调试、测试、调优和代码审查工具。如今Go语言和它的工具链在大多数Linux发行版的基础仓库都可用,用默认的包管理器就可以安装。 ### 在Ubuntu、Debian 或者 Linux Mint上安装Go语言 ### @@ -16,7 +16,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几 go version go1.2.1 linux/amd64 -按照你的需要,你或许想要使用apt-get安装额外的Go工具。 +根据你的需要,你或许想要使用apt-get安装额外的Go工具。 $ sudo apt-cache search golang @@ -36,7 +36,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几 go version go1.3.3 linux/amd64 -按照你的需要,你或许想要使用yum安装额外的Go工具。 +根据你的需要,你或许想要使用yum安装额外的Go工具。 $ yum search golang @@ -44,7 +44,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几 ### 从官网安装Go语言 ### -有时发行版中的版本并不是最新的。为防这样,你可以从官网安装最新的Go语言。下面是步骤。 +有时发行版中的go语言版本并不是最新的。为了避免这种情况,你可以从官网安装最新的Go语言。下面是步骤。 进入Go语言的[官方源码][1],并下载预编译二进制代码。 @@ -68,7 +68,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几 export PATH=$PATH:/usr/local/go/bin -如果你在/usr/local之外安装了了Go,你同样需要设置GOROOT环境变量来指向自定义的安装位置。 +如果你在/usr/local之外的自定义位置中安装了Go,你同样需要设置GOROOT环境变量来指向自定义的安装位置。 $ sudo vi /etc/profile @@ -89,7 +89,7 @@ Go (也叫 "golang")是一款由Google开发的编程语言。它的诞生有几 via: http://ask.xmodulo.com/install-go-language-linux.html 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201502/20150205 LinuxQuestions Survey Results Surface Top Open Source Projects.md b/published/201502/20150205 LinuxQuestions Survey Results Surface Top Open Source Projects.md new file mode 100644 index 0000000000..9430f11ada --- /dev/null +++ b/published/201502/20150205 LinuxQuestions Survey Results Surface Top Open Source Projects.md @@ -0,0 +1,32 @@ +LinuxQuestions 问卷调查揭晓最佳开源项目 +================================================================================ +![](http://farm5.static.flickr.com/4099/4777335328_3cc363c419_m.jpg) + +在Linux用户社区中, 很多人每年都会期待来自 LinuxQuestions.org 细致可靠的年度问卷调查报告。如同[Susan在她的报告][1]中指出的那样, 今年的[结果][2]着重于调查网站读者心中最棒的开源项目。 这份报告目前已经完成。 在LinuxQuestions的大多数人都是“专家级”的用户, 他们经常在网站上在线回答Linux新手们的提问。 + +在Susan所作的报告的附加内容里, 你可以看到由“专家”们对开源世界的关注点分布。 + +你也可以在[这里][3]找到一份较为精美的调查问卷总结图.这里呈现了网站投票得出的最佳Linux发行版, 可以看到Mint和Slackwaer平分了半壁江山: + +![](http://i1311.photobucket.com/albums/s669/webworkerdaily/lin_zps9ogvyrty.png) + +而下图则是网站票选出的得出的最佳云项目。值得注意的是, LinuxQuestions的用户群体给予了ownCloud项目极高的评价。 你一定得亲自去看看调查结果的详情, 也看看 [Susan 关于各项目“赢家”][4]的总结, 还有[一堆精美的图表][5]。 + +![](http://i1311.photobucket.com/albums/s669/webworkerdaily/lin2_zps9nxf7yyi.png) + +-------------------------------------------------------------------------------- + +via: http://ostatic.com/blog/linuxquestions-survey-results-surface-top-open-source-projects + +作者:[Sam Dean][a] +译者:[jerryling315](https://github.com/jerryling315) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ostatic.com/member/samdean +[1]:http://ostatic.com/blog/lq-members-choice-award-winners-announced +[2]:http://www.linuxquestions.org/questions/linux-news-59/2014-linuxquestions-org-members-choice-award-winners-4175532948/ +[3]:http://www.linuxquestions.org/questions/2014mca.php +[4]:http://ostatic.com/blog/lq-members-choice-award-winners-announced +[5]:http://www.linuxquestions.org/questions/2014mca.php \ No newline at end of file diff --git a/published/201502/20150209 CrunchBang Linux Is Dead.md b/published/201502/20150209 CrunchBang Linux Is Dead.md new file mode 100644 index 0000000000..7adfa42887 --- /dev/null +++ b/published/201502/20150209 CrunchBang Linux Is Dead.md @@ -0,0 +1,32 @@ +CrunchBang Linux 已死!!! +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Crunchbang_Linux_Dead.jpeg) + +是的,你没看错。最小的Linux发行版**CrunchBang Linux 已经消失了**。 + +CrunchBang Linux,被大家所熟知的缩写标志“#!”,其基于Debian和[Openbox][1]窗口管理器。这个黑色主题的 Linux 发行版是许多资深 Linux用户的选择。 + +### CrunchBang 因为 “不再有继续下去的价值” 而消失了 ### + +其[公告][2]称,CrunchBang将不在继续开发,项目的领头人Philip Newborough说他在开始这个项目的时候,Linux 世界和现在不同。他指出那时在这种发行版还没有‘竞争’,但是随着Linux发行版的进步,如Lubuntu,Crunchbang这样的发行版就不具备原来的价值了。 + +> 对于任何十年前使用Linux的人而言,我想他们都会看到事物在不断发展。虽然一些事情一直保持不变,还有一些的变化超出了认知。这称之为进步。对于大部分事物而言,进步是一件好事。也就是说当进步发生时,一些事物落后了。对于我而言,CrunchBang就是我需要抛弃的东西。我抛弃它的原因是我真的认为它不再具有任何价值了,虽然我还可以因为一些多愁善感的原因把它留下来,但是我不认为那些使用原生Debian用户还有兴趣了。 + +### CrunchBang消失之后会怎么样? ### + +就像[Pear OS][3]那样,CrunchBang论坛仍将在线。现在仍可以下载但是不久的将来就会停止。Philip对他即将面对的新的项目和工作感到很激动。我希望他今后工作顺利。很难过见到一个像CrunchBang这样好的Linux发行版的消失。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/crunchbang-linux-dead/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://en.wikipedia.org/wiki/Openbox +[2]:http://crunchbang.org/forums/viewtopic.php?id=38916 +[3]:http://itsfoss.com/pear-os-history/ diff --git a/published/201502/20150209 Non-Linux FOSS--Homebrew.md b/published/201502/20150209 Non-Linux FOSS--Homebrew.md new file mode 100644 index 0000000000..d132d55555 --- /dev/null +++ b/published/201502/20150209 Non-Linux FOSS--Homebrew.md @@ -0,0 +1,24 @@ +非Linux的自由开源软件:Homebrew +================================================================================ +我日常工作中使用的是OS X。我能容忍它很大程序上是因为它的终端。如果我不能在黑色背景绿色文字的终端下工作,我想我会疯了。不幸的是,OS X 没有我需要的全部命令行工具。Homebrew的到来拯救了我。 + +![](http://www.linuxjournal.com/files/linuxjournal.com/ufiles/imagecache/large-550px-centered/u1002061/11811fossf1.png) + +Homebrew扮演了OS X中所缺乏的包管理器的角色。命令的使用很像apt-get,它能够安装无数的应用。一个最好的例子是wget。我很惊讶OS X中没有包含wget,但是homebrew中有,很简单就安装上了。 + +最棒的是homebrew在/usr/local文件夹下安装软件。你不必担心homebrew会破坏你的系统,因为它不会访问/usr/local之外的其他文件。OSX系统更新不会覆盖你的程序,并且/usr/local/bin已经在PATH中,使用homebrew安装的程序可以直接工作。 + +homebrew使用ruby管理它的包和功能,但是使用它不需要任何编程知识。并且安装过程只需要在命令行中复制粘贴就好了。如果你使用的是OS X,但是你希望像在Linux中那样方便地安装,就试一试homrbrew吧:[http://brew.sh][1]。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxjournal.com/content/non-linux-foss-homebrew + +作者:[Shawn Powers][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxjournal.com/users/shawn-powers +[1]:http://brew.sh/ diff --git a/published/201502/20150215 Get Rid Of Two Google Chrome Icons From Dock In Elementary OS Freya.md b/published/201502/20150215 Get Rid Of Two Google Chrome Icons From Dock In Elementary OS Freya.md new file mode 100644 index 0000000000..fb593dbf68 --- /dev/null +++ b/published/201502/20150215 Get Rid Of Two Google Chrome Icons From Dock In Elementary OS Freya.md @@ -0,0 +1,56 @@ +如何避免在ELemetary OS Freya中出现两个Google Chrome 图标 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Two_Google_Chrome_ElementaryOS_Freya.jpeg) + +这篇文章会教你**如何避免在ELemetary OS Freya中出现两个Google Chrome 图标**。 + +Chrome才是我在所有系统中使用的主浏览器。[Modori][2] 是默认放在dock中的浏览器,所以你每次使用Chrome时都需要在Slingshot中搜索Google Chrome,而为了节省时间,我通常会将它“保持在dock”中。 + +这里的问题是当你点击dock中的Chrome图标时,它会创建另外一个Google Chrome的实例。这就在dock中留下两个Chrome图标,这或许你可以不在意,但是很显然处女座不能忍!如果你有相同的感受,让我们看下如何移除这第二个Google Chrome图标。 + +### 在Elementary OS Freya的dock中删除第二个Google Chrome 图标 ### + +#### 第一步: #### + +从dock中删除Google Chrome。 + +#### 第二步: #### + +打开终端并使用下面的命令: + + cp /usr/share/applications/google-chrome.desktop ~/.local/share/applications + +#### 第三步: #### + +接下来我们要编辑google-chrome.destop文件。使用下面的命令: + + scratch-text-editor ~/.local/share/applications/google-chrome.desktop + +这会用Scratch打开google-chrome.destop文件。在[Desktop Entry]段落下,加入下面的行: + + + StartupWMClass=Google-chrome-stable + +看上去像这样: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/two_Google_Chrome_Elementary_Freya.png) + +#### 第四步: #### + +进入Slingshot并且再次打开Google Chrome。再次选择“keep in dock”。关闭并重新打开它来验证它是否在dock中打开了另外一个新的Chrome图标。这里不需要重启系统。 + +我希望这篇提示能够帮助你删除Elementary OS Freya中多出的Chrome图标。有任何问题或建议让我在评论区中知道。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/rid-google-chrome-icons-dock-elementary-os-freya/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://elementary.io/ +[2]:http://midori-browser.org/ diff --git a/published/20150225 Install Google's Material Design Inspired GTK And Icon Theme Paper in Linux.md b/published/20150225 Install Google's Material Design Inspired GTK And Icon Theme Paper in Linux.md new file mode 100644 index 0000000000..a4ca97ed5a --- /dev/null +++ b/published/20150225 Install Google's Material Design Inspired GTK And Icon Theme Paper in Linux.md @@ -0,0 +1,70 @@ +在 Linux 下体验谷歌 Material风格的GTK和图标主题Paper +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Paper_theme_Material_Design.jpg) + +[Paper][1]是一款即将与广大朋友们见面的一个图形工具包和图标主题,它的设计灵感来自于谷歌的设计语言[Material风格][2]。Paper由Sam Hewitt发起,Sam是[Moka项目][3]的一员,Moka总会设计出[让人满意的Ubuntu主题][4]。对于Paper,我敢说只要它一经推出,它必将是[最好的GTK主题开发包][5]之一。 + +对的,你没有听错,Paper主题还在开发阶段。因此我建议,如果你想在你的Ubuntu或者它的衍生版本上安装Paper,最好抱着试一试的实验心态。因为你多多少少会发现一些破损的图标,但这并不影响整体体验非常棒! + +### 通过PPA在Ubuntu及其衍生版本上安装Paper主题 ### + +Sam为Ubuntu和它的衍生版本设置了一个专用的PPA(Presonal Package Archives,个人软件包档案)。我推荐你通过PPA安装而不是下载Paper主题,因为你将会定期更新主题。这个PPA可供使用的系统有Ubuntu 15.04, Ubuntu 14.10, Ubuntu 14.04, Elementary OS Freya, Elementary OS Luna, Linux Mint 17, Linux Mint 16 和其它的Ubuntu衍生版本。 + +打开终端,输入下列命令: + + sudo add-apt-repository ppa:snwh/pulp + sudo apt-get update + sudo apt-get install paper-gtk-theme paper-icon-theme + +### 下载Paper GTK和图标主题 ### + + +如果你不想用PPA,你可以手动下载主题和图标。但是就像刚才所说,这样你就无法自动更新。 + +- [下载Paper图标主题][6] +- [下载Paper的GTK主题][7] + +#### 把它们用起来吧 #### + +我希望你知道怎么在你的Ubuntu中安装或者更改主题。如果你不知道,下面几个教程将帮助你安装一个新的主题。 + +- [如何在标准Ubuntu中更改主题][8] +- [如何在GNOME Shell中更改主题][9] +- [如何在Ubuntu Mint中更改主题][10] +- [如何在Elementary OS Freya中更改主题][11] + +#### 就是这样! #### + +因为我用过[Elementary OS Freya][12]一段时间,这里有一些看起来像Elementary OS Freya的Paper主题和图标的截图。我使用了一张Material Design风格的墙纸,这样可以更好的匹配主题和图标。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Material_Design_Paper_Theme_Elementary_OS_Freya_1.jpeg) + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Material_Design_Paper_Theme_Elementary_OS_Freya.jpeg) + +How do you find this Material design inspired theme? If you did use it, do share the screenshot of your desktop with rest of us here. + +你觉得这个Material风格的主题怎么样?如果你使用它的话,在评论里和我们分享你的桌面截图吧! + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-paper-theme-linux/ + +作者:[Abhishek][a] +译者:[sevenot](https://github.com/sevenot) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://snwh.org/paper/ +[2]:http://www.google.fr/design/spec/material-design/introduction.html +[3]:http://mokaproject.com/moka-icon-theme/ +[4]:http://itsfoss.com/best-icon-themes-ubuntu-1404/ +[5]:http://itsfoss.com/gnome-shell-themes-ubuntu-1404/ +[6]:https://github.com/snwh/paper-icon-theme +[7]:https://github.com/snwh/paper-gtk-theme +[8]:http://itsfoss.com/how-to-install-themes-in-ubuntu-13-10/ +[9]:http://itsfoss.com/install-switch-themes-gnome-shell/ +[10]:http://itsfoss.com/install-icon-linux-mint/ +[11]:http://itsfoss.com/install-themes-icons-elementary-os-freya/ +[12]:http://itsfoss.com/tag/elementary-os-freya/ diff --git a/published/201503/20130315 How to protect SSH server from brute force attacks using fail2ban.md b/published/201503/20130315 How to protect SSH server from brute force attacks using fail2ban.md new file mode 100644 index 0000000000..e2940a2ed7 --- /dev/null +++ b/published/201503/20130315 How to protect SSH server from brute force attacks using fail2ban.md @@ -0,0 +1,170 @@ +如何使用 fail2ban 防御 SSH 服务器的暴力破解攻击 +================ + +对于SSH服务的常见的攻击就是暴力破解攻击——远程攻击者通过不同的密码来无限次地进行登录尝试。当然SSH可以设置使用非密码验证验证方式来对抗这种攻击,例如[公钥验证][1]或者[双重验证][2]。将不同的验证方法的优劣处先放在一边,如果我们必须使用密码验证方式怎么办?你是如何保护你的 SSH 服务器免遭暴力破解攻击的呢? + +[fail2ban][3] 是 Linux 上的一个著名的入侵保护的开源框架,它会监控多个系统的日志文件(例如:/var/log/auth.log 或者 /var/log/secure)并根据检测到的任何可疑的行为自动触发不同的防御动作。事实上,fail2ban 在防御对SSH服务器的暴力密码破解上非常有用。 + +在这篇指导教程中,我会演示**如何安装并配置 fail2ban 来保护 SSH 服务器以避免来自远程IP地址的暴力攻击**。 + +###在linux上安装Fail2ban + +为了在CentOS 或 RHEL上安装fail2ban,首先[设置EPEL仓库][4],然后运行以下命令。 + + $ sudo yum install fail2ban + +在Fedora上安装fail2ban,简单地运行以下命令: + + $ sudo yum install fail2ban + +在ubuntu,Debian 或 Linux Mint上安装fail2ban: + + $ sudo apt-get install fail2ban + +### 为SSH服务器配置Fail2ban + +现在你已经准备好了通过配置 fail2ban 来加强你的SSH服务器。你需要编辑其配置文件 /etc/fail2ban/jail.conf。 在配置文件的“[DEFAULT]”区,你可以在此定义所有受监控的服务的默认参数,另外在特定服务的配置部分,你可以为每个服务(例如SSH,Apache等)设置特定的配置来覆盖默认的参数配置。 + +在针对服务的监狱区(在[DEFAULT]区后面的地方),你需要定义一个[ssh-iptables]区,这里用来定义SSH相关的监狱配置。真正的禁止IP地址的操作是通过iptables完成的。 + +下面是一个包含“ssh-iptables”监狱配置的/etc/fail2ban/jail.conf的文件样例。当然根据你的需要,你也可以指定其他的应用监狱。 + + $ sudo vi /etc/fail2ban/jail.local + +``` +[DEFAULT] +# 以空格分隔的列表,可以是 IP 地址、CIDR 前缀或者 DNS 主机名 +# 用于指定哪些地址可以忽略 fail2ban 防御 +ignoreip = 127.0.0.1 172.31.0.0/24 10.10.0.0/24 192.168.0.0/24 + +# 客户端主机被禁止的时长(秒) +bantime = 86400 + +# 客户端主机被禁止前允许失败的次数 +maxretry = 5 + +# 查找失败次数的时长(秒) +findtime = 600 + +mta = sendmail + +[ssh-iptables] +enabled = true +filter = sshd +action = iptables[name=SSH, port=ssh, protocol=tcp] +sendmail-whois[name=SSH, dest=your@email.com, sender=fail2ban@email.com] +# Debian 系的发行版 +logpath = /var/log/auth.log +# Red Hat 系的发行版 +logpath = /var/log/secure +# ssh 服务的最大尝试次数 +maxretry = 3 +``` + +根据上述配置,fail2ban会自动禁止在最近10分钟内有超过3次访问尝试失败的任意IP地址。一旦被禁,这个IP地址将会在24小时内一直被禁止访问 SSH 服务。这个事件也会通过sendemail发送邮件通知。 + +一旦配置文件准备就绪,按照以下方式重启fail2ban服务。 + +在 Debian, Ubuntu 或 CentOS/RHEL 6: + + $ sudo service fail2ban restart + +在 Fedora 或 CentOS/RHEL 7: + + $ sudo systemctl restart fail2ban + +为了验证fail2ban成功运行,使用参数'ping'来运行fail2ban-client 命令。 如果fail2ban服务正常运行,你可以看到“pong(嘭)”作为响应。 + + $ sudo fail2ban-client ping + Server replied: pong + +### 测试 fail2ban 保护SSH免遭暴力破解攻击 + +为了测试fail2ban是否能正常工作,尝试通过使用错误的密码来用SSH连接到服务器模拟一个暴力破解攻击。与此同时,监控 /var/log/fail2ban.log,该文件记录在fail2ban中发生的任何敏感事件。 + + $ sudo tail -f /var/log/fail2ban.log + +![](https://farm8.staticflickr.com/7550/15882084127_fccf9ca7b7_c.jpg) + +根据上述的日志文件,Fail2ban通过检测IP地址的多次失败登录尝试,禁止了一个IP地址192.168.1.8。 + +###检查fail2ban状态并解禁被锁住的IP地址 + +由于fail2ban的“ssh-iptables”监狱使用iptables来阻塞问题IP地址,你可以通过以下方式来检测当前iptables来验证禁止规则。 + + $ sudo iptables --list -n + +``` +Chain INPUT (policy ACCEPT) +target prot opt source destination +fail2ban-SSH tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 + +Chain FORWARD (policy ACCEPT) +target prot opt source destination + +Chain OUTPUT (policy ACCEPT) +target prot opt source destination + +Chain fail2ban-SSH (1 references) +target prot opt source destination +DROP all -- 192.168.1.8 0.0.0.0/0 +RETURN all -- 0.0.0.0/0 0.0.0.0/0 +``` + +如果你想要从fail2ban中解锁某个IP地址,你可以使用iptables命令: + + $ sudo iptables -D fail2ban-SSH -s 192.168.1.8 -j DROP + +当然你可以使用上述的iptables命令手动地检验和管理fail2ban的IP阻塞列表,但实际上有一个适当的方法就是使用fail2ban-client命令行工具。这个命令不仅允许你对"ssh-iptables"监狱进行管理,同时也是一个标准的命令行接口,可以管理其他类型的fail2ban监狱。 + +为了检验fail2ban状态(会显示出当前活动的监狱列表): + + $ sudo fail2ban-client status + +为了检验一个特定监狱的状态(例如ssh-iptables): + + $ sudo fail2ban-client status ssh-iptables + +上面的命令会显示出被禁止IP地址列表。 + +![](https://farm8.staticflickr.com/7497/16067847655_021d23e320_b.jpg) + +为了解锁特定的IP地址: + + $ sudo fail2ban-client set ssh-iptables unbanip 192.168.1.8 + +![](https://farm8.staticflickr.com/7465/16065915571_b215a8b344_b.jpg) + +注意,如果你停止了Fail2ban 服务,那么所有的IP地址都会被解锁。当你重启 Fail2ban,它会从/etc/log/secure(或 /var/log/auth.log)中找到异常的IP地址列表,如果这些异常地址的发生时间仍然在禁止时间内,那么Fail2ban会重新将这些IP地址禁止。 + +### 设置 Fail2ban 自动启动 + +一旦你成功地测试了fail2ban之后,最后一个步骤就是在你的服务器上让其在开机时自动启动。在基于Debian的发行版中,fail2ban已经默认让自动启动生效。在基于Red-Hat的发行版中,按照下面的方式让自动启动生效。 + +在 CentOS/RHEL 6中: + + $ sudo chkconfig fail2ban on + +在 Fedora 或 CentOS/RHEL 7: + + $ sudo systemctl enable fail2ban + +### 总结 + +在该教程中,我演示了如何安装并配置fail2ban来保护一个SSH服务器。当然fail2ban可以缓解暴力密码攻击,但是请注意,这并不能保护SSH服务器避免来自复杂的分布式暴力破解组织,这些攻击者通过使用成千上万个机器控制的IP地址来绕过fail2ban的防御机制。 + +----------- + +via: http://xmodulo.com/how-to-protect-ssh-server-from-brute-force-attacks-using-fail2ban.html + +作者:[Dan Nanni][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/how-to-force-ssh-login-via-public-key-authentication.html +[2]:http://xmodulo.com/two-factor-authentication-ssh-login-linux.html +[3]:http://www.fail2ban.org/ +[4]:http://linux.cn/article-2324-1.html diff --git a/translated/share/20141106 Flow' N Play Movie Player Has a Stylish Interface Ubuntu Installation.md b/published/201503/20141106 Flow' N Play Movie Player Has a Stylish Interface Ubuntu Installation.md similarity index 91% rename from translated/share/20141106 Flow' N Play Movie Player Has a Stylish Interface Ubuntu Installation.md rename to published/201503/20141106 Flow' N Play Movie Player Has a Stylish Interface Ubuntu Installation.md index 9cb0a3765d..0decb425e1 100644 --- a/translated/share/20141106 Flow' N Play Movie Player Has a Stylish Interface Ubuntu Installation.md +++ b/published/201503/20141106 Flow' N Play Movie Player Has a Stylish Interface Ubuntu Installation.md @@ -1,10 +1,10 @@ -Flow 'N Play视频播放器有着独具风格的界面[在Ubuntu上安装] +在Ubuntu上安装Flow 'N Play—界面独具风格的视频播放器 ================================================================================ **Flow ‘N Play**是个用Qt编写的新视频播放器。它有着漂亮又简洁的界面,只提供基本播放功能。 ![](http://www.tuxarena.com/wp-content/uploads/2014/11/flow_n_play.jpg) -[Flow ‘N Play][1]是个比较新的视频播放器,它有着漂亮的界面和简单的操作(今年三月份第一次发行)。其中一个功能就是能通过拖动鼠标滑动视频列表。播放器带有基本功能,一个搜索功能,支持彩色主题。 +[Flow ‘N Play][1]是个比较新的视频播放器,它有着漂亮的界面和简单的操作(2014年3月份第一次发行)。其中一个功能就是能通过拖动鼠标滑动视频列表。播放器带有基本功能,一个搜索功能,支持彩色主题。 打开一个新的视频——你还可以在同一个对话框下自定义一个封面: diff --git a/translated/share/20141106 Tomahawk Music Player Returns With New Look, Features.md b/published/201503/20141106 Tomahawk Music Player Returns With New Look, Features.md similarity index 65% rename from translated/share/20141106 Tomahawk Music Player Returns With New Look, Features.md rename to published/201503/20141106 Tomahawk Music Player Returns With New Look, Features.md index 0194b88257..6a8b7496cb 100644 --- a/translated/share/20141106 Tomahawk Music Player Returns With New Look, Features.md +++ b/published/201503/20141106 Tomahawk Music Player Returns With New Look, Features.md @@ -1,5 +1,4 @@ - -Tomahawk音乐播放器带着新形象、新功能回来了 +新面孔、新功能的 Tomahawk 音乐播放器 ================================================================================ **在悄无声息得过了一年之后,Tomahawk——音乐播放器中的瑞士军刀——带着值得歌颂的全新发行版回归了。 ** @@ -9,35 +8,35 @@ Tomahawk音乐播放器带着新形象、新功能回来了 ### Tomahawk——两个世界的极品 ### -Tomahawk嫁给了一个带有我们的“即时”现代文化的传统应用结构。它可以浏览和播放本地的音乐和Spotify、Grooveshark以及SoundCloud这类的线上音乐。在最新的发行版中,它把Google Play Music和Beats Music列入了它的名册。 +Tomahawk 将一个传统的应用结构与我们的“即时”现代文化相结合。它可以浏览和播放本地的音乐和Spotify、Grooveshark以及SoundCloud这类的线上音乐。在最新的发行版中,它把Google Play Music和Beats Music列入了它的名册。 这可能听着很繁复或令人困惑,但实际上它表现得出奇的好。 -若你想要播放一首歌,而且不介意它是从哪里来的,你只需告诉Tomahawk音乐的标题和作者,它就会自动从可获取的源里找出高品质版本的音乐——你不需要做任何事。 +若你想要播放一首歌,而且不介意它是从哪里来的,你只需告诉Tomahawk这个音乐的标题和作者,它就会自动从可获取的源里找出高品质版本的音乐——你不需要做任何事。 ![](http://i.imgur.com/nk5oixy.jpg) -这个应用还弄了一些附加的功能,比如EchoNest剖析,Last.fm建议,还有对Jabber的支持,这样你就能‘播放’朋友的音乐。它还有一个内置的信息服务,以便于你能和其他人快速的分享播放列表和音乐。 +这个应用还弄了一些附加的功能,比如EchoNest剖析,Last.fm建议,还有对Jabber的支持,这样你就能“播放”朋友的音乐。它还有一个内置的信息服务,以便于你能和其他人快速的分享播放列表和音乐。 ->“这种从根本上就与众不同的听音乐的方式,开启了前所未有的音乐的消费和分享体验”,项目的网站上这样写道。而且即便它如此独特,这也没有错。 +>“这种从根本上就与众不同的听音乐的方式,开启了前所未有的音乐的消费和分享体验”,该项目的网站上这样写道。而且即便它如此独特,这也没有错。 ![Tomahawk supports the Sound Menu](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/tomahawk-controllers.jpg) -支持声音菜单 +*支持声音菜单* ### Tomahawk0.8发行版的亮点 ### - 新的交互界面 - 对Beats Music的支持 - 对Google Play Music的支持(保存的和播放全部链接) -- 对拖拽iTunes,Spotify这类网站的链接的支持 +- 支持拖拽iTunes,Spotify这类网站的链接 - 正在播放的提示 - Android应用(测试版) - 收件箱的改进 ### 在Ubuntu上安装Tomahawk0.8 ### -作为一个流媒体音乐的大用户,我会在接下来的几天里体验一下这个应用软件,然后提供一个关于他的改变的更全面的赏析。与此同时,你也可以尝尝鲜。 +作为一个流媒体音乐的粉丝,我会在接下来的几天里体验一下这个应用软件,然后提供一个关于他的改变的更全面的赏析。与此同时,你也可以尝尝鲜。 在Ubuntu 14.04 LTS和Ubuntu 14.10上可以通过官方PPA获得Tomahawk。 @@ -47,7 +46,7 @@ Tomahawk嫁给了一个带有我们的“即时”现代文化的传统应用结 在官方项目网站上可以找的独立安装程序和更详细的信息。 -- [Visit the Official Tomahawk Website][1] +- [访问 Tomahawk 官网][1] -------------------------------------------------------------------------------- @@ -55,7 +54,7 @@ via: http://www.omgubuntu.co.uk/2014/11/tomahawk-media-player-returns-new-look-f 作者:[Joey-Elijah Sneddon][a] 译者:[H-mudcup](https://github.com/H-mudcup) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201503/20141127 11 Useful Utilities To Supercharge Your Ubuntu Experience.md b/published/201503/20141127 11 Useful Utilities To Supercharge Your Ubuntu Experience.md new file mode 100644 index 0000000000..d18644094c --- /dev/null +++ b/published/201503/20141127 11 Useful Utilities To Supercharge Your Ubuntu Experience.md @@ -0,0 +1,158 @@ +让你玩转 Ubuntu 桌面的十一件武器 +================================================================================ +**无论你是一个相对的新手还是经验丰富的专家,我们都想从我们的操作系统中得到更多的东西。正如大多数现代的操作系统,相比于乍一看呈现出的内容,Ubuntu 还有更多东西可以向我们提供。** + +从调整和优化 Unity 桌面的外观、行为、性能到执行系统维护,这里有大量的实用工具和应用可以帮助你**调整 Ubuntu ,随时满足你的需求**。 + +注意: Ubuntu 总是配备了‘合理的默认设置’(即工作良好的选项),以达到开箱即用,这些默认设置适合大多数人,并且它们都是经过了测试、采用及推荐等过程的。 + +但一个尺码并不适合所有人。对于我们当中的能工巧匠和实验主义者来说,默认设置只是他们定制系统的起点。 + +所以,无需更多的唠叨, 这里有 11 个极好的实用工具可以帮助你增强 Ubuntu 使用体验。 + +### Unity Tweak Tool ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/unity-tweak-tool.jpg) + +我将以这个列表中最重要的一个工具: **Unity Tweak Tool** 来开始这次的介绍。融汇了各种定制选项,Unity Tweak Tool 提供了一系列针对 Ubuntu 和 Unity 桌面的系统综合调整功能。 + +它被各种开关、切换和控制器塞得满满的,使得你可以任意设置从 Unity 桌面的外观到 Unity 的行为之类的任何东西。你可以使用它**快速简便地改变 GTK 主题和图标集**、设置热区、调整启动器图标尺寸、增加或移除工作区,以及 ---特别地---开启 Unity 桌面中被巧妙隐藏的“通过点击最小化”的功能。 + +它是免费的,可直接从 Ubuntu 软件中心里找到, Unity Tweak Tool 是非常值得保留在你的口袋里的工具之一。 + +### Unity 隐私指示器 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/indicator-privacy-in-ubuntu.jpg) + +隐私是一个非常、非常重要的事,事实也恰恰如此,但这个话题要比二进制还难以说明白。让一些数据或习惯,比如说你经常打开的应用,在本地被记录下来,这或许会让你感到高兴,但对于你在 Dash 中的搜索数据被发送到第三方服务机构(尽管这些数据或许是匿名的)这类事情,你就高兴不起来了。 + +[隐私指示器][1] 是一个帮助你时刻跟踪 Ubuntu桌面系统中有哪些文件、目录和服务正被获取、记录及搜索的实用工具。 + +通过快速的点击被添加到桌面面板上的‘眼睛’图标,你可以: + +- 开启或关闭在线搜索结果,使用 Zeitgeist 记录系统活动,存储 HUD 使用记录和启用 Ubuntu GeoIP 服务 +- 快速清理 Zeitgeist 日志、 ALT-F2 历史、最近访问文件等等的记录数据 +- 展示或隐藏桌面图标及面板上显示的用户名 + +上述的最后一条的功能似乎不应该出现在这个应用程序中,但对于那些要分享截图或截屏的人来说,这将会泄露更少的隐私。 + +- [从这里下载隐私指示器 (.deb)][2] + +### Unity 橱窗 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/09/unity-folders.jpg) + +**Android, iOS, OS X, Chrome OS, 和 GNOME Shell 都有应用橱窗, 借助一个极好的第三方应用,Unity 也可以实现类似功能。** + +“Unity 橱窗” 允许你将 Unity 启动器中的应用分组到实用的橱窗中,--- 如游戏,办公,社交等。不必打开 Dash,你就可以快速启动你喜爱的应用,这非常适合你的工作流。 + +每一个 ‘橱窗’其实上是一个打开在图标附近的应用窗口,但总体效果看上去就像是一个 OS X 风格的“堆栈”或 Android 的分组框。 + +橱窗的图标可以自定义或根据橱窗内的应用来自动生成。已有的橱窗可以修改和重新组织、重命名以及如下的更多选择: + +- 根据你的喜好创建任意多的橱窗 +- 选择自定义或自动生成橱窗图标 +- 可选择 3 种橱窗样式 +- 为添加到橱窗中的应用设定自定义图标 +- 编辑现有橱窗 + +[Unity 橱窗的网址](http://unity-folders.exceptionfound.com/) + +### 咖啡因(Caffeine) ### + +对于我们中的许多人来说,咖啡因是必需品,而不仅仅是饮料。而这里的“咖啡因”则提供了一个快速,温和的方式来避免屏保/锁屏占据屏幕。它的有用程度将取决于你的环境(即你系统的怪癖),并且尽管它不像以前那样好用,它仍然值得你[尝试一下][3]。 + +[下载咖啡因(Caffeine) ](https://launchpad.net/~caffeine-developers/+archive/ppa/+files/caffeine_2.7_all.deb) + +### 系统监控指示器 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/multiload-indicator-in-ubuntu.jpg) + +假如你是一个状态迷,即一个喜欢密切关注程序,进程和硬件的状态的人, Linux 很容易满足你的需求。从 Conky 的配置到终端命令,并不缺少监视你的 CPU 使用情况、网络流量或 GPU 温度的方法。 + +但至今为止,我最喜爱的应用是**系统监控指示器**(也被叫做多负载指示器),它可从 Ubuntu 软件中心获得。它也有着大量的配置选项。 + +- [点击这个链接,在 Ubuntu 中下载 ‘系统监控指示器’][4] + +### 针对 Linux 笔记本电脑的省电工具 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2012/08/front.jpg) + +#### TLP #### + +当提到便携式设备上的电池使用效率时,Linux 发行版的声誉并不算好。 + +如果你的 Linux 笔记本在重新充电前,电池只够让你从沙发走到厨房的话,那么这里有几个你可以试试的工具。 + +TLP 是最受欢迎的确保延长 Linux 笔记本的电池寿命的自动化后台工具之一,它是通过调整系统进程和硬件的设置及行为来达成省电的,例如 启动 Wi-Fi 省电模式, PCI 总线设备的实时电量管理和处理器的降频调整。 + +在 Ubuntu 14.04 LTS 以及后续发行版本中可以[使用 TLP 专用的 PPA 来安装它][11],通过它的‘一下搞定’的设置就能用起来。在我们之中的高级用户可以潜心研究并根据你自己的硬件来调整设置,一个[关于 TLP 的完整指导 wiki][6] 使得设置更加容易。 + +#### Laptop Mode Tools #### + +假如 TLP 听起来有一点复杂,这也并没有什么可羞耻的,这里有一个更简单的替代品: **Laptop Mode Tools**。 这个软件包可从 Ubuntu 软件中心直接安装,且本身设置好了一系列合理的默认设置(Wi-Fi,蓝牙等等)。 + +切记,Laptop Mode Tools 不能和 TLP 同时被安装在电脑中。 + +- [Ubuntu 软件中心里的 Laptop Mode Tools ][7] + +### Intel 显卡驱动安装工具 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/04/intelgraphicsdriverinstaller.png) + +对于那些运行 Intel 显卡硬件,并想使得这些硬件发挥出最佳性能的人来说,Intel 显卡安装工具是必须拥有的。 它使得查找并安装最新的 Intel GPU 驱动变得不再是一件痛苦和大费周折的事,因为这无需 PPA 或任何的终端使用知识。 + +- [下载针对 Linux平台的 Intel 显卡驱动安装器 0.7 版本][8] + +### 硬件信息 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/02/Screen-Shot-2014-02-10-at-21.05.37.png) + +假如你计划升级你的 PC 或想替换一个坏掉的零部件,你需要知道一些特定的硬件信息,例如 RAM 类型,CPU插座类型 或查看哪个 PCI 槽是可用的等信息。 + +**I-Nex**可以使得找出这些以及其他的系统具体配置变得更加容易。使用它来查找你的主板型号、S.M.A.R.T.(注:为 Self-Monitoring, Analysis and Reporting Technology 的缩写,经常写为 SMART ) 状态,以及你想的出的很多东西! + +- [可从 Launchpad 了解到更多关于 I-Nex 的信息][9] + +### 磁盘空间可视化程序 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/disk-usage-visualizer-for-ubuntu.jpg) + +在这个硬盘以 TB 计数的时代,我们或许不必同以前一样对硬盘空间的使用三思而后行。但对于那些使用小容量的 SSD,分成多个分区或在一个拥有固定大小的虚拟磁盘的虚拟机上工作的人来说,总有“应该释放一些额外空间是必要的”这种想法的时候。 + +GNOME Disks,在 Ubuntu 中被默认安装,使得查找占用最大磁盘空间的罪魁祸首变得容易。对于定位隐藏的日志、缓存和视频文件,它是非常完美的工具。 + +### BleachBit (Cruft Cleaner) ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/bleachbit.jpg) + +Windows 用户可能对像 CCleaner 之类的应用很熟悉,它可以扫描并清理垃圾文件、空白文件夹、臃肿的缓存以及陈旧的软件包。在 Ubuntu 上,一个相似的快速且毫不费力的一键式清理方法可以试试 **BleachBit** 。 + +它是一个强大的工具,所以一定要注意你正在清理什么。不要漫无目的地确认每个选项框;不是所有的东西它都可以清理。所以请合理地使用它,当你对某个选项有疑问时,就跳过它。 + +- [从 Ubuntu 软件中心里安装 BleachBit][10] + +你已经有了自己最喜欢的系统实用工具了吗?可以在下面的评论中让其他人知晓它。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2014/11/useful-tools-for-ubuntu-do-you-use-them + +作者:[Joey-Elijah Sneddon][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://www.florian-diesch.de/software/indicator-privacy/index.html +[2]:http://www.florian-diesch.de/software/indicator-privacy/dist/indicator-privacy_0.04-1_all.deb +[3]:http://www.omgubuntu.co.uk/2014/05/stop-ubuntu-sleeping-caffeine +[4]:apt://indicator-mulitload +[5]:https://launchpad.net/~linrunner/+archive/ubuntu/tlp/+packages +[6]:http://linrunner.de/en/tlp/docs/tlp-configuration.html +[7]:https://apps.ubuntu.com/cat/applications/laptop-mode-tools/ +[8]:https://01.org/linuxgraphics/downloads/2014/intelr-graphics-installer-linux-1.0.7 +[9]:https://launchpad.net/i-nex +[10]:https://apps.ubuntu.com/cat/applications/bleachbit/ +[11]:https://launchpad.net/~linrunner/+archive/ubuntu/tlp/+packages diff --git a/published/201503/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md b/published/201503/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md new file mode 100644 index 0000000000..1910310f2d --- /dev/null +++ b/published/201503/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md @@ -0,0 +1,105 @@ +dupeGuru - 直接从硬盘中查找并移除重复文件 +================================================================================ + +### 简介 ### + +对我们来说,磁盘被装满是棘手问题之一。无论我们如何小心谨慎,我们总可能将相同的文件复制到多个不同的地方,或者在不知情的情况下,重复下载了同一个文件。因此,迟早你会看到“磁盘已满”的错误提示,若此时我们确实需要一些磁盘空间来存储重要数据,以上情形无疑是最糟糕的。假如你确信自己的系统中有重复文件,那么 **dupeGuru** 可能会帮助到你。 + +dupeGuru 团队也开发了名为 **dupeGuru 音乐版** 的应用来移除重复的音乐文件,和名为 **dupeGuru 图片版** 的应用来移除重复的图片文件。 + +### 1. dupeGuru (标准版) ### + +需要告诉那些不熟悉 [dupeGuru][1] 的人,它是一个免费、开源、跨平台的应用,其用途是在系统中查找和移除重复文件。它可以在 Linux, Windows, 和 Mac OS X 等平台下使用。通过使用一个快速的模糊匹配算法,它可以在几分钟内找到重复文件。同时,你还可以调整 dupeGuru 使它去精确查找特定文件类型的重复文件,以及从你想删除的文件中,清除某种文件。它支持英语、 法语、 德语、 中文 (简体)、 捷克语、 意大利语、亚美尼亚语、俄语、乌克兰语、巴西语和越南语。 + +#### 在 Ubuntu 14.10/14.04/13.10/13.04/12.04 中安装 dupeGuru #### + +dupeGuru 开发者已经构建了一个 Ubuntu PPA (Personal Package Archives)来简化安装过程。想要安装 dupeGuru,依次在终端中键入以下命令: + +``` +sudo apt-add-repository ppa:hsoft/ppa +sudo apt-get update +sudo apt-get install dupeguru-se +``` + +### 使用 ### + +使用非常简单,可从 Unity 面板或菜单中启动 dupeGuru。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/dupeGuru_007.png) + +点击位于底部的 `+` 按钮来添加你想扫描的文件目录。点击 `扫描` 按钮开始查找重复文件。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/dupeGuru_008.png) + +一旦所选目录中含有重复文件,那么它将在窗口中展示重复文件。正如你所看到的,在下面的截图中,我的下载目录中有一个重复文件。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/dupeGuru-Results_009.png) + +现在,你可以决定下一步如何操作。你可以删除这个重复的文件,或者对它进行重命名,抑或是 复制/移动 到另一个位置。为此,选定该重复文件,或在菜单栏中选定写有“**仅显示重复**”选项 ,如果你选择了“**仅显示重复**”选项,则只有重复文件在窗口中可见,这样你便可以轻松选择并删除这些文件。点击“操作”下拉菜单,最后选择你将执行的操作。在这里,我只想删除重复文件,所以我选择了“移动标记文件到垃圾箱”这个选项。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/Menu_010.png) + +接着,点击“继续”选项来移除重复文件。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/Deletion-Options_011.png) + +### 2. dupeGuru 音乐版 ### + +[dupeGuru 音乐版][2] 或简称 dupeGuru ME,它的功能与 dupeGuru 类似。它拥有 dupeGuru 的所有功能,但它包含更多的信息列 (如比特率,持续时间,标签等)和更多的扫描类型(如带有字段的文件名,标签以及音频内容)。和 dupeGuru 一样,dupeGuru ME 也运行在 Linux、Windows 和 Mac OS X 中。 + +它支持众多的格式,诸如 MP3、WMA、AAC (iTunes 格式)、OGG、FLAC,以及失真率较少的 AAC 和 WMA 格式等。 + +#### 在 Ubuntu 14.10/14.04/13.10/13.04/12.04 中安装 dupeGuru ME #### + +现在,我们不必再添加任何 PPA,因为在前面的步骤中,我们已经进行了添加。所以在终端中键入以下命令来安装它: + +``` +sudo apt-get install dupeguru-me +``` + +### 使用 ### + +你可以从 Unity 面板或菜单中启动它。dupeGuru ME 的使用方法、操作界面以及外观和正常的 dupeGuru 类似。添加你想扫描的目录并选择你想执行的操作。重复的音乐文件就会被删除。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/dupeGuru-Music-Edition-Results_012.png) + +### 3. dupeGuru 图片版 ### + +[dupeGuru 图片版][3],或简称为 duepGuru PE,是一个在你的电脑中查找重复图片的工具。它和 dupeGuru 类似,但独具匹配重复图片的功能。dupeGuru PE 可运行在 Linux、Windows 和 Mac OS X 中。 + +dupeGuru PE 支持 JPG、PNG、TIFF、GIF 和 BMP 等图片格式。所有的这些格式可以被同时比较。Mac OS X 版的 dupeGuru PE 还支持 PSD 和 RAW (CR2 和 NEF) 格式。 + +#### 在 Ubuntu 14.10/14.04/13.10/13.04/12.04 中安装 dupeGuru PE #### + +由于我们已经添加了 PPA,我们也不必为 dupeGuru PE 再次添加。只需运行如下命令来安装它。 + +``` +sudo apt-get install dupeguru-pe +``` + +#### 使用 #### + +就使用方法,操作界面和外观而言,它与 dupeGuru,dupeGuru ME 类似。我就纳闷为什么开发者为不同的类别开发了不同的版本。我想如果开发一个结合以上三个版本功能的应用,或许会更好。 + +启动它,添加你想扫描的目录,并选择你想执行的操作。就这样,你的重复文件将被清除。 + +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/11/dupeGuru-Picture-Edition-Results_014.png) + +如果因为任何的安全问题而不能移除某些重复文件,请记下这些文件的位置,通过终端或文件管理器来手动删除它们。 + +欢呼吧! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/dupeguru-find-remove-duplicate-files-instantly-hard-drive/ + +作者:[SK][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:http://www.hardcoded.net/dupeguru/ +[2]:http://www.hardcoded.net/dupeguru_me/ +[3]:http://www.hardcoded.net/dupeguru_pe/ diff --git a/translated/tech/20141204 Linux Namespaces.md b/published/201503/20141204 Linux Namespaces.md similarity index 79% rename from translated/tech/20141204 Linux Namespaces.md rename to published/201503/20141204 Linux Namespaces.md index 522131a50b..c40854d780 100644 --- a/translated/tech/20141204 Linux Namespaces.md +++ b/published/201503/20141204 Linux Namespaces.md @@ -1,32 +1,36 @@ -Linux 命名空间 +介绍 Linux 的命名空间 ================================================================================ ### 背景 ### -从2.6.24版的内核开始,Linux 就支持6种不同类型的命名空间。它们的出现,使用户创建的进程能够与系统分离得更加彻底,从而不需要考虑太多底层的虚拟化技术。 +从Linux 2.6.24版的内核开始,Linux 就支持6种不同类型的命名空间。它们的出现,使用户创建的进程能够与系统分离得更加彻底,从而不需要使用更多的底层虚拟化技术。 - **CLONE_NEWIPC**: 进程间通信(IPC)的命名空间,可以将 SystemV 的 IPC 和 POSIX 的消息队列独立出来。 -- **CLONE_NEWPID**: 进程 ID 的命名空间,进程 ID 独立,意思就是命名空间内的进程 ID 可能会与命名空间外的进程 ID 冲突,于是命名空间内的进程 ID 映射到命名空间外时会使用另外一个进程 ID。比如说,命名空间内 ID 为1的进程,在命名空间外就是指 init 进程。 +- **CLONE_NEWPID**: PID 命名空间。空间内的PID 是独立分配的,意思就是命名空间内的虚拟 PID 可能会与命名空间外的 PID 相冲突,于是命名空间内的 PID 映射到命名空间外时会使用另外一个 PID。比如说,命名空间内第一个 PID 为1,而在命名空间外就是该 PID 已被 init 进程所使用。 - **CLONE_NEWNET**: 网络命名空间,用于隔离网络资源(/proc/net、IP 地址、网卡、路由等)。后台进程可以运行在不同命名空间内的相同端口上,用户还可以虚拟出一块网卡。 - **CLONE_NEWNS**: 挂载命名空间,进程运行时可以将挂载点与系统分离,使用这个功能时,我们可以达到 chroot 的功能,而在安全性方面比 chroot 更高。 - **CLONE_NEWUTS**: UTS 命名空间,主要目的是独立出主机名和网络信息服务(NIS)。 - **CLONE_NEWUSER**: 用户命名空间,同进程 ID 一样,用户 ID 和组 ID 在命名空间内外是不一样的,并且在不同命名空间内可以存在相同的 ID。 +下面我们介绍一下进程命名空间和网络命名空间。 + +### 进程命名空间 + 本文用 C 语言介绍上述概念,因为演示进程命名空间的时候需要用到 C 语言。下面的测试过程在 Debian 6 和 Debian 7 上执行。首先,在栈内分配一页内存空间,并将指针指向内存页的末尾。这里我们使用 **alloca()** 函数来分配内存,不要用 malloc() 函数,它会把内存分配在堆上。 void *mem = alloca(sysconf(_SC_PAGESIZE)) + sysconf(_SC_PAGESIZE); -然后使用 **clone()** 函数创建子进程,传入栈空间的地址 "mem",以及指定命名空间的标记。同时我们还指定“callee”作为子进程运行的函数。 +然后使用 **clone()** 函数创建子进程,传入我们的子栈空间地址 "mem",并指定命名空间的标记。同时我们还指定“callee”作为子进程运行的函数。 mypid = clone(callee, mem, SIGCHLD | CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNS | CLONE_FILES, NULL); -**clone** 之后我们要在父进程中等待子进程先退出,否则的话,父进程会继续运行下去,直到进程结束,留下子进程变成孤儿进程: +**clone** 之后我们要在父进程中等待子进程先退出,否则的话,父进程会继续运行下去,并马上进程结束,留下子进程变成孤儿进程: while (waitpid(mypid, &r, 0) < 0 && errno == EINTR) { continue; } -最后当子进程退出后,我们会回到 shell 界面。 +最后当子进程退出后,我们会回到 shell 界面,并返回子进程的退出码。 if (WIFEXITED(r)) { @@ -47,7 +51,7 @@ Linux 命名空间 return ret; } -程序挂载 **/proc** 文件系统,设置用户 ID 和组 ID,值都为“u”,然后运行 **/bin/bash** 程序,[LXC][1] 是操作系统级的虚拟化工具,使用 cgroups 和命名空间来完成资源的分离。现在我们把所有代码放在一起,变量“u”的值设为65534,在 Debian 系统中,这是“nobody”和“nogroup”: +程序挂载了 **/proc** 文件系统,设置用户 ID 和组 ID,值都为“u”,然后运行 **/bin/bash** 程序,[LXC][1] 是一个操作系统级的虚拟化工具,使用 cgroups 和命名空间来完成资源的分离。现在我们把所有代码放在一起,变量“u”的值设为65534,在 Debian 系统中,这是“nobody”和“nogroup”: #define _GNU_SOURCE #include @@ -101,12 +105,16 @@ Linux 命名空间 nobody 5 0.0 0.0 2784 1064 pts/1 R+ 21:21 0:00 ps auxw nobody@w:~/pen/tmp$ -注意上面的结果,UID 和 GID 被设置成 nobody 和 nogroup 了,特别是 ps 工具只输出两个进程,它们的 ID 分别是1和5(LCTT注:这就是上文介绍 CLONE_NEWPID 时提到的功能,在线程所在的命名空间内,进程 ID 可以为1,映射到命名空间外就是65534;而命名空间外的 ID 为1的进程一直是 init)。接下来轮到使用 ip netns 来设置网络的命名空间。第一步先确定当前系统没有命名空间: +注意上面的结果,UID 和 GID 被设置成 nobody 和 nogroup 了,特别是 ps 工具只输出两个进程,它们的 ID 分别是1和5(LCTT注:这就是上文介绍 CLONE_NEWPID 时提到的功能,在线程所在的命名空间内,进程 ID 可以为1,映射到命名空间外是另外一个 PID;而命名空间外的 ID 为1的进程一直是 init)。 + +### 网络命名空间 + +接下来轮到使用 ip netns 来设置网络的命名空间。第一步先确定当前系统没有命名空间: root@w:~# ip netns list Object "netns" is unknown, try "ip help". -这种情况下,你需要更新你的系统内核,以及 ip 工具。这里假设你的内核版高于2.6.24,ip 工具版本也差不多,高于2.6.24(LCTT注:ip 工具由 iproute 安装包提供,此安装包版本与内核版本相近)。更新好后,**ip netns list** 在没有命名空间存在的情况下不会输出任务信息。加个名为“ns1”的命名空间看看: +如果报了上述错误,你需要更新你的系统内核,以及 ip 工具程序。这里假设你的内核版高于2.6.24,ip 工具版本也差不多,高于2.6.24(LCTT注:ip 工具由 iproute 安装包提供,此安装包版本与内核版本相近)。更新好后,**ip netns list** 在没有命名空间存在的情况下不会输出任务信息。加个名为“ns1”的命名空间看看: root@w:~# ip netns add ns1 root@w:~# ip netns list @@ -120,7 +128,7 @@ Linux 命名空间 2: eth0: mtu 1500 qdisc pfifo_fast state UNKNOWN mode DEFAULT qlen 1000 link/ether 00:0c:29:65:25:9e brd ff:ff:ff:ff:ff:ff -创建新的虚拟网卡,加到命名空间。虚拟网卡需要成对创建,互相关联——想想交叉电缆吧: +创建新的虚拟网卡,并加到命名空间。虚拟网卡需要成对创建,互相关联——就像交叉电缆一样: root@w:~# ip link add veth0 type veth peer name veth1 root@w:~# ip link list @@ -146,11 +154,11 @@ Linux 命名空间 这个时候 **ifconfig** -a 命令只能显示 veth0,不能显示 veth1,因为后者现在在 ns1 命名空间中。 -如果想删除 veth1,可以执行下面的命令: +如果想删除 veth0/veth1,可以执行下面的命令: ip netns exec ns1 ip link del veth1 -为 veth0 分配 IP 地址: +我们可以为 veth0 分配 IP 地址: ifconfig veth0 192.168.5.5/24 @@ -229,7 +237,7 @@ via: http://www.howtoforge.com/linux-namespaces 作者:[aziods][a] 译者:[bazz2](https://github.com/bazz2) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201503/20141205 How to configure a syslog server with rsyslog on Linux.md b/published/201503/20141205 How to configure a syslog server with rsyslog on Linux.md new file mode 100644 index 0000000000..49dd3eb4d4 --- /dev/null +++ b/published/201503/20141205 How to configure a syslog server with rsyslog on Linux.md @@ -0,0 +1,158 @@ +在 Linux 上配置一个 syslog 服务器 +======================================================================== +syslog服务器可以用作一个网络中的日志监控中心,所有能够通过网络来发送日志的设施(包含了Linux或Windows服务器,路由器,交换机以及其他主机)都可以把日志发送给它。 通过设置一个syslog服务器,可以将不同设施/主机发送的日志,过滤和合并到一个独立的位置,这样使得你更容易地查看和获取重要的日志消息。 + +**rsyslog** 作为标准的syslog守护进程,预装在了大多数的Linux发行版中。在客户端/服务器架构的配置下,**rsyslog**同时扮演了两种角色:1.作为一个syslog服务器,**rsyslog**可以收集来自其他设施的日志信息;2.作为一个syslog客户端,**rsyslog**可以将其内部的日志信息传输到远程的syslog服务器。 + +在此,我们演示了在linux上如何通过**rsyslog**来配置一个中心化syslog服务器。 在进入详解之前,先温习一下syslog标准。 + +### syslog标准基础### + +当通过syslog机制来收集日志时,有3个必须要考虑到的重要事情: + +- **设施层级**: 监听何种类型的进程 +- **严重性 (优先) 级别**: 收集何种级别的日志消息 +- **目标**: 发送或记录日志消息到何处 + +现在我们更加深入地了解一下配置是如何定义的。 + +设施层级定义了一种用来对内部系统进程进行分类的方法,linux中的一些常见的设施包括: + +- **auth**: 身份验证相关的消息(登录时) +- **cron**: 进程或应用调度相关的消息 +- **daemon**: 守护进程相关的消息(内部服务器) +- **kernel**: 内核相关的消息 +- **mail**: 内部邮件服务器相关的消息 +- **syslog**: syslog 守护进程本身相关的消息 +- **lpr**: 打印服务相关的消息 +- **local0 - local7**: 用户自定义的消息 (local7 通常被Cisco 和 Windows 服务器 使用) + +严重性(优先)级别有固定的标准缩写和指代的值,其中的数字7具有最高的级别,这些级别包含了: + +- emerg: Emergency(紧急)- 0 +- alert: Alerts (报警)- 1 +- crit: Critical (关键)- 2 +- err: Errors (错误)- 3 +- warn: Warnings (警告)- 4 +- notice: Notification (通知)- 5 +- info: Information (消息)- 6 +- debug: Debugging (调试)- 7 + +最后,目标语句会让一个syslog客户端来执行以下三个任务之一: + +1. 保存日志消息到一个本地文件; +2. 通过TCP/UDP将消息路由到远程的syslog服务器中; +3. 将其发送到一个标准输出中,例如控制台。 + +在 rsyslog里, syslog的配置是基于以下模式进行结构化的。 + + [facility-level].[severity-level] [destination] + +### 在Linux中配置Rsyslog### + +在我们理解syslog之后,现在可以通过rsyslog来将一个Linux服务器配置为一个中心syslog服务器了,另外我们也将看到如何在一个Windows的系统上配置一个syslog客户端来发送内部日志到该syslog服务器中。 + +### 第1步: 初始化系统需求 ### + +要将linux主机设置为一个中央日志服务器, 我们需要创建一个分离的 /var 分区,并分配足够大的磁盘空间或者创建一个特殊的LVM卷组。这样就会使得syslog服务器能够承担在日积月累收集日志所带来的潜在增长。 + +### 第2步: 让rsyslog 后台进程生效 ### + +rsyslog守护进程来自于当前的linux发布版本的预装模块,但是默认并没有启动。为了能够让rsyslog守护进程能够接受外部的消息,需要编辑其配置文件/etc/rsyslog.conf. + +打开文件进行编辑,查找到下面的两行所在的位置,通过删除其行首的#字符来取消注释。 + + $ModLoad imudp + $UDPServerRun 514 + +这会使得rsysolog守护进程能够在UDP端口514上接受日志消息了---UDP是一种比TCP速度快,但是并不具有TCP一样的数据流的可靠性。所以如果你需要使用可靠的传送机制,就可以通过取消以下行的注释。 + + $ModLoad imtcp + $InputTCPServerRun 514 + +需要注意的是,TCP和UDP可以被同时生效来监听TCP/UDP 连接。 + +### 第3步:创建日志接收模板### + +接下来的这步,需要我们来为远程消息创建模板,并告知rsyslog守护进程如何记录从其他客户端机器所接受到的消息。 + +使用文本编辑器来打开 /etc/rsyslog.conf,然后在GLOBAL DIRECTIVE块前追加以下的模板。 + + $template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log" * + *.* ?RemoteLogs + & ~ + +在此对该模板进行简单解释,$template RemoteLogs(这里“RemoteLogs” 字符串可以为任何其他的描述性的名称)指令使rsyslog后台进程将日志消息写到/var/log下的单独的本地日志文件中,其中日志文件的名称是基于远程日志发送机器的主机名以及生成该日志的应用程序名进行定义的。其中第二行暗示了我们将RemoteLogs模板应用到所有接收到的日志上。 + +符号"& ~"表示了一个重定向规则,被用来告知rsyslog守护进程停止对日志消息的进一步处理,并且不要在本地写入。如果没有使用该重定向规则,那么所有的远程消息都会在写入上述描述的日志文件之外同时被写入到本地日志文件,这就意味着日志消息实际上被写了两次。使用该规则的另外一个结果就是syslog服务器本身的日志消息只会被以该机器主机名命名的专有文件中。 + +如果你想要的话,也可以使用下面的模式对特定的设备或严重性级别使用新的模板直接来记录日志消息。 + + [facility-level].[severity-level] ?RemoteLogs + +例如: + +将全部优先级别的所有内部用户验证消息指定为RemoteLogs模板: + + authpriv.* ?RemoteLogs + +将所有系统进程中除开mail、用户验证和cron消息之外的进程产生的消息级别的日志指定为RemoteLogs模板: + + *.info,mail.none,authpriv.none,cron.none ?RemoteLogs + +如果我们想要将所有从远程客户端接受到的消息写入到一个以它们的IP地址命名的单个文件中,可以使用以下的模板。在此我们为该模板赋予了“IpTemplate”名称。 + + $template IpTemplate,"/var/log/%FROMHOST-IP%.log" + *.* ?IpTemplate + & ~ + +在我们启用rsyslog守护进程并编辑好配置文件之后,需要重启该守护进程。 + +在 Debian,Ubuntu 或 CentOS/RHEL 6中: + + $ sudo service rsyslog restart + +在 Fedora 或 CentOS/RHEL 7中: + + $ sudo systemctl restart rsyslog + +我们可以通过netstat命令来验证rsyslog守护进程是否正常工作。 + + $ sudo netstat -tulpn | grep rsyslog + +在UDP监听端口下工作的rsyslog守护进程会有类似下面的输出。 + + udp 0 0 0.0.0.0:514 0.0.0.0:* 551/rsyslogd + udp6 0 0 :::514 :::* 551/rsyslogd + +如果rsyslog守护进程被设置在TCP连接端口,那么应该有类似下面所示的输出。 + + tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 1891/rsyslogd + tcp6 0 0 :::514 :::* LISTEN 1891/rsyslogd + +### 发送Windows日志到一个远程的rsyslog服务器### + +要将一个Windows客户端的日志消息转发到我们的rsyslog服务器,需要一个安装 Windows syslog 代理。当然,有许多的syslog代理可以在windows上运行,在此我们可以使用一个自由软件程序 [Datagram SyslogAgent][1]. + +在下载安装该syslog代理后,需要将其配置为作为服务运行。指定使用何种协议来发送数据,以及远程rsyslog服务器的IP地址和端口,最后指定应该传输的事件日志类型,如下所示。 + +![](https://farm8.staticflickr.com/7509/15305930594_27b7f4440a_o.jpg) + +在我们完成所有的这些配置之后,我们就可以启动该服务并且在中央rsyslog服务器中使用命令行工具tail -f来查看日志文件了。 + +### 总结### + +通过创建一个可以收集本地和远程主机的中央rsyslog服务器,我们可以更好地了解在这些系统内部究竟发生着什么,而且可以更加容易地调试它们的问题,是否在它们之间有任何延迟或崩溃存在。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/configure-syslog-server-linux.html + +作者:[Caezsar M][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/caezsar +[1]:http://www.syslogserver.com/download.html diff --git a/translated/tech/20141217 Centralized Secure Storage (iSCSI)-- 'Initiator Client' Setup on RHEL or CentOS or Fedora -Part III.md b/published/201503/20141217 Centralized Secure Storage (iSCSI)-- 'Initiator Client' Setup on RHEL or CentOS or Fedora -Part III.md similarity index 68% rename from translated/tech/20141217 Centralized Secure Storage (iSCSI)-- 'Initiator Client' Setup on RHEL or CentOS or Fedora -Part III.md rename to published/201503/20141217 Centralized Secure Storage (iSCSI)-- 'Initiator Client' Setup on RHEL or CentOS or Fedora -Part III.md index f4754a6bb8..482733a3a2 100644 --- a/translated/tech/20141217 Centralized Secure Storage (iSCSI)-- 'Initiator Client' Setup on RHEL or CentOS or Fedora -Part III.md +++ b/published/201503/20141217 Centralized Secure Storage (iSCSI)-- 'Initiator Client' Setup on RHEL or CentOS or Fedora -Part III.md @@ -1,33 +1,33 @@ -中心化存储(iSCSI)- “初始器客户端” 在RHEL/CentOS/Fedora上的设置 - 第三部分 -================================================================================ -**iSCSI** 初始化器是一种用于与iSCSI target服务器认证并访问服务器上共享的的LUN的客户端。我们可以在本地挂载的硬盘上部署任何操作系统,只需要安装一个包来与target服务器验证。 +设置iSCSI的发起程序(客户端)(三) +============================ + +**iSCSI** 发起程序是一种用于同 iSCSI 目标器认证并访问服务器上共享的LUN的客户端。我们可以在本地挂载的硬盘上部署任何操作系统,只需要安装一个包来与目标器验证。 ![Client Initiator Setup](http://www.tecmint.com/wp-content/uploads/2014/07/Client-Initiator-Setup.jpg) -初始器客户端设置 +*初始器客户端设置* -#### 功能 #### +### 功能 ### - 可以处理本地挂载磁盘上的任意文件系统 -- 在使用fdisk命令后不需要重启系统 +- 在使用fdisk命令分区后不需要重启系统 -#### 要求 #### +### 前置阅读 ### -- [使用iSCSI Target创建集中化安全存储- 第一部分][1] -- [在Target服务器中使用LVM创建LUN - 第二部分][2] +- [使用iSCSI Target创建集中式安全存储(一)][1] +- [在 iSCSI Target 服务器中使用LVM创建和设置LUN(二)][2] #### 我的客户端设置 #### -- 操作系统 – CentOS release 6.5 (最终版) -- iSCSI Target IP – 192.168.0.50 +- 操作系统 – CentOS 6.5 (Final) +- iSCSI 目标器 IP – 192.168.0.50 - 使用的端口 : TCP 3260 -**Warning**: Never stop the service while LUNs Mounted in Client machines (Initiator). -**Warning**:永远不要在使用LUN的时候在客户端中(初始化器)停止服务。 +**警告**:永远不要在LUN还挂载在客户端(发起程序)时停止服务。 ### 客户端设置 ### -**1.** 在客户端,我们需要安装包‘**iSCSI-initiator-utils**‘,用下面的命令搜索包。 +**1.** 在客户端,我们需要安装包‘**iSCSI-initiator-utils**’,用下面的命令搜索包。 # yum search iscsi @@ -37,29 +37,29 @@ iscsi-initiator-utils.x86_64 : iSCSI daemon and utility programs iscsi-initiator-utils-devel.x86_64 : Development files for iscsi-initiator-utils -**2.** 一旦定位了包,就用下面的yum命令安装初始化包。 +**2.** 找到了包,就用下面的yum命令安装初始化包。 # yum install iscsi-initiator-utils.x86_64 -**3.** 安装完毕后,我们需要发现**Target 服务器**上的共享。客户端的命令有点难记,因此我们使用man来的到需要运行的命令列表 +**3.** 安装完毕后,我们需要发现**目标器**上的共享。客户端的命令有点难记,因此我们使用man找到需要运行的命令列表。 # man iscsiadm ![man iscsiadm](http://www.tecmint.com/wp-content/uploads/2014/07/man-iscsiadm.jpg) -man iscsiadm +*man iscsiadm* -**4.** 按下**SHIFT+G** 进入man页的底部并且稍微向上滚动来的到登录的示例命令。下面的发现命令中,需要用我们的**服务器IP地址**来替换。 +**4.** 按下**SHIFT+G** 进入man页的底部并且稍微向上滚动找到示例的登录命令。下面的发现命令中,需要用我们的**服务器IP地址**来替换。 # iscsiadm --mode discoverydb --type sendtargets --portal 192.168.0.200 --discover -**5.** 这里我们从下面的命令中得到了iSCSIi限定名(iqn)。 +**5.** 这里我们从下面的命令输出中找到了iSCSI的限定名(iqn)。 192.168.0.200:3260,1 iqn.2014-07.com.tecmint:tgt1 ![Discover Target](http://www.tecmint.com/wp-content/uploads/2014/07/Discover-Target.jpg) -发现服务器 +*发现服务器* **6.** 要登录就用下面的命令来连接一台LUN到我们本地系统中,这会与服务器验证并允许我们登录LUN。 @@ -67,7 +67,7 @@ man iscsiadm ![Login To Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Login-To-Target-Server.jpg) -登录到服务器 +*登录到服务器* **注意**:登出使用登录命令并在命令的最后使用logout来替换。 @@ -75,15 +75,15 @@ man iscsiadm ![Logout from Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Logout-from-Target-Server.jpg) -等出服务器 +*登出服务器* -**7.** 登录服务器后,使用下面的命令列出节点的记录。 +**7.** 登录服务器后,使用下面的命令列出节点的记录行。 # iscsiadm --mode node ![List Node](http://www.tecmint.com/wp-content/uploads/2014/07/List-Node.jpg) -列出节点 +*列出节点* **8.** 显示特定节点的所有数据 @@ -109,7 +109,7 @@ man iscsiadm iface.linklocal_autocfg = .... -**9.** 接着列出使用的磁盘,fdisk会列出所有的认证过的磁盘。 +**9.** 接着列出使用的磁盘,fdisk会列出所有的登录认证过的磁盘。 # fdisk -l /dev/sda @@ -123,7 +123,7 @@ man iscsiadm ![Create New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Create-New-Partition.jpg) -创建新分区 +*创建新分区* **注意**:在使用fdisk创建新分区之后,我们无需重启,就像使用我们本地的文件系统一样就行。因为这个将远程共享存储挂载到本地了。 @@ -133,7 +133,7 @@ man iscsiadm ![Format New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Format-New-Partition.jpg) -格式化新分区 +*格式化新分区* **12.** 创建一个目录来挂载新创建的分区 @@ -143,20 +143,20 @@ man iscsiadm ![Mount New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Mount-New-Partition.jpg) -挂载新分区 +*挂载新分区* **13.** 列出挂载点 # df -Th -- **-T** – Prints files system types. -- **-h** – Prints in human readable format eg : Megabyte or Gigabyte. +- **-T** – 输出文件系统类型 +- **-h** – 以易读的方式显示大小 ![List New Partition](http://www.tecmint.com/wp-content/uploads/2014/07/List-New-Partition.jpg) -列出新分区 +*列出新分区* -**14.** 如果需要永久挂在使用fdtab文件 +**14.** 如果需要永久挂载,使用fdtab文件 # vim /etc/fstab @@ -168,18 +168,18 @@ man iscsiadm ![Auto Mount Partition](http://www.tecmint.com/wp-content/uploads/2014/07/Auto-Mount-Partition.jpg) -自动挂载分区 +*自动挂载分区* **16.** 最后检查我们fstab文件是否有错误。 # mount -av - **-a** – 所有挂载点 -- **-v** – 繁琐模式 +- **-v** – 冗余模式 ![Verify fstab Entries](http://www.tecmint.com/wp-content/uploads/2014/07/Verify-fstab-Entries.jpg) -验证fstab文件 +*验证fstab文件* 我们已经成功完成了我们的客户端配置。现在让我们像本地磁盘一样使用它吧。 @@ -189,10 +189,10 @@ via: http://www.tecmint.com/iscsi-initiator-client-setup/ 作者:[Babin Lonston][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/) 荣誉推出 [a]:http://www.tecmint.com/author/babinlonston/ -[1]:http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-targetin-linux/ -[2]:http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/ +[1]:http://linux.cn/article-4971-1.html +[2]:http://linux.cn/article-4972-1.html diff --git a/translated/tech/20141217 Create Centralized Secure Storage using iSCSI Target on RHEL or CentOS or Fedora Part -I.md b/published/201503/20141217 Create Centralized Secure Storage using iSCSI Target on RHEL or CentOS or Fedora Part -I.md similarity index 59% rename from translated/tech/20141217 Create Centralized Secure Storage using iSCSI Target on RHEL or CentOS or Fedora Part -I.md rename to published/201503/20141217 Create Centralized Secure Storage using iSCSI Target on RHEL or CentOS or Fedora Part -I.md index 8455aeb5cb..34352ed08c 100644 --- a/translated/tech/20141217 Create Centralized Secure Storage using iSCSI Target on RHEL or CentOS or Fedora Part -I.md +++ b/published/201503/20141217 Create Centralized Secure Storage using iSCSI Target on RHEL or CentOS or Fedora Part -I.md @@ -1,46 +1,47 @@ -在RHEL/CentOS/Fedora上使用iSCSI Target创建集中式安全存储 - 第一部分 +使用iSCSI Target创建集中式安全存储(一) ================================================================================ -**iSCSI** 是一种就块级别协议,用于通过TCP/IP网络共享**原始存储设备**,可以用已经存在的IP和以太网如网卡、交换机、路由器等通过iSCSI协议共享和访问存储。iSCSI target是一种远程iSCSI服务器或者taget上的远程硬盘。 +**iSCSI** 是一种块级别的协议,用于通过TCP/IP网络共享**原始存储设备**,可以用已经存在的IP和以太网如网卡、交换机、路由器等通过iSCSI协议共享和访问存储。iSCSI target是一种由远程iSCSI服务器(target)提供的远程硬盘。 ![Install iSCSI Target in Linux](http://www.tecmint.com/wp-content/uploads/2014/07/Install-iSCSI-Target-in-Linux.jpg) -在Linux中安装iSCSI Target -我们不需要在客户端为了稳定的连接和性能而占用很大的资源。iSCSI服务器称为Target,它共享存储。iSCSI客户端称为Initiator,它访问Target服务器行的存储。市场中有用于大型存储服务如SAN的iSCSI适配器。 +*在Linux中安装iSCSI Target* + +我们不需要占用很大的资源就可以为客户端提供稳定的连接和性能。iSCSI服务器称为“Target(目标器)”,它提供服务器上的存储共享。iSCSI客户端称为“Initiator(发起程序)”,它访问目标器共享的存储。市场中有卖的用于大型存储服务如SAN的iSCSI适配器。 **我们为什么要在大型存储领域中使用iSCSI适配器** -以太网适配器(NIC)被设计用于在系统、服务器和存储设备如NAS间传输分组数据,它不适合在Internet中传输块级别数据。 +以太网适配器(NIC)被设计用于在系统、服务器和存储设备如NAS间传输分组数据,它不适合在Internet中传输块级数据。 ### iSCSI Target的功能 ### -- 可以在一台机器上运行几个iSCSI target -- 一台机器的多个iSCSI target可以在iSCSI中访问 -- 一个target就是一块存储,并且可以通过网络被初始化器(客户端)访问 +- 可以在一台机器上运行几个iSCSI 目标器 +- 一台机器可以提供多个iSCSI 目标器用于iSCSI SAN访问 +- 一个目标器就是一块存储,并且可以通过网络被发起程序(客户端)访问 - 把这些存储汇聚在一起让它们在网络中可以访问的是iSCSI LUN(逻辑单元号) -- iSCSI支持在同一个会话中含有多个连接 -- iSCSI初始化器在网络中发现目标接着用LUN验证并登录,这样就可以本地访问远程存储。 -- 我们了一在本地挂载的LUN上安装任何操作系统,就像我们安装我们本地的操作系统一样。 +- iSCSI支持在同一个会话中使用多个连接 +- iSCSI发起程序在网络中发现目标接着用LUN验证并登录,这样就可以本地访问远程存储。 +- 我们可以在本地挂载的LUN上安装任何操作系统,就像我们安装我们本地的操作系统一样。 ### 为什么需要iSCSI? ### 在虚拟化中,我们需要存储拥有高度的冗余性、稳定性,iSCSI以低成本的方式提供了这些特性。与使用光纤通道的SAN比起来,我们可以使用已经存在的设备比如NIC、以太网交换机等建造一个低成本的SAN。 -现在我开始使用iSCSI Target安装并配置安全存储。本篇中,我们遵循下面的步骤 +现在我开始使用iSCSI 目标器安装并配置安全存储。本篇中,我们遵循下面的步骤: -- 我们需要隔离一个系统来设置iSCSI Target服务器和初始化器(客户端)。 -- 可以在大型存储环境中添加多个硬盘,但是我们除了基本的安装盘之外只使用一个额外的驱动器。 -- 现在我们只使用2块硬盘,一个用于基本的服务器安装,另外一个用于存储(LUN),这个我们会在这个系列的第二篇描述。 +- 我们需要隔离一个系统来设置iSCSI Target服务器和发起程序(客户端)。 +- 在大型存储环境中可以添加多个硬盘,但是这里我们除了基本的安装盘之外只使用了一个额外的驱动器。 +- 这里我们只使用了2块硬盘,一个用于基本的服务器安装,另外一个用于存储(LUN),这个我们会在这个系列的第二篇描述。 #### 主服务器设置 #### -- 操作系统 – CentOS release 6.5 (最终版) -- iSCSI Target IP – 192.168.0.200 +- 操作系统 – CentOS 6.5 (Final) +- iSCSI 目标器 IP – 192.168.0.200 - 使用的端口 : TCP 860, 3260 - 配置文件 : /etc/tgt/targets.conf -## 安装 iSCSI Target ## +### 安装 iSCSI Target ### -打开终端并使用yum命令来搜索我们需要在iscsi target上安装的包名。 +打开终端并使用yum命令来搜索需要在iscsi 目标器上安装的包名。 # yum search iscsi @@ -52,21 +53,21 @@ lsscsi.x86_64 : List SCSI devices (or hosts) and associated information scsi-target-utils.x86_64 : The SCSI target daemon and utility programs -We got the search result as above, choose the **Target** package and install to play around. -你会的到上面的那些结果,选择**Target**包来安装 +你会的到上面的那些结果,选择**Target**包来安装。 # yum install scsi-target-utils -y ![Install iSCSI Utils](http://www.tecmint.com/wp-content/uploads/2014/07/Install-iSCSI-in-Linux.jpg) -安装iSCSI工具 -列出安装的包来了解默认的配置、服务和man页面的位置 +*安装iSCSI工具* + +列出安装的包里面的内容来了解默认的配置、服务和man页面的位置。 # rpm -ql scsi-target-utils.x86_64 ![List All iSCSI Files](http://www.tecmint.com/wp-content/uploads/2014/07/List-All-ISCSI-Files.jpg) -列出所有的iSCSI文件 +*列出所有的iSCSI包里面的文件* 让我们启动iSCSI服务,并检查服务运行的状态,iSCSI的服务名是**tgtd**。 @@ -75,7 +76,7 @@ We got the search result as above, choose the **Target** package and install to ![Start iSCSI Service](http://www.tecmint.com/wp-content/uploads/2014/07/Start-iSCSI-Service.jpg) -启动iSCSI服务 +*启动iSCSI服务* 现在我们需要配置开机自动启动。 @@ -87,53 +88,53 @@ We got the search result as above, choose the **Target** package and install to ![Enable iSCSI on Startup](http://www.tecmint.com/wp-content/uploads/2014/07/Enable-iSCSI-on-Startup.jpg) -开机启动iSCSI +*开机启动iSCSI* -现在使用**tgtadm**来列出在我们的服务器上已经配置了哪些target和LUN。 +现在使用**tgtadm**来列出在我们的服务器上已经配置了哪些目标器和LUN。 # tgtadm --mode target --op show -**tgtd**已经安装并在运行了,但是上面的命令没有**输出**因为我们还没有在Target服务器上定义LUN。要查看手册,运行‘**man**‘命令。 +**tgtd**已经安装并在运行了,但是上面的命令没有**输出**因为我们还没有在目标器上定义LUN。要查看手册,可以运行‘**man**‘命令。 # man tgtadm ![iSCSI Man Pages](http://www.tecmint.com/wp-content/uploads/2014/07/iSCSI-Man-Pages.jpg) -iSCSI Man 页面 +*iSCSI Man 页面* -最终我们需要为iSCSI添加iptable规则,如果你的target服务器上存在iptable的话。首先使用netstat命令找出iscsi target的端口号,target总是监听TCP端口3260。 +如果你的target服务器上有iptable的话,那么我们需要为iSCSI添加iptable规则。首先使用netstat命令找出iscsi target的端口号,target总是监听TCP端口3260。 # netstat -tulnp | grep tgtd ![Find iSCSI Port](http://www.tecmint.com/wp-content/uploads/2014/07/Find-iSCSI-Port.jpg) -找出iSCSI端口 +*找出iSCSI端口* -下面加入如下规则让iptable允许广播iSCSI target发现包。 +下面加入如下规则让iptable允许广播iSCSI 目标器发现包。 # iptables -A INPUT -i eth0 -p tcp --dport 860 -m state --state NEW,ESTABLISHED -j ACCEPT # iptables -A INPUT -i eth0 -p tcp --dport 3260 -m state --state NEW,ESTABLISHED -j ACCEPT ![Open iSCSI Ports](http://www.tecmint.com/wp-content/uploads/2014/07/Open-iSCSI-Ports.jpg) -打开iSCSI端口 +*打开iSCSI端口* ![Add iSCSI Ports to Iptables](http://www.tecmint.com/wp-content/uploads/2014/07/Add-iSCSI-Ports-to-Iptables.jpg) -添加iSCSI端口到iptable中 +*添加iSCSI端口到iptable中* -**注意**: 规则可能根据你的 **默认链策略**而不同。接着保存iptable并重启。 +**注意**: 规则可能根据你的 **默认链策略**而不同。接着保存iptable并重启该服务。 # iptables-save # /etc/init.d/iptables restart ![Restart iptables](http://www.tecmint.com/wp-content/uploads/2014/07/Restart-iptables.jpg) -重启iptable +*重启iptable* -现在我们已经部署了一个target服务器来共享LUN给通过TCP/IP认证的初始化器。这也适用于从小到大规模的生产环境。 +现在我们已经部署了一个目标器来共享LUN给通过TCP/IP认证的发起程序。这也适用于从小到大规模的生产环境。 -在我的下篇文章中,我会展示如何[在Target服务器中使用LVM创建LUN][1],并且如何在客户端中共享LUN,在此之前请继续关注TecMint获取更多的更新,并且不要忘记留下有价值的评论。 +在我的下篇文章中,我会展示如何[在目标器中使用LVM创建LUN][1],并且如何在客户端中共享LUN,不要忘记留下有价值的评论。 -------------------------------------------------------------------------------- @@ -141,7 +142,7 @@ via: http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-target 作者:[Babin Lonston][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/) 荣誉推出 diff --git a/translated/tech/20141217 How to Create and Setup LUNs using LVM in 'iSCSI Target Server' on RHEL or CentOS or Fedora -Part II.md b/published/201503/20141217 How to Create and Setup LUNs using LVM in 'iSCSI Target Server' on RHEL or CentOS or Fedora -Part II.md similarity index 65% rename from translated/tech/20141217 How to Create and Setup LUNs using LVM in 'iSCSI Target Server' on RHEL or CentOS or Fedora -Part II.md rename to published/201503/20141217 How to Create and Setup LUNs using LVM in 'iSCSI Target Server' on RHEL or CentOS or Fedora -Part II.md index bac7aba27f..3c8f09a168 100644 --- a/translated/tech/20141217 How to Create and Setup LUNs using LVM in 'iSCSI Target Server' on RHEL or CentOS or Fedora -Part II.md +++ b/published/201503/20141217 How to Create and Setup LUNs using LVM in 'iSCSI Target Server' on RHEL or CentOS or Fedora -Part II.md @@ -1,47 +1,47 @@ -如何在RHEL/CentOS/Fedora中使用LVM创建和设置LUN- 第二部分 +在 iSCSI Target 服务器中使用LVM创建和设置LUN(二) ================================================================================ -LUN是逻辑单元号,它与iSCSI存储服务器共享。物理iSCSI target服务器共享它的驱动器来初始化TCP/IP网络。驱动器的集合称作LUN来幸存一个大型存储也就是SAN(Storage Area Network)。在真实环境中LUN在LVM中定义,因此它可以按需扩展。 +LUN是逻辑单元号,它与iSCSI存储服务器共享。iSCSI 目标器通过TCP/IP网络共享它的物理驱动器给发起程序(initiator)。这些来自一个大型存储(SAN:Storage Area Network)的驱动器集合称作LUN。在真实环境中LUN是在LVM中定义的,因为它可以按需扩展。 ![Create LUNS using LVM in Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/Create-LUNS-inLVM.png) -Create LUNS using LVM in Target Server + +*在目标器中使用 LVM 创建 LUN* ### 为什么使用LUN? ### -LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块物理驱动器组成。我们可以使用LUN作为系统物理驱动器来安装操作系统,LUN在集群、虚拟服务器、SAN中使用。在虚拟服务器中使用LUN的目的是作为系统存储。LUN的性能和可靠性根据在创建目标存储服务器时所使用的驱动器决定。 +LUN用于存储,SAN存储大多数由LUN的集群来组成存储池,LUN由目标器的几块物理驱动器组成。我们可以使用LUN作为系统物理驱动器来安装操作系统,LUN可以用在集群、虚拟服务器、SAN中。在虚拟服务器中使用LUN的主要用途是作为操作系统的存储。LUN的性能和可靠性根据在创建目标存储服务器时所使用的驱动器决定。 -### 需求 ### +### 前置阅读 ### -要了解创建iSCSI target服务器点击下面的链接。 +要了解创建iSCSI 目标器,点击下面的链接。 -- [使用iSCSI target创建爱你集中话安全存储][1] +- [使用iSCSI Target创建集中式安全存储(一)][1] #### 主服务器设置 #### -系统信息和网络设置部分与已经写的iSCSI Target服务相同 - 我们在相同的服务器上定义LUN。 +系统信息和网络设置部分与前文的iSCSI 目标器相同 - 我们在相同的服务器上定义LUN。 - -- 操作系统 – CentOS release 6.5 (最终版) -- iSCSI Target IP – 192.168.0.200 +- 操作系统 – CentOS 6.5 (Final) +- iSCSI 目标器 IP – 192.168.0.200 - 使用的端口 : TCP 860, 3260 - 配置文件 : /etc/tgt/targets.conf -## 在iSCSI Target Server使用LVM创建LUN ## +### 在iSCSI 目标器使用LVM创建LUN ### 首先,用**fdisk -l**命令找出驱动器的列表,这会列出系统中所有分区的列表。 # fdisk -l -上面的命令只会给出基本系统的驱动器信息。为了个到存储设备的信息,使用下面的命令来的到存储设备的列表。 +上面的命令只会给出基本系统的驱动器信息。为了得到存储设备的信息,使用下面的命令来得到存储设备的列表。 # fdisk -l /dev/vda && fdisk -l /dev/sda ![List Storage Drives](http://www.tecmint.com/wp-content/uploads/2014/07/1.jpg) -列出存储设备 +*列出存储设备* **注意**:这里**vda**是虚拟机硬盘,因为我使用的是虚拟机来用于演示,**/dev/sda** 是额外加入的存储。 -### 第一步: 创建用于LUN的LVM ### +### 第一步: 创建用于LUN的LVM驱动器 ### 我们使用**/dev/sda**驱动器来创建LVM。 @@ -49,14 +49,14 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 ![List LVM Drive](http://www.tecmint.com/wp-content/uploads/2014/07/2.jpg) -列出LVM驱动器 +*列出LVM驱动器* -现在让我们如下使用fdisk命令列出驱动器分区。 +现在让我们使用如下fdisk命令列出驱动器分区。 # fdisk -cu /dev/sda -- The option ‘**-c**‘ 关闭DOS兼容模式。 -- The option ‘**-u**‘ 用于列出分区表,给出扇区而不是柱面的大小。 +- 选项 ‘**-c**’ 关闭DOS兼容模式。 +- 选项 ‘**-u**’ 用于列出分区表时给出扇区而不是柱面的大小。 使用**n**创建新的分区。 @@ -109,7 +109,7 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 ![Create LVM Partition](http://www.tecmint.com/wp-content/uploads/2014/07/3.jpg) -创建LVM分区 +*创建LVM分区* 系统重启后,使用fdisk命令列出分区表。 @@ -117,7 +117,7 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 ![Verify LVM Partition](http://www.tecmint.com/wp-content/uploads/2014/07/4.jpg) -验证LVM分区 +*验证LVM分区* ### 第二步: 为LUN创建逻辑卷 ### @@ -125,7 +125,7 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 # pvcreate /dev/sda1 -用iSCSI的名字创建卷组来区分组。 +用iSCSI的名字创建卷组来区分这个卷组。 # vgcreate vg_iscsi /dev/sda1 @@ -148,17 +148,17 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 ![Creating LVM Logical Volumes](http://www.tecmint.com/wp-content/uploads/2014/07/5.jpg) -创建LVM逻辑卷 +*创建LVM逻辑卷* ![Verify LVM Logical Volumes](http://www.tecmint.com/wp-content/uploads/2014/07/6.jpg) -验证LVM逻辑卷 +*验证LVM逻辑卷* -### 第三步: 在Target Server中定义LUN ### +### 第三步: 在目标器中定义LUN ### -我们已经创建了逻辑卷并准备使用LUN,现在我们在target配置中定义LUN,如果这样那么它只能用在客户机中(启动器)。 +我们已经创建了逻辑卷并准备使用LUN,现在我们在目标器配置中定义LUN,只有这样做它才能用在客户机中(发起程序)。 -用你选择的编辑器打开位于‘/etc/tgt/targets.conf’的target配置文件。 +用你选择的编辑器打开位于‘/etc/tgt/targets.conf’的目标器配置文件。 # vim /etc/tgt/targets.conf @@ -179,20 +179,22 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 ![Configure LUNs in Target Server](http://www.tecmint.com/wp-content/uploads/2014/07/7.jpg) -在target中配置LUN +*在target中配置LUN* -- iSCSI 限定名 (iqn.2014-07.com.tecmint:tgt1). -- 随你怎么使用 -- 确定使用目标, 这台服务器中的第一个目标 -- 4. LVM共享特定的LUN。 +上图的解释: -接下来使用下面命令重载**tgd**服务配置。 +1. iSCSI 采取限定名 (iqn.2014-07.com.tecmint:tgt1). +2. 名称随便你 +3. 用于确定目标名, 这是这台服务器中的第一个目标 +4. LVM共享特定的LUN。 + +接下来使用下面的命令重载**tgd**服务配置。 # /etc/init.d/tgtd reload ![Reload Configuration](http://www.tecmint.com/wp-content/uploads/2014/07/8.jpg) -重载配置 +*重载配置* 接下来使用下面的命令验证可用的LUN。 @@ -200,23 +202,22 @@ LUN用于存储,SAN存储大多数有LUN的集群来组成池,LUN由几块 ![List Available LUNs](http://www.tecmint.com/wp-content/uploads/2014/07/9.jpg) -列出可用LUN +*列出可用LUN* ![LUNs Information](http://www.tecmint.com/wp-content/uploads/2014/07/10.jpg) -LUN信息 +*LUN信息* -The above command will give long list of available LUNs with following information. 上面的命令会列出可用LUN的下面这些信息 -- iSCSI 限定名 -- iSCSI 准备使用 -- 默认LUN 0被控制器保留 -- LUN 1是我们定义的target服务器 -- 这里我为每个LUN都定义了4GB -- 在线: 是的,这就是可以使用的LUN +1. iSCSI 限定名 +2. iSCSI 已经准备好 +3. 默认LUN 0被控制器所保留 +4. LUN 1是我们定义的目标器 +5. 这里我为每个LUN都定义了4GB +6. 在线: 是的,这就是可以使用的LUN -现在我们已经使用LVM为target服务器定义了LUN,这可扩展并且支持很多特性,如快照。我们将会在第三部分了解如何用target服务器授权,并且本地挂载远程存储。 +现在我们已经使用LVM为目标器定义了LUN,这可扩展并且支持很多特性,如快照。我们将会在第三部分了解如何用目标器授权,并且本地挂载远程存储。 -------------------------------------------------------------------------------- @@ -224,9 +225,9 @@ via: http://www.tecmint.com/create-luns-using-lvm-in-iscsi-target/ 作者:[Babin Lonston][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/) 荣誉推出 [a]:http://www.tecmint.com/author/babinlonston/ -[1]:http://www.tecmint.com/create-centralized-secure-storage-using-iscsi-targetin-linux/ \ No newline at end of file +[1]:http://linux.cn/article-4971-1.html \ No newline at end of file diff --git a/translated/tech/20141219 Creating your First App on Linux with Python and Flask.md b/published/201503/20141219 Creating your First App on Linux with Python and Flask.md similarity index 64% rename from translated/tech/20141219 Creating your First App on Linux with Python and Flask.md rename to published/201503/20141219 Creating your First App on Linux with Python and Flask.md index fc90044195..94f3cd7873 100644 --- a/translated/tech/20141219 Creating your First App on Linux with Python and Flask.md +++ b/published/201503/20141219 Creating your First App on Linux with Python and Flask.md @@ -2,29 +2,28 @@ ================================================================================ ![](http://techarena51.com/wp-content/uploads/2014/12/python-logo.png) -无论你在linux上娱乐还是工作,这对你而言都是一个很好的机会使用python来编程。回到大学我希望他们教我的是Python而不是Java,这学起来很有趣且在实际的应用如yum包管理器中很有用。 +无论你在linux上娱乐还是工作,这对你而言都是一个使用python来编程的很好的机会。回到大学我希望他们教我的是Python而不是Java,这学起来很有趣且在实际的应用如yum包管理器中很有用。 -本篇教程中我会带你使用python和一个称为flask的微型框架来构建一个简单的应用来显示诸如[每个进程的内存使用][1],CPU百分比之类有用的信息。 +本篇教程中我会带你使用python和一个称为flask的微型框架来构建一个简单的应用,来显示诸如[每个进程的内存使用][1],CPU百分比之类有用的信息。 -### 前提 ### +### 前置需求 ### -Python基础、列表、类、函数、模块。 -HTML/CSS (基础) +Python基础、列表、类、函数、模块。HTML/CSS (基础)。 -学习这篇教程你不必是一个python高级开发者,但是首先我建议你阅读https://wiki.python.org/moin/BeginnersGuide/NonProgrammers。 +学习这篇教程你不必是一个python高级开发者,但是首先我建议你阅读 https://wiki.python.org/moin/BeginnersGuide/NonProgrammers 。 -### I在Linux上安装Python 3 ### +### 在Linux上安装Python 3 ### 在大多数Linux发行版上Python是默认安装的。下面的你命令可以让你看到安装的版本。 [root@linux-vps ~]# python -V Python 2.7.5 -我们会使用3.x的版本来构建我们的app。根据[Python.org][2]所说,这版本上面所有的改进都不向后兼容Python 2。 +我们会使用3.x的版本来构建我们的app。根据[Python.org][2]所说,现在只对这个版本进行改进,而且不向后兼容Python 2。 -**注意**: 在开始之前,我强烈建议你在虚拟机中尝试这个教程,因为Python许多Linux发行版的核心组建,任何意外都可能会损坏你的系统。 +**注意**: 在开始之前,我强烈建议你在虚拟机中尝试这个教程,因为Python是许多Linux发行版的核心组件,任何意外都可能会损坏你的系统。 -这步是基于红帽的版本如CentOS(6和7),基于Debian的版本如UbuntuMint和Resbian可以跳过这步,Pythonn 3应该默认已经安装了。如果没有安装,请用apt-get而不是yum来安装下面相应的包。 +以下步骤是基于红帽的版本如CentOS(6和7),基于Debian的版本如UbuntuMint和Resbian可以跳过这步,Pythonn 3应该默认已经安装了。如果没有安装,请用apt-get而不是yum来安装下面相应的包。 [leo@linux-vps] yum groupinstall 'Development Tools' [leo@linux-vps] yum install -y zlib-dev openssl-devel sqlite-devel bzip2-devel @@ -33,7 +32,7 @@ HTML/CSS (基础) [leo@linux-vps] cd Python-3.4.2 [leo@linux-vps] ./configure [leo@linux-vps] make - # make altinstall is recommended as make install can overwrite the current python binary, + # 推荐使用 make altinstall 以覆盖当前的 python 库 [leo@linux-vps] make altinstall 成功安装后,你应该可以用下面的命令进入Python3.4的shell了。 @@ -48,21 +47,19 @@ HTML/CSS (基础) Python有它自己的包管理去,与yum和apt-get相似。你将需要它来下载、安装和卸载包。 - [leo@linux-vps] pip3.4 install "packagename" - + [leo@linux-vps] pip3.4 install "packagename" [leo@linux-vps] pip3.4 list - [leo@linux-vps] pip3.4 uninstall "packagename" ### Python虚拟环境 ### -在Python中虚拟环境是一个你项目依赖的目录。隔离项目的一个好主意是使用不同的依赖。这可以让你不用sudo命令就能安装包。 +在Python中虚拟环境是一个放置你的项目的依赖环境的目录。这是一个将带有不同的依赖环境的项目隔离的好办法。它可以让你不用sudo命令就能安装包。 [leo@linux-vps] mkdir python3.4-flask [leo@linux-vps] cd python3.4-flask [leo@linux-vps python3.4-flask] pyvenv-3.4 venv -要创建虚拟环境你需要使用“pyvenv-3.4”命令。这会在venv文件夹的内部创建一个名为lib的目录,这里会安装项目所依赖的包。这里同样会创建一个bin文件夹容纳该环境下的pip和python可执行文件。 +要创建虚拟环境你需要使用“pyvenv-3.4”命令。上述命令会在venv文件夹的内部创建一个名为lib的目录,这里会安装项目所依赖的包。这里同样会创建一个bin文件夹容纳该环境下的pip和python可执行文件。 ### 为我们的Linux系统信息项目激活虚拟环境 ### @@ -74,21 +71,21 @@ Python有它自己的包管理去,与yum和apt-get相似。你将需要它来 ### 使用pip安装flask ### -让我们继续安装第一个模块flask框架,它可以处理路由和渲染我们app的模板。 +让我们继续安装第一个模块flask框架,它可以处理访问路由和渲染显示我们app的模板。 [leo@linux-vps python3.4-flask]pip3.4 install flask ### 在flask中创建第一个应用 ### -第一步:创建你app的目录 +####第一步:创建你app的目录 - [leo@linux-vps python3.4-flask] mkdir app - [leo@linux-vps python3.4-flask]mkdir app/static - [leo@linux-vps python3.4-flask]mkdir app/templates + [leo@linux-vps python3.4-flask] mkdir app + [leo@linux-vps python3.4-flask] mkdir app/static + [leo@linux-vps python3.4-flask] mkdir app/templates -在python3.4-flask文件家中创建一个一个名为app的文件夹,它包含了两个子文件夹“static”和“templates”。我们的Python脚本会在app文件夹,像css/js这类文件会在static文件夹,template文件夹会包含我们的html模板。 +在python3.4-flask文件夹中创建一个名为app的文件夹,它包含了两个子文件夹“static”和“templates”。我们的Python脚本会放在app文件夹,像css/js这类文件会在static文件夹,template文件夹会包含我们的html模板。 -第二步:在app文件夹内部创建一个初始化文件。 +####第二步:在app文件夹内部创建一个初始化文件 [leo@linux-vps python3.4-flask] vim app/_init_.py from flask import Flask @@ -96,7 +93,7 @@ Python有它自己的包管理去,与yum和apt-get相似。你将需要它来 app = Flask(__name__) from app import index -这个文件创建一个Flask的新的实例并加载我们存储在index.py文件中的python程序,这个文件我们之后会创建。 +这个文件会创建一个Flask的新的实例,并加载我们存储在index.py文件中的python程序——这个文件我们之后会创建。 [leo@linux-vps python3.4-flask]vim app/index.py from app import app @@ -110,7 +107,7 @@ Python有它自己的包管理去,与yum和apt-get相似。你将需要它来 return -flask中的路由由路由装饰器处理。这用于给函数绑定URL。 +flask中的访问路由通过“路由装饰器”处理。它用于将一个 URL 绑定到函数。 @app.route('/') @app.route('/index') @@ -123,7 +120,7 @@ flask中的路由由路由装饰器处理。这用于给函数绑定URL。 subprocess.Popen(['ls', ‘-l’],stdout=subprocess.PIPE,stderr=subprocess.PIPE) -stdout和stderr会相应地存储命令的输出和错误。你可以使用Popen的communicate方法来访问输出了。 +stdout和stderr会相应地存储命令的输出和错误。你可以使用Popen的communicate方法来访问输出。 out,error = cmd.communicate() @@ -133,7 +130,7 @@ stdout和stderr会相应地存储命令的输出和错误。你可以使用Popen 关于subprocess模块更多的信息会在教程的最后给出。 -第三步:创建一个html模板来显示我们命令的输出。 +####第三步:创建一个html模板来显示我们命令的输出。 要做到这个我们使用flask中的Jinja2模板引擎来为我们渲染。 @@ -162,31 +159,31 @@ stdout和stderr会相应地存储命令的输出和错误。你可以使用Popen {% endfor %} -Jinja2模板引擎允许你使用“{{ … }}”分隔符来打印结果,{% … %}来做循环和赋值。我使用“decode()”方法来格式化。 +Jinja2模板引擎允许你使用“{{ … }}”分隔符来输出结果,{% … %}来做循环和赋值。我使用“decode()”方法来格式化。 -第四步:运行app +####第四步:运行app [leo@linux-vps python3.4-flask]vim run.py from app import app app.debug = True app.run(host='174.140.165.231', port=80) -上面的代码会在debug模式下运行app。如果你不写IP地址和端口,默认则是localhost:5000。 +上面的代码会在debug模式下运行app。如果你不指定 IP 地址和端口,默认则是localhost:5000。 [leo@linux-vps python3.4-flask] chmod +x run.py [leo@linux-vps python3.4-flask] python3.4 run.py ![](http://techarena51.com/wp-content/uploads/2014/12/install-python3-flask.png) -我已经加了更多的带来来显示CPU、I/O和平均负载。 +我已经加了更多的代码来显示CPU、I/O和平均负载。 ![](http://techarena51.com/wp-content/uploads/2014/12/install-python3-flask-on-linux.png) -你可以在[这里][3]浏览代码。 +你可以在[这里][3]浏览完整的代码。 这是一个对flask的简短教程,我建议你阅读下面的教程和文档来更深入地了解。 -http://flask.pocoo.org/docs/0.10/quickstart/# +http://flask.pocoo.org/docs/0.10/quickstart/ https://docs.python.org/3.4/library/subprocess.html#popen-constructor @@ -198,7 +195,7 @@ via: http://techarena51.com/index.php/how-to-install-python-3-and-flask-on-linux 作者:[Leo G][a] 译者:[geekpi](https://github.com/gekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201503/20141219 Google Cloud offers streamlined Ubuntu for Docker use.md b/published/201503/20141219 Google Cloud offers streamlined Ubuntu for Docker use.md new file mode 100644 index 0000000000..c79d6de837 --- /dev/null +++ b/published/201503/20141219 Google Cloud offers streamlined Ubuntu for Docker use.md @@ -0,0 +1,37 @@ +Google云服务为Docker应用提供简化版Ubuntu +================================================================================ +> Ubuntu Core为运行容器提供了最小的轻量级Linux环境 + +Google为自己的云服务采用了一个简化版的Canonical Ubuntu Linux发行版,以优化运行Docker和其他容器。 + +Ubuntu Core被设计成仅提供在云上运行Linux所必需的组件。它发布了一个[早期预览版][1],Canonical命名其为“Snappy”。这个新版本裁减了大量在普通Linux发行版中常见而在云应用中不实用的库和应用程序。 + +Google计算引擎(GCE)和Microsoft Azure[加入了][4]支持这个新的发行版的行列。 + +从Canonical了解到,Ubuntu Core将为用户提供一个部署Docker的简单方式,一个[日益精简的虚拟容器][4]允许用户快速启动工作负载并轻松地转移,甚至可以跨越不同的云服务提供商。 + +Google是Docker和基于容器的虚拟化的热心支持者。在去年六月份,这家公司[用开源的方式发布了一个容器管理软件][5]:Kubernetes。 + +Ubuntu Core在设计上类似于另一个[发布于一年前][7]的 Linux发行版 CoreOS。CoreOS 主要由两名前Rackspace工程师开发,[CoreOS][8]是一个轻量级Linux发行版,设计运行在集群中,被那些在网页上完成他们大部分或所有业务的公司所喜好的大规模环境。CoreOS很快被许多云服务提供商采用,包括Microsoft Azure,Amazon网站服务,DigitalOcean以及Google计算引擎。 + +如同CoreOS一样,Ubuntu Core提供了一个快速引擎来更新组件,减少系统管理员去手动处理的时间。 + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2860401/cloud-computing/google-cloud-offers-streamlined-ubuntu-for-docker-use.html + +作者:[Joab Jackson][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Joab-Jackson/ +[1]:http://www.ubuntu.com/cloud/tools/snappy +[2]:http://www.infoworld.com/article/2607941/linux/how-to--get-started-with-docker.html +[3]:http://www.infoworld.com/blog/infoworld-tech-watch/ +[4]:http://www.ubuntu.com/cloud/tools/snappy +[5]:http://www.itworld.com/article/2695383/open-source-tools/docker-all-geared-up-for-the-enterprise.html +[6]:http://www.itworld.com/article/2695501/cloud-computing/google-unleashes-docker-management-tools.html +[7]:http://www.itworld.com/article/2696116/open-source-tools/coreos-linux-does-away-with-the-upgrade-cycle.html +[8]:https://coreos.com/using-coreos/ diff --git a/translated/tech/20141224 Linux FAQs with Answers--How to fix 'XXX is not in the sudoers file' error.md b/published/201503/20141224 Linux FAQs with Answers--How to fix 'XXX is not in the sudoers file' error.md similarity index 72% rename from translated/tech/20141224 Linux FAQs with Answers--How to fix 'XXX is not in the sudoers file' error.md rename to published/201503/20141224 Linux FAQs with Answers--How to fix 'XXX is not in the sudoers file' error.md index 996f833bff..0cd74b4e3d 100644 --- a/translated/tech/20141224 Linux FAQs with Answers--How to fix 'XXX is not in the sudoers file' error.md +++ b/published/201503/20141224 Linux FAQs with Answers--How to fix 'XXX is not in the sudoers file' error.md @@ -1,16 +1,16 @@ -Linux有问必答时间--怎样解决“XXX is not in the sudoers file”错误 +Linux有问必答时间:怎样解决“XXX is not in the sudoers file”错误 ================================================================================ -> **问题**:我想在我的Linux系统上使用sudo来运行一些特权命令,然而当我试图这么做时,我却得到了"[我的用户ID] is not in the sudoers file. This incident will be reported."的错误信息。我该怎么处理这种sudo错误呢? +> **问题**:我想在我的Linux系统上使用sudo来运行一些特权命令,然而当我试图这么做时,我却得到了"[我的用户名] is not in the sudoers file. This incident will be reported."的错误信息。我该怎么处理这种sudo错误呢? -sudo是一个允许特定的用户组用另一个用户(典型的代表是root)的特权来运行一个命令。sudo有详细的日志功能并且提供了细粒度控制来覆盖用户通过sudo敲入的命令。 +sudo是一个允许特定的用户组用另一个用户(典型的是root)的特权来运行一个命令。sudo有详细的日志功能,并且提供了对用户可通过sudo来运行哪些命令的细粒度控制。 ### Sudo vs. Su ### -su命令也提供了同样的特权升级功能,两者不同的是它们认证过程和特权变化的粒度。su允许你从你的登录会话切换到另一个用户的会话,然后你可以随心所欲地用该用户的特权来运行任何程序,但是你需要知道目标用户的密码才能切换这个用户。另一方面,sudo能在每个命令的基础上工作,允许你用root的特权来运行单个命令。用sudo你不必一定要知道root的密码,但是在提示输入sudo密码的时候要输入你的密码。 +su命令也提供了同样的特权提升功能,两者不同的是它们认证过程和特权变化的粒度。su允许你从你的登录会话切换到另一个用户的会话,然后你可以随心所欲地用该用户的特权来运行任何程序,但是你需要知道目标用户的密码才能切换这个用户。而另一方面,sudo能在单个命令的基础上工作,允许你用root的特权来运行单个命令。用sudo你不必一定要知道root的密码,但是在提示输入sudo密码的时候要输入你的密码。 ### 在Sudoers列表里添加用户 ### -作为一个新用户的你如果试图运行sudo命令,你会碰到以下错误。意思是你不在这个包含经过认证可以使用sudo特权的这么一个用户组的sudoers列表里。 +作为一个新用户的你如果试图运行sudo命令,你会碰到以下错误。意思是你不在这个包含经过认证就可以使用sudo特权的这么一个用户组的sudoers列表里。 [my-user-id] is not in the sudoers file. This incident will be reported. @@ -32,11 +32,11 @@ su命令也提供了同样的特权升级功能,两者不同的是它们认证 alice adm cdrom sudo dip plugdev fuse lpadmin netdev sambashare davfs2 libvirtd docker promiscuous -组员资格变动(和sudo访问)会在你登出登录后生效。 +组员资格变动(和sudo访问)会在你登出后重新登录后生效。 ### 方法二 ### -第二个能让你使用sudo的方法是直接把你自己添加到路径为 /etc/sudoers 这个配置文件中去。 +第二个能让你使用sudo的方法是直接把你自己添加到 /etc/sudoers 这个配置文件中去。 要修改 /etc/sudoers 文件,你可以使用一个名为visudo的特殊sudo编辑器命令。用root身份简单调用以下命令。 @@ -55,6 +55,6 @@ su命令也提供了同样的特权升级功能,两者不同的是它们认证 via: http://ask.xmodulo.com/fix-is-not-in-the-sudoers-file.html 译者:[ZTinoZ](https://github.com/ZTinoZ) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20141229 5 User Space Debugging Tools in Linux.md b/published/201503/20141229 5 User Space Debugging Tools in Linux.md similarity index 63% rename from translated/tech/20141229 5 User Space Debugging Tools in Linux.md rename to published/201503/20141229 5 User Space Debugging Tools in Linux.md index 7989758115..d3f572c516 100644 --- a/translated/tech/20141229 5 User Space Debugging Tools in Linux.md +++ b/published/201503/20141229 5 User Space Debugging Tools in Linux.md @@ -1,9 +1,11 @@ -5 Linux下用户空间调试工具 +五个 Linux 下用户空间的调试工具 ================================================================================ -根据定义,调试工具是那些那些使我们能够监测、控制和纠正其他程序的程序。我们为什么应该用调试工具呢? 在有些情况下,运行一些程序的时候我们会被卡住,我们需要明白究竟发生了什么。 例如, 我们正在运行应用程序,它产生了一些错误消息。要修复这些错误,我们应该先找出为什么产生这些错误的消息和这些错误消息从哪里产生的。 一个应用程序可能突然挂起,我们必须了解其他什么进程同时在运行。我们可能还必须弄清楚进程'x'挂起的时候在做什么。为了剖析这些细节, 我们需要调试工具的帮助。有几个Linux下的用户空间调试工具和技术,他们用来分析用户空间问题相当有用。他们是: +根据定义,调试工具是那些那些使我们能够监测、控制和纠正其他程序的程序。我们为什么应该用调试工具呢? 在有些情况下,运行一些程序的时候我们会被卡住,我们需要明白究竟发生了什么。 例如,我们正在运行应用程序,它产生了一些错误消息。要修复这些错误,我们应该先找出为什么产生这些错误的消息和这些错误消息从哪里产生的。 一个应用程序可能突然挂起,我们必须了解其他什么进程同时在运行。我们可能还必须弄清楚某个进程挂起的时候在做什么。为了剖析这些细节, 我们需要调试工具的帮助。 + +有几个Linux下的用户空间调试工具和技术,它们用来分析用户空间的问题相当有用。它们是: - **'print' 语句** -- **查询 (/proc, /sys etc)** +- **查询 (/proc, /sys 等)** - **跟踪 (strace/ltrace)** - **Valgrind (memwatch)** - **GDB** @@ -12,42 +14,44 @@ ### 1.'print' 语句 ### -这是一个基本的原始的调试问题的方法。 我们可以在程序中插入print语句来了解控制流和变量值。 虽然这是一个简单的技术, 但它有一些缺点的。 程序需要进行编辑以添加'print'语句,然后不得不重新编译,重新运行来获得输出。 如果要调试的程序相当大,这是一个耗时的方法。 +这是一个基本的原始的调试问题的方法。 我们可以在程序中插入print语句来了解控制流和变量值。 虽然这是一个简单的技术, 但它有一些缺点。 程序需要进行编辑以添加'print'语句,然后必须重新编译,重新运行来获得输出。 如果要调试的程序相当大,这是一个耗时的方法。 ### 2. 查询 ### 在某些情况下,我们需要弄清楚在一个运行在内核中的进程的状态和内存映射。为了获得这些信息,我们不需要在内核中插入任何代码。 相反,可以用 /proc 文件系统。 -/proc 是一个伪文件系统,系统一起启动运行就收集着运行时系统的信息 (cpu信息, 内存容量 等)。 +/proc 是一个伪文件系统,系统一启动运行就收集着运行时系统的信息 (cpu信息, 内存容量等)。 ![output of 'ls /proc'](http://blog.linoxide.com/wp-content/uploads/2014/12/proc-output.png) -'ls /proc'的输出 + +*'ls /proc'的输出* 正如你看到的, 系统中运行的每一个进程在/proc文件系统中有一个以进程id命名的项。每个进程的细节信息可以在进程id对应的目录下的文件中获得。 ![output of 'ls /proc/pid'](http://blog.linoxide.com/wp-content/uploads/2014/12/proc-pid.png) -'ls /proc/pid'的输出 + +*'ls /proc/pid'的输出* 解释/proc文件系统内的所有条目超出了本文的范围。一些有用的列举如下: - /proc/cmdline -> 内核命令行 - /proc/cpuinfo -> 关于处理器的品牌,型号信息等 - /proc/filesystems -> 文件系统的内核支持的信息 -- /proc//cmdline -> 命令行参数传递到当前进程 -- /proc//mem -> 当前进程持有的内存 -- /proc//status -> 当前进程的状态 +- /proc/\/cmdline -> 命令行参数传递到当前进程 +- /proc/\/mem -> 当前进程持有的内存 +- /proc/\/status -> 当前进程的状态 ### 3. 跟踪 ### -strace的和ltrace是两个在Linux中用来追踪程序的执行细节的跟踪工具 +strace的和ltrace是两个在Linux中用来追踪程序的执行细节的跟踪工具。 #### strace: #### -strace拦截和记录系统调用并且由它来接收的信号。对于用户,它显示了系统调用,传递给它们的参数和返回值。 strace的可以附着到已在运行的进程中,或到一个新的进程。它作为一个针对开发者和系统管理员的诊断,调试工具是很有用的。它也可以用来当为一个通过跟踪不同的程序调用来了解系统的工具。这个工具的好处是不需要源代码和程序不需要重新编译。 +strace拦截和记录系统调用及其接收的信号。对于用户,它显示了系统调用、传递给它们的参数和返回值。strace的可以附着到已在运行的进程或一个新的进程。它作为一个针对开发者和系统管理员的诊断、调试工具是很有用的。它也可以用来当做一个通过跟踪不同的程序调用来了解系统的工具。这个工具的好处是不需要源代码,程序也不需要重新编译。 使用strace的基本语法是: -**strace command** +**strace 命令** strace有各种各样的参数。可以检查看strace的手册页来获得更多的细节。 @@ -58,11 +62,12 @@ strace的输出非常长,我们通常不会对显示的每一行都感兴趣 用'-o'选项,命令的输出可以被重定向到文件。 ![output of strace filtering only the open system call](http://blog.linoxide.com/wp-content/uploads/2014/12/strace-output.png) -strace过滤成只有系统调用的输出 + +*strace过滤成只有系统调用的输出* #### ltrace: #### -ltrace跟踪和记录一个进程的动态(运行时)库的调用和收到的信号。它也可以跟踪一个进程所作的系统调用。它的用法是类似与strace。 +ltrace跟踪和记录一个进程的动态(运行时)库的调用及其收到的信号。它也可以跟踪一个进程所作的系统调用。它的用法是类似与strace。 **ltrace command** @@ -73,25 +78,26 @@ ltrace跟踪和记录一个进程的动态(运行时)库的调用和收到 所有可用的选项请参阅ltrace手册。 ![output of ltrace capturing 'strcmp' library call](http://blog.linoxide.com/wp-content/uploads/2014/12/ltrace-output.png) -ltrace捕捉'STRCMP'库调用的输出 + +*ltrace捕捉'STRCMP'库调用的输出* ### 4. Valgrind ### -Valgrind是一套调试和分析工具。一个被广泛使用的工具,默认的工具被称为'Memcheck'的拦截malloc(),new(),free()和delete()调用的内存检测工具。换句话说,它在检测下面这些问题非常有用: +Valgrind是一套调试和分析工具。它的一个被广泛使用的默认工具——'Memcheck'——可以拦截malloc(),new(),free()和delete()调用。换句话说,它在检测下面这些问题非常有用: - 内存泄露 - 重释放 - 访问越界 - 使用未初始化的内存 -- 使用的内存已经被释放 等。 +- 使用已经被释放的内存等。 它直接通过可执行文件运行。 -Valgrind带有一些缺点。因为它增加了内存占用,可以减慢你的程序。它有时会造成误报和漏报。它不能检测出静态分配的数组的访问越界问题。 +Valgrind也有一些缺点,因为它增加了内存占用,会减慢你的程序。它有时会造成误报和漏报。它不能检测出静态分配的数组的访问越界问题。 -为了用他, 首先下载并安装在你的系统上。 ([Valgrind下载页面][1]). 可以使用操作系统上的包管理起来安装。 +为了使用它,首先请[下载][1]并安装在你的系统上。可以使用操作系统上的包管理器来安装。 -使用命令行安装涉及解压缩,解包下载的文件。 +使用命令行安装需要解压缩和解包下载的文件。 tar -xjvf valgring-x.y.z.tar.bz2 (where x.y.z is the version number you are trying to install) @@ -130,9 +136,10 @@ Valgrind带有一些缺点。因为它增加了内存占用,可以减慢你的 这是valgrind呈现错误的输出: ![output of valgrind showing heap block overrun and memory leak](http://blog.linoxide.com/wp-content/uploads/2014/12/Valgrind.png) -valgrind显示堆溢出和内存泄漏的输出 -正如我们在上面看到的消息,我们正在试图访问超出函数f分配的内存和分配的内存没有释放。 +*valgrind显示堆溢出和内存泄漏的输出* + +正如我们在上面看到的消息,我们正在试图访问函数f未分配的内存以及分配尚未释放的内存。 ### 5. GDB ### @@ -144,15 +151,15 @@ GDB是来自自由软件基金会的调试器。它对定位和修复代码中 - 检查所需信息 - 改变程序中的数据 等。 -你也可以附加一个崩溃的程序coredump到GDB并分析故障的原因。 +你也可以将一个崩溃的程序coredump附着到GDB并分析故障的原因。 GDB提供很多选项来调试程序。 然而,我们将介绍一些重要的选择,来感受如何开始使用GDB。 -如果你还没有安装GDB,可以在这里下载 [GDB官方网站][2]. +如果你还没有安装GDB,可以在这里下载:[GDB官方网站][2]。 #### 编译程序: #### -为了用GDB调试程序,必须使用gcc的'-g'选项进行编译。将以操作系统的本地格式产生调试信息,GDB利用这些信息来工作。 +为了用GDB调试程序,必须使用gcc的'-g'选项进行编译。这将以操作系统的本地格式产生调试信息,GDB利用这些信息来工作。 下面是一个简单的程序(example1.c)执行被零除用来显示GDB的用法: @@ -169,18 +176,20 @@ GDB提供很多选项来调试程序。 然而,我们将介绍一些重要的 } ![An example showing usage of gdb](http://blog.linoxide.com/wp-content/uploads/2014/12/gdb-example.png) -展示GDB用法的例子 + +*展示GDB用法的例子* #### 调用 GDB: #### 通过在命令行中执行'gdb'来启动gdb: ![invoking gdb](http://blog.linoxide.com/wp-content/uploads/2014/12/gdb.png) -调用 gdb -一旦调用, 它将等待终端命令并执行,直到退出。 +*调用 gdb* -如果一个进程已经在运行,你需要将GDB连接到它上面,可以通过指定进程ID来实现。假设程序已经崩溃,要分析问题的原因,则连接GDB到core文件。 +调用后, 它将等待终端命令并执行,直到退出。 + +如果一个进程已经在运行,你需要将GDB连接到它上面,可以通过指定进程ID来实现。假设程序已经崩溃,要分析问题的原因,则用GDB分析core文件。 #### 启动程序: #### @@ -188,7 +197,7 @@ GDB提供很多选项来调试程序。 然而,我们将介绍一些重要的 #### 给程序传参数: #### -使用'set args'给你的程序传参数,当程序下次运行时将获得参数。'show args'将显示传递给程序的参数。 +使用'set args'给你的程序传参数,当程序下次运行时将获得该参数。'show args'将显示传递给程序的参数。 #### 检查堆栈: #### @@ -202,13 +211,13 @@ GDB提供很多选项来调试程序。 然而,我们将介绍一些重要的 #### 检查数据: #### -程序的数据可以在里面GDB使用'print'命令进行检查。例如,如果'X'是调试程序内的变量,'print x'会打印x的值。 +程序的数据可以在里面GDB使用'print'命令进行检查。例如,如果'x'是调试程序内的变量,'print x'会打印x的值。 #### 检查源码: #### 源码可以在GDB中打印。默认情况下,'list'命令会打印10行代码。 -- **list **: 列出'linenum'行周外的源码 +- **list **: 列出'linenum'行周围的源码 - **list **: 从'function'开始列出源码 - **disas **: 显示该函数机器代码 @@ -217,11 +226,11 @@ GDB提供很多选项来调试程序。 然而,我们将介绍一些重要的 使用GDB,我们可以在必要的地方设置断点,观察点等来停止程序。 - **break **: 在'location'设置一个断点。当在程序执行到这里时断点将被击中,控制权被交给用户。 -- **watch **: 当'expr'被程序写而且它的值发生变化时GDB将停止 -- **catch **: 当'event'发生时GDB停止。 +- **watch **: 当'expr'被程序写入而且它的值发生变化时GDB将停止 +- **catch **: 当'event'发生时GDB停止 - **disable **: 禁用指定断点 - **enable **: 启用指定断点 -- **delete **: 删除 断点/观察点/捕获点。 如果没有传递参数默认操作是在所有的断点。 +- **delete **: 删除 断点/观察点/捕获点。 如果没有传递参数默认操作是在所有的断点 - **step**: 一步一步执行程序 - **continue**: 继续执行程序,直到执行完毕 @@ -232,21 +241,18 @@ GDB提供很多选项来调试程序。 然而,我们将介绍一些重要的 GDB还有更多的可用选项。里面GDB使用help选项了解更多详情。 ![getting help within gdb](http://blog.linoxide.com/wp-content/uploads/2014/12/gdb-help.png) -在GDB种获得帮助 + +*在GDB中获得帮助* ### 总结 ### -在这篇文章中,我们已经看到不同类型的Linux用户空间的调试工具。总结以上所有内容,这是些什么时候使用该什么的快速指南: +在这篇文章中,我们已经看到不同类型的Linux用户空间的调试工具。总结以上所有内容,如下是什么时候使用该什么的快速指南: -基本调试,获得关键变量 - print 语句 - -获取有关文件系统支持,可用内存,CPU,运行程序的内核状态等信息 - 查询 /proc 文件系统 - -最初的问题诊断,系统调用或库调用的相关问题,了解程序流程 – strace / ltrace - -应用程序内存空间的问题 – valgrind - -检查应用程序运行时的行为,分析应用程序崩溃 – gdb。 +- 基本调试,获得关键变量 - print 语句 +- 获取有关文件系统支持,可用内存,CPU,运行程序的内核状态等信息 - 查询 /proc 文件系统 +- 最初的问题诊断,系统调用或库调用的相关问题,了解程序流程 – strace / ltrace +- 应用程序内存空间的问题 – valgrind +- 检查应用程序运行时的行为,分析应用程序崩溃 – gdb -------------------------------------------------------------------------------- @@ -254,7 +260,7 @@ via: http://linoxide.com/linux-how-to/user-space-debugging-tools-linux/ 作者:[B N Poornima][a] 译者:[mtunique](https://github.com/mtunique) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150104 How to configure fail2ban to protect Apache HTTP server.md b/published/201503/20150104 How to configure fail2ban to protect Apache HTTP server.md similarity index 61% rename from translated/tech/20150104 How to configure fail2ban to protect Apache HTTP server.md rename to published/201503/20150104 How to configure fail2ban to protect Apache HTTP server.md index 8f89c4b388..2d7b3efc88 100644 --- a/translated/tech/20150104 How to configure fail2ban to protect Apache HTTP server.md +++ b/published/201503/20150104 How to configure fail2ban to protect Apache HTTP server.md @@ -1,16 +1,16 @@ -如何配置fail2ban来保护Apache服务器 +如何配置 fail2ban 来保护 Apache 服务器 ================================================================================ -生产环境中的Apache服务器可能会受到不同的攻击。攻击者或许试图通过暴力攻击或者执行恶意脚本来获取未经授权或者禁止访问的目录。一些恶意爬虫或许会扫描你网站下的任意安全漏洞,或者手机email地址或者web表格来发送垃圾邮件。 +生产环境中的 Apache 服务器可能会受到不同的攻击。攻击者或许试图通过暴力攻击或者执行恶意脚本来获取未经授权或者禁止访问的目录。一些恶意爬虫或许会扫描你网站下的各种安全漏洞,或者通过收集email地址和web表单来发送垃圾邮件。 -Apache服务器具有综合的日志功能来捕捉不同表明是攻击的异常事件。然而,它还不能系统地解析具体的apache日志并迅速地反应到潜在的攻击(比如,禁止/解禁IP地址)。这时候`fail2ban`可以解救这一切,解放了系统管理员的工作。 +Apache服务器具有全面的日志功能,可以捕捉到各种攻击所反映的异常事件。然而,它还不能系统地解析具体的apache 日志并迅速地对潜在的攻击进行反应(比如,禁止/解禁IP地址)。这时候`fail2ban`可以解救这一切,解放了系统管理员的工作。 -`fail2ban`是一款入侵防御工具,可以基于系统日志检测不同的工具并且可以自动采取保护措施比如:通过`iptables`禁止ip、阻止/etc/hosts.deny中的连接、或者通过邮件通知事件。fail2ban具有一系列预定义的“监狱”,它使用特定程序日志过滤器来检测通常的攻击。你也可以编写自定义的规则来检测来自任意程序的攻击。 +`fail2ban`是一款入侵防御工具,可以基于系统日志检测不同的工具并且可以自动采取保护措施比如:通过`iptables`禁止ip、通过 /etc/hosts.deny 阻止连接、或者通过邮件发送通知。fail2ban具有一系列预定义的“监狱”,它使用特定程序日志过滤器来检测通常的攻击。你也可以编写自定义的规则来检测来自任意程序的攻击。 在本教程中,我会演示如何配置fail2ban来保护你的apache服务器。我假设你已经安装了apache和fail2ban。对于安装,请参考[另外一篇教程][1]。 ### 什么是 Fail2ban 监狱 ### -让我们更深入地了解fail2ban监狱。监狱定义了具体的应用策略,它会为指定的程序触发一个保护措施。fail2ban在/etc/fail2ban/jail.conf 下为一些流行程序如Apache、Dovecot、Lighttpd、MySQL、Postfix、[SSH][2]等预定义了一些监狱。每个依赖于特定的程序日志过滤器(在/etc/fail2ban/fileter.d 下面)来检测通常的攻击。让我看一个例子监狱:SSH监狱。 +让我们更深入地了解 fail2ban 监狱。监狱定义了具体的应用策略,它会为指定的程序触发一个保护措施。fail2ban在 /etc/fail2ban/jail.conf 下为一些流行程序如Apache、Dovecot、Lighttpd、MySQL、Postfix、[SSH][2] 等预定义了一些监狱。每个监狱都通过特定的程序日志过滤器(在/etc/fail2ban/fileter.d 下面)来检测通常的攻击。让我看一个例子监狱:SSH监狱。 [ssh] enabled = true @@ -24,15 +24,15 @@ SSH监狱的配置定义了这些参数: - **[ssh]**: 方括号内是监狱的名字。 - **enabled**:是否启用监狱 -- **port**: 端口的数字 (或者数字对应的名称). -- **filter**: 检测攻击的检测规则 -- **logpath**: 检测的日志文件 -- **maxretry**: 禁止前失败的最大数字 -- **banaction**: 禁止操作 +- **port**: 端口号(或者对应的服务名称) +- **filter**: 检测攻击的日志解析规则 +- **logpath**: 所检测的日志文件 +- **maxretry**: 最大失败次数 +- **banaction**: 所进行的禁止操作 -定义配置文件中的任意参数都会覆盖相应的默认配置`fail2ban-wide` 中的参数。相反,任意缺少的参数都会使用定义在[DEFAULT]字段的值。 +定义在监狱配置中的任意参数都会覆盖`fail2ban-wide` 中相应的默认配置参数。相反,任何缺少的参数都会使用定义在[DEFAULT] 字段的默认值。 -预定义日志过滤器都必须在/etc/fail2ban/filter.d,可以采取的操作在/etc/fail2ban/action.d。 +预定义的日志过滤器都放在/etc/fail2ban/filter.d,而可以采取的禁止操作放在 /etc/fail2ban/action.d。 ![](https://farm8.staticflickr.com/7538/16076581722_cbca3c1307_b.jpg) @@ -40,7 +40,7 @@ SSH监狱的配置定义了这些参数: ### 启用预定义的apache监狱 ### -`fail2ban`的默认安装为Apache服务提供了一些预定义监狱以及过滤器。我要启用这些内建的Apache监狱。由于Debian和红买配置的稍微不同,我会分别它们的配置文件。 +`fail2ban`的默认安装为Apache服务提供了一些预定义监狱和过滤器。我要启用这些内建的Apache监狱。由于Debian和RedHat配置的稍微不同,我会分别提供它们的配置文件。 #### 在Debian 或者 Ubuntu启用Apache监狱 #### @@ -50,7 +50,7 @@ SSH监狱的配置定义了这些参数: ---------- - # detect password authentication failures + # 检测密码认证失败 [apache] enabled = true port = http,https @@ -58,7 +58,7 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/apache*/*error.log maxretry = 6 - # detect potential search for exploits and php vulnerabilities + # 检测漏洞和 PHP 脆弱性扫描 [apache-noscript] enabled = true port = http,https @@ -66,7 +66,7 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/apache*/*error.log maxretry = 6 - # detect Apache overflow attempts + # 检测 Apache 溢出攻击 [apache-overflows] enabled = true port = http,https @@ -74,7 +74,7 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/apache*/*error.log maxretry = 2 - # detect failures to find a home directory on a server + # 检测在服务器寻找主目录的尝试 [apache-nohome] enabled = true port = http,https @@ -100,7 +100,7 @@ SSH监狱的配置定义了这些参数: ---------- - # detect password authentication failures + # 检测密码认证失败 [apache] enabled = true port = http,https @@ -108,7 +108,7 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/httpd/*error_log maxretry = 6 - # detect spammer robots crawling email addresses + # 检测抓取邮件地址的爬虫 [apache-badbots] enabled = true port = http,https @@ -117,7 +117,7 @@ SSH监狱的配置定义了这些参数: bantime = 172800 maxretry = 1 - # detect potential search for exploits and php vulnerabilities + # 检测漏洞和 PHP 脆弱性扫描 [apache-noscript] enabled = true port = http,https @@ -125,7 +125,7 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/httpd/*error_log maxretry = 6 - # detect Apache overflow attempts + # 检测 Apache 溢出攻击 [apache-overflows] enabled = true port = http,https @@ -133,7 +133,7 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/httpd/*error_log maxretry = 2 - # detect failures to find a home directory on a server + # 检测在服务器寻找主目录的尝试 [apache-nohome] enabled = true port = http,https @@ -141,9 +141,9 @@ SSH监狱的配置定义了这些参数: logpath = /var/log/httpd/*error_log maxretry = 2 - # detect failures to execute non-existing scripts that - # are associated with several popular web services - # e.g. webmail, phpMyAdmin, WordPress + # 检测执行不存在的脚本的企图 + # 这些都是流行的网站服务程序 + # 如:webmail, phpMyAdmin,WordPress port = http,https filter = apache-botsearch logpath = /var/log/httpd/*error_log @@ -175,7 +175,7 @@ SSH监狱的配置定义了这些参数: ![](https://farm8.staticflickr.com/7572/15891521967_5c6cbc5f8f_c.jpg) -你也可以手动禁止或者解禁IP地址 +你也可以手动禁止或者解禁IP地址: 要用制定监狱禁止IP: @@ -187,7 +187,7 @@ SSH监狱的配置定义了这些参数: ### 总结 ### -本篇教程解释了fail2ban监狱如何工作以及如何使用内置的监狱来保护Apache服务器。依赖于你的环境以及要保护的web服务器类型,你或许要适配已存在的监狱或者编写自定义监狱和日志过滤器。查看outfail2ban的[官方Github页面][3]来获取最新的监狱和过滤器示例。 +本篇教程解释了fail2ban监狱如何工作以及如何使用内置的监狱来保护Apache服务器。依赖于你的环境以及要保护的web服务器类型,你或许要调整已有的监狱或者编写自定义监狱和日志过滤器。查看outfail2ban的[官方Github页面][3]来获取最新的监狱和过滤器示例。 你有在生产环境中使用fail2ban么?分享一下你的经验吧。 @@ -197,11 +197,11 @@ via: http://xmodulo.com/configure-fail2ban-apache-http-server.html 作者:[Dan Nanni][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/) 荣誉推出 [a]:http://xmodulo.com/author/nanni -[1]:http://xmodulo.com/how-to-protect-ssh-server-from-brute-force-attacks-using-fail2ban.html -[2]:http://xmodulo.com/how-to-protect-ssh-server-from-brute-force-attacks-using-fail2ban.html +[1]:http://linux.cn/article-5067-1.html +[2]:http://linux.cn/article-5067-1.html [3]:https://github.com/fail2ban/fail2ban \ No newline at end of file diff --git a/published/201503/20150104 How to debug a C or C++ program with Nemiver debugger.md b/published/201503/20150104 How to debug a C or C++ program with Nemiver debugger.md new file mode 100644 index 0000000000..99eee59987 --- /dev/null +++ b/published/201503/20150104 How to debug a C or C++ program with Nemiver debugger.md @@ -0,0 +1,110 @@ +使用Nemiver调试器来调试 C/C++ 程序 +================================================================================ + +如果你读过我写的[使用GDB命令行调试器调试C/C++程序][1],你就会明白一个调试器对一段C/C++程序来说有多么的重要和有用。然而,如果一个像GDB这样的命令行对你而言听起来更像一个问题而不是一个解决方案的话,那么你也许会对Nemiver更感兴趣。[Nemiver][2] 是一款基于 GTK+ 的用于C/C++程序的图形化的独立调试器,它以GDB作为其后端。最令人赞赏的是其速度和稳定性,Nemiver是一个非常可靠,具备许多优点的调试工具。 + +### Nemiver的安装 ### + +基于Debian发行版,它的安装时非常直接简单,如下: + + $ sudo apt-get install nemiver + +在Arch Linux中安装如下: + + $ sudo pacman -S nemiver + +在Fedora中安装如下: + + $ sudo yum install nemiver + +如果你选择自己编译,[GNOME 网站][3]上有最新源码包。 + +最令人欣慰的是,它能够很好地与GNOME环境像结合。 + +### Nemiver的基本用法 ### + +启动Nemiver的命令: + + $ nemiver + +你也可以通过执行一下命令来启动: + + $ nemiver [需要调试的可执行程序的路径] + +注意,如果在调试模式下编译程序(在 GCC 中使用 -g 选项)将会对 nemiver 更有帮助。 + +还有一个优点是Nemiver的加载很快,所以你马上就可以看到主屏幕的默认布局。 + +![](https://farm9.staticflickr.com/8679/15535277554_d320f6692c_c.jpg) + +默认情况下,断点通常位于主函数的第一行。这样就可以空出时间让你去认识调试器的基本功能: + +![](https://farm9.staticflickr.com/8669/16131832596_bc68ae18a8_o.jpg) + +- 执行到下一行 (按键是F6) +- 执行到函数内部即停止(F7) +- 执行到函数外部即停止(Shift+F7) + +不过我个人喜欢“Run to cursor(运行至光标所在行)”,该选项使你的程序准确的运行至你光标所在行,它的默认按键是F11。 + +断点是很容易使用的。最快捷的方式是在一行代码上按下F8来设置一个断点。但是Nemiver在“Debug”菜单下也有一个更复杂的菜单,它允许你在一个特定的函数,某一行,二进制文件中的位置,或者类似异常、分支或者exec的事件上设置断点。 + +![](https://farm8.staticflickr.com/7579/16157622315_d680a63896_z.jpg) + +你也可以通过追踪来查看一个变量。在“Debug”中,你可以用一个表达式的名字来检查它的值,然后也可以通过将其添加到列表中以方便访问。这可能是最有用的一个功能,虽然我从未有兴趣将鼠标悬停在一个变量来获取它的值。值得注意的是,虽然鼠标悬停可以取到值,如果想要让它更好地工作,Nemiver是可以看到结构并给出所有成员的变量的赋值。 + +![](https://farm8.staticflickr.com/7465/15970310470_7ed020c613.jpg) + +谈到方便地访问信息,我也非常欣赏这个程序的布局。默认情况下,代码在上半部分,功能区标签在下半部分。这可以让你访问终端的输出、上下文追踪器、断点列表、注册器地址、内存映射和变量控制。但是请注意在“Edit”-“Preferences”-“Layout”下你可以选择不同的布局,包括一个可以修改的动态布局。 + +![](https://farm9.staticflickr.com/8606/15971551549_00e4cdd32e_c.jpg) + +![](https://farm8.staticflickr.com/7525/15535277594_026fef17c1_z.jpg) + +自然,当你设置了全部断点,观察点和布局,您可以在“File”菜单下很方便地保存该会话,以便你下次打开时恢复。 + +### Nemiver的高级用法 ### + +到目前为止,我们讨论的都是Nemiver的基本特征,例如,你马上开始调试一个简单的程序需要了解什么。如果你有更高的需求,特别是对于一些更加复杂的程序,你应该会对接下来提到的这些特征更感兴趣。 + +#### 调试一个正在运行的进程 #### + +Nemiver允许你驳接到一个正在运行的进程进行调试。在“File”菜单,你可以筛选出正在运行的进程,并驳接到某个进程。 + +![](https://farm9.staticflickr.com/8593/16155720571_00e4cdd32e_z.jpg) + +#### 通过TCP连接远程调试一个程序 #### + +Nemiver支持远程调试,你可以在一台远程机器上设置一个轻量级调试服务器,然后你在另外一台机器上启动 nemiver 去调试运行在调试服务器上的程序。如果出于某些原因,你不能在远程机器上很好地驾驭 Nemiver或者GDB,那么远程调试对于你来说将非常有用。在“File”菜单下,指定二进制文件、共享库位置、远程地址和端口。 + +![](https://farm8.staticflickr.com/7469/16131832746_c47dee4ef1.jpg) + +#### 使用你的GDB二进制程序进行调试 #### + +如果你的Nemiver是自行编译的,你可以在“Edit(编辑)”-“Preferences(首选项)”-“Debug(调试)”下给GDB指定一个新的位置。如果你想在Nemiver下使用定制版本的GDB,那么这个选项对你来说是非常实用的。 + +#### 跟随一个子进程或者父进程 #### + +当你的程序分支时,Nemiver是可以设置为跟随子进程或者父进程的。想激活这个功能,请到“Debugger”下面的“Preferences(首选项)”。 + +![](https://farm8.staticflickr.com/7512/16131832716_5724ff434c_z.jpg) + +总而言之,Nemiver大概是我最喜欢的不在IDE里面的调试程序。在我看来,它甚至可以击败GDB,它和命令行程序一样深深吸引了我。所以,如果你从未使用过的话,我会强烈推荐你使用。我十分感谢它背后的开发团队给了我这么一个可靠、稳定的程序。 + +你对Nemiver有什么见解?你是否也考虑它作为独立的调试工具?或者仍然坚持使用IDE?让我们在评论中探讨吧。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/debug-program-nemiver-debugger.html + +作者:[Adrien Brochard][a] +译者:[disylee](https://github.com/disylee) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/adrien +[1]:http://linux.cn/article-4302-1.html +[2]:https://wiki.gnome.org/Apps/Nemiver +[3]:https://download.gnome.org/sources/nemiver/0.9/ +[4]:http://xmodulo.com/recommend/linuxclibook diff --git a/published/201503/20150104 How to set up a cross-platform backup server on Linux with BackupPC.md b/published/201503/20150104 How to set up a cross-platform backup server on Linux with BackupPC.md new file mode 100644 index 0000000000..24daaf3424 --- /dev/null +++ b/published/201503/20150104 How to set up a cross-platform backup server on Linux with BackupPC.md @@ -0,0 +1,134 @@ +如何在 Linux 上使用 BackupPC 来架设跨平台的备份服务器 +================================================================================ +也许你没有从我先前关于 [backupninja][1] 和 [backup-manager][2] 的两篇文章中发现,我是一个超级备“粉”。当提到备份,我宁愿备份的太多而不希望备份不足,因为如果我们有需要的话,你将会感激你为重要数据生成额外的拷贝所付出的时间和精力。 + +在这篇文章中,我将向你介绍 [BackupPC][3],一个跨平台的备份服务器软件,它可以通过网络为 Linux,Windows 和 MacOS 等系统上的客户端主机拉取备份。BackupPC 添加了一系列的特点使得管理备份变为一件快乐的事。 + +### BackupPC 的特点 ### + +BackupPC 自带有一个健壮的 Web 界面,允许你以集中化的方式来收集和管理其他远程客户端主机上的备份。通过使用它的 Web 界面,你可以检查日志和配置文件、为其他远程主机启动/取消/安排备份任务以及可视化备份任务的当前状态。你也可以非常容易地浏览归档的文件以及从备份的归档中恢复单个文件或整个备份。要恢复单个文件,你可以直接通过 Web 界面来下载任何先前备份的文件。不仅如此,客户端主机并不需要安装特别的客户端软件。在 Windows 客户端上, 使用的是原生的 SMB 协议,而对于 *nix 客户端,你将使用 `rsync` 或 通过 SSH, RSH 或 NFS 来使用 `tar` 。 + +### 安装 BackupPC ### + +在 Debian,Ubuntu 和它们的衍生版本上,运行下面的命令: + + # aptitude install backuppc + +在 Fedora上, 使用 `yum` 命令。请注意软件包名字对大小写敏感。 + +在 CentOS/RHEL 6 上,首先要启用 [EPEL 软件仓库][4]。在 CentOS/RHEL 7 上,请替代启用 [Nux Dextop][5] 软件仓库。然后接着使用 `yum` 命令: + + # yum install BackupPC + +同往常一样,这两种包管理系统都会自动解决依赖问题。另外,作为安装过程中的一部分,你可能需要新配置或修改配置用于图形用户界面的 Web 服务器。下面的截图来自于 Debian 系统: + +![](https://farm8.staticflickr.com/7573/16163781711_6218b620ef_c.jpg) + +通过空格键来确定你的选择,然后使用 tab 键移动到 Ok 选项并敲回车键。 + +接着类似于下面的截屏将会呈现在你眼前,通知你创建了一个用来管理 BackupPC 的名为 ‘backuppc’的管理员用户以及相应的密码(如果你需要,这个密码以后可以更改)。这里需要注意的是:这里创建了同样名为 ‘backuppc’的 HTTP 账户和常规的 Linux 账户,它们使用相同的密码。需要前者的目的是来访问受保护的 BackupPC 的 Web 界面,而后者则是为了通过 SSH 来使用 `rsync` 来执行备份任务。 + +![](https://farm8.staticflickr.com/7579/15979622809_25e734658d_c.jpg) + +你可以使用下面的命令来更改 HTTP 账户 ‘backuppc’ 的默认密码: + + # htpasswd /path/to/hash/file backuppc + +至于常规的 ‘backuppc’ [Linux][6]账户,可以使用 `passwd`命令来更改它的默认密码: + + # passwd backuppc + +需要提及的是:安装过程中会自动创建 Web 和程序的配置文件。 + +### 启动 BackupPC 并设置备份 ### + +首先,打开一个浏览器窗口并指向 http://\<服务器名称或 IP 地址>/backuppc/ 。当弹出提示框时,输入先前向你创建的默认 HTTP 用户凭据(注:即用户名 backuppc 和相应的默认密码)。假如认证成功,你就会被带入到 Web 界面的主页: + +![](https://farm9.staticflickr.com/8601/15543330314_f6fdaa235e_z.jpg) + +你想做的第一件事最有可能是通过新增一个客户端主机来备份。进入任务窗格中的 “编辑主机”选项。我们将添加两个客户端主机: + +- Host #1: CentOS 7 [IP 192.168.0.17] +- Host #2: Windows 7 [IP 192.168.0.103] + +我们将通过 SSH 使用 `rsync`来备份 CentOS 主机,使用 SMB 来备份 Windows 主机。在执行备份之前,我们需要向我们的 CentOS 主机设置 [基于密钥认证][7] 以及在我们的 Windows 主机中设置一个共享目录。 + +下面是关于如何为一个远程 CentOS 主机设置基于密钥认证的指导。我们创建 ‘backuppc’ 用户的 RSA 密钥对,并将其公钥传输给 CentOS 主机上的 root 账户。 + + # usermod -s /bin/bash backuppc + # su - backuppc + # ssh-keygen -t rsa + # ssh-copy-id root@192.168.0.17 + +当弹出提示框时,键入 yes 并为 192.168.0.17 键入 root 用户的密码: + +![](https://farm8.staticflickr.com/7496/16164929932_8fc817125d_b.jpg) + +你需要一个远程的 CentOS 主机的 root 权限,以获得在该主机中的文件系统中写权限,以防要恢复的备份文件或目录的所有者为 root 账户。 + +一旦 CentOS 和 Windows 主机都准备完毕,使用 Web 界面将它们添加到 BackupPC: + +![](https://farm9.staticflickr.com/8586/15979622709_76c2dcf68c_z.jpg) + +下一步更改每个主机的备份设置: + +![](https://farm8.staticflickr.com/7461/16163781611_765c147f9f_z.jpg) + +接下来的图片展示了 Windows 主机的备份设置: + +![](https://farm8.staticflickr.com/7480/16139884676_bddfafed75_z.jpg) + +而接着的截图展示了 CentOS 主机的备份设置: + +![](https://farm8.staticflickr.com/7557/16139884666_34ff8fd858_z.jpg) + +### 开始一个备份任务 ### + +为了开始备份,到每个主机的设定选项,然后点击“开始全备份”: + +![](https://farm8.staticflickr.com/7536/15978247428_458c023f4c.jpg) + +在任何时候,你都可以通过点击如上图展示的每个主机的备份主页来查看备份任务的状态。假如因为某些原因备份失败,在主机菜单中将会出现一个指向包含错误信息的网页的链接。当一个备份任务成功完成后,在服务器的 /var/lib/backuppc/pc 目录下会创建一个命名为主机名或 IP 地址的目录。 + +![](https://farm8.staticflickr.com/7549/16165680115_196ee42a49_z.jpg) + +我们也可以随意地在命令行中浏览这个目录中的文件,但存在一个更加简单的方式来查找和恢复这些文件。 + +### 恢复备份 ### + +要浏览这些保存的文件,进入每个主机的主菜单下的 “浏览备份”选项,你可以一目了然地看到目录和文件,并选择那些你想恢复的文件。另外,你还可以通过点击文件来使用默认程序打开文件或右击文件并选择“另存为”来下载该文件到你当前的机器上: + +![](https://farm8.staticflickr.com/7506/16165680105_bd5883e0da_c.jpg) + +如若你想,你可以下载一个包含所有你想备份的内容的 zip 或 tar 文件: + +![](https://farm8.staticflickr.com/7507/15978247398_18e81667cd_z.jpg) + +或只是恢复文件: + +![](https://farm8.staticflickr.com/7545/15545911003_2aca8a36fc_z.jpg) + +### 总结 ### + +有句俗话说,"越简单,越好",而这正是 BackupPC 所提供的东西。在 BackupPC 中,你将不仅找到了一个备份工具,而且还找到了一个无需任何客户端应用来在几个不同的操作系统中管理你的备份的方法。我相信这就有足够的理由让你去尝试一下。 + +欢迎使用下面的评论框来留下你的评论和问题,假如你有的话。我总是乐于听取读者想说的话! + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/backuppc-cross-platform-backup-server-linux.html + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/gabriel +[1]:http://linux.cn/article-5096-1.html +[2]:http://linux.cn/article-4586-1.html +[3]:http://backuppc.sourceforge.net/ +[4]:http://linux.cn/article-2324-1.html +[5]:http://linux.cn/article-3889-1.html +[6]:http://xmodulo.com/recommend/linuxguide +[7]:http://xmodulo.com/how-to-enable-ssh-login-without.html diff --git a/translated/share/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md b/published/201503/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md similarity index 59% rename from translated/share/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md rename to published/201503/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md index 098350741f..b9768d7148 100644 --- a/translated/share/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md +++ b/published/201503/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md @@ -1,20 +1,20 @@ -支持同时把单个 ISO 文件写入 20 个 USB 驱动盘的应用程序 +MultiWriter:同时将 ISO 镜像并发写入 20 个 USB 启动盘 ================================================================================ -**我的问题是如何把一个Linux ISO 文件烧录到 17 个 USB 拇指驱动盘?** +**我的问题是如何把一个Linux ISO 文件烧录到 17 个 USB 启动盘?** -精通代码的会写一个 bash 脚本来自动化处理,而大部分的人会使用像 USB 启动盘创建器这样的图形用户界面工具来把 ISO 文件一个一个的烧录到驱动盘中。但剩下的还有一些人会很快得出结论,两种方法都不太理想。 +精通代码的人会写一个 bash 脚本来自动化处理,而大部分的人会使用像 USB 启动盘创建器这样的图形用户界面工具来把 ISO 文件一个、一个的烧录到驱动盘中。但剩下的还有一些人也许会很快得出结论,两种方法都不太理想。 ### 问题 > 解决 ### ![GNOME MultiWriter in action](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/gnome-multi-writer.jpg) -GNOME MultiWriter 在运行当中 +*GNOME MultiWriter 在运行当中* -Richard Hughes,一个 GNOME 开发者,也面临着类似的困境。他要创建一批预装操作系统的 USB 驱动盘,需要一个足够简单的工具,使得像他父亲这样的用户也能使用。 +Richard Hughes,一个 GNOME 开发者,也面临着类似的困境。他要创建一批预装操作系统的 USB 启动盘,需要一个足够简单的工具,使得像他父亲这样的用户也能使用。 他的反应是开发**品牌性的新应用程序**,使上面的两种方法合二为一,创造出易用的一款工具。 -它的名字就叫 “[GNOME MultiWriter][1]”。同时可以把单个的 ISO 或 IMG 文件写入多个 USB 驱动盘。 +它的名字就叫 “[GNOME MultiWriter][1]”,可以同时把单个的 ISO 或 IMG 文件写入多个 USB 驱动盘。 它不支持个性化自定义或命令行执行的功能,使用它就可以省掉浪费一下午的时间来对相同的操作的重复动作。 @@ -24,25 +24,25 @@ Richard Hughes,一个 GNOME 开发者,也面临着类似的困境。他要 ![The app can be installed on Ubuntu](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/mutli-writer-on-ubuntu.jpg) -该应用程序可以在 Ubuntu 上安装 +*该应用程序可以在 Ubuntu 上安装* -这款应用程序的定义使用场景很不错,正适合使用于预装正要发布的操作系统或 live 映像的 USB 棒上。 +这款应用程序的定义使用场景很不错,正适合使用于预装正要发布的操作系统或 live 映像的 USB 启动盘上。 -那就是说,任何人想要创建一个单独可启动的 USB 棒的话,也是一样的适用 - 因我用 Ubuntu 的内置磁盘创建工具来创建可引导的映像从来没有一次成功过的,所以这方案对我来说是个好消息! +那就是说,任何人想要创建一个单独可启动的 USB 启动盘的话,也是一样的适用 - 因我用 Ubuntu 的内置磁盘创建工具来创建可引导的映像从来没有一次成功过的,所以这方案对我来说是个好消息! -它的开发者 Hughes 说它**最高能支持20个 USB驱动盘**,每个盘的大小在 1GB 到 32GB之间。 +它的开发者 Hughes 说它**最高能支持20个 USB 启动盘**,每个盘的大小在 1GB 到 32GB之间。 -GNOME MultiWriter 不好的地方(到现在为止)就是它还没有一个完结、稳定的成品。它是能工作,但在早期的时候,还没有可安装的二进制版本或可添加到你庞大软件源的 PPA。 +GNOME MultiWriter 也有不好的地方(到现在为止)就是它还没有一个完结、稳定的成品。它是能工作,但在早期的时候,还没有可安装的二进制版本或可添加到你庞大软件源的 PPA。 如果您知道通常的 configure/make 的操作流程的话,可以获取其源码并随时都可以编译运行。在 Ubuntu14.10 系统上,你可能还需要首先安装以下软件包: sudo apt-get install gnome-common yelp-tools libcanberra-gtk3-dev libudisks2-dev gobject-introspection -如果您得到并运行起来,已经玩转的话,给我们分享下您的感受! +如果您可以运行起来,已经玩转的话,给我们分享下您的感受! 此项目托管在 GitHub 上,盼望对其提出问题缺陷和发起 pull 请求,在上面也可以找到压缩包下载,进行手动安装。 -- [Github 上的 GNOME MultiWriter][2] +- [Github 上的 GNOME MultiWriter][1] -------------------------------------------------------------------------------- @@ -50,10 +50,9 @@ via: http://www.omgubuntu.co.uk/2015/01/gnome-multiwriter-iso-usb-utility 作者:[Joey-Elijah Sneddon][a] 译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:https://plus.google.com/117485690627814051450/?rel=author [1]:https://github.com/hughsie/gnome-multi-writer/ -[2]:https://github.com/hughsie/gnome-multi-writer/ diff --git a/translated/tech/20150108 How to Install Scrapy a Web Crawling Tool in Ubuntu 14.04 LTS.md b/published/201503/20150108 How to Install Scrapy a Web Crawling Tool in Ubuntu 14.04 LTS.md similarity index 80% rename from translated/tech/20150108 How to Install Scrapy a Web Crawling Tool in Ubuntu 14.04 LTS.md rename to published/201503/20150108 How to Install Scrapy a Web Crawling Tool in Ubuntu 14.04 LTS.md index 672548853b..6ab4241c76 100644 --- a/translated/tech/20150108 How to Install Scrapy a Web Crawling Tool in Ubuntu 14.04 LTS.md +++ b/published/201503/20150108 How to Install Scrapy a Web Crawling Tool in Ubuntu 14.04 LTS.md @@ -1,4 +1,4 @@ -如何在Ubuntu 14.04 LTS安装网络爬虫工具 +如何在Ubuntu 14.04 LTS安装网络爬虫工具:Scrapy ================================================================================ 这是一款提取网站数据的开源工具。Scrapy框架用Python开发而成,它使抓取工作又快又简单,且可扩展。我们已经在virtual box中创建一台虚拟机(VM)并且在上面安装了Ubuntu 14.04 LTS。 @@ -6,13 +6,13 @@ Scrapy依赖于Python、开发库和pip。Python最新的版本已经在Ubuntu上预装了。因此我们在安装Scrapy之前只需安装pip和python开发库就可以了。 -pip是作为python包索引器easy_install的替代品。用于安装和管理Python包。pip包的安装可见图 1。 +pip是作为python包索引器easy_install的替代品,用于安装和管理Python包。pip包的安装可见图 1。 sudo apt-get install python-pip ![Fig:1 Pip installation](http://blog.linoxide.com/wp-content/uploads/2014/11/f1.png) -图:1 pip安装 +*图:1 pip安装* 我们必须要用下面的命令安装python开发库。如果包没有安装那么就会在安装scrapy框架的时候报关于python.h头文件的错误。 @@ -20,42 +20,41 @@ pip是作为python包索引器easy_install的替代品。用于安装和管理Py ![Fig:2 Python Developer Libraries](http://blog.linoxide.com/wp-content/uploads/2014/11/f2.png) -图:2 Python 开发库 +*图:2 Python 开发库* -scrapy框架即可从deb包安装也可以从源码安装。然而在图3中我们已经用pip(Python 包管理器)安装了deb包了。 +scrapy框架既可从deb包安装也可以从源码安装。在图3中我们用pip(Python 包管理器)安装了deb包了。 sudo pip install scrapy ![Fig:3 Scrapy Installation](http://blog.linoxide.com/wp-content/uploads/2014/11/f3.png) -图:3 Scrapy 安装 +*图:3 Scrapy 安装* 图4中scrapy的成功安装需要一些时间。 ![Fig:4 Successful installation of Scrapy Framework](http://blog.linoxide.com/wp-content/uploads/2014/11/f4.png) -图:4 成功安装Scrapy框架 +*图:4 成功安装Scrapy框架* ### 使用scrapy框架提取数据 ### -**(基础教程)** +####基础教程#### -我们将用scrapy从fatwallet.com上提取店名(提供卡的店)。首先,我们使用下面的命令新建一个scrapy项目“store name”, 见图5。 +我们将用scrapy从fatwallet.com上提取商店名称(卖卡的店)。首先,我们使用下面的命令新建一个scrapy项目“store name”, 见图5。 $sudo scrapy startproject store_name ![Fig:5 Creation of new project in Scrapy Framework](http://blog.linoxide.com/wp-content/uploads/2014/11/f5.png) -图:5 Scrapy框架新建项目 +*图:5 Scrapy框架新建项目* -Above command creates a directory with title “store_name” at current path. This main directory of the project contains files/folders which are shown in the following Figure 6. 上面的命令在当前路径创建了一个“store_name”的目录。项目主目录下包含的文件/文件夹见图6。 $sudo ls –lR store_name ![Fig:6 Contents of store_name project.](http://blog.linoxide.com/wp-content/uploads/2014/11/f6.png) -图:6 store_name项目的内容 +*图:6 store_name项目的内容* 每个文件/文件夹的概要如下: @@ -66,13 +65,13 @@ Above command creates a directory with title “store_name” at current path. T - store_name/settings.py 是项目的配置文件 - store_name/spiders/, 包含了用于爬取的蜘蛛 -由于我们要从fatwallet.com上如提取店名,因此我们如下修改文件。 +由于我们要从fatwallet.com上如提取店名,因此我们如下修改文件(LCTT 译注:这里没说明是哪个文件,译者认为应该是 items.py)。 import scrapy class StoreNameItem(scrapy.Item): - name = scrapy.Field() # extract the names of Cards store + name = scrapy.Field() # 取出卡片商店的名称 之后我们要在项目的store_name/spiders/文件夹下写一个新的蜘蛛。蜘蛛是一个python类,它包含了下面几个必须的属性: @@ -80,7 +79,7 @@ Above command creates a directory with title “store_name” at current path. T 2. 爬取起点url (start_urls) 3. 包含了从响应中提取需要内容相应的正则表达式的解析方法。解析方法对爬虫而言很重要。 -我们在store_name/spiders/目录下创建了“store_name.py”爬虫,并添加如下的代码来从fatwallet.com上提取点名。爬虫的输出到文件(**StoreName.txt**)中,见图7。 +我们在store_name/spiders/目录下创建了“store_name.py”爬虫,并添加如下的代码来从fatwallet.com上提取店名。爬虫的输出写到文件(**StoreName.txt**)中,见图7。 from scrapy.selector import Selector from scrapy.spider import BaseSpider @@ -113,7 +112,7 @@ Above command creates a directory with title “store_name” at current path. T ![Fig:7 Output of the Spider code .](http://blog.linoxide.com/wp-content/uploads/2014/11/f7.png) -图:7 爬虫的输出 +*图:7 爬虫的输出* *注意: 本教程的目的仅用于理解scrapy框架* @@ -123,7 +122,7 @@ via: http://linoxide.com/ubuntu-how-to/scrapy-install-ubuntu/ 作者:[nido][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/) 荣誉推出 diff --git a/translated/tech/20150112 How to Find and Remove Duplicate Files on Linux.md b/published/201503/20150112 How to Find and Remove Duplicate Files on Linux.md similarity index 81% rename from translated/tech/20150112 How to Find and Remove Duplicate Files on Linux.md rename to published/201503/20150112 How to Find and Remove Duplicate Files on Linux.md index 7e0b96c45f..d646627e84 100644 --- a/translated/tech/20150112 How to Find and Remove Duplicate Files on Linux.md +++ b/published/201503/20150112 How to Find and Remove Duplicate Files on Linux.md @@ -2,13 +2,13 @@ ================================================================================ 大家好,今天我们会学习如何在Linux PC或者服务器上找出和删除重复文件。这里有一款工具你可以工具自己的需要使用。 -无论你是否正在使用Linux桌面或者服务器,有一些很好的工具能一帮你扫描系统中的重复文件并删除它们来释放空间。图形界面和命令行界面的都有。重复文件是磁盘空间不必要的浪费。毕竟,如果你的确需要在不同的位置享有同一个文件,你可以使用软链接或者硬链接,这样就可以这样就可以在磁盘的一处地方存储数据了。 +无论你是否正在使用Linux桌面或者服务器,有一些很好的工具能够帮你扫描系统中的重复文件并删除它们来释放空间。图形界面和命令行界面的都有。重复文件是磁盘空间不必要的浪费。毕竟,如果你的确需要在不同的位置享有同一个文件,你可以使用软链接或者硬链接,这样就可以在磁盘的一个地方存储数据了。 ### FSlint ### -[FSlint][1] 在不同的Linux发行办二进制仓库中都有,包括Ubuntu、Debian、Fedora和Red Hat。只需你运行你的包管理器并安装“fslint”包就行。这个工具默认提供了一个简单的图形化界面,同样也有包含各种功能的命令行版本。 +[FSlint][1] 在不同的Linux发行版二进制仓库中都有,包括Ubuntu、Debian、Fedora和Red Hat。只需你运行你的包管理器并安装“fslint”包就行。这个工具默认提供了一个简单的图形化界面,同样也有包含各种功能的命令行版本。 -不要让它让你害怕使用FSlint的图形化界面。默认情况下,它会自动选中Duplicate窗格,并以你的家目录作为搜索路径。 +不要担心FSlint的图形化界面太复杂。默认情况下,它会自动选中Duplicate窗格,并以你的家目录作为搜索路径。 要安装fslint,若像我这样运行的是Ubuntu,这里是默认的命令: @@ -27,7 +27,7 @@ Fedora: sudo yum install fslint -For OpenSuse: +OpenSuse: [ -f /etc/mandrake-release ] && pkg=rpm [ -f /etc/SuSE-release ] && pkg=packages @@ -51,11 +51,11 @@ For OpenSuse: ![Delete Duplicate files with Fslint](http://blog.linoxide.com/wp-content/uploads/2015/01/delete-duplicates-fslint.png) -使用按钮来删除任何你要删除的文件,并且可以双击预览。 +点击按钮来删除任何你要删除的文件,并且可以双击预览。 完成这一切后,我们就成功地删除你系统中的重复文件了。 -**注意** 的是命令行工具默认不在环境的路径中,你不能像典型的命令那样运行它。在Ubuntu中,你可以在/usr/share/fslint/fslint下找到它。因此,如果你要在一个单独的目录运行fslint完整扫描,下面是Ubuntu中的运行命令: +**注意** ,命令行工具默认不在环境的路径中,你不能像典型的命令那样运行它。在Ubuntu中,你可以在/usr/share/fslint/fslint下找到它。因此,如果你要在一个单独的目录运行fslint完整扫描,下面是Ubuntu中的运行命令: cd /usr/share/fslint/fslint @@ -84,7 +84,7 @@ via: http://linoxide.com/file-system/find-remove-duplicate-files-linux/ 作者:[Arun Pyasi][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150114 Install Gitblit On Ubuntu or Fedora or CentOS.md b/published/201503/20150114 Install Gitblit On Ubuntu or Fedora or CentOS.md similarity index 90% rename from translated/tech/20150114 Install Gitblit On Ubuntu or Fedora or CentOS.md rename to published/201503/20150114 Install Gitblit On Ubuntu or Fedora or CentOS.md index 84232f87a1..e2dd91ef0b 100644 --- a/translated/tech/20150114 Install Gitblit On Ubuntu or Fedora or CentOS.md +++ b/published/201503/20150114 Install Gitblit On Ubuntu or Fedora or CentOS.md @@ -2,13 +2,13 @@ ================================================================================ **Git**是一款注重速度、数据完整性、分布式支持和非线性工作流的分布式版本控制工具。Git最初由Linus Torvalds在2005年为Linux内核开发而设计,如今已经成为被广泛接受的版本控制系统。 -和其他大多数分布式版本控制系统比起来,不像大多数客户端-服务端的系统,每个Git工作目录是一个完整的仓库,带有完整的历史记录和完整的版本跟踪能力,不需要依赖网络或者中心服务器。像Linux内核一样,Git意识在GPLv2许可证下的免费软件。 +和其他大多数分布式版本控制系统比起来,不像大多数客户端-服务端的系统,每个Git工作目录是一个完整的仓库,带有完整的历史记录和完整的版本跟踪能力,不需要依赖网络或者中心服务器。像Linux内核一样,Git也是在GPLv2许可证下分发的自由软件。 -本篇教程我会演示如何安装gitlit服务器。gitlit的最新稳定版是1.6.2。[Gitblit][1]是一款开源、纯Java开发的用于管理浏览和服务的[Git][2]仓库。它被设计成一款为希望托管中心仓库的小工作组服务的工具。 +本篇教程我会演示如何安装 gitlit 服务器。gitlit的最新稳定版是1.6.2。[Gitblit][1]是一款开源、纯Java开发的用于管理、浏览和提供[Git][2]仓库服务的软件。它被设计成一款为希望托管中心仓库的小型工作组服务的工具。 mkdir -p /opt/gitblit; cd /opt/gitblit; wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz -### 列出目录: ### +### 列出解压后目录内容: ### root@vps124229 [/opt/gitblit]# ls ./ docs/ gitblit-stop.sh* LICENSE service-ubuntu.sh* @@ -21,7 +21,7 @@ ### 启动gitlit服务: ### -### 通过service命令: ### +**通过service命令:** root@vps124229 [/opt/gitblit]# cp service-centos.sh /etc/init.d/gitblit root@vps124229 [/opt/gitblit]# chkconfig --add gitblit @@ -29,7 +29,7 @@ Starting gitblit server . -### 手动启动: ### +**手动启动:** root@vps124229 [/opt/gitblit]# java -jar gitblit.jar --baseFolder data 2015-01-10 09:16:53 [INFO ] ***************************************************************** @@ -108,15 +108,15 @@ 打开浏览器,依据你的配置进入**http://localhost:8080** 或者 **https://localhost:8443**。 输入默认的管理员授权:**admin / admin** 并点击**Login** 按钮 -![snapshot2](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/snapshot2.png) +![snapshot2](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/snapshot2.png) ### 添加用户: ### -![snapshot1](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/snapshot1.png) +![snapshot1](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/snapshot1.png) -添加仓库: +###添加仓库:### -![snapshot3](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/snapshot3.png) +![snapshot3](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/snapshot3.png) ### 用命令行创建新的仓库: ### @@ -140,7 +140,7 @@ via: http://www.unixmen.com/install-gitblit-ubuntu-fedora-centos/ 作者:[M.el Khamlichi][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/) 荣誉推出 diff --git a/published/201503/20150114 What is a good IDE for C or C++ on Linux.md b/published/201503/20150114 What is a good IDE for C or C++ on Linux.md new file mode 100644 index 0000000000..e0e960744a --- /dev/null +++ b/published/201503/20150114 What is a good IDE for C or C++ on Linux.md @@ -0,0 +1,83 @@ +Linux 上的最佳 C/C++ IDE +================================================================================ +"一个真正的程序员是不用IDE(译者注:集成开发环境)的,他们都是用带着某某插件的文本编辑器来写代码。"我们总能在某些地方听到此类观点。然而,尽管越来越多的人同意这样的观点,但是一个IDE仍然非常有用,它设置简单,使用起来也很方便,因此不能比这样更合适编写一个项目了。所以鉴于这点,在这里我想给大家列一份在Linux平台上比较好的C/C++ IDE清单。为什么特地说C/C++呢?因为C语言是我最喜欢的编程语言,而且我们总要找个切入点来开始。另外要注意的是,通常有很多种编写C代码的方法,所以为了消减清单的篇幅,我只选择了"真正好用的IDE",而不是诸如Gedit或Vim这种注入[插件][1]的文本编辑器。并不是说这些编辑器不好,只是如果我将文本编辑器包含进去那这份清单就将永无止境了。 + +### 1. Code::Blocks ### + +![](https://farm8.staticflickr.com/7520/16089880989_10173db27b_c.jpg) + +用我个人的最爱来开篇,[Code::Blocks][2]是一款简单快速的专有C/C++ IDE。就像任何一款强大的IDE一样, 它集成了语法高亮、书签功能、自动补全功能、项目管理和一个调试器。它最闪亮的地方在于它简单的插件系统,里面添加了不可缺少的工具,像Valgrind和CppCheck,还有不太重要的比如像俄罗斯方块这样的小游戏。但是我特别喜欢它的理由是它连贯方便的快捷键设定和大量的却感受不到拥挤的选项设置。 + +### 2. Eclipse ### + +![](https://farm8.staticflickr.com/7522/16276001255_66235a0a69_c.jpg) + +我知道我只说"真正好用的IDE"而不是带着插件的文本编辑器,但是,[Eclipse][3]的确是一款"真正好用的IDE",只是Eclipse需要一些[插件][4](或经过一些改装)来编写C程序,所以严格来说我无法反驳我自己。而且,做一份IDE清单不提到Eclipse这个“巨人”是不可能的事情。无论喜欢它与否,Eclipse仍然是一款强大的Java编程工具。这里要感谢[CDT 项目][5],让Eclipse编写C程序变得可能。你同样可以体验到Eclipse的强大功能,包括它的一些传统功能特点比如自动补全、代码大纲、代码生成器和先进的重构功能。照我话说,它的不足之处在于它不如Code::Blocks那么轻量级,它仍然很臃肿,要花费很多时间去载入。但是如果你的电脑可以驾驭它,或者你是个忠实的Eclipse粉,那么它一定是你的不二选择。 + +### 3. Geany ### + +![](https://farm9.staticflickr.com/8573/16088461968_c6a6c9e49a_c.jpg) + +牺牲了很多特色功能但是增加了很多灵活性,[Geany][6]就是这样一款与Eclipse对立的软件。但是对于它所缺乏的地方(比如说没有调试器), Geany用一些漂亮小巧的特色功能弥补了它们:一个可以做笔记的区域、基于模板创作、代码大纲、自定义快捷键和插件管理。相比于现在的IDE,Geany仍然是一款作用广泛的文本编辑器,然而,因为它的功能亮点和它的界面设计,所以我把它放在这份列表里。 + +### 4. MonoDevelop ### + +![](https://farm8.staticflickr.com/7515/16275175052_61487480ce_c.jpg) + +这又是这份列表里的一个“巨人级”工具,[MonoDevelop][7]那无与伦比的体验来源于它的外表和界面。我个人非常喜爱它的项目管理体系和它的一体化版本控制系统。插件系统同样漂亮地让人震惊。但是由于一些原因,所有的设置和对所有编程语言的支持对于我来说让我感觉有点“资源过剩”了。它仍然是我在过去经常使用的伟大工具,但不是我在单单处理C语言时的第一选择。 + +### 5. Anjuta ### + +![](https://farm8.staticflickr.com/7514/16088462018_7ee6e5b433_c.jpg) + +它身上有着强烈的“GNOME即视感”,[Anjuta][8]的外观很具争议。我倾向于把它看作是带着调试器的Geany升级版,但是它的界面实际上要复杂得多。我确实很享受能在项目、文件夹和代码大纲视图之间来回切换的标签系统,我本想用诸如更多的快捷方法来移动文件,然而,这是一个很好的提供了显著编译功能和构建选项的工具,它能够支持哪些很有特点的需求。 + +### 6. Komodo Edit ### + +![](https://farm8.staticflickr.com/7502/16088462028_81d1114c84_c.jpg) + +我不是非常熟悉[Komodo Edit][9],但是在试用了一段时间之后,我被它很多很多的优点给惊喜到了。首先,基于标签的导航功能有很强的可预见性。其次它奇特的代码大纲让我想到了Sublime Text。此外,它的宏系统和文件比较器使得Komodo Edit非常实用。它的插件库让它几乎是完美的,说“几乎”是因为在其它IDE里我的确找不到能与之相媲美的快捷方法了。而且我们能享受到更多特别的C/C++工具,这往往是普通IDE的不足之处。然而,Komodo Edit就能做到。 + +### 7. NetBeans ### + +![](https://farm8.staticflickr.com/7569/16089881229_98beb0fce3_c.jpg) + +就好像Eclipse一样,这又是一款不得不提的“巨人级”软件。拥有的功能包括通过标签进行导航、项目管理、代码大纲、更改历史追踪和大量工具,[NetBeans][10]可能是最完整的IDE了,我能用半页来列出它所有让人震惊的特色功能。但是这同时也很容易地向你透露了它的主要缺点,它太臃肿了。比起它的强大,我更喜欢基于插件的软件,因为我觉得不太会有人为了一个同样的项目同时需要Git和Mercurial相结合来工作,我是不是很疯狂?但是如果你有耐心去掌握它所有的选项,那你差不多无论到哪里都是IDE大师了。 + +### 8. KDevelop ### + +![](https://farm8.staticflickr.com/7519/15653583824_e412f2ab1f_c.jpg) + +说到这,肯定照顾到所有的KDE粉丝,[KDevelop][11]会是你希望的答案。它拥有许多配置选项,如果你设法去征服KDevelop,那它就是你的。你们说我肤浅,但是我真的从来没有深入过除它界面以外的层次了,对于我来说编辑器本身就携带着大量的导航选项和可定制的快捷键简直是一个再糟糕不过的事了。它的调试器也是相当高级,要去练习掌握。然而,这样的耐心是有回报的,就是能领会到这款灵活的IDE的全部能力,并且由于它令人吃惊的嵌入式文件编制,你会给予它一种特殊的信任。 + +### 9. CodeLite ### + +![](https://farm9.staticflickr.com/8594/16250066446_b5f654e63f_c.jpg) + +留在最后的不代表是最差的,[CodeLite][12]展现给你一种传统的编程规则却仍然能让你从它身上那特有的感觉上有所收获,即使它的界面一开始的确让我想到了Code::Blocks和Anjuta,只是不包括大量的插件库。无论你想要比较文件、插入一条版权块、定义缩略语或者用Git来工作,总有一款插件适合你。如果我不得不挑点毛病,我想说它缺乏一些符合我口味的导航快捷键,但这是真的。 + +最后,我希望这份清单能让你给自己最喜欢的语言探索到更多新的IDE。虽然Code::Blocks仍然是我的最爱,不过它有一些很强大的对手。当然我们也可以远离Linux上的IDE,而用文本编辑器去编写C/C++代码。所以如果你有什么其它的建议想法,在评论中让我们获悉。或者如果你想要我再说说关于一些其它语言的IDE,也可以评论里提出。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/good-ide-for-c-cpp-linux.html + +作者:[Adrien Brochard][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/adrien +[1]:http://xmodulo.com/turn-vim-full-fledged-ide.html +[2]:http://www.codeblocks.org/ +[3]:https://eclipse.org/ +[4]:http://xmodulo.com/how-to-set-up-c-cpp-development-environment-in-eclipse.html +[5]:https://eclipse.org/cdt/ +[6]:http://www.geany.org/ +[7]:http://www.monodevelop.com/ +[8]:http://anjuta.org/ +[9]:http://komodoide.com/komodo-edit/ +[10]:https://netbeans.org/ +[11]:https://www.kdevelop.org/ +[12]:http://codelite.org/ \ No newline at end of file diff --git a/translated/tech/20150115 20 Unix Command Line Tricks--Part I.md b/published/201503/20150115 20 Unix Command Line Tricks--Part I.md similarity index 73% rename from translated/tech/20150115 20 Unix Command Line Tricks--Part I.md rename to published/201503/20150115 20 Unix Command Line Tricks--Part I.md index b178a61db9..deaaef6bfa 100644 --- a/translated/tech/20150115 20 Unix Command Line Tricks--Part I.md +++ b/published/201503/20150115 20 Unix Command Line Tricks--Part I.md @@ -1,6 +1,6 @@ -20个Unix命令技巧 - 第一部分 +20个 Unix/Linux 命令技巧(一) ================================================================================ -让我们用**这些Unix命令技巧**开启新的一年,提高在终端下的生产力。我已经找了很久了,现在就与你们分享。 +让我们用**这些Unix/Linux命令技巧**开启新的一年,提高在终端下的生产力。我已经找了很久了,现在就与你们分享。 ![](http://s0.cyberciti.org/uploads/cms/2015/01/unix-command-line-tricks.001.jpg) @@ -9,16 +9,15 @@ 我在生产服务器上有一个很大的200GB的日志文件需要删除。我的rm和ls命令已经崩溃,我担心这是由于巨大的磁盘IO造成的,要删除这个大文件,输入: > /path/to/file.log - # or use the following syntax + # 或使用如下格式 : > /path/to/file.log - # finally delete it + # 然后删除它 rm /path/to/file.log -### 如何缓存终端输出? ### - -尝试使用script命令行工具来为你的终端输出创建typescript。 +### 如何记录终端输出? ### +试试使用script命令行工具来为你的终端输出创建输出记录。 script my.terminal.sessio @@ -28,7 +27,7 @@ date sudo service foo stop -要退出(结束script绘画),输入*exit* 或者 *logout* 或者按下 *control-D* +要退出(结束script会话),输入 *exit* 或者 *logout* 或者按下 *control-D*。 exit @@ -38,11 +37,10 @@ less my.terminal.session cat my.terminal.session -### 还原删除的 /tmp 文件夹 ### +### 还原被删除的 /tmp 文件夹 ### 我在文章[Linux和Unix shell,我犯了一些错误][1]。我意外地删除了/tmp文件夹。要还原它,我需要这么做: - mkdir /tmp chmod 1777 /tmp chown root:root /tmp @@ -50,11 +48,11 @@ ### 锁定一个文件夹 ### -为了我的数据隐私,我想要锁定我文件服务器下的/downloads文件夹。因此我运行: +为了我的数据隐私,我想要锁定我文件服务器下的/downloads文件夹。因此我运行了: chmod 0000 /downloads -root用户仍旧可以访问,但是ls和cd命令还不可用。要还原它用: +root用户仍旧可以访问,而ls和cd命令则不工作。要还原它用: chmod 0755 /downloads @@ -66,40 +64,40 @@ root用户仍旧可以访问,但是ls和cd命令还不可用。要还原它用 或者,在退出vim之前使用:X 命令来加密你的文件,vim会提示你输入一个密码。 -### 清除屏幕上的输出 ### +### 清除屏幕上的乱码 ### 只要输入: reset -### 成为人类 ### +### 易读格式 ### -传递*-h*或者*-H*(和其他选项)选项给GNU或者BSD工具来获取像ls、df、du等命令以人类可读的格式输出: +传递*-h*或者*-H*(和其他选项)选项给GNU或者BSD工具来获取像ls、df、du等命令以易读的格式输出: ls -lh - # 以人类可读的格式 (比如: 1K 234M 2G) + # 以易读的格式 (比如: 1K 234M 2G) df -h df -k - # 已字节输出如: KB, MB, or GB + # 以字节、KB、MB 或 GB 输出: free -b free -k free -m free -g - # 以人类可读的格式打印 (比如 1K 234M 2G) + # 以易读的格式输出 (比如 1K 234M 2G) du -h - # 以人类可读的格式获取系统perms + # 以易读的格式显示文件系统权限 stat -c %A /boot - # 比较人类可读的数字 + # 比较易读的数字 sort -h -a file - # 在Linux上以人类可读的形式显示cpu信息 + # 在Linux上以易读的形式显示cpu信息 lscpu lscpu -e lscpu -e=cpu,node - # 以人类可读的形式显示每个文件的大小 + # 以易读的形式显示每个文件的大小 tree -h tree -h /boot -### 在Linux系统中显示已知用户的信息 ### +### 在Linux系统中显示已知的用户信息 ### 只要输入: @@ -143,7 +141,7 @@ root用户仍旧可以访问,但是ls和cd命令还不可用。要还原它用 ### 我如何删除意外在当前文件夹下解压的文件? ### -我意外在/var/www/html/而不是/home/projects/www/current下解压了一个tarball。它混乱了/var/www/html下的文件。最简单修复这个问题的方法是: +我意外在/var/www/html/而不是/home/projects/www/current下解压了一个tarball。它搞乱了/var/www/html下的文件,你甚至不知道哪些是误解压出来的。最简单修复这个问题的方法是: cd /var/www/html/ /bin/rm -f "$(tar ztf /path/to/file.tar.gz)" @@ -166,7 +164,7 @@ root用户仍旧可以访问,但是ls和cd命令还不可用。要还原它用 ## 以root用户运行最后运行的命令 sudo !! -!!会运行最近使用的命令。要运行最近运行的“foo”命令: +!!会运行最近使用的命令。要运行最近运行的以“foo”开头命令: !foo # 以root用户运行上一次以“service”开头的命令 @@ -180,12 +178,11 @@ root用户仍旧可以访问,但是ls和cd命令还不可用。要还原它用 # 测试 nginx.conf /sbin/nginx -t -c /etc/nginx/nginx.conf - # 测试完 "/sbin/nginx -t -c /etc/nginx/nginx.conf"你可以用vi编辑了 + # 测试完 "/sbin/nginx -t -c /etc/nginx/nginx.conf"你可以用vi再次编辑这个文件了 sudo vi !$ -### 在你要离开的时候留下一个提醒 ### +### 在终端上提醒你必须得走了 ### -If you need a reminder to leave your terminal, type the following command: 如果你需要提醒离开你的终端,输入下面的命令: leave +hhmm @@ -200,26 +197,26 @@ If you need a reminder to leave your terminal, type the following command: cd - -需要快速地回到家目录?输入: +需要快速地回到你的家目录?输入: cd -变量*CDPATH*定义了含有这个目录的搜索目录路径: +变量*CDPATH*定义了目录的搜索路径: export CDPATH=/var/www:/nas10 -现在,不用输入cd */var/www/html/ ,我可以直接输入下面的命令进入/var/www/html: +现在,不用输入cd */var/www/html/ 这样长了,我可以直接输入下面的命令进入 /var/www/html: cd html -### 编辑一个用less浏览的文件 ### +### 在less浏览时编辑文件 ### -要编辑一个用less浏览的文件,按下v。你就可以用变量$EDITOR下的编辑器来编辑了: +要编辑一个正在用less浏览的文件,可以按下v。你就可以用变量$EDITOR所指定的编辑器来编辑了: less *.c less foo.html - ## 下载v编辑文件 ## - ## 退出编辑器,你可以继续用less浏览了 ## + ## 按下v键来编辑文件 ## + ## 退出编辑器后,你可以继续用less浏览了 ## ### 列出你系统中的所有文件和目录 ### @@ -237,14 +234,14 @@ If you need a reminder to leave your terminal, type the following command: # 列出 $HOME 中所有的文件 find $HOME -type f -ls | less -### 用一条命令构造命令树 ### +### 用一条命令构造目录树 ### -你可以用mkdir加上-p选项一次创建目录树: +你可以用mkdir加上-p选项一次创建一颗目录树: mkdir -p /jail/{dev,bin,sbin,etc,usr,lib,lib64} ls -l /jail/ -### 复制文件到多个目录中 ### +### 将文件复制到多个目录中 ### 不必运行: @@ -260,16 +257,16 @@ If you need a reminder to leave your terminal, type the following command: ### 快速找出两个目录的不同 ### -diff命令会按行比较文件。它也可以比较两个目录: +diff命令会按行比较文件。但是它也可以比较两个目录: ls -l /tmp/r ls -l /tmp/s - # Compare two folders using diff ## + # 使用 diff 比较两个文件夹 diff /tmp/r/ /tmp/s/ [![Fig. : Finding differences between folders](http://s0.cyberciti.org/uploads/cms/2015/01/differences-between-folders.jpg)][3] -图片: 找出目录之间的不同 +*图片: 找出目录之间的不同* ### 文本格式化 ### @@ -281,13 +278,13 @@ diff命令会按行比较文件。它也可以比较两个目录: fmt -s file.txt -### 看见输出并写入到一个文件中 ### +### 可以看见输出并将其写入到一个文件中 ### 如下使用tee命令在屏幕上看见输出并同样写入到日志文件my.log中: mycoolapp arg1 arg2 input.file | tee my.log -tee可以保证你同时在屏幕上看到mycoolapp的输出和写入文件。 +tee可以保证你同时在屏幕上看到mycoolapp的输出并写入文件  my.log。 -------------------------------------------------------------------------------- @@ -295,7 +292,7 @@ via: http://www.cyberciti.biz/open-source/command-line-hacks/20-unix-command-lin 作者:[nixCraft][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/) 荣誉推出 diff --git a/published/201503/20150115 Get back your privacy and control.md b/published/201503/20150115 Get back your privacy and control.md new file mode 100644 index 0000000000..5c78a23751 --- /dev/null +++ b/published/201503/20150115 Get back your privacy and control.md @@ -0,0 +1,1112 @@ +权威指南:构建个人私有云,拿回你的数据隐私的控制权! +================================================================================ +8年里40000多次搜索!这是我的Google搜索历史。你的呢?(可以在[这里][1]自己找一下)有经过这么长时间积累下来的这么多数据点,Google已经能非常精确的推测你对什么感兴趣、曾经的想法、担忧过的事情,以及从你第一次获得Google帐号后这些年里所有这些的变化! + +## 很多非常私人的信息不受自己控制地存储在世界范围内的服务器上 ## + +比如说你也像我一样从2006年到2013年都是Gmail用户,意味着你收到了30000封以上的电子邮件,以及在这7年里写了差不多5000封电子邮件。这些发送或收到的电子邮件里有很多是非常私人的,私人到你甚至不希望自己的家人或好友可以系统地查看。也许你还写过一些草稿邮件,因为最后一分钟改变主意而从没发出去。但是尽管你从未发出去,这些邮件仍然保存在服务器上的某个地方。结论是,说Google服务器比你最亲密的朋友或家人都更了解你的个人生活一点也不过分。 + +从统计数据来看,我可以很保险地打赌你拥有一部智能手机。如果不使用联系人应用的话手机将基本没法用,而它默认会将你的联系人信息保存到Google服务器上的Google联系人里。所以,现在Google不仅知道了你的电子邮件,还有了你的离线联系人:你喜欢打给谁、谁来过电话、你发过短信给谁,以及发了些什么。你也不需要听我的片面之词,可以自己检查一下,看看你开放给类似Google Play服务的一些应用的权限,用来读取来电信息以及收到的短信。你是否还会用到手机里自带的日历应用?除非你在设置日程的时候明确地去掉同步,那么Google将精确地知道你将要做什么,一天里的每个时段、每一天、每一年。用iPhone代替Android手机也是一样的,只是Apple会代替Google来掌握你的往来邮件、联系人和日程计划。 + +你是否还会非常小心地同步自己的联系人信息,在你朋友,同事或家人换工作或换服务商的时候更新他们的电子邮件地址和手机号?这给Google提供了一副你的社交网络的非常精确的、最新的描绘。还有你非常喜欢手机的GPS功能,经常配合Google地图使用。这意味着Google不仅能从日程里知道你在干什么,还知道你在哪儿、住在哪儿、在哪儿工作。然后再关联用户之间的GPS位置信息,Google还能知道你现在可能正在和哪些人来往。 + +## 这种泄漏自己私人信息的日常爱好会以一种甚至没人能够预测的方式影响你的生活 ## + +总结一下,如果你是一个普通的因特网用户,Google拥有过去差不多10年里你最新的、深度的信息,关于你的兴趣、忧虑、热情、疑问。它还收集了一些你很私人的信息(电子邮件、短信),精确到小时的你的日常活动和位置,一副你社交网络的高精度的描绘。关于你的如此私密的数据,很可能已经超越了你最亲密的朋友,家人或爱人对你的了解。 + +不敢想象把这些深度的个人信息交给完全陌生的人,就好像把这些信息拷到一个U盘里,然后随便放到某个咖啡厅的桌上,留张纸条说“Olivier Martin的个人数据,请随便”。谁知道什么人会拿到它以及用来干嘛?然而,我们毫不犹豫地把自己的主要信息交给那些对我们的数据很感兴趣的IT公司的陌生人(这是他们制造面包的材料)以及[世界级的数据分析专家][2]手里,也许只是因为我们在点击那个绿色的'接受'按钮时根本没有想这么多。 + +有这么多的高质量信息,这么多年里,Google可能会比你希望自我了解的更了解你自己:尼玛,回想我过去的数字生活,5年前发出的邮件里有一半我已经不记得了。我很高兴能重新发现早在2005年对xxx主义的兴趣以及第二年加入了[ATTAC][3](一个致力于通过征收金融交易税来限制投机和改善社会公平的组织)。天知道为什么我竟然在2007年这么喜欢跳舞。这些都是无关紧要的信息(你不指望我能爆出什么猛料,是吧?;-)。但是,连接起这些高质量数据点,关于你生活的方方面面(做什么、什么时候、和谁一起、在哪里,...),并跨越这么长时间间隔,应该能推测出你的未来状态。比如说,根据一个17岁女孩的购物习惯,超市甚至可以在他父亲听说之前断定这个女孩怀孕了(这是一个[真实的故事][4])。谁知道通过像Google所掌握的这些远远超出购物习惯的高质量数据能做些什么?连接起这些点,也许有人能预测你未来几年里口味或观点的变化。如今,[你从未听过的公司声称拥有你500项数据点][5],包括宗教信仰、性取向和政治观点。提到政治,如果说你决定今后10年内进入政坛会怎么样?你的生活会改变,你的观点也一样,甚至你有时候会有所遗忘,但是Google不会。那你会不会担心你的对手会接触一些可以从Google访问你数据的人并会从你过去这些年里积累的个人数据深渊里挖出一些猛料呢?[就像最近Sony被黑][6]一样,多久以后会轮到Google或Facebook,以致让你的个人信息最终永远暴露? + +我们大多数人把自己的个人数据托付给这些公司的一个原因就是它们提供免费服务。但是真的免费吗?一般的Google帐号的价值根据评估方式不同会有些差别:你花在写邮件上的时间占到[1000美元/年][7],你的帐号对于广告产业的价值差不多在[220美元/年][8]到[500美元/年][9]之间。所以这些服务并不是真的免费:会通过广告和我们的数据在未来的一些未知使用来间接付费。 + +我写的最多的是Google,这是因为这是我托付个人数字信息的,以及目前我所知道做的最好的公司。但是我也提到过Apple或Facebook。这些公司通过它们在设计、工程和我们(曾经)喜欢每天使用的服务方面的神奇进步实实在在地改变了世界。但是这并不是说我们应该把所有我们最私人的个人数据堆积到它们的服务器上并把我们的数字生活托付给它们:潜在的危害实在太大了。 + +## 只要5小时,拿回自己以及关心的人的隐私权 ## + +但是事实并不是一定必须这样的。你可以生活在21世纪,拿着智能手机,每天都用电子邮件和GPS,却仍然可以保留自己的隐私。你所需要的就是拿回自己个人数据的控制权:邮件、日程、联系人、文件,等等。[Prism-Break.org][10]网站上列出了一些能帮你掌握个人数据命运的软件。除此以外,控制自己个人数据的最安全和最有效的方式是架设自己的服务器并搭建自己的云。不过你也许只是没有时间或精力去研究具体该怎么做以及如何让它能流畅工作。 + +这也是这篇文章的意义所在。仅仅5个小时内,我们将配置出一台服务器来支撑你的邮件、联系人、日程表和各种文件,为你、你的朋友和你的家人。这个服务器将设计成一个个人数据中心或云,所以你能时刻保留它的完整控制。数据将自动在你的台式机/笔记本、手机和平板之间同步。从根本上来说,**我们将建立一个系统来代替Gmail、Google文件/Dropbox、Google联系人、Google日历和Picasa**。 + +为自己做这件事情已经是迈出很大一步了。但是,你个人信息的很大一部分将仍然泄漏出去并保存到硅谷的一些主机上,只是因为和你日常来往的太多人在用Gmail和使用智能手机,所以最好是带上你一些比较亲近的人加入这次探险。 + +我们将构建的系统能够: + +- **支持任意数目的域名和用户**。这样就能轻易地和你的家人朋友共享这台服务器,所以他们也能掌控自己的个人数据,并且还能和你一起分摊服务费用。和你一起共享服务器的人可以使用他们自己的域名或者共享你的。 +- **允许你从任意网络发送和接收电子邮件**,需要成功登录服务器之后。这样,你可以通过任意的邮件地址、任意设备(台式机、手机、平板)、任意网络(家里、公司、公共网络、...)来发送电子邮件。 +- **在发送和接收邮件的时候加密网络数据**,这样,你不信任的人不能钓出你的密码,也不能看到你的私人邮件。 +- **提供最先进的反垃圾邮件技术**,结合了已知垃圾邮件黑名单、自动灰名单、和自适应垃圾邮件过滤。如果邮件被误判了只需要简单地把它拖入或拖出垃圾目录就可以重新调校垃圾邮件过滤器。而且,服务器还会为基于社区的反垃圾邮件努力做出贡献。 +- **一段时间里只需要几分钟的维护**,基本上只是安装安全更新和简单地检查一下服务器日志。添加一个新的邮件地址只需要在数据库中插入一条记录。除此之外,你可以忘记它的存在过自己的生活。我在14个月之前搭建了本文描述的这个系统,从那以后就一直顺利运行。所以我完全把它给忘了,直到我最近觉得随便按下手机上的‘检查邮件’会导致电子信号一路跑到冰岛(我放置服务器的地方)再回来的想法有点好笑才想起来。 + +要完成这篇文章里的工作,你需要一点基本的技术能力。如果你知道SMTP和IMAP的区别,什么是DNS,以及对TCP/IP有基本了解的话,就够了。你还将需要一点基本的Unix知识(在命令行下和文件一起工作,基本的系统管理)。然后你需要花总共5小时时间来搭建。 + +下面是我们将要做的事情的概述。 + +- [申请一个虚拟私人服务器,一个域名,并把它们配置好][11] +- [设置postfix和dovecot来收发电子邮件][12] +- [阻止垃圾邮件进入你的收件箱][13] +- [确保你发出的邮件能通过垃圾邮件过滤器][14] +- [使用Owncloud提供日历,联系人,文件服务并配置webmail][15] +- [在云上同步你的设备][16] + +## 这篇文章是受之前工作的启发并以之为基础 ## + +本文很大程度参考了两篇文章,由[Xavier Claude][17]和[Drew Crawford][18]写的关于架设私有邮件服务器的介绍。 + +本文覆盖了Xavier和Drew的文章里所描述的所有功能,除了3个地方Drew有而我没有:邮件推送支持(我喜欢由我主动检查邮件,而其他时候都不会被打扰),邮件全文检索(我一直都没用过),以及使用加密方式存储邮件(我的邮件和数据还没那么重要到要把它们加密后再存到本地服务器上)。如果你需要这些功能,只需要按照Drew的文章里相应部分的说明做就好了,和本文的内容兼容。 + +和Xavier和Drew的成果比起来,本文有下面几个主要改进: + +- 根据我自己按Drew文章操作的经验以及原文的大量回复,修改了一些问题和文字错误。我也把本文所介绍的内容仔细检查了几遍,从头开始设定了几次服务器做重复验证以确保能正常工作。 +- 低维护:和Xavier的方式比起来,本文增加了在服务器上支持多个邮件域名。这样做是为了尽可能地减少服务器维护工作:基本上,要添加一个域名或用户,只需要往mysql数据库表里增加一行就好了(不需要增加过滤脚本,等等)。 +- 我增加了webmail。 +- 我增加了设定云服务器的部分,不仅能收发邮件还能管理文件,地址本/联系人(邮件地址,电话号码,生日,等等等),日程表和图片,供所有设备访问使用。 + +## 申请一个虚拟私人服务器,一个域名,并把它们配置好 ## + +让我们从设置基础设施开始:我们的虚拟私人主机和我们的域名。 + +我用过[1984.is][19]和[Linode][20]提供的虚拟私人主机(VPS),体验非常好。在本文中,我们将使用**Debian Wheezy**,这个在1984和Linode都提供了已经做好的映像文件可以直接布置到你的VPS上。我喜欢1984是因为它的服务器在冰岛,也是唯一使用可再生能源(地热和水力发电)的地方,目前还没有影响过气候变化,不像[大多数美国数据中心目前大多数依赖于烧煤的火力发电站][21]。而且,他们注重[民权,透明,自由][22]以及[免费软件][23]。 + +最好是在服务器上创建一个文件用来保存后面要用到的各种密码(用户账号、邮件账号、云帐号、数据库帐号)。当然最好是加密一下(可以用[GnuPG][24]),这样就算用来设定服务器的电脑被偷了或被入侵了,你的服务器就不会那么容易被攻击。 + +关于注册域名,我已经使用[grandi][25]的服务超过10年了,也很满意。在本文中,我们将开辟一个叫**jhausse.net**的域名。然后在上面增加一个叫**cloud.jhausse.net**的二级域名,并绑定MX纪录。在完成之后,设置比较短的纪录生存时间(TTL)比如300秒,这样你在设置服务器的时候,可以修改你的域并很快测试到结果。 + +最后,设置PTR纪录(反向DNS),这样IP地址可以反向映射回它的域名。如果你不理解前面这句话,看下[这篇文章][26]来获得相关背景知识。如果你使用Linode的服务,你可以在远程访问这一栏的控制面板里设置PTR纪录。如果是1984,联系一下技术支持来帮你搞定。 + +在服务器上,我们从添加一个普通用户开始,这样我们不用从头到尾一直用root账号。另外,用root登陆也需要额外多一层安全措施。 + + adduser roudy + +然后,在文件**/etc/ssh/sshd\_config**中设置 + + PermitRootLogin no + +然后重启ssh服务 + + service ssh reload + +然后,我们要修改服务器的主机名。编辑文件**/etc/hostname**,只有一行就是自己的主机名,我们这个例子中是 + + cloud + +然后,编辑ssh服务的公钥文件**/etc/ssh/ssh\_host\_rsa\_key.pub, /etc/ssh/ssh\_host\_dsa\_key.pub, /etc/ssh/ssh\_host\_ecdsa\_key.pub**,这样文件末尾可以反映你的主机名,比如**root@cloud**。然后重启系统保证主机名在系统的每个需要它的角落都生效了。 + + reboot + +我们将更新系统并移除不必要的服务以降低远程攻击的风险。 + + apt-get update + apt-get dist-upgrade + service exim4 stop + apt-get remove exim4 rpcbind + apt-get autoremove + apt-get install vim + +我喜欢使用vim远程编辑配置文件。打开vim 的自动语法高亮会很有帮助。添加下面这一行到**~/.vimrc**文件中。 + + syn on + +## 设置postfix和dovecot来收发电子邮件 ## + + apt-get install postfix postfix-mysql dovecot-core dovecot-imapd dovecot-mysql mysql-server dovecot-lmtpd postgrey + +在[Postfix][27]的配置菜单里,选择`Internet Site`,设置这个系统的邮件名称为**jhausse.net**。 + +现在开始添加一个数据库用于保存主机上管理的域名列表,和每个域名下的用户列表(同时也包括他们各自的密码),以及邮件别名列表(用于从一个地址往另一个地址转发邮件)。 + + mysqladmin -p create mailserver + mysql -p mailserver + mysql> GRANT SELECT ON mailserver.* TO 'mailuser'@'localhost' IDENTIFIED BY 'mailuserpass'; + mysql> FLUSH PRIVILEGES; + mysql> CREATE TABLE `virtual_domains` ( + `id` int(11) NOT NULL auto_increment, + `name` varchar(50) NOT NULL, + PRIMARY KEY (`id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + mysql> CREATE TABLE `virtual_users` ( + `id` int(11) NOT NULL auto_increment, + `domain_id` int(11) NOT NULL, + `password` varchar(106) NOT NULL, + `email` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `email` (`email`), + FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + mysql> CREATE TABLE `virtual_aliases` ( + `id` int(11) NOT NULL auto_increment, + `domain_id` int(11) NOT NULL, + `source` varchar(100) NOT NULL, + `destination` varchar(100) NOT NULL, + PRIMARY KEY (`id`), + FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +这里我们为**jhausse.net**域名提供邮件服务。如果还需要加入其他域名,也没问题。我们也会为每个域名设置一个邮件管理地址(postmaster),转寄给**roudy@jhausse.net**。 + + mysql> INSERT INTO virtual_domains (`name`) VALUES ('jhausse.net'); + mysql> INSERT INTO virtual_domains (`name`) VALUES ('otherdomain.net'); + mysql> INSERT INTO virtual_aliases (`domain_id`, `source`, `destination`) VALUES ('1', 'postmaster', 'roudy@jhausse.net'); + mysql> INSERT INTO virtual_aliases (`domain_id`, `source`, `destination`) VALUES ('2', 'postmaster', 'roudy@jhausse.net'); + +现在已经添加了一个本地邮件账号**roudy@jhausse.net**。首先,为它生成一个密码的哈希串: + + doveadm pw -s SHA512-CRYPT + +然后把哈希值加入到数据库中 + + mysql> INSERT INTO `mailserver`.`virtual_users` (`domain_id`, `password`, `email`) VALUES ('1', '$6$YOURPASSWORDHASH', 'roudy@jhausse.net'); + +现在我们的域名、别名和用户列表都设置好了,然后开始设置postfix(这是一个SMTP服务器,用来发送邮件)。把文件**/etc/postfix/main.cf**替换为下面的内容: + + myhostname = cloud.jhausse.net + myorigin = /etc/mailname + mydestination = localhost.localdomain, localhost + mynetworks_style = host + + # We disable relaying in the general case + smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination + # Requirements on servers that contact us: we verify the client is not a + # known spammer (reject_rbl_client) and use a graylist mechanism + # (postgrey) to help reducing spam (check_policy_service) + smtpd_client_restrictions = permit_mynetworks, reject_rbl_client zen.spamhaus.org, check_policy_service inet:127.0.0.1:10023 + disable_vrfy_command = yes + inet_interfaces = all + smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) + biff = no + append_dot_mydomain = no + readme_directory = no + + # TLS parameters + smtpd_tls_cert_file=/etc/ssl/certs/cloud.crt + smtpd_tls_key_file=/etc/ssl/private/cloud.key + smtpd_use_tls=yes + smtpd_tls_auth_only = yes + smtp_tls_security_level=may + smtp_tls_loglevel = 1 + smtpd_tls_loglevel = 1 + smtpd_tls_received_header = yes + smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache + smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache + + # Delivery + alias_maps = hash:/etc/aliases + alias_database = hash:/etc/aliases + message_size_limit = 50000000 + recipient_delimiter = + + + # The next lines are useful to set up a backup MX for myfriendsdomain.org + # relay_domains = myfriendsdomain.org + # relay_recipient_maps = + + # Virtual domains + virtual_transport = lmtp:unix:private/dovecot-lmtp + virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf + virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf + virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf + local_recipient_maps = $virtual_mailbox_maps + +现在我们要让postfix知道如何从我们设定的数据库里找出需要接收邮件的域名。建立一个新文件**/etc/postfix/mysql-virtual-mailbox-domains.cf**并添加以下内容: + + user = mailuser + password = mailuserpass + hosts = 127.0.0.1 + dbname = mailserver + query = SELECT 1 FROM virtual_domains WHERE name='%s' + +我们可以让postfix判断给定的电子邮件账号是否存在,创建文件**/etc/postfix/mysql-virtual-mailbox-maps.cf**并写入以下内容: + + user = mailuser + password = mailuserpass + hosts = 127.0.0.1 + dbname = mailserver + query = SELECT 1 FROM virtual_users WHERE email='%s' + +最后,postfix会根据文件**/etc/postfix/mysql-virtual-alias-maps.cf**的内容来查找邮件别名 + + user = mailuser + password = mailuserpass + hosts = 127.0.0.1 + dbname = mailserver + query = SELECT virtual_aliases.destination as destination FROM virtual_aliases, virtual_domains WHERE virtual_aliases.source='%u' AND virtual_aliases.domain_id = virtual_domains.id AND virtual_domains.name='%d' + +在配置好这些后,现在要测试一下postfix是否能正常查询数据库。我们可以用**postmap**命令测试: + + postmap -q jhausse.net mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf + postmap -q roudy@jhausse.net mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf + postmap -q postmaster@jhausse.net mysql:/etc/postfix/mysql-virtual-alias-maps.cf + postmap -q bob@jhausse.net mysql:/etc/postfix/mysql-virtual-alias-maps.cf + +如果一切都正常配置了的话,头两个查询应该输出1,第3个查询应该输出**roudy@jhausse.net**,而最后一个应该什么都不输出。 + +现在,让我们设置一下dovecot(一个IMAP服务程序,用来在我们的设备上从服务器获取收到的邮件)。编辑文件**/etc/dovecot/dovecot.conf**设置以下参数: + + # Enable installed protocol + # !include_try /usr/share/dovecot/protocols.d/*.protocol + protocols = imap lmtp + +这样将只打开imap(让我们可以获取邮件)和lmtp(postfix用来将收件箱里的邮件转给dovecot)。编辑**/etc/dovecot/conf.d/10-mail.conf**并设置以下参数: + + mail_location = maildir:/var/mail/%d/%n + [...] + mail_privileged_group = mail + [...] + first_valid_uid = 0 + +这样邮件将被保存到目录 /var/mail/domainname/username 下。注意下这几个选项散布在配置文件的不同位置,有时已经在那里写好了:我们只需要取消注释即可。文件里的其他设定选项,可以维持原样。在本文后面还有很多文件需要用同样的方式更新设置。在文件**/etc/dovecot/conf.d/10-auth.conf**里,设置以下参数: + + disable_plaintext_auth = yes + auth_mechanisms = plain + #!include auth-system.conf.ext + !include auth-sql.conf.ext + +在文件**/etc/dovecot/conf.d/auth-sql.conf.ext**里,设置以下参数: + + passdb { + driver = sql + args = /etc/dovecot/dovecot-sql.conf.ext + } + userdb { + driver = static + args = uid=mail gid=mail home=/var/mail/%d/%n + } + +这是告诉dovecot用户的邮件保存在目录/var/mail/domainname/username下,以及如何从我们刚建立的数据库里查找密码。现在我们还需要告诉dovecot具体如何使用数据库。这样需要把下面的内容加入**/etc/dovecot/dovecot-sql.conf.ext**文件: + + driver = mysql + connect = host=localhost dbname=mailserver user=mailuser password=mailuserpass + default_pass_scheme = SHA512-CRYPT + password_query = SELECT email as user, password FROM virtual_users WHERE email='%u'; + +我们现在修改一下配置文件的权限 + + chown -R mail:dovecot /etc/dovecot + chmod -R o-rwx /etc/dovecot + +基本差不多了!只是还需要再多编辑几个文件。在文件**/etc/dovecot/conf.d/10-master.conf**里,设置以下参数: + + service imap-login { + inet_listener imap { + #port = 143 + port = 0 + } + inet_listener imaps { + port = 993 + ssl = yes + } + } + + service pop3-login { + inet_listener pop3 { + #port = 110 + port = 0 + } + inet_listener pop3s { + #port = 995 + #ssl = yes + port = 0 + } + } + + service lmtp { + unix_listener /var/spool/postfix/private/dovecot-lmtp { + mode = 0666 + group = postfix + user = postfix + } + user = mail + } + + service auth { + unix_listener auth-userdb { + mode = 0600 + user = mail + #group = + } + + # Postfix smtp-auth + unix_listener /var/spool/postfix/private/auth { + mode = 0666 + user = postfix + group = postfix + } + + # Auth process is run as this user. + #user = $default_internal_user + user = dovecot + } + + service auth-worker { + user = mail + } + +注意下我们把除了imaps之外所有服务的端口都设置成了0,这样可以有效地禁止这些服务。然后,在文件**/etc/dovecot/conf.d/15-lda.conf**里,指定一个邮箱管理地址: + + postmaster_address = postmaster@jhausse.net + +最后但很重要的一点,我们为服务器需要生成一对公钥和私钥,可以同时用于dovecot和postfix: + + openssl req -new -newkey rsa:4096 -x509 -days 365 -nodes -out "/etc/ssl/certs/cloud.crt" -keyout "/etc/ssl/private/cloud.key" + +请确保你指定了服务器的完全限定域名(FQDN),在本文的例子里: + + Common Name (e.g. server FQDN or YOUR name) []:cloud.jhausse.net + +如果没有的话,我们的客户端会抱怨在SSL证书里的服务器名字和所连接的服务器名字不一致。我们将通过修改配置文件**/etc/dovecot/conf.d/10-ssl.conf**里的如下选项来告诉dovecot使用刚生成的密钥: + + ssl = required + ssl_cert = : Relay access denied + +这个没问题:如果服务器能接受这封邮件而不是返回如上的拒绝消息,那意味着我们架设的postfix是一个对全世界所有垃圾邮件都开放的中继,这将完全没法使用。除了'Relay access denied'消息,你也可能会收到这样的响应: + + 554 5.7.1 Service unavailable; Client host [87.68.61.119] blocked using zen.spamhaus.org; http://www.spamhaus.org/query/bl?ip=87.68.61.119 + +意思是你正尝试从一个被标记成垃圾邮件发送者的IP地址连接服务器。我在通过普通的因特网服务提供商(ISP)连接服务器时曾收到过这样的消息。要解决这个问题,可以试着从另一个主机发起连接,比如另外一个你可以SSH登录的主机。另外一种方式是,你可以修改postfix的**main.cf**配置文件,不要使用Spamhous的RBL,重启postfix服务,然后再检查上面的测试是否正常。不管用哪种方式,最重要的是你要确定一个能工作的,因为我们后面马上要测试其他功能。如果你选择了重新配置postfix不使用RBL,别忘了在完成本文后重新开启RBL并重启postfix,以避免收到一些不必要的垃圾邮件。(LCTT 译者注:在国内可以使用 CASA 的 RBL:cblplus.anti-spam.org.cn,参见:http://www.anti-spam.org.cn/ 。) + +现在,我们试一下往SMTP端口25发送一封有效的邮件,这是一般正常的邮件服务器用来彼此对话的方式: + + openssl s_client -connect cloud.jhausse.net:25 -starttls smtp + EHLO cloud.jhausse.net + MAIL FROM:youremail@domain.com + RCPT TO:roudy@jhausse.net + +服务器应该有这样的响应 + + Client host rejected: Greylisted, see http://postgrey.schweikert.ch/help/jhausse.net.html + +这意味着[postgrey][28]工作正常。postgrey做的是用临时错误拒绝未知发送者的邮件。邮件的技术规则是要求邮件服务器尝试重新发送邮件。在5分钟后,postgrey就会接收这封邮件。一般世界范围内遵守规则的邮件服务器都会尝试为我们重复投递邮件,但大多数垃圾邮件发送者不会这样做。所以,等上5分钟,再次通过上面的命令发送一次,然后检查postfix应该正常接收了邮件。 + +之后,我们检查一下我们可以通过IMAP和dovecot对话获取刚才发送的两封邮件。 + + openssl s_client -crlf -connect cloud.jhausse.net:993 + 1 login roudy@jhausse.net "mypassword" + 2 LIST "" "*" + 3 SELECT INBOX + 4 UID fetch 1:1 (UID RFC822.SIZE FLAGS BODY.PEEK[]) + 5 LOGOUT + +这里,你应该把*mypassword*替换为你自己为这个邮件账号设定的密码。如果能正常工作,基本上我们已经拥有一个能接收邮件的邮件服务器了,通过它我们可以在各种设备(PC/笔记本、平板、手机...)上收取邮件了。但是我们不能把邮件给它发送出去,除非我们自己从服务器发送。现在我们将让postfix为我们转发邮件,但是这个只有成功登录才可以,这是为了保证邮件是由服务器上的某个有效帐号发出来的。要做到这个,我们要打开一个特殊的,全程SSL连接的,SASL鉴权的邮件提交服务。在文件**/etc/postfix/master.cf**里设置下面的参数: + + submission inet n - - - - smtpd + -o syslog_name=postfix/submission + -o smtpd_tls_security_level=encrypt + -o smtpd_sasl_auth_enable=yes + -o smtpd_client_restrictions=permit_sasl_authenticated,reject + -o smtpd_sasl_type=dovecot + -o smtpd_sasl_path=private/auth + -o smtpd_sasl_security_options=noanonymous + -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_non_fqdn_recipient,reject_unauth_destination + +然后重启postfix服务: + + service postfix reload + +现在,让我们试试从一台不同的机器连接这个服务,确定一下postfix现在能够正常中继我们自己的而不是其他任何人的邮件: + + openssl s_client -connect cloud.jhausse.net:587 -starttls smtp + EHLO cloud.jhausse.net + +注意一下服务器建议的'250-AUTH PLAIN'功能,在从端口25连接的时候不会出现。 + + MAIL FROM:asdf@jkl.net + rcpt to:bob@gmail.com + 554 5.7.1 : Relay access denied + QUIT + +这个没问题,postfix在不认识我们的时候是不会中继邮件的。所以,首先让我们先鉴定一下自己的身份。要这样做,我们首先需要生成一个鉴权字符串: + + echo -ne '\000roudy@jhausse.net\000mypassword'|base64 + +然后让我们尝试再次通过服务器发送邮件: + + openssl s_client -connect cloud.jhausse.net:587 -starttls smtp + EHLO cloud.jhausse.net + AUTH PLAIN DGplYW5AMTk4NGNsb3VQLm5ldAA4bmFmNGNvNG5jOA== + MAIL FROM:asdf@jkl.net + rcpt to:bob@gmail.com + +现在postfix应该能正常接收。最后完成这个测试,来检查一下我们的虚拟别名能正常工作,给postmaster@jhausse.net发送一封邮件然后确认一下它会被送到roudy@jhausse.net: + + telnet cloud.jhausse.net 25 + EHLO cloud.jhausse.net + MAIL FROM:youremail@domain.com + rcpt to:postmaster@jhausse.net + data + Subject: Virtual alias test + + Dear postmaster, + Long time no hear! I hope your MX is working smoothly and securely. + Yours sincerely, Roudy + . + QUIT + +让我们检查一下邮件是否被正常送到正确的收件箱了: + + openssl s_client -crlf -connect cloud.jhausse.net:993 + 1 login roudy@jhausse.net "mypassword" + 2 LIST "" "*" + 3 SELECT INBOX + * 2 EXISTS + * 2 RECENT + 4 LOGOUT + +到这里,我们已经拥有一个能正常工作的邮箱服务器了,能收发邮件。我们可以配置自己的设备来使用它。 + +PS:不要忘记再次[试试通过端口25往自己架设的服务器上的帐号发送邮件][29],来验证你已经没有被postgrey阻挡了。 + +## 阻止垃圾邮件进入你的收件箱 ## + +为了过滤垃圾邮件,我们已经使用了实时黑名单(RBL)和灰名单(postgrey)。现在我们将增加自适应垃圾邮件过滤来让我们的垃圾邮件过滤能力提高一个等级。这意味着我们将为我们的邮件服务器增加人工智能,这样它就能从经验中学习哪些邮件是垃圾哪些不是。我们将使用[dspam][30]来实现这个功能。 + + apt-get install dspam dovecot-antispam postfix-pcre dovecot-sieve + +dovecot-antispam是一个安装包,可以在我们发现有邮件被dspam误分类了之后让dovecot重新更新垃圾邮件过滤器。基本上,我们所需要做的就只是把邮件放进或拿出垃圾箱。dovecot-antispam将负责调用dspam来更新过滤器。至于postfix-pcre和dovecot-sieve,我们将分别用它们来把接收的邮件传递给垃圾邮件过滤器以及自动把垃圾邮件放入用户的垃圾箱。 + +在配置文件**/etc/dspam/dspam.conf**里,为以下参数设置相应的值: + + TrustedDeliveryAgent "/usr/sbin/sendmail" + UntrustedDeliveryAgent "/usr/lib/dovecot/deliver -d %u" + Tokenizer osb + IgnoreHeader X-Spam-Status + IgnoreHeader X-Spam-Scanned + IgnoreHeader X-Virus-Scanner-Result + IgnoreHeader X-Virus-Scanned + IgnoreHeader X-DKIM + IgnoreHeader DKIM-Signature + IgnoreHeader DomainKey-Signature + IgnoreHeader X-Google-Dkim-Signature + ParseToHeaders on + ChangeModeOnParse off + ChangeUserOnParse full + ServerPID /var/run/dspam/dspam.pid + ServerDomainSocketPath "/var/run/dspam/dspam.sock" + ClientHost /var/run/dspam/dspam.sock + +然后,在配置文件**/etc/dspam/default.prefs**里,把以下参数改为: + + spamAction=deliver # { quarantine | tag | deliver } -> default:quarantine + signatureLocation=headers # { message | headers } -> default:message + showFactors=on + +现在我们需要把dspam连接到postfix和dovecot上,在配置文件**/etc/postfix/master.cf**最后添加这样两行: + + dspam unix - n n - 10 pipe + flags=Ru user=dspam argv=/usr/bin/dspam --deliver=innocent,spam --user $recipient -i -f $sender -- $recipient + dovecot unix - n n - - pipe + flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} + +现在我们将告诉postfix通过dspam来过滤所有提交给服务器端口25(一般的SMTP通信)的新邮件,除非该邮件是从服务器本身发出(permit\_mynetworks)。注意下我们通过SASL鉴权提交给postfix的邮件不会通过dspam过滤,因为我们在前面部分里为这种方式设定了独立的提交服务。编辑文件**/etc/postfix/main.cf**将选项**smtpd\_client\_restrictions**改为如下内容: + + smtpd_client_restrictions = permit_mynetworks, reject_rbl_client zen.spamhaus.org, check_policy_service inet:127.0.0.1:10023, check_client_access pcre:/etc/postfix/dspam_filter_access + +在文件末尾,还需要增加: + + # For DSPAM, only scan one mail at a time + dspam_destination_recipient_limit = 1 + +现在我们需要指定我们定义的过滤器。基本上,我们将告诉postfix把所有邮件(如下用 /./ 代表)通过unix套接字发给dspam。创建一个新文件**/etc/postfix/dspam\_filter\_access**并把下面一行写进去: + + /./ FILTER dspam:unix:/run/dspam/dspam.sock + +这是postfix部分的配置。现在让我们为dovecot设置垃圾过滤。在文件**/etc/dovecot/conf.d/20-imap.conf**里,修改**imap mail\_plugin**插件参数为下面的方式: + + mail_plugins = $mail_plugins antispam + +并为lmtp增加一个部分: + + protocol lmtp { + # Space separated list of plugins to load (default is global mail_plugins). + mail_plugins = $mail_plugins sieve + } + +我们现在设置dovecot-antispam插件。编辑文件**/etc/dovecot/conf.d/90-plugin.conf**并把以下内容添加到插件部分: + + plugin { + ... + # Antispam (DSPAM) + antispam_backend = dspam + antispam_allow_append_to_spam = YES + antispam_spam = Junk;Spam + antispam_trash = Trash;trash + antispam_signature = X-DSPAM-Signature + antispam_signature_missing = error + antispam_dspam_binary = /usr/bin/dspam + antispam_dspam_args = --user;%u;--deliver=;--source=error + antispam_dspam_spam = --class=spam + antispam_dspam_notspam = --class=innocent + antispam_dspam_result_header = X-DSPAM-Result + } + +然后在文件**/etc/dovecot/conf.d/90-sieve.conf**里指定默认的sieve脚本,这个将对服务器上所有用户有效: + + sieve_default = /etc/dovecot/default.sieve + +什么是sieve以及为什么我们需要为所有用户设置一个默认脚本?sieve可以在IMAP服务器上为我们自动处理任务。在我们的例子里,我们想让所有被确定为垃圾的邮件移到垃圾箱而不是收件箱里。我们希望这是服务器上所有用户的默认行为;这是为什么我们把这个脚本设为默认脚本。现在让我们来创建这个脚本,建立一个新文件**/etc/dovecot/default.sieve**并写入以下内容: + + require ["regex", "fileinto", "imap4flags"]; + # Catch mail tagged as Spam, except Spam retrained and delivered to the mailbox + if allof (header :regex "X-DSPAM-Result" "^(Spam|Virus|Bl[ao]cklisted)$", + not header :contains "X-DSPAM-Reclassified" "Innocent") { + # Mark as read + # setflag "\\Seen"; + # Move into the Junk folder + fileinto "Junk"; + # Stop processing here + stop; + } + +现在我们需要编译这个脚本好让dovecot能运行它。我们也需要给它合适的权限。 + + cd /etc/dovecot + sievec . + chown mail.dovecot default.siev* + chmod 0640 default.sieve + chmod 0750 default.svbin + +最后,我们需要修改dspam需要读取的两个postfix配置文件的权限: + + chmod 0644 /etc/postfix/dynamicmaps.cf /etc/postfix/main.cf + +就这些!让我们重启dovecot和postfix服务 + + service dovecot restart + service postfix restart + +然后通过从远程主机(比如我们用来设定服务器的电脑)连接服务器来测试一下反垃圾邮件: + + openssl s_client -connect cloud.jhausse.net:25 -starttls smtp + EHLO cloud.jhausse.net + MAIL FROM:youremail@domain.com + rcpt to:roudy@jhausse.net + DATA + Subject: DSPAM test + + Hi Roudy, how'd you like to eat some ham tonight? Yours, J + . + QUIT + +让我们检查一下邮件是否已经送到: + + openssl s_client -crlf -connect cloud.jhausse.net:993 + 1 login roudy@jhausse.net "mypassword" + 2 LIST "" "*" + 3 SELECT INBOX + 4 UID fetch 3:3 (UID RFC822.SIZE FLAGS BODY.PEEK[]) + +这个应该返回SPAM为邮件增加了一组标记的数据,看上去像这样: + + X-DSPAM-Result: Innocent + X-DSPAM-Processed: Sun Oct 5 16:25:48 2014 + X-DSPAM-Confidence: 1.0000 + X-DSPAM-Probability: 0.0023 + X-DSPAM-Signature: 5431710c178911166011737 + X-DSPAM-Factors: 27, + Received*Postfix+with, 0.40000, + Received*with+#+id, 0.40000, + like+#+#+#+ham, 0.40000, + some+#+tonight, 0.40000, + Received*certificate+requested, 0.40000, + Received*client+certificate, 0.40000, + Received*for+roudy, 0.40000, + Received*Sun+#+#+#+16, 0.40000, + Received*Sun+#+Oct, 0.40000, + Received*roudy+#+#+#+Oct, 0.40000, + eat+some, 0.40000, + Received*5+#+#+16, 0.40000, + Received*cloud.jhausse.net+#+#+#+id, 0.40000, + Roudy+#+#+#+to, 0.40000, + Received*Oct+#+16, 0.40000, + to+#+#+ham, 0.40000, + Received*No+#+#+requested, 0.40000, + Received*jhausse.net+#+#+Oct, 0.40000, + Received*256+256, 0.40000, + like+#+#+some, 0.40000, + Received*ESMTPS+id, 0.40000, + how'd+#+#+to, 0.40000, + tonight+Yours, 0.40000, + Received*with+cipher, 0.40000 + 5 LOGOUT + +很好!你现在已经为你服务器上的用户配置好自适应垃圾邮件过滤。当然,每个用户将需要在开始的几周里培训过滤器。要标记一则信息为垃圾,只需要在你的任意设备(电脑,平板,手机)上将它移动到叫“垃圾箱”或“废纸篓”的目录里。否则它将被标记为有用。 + +## 确保你发出的邮件能通过垃圾邮件过滤器 ## + +这个部分我们的目标是让我们的邮件服务器能尽量干净地出现在世界上,并让垃圾邮件发送者们更难以我们的名义发邮件。作为附加效果,这也有助于让我们的邮件能通过其他邮件服务器的垃圾邮件过滤器。 + +### 发送者策略框架(SPF) ### + +发送者策略框架(SPF)是你添加到自己服务器区域里的一份记录,声明了整个因特网上哪些邮件服务器能以你的域名发邮件。设置非常简单,使用[microsoft.com][31]上的SPF向导来生成你的SPF记录,然后作为一个TXT记录添加到自己的服务器区域里。看上去像这样: + + jhausse.net. 300 IN TXT v=spf1 mx mx:cloud.jhausse.net -all + +### 反向PTR ### + +我们[之前][32]在本文里讨论过这个问题,建议你为自己的服务器正确地设置反向DNS,这样对服务器IP地址的反向查询能返回你服务器的实际名字。 + +### OpenDKIM ### + +当我们激活[OpenDKIM][33]后,postfix会用密钥为每封发出去的邮件签名。然后我们将把这个密钥存储在DNS域中。这样的话,世界上任意一个邮件服务器都能够检验邮件是否真的是我们发出的,或是由垃圾邮件发送者伪造的。让我们先安装opendkim: + + apt-get install opendkim opendkim-tools + +然后按如下方式编辑**/etc/opendkim.conf**文件的配置: + + ## + ## opendkim.conf -- configuration file for OpenDKIM filter + ## + Canonicalization relaxed/relaxed + ExternalIgnoreList refile:/etc/opendkim/TrustedHosts + InternalHosts refile:/etc/opendkim/TrustedHosts + KeyTable refile:/etc/opendkim/KeyTable + LogWhy Yes + MinimumKeyBits 1024 + Mode sv + PidFile /var/run/opendkim/opendkim.pid + SigningTable refile:/etc/opendkim/SigningTable + Socket inet:8891@localhost + Syslog Yes + SyslogSuccess Yes + TemporaryDirectory /var/tmp + UMask 022 + UserID opendkim:opendkim + +我们还需要几个额外的文件,需保存在目录**/etc/opendkim**里: + + mkdir -pv /etc/opendkim/ + cd /etc/opendkim/ + +让我们建立新文件**/etc/opendkim/TrustedHosts**并写入以下内容 + + 127.0.0.1 + +建立新文件**/etc/opendkim/KeyTable**并写入以下内容 + + cloudkey jhausse.net:mail:/etc/opendkim/mail.private + +这会告诉OpenDKIM我们希望使用一个名叫'cloudkey'的加密密钥,它的内容在文件/etc/opendkim/mail.private里。我们建立另一个名叫**/etc/opendkim/SigningTable**的文件然后写入下面这一行: + + *@jhausse.net cloudkey + +这会告诉OpenDKIM每封从jhausse.net域发出的邮件都应该用'cloudkey'密钥签名。如果我们还有其他域希望也能签名,我们也可以在这里添加。 + +下一步是生成密钥并修改OpenDKIM配置文件的权限。 + + opendkim-genkey -r -s mail [-t] + chown -Rv opendkim:opendkim /etc/opendkim + chmod 0600 /etc/opendkim/* + chmod 0700 /etc/opendkim + +一开始,最好使用-t开关,这样会通知其他邮件服务器你只是在测试模式下,这样他们就不会丢弃基于你的OpenDKIM签名的邮件(目前来说)。你可以从mail.txt文件里看到OpenDKIM密钥: + + cat mail.txt + +然后把它作为一个TXT记录添加到区域文件里,应该是类似这样的 + + mail._domainkey.cloud1984.net. 300 IN TXT v=DKIM1; k=rsa; p=MIGfMA0GCSqG... + +最后,我们需要告诉postfix来为发出的邮件签名。在文件/etc/postfix/main.cf末尾,添加: + + # Now for OpenDKIM: we'll sign all outgoing emails + smtpd_milters = inet:127.0.0.1:8891 + non_smtpd_milters = $smtpd_milters + milter_default_action = accept + +然后重启相关服务: + + service postfix reload + service opendkim restart + +现在让我们测试一下是否能找到我们的OpenDKIM公钥并和私钥匹配: + + opendkim-testkey -d jhausse.net -s mail -k mail.private -vvv + +这个应该返回: + + opendkim-testkey: key OK + +这个你可能需要等一会直到域名服务器重新加载该区域(对于Linode,每15分钟会更新一次)。你可以用**dig**来检查区域是否已经重新加载。 + +如果这个没问题,让我们测试一下其他服务器能验证我们的OpenDKIM签名和SPF记录。要做这个,我们可以用[Brandon Checkett的邮件测试系统][34]。发送一封邮件到[Brandon的网页][34]上提供的测试地址,我们可以在服务器上运行下面的命令 + + mail -s CloudCheck ihAdmTBmUH@www.brandonchecketts.com + +在Brandon的网页上,我们应该可以在'DKIM Signature'部分里看到**result = pass**的文字,以及在'SPF Information'部分看到**Result: pass**的文字。如果我们的邮件通过这个测试,只要不加-t开关重新生成OpenDKIM密钥,上传新的密钥到区域文件里,然后重新测试检查是否仍然可以通过这些测试。如果可以的话,恭喜!你已经在你的服务器上成功配置好OpenDKIM和SPF了! + +## 使用Owncloud提供日历,联系人,文件服务并通过Roundcube配置网页邮件 ## + +既然我们已经拥有了一流的邮件服务器,让我们再为它增加在云上保存通讯录,日程表和文件的能力。这些是[Owncloud][35]所提供的非常赞的服务。在这个弄好后,我们还会设置一个网页邮件,这样就算你没带任何电子设备出去旅行时,或者说在你的手机或笔记本没电的情况下,也可以通过网吧来检查邮件。 + +安装Owncloud非常直观,而且在[这里][36]有非常好的介绍。在Debian系统里,归根结底就是把owncloud的仓库添加到apt源里,下载Owncloud的发行密钥并安装到apt钥匙链中,然后通过apt-get安装Owncloud: + + echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list + wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/Release.key + apt-key add - < Release.key + apt-get update + apt-get install apache2 owncloud roundcube + +在有提示的时候,选择**dbconfig**并设置**roundcube**使用**mysql**。然后,提供一下mysql的root密码并为roundcube的mysql用户设置一个漂亮的密码。然后,按如下方式编辑roundcube的配置文件**/etc/roundcube/main.inc.php**,这样登录roundcube默认会使用你的IMAP服务器: + + $rcmail_config['default_host'] = 'ssl://localhost'; + $rcmail_config['default_port'] = 993; + +现在我们来配置一下apache2网页服务器增加SSL支持,这样我们可以和Owncloud和Roundcube对话时使用加密的方式传输我们的密码和数据。让我们打开Apache的SSL模块: + + a2enmod ssl + +然后编辑文件**/etc/apache2/ports.conf**并设定以下参数: + + NameVirtualHost *:80 + Listen 80 + ServerName www.jhausse.net + + + # If you add NameVirtualHost *:443 here, you will also have to change + # the VirtualHost statement in /etc/apache2/sites-available/default-ssl + # to + # Server Name Indication for SSL named virtual hosts is currently not + # supported by MSIE on Windows XP. + NameVirtualHost *:443 + Listen 443 + + + + Listen 443 + + +我们将在目录**/var/www**下为服务器加密连接**https://www.jhausse.net**设定一个默认网站。编辑文件**/etc/apache2/sites-available/default-ssl**: + + + ServerAdmin webmaster@localhost + + DocumentRoot /var/www + ServerName www.jhausse.net + [...] + + Deny from all + + [...] + SSLCertificateFile /etc/ssl/certs/cloud.crt + SSLCertificateKeyFile /etc/ssl/private/cloud.key + [...] + + +然后让我们同时也在目录**/var/www**下设定一个非加密连接**http://www.jhausse.net**的默认网站。编辑文件**/etc/apache2/sites-available/default**: + + + DocumentRoot /var/www + ServerName www.jhausse.net + [...] + + Deny from all + + + +这样的话,我们通过把文件放到/var/www目录下让www.jhausse.net使用它们提供网站服务。名叫'Deny from all'的指令可以阻止通过www.jhausse.net访问Owncloud:我们将设定通过**https://cloud.jhausse.net**来正常访问。 + +现在我们将设定网页邮件(roundcube),让它可以通过网址**https://webmail.jhausse.net**来访问。编辑文件**/etc/apache2/sites-available/roundcube**并写入以下内容: + + + + ServerAdmin webmaster@localhost + + DocumentRoot /var/lib/roundcube + # The host name under which you'd like to access the webmail + ServerName webmail.jhausse.net + + Options FollowSymLinks + AllowOverride None + + + ErrorLog ${APACHE_LOG_DIR}/error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # do not allow unsecured connections + # SSLRequireSSL + SSLCipherSuite HIGH:MEDIUM + + # A self-signed (snakeoil) certificate can be created by installing + # the ssl-cert package. See + # /usr/share/doc/apache2.2-common/README.Debian.gz for more info. + # If both key and certificate are stored in the same file, only the + # SSLCertificateFile directive is needed. + SSLCertificateFile /etc/ssl/certs/cloud.crt + SSLCertificateKeyFile /etc/ssl/private/cloud.key + + # Those aliases do not work properly with several hosts on your apache server + # Uncomment them to use it or adapt them to your configuration + Alias /program/js/tiny_mce/ /usr/share/tinymce/www/ + + # Access to tinymce files + + Options Indexes MultiViews FollowSymLinks + AllowOverride None + Order allow,deny + allow from all + + + + Options +FollowSymLinks + # This is needed to parse /var/lib/roundcube/.htaccess. See its + # content before setting AllowOverride to None. + AllowOverride All + order allow,deny + allow from all + + + # Protecting basic directories: + + Options -FollowSymLinks + AllowOverride None + + + + Options -FollowSymLinks + AllowOverride None + Order allow,deny + Deny from all + + + + Options -FollowSymLinks + AllowOverride None + Order allow,deny + Deny from all + + + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + # SSL Protocol Adjustments: + # The safe and default but still SSL/TLS standard compliant shutdown + # approach is that mod_ssl sends the close notify alert but doesn't wait for + # the close notify alert from client. When you need a different shutdown + # approach you can use one of the following variables: + # o ssl-unclean-shutdown: + # This forces an unclean shutdown when the connection is closed, i.e. no + # SSL close notify alert is send or allowed to received. This violates + # the SSL/TLS standard but is needed for some brain-dead browsers. Use + # this when you receive I/O errors because of the standard approach where + # mod_ssl sends the close notify alert. + # o ssl-accurate-shutdown: + # This forces an accurate shutdown when the connection is closed, i.e. a + # SSL close notify alert is send and mod_ssl waits for the close notify + # alert of the client. This is 100% SSL/TLS standard compliant, but in + # practice often causes hanging connections with brain-dead browsers. Use + # this only for browsers where you know that their SSL implementation + # works correctly. + # Notice: Most problems of broken clients are also related to the HTTP + # keep-alive facility, so you usually additionally want to disable + # keep-alive for those clients, too. Use variable "nokeepalive" for this. + # Similarly, one has to force some clients to use HTTP/1.0 to workaround + # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and + # "force-response-1.0" for this. + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + + +然后在你的DNS服务商那里声明一下服务器,例如: + + webmail.jhausse.net. 300 IN CNAME cloud.jhausse.net. + +现在让我激活这三个网站 + + a2ensite default default-ssl roundcube + service apache2 restart + +关于网页邮件,可以通过网址**https://webmail.jhausse.net**来访问,基本上能工作。之后使用邮箱全名(例如roudy@jhausse.net)和在本文一开始在邮件服务器数据库里设定的密码登录。第一次连接成功,浏览器会警告说证书没有可靠机构的签名。这个没什么关系,只要添加一个例外即可。 + +最后但很重要的是,我们将通过把以下内容写入到**/etc/apache2/sites-available/owncloud**来为Owncloud创建一个虚拟主机。 + + + + ServerAdmin webmaster@localhost + + DocumentRoot /var/www/owncloud + ServerName cloud.jhausse.net + + Options FollowSymLinks + AllowOverride None + + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all + + + ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ + + AllowOverride None + Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch + Order allow,deny + Allow from all + + + ErrorLog ${APACHE_LOG_DIR}/error.log + + # Possible values include: debug, info, notice, warn, error, crit, + # alert, emerg. + LogLevel warn + + CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined + + # SSL Engine Switch: + # Enable/Disable SSL for this virtual host. + SSLEngine on + + # do not allow unsecured connections + # SSLRequireSSL + SSLCipherSuite HIGH:MEDIUM + SSLCertificateFile /etc/ssl/certs/cloud.crt + SSLCertificateKeyFile /etc/ssl/private/cloud.key + + + SSLOptions +StdEnvVars + + + SSLOptions +StdEnvVars + + + BrowserMatch "MSIE [2-6]" \ + nokeepalive ssl-unclean-shutdown \ + downgrade-1.0 force-response-1.0 + # MSIE 7 and newer should be able to use keepalive + BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown + + + +然后通过执行以下命令激活Owncloud + + a2ensite owncloud + service apache2 reload + +之后通过在浏览器里打开链接**https://cloud.jhausse.net/**配置一下Owncloud。 + +就这些了!现在你已经拥有自己的Google Drive,日程表,联系人,Dropbox,以及Gmail!好好享受下新鲜恢复保护的隐私吧!:-) + +## 在云上同步你的设备 ## + +要同步你的邮件,你只需用你喜欢的邮件客户端即可:Android或iOS自带的默认邮件应用,[k9mail][37],或者电脑上的Thunderbird。或者你也可以使用我们设置好的网页邮件。 + +在Owncloud的文档里描述了如何与云端同步你的日程表和联系人。在Android系统中,我用的是CalDAV-Sync,CardDAV-Sync应用桥接了手机上Android自带日历以及联系人应用和Owncloud服务器。 + +对于文件,有一个叫Owncloud的Android应用可以访问你手机上的文件,然后自动把你拍的图片和视频上传到云中。在你的Mac/PC上访问云端文件也很容易,在[Owncloud文档里有很好的描述][38]。 + +## 最后一点提示 ## + +在上线后的前几个星期里,最好每天检查一下日志**/var/log/syslog**和**/var/log/mail.log**以保证一切都在顺利运行。在你邀请其他人(朋友,家人,等等)加入你的服务器之前这很重要。他们信任你能很好地架设个人服务器维护他们的数据,但是如果服务器突然崩溃会让他们很失望。 + +要添加另一个邮件用户,只要在数据库**mailserver**的**virtual\_users**表中增加一行。 + +要添加一个域名,只要在**virtual_domains**表中增加一行。然后更新**/etc/opendkim/SigningTable**为发出的邮件签名,上传OpenDKIM密钥到服务器区域,然后重启OpenDKIM服务。 + +Owncloud有自己的用户数据库,在用管理员帐号登录后可以修改。 + +最后,万一在服务器临时崩溃的时候想办法找解决方案很重要。比如说,在服务器恢复之前你的邮件应该送往哪儿?一种方式是找个能帮你做备份MX的朋友,同时你也可以当他的备份MX(看下postfix的配置文件**main.cf**里**relay\_domains**和**relay\_recipient\_maps**里的设定)。与此类似,如果你的服务器被破解然后一个坏蛋把你所有文件删了怎么办?对于这个,考虑增加一个常规备份系统就很重要了。Linode提供了备份选项。在1984.is里,我用crontabs和scp做了一个基本但管用的自动备份系统。 + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/ + +作者:[Roudy Jhausse][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:aboutlinux@free.fr +[1]:https://history.google.com/history/ +[2]:http://research.google.com/workatgoogle.html +[3]:http://www.attac.org/ +[4]:http://www.nytimes.com/2012/02/19/magazine/shopping-habits.html?pagewanted=all +[5]:http://vimeo.com/ondemand/termsandconditions +[6]:http://www.techtimes.com/articles/21670/20141208/sony-pictures-hack-nightmare-week-celebs-data-leak-and-threatening-emails-to-employees.htm +[7]:http://blog.backupify.com/2012/07/25/what-is-my-gmail-account-really-worth/ +[8]:http://adage.com/article/digital/worth-facebook-google/293042/ +[9]:http://vimeo.com/ondemand/termsandconditions +[10]:https://prism-break.org/en/ +[11]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#VPS +[12]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#mail +[13]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#dspam +[14]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#SPF +[15]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#owncloud +[16]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#sync +[17]:http://linuxfr.org/news/heberger-son-courriel +[18]:http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/ +[19]:http://www.1984.is/ +[20]:http://www.linode.com/ +[21]:http://www.greenpeace.org/international/Global/international/publications/climate/2012/iCoal/HowCleanisYourCloud.pdf +[22]:http://www.1984.is/about/ +[23]:http://www.fsf.org/ +[24]:https://www.gnupg.org/ +[25]:http://www.gandi.net/ +[26]:http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html +[27]:http://www.postfix.org/ +[28]:http://postgrey.schweikert.ch/ +[29]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#testPort25 +[30]:http://dspam.sourceforge.net/ +[31]:http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/ +[32]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#PTR +[33]:http://opendkim.org/opendkim-README +[34]:http://www.brandonchecketts.com/emailtest.php +[35]:http://owncloud.org/ +[36]:http://owncloud.org/install/ +[37]:https://code.google.com/p/k9mail/ +[38]:http://doc.owncloud.org/server/7.0/user_manual/files/files.html diff --git a/translated/share/20150115 How To Run Linux Applications From The Terminal In Background Mode.md b/published/201503/20150115 How To Run Linux Applications From The Terminal In Background Mode.md similarity index 100% rename from translated/share/20150115 How To Run Linux Applications From The Terminal In Background Mode.md rename to published/201503/20150115 How To Run Linux Applications From The Terminal In Background Mode.md diff --git a/published/201503/20150119 Ubuntu 15.04 Finally Lets You Set Menus ToAlways Show.md b/published/201503/20150119 Ubuntu 15.04 Finally Lets You Set Menus ToAlways Show.md new file mode 100644 index 0000000000..3eec1c4a08 --- /dev/null +++ b/published/201503/20150119 Ubuntu 15.04 Finally Lets You Set Menus ToAlways Show.md @@ -0,0 +1,41 @@ +Ubuntu 15.04 终于可以让你将菜单设置为 ‘始终可见’ +================================================================================ +**如果你不喜欢 Unity 的全局菜单在你的鼠标离开后就淡出你的视野,在 Ubuntu 15.04 稍微做点工作就可以留住菜单。** + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/02/locally-integrated-menus-in-ubuntu.png) + +最新的Ubuntu 15.04的Unity界面通过在“提议(Proposed)”通道提供了一个选项,**使应用程序菜单在Ubuntu中始终可见**。 + +这是个不会淡出,也不会过段时间就消失的菜单。 + +最大的缺点是它目前只能通过`dconf`来控制,而不是常规的面向用户的选项设置。 + +我希望(如果预计没有的话)在之后的开发中,能有一个设置这个特性的选项被加入到Ubuntu的【系统设置】>【外观】部分。 + +现在,如果你使用的是 Ubuntu 15.04,并启用了“提议(Proposed)”的更新通道后,你可以在dconf 的com>canonical>Unity>‘always show menus’ 中找到这个开关。 + +### 迟到总比没有要好? ### + +开发者们计划在Ubuntu 14.04 LTS的下一个SRU中反向移植这个选项(假设在测试阶段没有任何意外发生)。 + +本地集成菜单(LIM)在Ubuntu 14.04 LTS 中的首次亮相就赢得了赞誉,其被广泛认为在那些喜欢隐藏方式的与那些不喜欢必须使用鼠标和触摸板的人之间的最佳的折衷方案。 + +虽然在Unity方面本地集成菜单减少了不少批评,不过默认的“淡入/淡出”行为总是还让人不爽。 + +在Ubuntu 过去的几个版本中已经能够看到他们在积极解决早期的用户体验中的几个痛点。经过了几年,在TODO列表中[我们去年终于看到了本地集成菜单][1],以及通过[点击应用图标来实现Unity 启动器中应用的最小化及恢复的选项][2]。 + +一年以来我们终于看到了一个使应用程序菜单始终显示的选项,无论我们的鼠标在哪里。迟来总比没有好,对不对? + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/01/ubuntu-15-04-always-show-menu-bar-option + +作者:[Joey-Elijah Sneddon][a] +译者:[JeffDing](https://github.com/JeffDing) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://www.omgubuntu.co.uk/2014/02/locally-integrated-menus-ubuntu-14-04 +[2]:http://www.omgubuntu.co.uk/2014/03/minimize-click-launcher-option-ubuntu-14-04 diff --git a/translated/share/20150119 Ubuntu With XFCE vs Xubuntu Linux.md b/published/201503/20150119 Ubuntu With XFCE vs Xubuntu Linux.md similarity index 91% rename from translated/share/20150119 Ubuntu With XFCE vs Xubuntu Linux.md rename to published/201503/20150119 Ubuntu With XFCE vs Xubuntu Linux.md index c739b3b702..f48ee95fa7 100644 --- a/translated/share/20150119 Ubuntu With XFCE vs Xubuntu Linux.md +++ b/published/201503/20150119 Ubuntu With XFCE vs Xubuntu Linux.md @@ -1,7 +1,8 @@ -Ubuntu With XFCE vs Xubuntu Linux +Ubuntu & XFCE vs Xubuntu ========================================================= -Ubuntu vs Xubuntu。Ubuntu拥有漂亮的桌面体验以及强大的应用程序。Xubuntu轻量、快速并且可定制,哪个更适合你? +Ubuntu拥有漂亮的桌面体验以及强大的应用程序。Xubuntu轻量、快速并且可定制,哪个更适合你? + --------------------------------------------------------- ![](http://f.tqn.com/y/linux/1/W/T/J/1/ubuntudesktop.png) @@ -10,11 +11,11 @@ Ubuntu vs Xubuntu。Ubuntu拥有漂亮的桌面体验以及强大的应用程序 并且,我同时也会在这篇文章中介绍Ubuntu用户如何获取基本的XFCE桌面,以及如何安装完整的Xubuntu桌面。 -[Ubuntu][1]以及[Xubuntu][2]是针对不同目的开发的操作系统,为什么我会强调这一点,是为了说明什么时候或者为什么你应该使用Ubuntu以及什么时候应该使用Xubuntu。 +[Ubuntu][1]以及[Xubuntu][2]是针对不同目的开发的操作系统,为什么我会强调这一点,是为了说明什么时候或者为什么你应该使用Ubuntu或Xubuntu。 比较这两个操作系统就像比较[劳斯莱斯][3]与[保时捷][4]。这两个都是很棒的车,但是如果把劳斯莱斯给一个赛车迷,他们也许会卖掉它买个其他的车,同样,如果把保时捷给舒格勋爵或者休·海夫纳这类人可能也不那么合适。 -Ubuntu拥有一个适用性很强的桌面环境,叫做Unity,并且默认会安装一些很棒的Linux应用程序,包括Rhythmbox以及[LibreOffic][5]。Ubuntu就像是劳斯莱斯。它为舒适而生,并且尽可能的提供从A到B的最时髦的方法。 +Ubuntu拥有一个适用性很强的桌面环境,叫做Unity,并且默认会安装一些很棒的Linux应用程序,包括Rhythmbox以及[LibreOffic][5]。Ubuntu就像是劳斯莱斯。它为舒适而生,并且尽可能的提供满足需要的漂亮的解决方案。 作为一个Ubuntu用户,就像汽车里面的乘客。你在到达目的地的过程中就可以同时把事情搞定,并且所有的事看起来都很漂亮并且很简单。 @@ -92,7 +93,7 @@ Xubuntu就像一个改装过的跑车。你可以把它改装成任何你想要 接下来,我会使用命令行工具[apt-get][7]介绍在Ubuntu安装XFCE桌面的方法。 -打开一个终端窗口,在Unity环境,你可以在[Dash][8]中搜索“TERM”,或者使用组合键 CTRL+ALT+T。 +打开一个终端窗口,在Unity环境,你可以在[Dash][8]中搜索“TERM”,或者使用组合键 `CTRL+ALT+T`。 安装XFCE桌面十分简单,输入下列命令就可以了: @@ -105,7 +106,7 @@ Xubuntu就像一个改装过的跑车。你可以把它改装成任何你想要 系统会显示一个消息,提示你是否使用默认的面板布局或者使用单独的面板。 -[最新版本的Xubuntu][10]在顶部包含一个单独的面板,不过我更喜欢两个面板,顶部一个标准面板,底部一个常用程序的停靠面板。 +[最新版本的Xubuntu][10]在顶部包含一个单独的面板,不过我更喜欢双面板,顶部一个标准面板,底部一个常用程序的停靠面板。 需要注意的是,XFCE桌面菜单系统和Xubuntu的菜单有些差异,除非你安装[一个更好的菜单系统][11],设置两个面板或许是个更好的选择。 @@ -117,7 +118,7 @@ Xubuntu就像一个改装过的跑车。你可以把它改装成任何你想要 如果你想全都使用Xubuntu的东西,但是又不想按照那些介绍重新安装系统的话,看看下面的东西。 -通过搜索“TERM”,或者组合键CTRL+ALT+T,打开一个终端窗口。 +通过搜索“TERM”,或者组合键`CTRL+ALT+T`,打开一个终端窗口。 在终端输入如下命令: @@ -132,16 +133,17 @@ Xubuntu就像一个改装过的跑车。你可以把它改装成任何你想要 Xubuntu桌面就会显示出来啦。 -这里会有一些差异。菜单仍然是XFCE菜单,而不是Xubuntu菜单。某些图标也不会出现在顶部面板中。但是这些问题都不足以让我们花时间卸载Ubuntu然后重装Xubuntu。 +这里会有一些差异。菜单仍然是XFCE菜单,而不是Xubuntu菜单。某些图标也不会出现在顶部面板中。但是这些小问题都不足以让我们花时间卸载Ubuntu然后重装Xubuntu。 下一篇文章中,我会介绍如何自定义Xubuntu以及XFCE桌面。 +----- via : http://linux.about.com/od/dist/fl/Ubuntu-With-XFCE-vs-Xubuntu-Linux.htm 作者:[Gary Newell][a] 译者:[zhouj-sh](https://github.com/Zhouj-sh) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201503/20150121 How to Monitor Network Usage with nload in Linux.md b/published/201503/20150121 How to Monitor Network Usage with nload in Linux.md new file mode 100644 index 0000000000..e94489c554 --- /dev/null +++ b/published/201503/20150121 How to Monitor Network Usage with nload in Linux.md @@ -0,0 +1,202 @@ +在linux中如何通过nload来监控网络使用情况 +================================================================================ +nload 是一个 linux 自由软件工具,通过提供两个简单的图形来帮助linux用户和系统管理员来实时监控网络流量以及宽带使用情况:一个是进入流量,一个是流出流量。 + +我真的很喜欢用**nload**来在屏幕上显示当前的下载速度、总的流入量和平均下载速度等信息。nload工具的报告图非常容易理解,最重要的是这些信息真的非常有用。 + +在其使用手册上说到,在默认情况下它会监控所有网络设备。但是你可以轻松地指定你想要监控的设备,而且可以通过方向键在不同的网络设备之间进行转换。另外还有很多的选项可用,例如 ‘-t’选项以毫秒来设定刷新显示时间间隔(默认时间间隔值是500毫秒),‘-m’选项用来同时显示多个设备(在使用该选项时不会显示流量图),‘-u’选项用来设置显示流量数字的单位,另外还有许多其他的选项将会在本教程中探索和练习。 + +### 如何将 nload安装到你的linux机器上 ### + +**Ubuntu** 和 **Fedora** 用户可以从默认的软件仓库中容易地安装。 + +在Ubuntu上使用以下命令进行安装。 + + sudo apt-get install nload + +在Fedora上使用以下命令进行安装。 + + sudo yum install nload + +**CentOS**用户该怎么办呢? 只需要在你的机器上输入以下命令就可以安装成功。 + + sudo yum install nload + +以下的命令会帮助你在OpenBSD系统中安装nload。 + + sudo pkg_add -i nload + +在 linux 机器上的另外一个非常有效的安装软件的方式就是编译源代码,下载并安装最新的版本意味着能够获得更好地性能、更酷的特性以及更少的bug。 + +### 如何通过源代码安装nload ### + +在从源代码安装nload之前,你需要首先下载源代码。 我通常使用wget工具来进行下载--该工具在许多linux机器上默认可用。该免费工具帮助用户以非交互式的方式从网络上下载文件,并支持以下协议: + +- HTTP +- HTTPS +- FTP + +通过以下命令来进入到**/tmp**目录中。 + + cd /tmp + +然后在你的终端中输入以下命令就可以将最新版本的nload下载到你的linux机器上了。 + + wget http://www.roland-riegel.de/nload/nload-0.7.4.tar.gz + +如果你不喜欢使用wget工具,也可以通过简单的一个鼠标点击轻松地从[官网][1]上下载其源代码。 + +由于该软件非常轻巧,其下载过程几乎在瞬间就会完成。接下来的步骤就是通过**tar**工具来将下载的源代码包进行解压。 + +tar归档工具可以用来从磁带或硬盘文档中存储或解压文件,该工具有许多可用的选项,但是我们只需要下面的几个选项来执行我们的操作。 + +1. **-x** 从归档中解压文件 +1. **-v** 使用繁琐模式运行--用来显示详细信息 +1. **-f** 用来指定归档文件 + +例如(LCTT 译注:tar 命令的参数前的“-”可以省略): + + tar xvf example.tar + +现在你学会了如何使用tar工具,我可以非常肯定你知道了如何从命令行中解压这个.tar文档。 + + tar xvf nload-0.7.4.tar.gz + +之后使用cd命令来进入到nload*目录中: + + cd nload* + +在我的系统上看起来是这样的: + + oltjano@baby:/tmp/nload-0.7.4$ + +然后运行下面这个命令来为你的系统配置该软件包: + + ./configure + +此时会有“一大波僵尸”会在你的屏幕上显示出来,下面的一个屏幕截图描述了它的样子。 + +![configuring packages for nload](http://blog.linoxide.com/wp-content/uploads/2015/01/nload1.png) + +在上述命令完成之后,通过下面的命令来编译nload。 + + make + +![compiling nload](http://blog.linoxide.com/wp-content/uploads/2015/01/nload2.png) + +好了,终于....,通过以下命令可以将nload安装在你的机器上了。 + + sudo make install + +![installing nload from source](http://blog.linoxide.com/wp-content/uploads/2015/01/nload3.png) + +安装好nload之后就是让你学习如何使用它的时间了。 + +###如何使用nload### + +我喜欢探索,所以在你的终端输入以下命令. + + nload + +看到了什么? + +我得到了下面的结果。 + +![running nload](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.png) + +如上述截图可以看到,我得到了以下信息: + +#### 流入量#### + +**当前下载速度** + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.1.png) + +**平均下载速度** + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.2.png) + +**最小下载速度** + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.3.png) + +**最大下载速度** + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.4.png) + +**总的流入量按字节进行显示** + +![](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.5.png) + +#### 流出量 #### + +类似的同样适用于流出量 + +#### 一些nload有用的选项#### + +使用选项 + + -u + +用来设置显示流量单位。 + +下面的命令会帮助你使用MBit/s显示单元 + + nload -u m + +下面的屏幕截图显示了上述命令的结果。 + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload5.png) + +尝试以下命令然后看看有什么结果。 + + nload -u g + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload6.png) + +同时还有一个**-U**选项。根据手册描述,该选项基本上与-u选项类似,只是用在合计数据。 我测试了这个命令,老实说,当你需要检查总的流入与流出量时非常有用。 + + nload -U G + +![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload7.png) + +从上面的截图中可以看到,**nload -U G** 使用Gbyte来显示数据总量。 + +另外一个我喜欢使用的有用选项是 **-t**。 该选项用来设置刷新显示事件间隔,单位为毫秒,默认值为500毫秒。 + +我会通过下面的命令做一些小的实验。 + + nload -t 130 + +那么上述命令做了什么呢?它将刷新显示时间间隔设置为130毫秒。 通常推荐不要将该时间间隔值设置为小于100毫秒,因为nload在生成报告时计算错误。 + +另外的一个选项为 **-a**, 在你想要设置计算平均值的时间窗口的秒数时使用,默认该值为300秒。 + +那么当你想要监控指定的网络设备该如何呢? 非常容易, 像下面这样简单地指定设备或者列出想要监控的设备列表即可。 + + nload wlan0 + +![nload monitoring wlan0 on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload8.png) + +下面的语法可帮助你监控指定的多个设备。 + + nload [options] device1 device2 devicen + +例如,使用下面的命令来监控eth0和eth1。 + + nload wlan0 eth0 + +如果不带选项来运行nload,那么它会监控所有自动检测到的设备,你可以通过左右方向键来显示其中的任何一个设备的信息。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/monitoring-2/monitor-network-usage-nload/ + +作者:[Oltjano Terpollari][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/oltjano/ +[1]:http://www.roland-riegel.de/nload/nload-0.7.4.tar.gz diff --git a/published/201503/20150121 How to apply image effects to pictures on Raspberry Pi.md b/published/201503/20150121 How to apply image effects to pictures on Raspberry Pi.md new file mode 100644 index 0000000000..4cbdc0fcb8 --- /dev/null +++ b/published/201503/20150121 How to apply image effects to pictures on Raspberry Pi.md @@ -0,0 +1,70 @@ +如何在树莓派上使用图片特效 +================================================================================ +现在使用[树莓派摄像头模组][1]("raspi cam"),也可以像使用卡片相机那样,给拍摄的照片增加各种各样的图片特效。 raspistill命令行工具,为您的树莓派提供了丰富的图片特效选项,来美化处理你的图片。 + +有[三个命令行工具][2]可以用于[抓取raspicam拍摄的照片或者视频][3],在这文章中将重点介绍其中的raspstill工具。raspstill工具提供了丰富的控制选项来处理图片,比如说:锐度(sharpness)、对比度(contrast)、亮度(brightness)、饱和度(saturation)、ISO、自动白平衡(AWB)、以及图片特效(image effect)等。 + +在这篇文章中,将介绍如何使用raspstill工具以及raspicam摄像头模组来控制照片的曝光、AWB以及其他的图片效果。我写了一个简单的python脚本来自动拍摄照片并在这些照片上自动应用各种图片特效。raspicam的帮助文档中介绍了该摄像头模组所支持的曝光模式、AWB和图片特效。总的来说,raspicam一共支持16种图片特效、12种曝光模式以及10种AWB选项。 + +Python脚本很简单,如下所示 。 + + #!/usb/bin/python + import os + import time + import subprocess + list_ex=['auto','night'] + list_awb=['auto','cloud',flash'] + list_ifx=['blur','cartoon','colourswap','emboss','film','gpen','hatch','negative','oilpaint','posterise','sketch','solarise','watercolour'] + x=0 + for ex in list_ex: + for awb in list_awb: + for ifx in list_ifx: + x=x+1 + filename='img_'+ex+'_'+awb+'_'+ifx+'.jpg' + cmd='raspistill -o '+filename+' -n -t 1000 -ex '+ex+' -awb '+awb+' -ifx '+ifx+' -w 640 -h 480' + pid=subprocess.call(cmd,shell=True) + print "["+str(x)+"]-"+ex+"_"+awb+"_"+ifx+".jpg" + time.sleep(0.25) + print "End of image capture" + + +这个脚本完成了以下几个工作。首先,脚本中定义了3个列表,分别用于枚举曝光模式、AWB模式以及图片特效。在这个实例中,我们将使用到2种曝光模式、3种AWB模式以及13种图片特效。脚本会遍历上述3种选项的各种组合,并使用这些参数组合来运行raspistill工具。传入的参数共6个,分别为:(1)输出文件名;(2)曝光模式;(3)AWB模式;(4)图片特效模式;(5)拍照时间,设为1秒;(6)图片尺寸,设为640x480。脚本会自动拍摄78张照片,每张照片会应用不同的特效参数。 + +执行这个脚本也很简单,只需键入下面的命令行: + + $ python name_of_this_script.py + +下面是抓取到一些样张。 + +![](https://farm8.staticflickr.com/7483/16134215939_c93291158a_c.jpg) + +### 小福利 ### + +除了使用raspistill命令行工具来操控raspicam摄像模组以外,还有其他的方法可以用哦。[Picamera][4]是一个python库,它提供了操控raspicam摄像模组的的API接口,这样就可以便捷地构建更加复杂的应用程序。如果你精通python,那么picamera一定是你的 hack 项目的好伙伴。picamera已经被默认集成到Raspbian最新版本的的镜像中。当然,如果你用的不是最新的Raspbian或者是使用其他的操作系统版本,你可以通过下面的方法来进行手动安装。 + +首先,先在你的系统上安装pip,详见[指导][6]。 + +然后,就可以按下面的方法安装picamera。 + + $ sudo pip install picamera + +picamera的使用说明可以查阅[官方文档][7]。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/apply-image-effects-pictures-raspberrypi.html + +作者:[Kristophorus Hadiono][a] +译者:[coloka](https://github.com/coloka) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/kristophorus +[1]:http://xmodulo.com/go/picam +[2]:http://www.raspberrypi.org/documentation/usage/camera/raspicam/ +[3]:http://xmodulo.com/install-raspberry-pi-camera-board.html +[4]:https://pypi.python.org/pypi/picamera +[5]:http://xmodulo.com/go/raspberrypi +[6]:http://ask.xmodulo.com/install-pip-linux.html +[7]:http://picamera.readthedocs.org/ \ No newline at end of file diff --git a/translated/tech/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md b/published/201503/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md similarity index 73% rename from translated/tech/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md rename to published/201503/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md index da72d8527b..e8b97a3f0d 100644 --- a/translated/tech/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md +++ b/published/201503/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md @@ -1,8 +1,8 @@ -Linux有问必答时间--如何查看Linux系统的CPU信息 +Linux有问必答:如何查看Linux系统的CPU信息 ================================================================================ > **问题**: 我想要了解我的电脑关于CPU处理器的详细信息,查看CPU信息比较有效地方法是什么? -根据你的需要,有各种各样的关于你的CPU处理器信息你需要了解,比如CPU供应商名、模型名、时钟频率、套接字/内核的数量, L1/L2/L3缓存配置、可用的处理器能力(比如:硬件虚拟化、AES, MMX, SSE)等等。在Linux中,有许多命令行或基于GUI的工具就能来展示你的CPU硬件的相关具体信息。 +根据你的需要,有各种各样的关于你的CPU处理器信息你需要了解,比如CPU供应商名、模型名、时钟频率、插槽/内核的数量, L1/L2/L3缓存配置、可用的处理器能力(比如:硬件虚拟化、AES, MMX, SSE)等等。在Linux中,有许多命令行或基于GUI的工具就能来展示你的CPU硬件的相关具体信息。 ### 1. /proc/cpuinfo ### @@ -12,7 +12,7 @@ Linux有问必答时间--如何查看Linux系统的CPU信息 ![](https://farm8.staticflickr.com/7572/15934711577_4136a8e0b9_c.jpg) -通过查看这个文件,你能[识别出][1]物理处理器数、每个CPU核心数、可用的CPU标志寄存器以及其它东西的数量。 +通过查看这个文件,你能[识别出][1]物理处理器数(插槽)、每个CPU核心数、可用的CPU标志寄存器以及其它东西的数量。 ### 2. cpufreq-info ### @@ -32,7 +32,7 @@ cpuid命令的功能就相当于一个专用的CPU信息工具,它能通过使 ### 4. dmidecode ### -dmidecode命令直接从BIOS的DMI(译者注:桌面管理接口)数据收集关于系统硬件的具体信息。CPU信息报告包括CPU供应商、版本、CPU标志寄存器、最大/最近的时钟速度、(所允许的)核心总数、L1/L2/L3缓存配置等等。 +dmidecode命令直接从BIOS的DMI(桌面管理接口)数据收集关于系统硬件的具体信息。CPU信息报告包括CPU供应商、版本、CPU标志寄存器、最大/当前的时钟速度、(启用的)核心总数、L1/L2/L3缓存配置等等。 $ sudo dmidecode @@ -54,7 +54,7 @@ i7z是一个专供英特尔酷睿i3、i5和i7 CPU的实时CPU报告工具。它 ![](https://farm8.staticflickr.com/7546/15534687744_1968dc2b18_c.jpg) -### 8. likwid-topology ### +### 8. likwid拓扑 ### [likwid][3] (Like I Knew What I'm Doing) 是一个用来测量、配置并显示硬件相关特性的命令行收集工具。其中的likwid拓扑结构能显示CPU硬件(线程/缓存/NUMA)的拓扑结构信息,还能识别处理器家族(比如:Intel Core 2, AMD Shanghai)。 @@ -70,7 +70,7 @@ lscpu命令用一个更加用户友好的格式统计了 /etc/cpuinfo 的内容 ### 10. lshw ### -**lshw**命令是一个综合性硬件查询工具。不同于其它工具,lshw需要root特权才能运行因为它是在BIOS系统里查询DMI(译者注:桌面管理接口)信息。它能报告总核心数和可用核心数,但是会遗漏掉一些信息比如L1/L2/L3缓存配置。GTK版本的lshw-gtk也是可用的。 +**lshw**命令是一个综合性硬件查询工具。不同于其它工具,lshw需要root特权才能运行,因为它是在BIOS系统里查询DMI(桌面管理接口)信息。它能报告总核心数和可用核心数,但是会遗漏掉一些信息比如L1/L2/L3缓存配置。GTK版本的lshw-gtk也是可用的。 $ sudo lshw -class processor @@ -78,7 +78,7 @@ lscpu命令用一个更加用户友好的格式统计了 /etc/cpuinfo 的内容 ### 11. lstopo ### -lstopo命令 (包括 [hwloc][4] 包) 使由CPU、缓存、内存和I/O设备组成的拓扑结构可见。这个命令用来识别处理器结构和系统的NUMA拓扑结构。 +lstopo命令 (包括在 [hwloc][4] 包中) 以可视化的方式组成 CPU、缓存、内存和I/O设备的拓扑结构。这个命令用来识别处理器结构和系统的NUMA拓扑结构。 $ lstopo @@ -86,7 +86,7 @@ lstopo命令 (包括 [hwloc][4] 包) 使由CPU、缓存、内存和I/O设备组 ### 12. numactl ### -其被开发的起初是为了设置NUMA的时序安排和Linux处理器的内存布局策略,numactl命令也能通过命令行来展示关于CPU硬件的NUMA拓扑结构信息。 +最初其被开发的目的是为了设置NUMA的时序安排和Linux处理器的内存布局策略,numactl命令也能通过命令行来展示关于CPU硬件的NUMA拓扑结构信息。 $ numactl --hardware @@ -94,7 +94,7 @@ lstopo命令 (包括 [hwloc][4] 包) 使由CPU、缓存、内存和I/O设备组 ### 13. x86info ### -x86info是一个为了展示基于x86架构的CPU信息的命令行工具。信息报告包括CPU型号、线程/核心数、时钟速度、TLB(译者注:传输后备缓冲器)缓存配置、支持的特征标志寄存器等等。 +x86info是一个为了展示基于x86架构的CPU信息的命令行工具。信息报告包括CPU型号、线程/核心数、时钟速度、TLB(传输后备缓冲器)缓存配置、支持的特征标志寄存器等等。 $ x86info --all @@ -105,7 +105,7 @@ x86info是一个为了展示基于x86架构的CPU信息的命令行工具。信 via: http://ask.xmodulo.com/check-cpu-info-linux.html 译者:[ZTinoZ](https://github.com/ZTinoZ) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md b/published/201503/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md similarity index 91% rename from translated/tech/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md rename to published/201503/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md index 9278bbd707..e20cd1c1ab 100644 --- a/translated/tech/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md +++ b/published/201503/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md @@ -1,4 +1,4 @@ -如何通过简单的3步恢复Windows7同时删除Ubuntu +如何通过简单的3步恢复Windows 7同时删除Ubuntu ================================================================================ ### 说明 ### @@ -8,11 +8,11 @@ 那么为什么我现在要写这篇文章呢? -到目前为止我曾经在很多场合被问到如何从一个装有Windows7或Windows8的双系统中删除Unbuntu系统,因此写这篇文章就变得有意义了。 +到目前为止我曾经在很多场合被问到如何从一个装有Windows7或Windows8的双系统中删除Ubuntu系统,因此写这篇文章就变得有意义了。 我在圣诞节期间浏览了人们在我文章中的留言,感觉是时候把缺失的文章写完同时更新一下那些比较老的又需要关注的文章了。 -我打算把一月份剩下的时间都用在这上面。这是第一步。如果你的电脑上安装了Windown7和Ubuntu双系统,同时你不想通过恢复出厂设置的方式恢复Windows7系统,那么请参考该教程。(注意:对于Windows8系统,有一个独立的教程) +我打算把一月份剩下的时间都用在这上面。这是第一步。如果你的电脑上安装了Windows7和Ubuntu双系统,同时你不想通过恢复出厂设置的方式恢复Windows7系统,那么请参考该教程。(注意:对于Windows8系统,有一个独立的教程) ### 删除Ubuntu系统需要的步骤 ### @@ -24,11 +24,10 @@ 在你开始之前,我建议为你的系统保留一个备份。 -我也建议不要放弃这样的机会也不要使用微软自带的工具。 +我建议你不要放弃备份的机会,但也不要使用微软自带的工具。 [点击查看如何使用Macrinum Reflect备份你的驱动][1] - 如果Ubuntu中有你希望保存的数据,现在就登录进去然后将数据保存到外部硬盘驱动器,USB驱动器或者DVD中。 ### 步骤1 - 删除Grub启动菜单 ### @@ -57,7 +56,7 @@ 点击“创建光盘”。 -将光盘留在电脑中重启电脑,当出现从CD中启动的消息的时候按下键盘上的“回车”键。 +将光盘留在电脑中并重启电脑,当出现从CD中启动的消息的时候按下键盘上的“回车”键。 ![](http://2.bp.blogspot.com/-VPSD50bmk2E/VLWftBg7HxI/AAAAAAAAHnM/APVzvPg4rC0/s1600/recoveryoptionschooselanguage.jpg) @@ -111,13 +110,13 @@ 对于Windows系统来说,我们真正需要的只有驱动器C,所以剩下的是可以删掉的。 -**注意: 注意一下.你的磁盘上可能有恢复分区。 不要删除恢复分区.。它们应该会被标记,将文件系统设置为NTFS或FAT32** +**注意: 注意一下.你的磁盘上可能有恢复分区。 不要删除恢复分区。它们应该有专门的卷标,文件系统也许是NTFS或FAT32** ![](http://3.bp.blogspot.com/-8YUE2p5Fj8Q/VLWlHXst6JI/AAAAAAAAHoQ/BJC57d9Nilg/s1600/deletevolume.png) 在你希望删除的分区上单击右键(例如:root,home和swap分区),然后从弹出的菜单中点击“删除卷”。 -**(不要删除任何NTFS或者FAT32文件系统的分区)** +**(不要删除任何NTFS或者FAT32文件系统的分区!)** 对于剩下的两个分区重复执行上面的操作。 @@ -134,11 +133,12 @@ ![](http://4.bp.blogspot.com/-pLV5L3CvQ1Y/VLWmh-5SKTI/AAAAAAAAHoc/7sJzITyvduo/s1600/diskmanagement4.png) 最后一步是扩展Windows以便于将它再变成一个大的分区。 + 右键点击Windows分区(C盘),然后选择“扩展卷”。 ![](http://1.bp.blogspot.com/-vgmw_N2WZWw/VLWm7i5oSxI/AAAAAAAAHok/k0q_gnIik9A/s1600/extendvolume1.PNG) -当出现左面的窗口的时候点击“下一步”, +当出现左面的窗口的时候点击“下一步”。 ![](http://3.bp.blogspot.com/-WLA86V-Au8g/VLWnTq5RpAI/AAAAAAAAHos/6vzjLNkrwRQ/s1600/extendvolume2.PNG) @@ -165,13 +165,14 @@ 这就是全部内容。一个致力于Linux的网站刚刚向你展示了如何移除Linux然后用Windows7取而代之。 有任何疑问可以在下面评论区留言。 + -------------------------------------------------------------------------------- via: http://www.everydaylinuxuser.com/2015/01/how-to-recover-windows-7-and-delete.html 作者:Gary Newell 译者:[Medusar](https://github.com/Medusar) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md b/published/201503/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md similarity index 81% rename from translated/tech/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md rename to published/201503/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md index 9318d87821..0b393aa3b1 100644 --- a/translated/tech/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md +++ b/published/201503/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md @@ -1,4 +1,4 @@ -Linux有问必答: 如何通过命令行创建和设置一个MySQL用户 +Linux有问必答:如何通过命令行创建和设置一个MySQL用户 ================================================================================ > **问题**:我想要在MySQL服务器上创建一个新的用户帐号,并且赋予他适当的权限和资源限制。如何通过命令行的方式来创建并且设置一个MySQL用户呢? @@ -21,7 +21,7 @@ Linux有问必答: 如何通过命令行创建和设置一个MySQL用户 mysql> CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; -一旦用户被创建后,包括加密的密码、权限和资源限制在内的所有帐号细节都会被存储在一个名为**user**的表中,这个表则存在与**mysql**这个特殊的数据库里。 +一旦用户被创建后,包括加密的密码、权限和资源限制在内的所有帐号细节都会被存储在一个名为**user**的表中,这个表则存在于**mysql**这个特殊的数据库里。 运行下列命令,验证帐号是否创建成功 @@ -33,14 +33,14 @@ Linux有问必答: 如何通过命令行创建和设置一个MySQL用户 - **ALL**: 所有可用的权限 - **CREATE**: 创建库、表和索引 -- **LOCK_TABLES**: 锁定表. -- **ALTER**: 修改表. -- **DELETE**: 删除表. -- **INSERT**: 插入表或列. -- **SELECT**: 选择表或列. -- **CREATE_VIEW**: 创建视图. -- **SHOW_DATABASES**: 展示数据库. -- **DROP**: 删除库、表和视图. +- **LOCK_TABLES**: 锁定表 +- **ALTER**: 修改表 +- **DELETE**: 删除表 +- **INSERT**: 插入表或列 +- **SELECT**: 检索表或列的数据 +- **CREATE_VIEW**: 创建视图 +- **SHOW_DATABASES**: 列出数据库 +- **DROP**: 删除库、表和视图 运行以下命令赋予"myuser"用户特定权限。 @@ -70,10 +70,10 @@ Linux有问必答: 如何通过命令行创建和设置一个MySQL用户 在MySQL中,你可以为单独的用户设置MySQL的资源使用限制。可用的资源限制如下: -- **MAX_QUERIES_PER_HOUR**: 允许的每小时最大请求数量. -- **MAX_UPDATES_PER_HOUR**: 允许的每小时最大更新数量. -- **MAX_CONNECTIONS_PER_HOUR**: 允许的每小时最大连接(译者注:[其与 MySQL全局变量: max_user_connections 共同决定用户到数据库的同时连接数量](http://dev.mysql.com/doc/refman/5.0/en/user-resources.html))数量. -- **MAX_USER_CONNECTIONS**: 对服务器的同时连接量. +- **MAX\_QUERIES\_PER\_HOUR**: 允许的每小时最大请求数量 +- **MAX\_UPDATES\_PER\_HOUR**: 允许的每小时最大更新数量 +- **MAX\_CONNECTIONS\_PER\_HOUR**: 允许的每小时最大连接(译者注:[其与 MySQL全局变量: max\_user\_connections 共同决定用户到数据库的同时连接数量](http://dev.mysql.com/doc/refman/5.0/en/user-resources.html))数量 +- **MAX\_USER\_CONNECTIONS**: 对服务器的同时连接量 使用以下命令为"myuser"帐号增加一个资源限制: @@ -102,6 +102,6 @@ Linux有问必答: 如何通过命令行创建和设置一个MySQL用户 via: http://ask.xmodulo.com/create-configure-mysql-user-command-line.html 译者:[Ping](http://weibo.com/370321376) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/translated/tech/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md b/published/201503/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md similarity index 84% rename from translated/tech/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md rename to published/201503/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md index aab015201e..bcaa1b3c26 100644 --- a/translated/tech/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md +++ b/published/201503/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md @@ -1,10 +1,10 @@ -Linux 有问必答: 如何在Ubuntu或者Debian中下载和安装ixgbe驱动 +Linux 有问必答:如何在Ubuntu或者Debian中编译安装ixgbe驱动 ================================================================================ -> **提问**: 我想为我的Intel 10G网卡下载安装最新的ixgbe。我该如何在Ubuntu(或者Debian)中安装ixgbe驱动? +> **提问**: 我想为我的Intel 10G网卡下载安装最新的ixgbe驱动。我该如何在Ubuntu(或者Debian)中安装ixgbe驱动? -Intel的10G网卡(比如,82598、 82599、 x540)由ixgbe驱动支持。现代的Linux发版已经将ixgbe作为一个可加载模块。然而,有些情况你不想要你机器上的已经编译和安装的ixgbe驱动。比如,你想要体验ixbge驱动的最新特性。同样,自带内核中的ixgbe中的一个默认问题是不允许你自定义旭东内核参数。如果你想要完全自动一ixgbe驱动(比如 RSS、多队列、中断阈值等等),你需要手动从源码编译ixgbe驱动。 +Intel的10G网卡(比如,82598、 82599、 x540)由ixgbe驱动支持。现代的Linux发行版已经带有了ixgbe驱动,通过可加载模块的方式使用。然而,有些情况你希望在你机器上的自己编译安装ixgbe驱动,比如,你想要体验ixbge驱动的最新特性时。同样,内核默认自带的ixgbe驱动中的一个问题是不允许你自定义驱动的参数。如果你想要一个完全定制的ixgbe驱动(比如 RSS、多队列、中断阈值等等),你需要手动从源码编译ixgbe驱动。 -这里是如何在Ubuntu、Debian或者它们的衍生版中下载安装ixgbe驱动。 +这里是如何在Ubuntu、Debian或者它们的衍生版中下载安装ixgbe驱动的教程。 ### 第一步: 安装前提 ### @@ -29,7 +29,7 @@ Intel的10G网卡(比如,82598、 82599、 x540)由ixgbe驱动支持。现 编译之后,你会看到在ixgbe-3.23.2/src目录下创建了**ixgbe.ko**。这就是会加载到内核之中的ixgbe驱动。 -用modinfo命令检查内核模块的信息。注意你需要指定模块的绝对路径(比如 ./ixgbe.ko 或者 /home/xmodulo/ixgbe/ixgbe-3.23.2/src/ixgbe.ko)。输出中会显示ixgbe内核的版本。 +用modinfo命令检查内核模块的信息。注意你需要指定模块文件的绝对路径(比如 ./ixgbe.ko 或者 /home/xmodulo/ixgbe/ixgbe-3.23.2/src/ixgbe.ko)。输出中会显示ixgbe内核的版本。 $ modinfo ./ixgbe.ko @@ -120,24 +120,24 @@ Intel的10G网卡(比如,82598、 82599、 x540)由ixgbe驱动支持。现 ### 第五步: 安装Ixgbe驱动 ### -一旦你验证新的ixgbe驱动已经成功家在,最后一步是在你的系统中安装驱动。 +一旦你验证新的ixgbe驱动可以成功加载,最后一步是在你的系统中安装驱动。 $ sudo make install -**ixgbe.ko** 接着会安装在/lib/modules//kernel/drivers/net/ethernet/intel/ixgbe 下。 +**ixgbe.ko** 会安装在/lib/modules//kernel/drivers/net/ethernet/intel/ixgbe 下。 -这一步起,你可以用下面的modprobe命令加载ixgbe驱动了。注意你不必再指定绝对路径。 +从这一步起,你可以用下面的modprobe命令加载ixgbe驱动了。注意你不必再指定绝对路径。 $ sudo modprobe ixgbe -如果你希望在启动时家在ixgbe驱动,你可以在/etc/modules的最后加入“ixgbe”。 +如果你希望在启动时加载ixgbe驱动,你可以在/etc/modules的最后加入“ixgbe”。 -------------------------------------------------------------------------------- via: http://ask.xmodulo.com/download-install-ixgbe-driver-ubuntu-debian.html 译者:[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/) 荣誉推出 diff --git a/published/201503/20150122 Linux FAQs with Answers--How to use yum to download a RPM package without installing it.md b/published/201503/20150122 Linux FAQs with Answers--How to use yum to download a RPM package without installing it.md new file mode 100644 index 0000000000..e83de0ff93 --- /dev/null +++ b/published/201503/20150122 Linux FAQs with Answers--How to use yum to download a RPM package without installing it.md @@ -0,0 +1,56 @@ +Linux 有问必答:如何使用yum来下载RPM包而不进行安装 +================================================================================ +> **问题**:我想从Red Hat 的标准仓库中下载一个RPM包,我能使用yum命令来下载一个RPM包但是不进行安装吗? + +yum是基于Red Hat的系统(如CentOS、Fedora、RHEl)上的默认包管理器。使用yum,你可以安装或者更新一个RPM包,并且他会自动解决包依赖关系。但是如果你只想将一个RPM包下载到你的系统上该怎么办呢? 例如,你可能想要获取一些RPM包在以后使用,或者将他们安装在另外的机器上。 + +这里说明了如何从yum仓库上下载一个RPM包。 + +### 方法一:yum### + +yum命令本身就可以用来下载一个RPM包,标准的yum命令提供了`--downloadonly(只下载)`的选项来达到这个目的。 + + $ sudo yum install --downloadonly + +默认情况下,一个下载的RPM包会保存在下面的目录中: + + /var/cache/yum/x86_64/[centos/fedora-version]/[repository]/packages + +以上的[repository]表示下载包的来源仓库的名称(例如:base、fedora、updates) + +如果你想要将一个包下载到一个指定的目录(如/tmp): + + $ sudo yum install --downloadonly --downloaddir=/tmp + +注意,如果下载的包包含了任何没有满足的依赖关系,yum将会把所有的依赖关系包下载,但是都不会被安装。 + +另外一个重要的事情是,在CentOS/RHEL 6或更早期的版本中,你需要安装一个单独yum插件(名称为 yum-plugin-downloadonly)才能使用`--downloadonly`命令选项: + + $ sudo yum install yum-plugin-downloadonly + +如果没有该插件,你会在使用yum时得到以下错误: + + Command line error: no such option: --downloadonly + +![](https://farm9.staticflickr.com/8627/15571201803_38390aae75_c.jpg) + +### 方法二: Yumdownloader### + +另外一个下载RPM包的方法就是通过一个专门的包下载工具--yumdownloader。 这个工具是yum工具包(包含了用来进行yum包管理的帮助工具套件)的子集。 + + $ sudo yum install yum-utils + +下载一个RPM包: + + $ sudo yumdownloader + +下载的包会被保存在当前目录中。你需要使用root权限,因为yumdownloader会在下载过程中更新包索引文件。与yum命令不同的是,任何依赖包不会被下载。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/yum-download-rpm-package.html + +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md b/published/201503/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md similarity index 81% rename from translated/tech/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md rename to published/201503/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md index 2cc7a4778a..4437f991b9 100644 --- a/translated/tech/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md +++ b/published/201503/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md @@ -1,12 +1,12 @@ -使用最近通知工具保持通知历史 +使用“最近通知工具”保持桌面通知历史 ================================================================================ ![How to see recent notifications in Ubuntu 14.04](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/recent_notifications_Ubuntu_14.jpeg) -大多数桌面环境像Unity和Gnome都有通知特性。我很喜欢其中一些。它尤其当我[在Ubuntu上收听流媒体][1]时帮到我。默认上通知会在桌面的顶部显示几秒接着就会小时。如果你听见了通知的声音但是没有看到内容怎么办?你该如何知道通知的内容? +大多数桌面环境像Unity和Gnome都有通知特性。我很喜欢其中一些。它尤其当我[在Ubuntu上收听流媒体][1]时帮到我。默认上通知会在桌面的顶部显示几秒接着就会消失。如果你听见了通知的声音但是没有看到内容怎么办?你该如何知道通知的内容? 如果你可以看到最近所有通知的历史会很棒吧?是的,我知道这很棒。你可以在Ubuntu Unity或者Gnome中使用最近**通知小工具**来追踪所有的最近通知。 -最近通知位于顶部面板,并且有最近所有通知的历史。当它捕获到新的通知后,它就会变绿来表明你有未读的通知。 +最近通知位于顶部面板,并且记录了最近所有通知的历史。当它捕获到新的通知后,它就会变绿来表明你有未读的通知。 ![Recent notifications in Ubuntu 14.04](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/recent_notifications_Ubuntu.jpeg) @@ -24,7 +24,7 @@ sudo apt-get update sudo apt-get install indicator-notifications -安装完成后,重新登录后你就可以用了。现在它是没有通知的状态。很方便的小工具,不是么? +安装完成后,重新登录后你就可以用了。现在妈妈再也不用担心我的通知没看到了。很方便的小工具,不是么? -------------------------------------------------------------------------------- @@ -32,7 +32,7 @@ via: http://itsfoss.com/notifications-appindicator/ 作者:[Abhishek][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/) 荣誉推出 diff --git a/translated/tech/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md b/published/201503/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md similarity index 93% rename from translated/tech/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md rename to published/201503/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md index 2709602c87..2dc0d43263 100644 --- a/translated/tech/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md +++ b/published/201503/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md @@ -1,6 +1,6 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 ================================================================================ -在Linux或类Unix系统中,每个用户和进程都运行在一个特定环境中。这个环境包含了变量,设置,别名,函数以及更多的。下面是对Shell环境下一些常用命令的简单介绍,包括每个命令如何使用的例子,以及在命令行下设定你自己的环境来提高效率。 +在Linux或类Unix系统中,每个用户和进程都运行在一个特定环境中。这个环境包含了变量、设置、别名、函数以及更多的东西。下面是对Shell环境下一些常用命令的简单介绍,包括每个命令如何使用的例子,以及在命令行下设定你自己的环境来提高效率。 ![](http://s0.cyberciti.org/uploads/cms/2015/01/bash-shell-welcome-image.jpg) @@ -18,7 +18,8 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 输出范例: [![图1: Finding out your shell name](http://s0.cyberciti.org/uploads/cms/2015/01/finding-your-shell-like-a-pro.jpg)][1] -图1:找出当前的shell + +*图1:找出当前的shell* ### 找出所有已安装的shell ### @@ -32,9 +33,10 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 输出范例: [![Fig.02: Finding out your shell path](http://s0.cyberciti.org/uploads/cms/2015/01/finding-and-verifying-shell-path.jpg)][2] -图2:找出shell的路径 -文件/etc/shells里包含了系统支持的shell列表。每一行代表一个shell,是相对根目录的完整路径。用这个[cat命令][3]来查看这些数据: +*图2:找出shell的路径* + +文件/etc/shells里包含了系统所支持的shell列表。每一行代表一个shell,是相对根目录的完整路径。用这个[cat命令][3]来查看这些数据: cat /etc/shells @@ -71,7 +73,8 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 示例输出: [![Fig. 03: Bash shell nesting level (subshell numbers)](http://s0.cyberciti.org/uploads/cms/2015/01/a-nested-shell-level-command.jpg)][4] -图3:Bash shell嵌套层级(子shell数目) + +*图3:Bash shell嵌套层级(子shell数目)* ### 通过chsh命令永久变更系统shell ### @@ -83,9 +86,9 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 sudo chsh -s /bin/ksh userNameHere -### 查看当前的环境 ### +### 查看当前的环境变量 ### -你需要用到 +你需要用到: env env | more @@ -118,7 +121,8 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 下面是bash shell里一些常见变量的列表: ![Fig.04: Common bash environment variables](http://s0.cyberciti.org/uploads/cms/2015/01/common-shell-vars.jpg) -图4:常见bash环境变量 + +*图4:常见bash环境变量* > **注意**:下面这些环境变量没事不要乱改。很可能会造成不稳定的shell会话: > @@ -157,7 +161,7 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 /home/vivek -### 增加或设定一个新变量 ### +### 增加或设定一个新环境变量 ### 下面是bash,zsh,sh和ksh的语法: @@ -225,7 +229,8 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 示例输出: [![Fig.05: List all bash environment configuration files](http://s0.cyberciti.org/uploads/cms/2015/01/list-bash-enviroment-variables.jpg)][5] -图5:列出bash的所有配置文件 + +*图5:列出bash的所有配置文件* 要查看所有的bash配置文件,输入: @@ -241,7 +246,7 @@ Shell入门:掌握Linux,OS X,Unix的Shell环境 sudo cp -v /etc/bashrc /etc/bashrc.bak.22_jan_15 ######################################################################## - ## 然后,随心所欲随便改吧,好好玩玩shell环境或者提高一下效率:) ## + ## 然后,随心所欲随便改吧,好好玩玩shell环境或者提高一下效率:) ## ######################################################################## sudo vim /etc/bashrc @@ -326,14 +331,15 @@ zsh的[wiki][6]中建议用下面的命令: 示例输出: [![Fig.06: View session history in the bash shell using history command](http://s0.cyberciti.org/uploads/cms/2015/01/history-outputs.jpg)][7] -图6:在bash shell中使用history命令查看会话历史 -你可以重复使用命令。简单地按下[上]或[下]方向键就可以查看之前的命令。在shell提示符下按下[CTRL-R]可以向后搜索历史缓存或文件来查找命令。重复最后一次命令,只需要在shell提示符下输入!!就好了: +*图6:在bash shell中使用history命令查看会话历史* + +你可以重复使用之前的命令。简单地按下[上]或[下]方向键就可以查看之前的命令。在shell提示符下按下[CTRL-R]可以向后搜索历史缓存或文件来查找命令。重复最后一次命令,只需要在shell提示符下输入!!就好了: ls -l /foo/bar !! -在以上的历史记录中查看命令#93 (hddtemp /dev/sda),输入: +在以上的历史记录中找到命令#93 (hddtemp /dev/sda),输入: !93 @@ -483,7 +489,7 @@ Bash/ksh/zsh函数允许你更进一步地配置shell环境。在这个例子中 最后,[打开bash命令补齐][12] - source /etc/bash_completio + source /etc/bash_completion #### #2: 设定bash命令提示符 #### @@ -511,7 +517,7 @@ Bash/ksh/zsh函数允许你更进一步地配置shell环境。在这个例子中 # 为命令历史文件增加时间戳 export HISTTIMEFORMAT="%F %T " - # 附加到命令历史文件,俄不是覆盖 + # 附加到命令历史文件,而不是覆盖 shopt -s histappend #### #5: 设定shell会话的时区 #### @@ -561,7 +567,7 @@ Bash/ksh/zsh函数允许你更进一步地配置shell环境。在这个例子中 # 清理那些.DS_Store文件 alias dsclean='find . -type f -name .DS_Store -delete' -#### #8: 让世界充满色彩 #### +#### #8: 寡人好色 #### # 彩色的grep输出 alias grep='grep --color=auto' @@ -669,7 +675,7 @@ via: http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx 作者:[nixCraft][a] 译者:[zpl1025](https://github.com/zpl1025) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/20150126 4 lvcreate Command Examples on Linux.md b/published/201503/20150126 4 lvcreate Command Examples on Linux.md similarity index 61% rename from translated/tech/20150126 4 lvcreate Command Examples on Linux.md rename to published/201503/20150126 4 lvcreate Command Examples on Linux.md index 145f2c52ee..0da451aef2 100644 --- a/translated/tech/20150126 4 lvcreate Command Examples on Linux.md +++ b/published/201503/20150126 4 lvcreate Command Examples on Linux.md @@ -1,39 +1,38 @@ -在linux中4个lvcreate命令例子 +4 个 lvcreate 常用命令举例 ================================================================================ 逻辑卷管理(LVM)是广泛使用的技术,并拥有极其灵活磁盘管理方案。主要包含3个基础命令: -a. 创建物理卷使用**pvcreate** -b. 创建卷组并给卷组增加分区**vgcreate** -c. 创建新的逻辑卷使用**lvcreate** +1. 创建物理卷使用**pvcreate** +2. 创建卷组并给卷组增加分区**vgcreate** +3. 创建新的逻辑卷使用**lvcreate** ![](http://www.ehowstuff.com/wp-content/uploads/2015/01/lvm-diagram1.jpg) -随后的例子着重在已经存在的卷组上使用**lvcreate**创建逻辑卷。**lvcreate**命令可以在来自自由物理扩展池的卷组分配逻辑扩展。通常,逻辑卷可以随意使用底层逻辑卷上的任意空间。修改逻辑卷将释放或重新分配在物理卷空间。这些例子已经在CentOS 5, CentOS 6, CentOS 7, RHEL 5, RHEl 6 和 RHEL 7 版本中测试通过。 +下列例子主要讲述在已经存在的卷组上使用**lvcreate**创建逻辑卷。**lvcreate**命令可以在卷组的可用物理扩展池中分配逻辑扩展。通常,逻辑卷可以随意使用底层逻辑卷上的任意空间。修改逻辑卷将释放或重新分配物理卷的空间。这些例子已经在CentOS 5, CentOS 6, CentOS 7, RHEL 5, RHEl 6 和 RHEL 7 版本中测试通过。 ### 4个lvcreate命令例子 ### -1. 在名为vg_newlvm卷组中创建15G大小的逻辑卷: +1. 在名为vg_newlvm的卷组中创建15G大小的逻辑卷: - [root@centos7 ~]# lvcreate -L 15G vg_newlvm + [root@centos7 ~]# lvcreate -L 15G vg_newlvm -2. 在名为vg_newlvm中创建大小为2500MB的逻辑卷并命名centos7_newvol,创建块设备/dev/vg_newlvm/centos7_newvol: +2. 在名为vg_newlvm的卷组中创建大小为2500MB的逻辑卷,并命名为centos7_newvol,这样就创建了块设备/dev/vg_newlvm/centos7_newvol: - [root@centos7 ~]# lvcreate -L 2500 -n centos7_newvol vg_newlvm + [root@centos7 ~]# lvcreate -L 2500 -n centos7_newvol vg_newlvm -3.可以使用**lvcreate**命令的参数-l,能指定一些特别的逻辑卷扩展大小。也可以使用这个参数以卷组的大小百分比来扩展逻辑卷。这下列的命令创建了centos7_newvol卷组的50%大小的逻辑卷vg_newlvm: +3. 可以使用**lvcreate**命令的参数-l来指定逻辑卷扩展的大小。也可以使用这个参数以卷组的大小百分比来扩展逻辑卷。这下列的命令创建了centos7_newvol卷组的50%大小的逻辑卷vg_newlvm: - [root@centos7 ~]# lvcreate -l 50%VG -n centos7_newvol vg_newlvm + [root@centos7 ~]# lvcreate -l 50%VG -n centos7_newvol vg_newlvm 4. 使用卷组剩下的所有空间创建逻辑卷 - [root@centos7 ~]# lvcreate --name centos7_newvol -l 100%FREE vg_newlvm + [root@centos7 ~]# lvcreate --name centos7_newvol -l 100%FREE vg_newlvm 更多帮助,使用**lvcreate**命令--help选项来查看: [root@centos7 ~]# lvcreate --help ---------- -以下空号中是帮助字面翻译 lvcreate: Create a logical volume(创建逻辑卷) @@ -46,8 +45,8 @@ c. 创建新的逻辑卷使用**lvcreate** [-C|--contiguous {y|n}] [-d|--debug] [-h|-?|--help] - [--ignoremonitoring](忽略监听) - [--monitor {y|n}](监听) + [--ignoremonitoring](忽略监控) + [--monitor {y|n}](监控) [-i|--stripes Stripes [-I|--stripesize StripeSize]] [-k|--setactivationskip {y|n}] [-K|--ignoreactivationskip] @@ -66,7 +65,7 @@ c. 创建新的逻辑卷使用**lvcreate** [--discards {ignore|nopassdown|passdown}] [--poolmetadatasize MetadataSize[bBsSkKmMgG]]] [--poolmetadataspare {y|n}] - [--thinpool ThinPoolLogicalVolume{Name|Path}]精简池逻辑卷 + [--thinpool ThinPoolLogicalVolume{Name|Path}] (精简池逻辑卷) [-t|--test] [--type VolumeType](卷类型) [-v|--verbose] @@ -75,18 +74,14 @@ c. 创建新的逻辑卷使用**lvcreate** [--version] VolumeGroupName [PhysicalVolumePath...] - lvcreate - { {-s|--snapshot} OriginalLogicalVolume[Path] | - [-s|--snapshot] VolumeGroupName[Path] -V|--virtualsize VirtualSize} - {-T|--thin} VolumeGroupName[Path][/PoolLogicalVolume] - -V|--virtualsize VirtualSize}( + -------------------------------------------------------------------------------- via: http://www.ehowstuff.com/4-lvcreate-command-examples-on-linux/ 作者:[skytech][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[Vic020](https://github.com/Vic020) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201503/20150126 CD Audio Grabbers--Graphical Based.md b/published/201503/20150126 CD Audio Grabbers--Graphical Based.md new file mode 100644 index 0000000000..4521760139 --- /dev/null +++ b/published/201503/20150126 CD Audio Grabbers--Graphical Based.md @@ -0,0 +1,121 @@ +4 个图形界面的 CD 音频抓取器 +================================================================================ +CD音频抓取器设计用来从光盘中提取(“RIP”)原始数字音频(通常被称为 CDDA 格式)并把它保存成文件或以其他形式输出。这类软件使用户能把数字音频编码成各种格式,并可以从在线光盘数据库 freedb 中下载或上传光盘信息。 + +复制CD合法吗?在美国版权法中,把一个原始CD转换成数字文件用于个人使用等同于‘合理使用’。然而,美国版权法并没有明确的允许或禁止拷贝私人音频CD,而且判例法还没有确立出在具体的哪种情况下可以视为合理使用。而在英国,其版权的定位则更清晰一些。从2014年开始,英国公民制造CD,MP3,DVD,蓝光和电子书的行为成为合法行为。当然,这仅适用于这个人拥有被采集的媒体的实体,并且复制品仅用于他们个人使用。对于欧盟的其他国家,成员国也允许私人复制这种特例。 + +如果你不确定在你生活的国家里这种版权是如何界定的,在你使用这篇文章中所列举的软件前请查询本地的版权法以确定你处在合法的一边。 + +在某种程度上,提取CD音轨看起来有点多余。如[Spotify][5]和Google Play Music这类流媒体服务提供了一个巨大的以通用格式的音乐的库,无需采集你的CD集。但是,如果你已将收藏了一个数量巨大的CD集。能把你的CD转换成可以在便携设备如智能手机、平板和便携式MP3播放器上播放的格式仍然是个诱人的选择。 + +这篇文章推荐了我最喜欢的音频CD抓取器。我挑了四个最好的图形界面的音频抓取器。所有这些应用程序都是在开源许可下发行的。 + +###fre:ac + +![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-freac.png) + +fre:ac是个开源的音频转换器和CD提取器,支持很多种流行格式和编码器。目前这个应用可以在MA3、MP4/M4A、WMA、Ogg Vorbis、FLAC、AAC、WAV和Bonk格式间转换。这来源于几种不同形式的LAME编码器。 + +#### 功能包括: #### + +- 易学易用 +- MP3、MP4/M4A、WMA、Ogg Vorbis、FLAC、AAC、WAV和Bonk格式转换器 +- 集成了CDDB/freedb标题数据库支持的CD提取器 +- 多核优化的编码器加速了现代PC上的转换速度 +- 对于标签和文件名称的全Unicode支持 +- 易学易用,而当你需要时还提供专家级选项 +- 任务列表 +- 可以使用Winamp 2输入插件 +- 多语言用户界面支持41种语言 + +- 网址: [freac.org][1] +- 开发人员:Robert Kausch +- 许可证: GNU GPL v2 +- 版本号: 20141005 + +###Audex + +![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-Audex.png) + +Audex是个简单易用的开源的音频CD提取应用。虽然它还处于早期开发阶段,但这个KDE桌面工具足够稳定、智能和简单易用。 + +它的助手可以为LAME、OGG Vorbis(oggenc)、FLAC、FAAC(AAC/MP4)和RIFF WAVE等格式创建配置文件。除了这个助手,你也可以定义你自己的配置文件,这意味着,Audex适用于大部分的命令行编码器。 + +#### 功能包括: #### + +- 可提取CDDA Paranoia +- 提取和编码同时进行 +- 文件名采用本地和远程的CDDB/FreeDB数据库 +- 可以提交到CDDB/FreeDB数据库 +- 类似capitalize的元数据纠正工具 +- 多配置文件提取(每个配置文件文件有一个命令行编码器) +- 从互联网上抓取封面并将他们存在数据库中 +- 在目标目录中创建播放列表、封面和基于模板的信息文件 +- 创建提取和编码协议 +- 将文件传送到FTP服务器 +- 支持国际化 + +- 网址: [kde.maniatek.com/audex][2] +- 开发人员: Marco Nelles +- 许可证: GNU GPL v3 +- 版本号: 0.79 + +###Sound Juicer + +![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-SoundJuicer.png) + +Sound Juicer是个使用GTK+和GStreamer开发的轻量级CD提取器。它从CD中提取音频并把它转换成音频文件。Sound Juicer还可以直接播放CD中的音轨,在提取前提供预览。 + +它支持任何GStreamer插件所支持的音频编码,包括 MP3、Ogg Vorbis、FLAC和未压缩的PCM格式。 + +它是GNOME桌面环境内建的一部分。 + +#### 功能包括: #### + +- 自动通过CDDB给音轨加标签 +- 可编码成ogg/vorbis、FLAC和原始WAV +- 编码路径的设置很简单 +- 多种风格流派 +- 国际化支持 + +- 网址:[burtonini.com][3] +- 开发人员: Ross Burton +- 许可证:GNU GPL v2 +- 版本号:3.14 + +###ripperX + +![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-ripperX.png) + +ripperX是个开源的图形界面的程序,用于提取CD音轨并把他们编码成Ogg、MP2、MP3或FLAC格式。它的目的是容易使用,只需要点几下鼠标就能转换整张专辑。它支持在CDDB寻找专辑和音轨信息。 + +他使用cdparanoia把CD音轨转换(也就是“提取”)成WAV文件,然后调用Vorbis/Ogg编码器oggenc把WAV文件转换成OGG文件。它还可以调用flac让WAV文件生成无损压缩的FLAC文件。 + +#### 功能包括: #### + +- 非常简单易用 +- 可以把CD音轨提取成WAV、MP3、OGG或FLAC文件 +- 支持CDDB查找 +- 支持ID3v2标签 +- 可暂停提取进程 + +- 网址:[sourceforge.net/projects/ripperx][4] +- 开发人员:Marc André Tanner +- 许可证:MIT/X Consortium License +- 版本号:2.8.0 + +-------------------------------------------------------------------------------- + +转自:http://www.linuxlinks.com/article/20150125043738417/AudioGrabbersGraphical.html + +作者:Frazer Kline +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.freac.org/ +[2]:http://kde.maniatek.com/audex/ +[3]:http://burtonini.com/blog/computers/sound-juicer +[4]:http://sourceforge.net/projects/ripperx/ +[5]:http://linux.cn/article-3130-1.html \ No newline at end of file diff --git a/translated/tech/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md b/published/201503/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md similarity index 54% rename from translated/tech/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md rename to published/201503/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md index a49467781e..ff995682ad 100644 --- a/translated/tech/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md +++ b/published/201503/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md @@ -1,10 +1,10 @@ -清理 Ubuntu 14.10,14.04,13.10 系统 +如何清理你的 Ubuntu 14.10/14.04/13.10 系统 ================================================================================ 前面我们已经讨论了[如何清理 Ubuntu GNU/Linux 系统][1],这篇教程将在原有教程的基础上,增加对新的 Ubuntu 发行版本的支持,并介绍更多的工具。 假如你想清理你的 Ubuntu 主机,你可以按照以下的一些简单步骤来移除所有不需要的垃圾文件。 -### 移除多余软件包 ### +## 移除多余软件包 ## 这又是一个内置功能,但这次我们不必使用新得立包管理软件(Synaptic Package Manager),而是在终端中达到目的。 @@ -14,7 +14,7 @@ sudo apt-get autoclean ``` -这便激活了包清除命令。这个命令所做的工作是: 自动清除那些当你安装或升级程序时系统所缓存的 `.deb` 包(即清除 `/var/cache/apt/archives` 目录,不过只清理过时的包)。如果需要使用 清除命令,只需在终端窗口中键入以下命令: +这便激活了包清除命令。这个命令所做的工作是: 自动清除那些当你安装或升级程序时系统所缓存的 `.deb` 包(即清除 `/var/cache/apt/archives` 目录,不过只清理过时的包)。如果需要使用清除命令,只需在终端窗口中键入以下命令: ``` sudo apt-get clean @@ -26,9 +26,9 @@ sudo apt-get clean sudo apt-get autoremove ``` -### 移除不需要的本地数据 ### +## 移除不需要的本地化数据 ## -为达到此目的,我们需要安装 `localepurge` 软件,它将自动移除一些不需要的本地数据。这个软件是一个简单的脚本,它将从那些 不再需要的本地文件和本地联机手册( man pages ) 所占用的空间中回收磁盘空间。这个软件将在任何 apt 安装命令运行时 被自动激活。 +为达到此目的,我们需要安装 `localepurge` 软件,它将自动移除一些不需要的本地化数据(LCTT 译注:即各种语言翻译)。这个软件是一个简单的脚本,它将从那些不再需要的本地化文件和本地化联机手册( man pages ) 所占用的空间中回收磁盘空间。这个软件将在任何 apt 安装命令运行时 被自动激活。 在 Ubuntu 中安装 `localepurge` @@ -36,7 +36,7 @@ sudo apt-get autoremove sudo apt-get install localepurge ``` -在通过 `apt-get install` 安装任意软件后, localepurge 将移除所有 不是使用你系统中所设定语言的 翻译文件和翻译的联机手册。 +在通过 `apt-get install` 安装任意软件后, localepurge 将移除所有不是使用你系统中所设定语言的翻译文件和翻译的联机手册。 假如你想设置 `localepurge`,你需要编辑 `/ect/locale.nopurge` 文件。 @@ -54,9 +54,9 @@ sudo apt-get install discus > localepurge: Disk space freed in /usr/share/locale: 41860K -### 移除 孤包 ### +## 移除孤包 ## -假如你想移除孤包,你需要安装 `deborphan` 软件: +假如你想移除孤包,你需要安装 `deborphan` 软件: 在 Ubuntu 中安装 `deborphan` : @@ -72,11 +72,11 @@ sudo apt-get install deborphan sudo deborphan | xargs sudo apt-get -y remove --purge ``` -### 使用 GtkOrphan 来移除 孤包 ### +### 使用 GtkOrphan 来移除孤包 ### -`GtkOrphan` (一个针对 debian 系发行版本的 Perl/Gtk2 应用) 是一个分析 用户安装过程状态并查找孤立库文件的图形化工具, 它为 `deborphan` 提供了一个 GUI 前端,并具备移除软件包的功能。 +`GtkOrphan` (一个针对 debian 系发行版本的 Perl/Gtk2 应用) 是一个分析用户安装过程状态并查找孤立库文件的图形化工具,它为 `deborphan` 提供了一个 GUI 前端,并具备移除软件包的功能。 -### 在 Ubuntu 中安装 GtkOrphan ### +#### 在 Ubuntu 中安装 GtkOrphan #### 打开终端并运行如下命令: @@ -90,11 +90,11 @@ sudo apt-get install gtkorphan ### 使用 Wajig 移除孤包 ### -`Wajig`是 Debian 包管理系统中一个简单的软件包管理前端。它将 apt、apt-cache、 dpkg、 /etc/init.d 中的脚本等 通过一个单一命令集成在一起,它的设计初衷是 使用简单 和 为它所包含的函数提供丰富的文档。 +`Wajig`是 Debian 包管理系统中一个简单的软件包管理前端。它将 apt、apt-cache、 dpkg、 /etc/init.d 中的脚本等 通过一个单一命令集成在一起,它的设计初衷是使用简单和为它的所有功能提供丰富的文档。 -通过适当的 `sudo`配置,大多数(如果不是全部)的软件包安装和创建等任务可以通过 一个用户 shell 来完成。`Wajig` 也适用于一般的系统管理。另外,一个 Gnome GUI 命令 `gjig`也被囊括在这个软件包之中。 +通过适当的 `sudo`配置,大多数(如果不是全部)的软件包安装和创建等任务可以通过一个用户 shell 来完成。`Wajig` 也适用于一般的系统管理。另外,一个 Gnome GUI 命令 `gjig`也被囊括在这个软件包之中。 -### 在 Ubuntu 中安装 Wajig ### +#### 在 Ubuntu 中安装 Wajig #### 打开终端并运行如下命令: @@ -102,13 +102,13 @@ sudo apt-get install gtkorphan sudo apt-get install wajig ``` -### Debfoster --- 跟踪你在安装过程中的操作 ### +## Debfoster --- 跟踪你在安装过程中的操作 ## -debfoster 将会维护一个列有 被明确要求安装的软件包的列表,但不包括那些作为某个软件的依赖而被安装的软件包。参数是完全可选的,你甚至可以使得 在 dpkg 和/或 apt-get 每次运行之后的每一秒内 激活 debfoster 。 +debfoster 将会维护一个列有被明确需要安装的软件包的列表,但不包括那些作为某个软件的依赖而被安装的软件包。参数是完全可选的,你甚至可以使得在 dpkg 和/或 apt-get 每次运行之后马上激活 debfoster 。 另外,你还可以在命令行中使用 debfoster 来安装或移除某些特定的软件包。那些后缀为 `---` 的软件包将会被移除,而没有后缀的软件包将会被安装。 -假如一个新的软件包或 debfoster 注意到 作为某个软件包的依赖的软件包 是一个孤包,则 debfoster 将会询问你下一步如何操作。若你决定保留这个孤包, debfoster 将只会进行记录并继续安装过程;若你觉得这个软件包不足以引起你的兴趣,在 debfoster 询问这个问题后,它将移除这个软件包。进一步的,如果你的决定使得其他的软件包变为孤包,更多的提问将会接踵而来。 +假如一个新的软件包或 debfoster 注意到作为某个软件包的依赖的软件包是一个孤包,则 debfoster 将会询问你下一步如何操作。若你决定保留这个孤包, debfoster 将只会进行记录并继续安装过程;若你觉得这个软件包不足以引起你的兴趣,在 debfoster 询问这个问题后,它将移除这个软件包。进一步的,如果你的决定使得其他的软件包变为孤包,更多的提问将会接踵而来。 ### 在 Ubuntu 中安装 debfoster ### @@ -120,13 +120,13 @@ sudo apt-get install debfoster ### 使用 debfoster ### -为了创建一个 初始跟踪文件,可以使用如下命令: +为了创建一个初始跟踪文件,可以使用如下命令: ``` sudo debfoster -q ``` -你总可以编辑 `/var/lib/debfoster/keepers` 文件,来定义那些 你想留在系统中的软件包。 +你总可以编辑 `/var/lib/debfoster/keepers` 文件,来定义那些你想留在系统中的软件包。 为了编辑这个文件,可以键入: @@ -134,7 +134,7 @@ sudo debfoster -q sudo vi /var/lib/debfoster/keepers ``` -强制使 debfoster 去移除 所有没有被列在上面这个文件的软件包 或 安装作为某些列在这个文件中的软件包的依赖, 它也会添加所有在这个列表中没有被安装的软件包。若要根据这个列表来执行相关操作,只需执行 +要强制使 debfoster 去移除所有没有被列在上面这个文件的软件包,或安装作为某些列在这个文件中的软件包的依赖,它也同时会添加所有在这个列表中没有被安装的软件包。若要根据这个列表来执行相关操作,只需执行: ``` sudo debfoster -f @@ -146,9 +146,9 @@ sudo debfoster -f sudo debfoster ``` -### xdiskusage -- 查看你的硬盘空间都去哪儿了 ### +## xdiskusage -- 查看你的硬盘空间都去哪儿了 ## -图形化地展示磁盘使用情况的 du.xdiskusage 是一个用户友好型程序,它将为你展示你所有磁盘的使用情况。 它是在 Phillip C. Dykstra 所写的 “xdu” 程序的基础上设计的。一些改变使得它可以为你运行 “du”命令,并显示磁盘的剩余空间,并且假如你想清晰地了解你的磁盘空间都去哪儿了,它还可以生成一个 PostScript 格式的名为 display.xdiskusage 的文件。 +图形化地展示磁盘使用情况的 du。xdiskusage 是一个用户友好型的程序,它将为你展示你所有磁盘的使用情况。 它是在 Phillip C. Dykstra 所写的 “xdu” 程序的基础上设计的。做了一些修改以使得它可以为你运行 “du”命令,并显示磁盘的剩余空间,并且假如你想清晰地了解你的磁盘空间都去哪儿了,它还可以生成一个 PostScript 格式的名为 display.xdiskusage 的文件。 ### 在 Ubuntu 中安装 xdiskusage ### @@ -169,9 +169,9 @@ sudo xdiskusage ![](http://www.ubuntugeek.com/wp-content/uploads/2015/01/5.png) -### Bleachbit ### +## Bleachbit ## -BleachBit 能快速地释放磁盘空间并不知疲倦地保护你的隐私。它可以 释放缓存,删除 cookie,清除 Internet 上网历史,粉碎临时文件,删除日志,丢弃你所不知道存在何处的垃圾。为 Linux 和 Windows 系统设计,它支持擦除清理数以千计的应用程序,如 Firefox, Internet Explorer, Adobe Flash, Google Chrome, Opera, Safari 等等。除了简单地删除文件,BleachBit 还包括许多高级功能,诸如 粉碎文件以防止恢复,擦除磁盘空间 来隐藏被其他应用程序所删除文件的痕迹,为火狐“除尘”,使其速度更快等。比免费更好,BleachBit 是一个开源软件。 +BleachBit 能快速地释放磁盘空间并不知疲倦地保护你的隐私。它可以释放缓存,删除 cookie,清除 Internet 上网历史,粉碎临时文件,删除日志,丢弃你所不知道存在何处的垃圾。为 Linux 和 Windows 系统而设计,它支持擦除清理数以千计的应用程序,如 Firefox, Internet Explorer, Adobe Flash, Google Chrome, Opera, Safari 等等。除了简单地删除文件,BleachBit 还包括许多高级功能,诸如粉碎文件以防止恢复,擦除磁盘空间来隐藏被其他应用程序所删除文件的痕迹,为火狐“除尘”,使其速度更快等。比免费更好,BleachBit 是一个开源软件。 ### 在 Ubuntu 中安装 Bleachbit ### @@ -195,10 +195,10 @@ via: http://www.ubuntugeek.com/cleaning-up-a-ubuntu-gnulinux-system-updated-with 作者:[ruchi][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.ubuntugeek.com/author/ubuntufix [1]:http://www.ubuntugeek.com/cleaning-up-all-unnecessary-junk-files-in-ubuntu.html -[2]:http://www.ubuntugeek.com/www.ubuntugeek.com/install-ubuntu-tweak-on-ubuntu-14-10.html +[2]:http://linux.cn/article-3335-1.html diff --git a/translated/tech/20150126 How To Kill All Processes Of A Specific User With slay.md b/published/201503/20150126 How To Kill All Processes Of A Specific User With slay.md similarity index 83% rename from translated/tech/20150126 How To Kill All Processes Of A Specific User With slay.md rename to published/201503/20150126 How To Kill All Processes Of A Specific User With slay.md index 897c4c16c7..77a8441323 100644 --- a/translated/tech/20150126 How To Kill All Processes Of A Specific User With slay.md +++ b/published/201503/20150126 How To Kill All Processes Of A Specific User With slay.md @@ -1,4 +1,4 @@ -如何用‘slay’杀掉指定用户的所有进程 +用‘slay’干掉某个用户的所有进程 ================================================================================ **slay** 是**Chris Ausbrooks**写的一款用于杀掉指定用户所有运行进程的命令行工具。slay对系统管理员而言在找出那些不应该运行进程的用户是很有用的。 @@ -31,19 +31,19 @@ slay在大多数发行版中都有官方仓库。 ~ sudo slay amitooo slay: Done. -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/slay-amitoo-kpenee.png) +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/slay-amitoo-kpenee.png) 当slay运行完成后,你应该就可以看到反馈了。 -享受吧。 +爽吧?! -------------------------------------------------------------------------------- via: http://www.unixmen.com/kill-processes-specific-user-slay/ -作者:[ Enock Seth Nyamador][a] +作者:[Enock Seth Nyamador][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/) 荣誉推出 diff --git a/translated/tech/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md b/published/201503/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md similarity index 81% rename from translated/tech/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md rename to published/201503/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md index 104f05e0a7..d54877bd36 100644 --- a/translated/tech/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md +++ b/published/201503/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md @@ -1,17 +1,18 @@ -如何不用重启在CentOS 7/ RHEL 7中添加一块新硬盘 +如何不用重启在CentOS 7/ RHEL 7虚拟机中添加一块新硬盘 ================================================================================ 通常在你在虚拟机中添加一块新硬盘时,你可能会看到新硬盘没有自动加载。这是因为连接到硬盘的SCSI总线需要重新扫描来使得新硬盘可见。这里有一个简单的命令来重新扫描SCSI总线和SCSI设备。下面这几步在CentOS 7 和RHEL 7 中测试过。 1. 在ESXi或者vCenter中添加一块新的20G硬盘: -![](http://www.ehowstuff.com/wp-content/uploads/2015/01/Create-new-LVM-CentOS7-1.png) + ![](http://www.ehowstuff.com/wp-content/uploads/2015/01/Create-new-LVM-CentOS7-1.png) 2. 显示当前磁盘分区: - [root@centos7 ~]# fdisk -l + [root@centos7 ~]# fdisk -l ----------- + ---------- + ``` Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes @@ -33,20 +34,22 @@ Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes + ``` 3. 确定主机总线号 - [root@centos7 ~]# ls /sys/class/scsi_host/ - host0 host1 host2 + [root@centos7 ~]# ls /sys/class/scsi_host/ + host0 host1 host2 4. 重新扫描SCSI总线来添加设备 - [root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan - [root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan - [root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan + [root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host0/scan + [root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host1/scan + [root@centos7 ~]# echo "- - -" > /sys/class/scsi_host/host2/scan -5. 验证磁盘和分区并确保20GB硬盘已经添加了。在本例中,出现了下面这行 “Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors” 并且确认新盘添加后没有重启服务器: +5. 验证磁盘和分区并确保20GB硬盘已经添加了。在本例中,出现了下面这行 “`Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors`” 并且可以确认没有重启服务器就添加了新盘: + ``` [root@centos7 ~]# fdisk -l Disk /dev/sda: 32.2 GB, 32212254720 bytes, 62914560 sectors @@ -76,14 +79,14 @@ Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes - + ``` -------------------------------------------------------------------------------- via: http://www.ehowstuff.com/how-to-add-a-new-hard-disk-without-rebooting-on-centos-7-rhel-7/ 作者:[skytech][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/) 荣誉推出 diff --git a/published/201503/20150126 Improve system performance by moving your log files to RAM Using Ramlog.md b/published/201503/20150126 Improve system performance by moving your log files to RAM Using Ramlog.md new file mode 100644 index 0000000000..3ad03ac708 --- /dev/null +++ b/published/201503/20150126 Improve system performance by moving your log files to RAM Using Ramlog.md @@ -0,0 +1,107 @@ +性能优化:使用ramlog将日志文件转移到内存中 +================================================================================ +Ramlog 以系统守护进程的形式运行。在系统启动时它创建虚拟磁盘(ramdisk),将 /var/log 下的文件复制到虚拟磁盘中,同时把虚拟磁盘挂载为/var/log。然后所有的日志就会更新到虚拟磁盘上。而当 ramlog 重启或停止时,需要记录到硬盘上的日志就会保留在目录/var/log.hdd中。而关机的时候,(ramdisk上的)日志文件会重新保存到硬盘上,以确保日志一致性。Ramlog 2.x默认使用tmpfs文件系统,同时也可以支持ramfs和内核ramdisk。使用rsync(译注:Linux数据镜像备份工具)这个工具来同步日志。 + +注意:如果突然断电或者内核崩溃(kernel panic)时,没有保存进硬盘的日志将会丢失。 + +如果你拥有够多的可用内存,而又想把日志放进虚拟磁盘,就安装ramlog吧。它是笔记本用户、带有UPS的系统或是直接在flash中运行的系统的优良选择,可以节省日志的写入时间。 + +Ramlog的运行机制以及步骤如下: + +1. Ramlog 由第一个守护进程(这取决于你所安装过的其它守护进程)启动。 + +2. 然后创建目录/var/log.hdd并将其硬链至/var/log。 + +3. 如果使用的是tmpfs(默认)或者ramfs 文件系统,将其挂载到/var/log上。 + +4. 而如果使用的是内核ramdisk,ramdisk会在/dev/ram9中创建,并将其挂载至/var/log。默认情况下ramlog会占用所有ramdisk的内存,其大小由内核参数"ramdisk_size"指定。 + +5. 接着其它的守护进程被启动,并在ramdisk中更新日志。Logrotate(译注:Linux日志轮替工具)和 ramdisk 配合的也很好。 + +6. 重启(默认一天一次)ramlog时,目录/var/log.hdd将借助rsync与/var/log保持同步。日志自动保存的频率可以通过cron(译注:Linux例行性工作调度)来控制。默认情况下,ramlog 的调度任务放置在目录/etc/cron.daily下。 + +7. 系统关机时,ramlog在最后一个守护进程关闭之前关闭。 + +8. 在ramlog关闭期间,/var/log.hdd中的文件将被同步至/var/log,接着/var/log和/var/log.hdd都被卸载,然后删除空目录/var/log.hdd。 + +**注意:- 此文仅面向高级用户** + +### 在Ubuntu中安装Ramlog ### + +首先需要用以下命令,从[这里][1]下载.deb安装包: + + wget http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb + +下载ramlog\_2.0.0\_all.deb安装包完毕,使用以下命令进行安装: + + sudo dpkg -i ramlog_2.0.0_all.deb + +这一步会完成整个安装,现在你需要运行以下命令: + + sudo update-rc.d ramlog start 2 2 3 4 5 . stop 99 0 1 6 . + +现在,在更新sysklogd的初始化顺序,使之能在ramlog停止运行前正确关闭: + + sudo update-rc.d -f sysklogd remove + + sudo update-rc.d sysklogd start 10 2 3 4 5 . stop 90 0 1 6 . + +然后重启系统: + + sudo reboot + +系统重启完毕,运行'ramlog getlogsize'来获取你当前的/var/log的空间大小。在此基础之上多分配40%的空间,确保ramdisk有足够的空间(这整个都将作为ramdisk的空间大小)。 + +编辑引导配置文件,如/etc/grub.conf,、/boot/grub/menu.lst 或/etc/lilo.conf(译注:具体哪个配置文件视不同引导加载程序而定),给你的当前内核的新增选项 'ramdisk_size=xxx' ,其中xxx是ramdisk的空间大小。 + +### 配置Ramlog ### + +基于deb的系统中,Ramlog的配置文件位于/etc/default/ramlog,你可以在该配置文件中设置以下变量: + + RAMDISKTYPE=0 + # 取值: + # 0 -- tmpfs (可被交换到交换分区) -- 默认 + # 1 -- ramfs (旧内核不能设置最大空间大小, + # 不能被交换到交换分区,和 SELinux 不兼容) + # 2 -- 老式的内核 ramdisk + TMPFS_RAMFS_SIZE= + # 可以用于 tmpfs 或 ramfs 的最大内存大小 + # 这个值可以是百分比或数值(单位是 Mb),例如: + # TMPFS_RAMFS_SIZE=40% + # TMPFS_RAMFS_SIZE=100m + # 该值为空表示 tmpfs/ramfs 的大小是全部内存的 50% + # 更多选项可以参考 ‘man mount' 中的‘Mount options for tmpfs' 一节 + # (补充,在较新的内核中,ramfs 支持大小限制, + # 虽然 man 中说没有这个挂载选项) + # 该选项仅用于 RAMDISKTYPE=0 或 1 时 + KERNEL_RAMDISK_SIZE=MAX + #以 kb 为单位指定的内核 ramdisk 大小,或者使用 MAX 来使用整个 ramdisk。 + #该选项仅用于 RAMDISKTYPE=2 时 + LOGGING=1 + # 0=关闭, 1=打开 。记录自身的日志到 /var/log/ramdisk + LOGNAME=ramlog + # 自身的日志文件名 (用于 LOGGING=1时) + VERBOSE=1 + # 0=关闭, 1=打开 (设置为 1时,启动或停止失败时会调用 teststartstop 将细节 + # 写到日志中) + +### 在Ubuntu中卸载ramlog ### + +打开终端运行以下命令: + + sudo dpkg -P ramlog + +注意:如果ramlog卸载之前仍在运行,需要重启系统完成整个卸载工作。 + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/improve-system-performance-by-moving-your-log-files-to-ram-using-ramlog.html + +作者:[ruchi][a] +译者:[soooogreen](https://github.com/soooogreen) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix +[1]:http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb diff --git a/translated/tech/20150127 How to limit network bandwidth on Linux.md b/published/201503/20150127 How to limit network bandwidth on Linux.md similarity index 55% rename from translated/tech/20150127 How to limit network bandwidth on Linux.md rename to published/201503/20150127 How to limit network bandwidth on Linux.md index cc1efc2aef..5be2501e58 100644 --- a/translated/tech/20150127 How to limit network bandwidth on Linux.md +++ b/published/201503/20150127 How to limit network bandwidth on Linux.md @@ -1,12 +1,12 @@ -怎样在 Linux 中限制网络带宽 +怎样在 Linux 中限制网络带宽使用 ================================================================================ -假如你经常在 Linux 桌面上运行多个网络应用,或在家中让多台电脑共享带宽;(这时,)你可能想更好地控制带宽的使用。否则,当你使用下载器下载一个大文件时,交互式 SSH 会话可能会变得缓慢以至不可用;或者当你通过 Dropbox 来同步一个大文件夹时,你的室友可能会抱怨在她的电脑上,视频流变得断断续续。 +假如你经常在 Linux 桌面上运行多个网络应用,或在家中让多台电脑共享带宽;那么你可能想更好地控制带宽的使用。否则,当你使用下载器下载一个大文件时,交互式 SSH 会话可能会变得缓慢以至不可用;或者当你通过 Dropbox 来同步一个大文件夹时,你的室友可能会抱怨在她的电脑上,视频流变得断断续续。 -在本教程中,我将为你描述两种 在 Linux 中限制网络流量速率的不同方法。 +在本教程中,我将为你描述两种在 Linux 中限制网络流量速率的不同方法。 ### 在 Linux 中限制一个应用的速率 ### -限制网络流量速率的一种方法是通过一个名为[trickle][1]的命令行工具。通过在程序运行时,预先加载一个 速率限制 socket 库 的方法,trickle 命令允许你改变任意一个特定程序的流量。 关于 trickle 命令的一个很好的特征是 它仅在用户空间中运行,这意味着,你不必需要 root 权限来达到限制一个程序的带宽使用的目的。为了与 trickle 程序兼容,这个特定程序必须使用没有静态链接库的套接字接口。当你想对一个不具有内置带宽控制功能的程序进行速率限制时,trickle 可以帮得上忙。 +限制网络流量速率的一种方法是通过一个名为[trickle][1]的命令行工具。通过在程序运行时,预先加载一个速率限制 socket 库 的方法,trickle 命令允许你改变任意一个特定程序的流量。 trickle 命令有一个很好的特性是它仅在用户空间中运行,这意味着,你不必需要 root 权限就可以限制一个程序的带宽使用。要能使用 trickle 程序控制程序的带宽,这个程序就必须使用非静态链接库的套接字接口。当你想对一个不具有内置带宽控制功能的程序进行速率限制时,trickle 可以帮得上忙。 在 Ubuntu,Debian 及其衍生发行版中安装 trickle : @@ -20,10 +20,10 @@ $ sudo apt-get install trickle $ sudo yum install trickle ``` -trickle 的基本使用方法如下。仅需简单地把 trickle 命令(带有速率参数)放在你想运行的命令之前。 +trickle 的基本使用方法如下。仅需简单地把 trickle 命令(及速率参数)放在你想运行的命令之前。 ``` -$ trickle -d -u +$ trickle -d -u ``` 这就可以将 `` 的下载和上传速率限定为特定值(单位 KBytes/s)。 @@ -34,27 +34,27 @@ $ trickle -d -u $ trickle -u 100 scp backup.tgz alice@remote_host.com: ``` -如若你想,你可以使用下面的命令为你的 Firefox 浏览器设定最大下载速率(e.g. , 300 KB/s),通过产生一个[自定义启动器][3]的方式。 +如若你想,你可以通过创建一个[自定义启动器][3]的方式,使用下面的命令为你的 Firefox 浏览器设定最大下载速率(例如, 300 KB/s)。 ``` trickle -d 300 firefox %u ``` -最后, trickle 也可以 以守护进程模式运行,在该模式下,它将会限制所有通过 trickle 启动且正在运行的程序的总的带宽和。 启动 trickle 使其作为一个守护进程(i.e., trickled): +最后, trickle 也可以以守护进程模式运行,在该模式下,它将会限制所有通过 trickle 启动且正在运行的程序的总带宽之和。 启动 trickle 使其作为一个守护进程(例如, trickled): ``` $ sudo trickled -d 1000 ``` -一旦 trickled 守护进程在后台运行,你便可以通过 trickle 命令来启动其他程序。假如你通过 trickle 启动一个程序,那么这个程序的最大下载速率将是 1000 KB/s, 假如你再通过 trickle 启动了另一个程序,则每个程序的(下载)速率极限将会被限制为 500 KB/s, 等等。 +一旦 trickled 守护进程在后台运行,你便可以通过 trickle 命令来启动其他程序。假如你通过 trickle 启动一个程序,那么这个程序的最大下载速率将是 1000 KB/s, 假如你再通过 trickle 启动了另一个程序,则每个程序的(下载)速率极限将会被限制为 500 KB/s,等等。 ### 在 Linux 中限制一个网络接口的速率 ### -另一种控制你的带宽资源的方式是在每一个接口上限制带宽。这在你与其他人分享你的网络连接的上行带宽时尤为实用。同其他一样,Linux 有一个工具来为你做这件事。[wondershaper][4]恰好执行限制网络接口速率的任务。 +另一种控制你的带宽资源的方式是在每一个接口上限制带宽。这在你与其他人分享你的网络连接的上行带宽时尤为实用。同其他一样,Linux 有一个工具来为你做这件事。[wondershaper][4]就是干这个的。 -wondershaper 实际上是一个 shell 脚本,它使用 [tc][5] 来定义流量调整命令,使用 QoS 来处理特定的网络接口。通过放置被赋予不同的优先级的传出流量在一个队列中,达到限制传出流量速率的目的, 而传入流量通过丢包的方式来达到速率限制的目的。 +wondershaper 实际上是一个 shell 脚本,它使用 [tc][5] 来定义流量调整命令,使用 QoS 来处理特定的网络接口。外发流量通过放在不同优先级的队列中,达到限制传出流量速率的目的;而传入流量通过丢包的方式来达到速率限制的目的。 -事实上, wondershaper 的既定目标不仅仅是对一个接口增加其带宽上限;当批量下载或上传正在进行时,wondershaper 还试图去保持互动性会话如SSH 的低延迟。同样的,它还确保批量上传(e.g. , Dropbox 的同步)不会使得下载“窒息”,反之亦然。 +事实上, wondershaper 的既定目标不仅仅是对一个接口增加其带宽上限;当批量下载或上传正在进行时,wondershaper 还试图去保持互动性会话如 SSH 的低延迟。同样的,它还会控制批量上传(例如, Dropbox 的同步)不会使得下载“窒息”,反之亦然。 在 Ubuntu Debian 及其衍生发行版本 中安装 wondershaper: @@ -62,9 +62,9 @@ wondershaper 实际上是一个 shell 脚本,它使用 [tc][5] 来定义流量 $ sudo apt-get install wondershaper ``` -在 Fdora 或 CentOS/RHEL (带有 [EPEL 软件仓库][2]) 中安装 wondershaper:(注:这里 链接 2 和 6 一样,可以删除其中之一) +在 Fdora 或 CentOS/RHEL (带有 [EPEL 软件仓库][2]) 中安装 wondershaper: -`` +``` $ sudo yum install wondershaper ``` @@ -90,7 +90,7 @@ $ sudo wondershaper clear eth0 ### 总结 ### -在本教程中,我介绍了两种不同的方法,来达到如何在 Linux 桌面环境中,控制每个应用或每个接口的带宽使用的目的。 这些工具对用户都及其友好,都为用户提供了一个快速且容易的方式来调整或限制流量。 对于那些想更多地了解如何在 Linux 中进行速率控制的读者,请参考 [the Linux bible][7]. +在本教程中,我介绍了两种不同的方法,来达到如何在 Linux 桌面环境中,控制每个应用或每个接口的带宽使用的目的。 这些工具的使用都很简单,都为用户提供了一个快速且容易的方式来调整或限制流量。 对于那些想更多地了解如何在 Linux 中进行速率控制的读者,请参考 [the Linux bible][7]. -------------------------------------------------------------------------------- @@ -98,15 +98,15 @@ via: http://xmodulo.com/limit-network-bandwidth-linux.html 作者:[Dan Nanni][a] 译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://xmodulo.com/author/nanni [1]:http://monkey.org/~marius/trickle -[2]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html +[2]:http://linux.cn/article-2324-1.html [3]:http://xmodulo.com/create-desktop-shortcut-launcher-linux.html [4]:http://lartc.org/wondershaper/ [5]:http://lartc.org/manpages/tc.txt -[6]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html +[6]:http://linux.cn/article-2324-1.html [7]:http://www.lartc.org/lartc.html diff --git a/translated/tech/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md b/published/201503/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md similarity index 58% rename from translated/tech/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md rename to published/201503/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md index 5935a4545c..e9db8a1172 100644 --- a/translated/tech/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md +++ b/published/201503/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md @@ -1,14 +1,14 @@ -LinSSID - 一款Linux下的图形化Wi-Fi扫描器 +LinSSID:一款Linux下的图形化Wi-Fi扫描器 ================================================================================ ### 介绍 ### -如你所知,**LinSSID** 是一款可以用于寻找可用无线网络的图形化软件。它完全开源,用C++写成,使用了Linux无线工具、Qt5、Qwt6.1,它在外观和功能上与**Inssider** (MS Windows)相近。 +你可能知道,**LinSSID** 是一款可以用于寻找可用无线网络的图形化软件。它完全开源,用C++写成,使用了Linux wireless tools、Qt5、Qwt6.1,它在外观和功能上与**Inssider** (MS Windows 下的)相近。 ### 安装 ### 你可以使用源码安装,如果你使用的是基于DEB的系统比如Ubuntu和LinuxMint等等,你也可以使用PPA安装。 -你可用从[this link][1]这个链接下载并安装LinSSID。 +你可用从[这个][1]下载并安装LinSSID。 这里我门将使用PPA来安装并测试这个软件。 @@ -22,22 +22,21 @@ LinSSID - 一款Linux下的图形化Wi-Fi扫描器 安装完成之后,你可以从菜单或者unity中启动。 -你将被要求输入管理员密码。 +你需要输入管理员密码。 -![Password required for iwlist scan_001](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Password-required-for-iwlist-scan_001.png) +![Password required for iwlist scan_001](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Password-required-for-iwlist-scan_001.png) 这就是LinSSID的界面。 -![LinSSID_002](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/LinSSID_002.png) +![LinSSID_002](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/LinSSID_002.png) -现在选择你想要连接无线网络的网卡,比如这里是wlan0.点击Play按钮来搜寻wi-fi网络列表。 +现在选择你想要连接无线网络的网卡,比如这里是wlan0,点击Play按钮来搜寻wi-fi网络列表。 几秒钟之后,LinSSID就会显示wi-fi网络了。 -![LinSSID_003](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/LinSSID_003.png) - -如你在上面的截屏中所见,LinSSID显示SSID名、MAC ID、通道、隐私、加密方式、信号和协议等等信息。当然,你可以让LinSSID显示更多的选项,比如安全、带宽等等。要显示这些,进入**View**菜单并选择需要的选项。同样,它显示了不同通道中的信号随着时间信号强度的变化。最后,它可以工作在2.4Ghz和5Ghz通道上。 +![LinSSID_003](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/LinSSID_003.png) +如你在上面的截屏中所见,LinSSID显示SSID名、MAC ID、通道、隐私、加密方式、信号和协议等等信息。当然,你可以让LinSSID显示更多的选项,比如安全设置、带宽等等。要显示这些,进入**View**菜单并选择需要的选项。同样,它显示了不同的通道中的信号随着时间信号强度的变化。最后,它可以工作在2.4Ghz和5Ghz通道上。 就是这样。希望这个工具对你有用。 @@ -53,7 +52,7 @@ via: http://www.unixmen.com/linssid-graphical-wi-fi-scanner-linux/ 作者:[SK][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/) 荣誉推出 diff --git a/published/201503/20150127 Windows 10 versus Linux.md b/published/201503/20150127 Windows 10 versus Linux.md new file mode 100644 index 0000000000..f0c78dfb4d --- /dev/null +++ b/published/201503/20150127 Windows 10 versus Linux.md @@ -0,0 +1,31 @@ +Windows 10 VS Linux +================================================================================ +![](https://farm4.staticflickr.com/3852/14863156322_e4edbae70e_t.jpg) + +前阵子 Windows 10 好像占据了绝大部分头条,甚至在一些Linux圈里也是一样。最具代表性的是 betanews.com 的 Brian Fagioli 说 Windows 10 已经为 Linux 桌面系统敲响了丧钟,Microsoft 如今宣布将为忠实的 Windows 用户免费提供 Windows 10,Steven J. Vaughan-Nichols 说这是一个最新的开源公司,然后 Matt Hartley 比较了 Windows 10 和 Ubuntu,Jesse Smith 从 Linux 用户的视角对 Windows 10 做出评估。 + +**Windows 10**,在 Microsoft [声明][1]说将免费提供给 Windows 7 及以上用户,这件事成为如今大家闲聊的热门话题。在 Linuxland 这里,也没有被忽视。betanews.com 的 Brian Fagioli,一个自封的 Linux 粉丝,如今这样说,“ Windows 10 把门彻底关上了。Linux 桌面元年将永远不会到来,歇歇吧。”[Fagioli解释][2]说 Microsoft 倾听了用户的抱怨而且并不只是记录一下,还更好地解决了这些问题。他说 Linux 错失了由 Windows 8 不受欢迎以及巨大失败带来的机会。然后他总结,拜 Windows 10 所赐,处于边缘地带的我们只能接受一个“破碎的梦”。 + +不过,来自闻名的 Distrowatch.com 的 Jesse Smith 说 Microsoft 并没有提供一个很明显的下载方式,不过确实可行而且它也升级了。安装程序非常简单,除了分区功能很有限甚至有点吓人。在最终启动进入 Windows 10 后,Smith说界面布局很“松散”,没有 Win7 里被很多人讨厌的大量分散注意的元素,开始菜单又回来了,取消了欢迎屏幕。据Smith所说,还有一个很类似 Ubuntu 和 Android 的新的包管理程序,不过需要 Microsoft 在线账户才可以使用。[Smith的总结][3]里有这样一条,“感觉 Windows 10 像是 Android 的早期 beta 版本,一个设计成时刻保持在线的消费者操作系统。而不像是一个我能用来完成工作的操作系统。” + +**S**mith的[完整文章][4]里比较了 Windows 10 和 Linux 的大量细节,不过 Matt Hartley 发表了一份实在的 Windows 10 vs Linux 的报告。[他说][5]两者的安装程序都很直观和简单,Windows 的双启动仍然没那么容易,Windows 默认提供了加密而 Ubuntu 只提供了配置选项。在桌面方面 Hartley 说 Windows 10 “纠结地丢弃了它 Windows 8 的根。”他觉得 Windows 10 的 Windows 商店比 Ubuntu 的漂亮很多,但是实在不喜欢通过“一切都是卡片”的方式来查看新安装的应用。Hartley这样总结,“首先是它将为大量 Windows 用户提供免费升级。这意味着大大降低了进入和升级门槛。第二,看起来 Microsoft 这次真的在全力以赴地倾听他们的用户需求了。” + +**S**teven J. Vaughan-Nichols 如今声称 Microsoft 是最新的开源公司;不仅因为它将发布 Windows 10 的免费升级,而且 Microsoft 正在从一个软件公司转型为一个软件服务公司。然后,据 Vaughan-Nichols 所说,Microsoft 需要开源来完成这次转型。从Novell/SUSE开始,他们已经致力于这一块儿好多年了。不仅如此,他们也发布过开源软件(不管什么目的)。[Vaughan-Nichols总结][6],“很多人不这么认为,但是Microsoft——就是Microsoft——已经成为一家开源公司。” + +-------------------------------------------------------------------------------- + +via: http://ostatic.com/blog/windows-10-versus-linux + +作者:[Susan Linton][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ostatic.com/member/susan-linton +[1]:https://news.google.com/news/section?q=microsoft+windows+10+free&ie=UTF-8&oe=UTF-8 +[2]:http://betanews.com/2015/01/25/windows-10-is-the-final-nail-in-the-coffin-for-the-linux-desktop/ +[3]:http://blowingupbits.com/2015/01/an-outsiders-perspective-on-windows-10-preview/ +[4]:http://blowingupbits.com/2015/01/an-outsiders-perspective-on-windows-10-preview/ +[5]:http://www.datamation.com/open-source/windows-vs-linux-the-2015-version-1.html +[6]:http://www.zdnet.com/article/microsoft-the-open-source-company/ diff --git a/translated/tech/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md b/published/201503/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md similarity index 71% rename from translated/tech/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md rename to published/201503/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md index db2ae3c05a..7a12be0642 100644 --- a/translated/tech/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md +++ b/published/201503/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md @@ -1,14 +1,14 @@ 如何用wifi-linux检测AP信号强度 ================================================================================ -作为一名python极客,我喜欢在github上发现新的针对linux用户的python工具。今天我发现了一款用python写成的用于检测AP信号强度的工具。 +作为一名python极客,我喜欢在github上挖掘新的用于linux用户的python工具。今天我发现了一款用python写成的用于检测AP信号强度的工具:wifi-linux。 我已经在**wifi-linux**上实验了大约两个小时,并且它工作的很好但是我希望在不久的将来在作者那里看到一些单元测试,因为命令**plot**无法在我的电脑上工作,并且会导致一些问题。 ### 什么是wifi-linux ### -根据github作者账号的官方的offical readme.md文件, wifi-linux是一个简单的收集你周围AP的RSSI信息的python脚本,它还会画出RSSI活动图形。 +根据github上作者账号的官方的 readme.md文件, wifi-linux是一个简单的收集你周围AP的RSSI信息的python脚本,它还会画出RSSI活动图形。 -,这同样可以用命令plot生成,但是不幸的是,这对我不可行。wifi-linux支持其他的命令,比如**bp** 来加入一个断点,**print**会打印一些统计和**启动开关**。 +作者说可以在该程序中可以使用plot命令绘制RSSI 活动图形,但是不幸的是,这对我不可行。wifi-linux也支持其他的命令,比如**bp** 来加入一个断点,**print**会打印一些统计和**启动开关**。 wifi-linux程序有下面这些依赖: @@ -19,15 +19,15 @@ wifi-linux程序有下面这些依赖: ### 安装wifi-linux需要的包 ### -我怕尝试使用python包管理工具pip安装python-dbus但是失败了,因为pip会查找setup.py,但是python-dbus中没有。因此下面的命令不工作。 +我尝试使用python包管理工具pip安装python-dbus但是失败了,因为pip会查找setup.py,但是python-dbus中没有。因此下面的命令不工作。 pip install dbus-python -你可以试一下但是很有可能会在终端中下面的错误。 +你可以试一下但是很有可能会在终端中出现下面的错误。 IOError: [Errno 2] No such file or directory: '/tmp/pip_build_oltjano/dbus-python/setup.py' -我该怎么解决这个问题呢?很简单,用下面命令中的系统包管理工具安装Python DBUS。 +我该怎么解决这个问题呢?很简单,用下面命令中的系统包管理工具来安装Python DBUS。 sudo apt-get install python-dbus @@ -69,7 +69,7 @@ wifi-linux程序有下面这些依赖: ![the bp command in wifi-linux](http://blog.linoxide.com/wp-content/uploads/2015/01/wifi-linux2.png) -命令**print**可以用于显示你机器的状态。下面就是一个例子。 +命令**print**可以用于在终端上显示你机器的状态。下面就是一个例子。 ![the print command](http://blog.linoxide.com/wp-content/uploads/2015/01/wifi-linux3.png) @@ -79,7 +79,7 @@ via: http://linoxide.com/linux-how-to/monitor-access-point-signal-strength-wifi- 作者:[Oltjano Terpollari][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/) 荣誉推出 diff --git a/translated/tech/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md b/published/201503/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md similarity index 93% rename from translated/tech/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md rename to published/201503/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md index 9139b8dd92..a5bdc115e2 100644 --- a/translated/tech/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md +++ b/published/201503/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md @@ -1,6 +1,6 @@ -Linux 基础:如何在Ubuntu上检查是否已经安装了一个包 +Linux 基础:如何在Ubuntu上检查一个软件包是否安装 ================================================================================ -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/04/ubuntu-790x558.png) +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2014/04/ubuntu-790x558.png) 如果你正在管理Debian或者Ubuntu服务器,你也许会经常使用**dpkg** 或者 **apt-get**命令。这两个命令用来安装、卸载和更新包。 @@ -51,7 +51,7 @@ Linux 基础:如何在Ubuntu上检查是否已经安装了一个包 +++-====================================-=======================-=======================-============================================================================= ii firefox 35.0+build3-0ubuntu0.14 amd64 Safe and easy web browser from Mozilla -要列出你系统中安装的包,输入下面的命令: +要列出你系统中安装的所有包,输入下面的命令: dpkg --get-selections @@ -97,7 +97,7 @@ Linux 基础:如何在Ubuntu上检查是否已经安装了一个包 libgcc1:amd64 install libgcc1:i386 install -额外的,你可以使用“**-L**”参数来找出包中文件的位置。 +此外,你可以使用“**-L**”参数来找出包中文件的位置。 dpkg -L gcc-4.8 @@ -130,7 +130,7 @@ via: http://www.unixmen.com/linux-basics-check-package-installed-not-ubuntu/ 作者:[SK][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/) 荣誉推出 diff --git a/published/201503/20150131 WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux.md b/published/201503/20150131 WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux.md new file mode 100644 index 0000000000..181ef5922d --- /dev/null +++ b/published/201503/20150131 WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux.md @@ -0,0 +1,47 @@ +WordPress 可以触发 Linux 上的 Ghost 缺陷 +----- +*建议用户马上更新可用的补丁* + +![WordPress validating pingback’s post URL](http://i1-news.softpedia-static.com/images/news2/WordPress-Can-Be-Used-to-Leverage-Critical-Ghost-Flaw-in-Linux-471730-2.jpg) + +**这个漏洞之前由Qualys的安全研究员发现,并取了绰号叫[Ghost](1),可以利用WordPress或其他PHP应用来攻击网站服务器。** + +这个瑕疵是一个缓冲区溢出问题,可以被攻击者触发用来获取Linux主机的命令行执行权限。发生在glibc的“`__nss_hostname_digits_dots()`”函数中,它会被“gethostbyname()”函数用到。 + +###PHP应用可以用来利用这个瑕疵 + +Sucuri的Marc-Alexandre Montpas说之所以这个问题很重要是因为这些函数在大量软件和服务器系统使用。 + +“说这是个严重问题的一个例子是WordPress本身:它使用一个叫`wp_http_validate_url()`的函数来验证每个pingback的发送URL,它是通过PHP应用的“gethostbyname()”函数替代来执行的”,他在周三的一篇博客文章里写到。 + +攻击者可以用这种方式来引入一个设计用来触发服务器端漏洞的恶意URL,从而获得系统访问权限。 + +实际上,Trustwave的安全研究人员提供了[验证][2]代码,可以使用WordPress的pingback功能引起缓冲区溢出。 + +###多个Linux发行版受到影响 + +ghost漏洞存在于glibc 2.17以上版本中,发布于2013年5月21日。glibc当前版本是2.20,发布于2014年9月。 + +不过,当时并没有升级为一个安全补丁,许多发行版并没有包含进去,特别是提供长期支持(LTS)的发行版。 + +受影响的系统包括Debian 7(wheezy),Red Hat企业版Linux 6和7,CentOS 6和7,Ubuntu 12.04。幸运的是,Linux供应商已经开始发布可以减轻风险的升级补丁。建议用户马上下载并更新。 + +为了展示这个漏洞,Qualys建立了一个利用它通过Exim邮件服务器运行远程代码的试验页面。这家安全公司声称在这个漏洞丢掉半条命之前不会关闭这个页面,意思是受影响的系统的数量降到50%的水平。 + +Linux上存在漏洞的应用包括clockdiff,ping和arping(在某些特定情况下),procmail,pppd,和Exim邮件服务器。 + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/WordPress-Can-Be-Used-to-Leverage-Critical-Ghost-Flaw-in-Linux-471730.shtml + +本文发布时间:30 Jan 2015, 17:36 GMT + +作者:[Ionut Ilascu][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/ionut-ilascu +[1]:http://news.softpedia.com/news/Linux-Systems-Affected-by-14-year-old-Vulnerability-in-Core-Component-471428.shtml +[2]:http://blog.spiderlabs.com/2015/01/ghost-gethostbyname-heap-overflow-in-glibc-cve-2015-0235.html diff --git a/translated/tech/20150202 How To Install Websvn for Subversion in CentOS 7.0.md b/published/201503/20150202 How To Install Websvn for Subversion in CentOS 7.0.md similarity index 59% rename from translated/tech/20150202 How To Install Websvn for Subversion in CentOS 7.0.md rename to published/201503/20150202 How To Install Websvn for Subversion in CentOS 7.0.md index 35af70fc51..c374f9f670 100644 --- a/translated/tech/20150202 How To Install Websvn for Subversion in CentOS 7.0.md +++ b/published/201503/20150202 How To Install Websvn for Subversion in CentOS 7.0.md @@ -1,9 +1,8 @@ -如何在CentOS 7.0上为Subverison安装Websvn +如何在CentOS 7.0 安装 Websvn ================================================================================ -大家好,今天我们会在CentOS 7.0 上为subversion安装WebSVN。 - -WebSVN提供了Svbverion中的各种方法来查看你的仓库。我们可以看到任何给定版本的任何文件或者目录的日志并且看到所有文件改动、添加、删除的列表。我们同样可以看到两个版本间的不同来知道特定版本改动了什么。 +大家好,今天我们会在CentOS 7.0 上为 subversion(SVN)安装Web 界面 WebSVN。(subverion 是 apache 的顶级项目,也称为 Apache SVN 或 SVN) +WebSVN 将 Svbverion 的操作你的仓库的各种功能通过 Web 界面提供出来。通过它,我们可以看到任何给定版本的任何文件或者目录的日志,并且可看到所有文件改动、添加、删除的列表。我们同样可以查看两个版本间的差异来知道特定版本改动了什么。 ### 特性 ### @@ -12,20 +11,20 @@ WebSVN提供了下面这些特性: - 易于使用的用户界面 - 可定制的模板系统 - 色彩化的文件列表 -- blame 视图 +- 追溯视图 - 日志信息查询 - RSS支持 - [更多][1] -由于使用PHP写成,WebSVN同样易于移植和安装。 +由于其使用PHP写成,WebSVN同样易于移植和安装。 -现在我们将为Subverison(Apache SVN)安装WebSVN。请确保你的服务器上已经安装了Apache SVN。如果你还没有安装,你可以在本教程中安装。 +现在我们将为Subverison安装WebSVN。请确保你的服务器上已经安装了 SVN。如果你还没有安装,你可以按[本教程][2]安装。 -After you installed Apache SVN(Subversion), you'll need to follow the easy steps below.安装完Apache SVN(Subversion)后,你需要以下几步。 +安装完SVN后,你需要以下几步。 ### 1. 下载 WebSVN ### -你可以从官方网站http://www.websvn.info/download/中下载WebSVN。我们首先进入/var/www/html/并在这里下载安装包。 +你可以从官方网站 http://www.websvn.info/download/ 中下载 WebSVN。我们首先进入 /var/www/html/ 并在这里下载安装包。 $ sudo -s @@ -36,7 +35,7 @@ After you installed Apache SVN(Subversion), you'll need to follow the easy steps ![downloading websvn package](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-websvn.png) -这里,我下载的是最新的2.3.3版本的websvn。你可以从这个网站得到链接。你可以用你要安装的包的链接来替换上面的链接。 +这里,我下载的是最新的2.3.3版本的 websvn。你可以从上面这个网站找到下载链接,用适合你的包的链接来替换上面的链接。 ### 2. 解压下载的zip ### @@ -54,7 +53,7 @@ After you installed Apache SVN(Subversion), you'll need to follow the easy steps ### 4. 编辑WebSVN配置 ### -现在,我们需要拷贝位于/var/www/html/websvn/include的distconfig.php为config.php,并且接着编辑配置文件。 +现在,我们需要拷贝位于 /var/www/html/websvn/include 的 distconfig.php 为 config.php,并且接着编辑该配置文件。 # cd /var/www/html/websvn/include @@ -62,7 +61,7 @@ After you installed Apache SVN(Subversion), you'll need to follow the easy steps # nano config.php -现在我们需要按如下改变文件。这完成之后,请保存病退出。 +现在我们需要按如下改变文件。完成之后,请保存并退出。 // Configure these lines if your commands aren't on your path. // @@ -100,7 +99,7 @@ After you installed Apache SVN(Subversion), you'll need to follow the easy steps # systemctl restart httpd.service -接着我们在浏览器中打开WebSVN,输入http://Ip-address/websvn,或者你在本地的话,你可以输入http://localhost/websvn。 +接着我们在浏览器中打开WebSVN,输入 http:// IP地址/websvn ,或者你在本地的话,你可以输入 http://localhost/websvn 。 ![websvn successfully installed](http://blog.linoxide.com/wp-content/uploads/2015/01/websvn-success.png) @@ -108,7 +107,9 @@ After you installed Apache SVN(Subversion), you'll need to follow the easy steps ### 总结 ### -好了,我们已经在CentOS 7上哇安城WebSVN的安装了。这个教程同样适用于RHEL 7。WebSVN提供了Svbverion中的各种方法来查看你的仓库。你可以看到任何给定版本的任何文件或者目录的日志并且看到所有文件改动、添加、删除的列表。如果你有任何问题、评论、反馈请在下面的评论栏中留下,来让我们知道该添加什么和改进。谢谢!享受WebSVN吧。:-) +好了,我们已经在CentOS 7上完成WebSVN的安装了。这个教程同样适用于RHEL 7。WebSVN 提供了 Subverion 中的各种功能来查看你的仓库。你可以看到任何给定版本的任何文件或者目录的日志,并且看到所有文件改动、添加、删除的列表。 + +如果你有任何问题、评论、反馈请在下面的评论栏中留下,来让我们知道该添加什么和改进。谢谢! 用用看吧。:-) -------------------------------------------------------------------------------- @@ -116,9 +117,10 @@ via: http://linoxide.com/linux-how-to/install-websvn-subversion-centos-7/ 作者:[Arun Pyasi][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://linoxide.com/author/arunp/ [1]:http://www.websvn.info/features/ +[2]:http://linoxide.com/linux-how-to/install-apache-svn-subversion-centos-7/ diff --git a/published/201503/20150203 9 Best IDEs and Code Editors for JavaScript Users.md b/published/201503/20150203 9 Best IDEs and Code Editors for JavaScript Users.md new file mode 100644 index 0000000000..870e5b6888 --- /dev/null +++ b/published/201503/20150203 9 Best IDEs and Code Editors for JavaScript Users.md @@ -0,0 +1,82 @@ +9款最好的 Javacript 用户的 IDE 和代码编辑器。 +================================================================================ +网络应用设计和开发是最近一段时间的发展趋势,也有越来越多的人开始在此寻找他们的职业机会。但是,作为网络开发人员或图形设计人员来说,一个好的机会并不是每个人都能够轻易获得到的,它需要很好的思维展现,以及对于工作的熟练技巧。现在有许多可用的网站来根据你的知识帮助你找到正确的职位描述。但是如果你想要在这个领域有所成就,你仍然需要具有一些出色的技能,例如可以在不同的平台、IDE以及其他的工具上开展工作。 + +说到根据不同目的和不同语言所用到的不同平台以及IDE,只靠学习一个IDE来轻松获取项目设计最佳方案的惯例已经属于过去时了。今天我们活在一个竞争日益激烈的现代生活节奏中,对于IDE们也是相同的处境,IDE是一个用来创建和部署应用的强大的客户端应用。今天我们打算为网络设计者和开发人员分享一些最好的Javacript IDE。 + +请访问这个 javascript 用户最好的代码编辑器列表,并将你的想法与我们一起分享。 + +### 1) [Spket][1] ### + +**Spket IDE** 是 JavaScript 和 XML 开发的强大工具包。这个功能强大的编辑器可以用来进行开发 JavaScript,XUL/XBL 和 Yahoo!小组件。JavaScript 编辑器提供了例如代码补全、语法高亮以及代码内容大纲等特性,可以帮助开发者提高创建高效 JavaScript 代码的生产率。 + + +![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/spket-e1422674329554.png) + +### 2) [Ixedit][2] ### + +IxEdit 是一个基于 Javascript 交互的网络设计工具。通过 IxEdit,设计者可以在不需要通过代码改变,添加,删除或变换页面元素的情况下,在网页上进行动态进行 DOM 脚本编写。 + +![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/ixedit.png) + +### 3) [Komodo Edit][3] ### + +Komodo是一款免费而强大的编辑器,可以用来编辑JavaScript和其他的编程语言。 +![](http://i2.wp.com/devzum.com/wp-content/uploads/2015/01/komodo-edit-e1422674596277.png) + +### 4) [EpicEditor][4] ### + +EpicEditor是一个可嵌入的 JavaScript Markdown 编辑器,具有分割全屏进行编辑,实时预览,自动草稿保存,离线支持等特性。对于开发人员,它提供了健壮的API,可以容易地设置主题,并允许你以任何其他的事物来替换绑定的 Markdown 解析器。 + +![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/epiceditor-e1422674732281.png) + +### 5) [codepress][5] ### + +CodePress是一个基于网络的源代码编辑器,它用 JavaScript 编写,具有语法高亮,并且是在你将代码输入到浏览器后实时进行文本颜色渲染。 + +![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/codepres-e1422674893706.png) + +### 6) [ACe][6] ### + +Ace 是一个使用JavaScript编写的嵌入式代码编辑器,它能够匹配宿主编辑器的特性和性能,例如Sublime,Vim和Textate。它能够容易地嵌入到任何的网页和JavaScript应用中。 + +![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/ace-e1422675089912.png) + +### 7) [scripted][7] ### + +Scripted是一个快速的轻量级代码编辑器,最初是为了JavaScript编写实现的。 Scripted是一个基于浏览器的编辑器,而编辑器本身有本地运行的Node.js服务器实例来提供服务支持。 + +![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/scripted-e1422675188408.png) + +### 8) [Netbeans][8] ### + +这是另外的一个更加震撼而且有用的编辑器,可以用来编写javascript和其他的编程语言。 + +![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/code_editing1-e1422675506226.png) + +### 9) [Webstorm][9] ### + +这是最智能的JavaScript IDE。 它是为使用Node.js进行复杂的客户端开发和服务器端开发而装备的一个轻巧而强大的完美IDE。 + +![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/webstorm.png) + +-------------------------------------------------------------------------------- + +via: http://devzum.com/2015/01/31/9-best-ides-and-code-editors-for-javascript-users/ + +作者:[vikas][a] +译者:[theo-l](https://github.com/theo-l) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://devzum.com/author/vikas/ +[1]:http://spket.com/ +[2]:http://www.ixedit.com/ +[3]:http://komodoide.com/komodo-edit/ +[4]:http://oscargodson.github.io/EpicEditor/ +[5]:http://codepress.sourceforge.net/ +[6]:http://ace.c9.io/#nav=about +[7]:https://github.com/scripted-editor/scripted +[8]:https://netbeans.org/ +[9]:http://www.jetbrains.com/webstorm/ diff --git a/published/201503/20150203 How To Install KDE Plasma 5.2 In Ubuntu 14.10.md b/published/201503/20150203 How To Install KDE Plasma 5.2 In Ubuntu 14.10.md new file mode 100644 index 0000000000..28a49ca44e --- /dev/null +++ b/published/201503/20150203 How To Install KDE Plasma 5.2 In Ubuntu 14.10.md @@ -0,0 +1,60 @@ +如何在Ubuntu 14.10 上安装KDE Plasma 5.2 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Plasma_Ubuntu_1410.jpg) + +[KDE][1] Plasma 5.2已经[发布][2]一段时间了,在本篇中我们将看到如何在Ubuntu 14.10 上安装KDE Plasma 5.2。 + +Ubuntu的默认桌面环境Unity很漂亮还有很多特性,但是如果你问任何有经验的Linux用户关于桌面定制能力,他的回答将是KDE。KDE在定制上是王者并且它得到流行大概是由于Ubuntu有官方的KDE版本,也就是Kubuntu[3]。 + +对于Ubuntu(或者任何其他的Linux系统)而言的一个好消息是它们没有绑定在任何特定的桌面环境上,你可以安装额外的桌面环境并在不同的桌面环境间切换。早先我们已经了解如下的桌面环境的安装。 + +- [如何在Ubuntu 14.04中安装Mate桌面][4] +- [如何在Ubuntu 14.04中安装Cinnamon桌面][5] +- [如何在Ubuntu 14.04中安装Budgie桌面][6] +- [如何在Ubuntu 14.04中安装Gnome Shell][7] + +今天我们要展示如何在Ubuntu 14.10 中如何安装KDE Plasma。 + +### 如何在Ubuntu 14.10 上安装KDE Plasma 5.2 ### + +在Ubuntu 14.10上安装Plasma之前,你要知道这会下载大概1GB的内容。因此在安装KDE之前要考虑速度和数据存放空间。我们下载所使用的PPA是KDE社区官方提供的。在终端中使用下面的命令: + + sudo apt-add-repository ppa:kubuntu-ppa/next-backports + sudo apt-get update + sudo apt-get dist-upgrade + sudo apt-get install kubuntu-plasma5-desktop plasma-workspace-wallpapers + +在安装中,我们要选择默认的显示管理器。我选择的是默认的LightDM。安装完成后,重启系统。在登录时,点击登录区域旁边的Ubuntu图标。这里选择Plasma。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Select_Plasma_KDE_Ubuntu.jpeg) + +你现在就登录到KDE Plasma了。这里有一个KDE Plasma 5.2在Ubuntu 14.10下的截图: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/KDE_Plasma_Desktop.jpeg) + +### 从Ubuntu中卸载KDE Plasma ### + +如果你想要卸载它,使用下面的命令从Ubuntu 14.10中卸载KDE Plasma。 + + sudo apt-get install ppa-purge + sudo apt-get remove kubuntu-plasma5-desktop + sudo ppa-purge ppa:kubuntu-ppa/next + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-kde-plasma-ubuntu-1410/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/Abhishek/ +[1]:https://www.kde.org/ +[2]:https://dot.kde.org/2015/01/27/plasma-52-beautiful-and-featureful +[3]:http://www.kubuntu.org/ +[4]:http://itsfoss.com/install-mate-desktop-ubuntu-14-04/ +[5]:http://itsfoss.com/install-cinnamon-24-ubuntu-1404/ +[6]:http://itsfoss.com/install-budgie-desktop-ubuntu-1404/ +[7]:http://itsfoss.com/how-to-install-gnome-in-ubuntu-14-04/ diff --git a/published/201503/20150205 How To Use Smartphones Like Weather Conky In Linux.md b/published/201503/20150205 How To Use Smartphones Like Weather Conky In Linux.md new file mode 100644 index 0000000000..8eb8647d4e --- /dev/null +++ b/published/201503/20150205 How To Use Smartphones Like Weather Conky In Linux.md @@ -0,0 +1,106 @@ +如何在 Linux 中使用类似智能手机外观的 Conky 天气插件 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Use_Weather_Conky_Linux.jpeg) + +智能手机都拥有一些平滑地融入手机外观的天气小插件,现在幸亏有了 Flair Weather Conky,你便可以**在你的 Linux 桌面中拥有像智能手机一样的天气外观**。我们将使用一个 GUI 工具[Conky Manager 在 Linux 中轻松地管理 Conky][1]。那就先让我们看看如何在 Ubuntu 14.10,14.04、Linux Mint 17 及其他 Linux 发行版本中安装 Conky Manager 吧。 + +### 安装 Conky Manager ### + +打开一个终端并使用下面的命令: + + sudo add-apt-repository ppa:teejee2008/ppa + sudo apt-get update + sudo apt-get install conky-manager + +你可以阅读这篇关于[如何在 Linux 中使用 Conky Manager][1] 的文章。 + +### 确保 `curl` 已被安装 ### + +请确保 [curl][2] 已被安装。如果没有安装它,可以使用下面的命令来安装: + + sudo apt-get install curl + +### 下载 Flair Weather Conky ### + +从下面的链接下载 Flair Weather Conky 的脚本: + +- [下载 Flair Weather Conky 的脚本][3] + +### 在 Conky Manager 中使用 Flair Weather Conky 脚本 ### + +#### 步骤 1: #### + +同你在 Ubuntu 14.04 中安装主题一样,在你的家目录中应该有一个 `.conky` 目录。假如你使用命令行,我想我不需要告诉你如何找到这个目录。对于新手,请用文件管理器切换到你的家目录下,并按 `Ctrl+H` 来 [在 Ubuntu 中显示隐藏文件][4]。在这里查找 `.conky` 文件夹,假如没有这个文件夹,则创建一个。 + +#### 步骤 2: #### + +在 `.conky` 目录中,解压下载到的 Flair Weather 文件。请注意在默认情况下它会自动解压到一个名为 `.conky` 目录下。所以请进入这个目录,将其中的 Flair Weather 文件夹从中取出,然后将它粘贴到真正的 `.conky` 目录下。 + +#### 步骤 3: #### + +Flair Weather 使用 Yahoo 的天气服务,但它不能自动地识别你的位置。你需要手动地编辑它。到[Yahoo 天气][5] 网页,然后通过键入你的城市/Pin 码来得到你所在城市的位置 ID号。你可以从网页地址栏中取得位置 ID 号。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Yahoo_Weather_Location_Code.jpeg) + +#### 步骤 4: #### + +打开 Conky Manager,它应该能够读取新安装的 Conky 脚本。这里有两款样式可用,黑色主题或亮丽主题。你可以选择你偏爱的那一款。当你选择后,你就可以在桌面上看到 conky 的显示了。 + +在 Flair Weather 中,默认位置被设定为 Melbourne。你必须手动编辑 conky 文件来修改。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Using_Weather_Conky_Ubuntu.jpeg) + +#### 步骤 5: #### + +在上面的截图中,你可以看到有一个编辑选定 conky 脚本的选项,在打开的编辑器中,查找 location 或 WOEID ,更换它为你在 `步骤 3` 中得到的位置 ID 号。然后重启 Conky。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Edit_Conky.jpeg) + +在上面查找的相同位置,假如你将`u=c` 替换为`u=f`,则温度的单位将从摄氏温标改为华氏温标 。不要忘了重启 Conky 来查看已经做出的修改。 + +#### 可能的故障排除 #### + +在 Ubuntu 14.04 和 Ubuntu 14.10 中,假如你发现 Conky 展示的时间有重叠现象,则请编辑 conky 脚本。查找下面的这些行: + +``` +## cairo-compmgr +own_window_type override +own_window_argb_visual no +``` + +然后将内容更换为下面的这些行: + + +``` +## cairo-compmgr +own_window_type dock +own_window_argb_visual no +``` + +保存更改并重启 conky。这就应该解决了这个问题。感谢 Jesse(这个 Conky 脚本的开发者)给我们提供了这个解决方法和为其他相关问题给予的支持。 + +### 尝试一下 ### + +在这篇文章中,我们实际上学到了不少东西。我们见证了如何轻松地使用任何 Conky 脚本,如何编辑脚本以及如何使用 Conky Manager 来达到不同的目的。我希望这些对你有用。 + +需要留心的是,Ubuntu 14.10 用户可能会看到重叠的时间数字。请在开发者 Jesse 绝妙的[Google + 主页][6] 中报告任何相关的问题。 + +我已经向你展示了在我的系统上 Flair Weather conky 外观的截图。现在是该你尝试它并炫耀你的桌面的时间了。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/weather-conky-linux/ + +作者:[Abhishek][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/Abhishek/ +[1]:http://www.linux.cn/article-3434-1.html +[2]:http://www.computerhope.com/unix/curl.htm +[3]:http://speedracker.deviantart.com/art/Flair-Weather-Conky-Made-for-Conky-Manager-510130311 +[4]:http://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[5]:https://weather.yahoo.com/ +[6]:https://plus.google.com/communities/104794997718869399105 diff --git a/sources/tech/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md b/published/201503/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md similarity index 69% rename from sources/tech/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md rename to published/201503/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md index 73d91116cb..31a10d3923 100644 --- a/sources/tech/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md +++ b/published/201503/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md @@ -1,14 +1,14 @@ -Linux Basics: Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7 +在CentOS 7上给一个网卡分配多个IP地址 ================================================================================ -Some times you might want to use more than one IP address for your network interface card. What are you going to do? Buy an extra network card and assign new IP? No, It’s not necessary(atleast in the small networks). We can now assign multiple ip addresses to single network interface card in CentOS / RHEL 7 systems. Curious to know how? Well, Follow me, It is not that difficult. +有时你也许想要给一个网卡多个地址。你该怎么做呢?另外买一个网卡来分配地址?在小型网络中其实不用这么做。我们现在可以在CentOS/RHEL 7中给一个网卡分配多个ip地址。想知道怎么做么?好的,跟随我,这并不难。 -First, let us find the IP address of the network card. In my CentOS 7 server, I use only one network card. +首先,让我们找到网卡的IP地址。在我的CentOS 7服务器中,我只使用了一个网卡。 -Run the following command with root user privileges: +用root特权运行下面的命令: ip addr -Sample output: +示例输出: 1: lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 @@ -21,15 +21,15 @@ Sample output: inet 192.168.1.150/24 brd 192.168.1.255 scope global enp0s3 valid_lft forever preferred_lft forever -As you see in the above output, my network card name is enp0s3, and its IP address is 192.168.1.150. +如上所见,我的网卡名是enp0s3,ip地址是192.168.1.150。 -Well, as you may know, the the network card configuration files of your system is stored under **/etc/sysconfig/network-scripts/** directory. Each cards details will be stored in different names, for example **ifcfg-enp0s3**. +如你所知,网卡的配置文件存储在 **/etc/sysconfig/network-scripts/** 目录下。每个网卡的详细内容将会以不同的名字存储,比如**ifcfg-enp0s3**。 -Let us see the details of **ifcfg-enp0s3**. +让我们看下**ifcfg-enp0s3**的细节。 cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 -Sample output: +示例输出: TYPE="Ethernet" BOOTPROTO="none" @@ -50,13 +50,13 @@ Sample output: IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" -Okay, now we will assign multiple addresses in the same subnet. +好的,现在我们将在相同的子网中分配多个地址了。 -Edit file **/etc/sysconfig/network-scripts/ifcfg-enp0s3**: +编辑文件 **/etc/sysconfig/network-scripts/ifcfg-enp0s3**: vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 -Add extra IP addresses one by one as shown below. +像下面那样加入额外的IP地址。 TYPE="Ethernet" BOOTPROTO="none" @@ -79,19 +79,19 @@ Add extra IP addresses one by one as shown below. IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" -As you see above, I have added two more IP addresses: **IPADDR1=”192.168.1.151″ & IPADDR2=”192.168.1.152″** +如你所见,我已经加了两个IP地址:**IPADDR1=”192.168.1.151″ & IPADDR2=”192.168.1.152″** -Like wise, you can add as many a IP addresses you want. +类似地,你可以加入更多的ip地址。 -Finally, save and close the file. Restart network service to take effect the changes. +最后,保存并退出文件。重启网络服务来使更改生效。 systemctl restart network -Now, let us check the IP addresses have been added or not. +现在,让我们检查是否已经加入了ip地址。 ip addr -Sample output: +示例输出: : lo: mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 @@ -110,13 +110,13 @@ Sample output: inet6 fe80::a00:27ff:fe3f:ab68/64 scope link valid_lft forever preferred_lft forever -As you see above, the single network interface card has three IP addresses. +如你所见,单个网卡已经有3个ip地址了。 -Let us ping the newly added IP addresses: +让我们ping一下新增的IP地址: ping -c 4 192.168.1.151 -Sample output: +示例输出: PING 192.168.1.151 (192.168.1.151) 56(84) bytes of data. 64 bytes from 192.168.1.151: icmp_seq=1 ttl=64 time=0.048 ms @@ -132,7 +132,7 @@ Sample output: ping -c 4 192.168.1.152 -Sample output: +示例输出: PING 192.168.1.152 (192.168.1.152) 56(84) bytes of data. 64 bytes from 192.168.1.152: icmp_seq=1 ttl=64 time=0.034 ms @@ -144,9 +144,9 @@ Sample output: 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.034/0.064/0.075/0.018 ms -If you want to use **different subnet**, then you can change the **PREFIX0=24** line to different subnet, such as **PREFIX1=16**. +如果你想要使用**不同的子网**,你要改变**PREFIX0=24**成不同的子网,比如 **PREFIX1=16**。 -For example, I am going to add Class A IP address(**ex.10.0.0.1**) to my network card. +比如,我想要添加一个A类地址(**比如10.0.0.1*)到我的网卡中。 TYPE="Ethernet" BOOTPROTO="none" @@ -171,15 +171,13 @@ For example, I am going to add Class A IP address(**ex.10.0.0.1**) to my network IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" -Do you notice that I have added a Class A type address(10.0.0.1) and prefix=16. +你可以看到我已经添加一个A类地址(10.0.0.1)并且前缀是16。 -Save and close the file. Restart network service, - -Then, ping the new added IP: +保存并退出文件。重启网络服务,接着,ping新增的地址: ping -c 4 10.0.0.1 -Sample output: +示例输出: PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=0.097 ms @@ -191,18 +189,18 @@ Sample output: 4 packets transmitted, 4 received, 0% packet loss, time 3000ms rtt min/avg/max/mdev = 0.073/0.079/0.097/0.014 ms -Similarly, you can add different Gateways too. +相似地,你可以添加不同的网关。 -That’s it. +就是这样。 -------------------------------------------------------------------------------- via: http://www.unixmen.com/linux-basics-assign-multiple-ip-addresses-single-network-interface-card-centos-7/ 作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 -[a]:http://www.unixmen.com/author/sk/ \ No newline at end of file +[a]:http://www.unixmen.com/author/sk/ diff --git a/published/201503/20150209 How to back up a Debian system using backupninja.md b/published/201503/20150209 How to back up a Debian system using backupninja.md new file mode 100644 index 0000000000..33e95473af --- /dev/null +++ b/published/201503/20150209 How to back up a Debian system using backupninja.md @@ -0,0 +1,111 @@ +如何使用 backupninja 来备份 Debian 系统 +================================================================================ +小心谨慎或灾难体验会让每一个系统管理都认识到频繁的系统备份的重要性。你可以通过编写管用的旧式 shell 脚本,或使用一个(或几个)适合这项工作的备份工具来完成备份任务。因此,当你要实施一个备份解决方案时,你了解的备份工具越多,你做出的决策就会越明智。 + +在这篇文章中,我们将为你介绍 [backupninja][2] ,这是一个轻量且易于配置的系统备份工具。在诸如 **rdiff-backup**, **duplicity**, **mysqlhotcopy** 和 **mysqldump** 等程序的帮助下, Backupninja 可以提供常用的备份功能,如执行远程的、安全的和增量式的文件系统备份,加密备份以及 MySQL/MariaDB 数据库备份。你可以选择性地开启使用 Email 状态报告功能,也可以对一般的硬件和系统的信息进行备份。 backupninja 的一个关键功能是它拥有一个内建的基于控制台的向导程序(被称为 **ninjahelper**),而后者允许你为不同的备份情景轻松地创建配置文件。 + +如果非要说的话,backupninja 的缺点是:为了充分使用其所有的功能,它要求安装一些其他“助手”程序。尽管 backupninja 有针对基于 Red Hat(红帽)的发行版本的 RPM 安装包,但 backupninja 针对 Debian 及其衍生发行版本的依赖进行了优化。所以不建议在基于 Red Hat 的系统上尝试 backupninja 。 + +在这篇教程中,我们将介绍如何在基于 Debian 的发行版本上安装 backupninja 。 + +### 安装 Backupninja ### + +以 root 账户来运行下面的命令: + + # aptitude install backupninja + +在安装的过程中,有几个文件和目录将被创建: + +- **/usr/sbin/backupninja** 是个 bash shell 的主脚本; +- **/etc/cron.d/backupninja**, 默认情况下,设置 cron 任务来每隔一个小时运行上面的主脚本; +- **/etc/logrotate.d/backupninja** 截断由 backupninja 程序产生的日志; +- **/etc/backup.d/** 是备份操作的配置文件驻留的目录; +- **/etc/backupninja.conf** 是包含一般选项的主配置文件。这个文件带有良好的注释且详细解释了每个选项的含义; +- **/usr/share/backupninja** 是那些 backupninja 所使用的脚本所处的目录。这些脚本文件负责执行实际的工作。在这个目录中,你还可以找到 `.helper` 文件,它们可以被用来配置和设定 ninjahelper 的菜单; +- **/usr/share/doc/backupninja/examples** 含有操作配置文件(即通过 ninjahelper 产生的文件)的模板。 + +### 首次运行 Ninjahelper ### + +当我们尝试启动 ninjahelper 时,我们可以看到可能需要一个内部依赖程序。假如系统进行了提示,请输入 “yes” 并敲下回车键来安装 dialog(一个用于从 shell 脚本中显示友好对话框的工具)。 + +![](https://farm8.staticflickr.com/7537/15700597667_6618fbc142_z.jpg) + +当你在键入 yes 后再敲回车键时,backupninja 将会安装 dialog,一旦安装完成,将呈现出下面的截屏: + +![](https://farm8.staticflickr.com/7469/15884374871_29f1c9acf1_z.jpg) + +#### 案例 1: 备份硬件和系统信息 #### + +在启动了 ninjahelper 之后,我们将创建一个新的备份操作: + +![](https://farm9.staticflickr.com/8637/15885715132_eb3156678e_z.jpg) + +如果必要的助手程序没有被安装,下面的截屏将会呈现在我们眼前。假如这些软件包已经在你的系统上安装了,请跳过这一步。 + +![](https://farm8.staticflickr.com/7508/15700315139_4c6117ef32_z.jpg) + +接下来的一步需要你选取相关条目来作为此次备份任务的一部分。前四个条目已经默认被选上了,但你可以通过在条目上按空格键来撤消选择。 + +![](https://farm8.staticflickr.com/7507/15699051870_65abaf52e5_z.jpg) + +一旦你完成了上面的步骤,按 OK 选项来继续。接着你将能够选择是愿意使用默认的配置文件(/etc/backup.d/10.sys)来完成这次备份操作,还是创建一个新的配置文件。若为后者,一个含有与默认配置文件内容相同的文件将会在相同的目录下被创建,但它被命名为 11.sys,后续的备份操作将会创建类似的文件(注:只不过命名的序号不同)。需要说明的是一旦这个新的配置文件被创建,你便可以使用你喜爱的文本编辑器来编辑该文件。 + +![](https://farm9.staticflickr.com/8654/15885715072_1e6126e929_o.png) + +#### 案例 2: 一个远程目录的增量式 Rsync 拉取备份 #### + +正如你最有可能知道的那样, rsync 被广泛地用于通过网络同步文件或文件夹。在接下来的例子中,我们将讨论一个使用硬链接来为一个远程目录做增量式拉取备份的方法,它被用来保存历史数据以及在我们本地的文件服务器中恢复这些历史数据。这个方法将帮助我们节省空间并增强位于服务器端的安全性。 + +**步骤 1**:编写一个带有如下内容的自定义脚本,放在 `/etc/backup.d`,并将它的权限设置为 600 。需要说明的是,除了一般的配置文件,这个目录可能还包含当 backupninja 执行时你想运行的一些脚本文件,它们可以发挥出位于主配置文件中的变量的优势。 + + # REMOTE USER + user=root + # REMOTE HOST + host=dev1 + # REMOTE DIRECTORY + remotedir=/home/gacanepa/ + # LOCAL DIRECTORY + localdir=/home/gacanepa/backup.0 + # LOCAL DIRECTORY WHERE PREVIOUS BACKUP WAS STORED + localdirold=/home/gacanepa/backup.1 + mv $localdir $localdirold + # RSYNC + rsync -av --delete --recursive --link-dest=$localdirold $user@$host:$remotedir $localdir + +在上面的配置中, rsync 的 ‘--link-dest’ 选项的作用是为位于 $localdir-old 目录中那些没有改变的文件(包含所有属性) 硬链接到目标目录($localdir)。 + +**步骤 2**:在 backupninja 第一次运行之前,上层目录(这个例子中指的是 /home/gacanepa) 是空的。第一次我们执行下面的命令: + + # backupninja -n + +backup.0 目录就被创建了,并在接下来的过程中,它的名称将会被更改为 backup.1。 + +当我们第二次运行 backupninja 时, backup.0 将会被重新创建,而 backup.1 保持不动。 + +![](https://farm8.staticflickr.com/7581/15700597497_0e0cd89ab9.jpg) + +**步骤 3**: 确保 backup.1 里面的文件硬链接到 backup.0 里的文件,我们可以通过比较文件的 inode(i 节点)数和目录的大小来达到此目的。 + +![](https://farm9.staticflickr.com/8636/15700315029_e922ce771b.jpg) + +### 总结 ### + +Backupninja 不仅是一个经典的备份工具,它也是一个易于配置的实用程序。你可以通过编写你自己的控制脚本,用放在 `/etc.backup.d` 中的不同的配置文件来运行 backupninja 。甚至你还可以为 ninjahelper 编写助手程序,并将其包括在 ninjahelper 的主界面上。 + +例如,假如你在 `/usr/share/backupninja`目录中创建了一个名为 xmodulo 的控制脚本,它将自动运行那些位于 `/etc/backup.d` 目录中以 .xmodulo 为后缀的每个文件。如果你决定添加你的 xmodulo 控制脚本到 ninjahelper 中, 你可以编写相应的助手程序,即 xmodulo.helper 。另外,假如你想 让 backupninja 运行其它的脚本,只需把它添加到 `/etc/backup.d` 目录中就可以了。 + +欢迎使用下面的评论框来留下你的评论、问题或建议。听到你的回应将会使我们很高兴。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/backup-debian-system-backupninja.html + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/gabriel +[1]:http://xmodulo.com/recommend/sysadminbook +[2]:https://labs.riseup.net/code/projects/backupninja diff --git a/published/201503/20150209 Linux FAQs with Answers--How to get the process ID (PID) of a shell script.md b/published/201503/20150209 Linux FAQs with Answers--How to get the process ID (PID) of a shell script.md new file mode 100644 index 0000000000..0e24fa1fb1 --- /dev/null +++ b/published/201503/20150209 Linux FAQs with Answers--How to get the process ID (PID) of a shell script.md @@ -0,0 +1,48 @@ +Linux有问必答:如何在脚本中获取进程ID(PID) +================================================================================ +> **提问**: 我想要知道运行中脚本子shell的进程id。我该如何在shell脚本中得到PID。 + +当我在执行shell脚本时,它会启动一个叫子shell的进程。作为主shell的子进程,子shell将shell脚本中的命令作为批处理运行(因此称为“批处理进程”)。 + +在某些情况下,你也许想要知道运行中的子shell的PID。这个PID信息可以在不同的情况下使用。比如,你可以使用shell脚本的PID在/tmp下创建一个唯一的临时文件。有时侯脚本需要检测所有运行的进程,它可以从进程列表中排除自身的子shell。 + +在bash中,**子shell进程的PID**存储在一个特殊的变量‘$$’中。这个变量只读,你不可以在脚本中修改它。比如: + + #!/bin/bash + + echo "PID of this script: $$" + +上面的脚本会得到下面的输出: + + PID of this script: 6583 + +除了$$, bash shell还会导出其他的只读变量。比如,PPID存储子shell父进程的ID(也就是主shell)。UID存储了执行这个脚本的当前用户ID。比如: + + #!/bin/bash + + echo "PID of this script: $$" + echo "PPID of this script: $PPID" + echo "UID of this script: $UID" + +输出是: + + PID of this script: 6686 + PPID of this script: 4656 + UID of this script: 1000 + +上面输出中,PID每次执行都会变化。这个因为每次运行都会创建一个新的shell。另一方面,PPID每次都会一样只要你在同一个shell中运行。 + +![](https://farm8.staticflickr.com/7437/16274890369_e78ce16d42_b.jpg) + +对于所有bash内置变量列表,参考man页。 + + $ man bash + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/process-id-pid-shell-script.html + +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/201503/20150211 Best Known Linux Archive or Compress Tools.md b/published/201503/20150211 Best Known Linux Archive or Compress Tools.md new file mode 100644 index 0000000000..c570ee62a4 --- /dev/null +++ b/published/201503/20150211 Best Known Linux Archive or Compress Tools.md @@ -0,0 +1,227 @@ +Linux 下最为人熟知的归档/压缩工具 +================================================================================ +很多时候,通过互联网发送或接收大文件和图片是一件令人头疼的事。压缩及解压缩工具正好可以应对这个问题。下面让我们快速浏览一些可以使得我们的工作更加轻松的开源工具。 + +### Tar ### + +Tar 由 'Tape archiver(磁带归档器)' 衍生而来,最初被用来在磁带上归档和存储文件。Tar 是一个 GNU 软件,它可以压缩一组文件(归档),或提取它们以及对已有的归档文件进行相关操作。在存储、备份以及传输文件方面,它是很有用的。在创建归档文件时,Tar 可以保持原有文件和目录结构不变。通过 Tar 归档的文件的后缀名为 ‘.tar’。 + +**基本用法如下:** + +#### a) 创建归档 (c / --create) #### + + tar --create --verbose --file=archive.tar file1 file2 file3 + +或 + + tar cvf archive.tar file1 file2 file3 + +![tar cvf](http://blog.linoxide.com/wp-content/uploads/2015/01/tar-cvf.png) + +*创建一个归档* + +#### b) 列出归档文件内容 ( t / --list) #### + + tar --list archive.tar + +![tar tvf](http://blog.linoxide.com/wp-content/uploads/2015/01/tar-tvf.png) + +*列出归档中包含的文件* + +#### c) 提取归档 (x / --extract) #### + + tar xvf archive.tar + + tar xvf archive.tar --wildcards '*.c' - 从归档中提取后缀名为 *.c 的文件。 + +![tar xvf](http://blog.linoxide.com/wp-content/uploads/2015/01/tar-xvf.png) + +*提取文件* + +![tar xvf --wildcards](http://blog.linoxide.com/wp-content/uploads/2015/01/tar-wildcard.png) + +*只提取需要的文件* + +#### d) 对归档文件进行更新 ( u / --update) #### + + tar uvf archive.tar newfile.c - 假如归档的newfile.c 要比先前已经归档的新,则添加更新的 newfile.c 到归档里面. + +![tar uvf](http://blog.linoxide.com/wp-content/uploads/2015/01/tar-uvf.png) + +*更新一个归档* + +#### e) 从归档中删除文件 (--delete) #### + + tar --delete -f archive.tar file1.c - 从压缩包'archive.tar' 中删除文件'file1.c' + +![tar --delete](http://blog.linoxide.com/wp-content/uploads/2015/01/tar-delete.png) + +*删除文件* + +更加具体的使用方法请参考[tar 主页][1]。 + +### Gzip / Gunzip ### + +Gzip 即 GNU zip,它是一个被广泛用于 Linux 操作系统中的压缩应用,被其压缩的文件的后缀名为'*.gz' 。 + +**基本用法如下:** + +#### a) 压缩文件 #### + + gzip file(s) + +每个文件将被**单独压缩**。 + +![gzip](http://blog.linoxide.com/wp-content/uploads/2015/01/gzip.png) + +*压缩文件* + +通常在压缩完成后,它会将原来的文件删除。我们可以使用 `-c` 选项来保留原来的文件。 + + gzip -c file > file.gz + +![gzip-c](http://blog.linoxide.com/wp-content/uploads/2015/01/gzip-c.png) + +*压缩后保留原有文件* + +我们也可以将一组文件压缩到一个单独的文件中 + + cat file1 file2 file3 | gzip > archieve.gz + +![gz group](http://blog.linoxide.com/wp-content/uploads/2015/01/gz-group.png) + +*压缩一组文件* + +#### b) 检查压缩比 #### + +被压缩文件的压缩比可以使用 ‘-l’ 选项来进行检验。 + + gzip -l archieve.gz + +![gzip -l](http://blog.linoxide.com/wp-content/uploads/2015/01/gzip-l.png) + +*检查压缩率* + +#### c) 解压文件 #### + +Gunzip 用来解压文件,在这里,原有的(压缩)文件在被解压后同样会被删除。使用 `-c`选项来保留原始文件。 + + gunzip -c archieve.gz + +![gunzip -c](http://blog.linoxide.com/wp-content/uploads/2015/01/gunzip-c.png) + +*解压文件* + +gzip 加上'-d'选项 和 gunzip 对压缩文件有同样的效果。 + +更多细节可以从 [gzip 主页][2] 得到。 + +### Bzip2 / Bunzip2 ### + +同 gzip 一样,[Bzip2][3] 也是一个压缩工具,与其他传统的工具相比,它可以将文件压缩到更小,但其缺点为:运行速度比 gzip 慢。 + +**基本用法如下:** + +#### a) 压缩文件 #### + +一般情况下,针对压缩而言,Bzip2 不用什么选项,将被压缩的文件被传递为它的参数。每个文件被单独压缩,且压缩文件以 'bz2' 为后缀名。 + + bzip2 file1 file2 file3 + +![bzip2](http://blog.linoxide.com/wp-content/uploads/2015/01/bzip2.png) + +*文件压缩* + +使用 '-k' 选项可以使得在压缩或解压缩之后保留原有的文件。 + +![bzip2 -k](http://blog.linoxide.com/wp-content/uploads/2015/01/bzip2-k.png) + +*在压缩后保留原有文件* + + +#### b) 解压 #### + +'-d' 选项被用来解压缩。 + +![bzip2 -d](http://blog.linoxide.com/wp-content/uploads/2015/01/bzip2-d.png) + +*使用 -d 选项解压缩文件* + +也可以使用 bunzip2 来解压缩。 + + bunzip2 filename + +![bunzip2](http://blog.linoxide.com/wp-content/uploads/2015/01/bunzip2.png) + +*解压文件* + +bunzip2 可以解压后缀名为 bz2, bz, tbz2 和 tbz 的文件。带有 tbz2 和 tbz 的文件在压缩后,后缀名将变为'.tar' 。 + + bzip2 -dc - 执行解压文件到标准输出的功能。 + +### 7-zip ### + +[7-zip][4] 是另一个开源压缩软件。它使用 7z 这种新的压缩格式,并支持高压缩比。因此,它被认为是比先前提及的压缩工具更好的软件。在 Linux 下,可以通过 p7zip 软件包得到,该软件包里包含 3 个二进制文件: 7z, 7za 和 7zr,读者可以参考 [p7zip wiki][5] 来了解这三个二进制文件之间的不同。在本篇中,我们将使用 7zr 来解释 7-zip 的用法。归档文件以 '.7z' 为后缀名。 + +**基本用法如下:** + +#### a) 创建归档 #### + + 7zr a archive-name.7z file-name(s) / directory-name(s) + +![7zr a](http://blog.linoxide.com/wp-content/uploads/2015/01/7zr-a.png) + +*创建一个归档文件* + +#### b) 列出归档包含文件 #### + + 7zr l archive-name.7z + +![7zr l](http://blog.linoxide.com/wp-content/uploads/2015/01/7zr-l.png) + +*列出归档中包含的文件* + +#### c) 提取归档文件 #### + + 7zr e archive-name.7z + +![7zr e](http://blog.linoxide.com/wp-content/uploads/2015/01/7zr-e.png) + +*提取归档* + +#### d) 更新归档文件 #### + + 7zr u archive-name.7z new-file + +![7zr u](http://blog.linoxide.com/wp-content/uploads/2015/01/7zr-u.png) + +*更新一个归档文件* + +#### e) 从归档文件中删除文件 #### + + 7zr d archive-name.7z file-to-be-deleted + +![7zr d](http://blog.linoxide.com/wp-content/uploads/2015/01/7zr-d.png) + +*删除文件* + +![7zr l](http://blog.linoxide.com/wp-content/uploads/2015/01/7zr-d-l.png) + +*确认文件删除* + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/linux-compress-decompress-tools/ + +作者:[B N Poornima][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bnpoornima/ +[1]:http://www.gnu.org/software/tar/ +[2]:http://www.gzip.org/ +[3]:http://www.bzip.org/ +[4]:http://www.7-zip.org/ +[5]:https://wiki.archlinux.org/index.php/p7zip \ No newline at end of file diff --git a/published/201503/20150211 How To Protect Ubuntu Server Against the GHOST Vulnerability.md b/published/201503/20150211 How To Protect Ubuntu Server Against the GHOST Vulnerability.md new file mode 100644 index 0000000000..243c4212d0 --- /dev/null +++ b/published/201503/20150211 How To Protect Ubuntu Server Against the GHOST Vulnerability.md @@ -0,0 +1,44 @@ +如何让Ubuntu服务器远离鬼影漏洞影响 +================================================================================ +2015年1月27日,GNU C库(glibc)的一个漏洞也称鬼影漏洞被公诸于众。总的来说,这个漏洞允许远程攻击者利用glibc中的GetHOST函数的缓冲区溢出漏洞来获得系统的完全控制。点击[这里][1]获得更多细节。 + +鬼影漏洞可在版本在glibc-2.18之前的Linux系统上被利用。也就是说没有打过补丁的版本2.2到2.17都是有风险的。 + +### 检查系统漏洞 ### + +你可以使用下面的命令来检查glib的版本 + + ldd --version + +### 输出 ### + +ldd (Ubuntu GLIBC 2.19-10ubuntu2) **2.19** +Copyright (C) 2014 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +Written by Roland McGrath and Ulrich Drepper. + +glib的版本应该高于2.17,我们的输出是2.19。如果你看到glib的版本在2.2到2.17之间。你应该运行下面的命令。 + + sudo apt-get update + + sudo apt-get dist-upgrade + +安装完之后,你应该用下面的命令重启系统。 + + sudo reboot + +重启完成之后,你可以用同样的命令来检查glib的版本。 + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/how-to-protect-ubuntu-server-against-the-ghost-vulnerability.html + +作者:[ruchi][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix +[1]:http://chargen.matasano.com/chargen/2015/1/27/vulnerability-overview-ghost-cve-2015-0235.html diff --git a/published/201503/20150215 A Look At What Linux Games We Will See In 2015 And Beyond.md b/published/201503/20150215 A Look At What Linux Games We Will See In 2015 And Beyond.md new file mode 100644 index 0000000000..5def58511a --- /dev/null +++ b/published/201503/20150215 A Look At What Linux Games We Will See In 2015 And Beyond.md @@ -0,0 +1,158 @@ +Linux 游戏之 2015 动向 +================================================================================ +他们说Linux游戏开发已经死了,已经变得毫无意义…… 随他们说去吧。一起看看2015甚至以后会为我们带来什么Linux游戏。 + +真的很难跟得上扑面而来的各种形形色色的新事物,但是可以快速浏览一下我们将会看到的变化。 + +### 已确认的游戏 ### + +#### 冒险游戏 #### + +- [看火人(Firewatch)][1] +- [失落的天堂:初探(Paradise Lost: First Contact)][2] +- [时空英豪 1.1(Outcast 1.1)][42] +- [蒸汽世界:浩劫(SteamWorld Heist)][3] + +#### 动作游戏 #### + +- [暗黑血统(Darksiders)][4] +- [暗黑血统 2(Darksiders 2)][5] +- [尸人的世界(Ray's The Dead)][6] +- [骷髅女孩(Skullgirls)][7] + +#### 第一人称游戏 #### + +- [生化奇兵:永恒(Bioshock Infinite)][8] +- 半条命 3 /troll (Half Life 3 /troll)    +- [烽火家园:革命(Homefront: The Revolution)][9] +- [叛变(Insurgency)][43] +- [杀戮空间 2(Killing Floor 2)][10] +- 英雄萨姆 4(Serious Sam 4)(目前无官方站点) +- [联合风暴(Storm United)][11] +- [烈火击杀(SUPERHOT)][12] + +#### 平台游戏 #### + +- [武装原型(Broforce)][13] +- [峡谷(Chasm)][14] #此处游戏中文名尚不确定 +- [吉安娜姐妹(Giana Sisters)][15] +- [心之所向:Alicia(Heart Forth, Alicia)][16] +- [热铁皮屋顶(Hot Tin Roof)][17] +- [无限工厂(Infinifactory)][18] +- [无敌9号(Mighty No. 9)][19] +- [林中之夜(Night in the Woods)][20] +- [夜(Noct)][21] +- [奇异的世界:新鲜可口(Oddworld: New 'N' Tasty)][22] +- [真红女神(Red Goddess)][23] + +#### 赛车游戏 #### + +- [赛车计划(Project Cars)][44] +- [死亡赛车:再生(Carmageddon: Reincarnation)][45] + +#### 角色扮演游戏 #### + +- [神界:原罪(Divinity: Original Sin)][24] +- [永恒之柱(Pillars Of Eternity)][25] +- [暗影狂奔:香港(Shadowrun: Hong Kong)][26] +- [旗帜的传说(The Banner Saga)][27] +- [镇魂曲:遗器之潮(Torment: Tides of Numenera)][46] + +#### 策略游戏 #### + +- [奇迹时代3(Age of Wonders III)][28] +- [At The Gates][47] # 尚无中文名 +- [放逐之城(Banished)][29] +- [城:天际(Cities: Skylines)][30] +- [发条帝国(Clockwork Empires)][31] +- [Parkitect][32] # 尚无中文名 +- [卷轴(Scrolls)][33] +- [太空海盗和僵尸 2(Space Pirates And Zombies 2)][34] + +#### 沙盒游戏 #### + +- [泰拉瑞亚(Terraria)][35] +- [X 重生(X Rebirth)][36] + +#### 体育游戏 #### + +- [惊爆美国棒球16(Out of the Park Baseball 16)][48] + +### 不太确认,不过可能性高 ### + +- [英雄连 2(Company of Heroes 2)][37] +- [逃生(Outlast)][38] +- [影子武士(Shadow Warrior)][39] +- 无光之海 - 其开发商试验性地构建 Linux 版本,不过这要取决于他们的 Windows 版本的销售情况(据邮件沟通信息) +- [火炬之光 2(Torchlight II)][40] + +然而有[两个来自Feral Interactive的移植大作][49],由于不知道他们是什么,所以没有列举出来。 + +我们猜测Aspyr也在准备新的大制作,但是他们仅仅发布了他们最新的游戏,所以可能要等上几个月我们才能看到些什么。 + +当然,** 这不是完整的列表 **,我们会轻易忘记如此多的游戏正在走向我们,哇,如此丰富的列表。 + +我们也期待 GDC 2015 上有一些改变,然而,我们没有什么确切的东西,对于Valve与Steam Machines的合作,我们期待至少会增加一些Linux游戏,否则,如我们担心,炫耀一些过时的游戏会让Valve脸上无光。 + +希望我们没有错过那些 Linux 中让你感到兴奋的东西! + +-------------------------------------------------------------------------------- + +via: http://www.gamingonlinux.com/articles/a-look-at-what-linux-games-we-will-see-in-2015-and-beyond.4963 + +作者:[liamdawe][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.gamingonlinux.com/profiles/1 +[1]:https://www.gamingonlinux.com/articles/category/17/articles/firewatch-a-first-person-mystery-game-finally-reveals-itself-in-a-trailer.4231 +[2]:http://www.asthreeworks.com/games/ +[3]:https://www.gamingonlinux.com/articles/category/17/articles/image-form-announces-steamworld-heist.4304 +[4]:https://www.gamingonlinux.com/articles/darksiders-linux-port-looks-like-it-is-still-happening.4893 +[5]:https://www.gamingonlinux.com/articles/darksiders-2-confirmed-for-linux.4154 +[6]:http://ragtagstudio.com/?page_id=457 +[7]:https://www.gamingonlinux.com/articles/editorial-skullgirls-on-linux-finally-shows-some-progress.4789 +[8]:https://www.gamingonlinux.com/articles/bioshock-infinite-looks-set-for-a-linux-release-confirmed.4668 +[9]:http://www.homefront-game.com/ +[10]:https://www.gamingonlinux.com/articles/category/17/articles/killing-floor-2-fps-has-a-new-trailer.4676 +[11]:https://www.gamingonlinux.com/articles/storm-united-online-fps-shows-first-real-gameplay-video-first-alpha-due-soon.4872 +[12]:http://superhotgame.com/ +[13]:http://steamcommunity.com/app/274190/discussions/0/540738051503306548/#c540738051518330743 +[14]:https://www.gamingonlinux.com/articles/category/17/articles/chasm-rpg-platformer-will-have-a-same-day-linux-release.4266 +[15]:https://www.gamingonlinux.com/articles/linux-port-of-platformer-giana-sisters-brought-inhouse-sequel-might-get-sameday-release.4913 +[16]:http://www.alonsomartin.mx/hfa/ +[17]:http://www.hottinroofgame.com/ +[18]:https://twitter.com/zachtronics/status/566016742825005057 +[19]:http://www.mightyno9.com/ +[20]:http://www.nightinthewoods.com/ +[21]:https://www.gamingonlinux.com/articles/category/17/articles/noct-a-fantastic-top-down-thermal-image-survival-horror-game.4783 +[22]:https://www.gamingonlinux.com/articles/puzzle-platformer-oddworld-new-n-tasty-will-release-for-linux-next-month.4836 +[23]:https://www.gamingonlinux.com/articles/new-trailer-for-platformer-red-goddesss-looks-really-good.4939 +[24]:https://www.gamingonlinux.com/articles/divinity-original-sin-is-pushing-ahead-for-the-linux-release.4938 +[25]:https://www.gamingonlinux.com/articles/pillars-of-eternity-the-rpg-aims-for-a-sameday-linux-release-on-march-26th.4834 +[26]:https://www.kickstarter.com/projects/webeharebrained/shadowrun-hong-kong +[27]:https://www.gamingonlinux.com/articles/the-banner-saga-rpg-looks-close-to-a-linux-version.4862 +[28]:https://www.gamingonlinux.com/articles/the-linux-port-of-age-of-wonders-iii-is-progressing-a-bit-too-explosive-right-now.4857 +[29]:https://www.gamingonlinux.com/articles/banished-survival-city-building-sim-is-being-ported-to-linux.4813 +[30]:https://www.gamingonlinux.com/articles/city-builder-game-cities-skylines-now-has-a-release-date.4954 +[31]:https://www.gamingonlinux.com/articles/clockwork-empires-still-pushing-towards-a-linux-version-suffering-delays.4734 +[32]:https://www.gamingonlinux.com/articles/category/17/articles/parkitect-what-roller-coaster-tycoon-should-have-grown-into.4528 +[33]:https://www.gamingonlinux.com/articles/mojangs-scrolls-now-has-an-experimental-linux-build.4450 +[34]:https://www.gamingonlinux.com/articles/space-pirates-and-zombies-2-reveals-the-zombies-in-a-brand-new-video.4759 +[35]:https://www.gamingonlinux.com/articles/terraria-officially-confirmed-to-be-in-development-for-linux-finally.4299 +[36]:https://www.gamingonlinux.com/articles/egosofts-x-rebirth-actively-being-ported-to-linux.4822 +[37]:https://www.gamingonlinux.com/articles/company-of-heroes-2-looks-like-it-is-heading-to-linux.4199 +[38]:https://www.gamingonlinux.com/articles/outlast-that-really-scary-game-looks-like-its-still-heading-to-linux.4896 +[39]:https://www.gamingonlinux.com/articles/shadow-warrior-looks-like-it-will-come-to-linux.4859 +[40]:https://www.gamingonlinux.com/articles/torchlight-ii-has-even-more-positive-signs-for-linux.4817 +[41]:https://www.gamingonlinux.com/articles/feralinteractive.com/en/upcoming/ +[42]:https://www.gamingonlinux.com/articles/outcast-a-real-classic-has-been-revamped-and-linux-is-planned.4736 +[43]:https://www.gamingonlinux.com/articles/insurgency-fps-is-waiting-on-valve-so-it-can-come-to-linux-updated.4564 +[44]:http://projectcarsgame.com/ +[45]:https://www.gamingonlinux.com/articles/carmageddon-reincarnations-jason-garber-answers-our-questions-on-their-linux-support.3380 +[46]:https://www.gamingonlinux.com/articles/torment-tides-of-numenera-new-video-looks-absolutely-stunning.4320 +[47]:http://www.atthegatesgame.com/info +[48]:http://www.ootpdevelopments.com/newsletters/nl0154/ +[49]:http://feralinteractive.com/en/upcoming/ \ No newline at end of file diff --git a/published/201503/20150215 How To Make GDebi Default Instead of Ubuntu Software Center.md b/published/201503/20150215 How To Make GDebi Default Instead of Ubuntu Software Center.md new file mode 100644 index 0000000000..9e6499eb2b --- /dev/null +++ b/published/201503/20150215 How To Make GDebi Default Instead of Ubuntu Software Center.md @@ -0,0 +1,46 @@ +如何使 GDebi 默认代替 Ubuntu 软件中心 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Make_GDebi_Default.jpeg) + +如果你使用 Ubuntu 或基于 Ubuntu 的 Linux 发行版本,比如Elementary OS Freya,也许你使用 Ubuntu 软件中心来安装 `.deb` 可执行文件。对于查找和安装应用,Ubuntu 软件中心是一个很好的应用,但它会消耗很多资源且运行速度缓慢。这就是为什么我更偏爱使用 [一个 Ubuntu 软件中心的轻量级替代品——App Grid][1] 的原因。 + +现在,假如你只是尝试安装一个 `.deb` 文件,我不会向你推荐 Ubuntu 软件中心或 App Grid ,我的建议为 GDebi,一个安装 Debian 可执行文件的专用程序。它极其轻量,且专注于安装 `.deb` 文件。GDebi 最有用的功能是它也可以为你展示出将要安装的程序的依赖。 + +在这篇文章中,我们将看一看 **如何安装 GDebi 以及使用它代替 Ubuntu 软件中心作为默认的安装器**。 + +### 在 Ubuntu 和其他 Linux 发行版本中安装 GDebi ### + +打开终端并使用下面的命令: + + sudo apt-get install gdebi + +### 使得 GDebi 成为默认的 `.deb`包安装器 ### + +一旦你安装了 GDebi,就是时候来看看如何使它成为安装 `.deb` 文件的默认应用了。请读者注意在这篇教程中我使用的是 Elementary OS Freya ,但下面的步骤对于所有基于 Ubuntu 的发行版本都是适用的。可能截屏显示会有点不同。 + +首先下载一个 `.deb`文件。例如你已经下载了一个 Google Chrome 的 `.deb`包。进入下载目录并右击该 `.deb`文件。在这里,接着选择 **属性**选项。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/GDebi_default.jpeg) + +在属性中,你应该可以看到 **打开方式** 选项。点击它并选择为 GDebi。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/GDebi_default_Ubuntu.jpeg) + +这样下次你双击一个 `.deb` 文件,便会自动打开 GDebi 来安装这个`.deb` 文件。使用这样轻量级的应用的确是一个[加速 Ubuntu][2] 或其他 Linux 系统的好方法。 + +你怎么看呢?对于安装应用,你仍然偏爱 Ubuntu 软件中心还是 GDebi 呢?如果你是一个守旧派,也许你更喜欢 [新立得软件包管理器(Synaptic Package Manager)][3]?那么,哪一个是你的最爱? + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/gdebi-default-ubuntu-software-center/ + +作者:[Abhishek][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/app-grid-lighter-alternative-ubuntu-software-center/ +[2]:http://itsfoss.com/speed-up-ubuntu-1310/ +[3]:http://www.nongnu.org/synaptic/ diff --git a/published/201503/20150225 10 quick tar command examples to create or extract archives in Linux.md b/published/201503/20150225 10 quick tar command examples to create or extract archives in Linux.md new file mode 100644 index 0000000000..6d851ee0cc --- /dev/null +++ b/published/201503/20150225 10 quick tar command examples to create or extract archives in Linux.md @@ -0,0 +1,187 @@ +在linux中创建和解压文档的11个 tar 命令例子 +================================================================================ +### linux中的tar命令### + +tar(磁带归档)命令是linux系统中被经常用来将文件存入到一个归档文件中的命令。 + +其常见的文件扩展包括:.tar.gz 和 .tar.bz2, 分别表示通过了gzip或bzip算法进一步进行了压缩。 + +在本教程中我们会管中窥豹一下在linux桌面或服务器版本中使用tar命令来处理一些创建和解压归档文件的日常工作的例子。 + +### 使用tar命令### + +tar命令在大部分linux系统默认情况下都是可用的,所以你不用单独安装该软件。 + +> tar命令具有两个压缩格式,gzip和bzip,该命令的“z”选项用来指定gzip,“j”选项用来指定bzip。同时也可以创建非压缩归档文件。 + +#### 1.解压一个tar.gz归档 #### + +一般常见的用法是用来解压归档文件,下面的命令将会把文件从一个tar.gz归档文件中解压出来。 + + $ tar -xvzf tarfile.tar.gz + +这里对这些参数做一个简单解释- + +> x - 解压文件 + +> v - 冗长模式,在解压每个文件时打印出文件的名称。 + +> z - 该文件是一个使用 gzip 压缩的文件。 + +> f - 使用接下来的tar归档来进行操作。 + +这些就是一些需要记住的重要选项。 + +**解压 tar.bz2/bzip 归档文件** + +具有bz2扩展名的文件是使用bzip算法进行压缩的,但是tar命令也可以对其进行处理,但是需要通过使用“j”选项来替换“z”选项。 + + $ tar -xvjf archivefile.tar.bz2 + +#### 2.将文件解压到一个指定的目录或路径 #### + +为了将文件解压到一个指定的目录中,使用“-C”选项来指定路径,此处的“C”是大写“C”。 + + $ tar -xvzf abc.tar.gz -C /opt/folder/ + +然后,首先需要确认目标目录是否存在,毕竟tar命令并不会为你创建目录,所以如果目标目录不存在的情况下该命令会失败。 + +####3. 提取出单个文件 #### + +为了从一个归档文件中提取出单个文件,只需要将文件名按照以下方式将其放置在命令后面。 + + $ tar -xz -f abc.tar.gz "./new/abc.txt" + +在上述命令中,可以按照以下方式来指定多个文件。 + + $ tar -xz -f abc.tar.gz "./new/cde.txt" "./new/abc.txt" + +#### 4.使用通配符来解压多个文件 #### + +通配符可以用来解压于给定通配符匹配的一批文件,例如所有以".txt"作为扩展名的文件。 + + $ tar -xz -f abc.tar.gz --wildcards "*.txt" + +#### 5. 列出并检索tar归档文件中的内容 #### + +如果你仅仅想要列出而不是解压tar归档文件的中的内容,使用“-t”(test)选项, 下面的命令用来打印一个使用gzip压缩过的tar归档文件中的内容。 + + $ tar -tz -f abc.tar.gz + ./new/ + ./new/cde.txt + ./new/subdir/ + ./new/subdir/in.txt + ./new/abc.txt + ... + +可以将输出通过管道定向到grep来搜索一个文件,或者定向到less命令来浏览内容列表。 使用"v"冗长选项将会打印出每个文件的额外详细信息。 + +对于 tar.bz2/bzip文件,需要使用"j"选项。 + +结合上述的命令和grep命令来检索归档文件,如下所示。简单吧! + + $ tar -tvz -f abc.tar.gz | grep abc.txt + -rw-rw-r-- enlightened/enlightened 0 2015-01-13 11:40 ./new/abc.txt + +#### 6.创建一个tar/tar.gz归档文件 #### + +现在我们已经学过了如何解压一个tar归档文件,是时候开始创建一个新的tar归档文件了。tar命令可以用来将所选的文件或整个目录放入到一个归档文件中,以下是相应的样例。 + +下面的命令使用一个目录来创建一个tar归档文件,它会将该目录中所有的文件和子目录都加入到归档文件中。 + + $ tar -cvf abc.tar ./new/ + ./new/ + ./new/cde.txt + ./new/abc.txt + +上述命令不会创建一个压缩的的归档文件,只是一个普通的归档文件,只是将多个文件放入到一个归档文件中并没有真正地压缩每个文件。 + +为了使用压缩,可以分别使用“z”或“j”选项进行gzip或bzip压缩算法。 + + $ tar -cvzf abc.tar.gz ./new/ + +> 文件的扩展名其实并不真正有什么影响。“tar.gz” 和“tgz”是gzip压缩算法压缩文件的常见扩展名。 “tar.bz2”和“tbz”是bzip压缩算法压缩文件的常见扩展名(LCTT 译注:归档是否是压缩的和采用哪种压缩方式并不取决于其扩展名,扩展名只是为了便于辨识。)。 + +#### 7. 在添加文件之前进行确认 #### + +一个有用的选项是“w”,该选项使得tar命令在添加每个文件到归档文件之前来让用户进行确认,有时候这会很有用。 + +使用该选项时,只有用户输入“y”时的文件才会被加入到归档文件中,如果你不输入任何东西,其默认表示是一个“n”。 + + # 添加指定文件 + + $ tar -czw -f abc.tar.gz ./new/* + add ‘./new/abc.txt’?y + add ‘./new/cde.txt’?y + add ‘./new/newfile.txt’?n + add ‘./new/subdir’?y + add ‘./new/subdir/in.txt’?n + + #现在列出所有被加入的文件 + + $ tar -t -f abc.tar.gz + ./new/abc.txt + ./new/cde.txt + ./new/subdir/ + +#### 8. 加入文件到存在的归档文件中 #### + +“r”选项可以被用来将文件加入到已存在的归档文件中,而不用创建一个新的归档文件,下面是一个简单的样例: + + $ tar -rv -f abc.tar abc.txt + +> 文件并不能加入到已压缩的归档文件中(gz 或 bzip)。文件只能被加入到普通的归档文件中。 + +#### 9. 将文件加入到压缩的归档文件中(tar.gz/tar.bz2) #### + +之前已经提到了不可能将文件加入到已压缩的归档文件中,然而依然可以通过简单的一些把戏来完成。使用gunzip命令来解压缩归档文件,然后将文件加入到归档文件中后重新进行压缩。 + + $ gunzip archive.tar.gz + $ tar -rf archive.tar ./path/to/file + $ gzip archive.tar + +对于bzip文件分别使用bzip2和bunzip2。 + +#### 10.通过tar来进行备份 #### + +一个真实的场景是在固定的时间间隔内来备份目录,tar命令可以通过cron调度来实现这样的一个备份,以下是一个样例 : + + $ tar -cvz -f archive-$(date +%Y%m%d).tar.gz ./new/ + +使用cron来运行上述的命令会保持创建类似以下名称的备份文件 :'archive-20150218.tar.gz'。 + +当然,需要确保日益增长的归档文件不会导致磁盘空间的溢出。 + +#### 11. 在创建归档文件时进行验证 #### + +"W"选项可以用来在创建归档文件之后进行验证,以下是一个简单例子。 + + $ tar -cvW -f abc.tar ./new/ + ./new/ + ./new/cde.txt + ./new/subdir/ + ./new/subdir/in.txt + ./new/newfile.txt + ./new/abc.txt + Verify ./new/ + Verify ./new/cde.txt + Verify ./new/subdir/ + Verify ./new/subdir/in.txt + Verify ./new/newfile.txt + Verify ./new/abc.txt + +需要注意的是验证动作不能在压缩过的归档文件上进行,只能在非压缩的tar归档文件上执行。 + +这次就先到此为止,可以通过“man tar”命令来查看tar命令的的手册。 + +-------------------------------------------------------------------------------- + +via: http://www.binarytides.com/linux-tar-command/ + +作者:[Silver Moon][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117145272367995638274/posts diff --git a/published/201503/20150225 How to Hide PHP Version in Linux.md b/published/201503/20150225 How to Hide PHP Version in Linux.md new file mode 100644 index 0000000000..89dcdf4f75 --- /dev/null +++ b/published/201503/20150225 How to Hide PHP Version in Linux.md @@ -0,0 +1,58 @@ +如何在Linux服务器中隐藏PHP版本 +================================================================================ +通常,大多数默认设置安装的web服务器存在信息泄露,这其中之一就是PHP。PHP 是如今流行的服务端html嵌入式语言(之一?)。在如今这个充满挑战的时代,有许多攻击者会尝试发现你服务端的漏洞。因此,我会简单描述如何在Linux服务器中隐藏PHP信息。 + +默认上**expose_php**默认是开的。关闭“expose_php”参数可以使php隐藏它的版本信息。 + + [root@centos66 ~]# vi /etc/php.ini + +在你的php.ini, 定位到含有expose_php的那行把On设成Off: + + expose_php = Off + +在此之前,web服务器头看上去就像这样: + + [root@centos66 ~]# curl -I http://www.ehowstuff.com/ + +---------- + + HTTP/1.1 200 OK + Server: nginx + Content-Type: text/html; charset=UTF-8 + Vary: Accept-Encoding + X-Powered-By: PHP/5.3.3 + X-Pingback: http://www.ehowstuff.com/xmlrpc.php + Date: Wed, 11 Feb 2015 14:10:43 GMT + X-Page-Speed: 1.9.32.2-4321 + Cache-Control: max-age=0, no-cache + +更改并重启 Web 服务后,php就不会在web服务头中显示版本了: + +```[root@centos66 ~]# curl -I http://www.ehowstuff.com/ + +HTTP/1.1 200 OK +Server: nginx +Date: Wed, 11 Feb 2015 15:38:14 GMT +Content-Type: text/html; charset=UTF-8 +Vary: Accept-Encoding +X-Pingback: http://www.ehowstuff.com/xmlrpc.php +Date: Wed, 11 Feb 2015 14:10:43 GMT +X-Page-Speed: 1.9.32.2-4321 +Cache-Control: max-age=0, no-cache +``` + +LCTT译注:除了 PHP 的版本之外,Web 服务器也会默认泄露版本号。如果使用 Apache 服务器,请[参照此文章关闭Apache 版本显示][2];如果使用 Nginx 服务器,请在 http 段内加入`server_tokens off;` 配置。以上修改请记得重启相关服务。 + +-------------------------------------------------------------------------------- + +via: http://www.ehowstuff.com/how-to-hide-php-version-in-linux/ + +作者:[skytech][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ehowstuff.com/author/mhstar/ +[1]:http://www.ehowstuff.com/archives/ +[2]:http://linux.cn/article-3642-1.html \ No newline at end of file diff --git a/published/201503/20150225 Italian Region Emilia-Romagna Is Switching To OpenOffice.md b/published/201503/20150225 Italian Region Emilia-Romagna Is Switching To OpenOffice.md new file mode 100644 index 0000000000..4ebb83401f --- /dev/null +++ b/published/201503/20150225 Italian Region Emilia-Romagna Is Switching To OpenOffice.md @@ -0,0 +1,39 @@ +意大利艾米利亚-罗马涅大区正在切换到OpenOffice +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/Turin_Open_Source.jpg) + +在拥抱开源的道路上,意大利似乎走在了最前面。我们已经知道,很多意大利的城市如[乌迪内][1],[都灵][2],[Todi和都灵][3]过去已经选择了[开源办公套件以取代微软的Office][4]。现在,位于意大利北部的[艾米利亚-罗马涅大区][5](位于意大利北部,是意大利20个大区之一)也将在下个月完成向[Apache OpenOffice][6]的过渡。 + +### 切换到 OpenOffice ### + +这次向OpenOffice的迁移将会在下个月完成,而且将会覆盖4200个计算机工作站,涉及到10个部门和5个代理机构。 而且,开源文档格式(ODF)也将成为默认的文档格式。向OpenOffice的过渡最初在2013年底被提出来,原本打算在2014年底完成。这次从商业办公产品改用OpenOffice,从授权费用来说,据信会[节约大概2 000 000欧元][7]。 + +为了使这次顺利搬家和方便内部操作,负责这次搬家的团队正在开发许多定制工具和插件。 + +本次项目的负责人,Giovanni Grazia对本次“搬家”充满激情,但同时他也做好了应对批评的准备: + +> “改用新的办公套件并不是一件容易完成的工作,我们借这次机会来拥护免费和开源的软件。一些地区的公务员表示高度支持,而另一些则感到厌烦,因为他们已经使用商业产品二十年了。为了处理任何在迁移中发生的问题,一个有着三个IT专家的五人支持团队正在一个部门接一个部门,逐渐地完成这次迁移。” + +### 祝愿 ### + +我希望其他的国家也能使用OpenOffice套件,祝愿所有迁移到开源软件的人或国家都顺利完成。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/emiliaromagna-completes-switch-openoffice/ + +作者:[Abhishek][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://linux.cn/article-3853-1.html +[2]:http://linux.cn/article-3602-1.html +[3]:http://itsfoss.com/italian-cities-switch-libreoffice/ +[4]:http://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ +[5]:http://en.wikipedia.org/wiki/Emilia-Romagna +[6]:https://www.openoffice.org/ +[7]:http://www.slwoods.co.uk/?p=2886 +[8]:http://itsfoss.com/french-city-toulouse-saved-1-million-euro-libreoffice/ diff --git a/published/201503/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md b/published/201503/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md new file mode 100644 index 0000000000..3c0f4ec412 --- /dev/null +++ b/published/201503/20150225 Linux FAQs with Answers--How to install full kernel source on Debian or Ubuntu.md @@ -0,0 +1,58 @@ +Linux有问必答:如何在Debian或Ubuntu上安装完整的内核源码 +================================================================================ +> **问题**:我需要为我的Debian或Ubuntu下载并安装完整树结构的内核源码以供编译一个定制的内核。那么在Debian或Ubuntu上有什么可行的方法来下载完整的内核源码呢? + +在给你的Linux安装完整内核源码之前,先问问自己是否真的需要这样做。如果你仅仅是尝试去编译一个内核模块或是为内核定制驱动,你并不需要完整的内核源码树。你只需要安装[一些与内核对应的头文件][1],这样就足够了。 + +只有在你需要生成一个定制的内核,而且内核源码中的一些内核默认设置要被你调整了的情况下,你才需要完整的内核源码树。 + +这里将会解答如何**在Debian或Ubuntu的库中下载并安装完整树结构的内核源码**。你可以在[https://www.kernel.org/pub/linux/kernel/][2]下载官方的内核源码,不过使用发行版软件仓库可以允许你下载包含补丁的内核源码。 + +### 在Debian上安装完整的内核源码 ### + +在下载内核源码之前,先安装dpkg-dev,其中包含你在Debian上生成源代码时需要的开发工具套件。不仅如此,dpkg-dev中还包含在用来解压Debian源码包并自动打补丁的工具dpgk-source。 + + $ sudo apt-get install dpkg-dev + +然后,运行以下命令下载完整的内核源码。 + + $ apt-get source linux-image-$(uname -r) + +伴随着完整内核源码(linux_X.X.XX.orig.tar.xz)的还有一些可用的内核补丁(linux_X.X.X+XXX.debian.tar.xz)和源码控制文件(linux_XXXX.dsc),这些都将被下载并存储到当前目录。在.dsc文件中会指出如何给内核源码打补丁。 + +当下载完成,以上的命令将会自动调用工具dpkg-source将下载的内核源码解压到当前的目录中,与此同时根据.dsc文件来下补丁。 + +最终完整的内核源码树将会以"linux-X.X.XX"的形式呈现在当前目录中。 + +![](https://farm9.staticflickr.com/8676/16341110300_b4f059eeb0_b.jpg) + +### 在Ubuntu上安装完整内核源码 ### + +如果你想安装完整内核源码的话,以上在Debian上的那一套做法在Ubuntu上仍然奏效。 + +在Ubuntu上还有另一套方法安装完整内核源码。事实上,你可以查一下由Canonical为Ubuntu不同发行版维护的内核源码树。 + + $ sudo apt-get install git + $ git clone git://kernel.ubuntu.com/ubuntu/ubuntu-$(lsb_release --codename | cut -f2).git + +举个例子,如果你使用的是Ubuntu 14.04,以上的命令将会查看Git的"ubuntu-trusty"仓库中的代码。 + +![](https://farm9.staticflickr.com/8642/16526856391_de636ff9b8_c.jpg) + +一旦在你对Git仓库的查询结束后,使用以下的命令来安装用来访问生成内核源码树所需依赖的重要开发包。 + + $ sudo apt-get build-dep linux-image-$(uname -r) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-full-kernel-source-debian-ubuntu.html + +作者:[Dan Nanni][a] +译者:[martin qi](https://github.com/martin2011qi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://ask.xmodulo.com/install-kernel-headers-linux.html +[2]:https://www.kernel.org/pub/linux/kernel/ diff --git a/published/201503/20150304 Linux Basics--How To Find Maximum Supported RAM By Your System.md b/published/201503/20150304 Linux Basics--How To Find Maximum Supported RAM By Your System.md new file mode 100644 index 0000000000..14bc56c329 --- /dev/null +++ b/published/201503/20150304 Linux Basics--How To Find Maximum Supported RAM By Your System.md @@ -0,0 +1,696 @@ +Linux基础:如何找出你的系统所支持的最大内存 +================================================================================ +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/RAM-790x527.jpg) + +大多数情况下你可以从BIOS、产品目录或者干脆手动找出你的系统所持的最大内存。这里,我们介绍一种简单有用的技巧——使用Dmidecode来找出系统支持的最大内存,这样你就无需打开机箱或者参照BIOS和产品目录了。 + +### 什么是 Dmidecode? ### + +就像你可能知道的一样, **Dmidecode**是一个将计算机DMI(又名SMBIOS)表的内容转换为可读格式的工具。这个表包含了系统硬件组件的介绍以及其他一些如序列号和IOS版本等有用的信息。使用Dmidecode你能够获取此项信息,而无需去探测真实的硬件。 + +### 找出你的系统所支持的最大内存 ### + +请确定你已经在系统中安装了dmidecode,我觉得你的操作系统应该已经自动安装过了,不过并不非常确定。 + +**在基于Deb的系统中安装** + + sudo apt-get install dmidecode + +**在基于RPM的系统中安装** + + sudo yum install dmidecode + +**在SUSE/openSUSE中安装** + + sudo zypper in dmidecode + +好了,我们已经安装了dmidecode,接下来让我们找出支持的最大内存。输入以下命令: + + sudo dmidecode -t 16 + +**输出样本** + + # dmidecode 2.12 + SMBIOS 2.6 present. + + Handle 0x0014, DMI type 16, 15 bytes + Physical Memory Array + Location: System Board Or Motherboard + Use: System Memory + Error Correction Type: None + Maximum Capacity: 16 GB + Error Information Handle: Not Provided + Number Of Devices: 2 + +就像你看到的,我的系统支持最大内存到16G,并且有两个内存插槽,简单吧? + +接下来,让我们找出现在已经安装的内存的详细信息。 + + sudo dmidecode -t 17 + +**输出样本** + + # dmidecode 2.12 + SMBIOS 2.6 present. + + Handle 0x0017, DMI type 17, 28 bytes + Memory Device + Array Handle: 0x0014 + Error Information Handle: 0x0000 + Total Width: Unknown + Data Width: Unknown + Size: No Module Installed + Form Factor: DIMM + Set: None + Locator: DIMM_B + Bank Locator: BANK 2 + Type: Unknown + Type Detail: None + Speed: Unknown + Manufacturer: Not Specified + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Rank: Unknown + + Handle 0x0015, DMI type 17, 28 bytes + Memory Device + Array Handle: 0x0014 + Error Information Handle: 0x0000 + Total Width: 64 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: SODIMM + Set: None + Locator: DIMM_A + Bank Locator: BANK 0 + Type: DDR3 + Type Detail: Synchronous + Speed: 1067 MHz + Manufacturer: 014F + Serial Number: 00092AF2 + Asset Tag: 54114000 + Part Number: JM1066KSN-4G + Rank: Unknown + +就像上边输出的一样,我在插槽1里边安装了一个内存条。内存大小为**4G**,类型为**DDR3**,速度为**1067 MHz**。 + +同样的,我们可以通过下边命令得到完整的内存信息。 + + sudo dmidecode -t memory + sudo dmidecode -t memory | less + sudo dmidecode -t memory | more + +**输出样本** + + # dmidecode 2.12 + SMBIOS 2.6 present. + + Handle 0x0014, DMI type 16, 15 bytes + Physical Memory Array + Location: System Board Or Motherboard + Use: System Memory + Error Correction Type: None + Maximum Capacity: 16 GB + Error Information Handle: Not Provided + Number Of Devices: 2 + + Handle 0x0017, DMI type 17, 28 bytes + Memory Device + Array Handle: 0x0014 + Error Information Handle: 0x0000 + Total Width: Unknown + Data Width: Unknown + Size: No Module Installed + Form Factor: DIMM + Set: None + Locator: DIMM_B + Bank Locator: BANK 2 + Type: Unknown + Type Detail: None + Speed: Unknown + Manufacturer: Not Specified + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Rank: Unknown + + Handle 0x0015, DMI type 17, 28 bytes + Memory Device + Array Handle: 0x0014 + Error Information Handle: 0x0000 + Total Width: 64 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: SODIMM + Set: None + Locator: DIMM_A + Bank Locator: BANK 0 + Type: DDR3 + Type Detail: Synchronous + Speed: 1067 MHz + Manufacturer: 014F + Serial Number: 00092AF2 + Asset Tag: 54114000 + Part Number: JM1066KSN-4G + Rank: Unknown + +如果你好奇想要知道整个系统的详细信息,例如主板、内存、BIOS等,那么可以输入以下命令来获取。 + + sudo dmidecode + +**输出样本** + + # dmidecode 2.12 + SMBIOS 2.6 present. + 48 structures occupying 2173 bytes. + Table at 0x000EB840. + + Handle 0xDA00, DMI type 218, 251 bytes + OEM-specific Type + Header and Data: + DA FB 00 DA B2 00 0D 5F 0F 37 40 7D 00 00 00 00 + 00 7E 00 01 00 00 00 DC 01 00 80 02 00 DD 01 00 + 80 03 00 75 01 01 80 01 00 76 01 02 80 01 00 2D + 01 03 80 01 00 2E 01 03 80 00 00 81 01 07 80 00 + 00 82 01 07 80 01 00 83 01 08 80 00 00 84 01 08 + 80 01 00 85 01 06 80 00 00 86 01 06 80 01 00 58 + 02 05 80 00 00 57 02 05 80 01 00 9C 00 02 00 01 + 00 9B 00 02 00 00 00 8A 01 03 00 01 00 89 01 03 + 00 00 00 7F 01 04 00 00 00 80 01 04 00 01 00 53 + 01 05 00 00 00 52 01 05 00 01 00 7B 01 06 00 00 + 00 7C 01 06 00 01 00 94 01 07 00 00 00 93 01 07 + 00 01 00 7D 00 08 00 00 00 2D 00 09 00 01 00 2E + 00 09 00 00 00 6E 00 0A 00 00 00 95 00 0B 00 01 + 00 96 00 0B 00 00 00 2F 02 0C 00 01 00 30 02 0C + 00 00 00 50 02 0D 00 00 00 51 02 0D 00 01 00 52 + 02 0D 00 02 00 FF FF 00 00 00 00 + + Handle 0xDA01, DMI type 218, 59 bytes + OEM-specific Type + Header and Data: + DA 3B 01 DA B2 00 0D 5F 0F 37 40 53 02 0D 00 03 + 00 54 02 0D 00 04 00 56 02 0D 00 05 00 4B 01 0E + 00 01 00 4A 01 0E 00 00 00 EA 00 0F 00 01 00 EB + 00 0F 00 00 00 FF FF 00 00 00 00 + + Handle 0x0004, DMI type 4, 42 bytes + Processor Information + Socket Designation: CPU 1 + Type: Central Processor + Family: Core i3 + Manufacturer: Intel + ID: A7 06 03 01 FF FB AB BE + Signature: Type 0, Family 6, Model 42, Stepping 7 + Flags: + FPU (Floating-point unit on-chip) + VME (Virtual mode extension) + DE (Debugging extension) + PSE (Page size extension) + TSC (Time stamp counter) + MSR (Model specific registers) + PAE (Physical address extension) + MCE (Machine check exception) + CX8 (CMPXCHG8 instruction supported) + APIC (On-chip APIC hardware supported) + SEP (Fast system call) + MTRR (Memory type range registers) + PGE (Page global enable) + MCA (Machine check architecture) + CMOV (Conditional move instruction supported) + PAT (Page attribute table) + PSE-36 (36-bit page size extension) + CLFSH (CLFLUSH instruction supported) + DS (Debug store) + ACPI (ACPI supported) + MMX (MMX technology supported) + FXSR (FXSAVE and FXSTOR instructions supported) + SSE (Streaming SIMD extensions) + SSE2 (Streaming SIMD extensions 2) + SS (Self-snoop) + HTT (Multi-threading) + TM (Thermal monitor supported) + PBE (Pending break enabled) + Version: Intel(R) Core(TM) i3-2350M CPU @ 2.30GHz + Voltage: 1.1 V + External Clock: 100 MHz + Max Speed: 2300 MHz + Current Speed: 2300 MHz + Status: Populated, Enabled + Upgrade: Other + L1 Cache Handle: 0x0005 + L2 Cache Handle: 0x0006 + L3 Cache Handle: 0x0007 + Serial Number: To Be Filled By O.E.M. + Asset Tag: To Be Filled By O.E.M. + Part Number: To Be Filled By O.E.M. + Core Count: 2 + Core Enabled: 1 + Thread Count: 2 + Characteristics: + 64-bit capable + + Handle 0x0005, DMI type 7, 19 bytes + Cache Information + Socket Designation: L1-Cache + Configuration: Enabled, Not Socketed, Level 1 + Operational Mode: Write Back + Location: Internal + Installed Size: 64 kB + Maximum Size: 64 kB + Supported SRAM Types: + Other + Installed SRAM Type: Other + Speed: Unknown + Error Correction Type: None + System Type: Unified + Associativity: 8-way Set-associative + + Handle 0x0006, DMI type 7, 19 bytes + Cache Information + Socket Designation: L2-Cache + Configuration: Enabled, Not Socketed, Level 2 + Operational Mode: Varies With Memory Address + Location: Internal + Installed Size: 512 kB + Maximum Size: 512 kB + Supported SRAM Types: + Other + Installed SRAM Type: Other + Speed: Unknown + Error Correction Type: None + System Type: Unified + Associativity: 8-way Set-associative + + Handle 0x0007, DMI type 7, 19 bytes + Cache Information + Socket Designation: L3-Cache + Configuration: Enabled, Not Socketed, Level 3 + Operational Mode: Varies With Memory Address + Location: Internal + Installed Size: 3072 kB + Maximum Size: 3072 kB + Supported SRAM Types: + Other + Installed SRAM Type: Other + Speed: Unknown + Error Correction Type: None + System Type: Unified + Associativity: Other + + Handle 0x0008, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J1A1 + Internal Connector Type: None + External Reference Designator: PS2Mouse + External Connector Type: PS/2 + Port Type: Mouse Port + + Handle 0x0009, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J1A1 + Internal Connector Type: None + External Reference Designator: Keyboard + External Connector Type: PS/2 + Port Type: Keyboard Port + + Handle 0x000A, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J2A2B + Internal Connector Type: None + External Reference Designator: Video + External Connector Type: DB-15 female + Port Type: Video Port + + Handle 0x000B, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J3A1 + Internal Connector Type: None + External Reference Designator: USB1 + External Connector Type: Access Bus (USB) + Port Type: USB + + Handle 0x000C, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J3A1 + Internal Connector Type: None + External Reference Designator: USB2 + External Connector Type: Access Bus (USB) + Port Type: USB + + Handle 0x000D, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J3A1 + Internal Connector Type: None + External Reference Designator: USB3 + External Connector Type: Access Bus (USB) + Port Type: USB + + Handle 0x000E, DMI type 8, 9 bytes + Port Connector Information + Internal Reference Designator: J5A1 + Internal Connector Type: None + External Reference Designator: LAN + External Connector Type: RJ-45 + Port Type: Network Port + + Handle 0x000F, DMI type 9, 17 bytes + System Slot Information + Designation: J6B2 + Type: x16 PCI Express + Current Usage: In Use + Length: Long + ID: 0 + Characteristics: + 3.3 V is provided + Opening is shared + PME signal is supported + Bus Address: 0000:00:01.0 + + Handle 0x0010, DMI type 9, 17 bytes + System Slot Information + Designation: J6B1 + Type: x1 PCI Express + Current Usage: In Use + Length: Short + ID: 1 + Characteristics: + 3.3 V is provided + Opening is shared + PME signal is supported + Bus Address: 0000:00:1c.3 + + Handle 0x0012, DMI type 11, 5 bytes + OEM Strings + String 1: Dell System + String 2: 5[0003] + String 3: 13[P18F] + + Handle 0x0013, DMI type 12, 5 bytes + System Configuration Options + Option 1: To Be Filled By O.E.M. + + Handle 0x001C, DMI type 21, 7 bytes + Built-in Pointing Device + Type: Touch Pad + Interface: Bus Mouse + Buttons: 2 + + Handle 0x001D, DMI type 22, 26 bytes + Portable Battery + Location: Sys. Battery Bay + Manufacturer: Sanyo + Serial Number: 5390 + Name: DELL 4YRJH22 + Chemistry: Lithium Ion + Design Capacity: 45000 mWh + Design Voltage: 10800 mV + SBDS Version: 1.0 + Maximum Error: 2% + SBDS Manufacture Date: 2012-02-28 + OEM-specific Information: 0x00000001 + + Handle 0x001E, DMI type 32, 20 bytes + System Boot Information + Status: No errors detected + + Handle 0x0020, DMI type 27, 12 bytes + Cooling Device + Type: Fan + Status: OK + OEM-specific Information: 0x00000000 + + Handle 0x0021, DMI type 28, 20 bytes + Temperature Probe + Description: CPU Internal Temperature + Location: Processor + Status: OK + Maximum Value: 127.0 deg C + Minimum Value: 0.0 deg C + Resolution: 1.000 deg C + Tolerance: 0.5 deg C + Accuracy: Unknown + OEM-specific Information: 0x00000000 + + Handle 0xB000, DMI type 176, 5 bytes + OEM-specific Type + Header and Data: + B0 05 00 B0 00 + + Handle 0xB100, DMI type 177, 12 bytes + OEM-specific Type + Header and Data: + B1 0C 00 B1 1A 0E 00 00 00 00 00 00 + + Handle 0x0025, DMI type 209, 12 bytes + OEM-specific Type + Header and Data: + D1 0C 25 00 00 00 00 03 05 01 00 03 + + Handle 0x0026, DMI type 210, 12 bytes + OEM-specific Type + Header and Data: + D2 0C 26 00 00 00 00 03 05 20 01 03 + + Handle 0x0027, DMI type 211, 13 bytes + OEM-specific Type + Header and Data: + D3 0D 27 00 01 00 00 00 00 02 03 04 04 + Strings: + Front + + Handle 0x0028, DMI type 212, 57 bytes + OEM-specific Type + Header and Data: + D4 39 28 00 70 00 71 00 01 49 50 48 9C 00 49 FC + 01 9B 00 49 FC 00 7F 01 4A FB 04 80 01 4A FB 00 + 53 01 4A F7 08 52 01 4A F7 08 7B 01 4A EF 10 7C + 01 4A EF 10 FF FF 00 00 00 + + Handle 0x002A, DMI type 217, 8 bytes + OEM-specific Type + Header and Data: + D9 08 2A 00 01 02 00 00 + Strings: + + Handle 0x002B, DMI type 219, 11 bytes + OEM-specific Type + Header and Data: + DB 0B 2B 00 00 01 02 03 00 04 05 + Strings: + + Handle 0x002C, DMI type 220, 22 bytes + OEM-specific Type + Header and Data: + DC 16 2C 00 01 F0 00 00 02 F0 00 00 00 00 03 F0 + 04 F0 00 00 00 00 + + Handle 0x002D, DMI type 221, 19 bytes + OEM-specific Type + Header and Data: + DD 13 2D 00 00 00 00 00 00 03 00 00 00 00 00 00 + 00 00 00 + + Handle 0x002E, DMI type 222, 16 bytes + OEM-specific Type + Header and Data: + DE 10 2E 00 01 08 FF FF 00 00 00 00 00 00 00 00 + + Handle 0x0014, DMI type 16, 15 bytes + Physical Memory Array + Location: System Board Or Motherboard + Use: System Memory + Error Correction Type: None + Maximum Capacity: 16 GB + Error Information Handle: Not Provided + Number Of Devices: 2 + + Handle 0x0016, DMI type 20, 19 bytes + Memory Device Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x000FFFFFFFF + Range Size: 4 GB + Physical Device Handle: 0x0015 + Memory Array Mapped Address Handle: 0x0018 + Partition Row Position: 1 + Interleave Position: 1 + Interleaved Data Depth: 1 + + Handle 0x0017, DMI type 17, 28 bytes + Memory Device + Array Handle: 0x0014 + Error Information Handle: 0x0000 + Total Width: Unknown + Data Width: Unknown + Size: No Module Installed + Form Factor: DIMM + Set: None + Locator: DIMM_B + Bank Locator: BANK 2 + Type: Unknown + Type Detail: None + Speed: Unknown + Manufacturer: Not Specified + Serial Number: Not Specified + Asset Tag: Not Specified + Part Number: Not Specified + Rank: Unknown + + Handle 0x0018, DMI type 19, 15 bytes + Memory Array Mapped Address + Starting Address: 0x00000000000 + Ending Address: 0x000FFFFFFFF + Range Size: 4 GB + Physical Array Handle: 0x0014 + Partition Width: 2 + + Handle 0x002F, DMI type 13, 22 bytes + BIOS Language Information + Language Description Format: Abbreviated + Installable Languages: 1 + eng + Currently Installed Language: eng + + Handle 0x0030, DMI type 131, 64 bytes + OEM-specific Type + Header and Data: + 83 40 30 00 31 00 00 00 00 00 00 00 00 00 00 00 + F8 00 4B 1C FF FF FF FF 01 00 00 00 00 00 07 00 + AD 04 04 00 00 00 00 00 C8 00 FF FF 00 00 00 00 + 00 00 00 00 32 00 00 00 76 50 72 6F 00 00 00 00 + + Handle 0x0029, DMI type 216, 9 bytes + OEM-specific Type + Header and Data: + D8 09 29 00 01 02 01 00 00 + Strings: + INTEL + 0000 + + Handle 0x0000, DMI type 0, 24 bytes + BIOS Information + Vendor: Dell Inc. + Version: A05 + Release Date: 08/03/2012 + Address: 0xF0000 + Runtime Size: 64 kB + ROM Size: 2048 kB + Characteristics: + MCA is supported + PCI is supported + BIOS is upgradeable + BIOS shadowing is allowed + ESCD support is available + Boot from CD is supported + Selectable boot is supported + BIOS ROM is socketed + EDD is supported + 5.25"/1.2 MB floppy services are supported (int 13h) + 3.5"/720 kB floppy services are supported (int 13h) + 3.5"/2.88 MB floppy services are supported (int 13h) + Print screen service is supported (int 5h) + 8042 keyboard services are supported (int 9h) + Serial services are supported (int 14h) + Printer services are supported (int 17h) + CGA/mono video services are supported (int 10h) + ACPI is supported + USB legacy is supported + ATAPI Zip drive boot is supported + BIOS boot specification is supported + Targeted content distribution is supported + BIOS Revision: 0.5 + Firmware Revision: 0.5 + + Handle 0x0002, DMI type 2, 15 bytes + Base Board Information + Manufacturer: Dell Inc. + Product Name: 01HXXJ + Version: A05 + Serial Number: .JSQ7PA1.CN7117623M00J2. + Asset Tag: Not Specified + Features: + Board is a hosting board + Board is replaceable + Location In Chassis: To Be Filled By O.E.M. + Chassis Handle: 0x0003 + Type: Motherboard + Contained Object Handles: 0 + + Handle 0x0003, DMI type 3, 21 bytes + Chassis Information + Manufacturer: Dell Inc. + Type: Portable + Lock: Not Present + Version: Not Specified + Serial Number: JSR1 + Asset Tag: Not Specified + Boot-up State: Safe + Power Supply State: Safe + Thermal State: Safe + Security Status: None + OEM Information: 0x00000000 + Height: Unspecified + Number Of Power Cords: 1 + Contained Elements: 0 + + Handle 0x0001, DMI type 1, 27 bytes + System Information + Manufacturer: Dell Inc. + Product Name: Inspiron N5050 + Version: Not Specified + Serial Number: JSR1 + UUID: 4C4C4544-0053-5110-8029-CAC05241 + Wake-up Type: Power Switch + SKU Number: To be filled by O.E.M. + Family: + + Handle 0x0024, DMI type 208, 12 bytes + OEM-specific Type + Header and Data: + D0 0C 24 00 02 05 FE 00 04 05 01 02 + Strings: + 20120323 + 20120323 + + Handle 0x0011, DMI type 10, 6 bytes + On Board Device Information + Type: Video + Status: Enabled + Description: Mobile Intel SandyBridge HD Graphics + + Handle 0x0015, DMI type 17, 28 bytes + Memory Device + Array Handle: 0x0014 + Error Information Handle: 0x0000 + Total Width: 64 bits + Data Width: 64 bits + Size: 4096 MB + Form Factor: SODIMM + Set: None + Locator: DIMM_A + Bank Locator: BANK 0 + Type: DDR3 + Type Detail: Synchronous + Speed: 1067 MHz + Manufacturer: 014F + Serial Number: 0009F2 + Asset Tag: 54114000 + Part Number: JM1066-4G + Rank: Unknown + + Handle 0x0031, DMI type 127, 4 bytes + End Of Table + +好了,就是这样。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/linux-basics-how-to-find-maximum-supported-ram-by-your-system/ + +作者:[SK][0] +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[0]:https://www.unixmen.com/author/sk/ diff --git a/published/201503/20150306 Pinta 1.6 Released Install It In Ubuntu And Linux Mint.md b/published/201503/20150306 Pinta 1.6 Released Install It In Ubuntu And Linux Mint.md new file mode 100644 index 0000000000..bf0a698a16 --- /dev/null +++ b/published/201503/20150306 Pinta 1.6 Released Install It In Ubuntu And Linux Mint.md @@ -0,0 +1,50 @@ +Pinta 1.6发布了!在 Ubuntu 和 Linux Mint 上安装Pinta +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Pinta_Ubuntu_Linux.jpeg) + + +[Pinta][1] 是一款免费的开源绘图应用软件,它在Linux用户中很受欢迎。你也可以把它看作是**微软画图软件的开源替代品**。Pinta 可以在很多平台上使用,如 Linux、Windows 以及 Mac OS X。 + +Gimp 作为一款功能齐全的图像编辑软件而流行,相比Pinta则单纯是一种绘图工具。我常用它在我的截图上画箭头和曲线,而且我可以说这是我在 Linux 上最喜欢的绘图应用软件。 + +### Pinta 1.6 的新功能### + +经过一年多的时间,Pinta发布了1.6版本,修复了50多个漏洞并且增加了一些新功能。增加的新功能如下: + +- 线条工具现在支持绘制曲线和箭头 +- 绘制好的图形可以编辑形状 +- 所有的图形工具现在支持绘制虚线 +- 所有的选择工具现在支持并集、排除,异或和交集模式 +- 插件可通过插件管理器安装 +- 命令行中加入新选项 + +新版本同时也修复了一个很烦人的漏洞——右键菜单选项,[在打开方式中使用Pinta不能打开文件][2]。你可以在[发布说明][3]阅读所有的改变。 + +### 在 Ubuntu 和 Linux Mint 中安装 Pinta 1.6### + +Pinta 1.5 可以在 Ubuntu 14.04,14.10,Linux Mint 17 和 elementary OS 中使用。如果你想安装最新的 1.6 版本,你可以使用 Pinta 团队的官方PPA源。如果你已经安装了 Pinta 1.5 也不必担心。再安装一次将会使版本升级。 + +打开终端并使用以下命令: + + sudo add-apt-repository ppa:pinta-maintainers/pinta-stable + sudo apt-get update + sudo apt-get install pinta + +下载源代码或者获取 Windows 和 Mac OS X 的安装文件,请点击[Pinta下载页面][4]。在如下这篇相关文章中,你也可以选出[Linux中最好的照片应用软件][5]。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/pinta-1-6-ubuntu-linux-mint/ + +作者:[Abhishek][a] +译者:[linuhap](https://github.com/linuhap) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://pinta-project.com/ +[2]:http://itsfoss.com/add-application-list-open-applications-ubuntu-1310/ +[3]:http://pinta-project.com/releases/1-6 +[4]:http://pinta-project.com/releases +[5]:http://itsfoss.com/image-applications-ubuntu-linux/ diff --git a/published/201503/20150309 10 best uses for open source software in the business world.md b/published/201503/20150309 10 best uses for open source software in the business world.md new file mode 100644 index 0000000000..82b5c89956 --- /dev/null +++ b/published/201503/20150309 10 best uses for open source software in the business world.md @@ -0,0 +1,85 @@ +10种将开源用于商业的最佳途径 +=============================================================================== +> 开源为大大小小的商业带来了一些显著的效益 -- 但是你可能会对某些用途感到惊讶。 + +![](http://tr2.cbsistatic.com/hub/i/r/2015/03/05/54a9c323-4311-4455-b10b-5182548da424/resize/620x485/95164f01a19cbd7a3e4b843be78febae/foss.jpg) + +技术上已经发生了一些必然性的改变。举个例子,开源软件以它的方式进入到了你的工作之中。10 年前,这也许还能称为一个问题。现在呢?则已经无法避免开源技术的使用 -- 也没有理由要去避免。有如此多强大(和必需的)的方方面面技术,开源在许多方面已经成为了技术的救世主。但是你哪一块的工作最适合开源软件呢?当然,这个问题的答案会因公司而异。然而许多的应用几乎可以适用于每个场景中。 + +让我们来看看这10种可能是最佳的使用方法,它们可以帮助你的公司成长,带给你从未体验过的灵活性与可靠性,或者仅仅是帮你节省一笔可观的预算。 + +### 1: 服务器软件 ### + +如果你还在微软的 IIS 平台苦苦挣扎,那么你需要体验一下 Apache。这款旗舰级开源软件是这个星球上使用最广泛的网页服务器软件之一。Apache 免费、极其可靠、易于管理,而且不像 IIS 一样需要大量的资源。然而,开源并不局限于网页服务器。如果你需要在公司内使用 SMB 来共享资源,可以试试 Samba, Samba 4甚至集成了活动目录(AD),所以你不需要担心在Samba服务器上建立单独的用户账号。 + +### 2: 开发 ### + +用开源开发是很简单的事。PHP,Rails,Perl -- 开源上面的开发语言和开发的工具(从集成开发环境到调试)都很多。为开源或者开源工具做开发可以有很多种选择(如同使用商业软件开发一样)。开源软件与商业软件最大的不同之处在于开源可以接触到软件源代码。在自由开源软件(FOSS,free open source software)的世界里,代码都是公开的。对许多开发者来说,Linux操作系统有他们开发和构建所需要的一切(特别那些没有一个成熟环境来写代码的人而言)。如果你需要图形用户界面(GUI)的开发工具,开源也能满足你。 + +### 3: 安全 ### + +通往安全的道路是充满挑战的,但还是很多途径可以达到。你可以选择“安全盒子”的解决方案,跟随Cisco(一个可靠的解决方案)的节奏,或者你可以借助iptables打造最适合你需求的安全。是的,开源的安全之路会需要更多的时间去配置(有很高的学习壁垒),但是结果通常是不错的。这里甚至不强调一种观点,就一般来说,在桌面上使用开源比起大多数封闭的系统而言是一个更安全的平台。在桌面上部署Linux,你的安全痛点会大大降低。 + +### 4: 桌面 ### + +Linux 桌面是大多数人不认可的地方。尽管如此,你必须考虑一个事实,那就是你每天的工作流程已经经历了一个主要的思维模式的转换。我们现在做的大部分事情都是通过网络浏览器。那么为什么不将Linux部署到桌面上呢?不但可以能做如今要做的许多工作,而且不用遭受病毒,恶意软件和能破坏系统的更新。它不完美 -- 但哪个平台敢说完美?但是它很强大,最后,还可以节省你的开支。这是一个双赢的结局。 + +### 5: 工作流程 ### + +每一种工作都依赖于工作流程。对于某些工作来说,一个流畅的工作流程又取决于所用的工具。开源已经登上这个舞台了。CRM(客户关系管理),HRM(人力资源管理),ERP(企业资源计划),BI(商业智能),BPM(业务流程管理) …… 只要你叫得出名字,开源就可以做到几乎你能想到的每一种可能 -- 并且干得不错。借助于[Pentaho][1], [Collabtive][2]和[SugarCRM][3], 开源可以在任何时候与最新的源工具保持同步。 + +### 6: 协作 ### + +没有一起合作项目的能力,你的员工就不能干好工作。所以你选择的协作工具是十分重要的。你会在开源的世界里发现大量的优质协作工具。[Cyn.in 社区版][4], [Zimbra 开源版][5]和[Kolab][6]都是不错的协作工具,但这仅仅是开源世界里的三个代表而已。 + +### 7: 大数据 ### + +以前说到大数据的时候,往往不会想到开源。多亏了[SUSE][7]的努力,大数据和开源现在可以携手共进了。许多如内存数据和内核热补丁的发明创建,使得开源成为大数据一个理想的解决方案。它可以完美地满足大数据在平台上所需的大量要求,而封闭的软件则达不到如此灵活的水平。 + +### 8: 云 ### + +云的主要玩家都是开源的。[Red Hat][8], [Ubuntu][9], [SUSE][10], [Amazon][11], [Rackspace][12] -- 他们都提供云服务,而且认为开源是云配置的最好解决方案。但是,如果你不想用大公司的服务,仍然有很多后起之秀如[OwnCloud][13],你可以选择OwnCloud的托管云方案,或者建立自己的一套。 + +### 9: 多媒体 ### + +如果你的公司做播客或为产品发布制作视频,开源可以为你提供服务。借助像[Audacity][14]和[OpenShot][15]这样的工具,你可以对音频和视频做你需要的任何处理 -- 而且十分的廉价。实际上,你会感觉到很难再去找到比Audacity更好的播客工具,或者比OpenShot更易用的视频编辑器。没有太大的学习壁垒,或者闭源软件工具所要求的高额费用,开源的软件在帮助你创造专业水准的作品方面已经做得很好了。 + +### 10: 电子商务 ### + +如果你做在线销售,如果不尝试一下像[PrestaShop][16]之类的工具,你就太懈怠了。PrestaShop是最强大的电子商务解决方案之一,易于获取 -- 不需要许可证。 PrestaShop有你可能想要的所有功能(而且有些你可能都没有想过),这个开源平台已经在任何水平上超出了电子商务的范畴。 + +### FOSS 之于商业 ### + +开源已经不再局限于商业交流的范围了。在许多情况下,FOSS已经主导这种交流。如果你已经在寻找将开源解决方案运用的领域,看上面的10条就行了。 + +### 该你了 ### + +你已经将开源用到你的工作中了吗?如果是,属于哪一条方法呢? + +------------------------------------------------------------------------------- + +via: http://www.techrepublic.com/blog/10-things/10-best-uses-for-open-source-software-in-the-business-world/ + +作者:[Jack Wallen][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.techrepublic.com/search/?a=jack+wallen +[1]:http://community.pentaho.com/ +[2]:http://collabtive.o-dyn.de/ +[3]:http://www.sugarcrm.com/ +[4]:http://cynapse.com/cyn-in/ +[5]:https://www.zimbra.com/open-source +[6]:http://kolab.org/ +[7]:http://www.suse.org/ +[8]:http://www.redhat.com/ +[9]:http://www.ubuntu.com/ +[10]:http://www.suse.com/ +[11]:http://aws.amazon.com/ec2/ +[12]:http://www.rackspace.com/cloud +[13]:https://owncloud.org/ +[14]:http://audacity.sourceforge.net/ +[15]:http://www.openshot.org/ +[16]:https://www.prestashop.com/ diff --git a/published/201503/20150309 15 Basic 'ls' Command Examples in Linux.md b/published/201503/20150309 15 Basic 'ls' Command Examples in Linux.md new file mode 100644 index 0000000000..e5feb79b2e --- /dev/null +++ b/published/201503/20150309 15 Basic 'ls' Command Examples in Linux.md @@ -0,0 +1,263 @@ +Linux中的15个基本‘ls’命令示例 +================================================================================ +ls命令是Linux系统中最被频繁使用的命令之一,我相信ls命令一定是你进入一台Linux系统的电脑打开命令提示符后第一个使用的命令。我们每天都在频繁地使用ls命令,即使我们可能没有意识也从来用不到所有可用的选项。本文中,我们将讨论下一些基本的ls命令并且覆盖尽可能多的有关参数来讲解。 + +![Linux ls Command](http://www.tecmint.com/wp-content/uploads/2012/08/Linux-ls-Commands.png) + +*Linux的ls命令* + +### 1. 不带任何选项列出文件 ### + +不带选项的ls命令来光秃秃地列出文件和目录,我们是不能看到像文件类型、大小、修改日期和时间、权限以及链接这样具体的信息的。 + + # ls + + 0001.pcap Desktop Downloads index.html install.log.syslog Pictures Templates + anaconda-ks.cfg Documents fbcmd_update.php install.log Music Public Videos + +### 2 带 –l 选项列出文件列表 ### + +你看,ls -l(-l是字母不是“1”)就能展示出是文件还是目录,它的大小、修改日期和时间、文件或目录的名字以及文件的属主和它的权限。 + + # ls -l + + total 176 + -rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap + -rw-------. 1 root root 1586 Jul 31 02:17 anaconda-ks.cfg + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Desktop + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Documents + drwxr-xr-x. 4 root root 4096 Aug 16 02:55 Downloads + -rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php + -rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html + -rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log + -rw-r--r--. 1 root root 11439 Jul 31 02:13 install.log.syslog + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Music + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Pictures + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Public + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Templates + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Videos + +### 3. 浏览隐藏文件 ### + +列出所有文件包括以‘.’开头的隐藏文件。 + + # ls -a + + . .bashrc Documents .gconfd install.log .nautilus .pulse-cookie + .. .cache Downloads .gnome2 install.log.syslog .netstat.swp .recently-used.xbel + 0001.pcap .config .elinks .gnome2_private .kde .opera .spice-vdagent + anaconda-ks.cfg .cshrc .esd_auth .gtk-bookmarks .libreoffice Pictures .tcshrc + .bash_history .dbus .fbcmd .gvfs .local .pki Templates + .bash_logout Desktop fbcmd_update.php .ICEauthority .mozilla Public Videos + .bash_profile .digrc .gconf index.html Music .pulse .wireshark + +### 4. 用 -lh 选项来以易读方式列出文件 ### + +用-lh组合选项,以易读方式来显示大小。 + + # ls -lh + + total 176K + -rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap + -rw-------. 1 root root 1.6K Jul 31 02:17 anaconda-ks.cfg + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Desktop + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Documents + drwxr-xr-x. 4 root root 4.0K Aug 16 02:55 Downloads + -rw-r--r--. 1 root root 21K Aug 12 12:42 fbcmd_update.php + -rw-r--r--. 1 root root 46K Jul 31 09:58 index.html + -rw-r--r--. 1 root root 48K Jul 31 02:17 install.log + -rw-r--r--. 1 root root 12K Jul 31 02:13 install.log.syslog + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Music + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Pictures + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Public + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Templates + drwxr-xr-x. 2 root root 4.0K Jul 31 02:48 Videos + +### 5. 以尾部以‘/’字符结尾的方式列出文件和目录 ### + +使用 ls 命令的 -F 选项,会在每个目录的末尾添加“/”字符显示。 + + # ls -F + + 0001.pcap Desktop/ Downloads/ index.html install.log.syslog Pictures/ Templates/ + anaconda-ks.cfg Documents/ fbcmd_update.php install.log Music/ Public/ Videos/ + +### 6. 倒序列出文件 ### + +ls -r 选项能以倒序方式显示文件和目录。 + + # ls -r + + Videos Public Music install.log fbcmd_update.php Documents anaconda-ks.cfg + Templates Pictures install.log.syslog index.html Downloads Desktop 0001.pcap + +### 7. 递归列出子目录 ### + +ls -R 选项能列出非常长的目录树,来看看示例输出: + + # ls -R + + total 1384 + -rw-------. 1 root root 33408 Aug 8 17:25 anaconda.log + -rw-------. 1 root root 30508 Aug 8 17:25 anaconda.program.log + + ./httpd: + total 132 + -rw-r--r-- 1 root root 0 Aug 19 03:14 access_log + -rw-r--r--. 1 root root 61916 Aug 10 17:55 access_log-20120812 + + ./lighttpd: + total 68 + -rw-r--r-- 1 lighttpd lighttpd 7858 Aug 21 15:26 access.log + -rw-r--r--. 1 lighttpd lighttpd 37531 Aug 17 18:21 access.log-20120819 + + ./nginx: + total 12 + -rw-r--r--. 1 root root 0 Aug 12 03:17 access.log + -rw-r--r--. 1 root root 390 Aug 12 03:17 access.log-20120812.gz + +### 8. 以修改时间倒序列出 ### + +带-ltr组合选项能以文件或目录的最新修改时间的次序来显示它们。 + + # ls -ltr + + total 176 + -rw-r--r--. 1 root root 11439 Jul 31 02:13 install.log.syslog + -rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log + -rw-------. 1 root root 1586 Jul 31 02:17 anaconda-ks.cfg + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Desktop + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Videos + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Templates + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Public + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Pictures + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Music + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Documents + -rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html + -rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php + drwxr-xr-x. 4 root root 4096 Aug 16 02:55 Downloads + -rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap + +### 9. 按文件大小排序 ### + +带-lS组合选项能按文件从大到小的次序显示。 + + # ls -lS + + total 176 + -rw-r--r--. 1 root root 48867 Jul 31 02:17 install.log + -rw-r--r--. 1 root root 46701 Jul 31 09:58 index.html + -rw-r--r--. 1 root root 21262 Aug 12 12:42 fbcmd_update.php + -rw-r--r--. 1 root root 11439 Jul 31 02:13 install.log.syslog + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Desktop + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Documents + drwxr-xr-x. 4 root root 4096 Aug 16 02:55 Downloads + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Music + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Pictures + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Public + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Templates + drwxr-xr-x. 2 root root 4096 Jul 31 02:48 Videos + -rw-------. 1 root root 1586 Jul 31 02:17 anaconda-ks.cfg + -rw-r--r--. 1 root root 683 Aug 19 09:59 0001.pcap + +### 10. 显示文件或目录的索引节点号 ### + +我们有时候可以看到一些数字打印在文件或目录名之前,带-i选项就能列出文件或目录的索引节点号。 + + # ls -i + + 20112 0001.pcap 23610 Documents 23793 index.html 23611 Music 23597 Templates + 23564 anaconda-ks.cfg 23595 Downloads 22 install.log 23612 Pictures 23613 Videos + 23594 Desktop 23585 fbcmd_update.php 35 install.log.syslog 23601 Public + +### 11. 显示ls命令的版本 ### + +查看ls命令的版本。 + + # ls --version + + ls (GNU coreutils) 8.4 + Copyright (C) 2010 Free Software Foundation, Inc. + License GPLv3+: GNU GPL version 3 or later . + This is free software: you are free to change and redistribute it. + There is NO WARRANTY, to the extent permitted by law. + Written by Richard M. Stallman and David MacKenzie. + +### 12. 显示帮助页面 ### + +列出ls命令的选项帮助页面。 + + # ls --help + + Usage: ls [OPTION]... [FILE]... + +### 13. 列出目录信息 ### + +用ls -l命令列出/tmp目录下的文件,其中-ld参数可以只显示/tmp目录的信息。 + + # ls -l /tmp + total 408 + drwx------. 2 narad narad 4096 Aug 2 02:00 CRX_75DAF8CB7768 + -r--------. 1 root root 384683 Aug 4 12:28 htop-1.0.1.tar.gz + drwx------. 2 root root 4096 Aug 4 11:20 keyring-6Mfjnk + drwx------. 2 root root 4096 Aug 16 01:33 keyring-pioZJr + drwx------. 2 gdm gdm 4096 Aug 21 11:26 orbit-gdm + drwx------. 2 root root 4096 Aug 19 08:41 pulse-gl6o4ZdxQVrX + drwx------. 2 narad narad 4096 Aug 4 08:16 pulse-UDH76ExwUVoU + drwx------. 2 gdm gdm 4096 Aug 21 11:26 pulse-wJtcweUCtvhn + -rw-------. 1 root root 300 Aug 16 03:34 yum_save_tx-2012-08-16-03-34LJTAa1.yumtx + +---------- + + # ls -ld /tmp/ + + drwxrwxrwt. 13 root root 4096 Aug 21 12:48 /tmp/ + +### 14. 显示文件的UID和GID ### + +用ls -n命令来显示文件和目录的UID(译者注:userid,用户ID)和GID(译者注:groupid,组ID)。 + + # ls -n + + total 36 + drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Downloads + drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Music + drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Pictures + -rw-rw-r--. 1 500 500 12 Aug 21 13:06 tmp.txt + drwxr-xr-x. 2 500 500 4096 Aug 2 01:52 Videos + +### 15. ls命令和它的别名 ### + +我们给ls命令设置如下别名之后,当我们执行ls命令的时候它会默认执行-l选项并且像上文提到的那样显示长列表。 + + # alias ls="ls -l" + +注意:我们可以通过不加任何参数的alias命令来看到目前系统中可用的所有alias设置,当然它们同时也可以unalias来取消。 + + # alias + + alias cp='cp -i' + alias l.='ls -d .* --color=auto' + alias ll='ls -l --color=auto' + alias ls='ls --color=auto' + alias mv='mv -i' + alias rm='rm -i' + alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde' + +删除一项之前定义的alias设置,只需用unalias命令即可。 + + # unalias ls + +下篇文章我们将讨论更多更高级的ls命令以及示例,如果我们在本文有遗漏了任何东西,请通过评论让我们获悉。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/15-basic-ls-command-examples-in-linux/ + +作者:[Ravi Saive][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/admin/ diff --git a/published/201503/20150309 New App Brings Android Notifications to The GNOME Desktop.md b/published/201503/20150309 New App Brings Android Notifications to The GNOME Desktop.md new file mode 100644 index 0000000000..7b299029bb --- /dev/null +++ b/published/201503/20150309 New App Brings Android Notifications to The GNOME Desktop.md @@ -0,0 +1,39 @@ +一款在Gnome桌面中显示Andorid通知的程序 +================================================================================ + +**你很快就可以在GNOME桌面中看到Andorid通知了,这都要归功于一个正在开发中的新程序。** + +![Fancy seeing your Android alerts here? You can.](http://www.omgubuntu.co.uk/wp-content/uploads/2015/02/Screen-Shot-2015-02-24-at-17.47.48.png) +在这里看到Android通知是不是很棒?就可以了~ + +这个新的项目叫“Nuntius”,这可以让在Andorid手机上收到的通知显示在GNOME桌面上。它会集成在GNOME 3.16中,并且它[重新设计了通知系统][1],这个app和特性会用在其他更多的地方。 + +这个app的开发者希望在这个月GNOME 3.16发布之前可以完成,它将通过蓝牙工作来保证不会传给外部的系统或者使用在线存储。这意味着你的电话必须接近GNOME桌面来保证这个功能可用。 + +他现在还不能回复短消息或者对提醒采取操作。 + +开发团队警告说**这是一个早期发布版本**,那些打算期望很高人要有暂时只能提供部分功能的心理准备。 + +这个用来配合在GNOME桌面上看Android通知的移动端app现在已经在[Google Play商店][2]找到了,而GNOME程序已经放在Fedora的仓库中了。 + +开发者已经在Gituhb上开源了Android和GNOME接收端的程序。 + +在一两年前,[KDE桌面上已经有了][3]一个相似的工具 - ‘KDE Connect,它通过Pushbullet来为使用Chrome的iOS和Android提供相似的功能,支持Windows、MAC和Linux桌面。 + +- [Nuntius for Android & GNOME on GitHub][4] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/03/new-app-brings-android-notifications-to-the-gnome-desktop + +作者:[Joey-Elijah Sneddon][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://www.omgubuntu.co.uk/2015/02/4-reason-why-gnome-3-16-might-be-the-best-version-yet-gallery +[2]:https://play.google.com/store/apps/details?id=org.holylobster.nuntius +[3]:http://www.omgubuntu.co.uk/2014/06/kde-connect-android-notifications-linux-desktop +[4]:https://github.com/holylobster diff --git a/published/201503/New Debian TC Members Appointed For Going Past The Systemd Fallout.md b/published/201503/New Debian TC Members Appointed For Going Past The Systemd Fallout.md new file mode 100644 index 0000000000..d33e7d3b5d --- /dev/null +++ b/published/201503/New Debian TC Members Appointed For Going Past The Systemd Fallout.md @@ -0,0 +1,26 @@ +经过 systemd 争执后,辞职的 Debian TC 席位已被增补 +================================================================================ + +去年随着Debian 以 systemd 作为 init 管理器的决议,以及随后的 [init 系统投票][1],有三个人从 Debian 技术委员会退出:Colin Watson, [Ian Jackson][2], 以及 [Russ Allbery][3]。现在,这些空缺席位现已由现有的技术委员会成员任命。 + +新任命的技术委员会成员是 Sam Hartman, Tollef Fog Heen 以及 Didier Raboud。这些新成员加上Bdale Garbee, Don Armstrong, Andreas Barth, Steve Langasek 以及 Keith Packard 组成了现在的Debian技术委员会。由Debian章程确定的 Debian 技术委员会(TC)负责对 Debian 项目中的技术争端做出最后的决定,他们在去年所有的关于 init 系统的讨论中变得十分重要。 + +![](http://www.phoronix.net/image.php?id=debconf12_managua&image=debconf_12_conference_med) + +新技术委员会成员的委任公告可以从 [debian-devel-announce列表][4] 中获悉。 + +-------------------------------------------------------------------------------- + +via: http://www.phoronix.com/scan.php?page=news_item&px=Debian-TC-Three-Appointments + +作者:[Michael Larabel][a] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.michaellarabel.com/ +[1]:http://www.phoronix.com/scan.php?page=news_item&px=MTg0MzY +[2]:http://www.phoronix.com/scan.php?page=news_item&px=MTg0NDA +[3]:http://www.phoronix.com/scan.php?page=news_item&px=MTg0MjM +[4]:https://lists.debian.org/debian-devel-announce/2015/03/msg00003.html diff --git a/published/20150310 FAQ--BSD.md b/published/20150310 FAQ--BSD.md new file mode 100644 index 0000000000..e9f3d8fedb --- /dev/null +++ b/published/20150310 FAQ--BSD.md @@ -0,0 +1,78 @@ +BSD 的那些事 +================================================================================ +![](http://www.linuxvoice.com/wp-content/uploads/2015/02/faq1-large1.png) + +### 假如历史稍有不同,今天你将听到的是“FreeBSD之声”... ### +(LCTT 译注:本文来自“Linux之声(LinuxVoice)”。) + +#### 那么,这个Birsa Seva Dal是怎么回事呢?难道不是一个印度的政治组织么? #### + +真有趣,您查阅了维基百科上“BSD”的消除分歧页面是为了讲上面这个笑话,对么?这里我们在讨论伯克利软件发行版(Berkeley Software Distribution),一个比您想象中用的更广泛的操作系统家族。 + +#### 抱歉,我有点 Hold 不住自己。那么,这些操作系统是怎么回事呢? #### + +今天,主要使用的BSD操作系统有三种。他们都基于Unix,他们都开源,并且大多担任服务器的角色,但也能当作优秀的桌面和工作站。他们运行KDE,Firefox,LibreOffice,Apache,MySQL和许多你能说得出名字的开源软件。它们都很稳定、安全、支持许多不同的硬件。 + +#### 真棒!你刚才在描述GNU/Linux吧 #### + +是的,Linux拥有我刚才提到的所有东西,这也是为什么很多人从来不讨论BSD。在日常的使用中,Linux和BSD并没有太多的不同,这主要是因为他们都以Unix为基础,并共用很多软件。您可以登录进远程主机,在Vim中写一些Python代码,使用Mutt检查您的email,您可能并未意识到您在使用BSD。或许您在咖啡馆里正通过网络终端使用它,但不知道他是BSD。 + +两者最大的区别在于开发模式和许可证,为了解这些,我们需要回到过去。在BSD中,B代表着加利福尼亚大学伯克利分校(University of California, Berkeley),在1980年代,那里是开源的Unix软件的发源地。到了90年代,基于x86的PC变得流行,许多人对在他们的家庭电脑中安装Unix类操作系统产生了兴趣。1992年,一个叫做386BSD的项目在那时发布,提供了上述功能。 + +#### 那么,所有的Linux发行版那个时候在哪里呢? #### + +问得好!您也许知道这一年的前一年(1991),Linus Torvalds已经发布了他的内核,当它与GNU项目结合时,变成了完整的开源操作系统。Linus那时也在关注GNU的内核(Hurd)和386BSD,并且他说过,如果那时两个内核有一个可以正常使用,他可能就不会创造Linux了。所以,90年代的头几年,开源操作系统生机勃勃,没有人知道哪个系统会最终胜出。 + +接下来,BSD遇到了一些麻烦。Unix最初的开发方AT&T试图从他们在操作系统方面的付出中获得一些利益,他们声称BSD侵犯了他们的知识产权。此事最终以1992年的一桩诉讼结束,它极大的抑制了BSD的开发进程。其结果就是,许多BSD源码必须重写,与此同时,GNU/Linux已经丰富了功能,变得稳定和流行了。 + +在90年代早期,BSD被认为比GNU/Linux更加成熟,如果没有那些法律麻烦,他可能已经成为了x86 PC的标准了。今天,我们可能都在使用它而不是Linux。 + +#### 但你提到BSD仍然被广泛的使用,所以它后来有提升么? #### + +是的。386BSD的开发停滞了,但有两只开发团队通过互联网协作并创造了两个独立的成功的项目。FreeBSD成为了使用最广泛的BSD版本,它目前是和Linux最相似的系统,包括桌面和服务器版本。而NetBSD则聚焦于可移植性(今天它可以运行在超过50种不同平台上,均基于同样的代码版本)。另一个版本是OpenBSD,它在NetBSD开始不久就因为开发者的口角而作为NetBSD的分支诞生了,今天,它以专注于安全闻名。多年以来,OpenBSD创建了许多程序,它们都成了Linux的标准部分,比如说OpenSSH - 甚至,现在我们还有了LibreSSL。 + +#### 所以,这三种版本的BSD和Linux发行版相似么? #### + +也是也不是,每个BSD版本都有自己的代码库、不同的开发团队。尽管他们间有许多共用的代码(尤其是硬件驱动)。但他们是各自拥有其特色、优点和缺点的相互独立的操作系统。 + +我们提到过,BSD的开发模式是他们真正和GNU/Linux区别的重要特点。在GNU/Linux中没有人对其整体进行掌控:一些团队在GNU组件方面工作,一些团队在开发内核,一些在开发启动脚本,一些在写手册,一些在写库等等。这样的开发模式通常被称作缺少中央权利的“荒蛮的美国西部”,由发行版负责将所有的东西各自锲合。 + +而BSD则相反,它们从中央化的源代码树中开发并作为一个整体。内核、库、系统组件和文档页都存在一个地方,且以同样的方式使用。许多BSD粉丝声称,这个特点给了操作系统更多的一致性和稳定性。通过我这些年使用BSD的经验来看,我们可以证明手册页已经变得非常完备。 + +![](http://www.linuxvoice.com/wp-content/uploads/2015/02/faq2-large1.png) + +#### 难道BSD没有使用GNU/Linux的任何东西么? #### + +是的,但除了GCC。几十年来,GNU Compiler Collection已经成为了实际上的Unix系统标准编译器,但FreeBSD最近已经转而使用LLVM/Clang了。值得注意的是BSD还是用了一些其他的开源项目,但它们并属于GNU或者Linux,比如说X Window System(XFree86和X.org)、Perl等等。并且幸亏有像POSIX一样的标准,许多运行在Linux上的程序可以在BSD的许多版本上编译和运行。 + +因此,您可以把LAMP(Linux、Apache、MySQL和PHP)中的L改成FreeBSD,这样可以获得几乎同样的环境,以及一些不同的特性(例如,在文件系统和驱动支持方面)。FreeBSD有一些大型、海量的用户,例如Netflix,每天提供海量的数据。尽管FreeBSD可以做为一个不错的桌面环境,但它的长处在于服务器方面,它拥有超乎寻常的可靠性和网络性能。 + +OpenBSD更倾向用于安全性十分必要的场合,如小型Web服务、文件托管、防火墙和网关。NetBSD是BSD主要发行版中最不流行的一个,它能运行在几乎所有平台上,包括古老的Amigas和Acorn boxes,有时您可以在闭源的网络设备中找到它的身影。 + +#### 等等,怎么会有人将开源代码闭源呢?那在Linux中是不合适的 #### + +对的,这里我们谈到了它与GNU/Linux的主要不同。BSD版本的许可证(很有趣,就叫做BSD许可证)非常不同于我们所知的GPL。对于新手来说,BSD更简短。BSD许可证主要内容是:对这份代码做你想做的事,但要保留它的初始开发者的荣誉,并且如果它搞坏你的电脑时不要提出诉讼。 + +因此,该许可证中没有任何条款强制代码开源,不像GPL,它要求使用这份代码的用户将他们的修改也开源。这一重要的不同引起了互联网上无数的激烈讨论,BSD的粉丝们说他们的许可证更加自由(因为它不那么严格),而GNU/GPL的粉丝说他们的证书才更自由(因为它保留了真正的自由) + +#### 啊呀,不管怎么说,你已经引起了我的兴趣,我在哪里能尝试这些可爱的BSD版本呢? #### + +您大概已经可以猜到这些网站了 – [www.openbsd.org][1]、[www.freebsd.org][2]、[www.netbsd.org][3]。在那里,您可以下载ISO镜像,在VirtualBox中启动它们,然后开始玩耍。如果您已经用了一段时间的Linux,你就会发现这并不难,虽然您需要了解命令行。如果您在寻找一些对新手更加友好的东西,可以试试PC-BSD,PC-BSD([www.pcbsd.org][4])是一个基于FreeBSD的个性化定制版本,它专注于桌面,有美观的图形化安装器和超级简单的软件管理器。 + +祝你玩的愉快! + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/faq-bsd-2/ + +作者:[Mike Saunders][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxvoice.com/author/mike/ +[1]:http://www.openbsd.org/ +[2]:http://www.freebsd.org/ +[3]:http://www.netbsd.org/ +[4]:http://www.pcbsd.org/ diff --git a/published/20150323 How to set up networking between Docker containers.md b/published/20150323 How to set up networking between Docker containers.md new file mode 100644 index 0000000000..6d8434041e --- /dev/null +++ b/published/20150323 How to set up networking between Docker containers.md @@ -0,0 +1,160 @@ +如何在 Docker 容器之间设置网络 +================================================================================ +你也许已经知道了,Docker 容器技术是现有的成熟虚拟化技术的一个替代方案。它被企业应用在越来越多的领域中,比如快速部署环境、简化基础设施的配置流程、多客户环境间的互相隔离等等。当你开始在真实的生产环境使用 Docker 容器去部署应用沙箱时,你可能需要用到多个容器部署一套复杂的多层应用系统,其中每个容器负责一个特定的功能(例如负载均衡、LAMP 栈、数据库、UI 等)。 + +那么问题来了:有多台宿主机,我们事先不知道会在哪台宿主机上创建容器,如果保证在这些宿主机上创建的容器们可以互相联网? + +联网技术哪家强?开源方案找 [weave][1]。这个工具可以为你省下不少烦恼。听我的准没错,谁用谁知道。 + +于是本教程的主题就变成了“**如何使用 weave 在不同主机上的 Docker 容器之间设置网络**”。 + +### Weave 是如何工作的 ### + +![](https://farm8.staticflickr.com/7288/16662287067_27888684a7_b.jpg) + +让我们先来看看 weave 怎么工作:先创建一个由多个 peer 组成的对等网络,每个 peer 是一个虚拟路由器容器,叫做“weave 路由器”,它们分布在不同的宿主机上。这个对等网络的每个 peer 之间会维持一个 TCP 链接,用于互相交换拓扑信息,它们也会建立 UDP 链接用于容器间通信。一个 weave 路由器通过桥接技术连接到本宿主机上的其他容器。当处于不同宿主机上的两个容器想要通信,一台宿主机上的 weave 路由器通过网桥截获数据包,使用 UDP 协议封装后发给另一台宿主机上的 weave 路由器。 + +每个 weave 路由器会刷新整个对等网络的拓扑信息,可以称作容器的 MAC 地址(如同交换机的 MAC 地址学习一样获取其他容器的 MAC 地址),因此它可以决定数据包的下一跳是往哪个容器的。weave 能让两个处于不同宿主机的容器进行通信,只要这两台宿主机在 weave 拓扑结构内连到同一个 weave 路由器。另外,weave 路由器还能使用公钥加密技术将 TCP 和 UDP 数据包进行加密。 + +### 准备工作 ### + +在使用 weave 之前,你需要在所有宿主机上安装 [Docker][2] 环境,参考[这些][3][教程][4],在 Ubuntu 或 CentOS/Fedora 发行版中安装 Docker。 + +Docker 环境部署完成后,使用下面的命令安装 weave: + + $ wget https://github.com/zettio/weave/releases/download/latest_release/weave + $ chmod a+x weave + $ sudo cp weave /usr/local/bin + +注意你的 PATH 环境变量要包含 /usr/local/bin 这个路径,请在 /etc/profile 文件中加入一行(LCTT 译注:要使环境变量生效,你需要执行这个命令: source /etc/profile): + + export PATH="$PATH:/usr/local/bin" + +在每台宿主机上重复上面的操作。 + +Weave 在 TCP 和 UDP 上都使用 6783 端口,如果你的系统开启了防火墙,请确保这两个端口不会被防火墙挡住。 + +### 在每台宿主机上启动 Weave 路由器 ### + +当你想要让处于在不同宿主机上的容器能够互相通信,第一步要做的就是在每台宿主机上启动 weave 路由器。 + +第一台宿主机,运行下面的命令,就会创建并开启一个 weave 路由器容器(LCTT 译注:前面说过了,weave 路由器也是一个容器): + + $ sudo weave launch + +第一次运行这个命令的时候,它会下载一个 weave 镜像,这会花一些时间。下载完成后就会自动运行这个镜像。成功启动后,终端会输出这个 weave 路由器的 ID 号。 + +下面的命令用于查看路由器状态: + + $ sudo weave status + +![](https://farm9.staticflickr.com/8632/16249607573_4514790cf5_c.jpg) + +第一个 weave 路由器就绪了,目前为止整个 peer 对等网络中只有一个 peer 成员。 + +你也可以使用 docker 的命令来查看 weave 路由器的状态: + + $ docker ps + +![](https://farm8.staticflickr.com/7655/16681964438_51d8b18809_c.jpg) + +第二台宿主机部署步骤稍微有点不同,我们需要为这台宿主机的 weave 路由器指定第一台宿主机的 IP 地址,命令如下: + + $ sudo weave launch + +当你查看路由器状态,你会看到两个 peer 成员:当前宿主机和第一个宿主机。 + +![](https://farm8.staticflickr.com/7608/16868571891_e66d4b8841_c.jpg) + +当你开启更多路由器,这个 peer 成员列表会更长。当你新开一个路由器时,要指定前一个宿主机的 IP 地址,请注意不是第一个宿主机的 IP 地址(LCTT 译注:链状结构)。 + +现在你已经有了一个 weave 网络了,它由位于不同宿主机的 weave 路由器组成。 + +### 把不同宿主机上的容器互联起来 ### + +接下来要做的就是在不同宿主机上开启 Docker 容器,并使用虚拟网络将它们互联起来。 + +假设我们创建一个私有网络 10.0.0.0/24 来互联 Docker 容器,并为这些容器随机分配 IP 地址。 + +如果你想新建一个能加入 weave 网络的容器,你就需要使用 weave 命令来创建,而不是 docker 命令。原因是 weave 命令内部会调用 docker 命令来新建容器然后为它设置网络。 + +下面的命令是在宿主机 hostA 上建立一个 Ubuntu 容器,然后将它放到 10.0.0.0/24 网络中,分配的 IP 地址为 10.0.0.1: + + hostA:~$ sudo weave run 10.0.0.1/24 -t -i ubuntu + +成功运行后,终端会显示出容器的 ID 号。你可以使用这个 ID 来访问这个容器: + + hostA:~$ docker attach + +在宿主机 hostB 上,也创建一个 Ubuntu 容器,IP 地址为 10.0.0.2: + + hostB:~$ sudo weave run 10.0.0.2/24 -t -i ubuntu + +访问下这个容器的控制台: + + hostB:~$ docker attach + +这两个容器能够互相 ping 通,你可以通过容器的控制台检查一下。 + +![](https://farm9.staticflickr.com/8566/16868571981_d73c8e401b_c.jpg) + +如果你检查一下每个容器的网络配置,你会发现有一块名为“ethwe”的网卡,你分配给容器的 IP 地址出现在它们那里(比如这里分别是 10.0.0.1 和 10.0.0.2)。 + +![](https://farm8.staticflickr.com/7286/16681964648_013f9594b1_b.jpg) + +### Weave 的其他高级用法 ### + +weave 提供了一些非常巧妙的特性,我在这里作下简单的介绍。 + +#### 应用分离 #### + +使用 weave,你可以创建多个虚拟网络,并为每个网络设置不同的应用。比如你可以为一群容器创建 10.0.0.0/24 网络,为另一群容器创建 10.10.0.0/24 网络,weave 会自动帮你维护这些网络,并将这两个网络互相隔离。另外,你可以灵活地将一个容器从一个网络移到另一个网络而不需要重启容器。举个例子: + +首先开启一个容器,运行在 10.0.0.0/24 网络上: + + $ sudo weave run 10.0.0.2/24 -t -i ubuntu + +然后让它脱离这个网络: + + $ sudo weave detach 10.0.0.2/24 + +最后将它加入到 10.10.0.0/24 网络中: + + $ sudo weave attach 10.10.0.2/24 + +![](https://farm8.staticflickr.com/7639/16247212144_c31a49714d_c.jpg) + +现在这个容器可以与 10.10.0.0/24 网络上的其它容器进行通信了。这在当你创建一个容器而网络信息还不确定时就很有帮助了。 + +#### 将 weave 网络与宿主机网络整合起来 #### + +有时候你想让虚拟网络中的容器能访问物理主机的网络。或者相反,宿主机需要访问容器。为满足这个功能,weave 允许虚拟网络与宿主机网络整合。 + +举个例子,在宿主机 hostA 上一个容器运行在 10.0.0.0/24 中,运行使用下面的命令: + + hostA:~$ sudo weave expose 10.0.0.100/24 + +这个命令把 IP 地址 10.0.0.100 分配给宿主机 hostA,这样一来宿主机 hostA 也连到了 10.0.0.0/24 网络上了。显然,你在为宿主机选择 IP 地址的时候,需要选一个没有被其他容器使用的地址。 + +现在 hostA 就可以访问 10.0.0.0/24 上的所有容器了,不管这些容器是否位于 hostA 上。好巧妙的设定啊,32 个赞! + +### 总结 ### + +如你所见,weave 是一个很有用的 docker 网络配置工具。这个教程只是它[强悍功能][5]的冰山一角。如果你想进一步玩玩,你可以试试它的以下功能:多跳路由功能,这个在 multi-cloud 环境(LCTT 译注:多云,企业使用多个不同的云服务提供商的产品,比如 IaaS 和 SaaS,来承载不同的业务)下还是很有用的;动态重路由功能是一个很巧妙的容错技术;或者它的分布式 DNS 服务,它允许你为你的容器命名。如果你决定使用这个好东西,欢迎分享你的使用心得。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/networking-between-docker-containers.html + +作者:[Dan Nanni][a] +译者:[bazz2](https://github.com/bazz2) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:https://github.com/zettio/weave +[2]:http://xmodulo.com/recommend/dockerbook +[3]:http://xmodulo.com/manage-linux-containers-docker-ubuntu.html +[4]:http://xmodulo.com/docker-containers-centos-fedora.html +[5]:http://zettio.github.io/weave/features.html diff --git a/published/20150326 A Peep into Process Management Commands in Linux.md b/published/20150326 A Peep into Process Management Commands in Linux.md new file mode 100644 index 0000000000..705ec14d6d --- /dev/null +++ b/published/20150326 A Peep into Process Management Commands in Linux.md @@ -0,0 +1,191 @@ +12个进程管理命令介绍 +================================================================================ +执行中的程序在称作进程。当程序以可执行文件存放在存储中,并且运行的时候,每个进程会被动态得分配系统资源、内存、安全属性和与之相关的状态。可以有多个进程关联到同一个程序,并同时执行不会互相干扰。操作系统会有效地管理和追踪所有运行着的进程。 + +为了管理这些进程,用户应该能够: + +- 查看所有运行中的进程 +- 查看进程消耗资源 +- 定位个别进程并且对其执行指定操作 +- 改变进程的优先级 +- 杀死指定进程 +- 限制进程可用的系统资源等 + +Linux提供了许多命令来让用户来高效掌控上述的操作。接下来,一个一个的来讲解下。 + +### 1. ps ### + +'ps'是Linux 中最基础的浏览系统中的进程的命令。能列出系统中运行的进程,包括进程号、命令、CPU使用量、内存使用量等。下述选项可以得到更多有用的消息。 + + ps -a - 列出所有运行中/激活进程 + +![Output of "ps -a" command](http://blog.linoxide.com/wp-content/uploads/2015/02/ps-a2.png) + + ps -ef |grep - 列出需要进程 + ps -aux - 显示进程信息,包括无终端的(x)和针对用户(u)的进程:如USER, PID, %CPU, %MEM等 + +### 2. pstree ### + +linux中,每一个进程都是由其父进程创建的。此命令以可视化方式显示进程,通过显示进程的树状图来展示进程间关系。如果指定了pid了,那么树的根是该pid,不然将会是init(pid: 1)。 + +![pstree](http://blog.linoxide.com/wp-content/uploads/2015/02/pstree.png) + +### 3. top ### + +‘top’是一个更加有用的命令,可以监视系统中不同的进程所使用的资源。它提供实时的系统状态信息。显示进程的数据包括 PID、进程属主、优先级、%CPU、%memory等。可以使用这些显示指示出资源使用量。 + +![top](http://blog.linoxide.com/wp-content/uploads/2015/02/top.png) + +### 4. htop ### + +htop与top很类似,但是htop是交互式的文本模式的进程查看器。它通过文字图形化地显示每一个进程的CPU和内存使用量、swap使用量。使用上下光标键选择进程,F7和F8改变优先级,F9杀死进程。Htop不是系统默认安装的,所以需要额外安装。 + +![htop output](http://blog.linoxide.com/wp-content/uploads/2015/03/htop1.png) + +### 5. nice ### + +通过nice命令的帮助,用户可以设置和改变进程的优先级。提高一个进程的优先级,内核会分配更多CPU时间片给这个进程。默认情况下,进程以0的优先级启动。进程优先级可以通过top命令显示的NI(nice value)列查看。 + +进程优先级值的范围从-20到19。值越低,优先级越高。 + + nice <优先值> <进程名> - 通过给定的优先值启动一个程序 + +![nice command](http://blog.linoxide.com/wp-content/uploads/2015/02/nice-cmd.png) + +![changed nice value of 'top'](http://blog.linoxide.com/wp-content/uploads/2015/02/top-nice.png) + +上述命令例子中,可以看到‘top’命令获得了-3的优先值。 + +### 6. renice ### + +renice命令类似nice命令。使用这个命令可以改变正在运行的进程优先值。注意,用户只能改变属于他们自己的进程的优先值。 + + renice -n -p - 改变指定进程的优先值 + +![renice command](http://blog.linoxide.com/wp-content/uploads/2015/02/renice2.png) + +初始优先值为0的3806号进程优先值已经变成了4. + + renice -u -g - 通过指定用户和组来改变进程优先值 + +![output of renice for a user group](http://blog.linoxide.com/wp-content/uploads/2015/02/renice1.png) + +上述例子中,用户为‘mint’的所有进程优先值变为‘-3’。 + +### 7. kill ### + +这个命令用于发送信号来结束进程。如果一个进程没有响应杀死命令,这也许就需要强制杀死,使用-9参数来执行。注意,使用强制杀死的时候一定要小心,因为进程没有时机清理现场,也许写入文件没有完成。如果我们不知道进程PID或者打算用名字杀死进程时候,killall就能派上用场。 + + kill + + kill -9 + + killall -9 - 杀死所有拥有同样名字的进程 + +如果你使用kill,你需要知道进程ID号。pkill是类似的命令,但使用模式匹配,如进程名,进程拥有者等。 + + pkill <进程名> + +![kill initiated](http://blog.linoxide.com/wp-content/uploads/2015/02/kill-initiated.png) + +![kill](http://blog.linoxide.com/wp-content/uploads/2015/02/kill.png) + +### 8. ulimit ### + +该命令用于控制系统资源在shell和进程上的分配量。对于系统管理员是最有用的,可以管理重度使用和存在性能问题的系统。限制资源大小可以确保重要进程持续运行,其他进程不会占用过多资源。 + + ulimit -a - 显示当前用户关联的资源限制 + +![ulimit -a](http://blog.linoxide.com/wp-content/uploads/2015/02/ulimit-a.png) + + -f - 最大文件尺寸大小 + + -v - 最大虚拟内存大小(KB) + + -n - 增加最大文件描述符数量 + + -H : 改变和报告硬限制 + + -S : 改变和报告软限制 + +浏览ulimit man页面获取更多选项。 + +### 9. w ### + +w 提供当前登录的用户及其正在执行的进程的信息。显示信息头包含信息,如当前时间、系统运行时长、登录用户总数、过去的1,5,15分钟内的负载均衡数。 + +基于这些用户信息,用户在终止不属于他们的进程时要小心。 + +!['w' command](http://blog.linoxide.com/wp-content/uploads/2015/02/w.png) + +**who**是类似命令,提供当前登录用户列表、系统启动时间、运行级别等。 + +!['who' command](http://blog.linoxide.com/wp-content/uploads/2015/02/who.png) + +**whoami** 命令输出当前用户ID + +!['whoami' command](http://blog.linoxide.com/wp-content/uploads/2015/02/whoami.png) + +### 10. pgrep ### + +pgrep的意思是"进程号全局正则匹配输出"。该命令扫描当前运行进程,然后按照命令匹配条件列出匹配结果到标准输出。对于通过名字检索进程号是很有用。 + + pgrep -u mint sh + +这个命令将会显示用户为‘mint’和进程名为‘sh’的进程ID。 + +![output of pgrep](http://blog.linoxide.com/wp-content/uploads/2015/03/pgrep.png) + +### 11. fg , bg ### + +有时,命令需要很长的时间才能执行完成。对于这种情况,我们使用‘bg’命令可以将任务放在后台执行,而用‘fg’可以调到前台来使用。 + +我们可以通过‘&’在后台启动一个程序: + + find . -name *iso > /tmp/res.txt & + +一个正在运行的程序也可以通过“CTRL+Z”和“bg”命令组合放到后台运行。 + + find . -name *iso > /tmp/res.txt & - 启动一个程序 + + ctrl+z - 挂起当前执行程序 + + bg - 将程序放到后台运行 + +我们可以使用‘jobs’命令列出所有后台进程。 + + jobs + +使用‘fg’命令可以将后台程序调到前台执行。 + + fg %进程id + +![output of fg, bg and jobscommands](http://blog.linoxide.com/wp-content/uploads/2015/03/fg-bg-jobs.png) + +### 12. ipcs ### + +ipcs命令报告进程间通信设施状态。(共享内存,信号量和消息队列) + +用-p参数联合-m、-s或-q使用,可以获得相关的进程间通信的进程ID。 + + ipcs -p -m + +下面屏幕截图列出了最近访问了共享内存段的进程的创建者的ID和进程ID。 + +![ipcs command](http://blog.linoxide.com/wp-content/uploads/2015/03/ipcs.png) + +### 总结 ### + +总之 ,这些命令可以帮助管理员修复问题和改善性能。同样作为一名普通用户也需要解决进程出现的问题。所以,熟悉如此繁多的命令,从能有效管理进程是行之有效。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/process-management-commands-linux/ + +作者:[B N Poornima][a] +译者:[VicYu/Vic020](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bnpoornima/ diff --git a/published/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md b/published/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md new file mode 100644 index 0000000000..ef30371412 --- /dev/null +++ b/published/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md @@ -0,0 +1,101 @@ +如何在Linux下使用Gitblit工具创建Git仓库服务 +================================================================================ +嗨!朋友,今天我们将学习如何在你的Linux服务器或者PC上安装Gitblit工具。首先,我们看看什么是Git,它的功能以及安装Gitblit的步骤。[Git是分布式版本控制系统][1],它强调速度、数据一致性,并且支持分布式、非线性工作流。它最初由Linus Torvalds在2005年为Linux内核设计和开发,使用GPLv2证书,并从此成为软件开发中使用最广泛的版本控制系统。 + +[Gitblit是完全开源的软件][2],它基于纯粹的Java堆栈,被设计以在Git仓库速度和效率方面胜任从小型到极大型的项目。它很容易学习和上手,并有着闪电般的性能。它在很多方面远胜 Subversion、CVS、Perforce和ClearCase等SCM(版本控制)工具,比如,如快速本地分支、易于暂存、多工作流等。 + +#### Gitblit的功能 #### + +- 它可以做为一个哑仓库视图,没有管理控制以及用户账户。 +- 它可以做为完整的Git服务,拥有克隆、推送和仓库访问控制。 +- 它能独立于其他Git工具使用(包括实际的Git),它能和您已有的工具协作。 + +### 1.创建Gitblit安装目录 ### + +首先我们将在我们的服务器上建立一个目录,并在该目录下安装最新的Gitblit。 + + $ sudo mkdir -p /opt/gitblit + + $ cd /opt/gitblit + +![创建gitblit目录](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png) + +### 2. 下载并解压 ### + +现在,我们将从Gitblit官方站点下载最新版的Gitblit。这里我们将安装1.6.2版本。所以,请在安装时根据具体的版本对命令进行修改。 + + $ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz + +![下载gitblit安装包](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png) + +接下来,我们将下载到的tar压缩包解压至之前创建的目录 /opt/gitblit/ + + $ sudo tar -zxvf gitblit-1.6.2.tar.gz + +![解压gitblit压缩包](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png) + +### 3.配置并运行 ### + +现在,我们将对Gitblit进行配置。如果你想要定制Gitblit的行为,你可以修改`gitblit/data/gitblit.properties`。在完成配置后,我们将运行安装好的gitblit。有两种方式来运行gitblit,第一种是通过下面的命令手动运行: + + $ sudo java -jar gitblit.jar --baseFolder data + +另一种是将gitblit添加为服务。下面是在linux下将gitblit添加为服务的步骤。 + +由于我在使用Ubuntu,下面的命令将是 sudo cp service-ubuntu.sh /etc/init.d/gitblit,所以请根据你的发行版修改文件名service-ubuntu.sh为相应的你运行的发行版。 + + $ sudo ./install-service-ubuntu.sh + + $ sudo service gitblit start + +![启动gitblit服务](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png) + +在你的浏览器中打开`http://localhost:8080`或`https://localhost:8443`,也可以将localhost根据本地配置替换为IP地址。输入默认的管理员凭证:admin / admin并点击login按钮。 + +![gitblit欢迎页面](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png) + +现在,我们将添加一个新的用户。首先,你需要以admin用户登录,username = **admin**,password = **admin**。 + +然后,点击用户图标 > users > (+) new user 来创建一个新用户,如下图所示。 + +![添加新用户](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png) + +现在,我们将创建一个开箱可用的仓库。点击 repositories > (+) new repository。然后,如下图所示添加新的仓库。 + +![添加新的仓库](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png) + +#### 使用命令行创建一个新的仓库 #### + + touch README.md + git init + git add README.md + git commit -m "first commit" + git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git + git push -u origin master + +请将其中的用户名arunlinoxide替换为你添加的用户名。 + +#### 在命令行中push一个已存在的仓库 #### + + git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git + git push -u origin master + +**注意**:强烈建议所有人修改用户名“admin”的密码。 + +### 结论 ### + +欢呼吧!我们已经在Linux电脑中安装好了最新版本的Gitblit。接下来我们便可以在我们的大小项目中享受这样一个优美的版本控制系统。有了Gitblit,版本控制便再容易不过了。它有易于学习、轻量级、高性能的特点。因此,如果你有任何的问题、建议和反馈,请在留言处留言。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/ + +作者:[Arun Pyasi][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://git-scm.com/ +[2]:http://gitblit.com/ \ No newline at end of file diff --git a/published/20150331 How to Install WordPress with Nginx in a Docker Container.md b/published/20150331 How to Install WordPress with Nginx in a Docker Container.md new file mode 100644 index 0000000000..e24767bd84 --- /dev/null +++ b/published/20150331 How to Install WordPress with Nginx in a Docker Container.md @@ -0,0 +1,349 @@ +如何在 Docker 容器中架设一个完整的 WordPress 站点 +================================================================================ + +大家好,今天我们来学习一下如何在 Docker 容器里运行的 Nginx Web 服务器中安装 WordPress。WordPress 是一个很好的免费开源的内容管理系统,全球成千上万的网站都在使用它。[Docker][1] 是一个开源项目,提供了一个可以打包、装载和运行任何应用的轻量级容器的开放平台。它没有语言支持、框架和打包系统的限制,从小型的家用电脑到高端服务器,在何时何地都可以运行。这使它们可以不依赖于特定软件栈和供应商,像一块块积木一样部署和扩展网络应用、数据库和后端服务。 + +今天,我们会在 docker 容器上部署最新的 WordPress 软件包,包括需要的前提条件,例如 Nginx Web 服务器、PHP5、MariaDB 服务器等。下面是在运行在 Docker 容器上成功安装 WordPress 的简单步骤。 + +### 1. 安装 Docker ### + +在我们真正开始之前,我们需要确保在我们的 Linux 机器上已经安装了 Docker。我们使用的主机是 CentOS 7,因此我们用下面的命令使用 yum 管理器安装 docker。 + + # yum install docker + +![安装 Docker](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-docker.png) + + # systemctl restart docker.service + +### 2. 创建 WordPress 的 Dockerfile ### + +我们需要创建用于自动安装 wordpress 以及其前置需求的 Dockerfile。这个 Dockerfile 将用于构建 WordPress 的安装镜像。这个 WordPress Dockerfile 会从 Docker Registry Hub 获取 CentOS 7 镜像并用最新的可用更新升级系统。然后它会安装必要的软件,例如 Nginx Web 服务器、PHP、MariaDB、Open SSH 服务器,以及其它保证 Docker 容器正常运行不可缺少的组件。最后它会执行一个初始化 WordPress 安装的脚本。 + + # nano Dockerfile + +然后,我们需要将下面的配置行添加到 Dockerfile中。 + + FROM centos:centos7 + MAINTAINER The CentOS Project + + RUN yum -y update; yum clean all + RUN yum -y install epel-release; yum clean all + RUN yum -y install mariadb mariadb-server mariadb-client nginx php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy php-apc pwgen python-setuptools curl git tar; yum clean all + ADD ./start.sh /start.sh + ADD ./nginx-site.conf /nginx.conf + RUN mv /nginx.conf /etc/nginx/nginx.conf + RUN rm -rf /usr/share/nginx/html/* + RUN /usr/bin/easy_install supervisor + RUN /usr/bin/easy_install supervisor-stdout + ADD ./supervisord.conf /etc/supervisord.conf + RUN echo %sudo ALL=NOPASSWD: ALL >> /etc/sudoers + ADD http://wordpress.org/latest.tar.gz /wordpress.tar.gz + RUN tar xvzf /wordpress.tar.gz + RUN mv /wordpress/* /usr/share/nginx/html/. + RUN chown -R apache:apache /usr/share/nginx/ + RUN chmod 755 /start.sh + RUN mkdir /var/run/sshd + + EXPOSE 80 + EXPOSE 22 + + CMD ["/bin/bash", "/start.sh"] + +![Wordpress Docker 文件](http://blog.linoxide.com/wp-content/uploads/2015/03/Dockerfile-wordpress.png) + +### 3. 创建启动脚本 ### + +我们创建了 Dockerfile 之后,我们需要创建用于运行和配置 WordPress 安装的脚本,名称为 start.sh。它会为 WordPress 创建并配置数据库和密码。用我们喜欢的文本编辑器打开 start.sh。 + + # nano start.sh + +打开 start.sh 之后,我们要添加下面的配置行到文件中。 + + #!/bin/bash + + __check() { + if [ -f /usr/share/nginx/html/wp-config.php ]; then + exit + fi + } + + __create_user() { + # 创建用于 SSH 登录的用户 + SSH_USERPASS=`pwgen -c -n -1 8` + useradd -G wheel user + echo user:$SSH_USERPASS | chpasswd + echo ssh user password: $SSH_USERPASS + } + + __mysql_config() { + # 启用并运行 MySQL + yum -y erase mariadb mariadb-server + rm -rf /var/lib/mysql/ /etc/my.cnf + yum -y install mariadb mariadb-server + mysql_install_db + chown -R mysql:mysql /var/lib/mysql + /usr/bin/mysqld_safe & + sleep 10 + } + + __handle_passwords() { + # 在这里我们生成随机密码(多亏了 pwgen)。前面两个用于 mysql 用户,最后一个用于 wp-config.php 的随机密钥。 + WORDPRESS_DB="wordpress" + MYSQL_PASSWORD=`pwgen -c -n -1 12` + WORDPRESS_PASSWORD=`pwgen -c -n -1 12` + # 这是在日志中显示的密码。 + echo mysql root password: $MYSQL_PASSWORD + echo wordpress password: $WORDPRESS_PASSWORD + echo $MYSQL_PASSWORD > /mysql-root-pw.txt + echo $WORDPRESS_PASSWORD > /wordpress-db-pw.txt + # 这里原来是一个包括 sed、cat、pipe 和 stuff 的很长的行,但多亏了 + # @djfiander 的 https://gist.github.com/djfiander/6141138 + # 现在没有了 + sed -e "s/database_name_here/$WORDPRESS_DB/ + s/username_here/$WORDPRESS_DB/ + s/password_here/$WORDPRESS_PASSWORD/ + /'AUTH_KEY'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'SECURE_AUTH_KEY'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'LOGGED_IN_KEY'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'NONCE_KEY'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'AUTH_SALT'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'SECURE_AUTH_SALT'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'LOGGED_IN_SALT'/s/put your unique phrase here/`pwgen -c -n -1 65`/ + /'NONCE_SALT'/s/put your unique phrase here/`pwgen -c -n -1 65`/" /usr/share/nginx/html/wp-config-sample.php > /usr/share/nginx/html/wp-config.php + } + + __httpd_perms() { + chown apache:apache /usr/share/nginx/html/wp-config.php + } + + __start_mysql() { + # systemctl 启动 mysqld 服务 + mysqladmin -u root password $MYSQL_PASSWORD + mysql -uroot -p$MYSQL_PASSWORD -e "CREATE DATABASE wordpress; GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY '$WORDPRESS_PASSWORD'; FLUSH PRIVILEGES;" + killall mysqld + sleep 10 + } + + __run_supervisor() { + supervisord -n + } + + # 调用所有函数 + __check + __create_user + __mysql_config + __handle_passwords + __httpd_perms + __start_mysql + __run_supervisor + +![启动脚本](http://blog.linoxide.com/wp-content/uploads/2015/03/start-script.png) + +增加完上面的配置之后,保存并关闭文件。 + +### 4. 创建配置文件 ### + +现在,我们需要创建 Nginx Web 服务器的配置文件,命名为 nginx-site.conf。 + + # nano nginx-site.conf + +然后,增加下面的配置信息到配置文件。 + + user nginx; + worker_processes 1; + + error_log /var/log/nginx/error.log; + #error_log /var/log/nginx/error.log notice; + #error_log /var/log/nginx/error.log info; + + pid /run/nginx.pid; + events { + worker_connections 1024; + } + http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format main '$remote_addr - $remote_user [$time_local] "$request" ' + '$status $body_bytes_sent "$http_referer" ' + '"$http_user_agent" "$http_x_forwarded_for"'; + + access_log /var/log/nginx/access.log main; + + sendfile on; + #tcp_nopush on; + + #keepalive_timeout 0; + keepalive_timeout 65; + + #gzip on; + + index index.html index.htm index.php; + + # Load modular configuration files from the /etc/nginx/conf.d directory. + # See http://nginx.org/en/docs/ngx_core_module.html#include + # for more information. + include /etc/nginx/conf.d/*.conf; + + server { + listen 80; + server_name localhost; + + #charset koi8-r; + + #access_log logs/host.access.log main; + root /usr/share/nginx/html; + + #error_page 404 /404.html; + + # redirect server error pages to the static page /50x.html + # + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + + # proxy the PHP scripts to Apache listening on 127.0.0.1:80 + # + #location ~ \.php$ { + # proxy_pass http://127.0.0.1; + #} + + # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 + # + location ~ \.php$ { + + root /usr/share/nginx/html; + try_files $uri =404; + fastcgi_pass 127.0.0.1:9000; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} + + } + } + +![Nginx 配置](http://blog.linoxide.com/wp-content/uploads/2015/03/nginx-conf.png) + +现在,创建 supervisor.conf 文件并添加下面的行。 + + # nano supervisord.conf + +然后,添加以下行。 + + [unix_http_server] + file=/tmp/supervisor.sock ; (the path to the socket file) + + [supervisord] + logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) + logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) + logfile_backups=10 ; (num of main logfile rotation backups;default 10) + loglevel=info ; (log level;default info; others: debug,warn,trace) + pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid) + nodaemon=false ; (start in foreground if true;default false) + minfds=1024 ; (min. avail startup file descriptors;default 1024) + minprocs=200 ; (min. avail process descriptors;default 200) + + ; the below section must remain in the config file for RPC + ; (supervisorctl/web interface) to work, additional interfaces may be + ; added by defining them in separate rpcinterface: sections + [rpcinterface:supervisor] + supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface + + [supervisorctl] + serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket + + [program:php-fpm] + command=/usr/sbin/php-fpm -c /etc/php/fpm + stdout_events_enabled=true + stderr_events_enabled=true + + [program:php-fpm-log] + command=tail -f /var/log/php-fpm/php-fpm.log + stdout_events_enabled=true + stderr_events_enabled=true + + [program:mysql] + command=/usr/bin/mysql --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306 + stdout_events_enabled=true + stderr_events_enabled=true + + [program:nginx] + command=/usr/sbin/nginx + stdout_events_enabled=true + stderr_events_enabled=true + + [eventlistener:stdout] + command = supervisor_stdout + buffer_size = 100 + events = PROCESS_LOG + result_handler = supervisor_stdout:event_handler + +![Supervisord 配置](http://blog.linoxide.com/wp-content/uploads/2015/03/supervisord.png) + +添加完后,保存并关闭文件。 + +### 5. 构建 WordPress 容器 ### + +现在,完成了创建配置文件和脚本之后,我们终于要使用 Dockerfile 来创建安装最新的 WordPress CMS(译者注:Content Management System,内容管理系统)所需要的容器,并根据配置文件进行配置。做到这点,我们需要在对应的目录中运行以下命令。 + + # docker build --rm -t wordpress:centos7 . + +![构建 WordPress 容器](http://blog.linoxide.com/wp-content/uploads/2015/03/building-wordpress-container.png) + +### 6. 运行 WordPress 容器 ### + +现在,执行以下命令运行新构建的容器,并为 Nginx Web 服务器和 SSH 访问打开88 和 22号相应端口 。 + + # CID=$(docker run -d -p 80:80 wordpress:centos7) + +![运行 WordPress Docker](http://blog.linoxide.com/wp-content/uploads/2015/03/run-wordpress-docker.png) + +运行以下命令检查进程以及容器内部执行的命令。 + + # echo "$(docker logs $CID )" + +运行以下命令检查端口映射是否正确。 + + # docker ps + +![docker 状态](http://blog.linoxide.com/wp-content/uploads/2015/03/docker-state.png) + +### 7. Web 界面 ### + +最后如果一切正常的话,当我们用浏览器打开 http://ip-address/ 或者 http://mywebsite.com/ 的时候会看到 WordPress 的欢迎界面。 + +![启动Wordpress](http://blog.linoxide.com/wp-content/uploads/2015/03/wordpress-start.png) + +现在,我们将通过 Web 界面为 WordPress 面板设置 WordPress 的配置、用户名和密码。 + +![Wordpress 欢迎界面](http://blog.linoxide.com/wp-content/uploads/2015/03/wordpress-welcome.png) + +然后,用上面用户名和密码输入到 WordPress 登录界面。 + +![wordpress 登录](http://blog.linoxide.com/wp-content/uploads/2015/03/wordpress-login.png) + +### 总结 ### + +我们已经成功地在以 CentOS 7 作为 docker OS 的 LEMP 栈上构建并运行了 WordPress CMS。从安全层面来说,在容器中运行 WordPress 对于宿主系统更加安全可靠。这篇文章介绍了在 Docker 容器中运行的 Nginx Web 服务器上使用 WordPress 的完整配置。如果你有任何问题、建议、反馈,请在下面的评论框中写下来,让我们可以改进和更新我们的内容。非常感谢!Enjoy :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-wordpress-nginx-docker-container/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://docker.io/ \ No newline at end of file diff --git a/published/201504/20141106 Exaile 3.4.1 Overview--A Feature-Complete GNOME Music Player.md b/published/201504/20141106 Exaile 3.4.1 Overview--A Feature-Complete GNOME Music Player.md new file mode 100644 index 0000000000..af58c52b1d --- /dev/null +++ b/published/201504/20141106 Exaile 3.4.1 Overview--A Feature-Complete GNOME Music Player.md @@ -0,0 +1,75 @@ +Exaile 3.4.1 概览:一个全功能的GNOME音乐播放器 +================================================================================ +**Exaile** 在过去两年显得有些平静,也许只有一个或者两个稳定版发布,但尽管如此,在功能方面,它是一个和[Rhythmbox][1]或者[Banshee][2]相匹敌的全功能GNOME音乐播放器。不过,在过去的两个月,在"We’re not dead yet"的口号下,他们推出了一个新的稳定版3.4,同时在11月1日还推出了3.4.1增量版本。事实上,Exaile有很多的功能,我可以继续写很多的文章而不是在一篇文章里全部介绍到,就让我们来看一下一些最显著的特点吧。 + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile02.jpg) + +[Exaile][3]是基于GTK-2,用Python写的音乐播放器,它能很好地兼容GNOME,有和旧的Amarok1.4或者Clementine非常类似的界面,以及一些很好的功能。界面主要由两个面板组成,两个都支持标签。左边的面板提供对音乐集,网络音频,智能和自定义播放列表,文件浏览,播客,组标签以及歌词的访问,窗口的主要部分是播放列表(支持多个列表,以标签方式组织的播放列表)和控制按钮。 + +Exaile的界面和Clementine或者Amarok1.4非常相似,可以显示或者隐藏左边的标签。 + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile04.jpg) + +版本3.4增加了很多新的主要功能和更改,而3.4.1是一个小的bug修复版本。版本3.4的新功能包括类似Icecast的新插件,歌词同步,播放列表分析器,Soma.fm,以及新的更简单的插件API。用户界面和一般操作也作了修改,包括可以在多个面板显示播放列表,关闭左边的面板以及更好的BPM用户界面集成。 + +第一次打开Exaile你可以添加歌曲文件夹到音乐集中-你也可以选择添加文件夹并设置在打开Exaile的时候是否监视或者扫描这些文件夹: + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile01.jpg) + +Exaile的功能几乎不尽其数。你可以在音乐集中组织音乐,听播客,对音乐进行评分,编辑标签,查看文件属性,排列歌曲,查看歌曲和封面,按照多种方式排序播放列表,更改播放行为和外观风格。 + +均衡器,封面管理以及收听网络电台: + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile05.jpg) + +自动检测本地专辑封面,可以全尺寸显示,放大或者缩小: + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile03.jpg) + +首选项窗口允许配置Exaile的各个方面,包括启用或者禁用插件,外观,系统托盘集成或者播放模式。外观设置允许你更改标签的布局,显示或者隐藏便签栏,启用或者禁用透明性或者禁用启动画面。 + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_preferences_01.jpg) + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_preferences_02.jpg) + +系统托盘集成提供了一个快速播放或者暂停音乐,对音乐评分或者更改音乐列表播放模式(随机,重复或者动态)的菜单。 + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_tray.jpg) + +![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_tray.jpg) + +我相信Exaile数不尽的功能使它成为音乐播放器的完美选择,尤其是对于GNOME用户。每个用户都会对丰富多样的选项和高度可配置的方式感到满意。 + +### 在Ubuntu 14.04 和 14.10上安装Exaile 3.4.1 ### + +从源码编译并安装和简单明了。首先获取依赖包: + + sudo apt-get build-dep exaile + sudo apt-get install python-gst0.10 + +从[下载页面][4](或者直接点击[这里][5])下载源码包,然后解压: + + tar -xf exaile-3.4.1.tar.gz + +更改工作目录到exaile-3.4.1然后运行下面的命令: + + make + sudo make install + +二进制可执行文件将被安装为 **/usr/local/bin/exaile**. + +-------------------------------------------------------------------------------- + +via: http://www.tuxarena.com/2014/11/exaile-3-4-1-overview-a-feature-complete-gnome-music-player/ + +作者:Craciun Dan +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:https://wiki.gnome.org/Apps/Rhythmbox +[2]:http://banshee.fm/ +[3]:http://www.exaile.org/ +[4]:http://www.exaile.org/download/ +[5]:https://github.com/exaile-dev/exaile/archive/3.4.1.tar.gz \ No newline at end of file diff --git a/published/201504/20141204 Intense Gameplay--Try these 13 Roguelike games.md b/published/201504/20141204 Intense Gameplay--Try these 13 Roguelike games.md new file mode 100644 index 0000000000..f271a53e1f --- /dev/null +++ b/published/201504/20141204 Intense Gameplay--Try these 13 Roguelike games.md @@ -0,0 +1,401 @@ +想找点激烈的游戏?那就试试这 13 款 Roguelike 游戏吧! +================================================================================ +Roguelike 是角色扮演游戏的一个子类。从字面上看,它的意思是 “像 Rogue 的游戏”。Rogue 是一个关于地下城冒险的视频游戏,于 1980 年第一次发行,以极其上瘾而著称。这个游戏的目标是取得深藏于第 26 层的 "Amulet of Yendor",再返回到顶层逃出生天。 + +Roguelike 的准确定义并不存在,但这类游戏通常具有下面的特点: + +- 奇幻的叙事背景; +- 用程序产生关卡。游戏中的绝大多数场景在开始新的游戏时由游戏自动创建。这样做是为了鼓励玩家不断重玩; +- 回合制的地下城探险和战斗; +- 随机生成的基于贴片的图形环境; +- 随机发生战斗; +- 永久死亡 :在游戏中,死亡真的存在,一旦你的角色死了,那就真的结束了; +- 高难度。 + +这篇文章精心挑选了一些可运行在 Linux 平台下的 roguelike 游戏。假如你喜欢激烈、易上瘾的游戏,可以尝试这 13 款游戏。不要因它们原始的画质而退缩,一旦你沉浸其中,你将很快忘记画面的简陋。所有的这些都可以免费下载,并且几乎所有的游戏都是在开源协议下发行的。 + +---------- + +###Dungeon Crawl Stone Soup + +![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-Dungeon1.png) + +Dungeon Crawl Stone Soup 是一个开源的,单用户角色扮演类的 roguelike 游戏,玩家要在遍布危险而充满敌意的怪兽的地下城中进行探险和寻找宝藏,并在任务中拯救传说中的神秘 Zot 宝珠。 + +Dungeon Crawl Stone Soup 是 Linley 开发的 Dungeon Crawl 游戏的延续。它是公开开发的,并邀请 Crawl 社区的人员来参与其中。 + +Dungeon Crawl 有着超棒且深层次的战术游戏环节,创新的魔法和信仰系统,以及数量宏大的和你战斗的怪兽。Crawl 也是最难以攻陷的 roguelike 游戏之一。当你最终在游戏中通关,将胜利宣言张贴在 rec.games.roguelike.misc 时,你才会知道这有多么令人骄傲! + +特点包括: + +- 丰富多彩的、富含深层次战术的 roguelike 游戏; +- 手绘地图; +- 无数的金库; +- 漂亮的界面; +- 创新的魔法和信仰系统; +- 各种神灵,角色,物品和聪明的怪兽; + +- 网站: [crawl.develz.org][1] +- 开发者: Stone Soup 开发小组 +- 协议: Crawl General Public License +- 版本号: 0.15.2 + +---------- + +###Dwarf Fortress + +![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-DwarfFortress.png) + +Dwarf Fortress 是一个单人魔幻游戏,与 NetHack 类似。你可以在一个随机生成的持久的世界中,控制一个矮人哨兵或一个冒险者。 + +这个游戏的特色有:三种游戏模式(矮人要塞,冒险者,传说模式),一个独特的随机生成的世界(由地形,野生生物和传奇生物等组成), 阴森的战斗机制以及各种邪恶鱼群。 + +特点包括: + +- 在这个世界里,你想玩多久都可以。可以经历许多次游戏,记录历史事件,对更改进行跟踪等; +- 当你扮演的矮人在山群中寻找宝藏时,你可以对他们下达命令 + - 用各种材料来手工制作珍宝、物品,并可以用贵重金属、宝石等来改进它们; + - 通过各种手段保护你自己,防御来自敌对文明的袭击; + - 支持贵族,他们会管理你的民众 + - 让你的矮人高兴起来,了解他们工作和休闲时的想法; + - 不同的 Z 坐标可以使你在多个层级上建造你的堡垒。建立塔台或征服地下深处; + - 建立水闸来灌溉作物或用水淹没你的对手; +- 扮演一个探险者并进行探索,为荣誉而战或复仇 + - 与以前的游戏中的对手相遇; + - 在你经过的旅途中营救小城里的人们; + - 没有繁琐的情节,只需要探索; + - 无缝连接的漫游游戏世界-总共达到 197376 x 197376 平方 -可以在区域地图上更快速地穿行; + - 接受小镇或文明社会的领导所委托的任务; + - 可以找到你以前的角色,以一个新的角色带上他们来一场新的冒险,或者直接重新激活并使用他们; + - 通过 Z 轴使得你可以在各个地下城的不同层级间和结构间平滑的上下移动来和对手战斗; +- 战斗模式是通过技巧、身体部位、搏斗、在不同区域间蓄势和躲避,体验流血、疼痛,恶心及其他感受; +- 一个动态的天气模型跟踪风,湿度及空气流动,以创造冷暖气流锋面、风、暴风雨雪; +- 超过 200 种岩石和矿物类型被引入到了游戏世界,它们被放置在合适的地理环境中; +- 通过可更改的文本文件来添加生物,武器,植物,金属和其他对象; +- 以 16 色(包括黑色)渲染的扩展 ASCII 字符集,以及 8 种背景颜色(包括黑色); + +- 网站: [www.bay12games.com/dwarves/][2] +- 开发者: Tarn Adams +- 协议: 免费软件 +- 版本号: 0.40.19 + +---------- + +###Ancient Domains of Mystery + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-ADOM.png) + +Ancient Domains of Mystery (ADOM) 是一个 rogue-like 游戏,从 1994 年至今一直在不断开发。 + +它是一个包含复杂地下城的单用户游戏。你控制一个用种族、类别、属性、技巧和装备等描述的虚构角色。这个虚构角色正尝试着达到一个特定的目标(参考下面的介绍)并在一个困难的任务中取胜。为了完成任务,你必须在以前没有发现的隧道和地下城中探险,和丑陋的怪兽战斗,解开一系列遗忘的秘密,并找到宝藏。 + +在游戏期间,你在每次游戏时随机生成的各层地下城中探索。你也可能遇到某个特定的关卡,其中有着特定的挑战或者围绕某个特定主题而生成。 + +特点包括: + +- 拥有上百个地点的巨大游戏世界,例如城堡、随机生成的地下城、主题寺庙、墓地、古代遗迹、塔台和其他名胜; +- 各种各样的种族(矮人、drakeling、雾精灵、hurthling、兽人、巨魔、ratling 等等)(LCTT注:种族信息可以参考[这里](http://ancardia.wikia.com/wiki/Race) 和丰富的职业(战士、 元素法师、 刺客、 混沌骑士,决斗士等等)带来无限的游戏乐趣; +- 上百个怪兽和物品,其中的许多带有随机的增强特性; +- 迫使你在对力量的欲望和对诅咒的恐惧之间进行权衡的腐败体系; +- 法术、祈祷、思想技艺、炼金术、手工艺和更多; +- 多样的任务和分支故事主线; +- 许多完全不同的结局,可能改变现实本身。 + +- 网站: [www.adom.de][3] +- 开发者: Thomas Biskup +- 协议: Postcardware +- 版本号: 1.20 Prelease 20 + +---------- + +###Tales of Maj’Eyal (ToME) + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-ToME.png) + +Tales of Maj’Eyal (ToME) (注:中文译名为 马基埃亚尔的传说) 是一个免费、开源的 roguelike 角色扮演游戏,包含特色的战术回合制战役和先进角色构建。它作为运行在 T-Engine 4.0 中的一个模块而被创造。 + +现在处于王权世纪(Age of Ascendancy),在长达一万年的冲突痛苦和混乱之后,我们所知的世界终于进入了一个相对和平的时期。 “魔法大爆裂(Spellblaze)” 留下的影响已经大为减缓, 大地的伤痕也慢慢地开始愈合。在薪火世纪(Age of Pyre)之后,各个文明也纷纷开始重建家园。(注:翻译来源于 [这里](http://www.qiyun.org/zhuanti/majiaiyaerdechuanshuo.htm))    + +特点包括: + +- 适合于那些没有 rogueline 体验的玩家; +- 同时支持图形界面和 ASCII 模式; +- 某些角色拥有多达 40 种的能力; +- 天赋系统; +- 战役引擎; +- 在线的持久状态/成就追踪; +- IRC 聊天客户端; +- 可扩展,可修改; +- 充满激情的音乐; +- 可解锁新的种族,类别,起始点,游戏模式和特点等; + +- 网站: [te4.org][4] +- 开发者: ToME 开发团队 +- 协议: GNU GPL v3.0 +- 版本号: 1.2.5 + +---------- + +###Cataclysm Dark Days Ahead + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Cataclysm.png) + +Cataclysm 是一个开源的 “后末世” roguelike 游戏,背景设定在由怪兽和僵尸带来的毁灭性的瘟疫后虚构的新英格兰(New England) 乡村。它是 Whale 开发的原有 Cataclysm 的继续,拓展了更多新的生物,建筑,游戏机制和其他特点。 + +尽管有些人描述它为一个 “僵尸游戏”,但 Cataclysm 远比一个“僵尸游戏”包含更多内容。玩家要在一个由程序生成的严酷、持久的世界中艰难生存下去。在一个死寂的文明世界中搜寻剩下的食物和装备,或者假如你足够幸运,搞到一辆装满汽油的汽车逃离 Dodge --这个如地狱一般的地方。从僵尸到巨型昆虫或机器人杀手以及更加奇怪和致命的东西,你要通过战斗来击败它们或逃离,以及和那些想要抢夺你的东西的那些同你一样的人战斗。 + +在许多方面上, Cataclysm 与大多数的 roguelike 游戏不同。它被设定在一个没有边界的三维世界里,而不是设定在一个垂直、线性的地下城中。这意味着相比于大多数的 roguel 游戏,探险将占一个更大的比重,而且这个游戏将具有更大的自由度。由于地图是如此的巨大,在每次游戏之间,它可以完全保持原样。假如你死了,并以一个新的角色开始,你的新游戏将会设定在同你最近呆过的游戏世界相同的世界里。同许多 roguelike 游戏一样,你可以获得先前角色的战利品;而与大多数 roguelike 不同的是,你也可以重新踏上先前角色的轨迹,并且对世界做出的任何戏剧性改变将会维持到你的下一次游戏。 + +特点包括: + +- 详细的角色创建,提供了数量众多的特性来选择; +- 防御模式,这是一个有着快节奏作战的休息模式; +- Bionics;类似于在许多其他游戏里的魔法系统; +- 基因突变, 有好的和坏的变化; +- 无界的,完全随机的世界地图,可以在角色交替时保持不变; +- 创造物品 + - 新的制作方法可能需要通过练习或从书本中获得来磨练你的知识; +- 逼真的火、烟和其他动态的地图特效; +- 昼/夜循环,需要睡觉。假如你必须的话,可以使用咖啡因来保持更长时间的清醒,但这不健康; +- 超过 300 种物品类型,包括众多的现实世界的枪支,药品和工具; + - 许多药品是上瘾的,并需要持续使用来避免负面效果; +- 通过修补门、窗、建造陷阱和巩固你的家的基石来防止一个僵尸的突然造访; +- 能够构建你自己的木屋,包括墙和屋顶; +- 可以驾驶在“后末世”发现的汽车兜风; + - 这个可以根据你的需求来修改,或甚至你可以自己制造一辆; +- 温度系统,太冷或太热都非常危险; +- 初步支持贴片界面; +- 根据选项生成世界,以及各种编辑方式; + +- 网站: [en.cataclysmdda.com][5] +- 作者: Kevin Granade 及其他 +- 协议: Creative Commons Attribution-ShareAlike 3.0 Unported License +- 版本号: 0.B + +---------- + +###Goblin Hack + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-GoblinHack.png) + +Goblin Hack 是一个开源 roguelike 游戏,基于 OpenGL 的平滑滚动的ASCII 图形界面。这个游戏受 NetHack 外观的启发,但更加快速且使用更少的按键。 + +Goblin Hack 有一个简洁的界面,在今天这个过度强调渲染的游戏世界中,似乎它对所有年龄段的玩家都有吸引力,并启发了这些玩家的想象力。 + +在被投进一个随机的正在生成的地下城之前,玩家可以从几个角色类别中选择一个角色。 + +特点包括: + +- 令人印象深刻的界面(相比于许多其他的 roguelike 游戏); +- 简洁的界面; +- 在被投进一个随机的正在生成的第一层地下城之前,玩家可以从几个角色类别中选择一个角色; +- 手动保存游戏; + +- 网站: [goblinhack.sourceforge.net][6], [github.com/goblinhack/goblinhack][7] +- 作者: Neil McGill +- 协议: GNU GPL v2 +- 版本号: 1.19 + +---------- + +###SLASH'EM + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-SlashEM.png) + +Super Lotsa Added Stuff Hack - Extended Magic (SLASH'EM) 是一个角色扮演游戏,在其中你控制一个单独的角色。SLASH'EM 是 NetHack 的一个变种。它拥有一个和 Rogue、ADOM、Anghand 及 NetHack 相似的界面和游戏玩法。你通过键盘来控制角色的动作,以一个俯视的视角来查看这个世界。 + +背景: Amulet of Yendor 已被偷走,不仅如此,偷走 amulet 的 Wizard of Yendor(坏蛋)似乎深藏于 Dungeons of Doom(危险的地方)。 + +特点包括: + +- 提供额外的特色、怪兽和项目; +- 新颖的特点包括僧人职业和类似推箱子的关卡; +- 主地下城比在 NetHack 中的要大很多; + +- 网站: [www.slashem.org][8] +- 开发者: Slash'EM 开发团队 +- 协议: MIT License, NetHack General Public License +- 版本号: 0.0.7E7F3 + +---------- + +###NetHack + +![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-NetHack.jpg) + +NetHack 是一个极简,但又非常吸引人的具有地下城与龙风格的冒险游戏。“net”元素指的是它的发展已经根据网络进行了调整,“hack”元素指的是角色扮演游戏的一种类型,以乱砍、猛砍著称,着眼于战斗。 + +在 NetHack 中,你扮演凶猛的战士、巫师或许多其他职业中的一种,一路战斗着,为你的神灵获取 Amulet of Yendor(可以说这是一个倒退!)。在这个过程中,你可能会遇到一个或两个 quantum mechanic(LCTT 译注:从[这里](http://nethack.wikia.com/wiki/Quantum_mechanic)得知,这指的是一种怪兽),或者可能遇到一个小型的太空舰队,抑或是 —— 假如你*足够*幸运会遇到 —— Ravenous Bugblatter Beast of Traal。(LCTT 译注:我参考了[这里](http://nethack.wikia.com/wiki/Douglas_Adams))。 + +特点包括: + +- 45-50 个关卡, 其中的大多数随机生成; +- 各种各样的物品:武器、盔甲、卷轴、药水、戒指、宝石和各种各样的工具,如钥匙和灯; +- 祝福和诅咒; +- 永久死亡: 若没有对当前的保存文件进行备份,失效的角色就找不回来了; +- 界面: + - 文本模式; + - 图形化界面, 使用 X、Qt 工具集或 GNOME 库; + +- 网站: [www.nethack.org][9] +- 开发者: NetHack 开发团队 +- 协议: NetHack 通用公共许可证 +- 版本号: 3.4.3 + +---------- + +###Ascii Sector + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-AsciiSector.png) + +Ascii Sector 是一个免费的太空战斗/探险/交易游戏,它基于经典的电脑游戏 `Wing Commander: Privateer`,后者由 Origine Systems 公司于 1993 年发布。 + +在 Ascii Sector 中,刚开始你将驾驶一艘简易的飞船,然后可以通过接受任务或者贩卖物品来挣得足够多的钱以升级你的飞船或重新再买一艘。不管是在太空中,还是在地面上,抑或是在飞船上,你可以专注于致命的战斗;并且通过使用 Ascii Sector 的脚本语言,你还可以为游戏创造自己的任务或享受其他玩家创造的任务。 + +特点包括: + +- 使用 ANSI 字符集生成图形界面; +- 真正的深入到游戏中; +- 提供各种基地,任务,商品和飞船; +- 飞船型号包括: Broadsword, Centurion, Demon, Dralthi, Drayman, Galaxy, Gladius, Gothri, Kamekh, Nexus, Orion, Paradign, Stileto, Talon, Tarsus 和 Ulysses; +- 四个象限: Alizarin, Crimson, Mauve, 和 Viridian; +- 可下载的任务; +- 任务可用脚本编辑; +- Ascii Sector 任务语言,在 Ascii Sector 宇宙中创造你自己的故事; +- 可以袭击或抢劫星球上的 NPC(非玩家控制角色); +- 可以到处移动的持久性舰队、可以改变系统的控制、引来敌人的舰队、回基地修复或重建; +- 可以登录系统受损的飞船; +- 可下载高质量的音乐文件; + +- 网站: [www.asciisector.net][10] +- 开发者: Christian Knudsen +- 协议: 免费软件 +- 版本号: 0.7.1.4 + +---------- + +###Angband + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Angband.png) + +Angband 是一个免费、单用户、使用 ASCII 字符图形化的地下城探险游戏,在其中你将以一个冒险者的角色探索一个深深的地下城,与怪兽战斗,获得你能取得的最好武器,准备着与黑暗之主 Morgoth 的最后决战。从上世纪九十年代开始,它一直在持续地开发着。 + +Angband 沿袭了 Rogue 和 NetHack 的风格路线。它由 Moria 和 Umoria 游戏衍生而来,基于 Rogue 回合制。它经常被描述为一个 “roguelike”游戏,因为它的外观和游戏体验与 Rogue 非常相似。很多游戏中的新生物、物品都来自 J.R.R Tolkien 的画作,尽管有些野兽直接来源于经典的神话、龙与地下城、Rolemaster,或 Angband 的原开发者的脑海中。 + +特点包括: + +- 100 层地下城; +- 随机产生的新关卡; +- 可以选择成为人类、半精灵、精灵、霍比特人、地精、矮人,半兽人,半巨魔, 登丹人 ,高等精灵,或者狗头人; +- 神器; +- 施法; +- 怪物; +- 怪物坑; +- 怪物巢穴; + +- 网站: [rephial.org][11] +- 开发者: Angband 开发小组 +- 协议: GNU GPL v2 +- 版本号: 3.5.0 + +---------- + +###UnNetHack + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-UnNetHack.png) + +UnNetHack 是 NetHack 的一个分支版本。NetHack 最开始于 1987 年发行,并且许多游戏玩家认为它是计算机世界所能提供的最好游戏体验的游戏之一。 + +特点包括: + +- 增加了许多针对 NetHack 的增强,如额外的怪兽、更多的关卡、许多新的元素、更多的危险、更具挑战性的游戏,以及最重要的,相比普通的 NetHack,它更具娱乐性; +- 帮助新手开始的教程; + +- 网站: [sourceforge.net/apps/trac/unnethack][12] +- 作者: Patric Mueller +- 协议: Nethack General Public License +- 版本号: 5.1.0 + +---------- + +###Hydra Slayer + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-HydraSlayer.png) + +Hydra Slayer 是一个专注于杀死九头蛇的开源 Roguelike 游戏。它受到了希腊神话、地下城探险、MathRL seven day roguelike ,和一些关于勇者杀死多头野兽的数字谜题等启发。 + +特点如下: + +- 独特的游戏机制; +- 混合希腊神话和数字迷宫的主题; +- 传统的 roguelike ASCII 字符界面或贴片/3D 界面; +- 5 种人物角色,具有极为不同的战术、力量及弱点; +- 28 种敌人类型: + - 10 种基本的九头蛇类型(每种类型都有两种变种); + - 8 种特殊类型的敌人; + - 可用作战术工具的无害蘑菇; +- 28 种装备(并包括材料和装备的大小/力量的变种); +- 15 种武器材料; +- 18 种非装备物品; +- 3 种可供选择的地图; +- 8 种关卡拓扑结构(包括莫比乌斯带和克莱因瓶); +- 11 个关卡生成器; +- 2 种结局; + +- 网站: [www.roguetemple.com/z/hydra][13] +- 开发者: Zeno Rogue +- 协议: GNU GPL v2 +- 版本号: 16.1 + +---------- + +###Brogue + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Brogue.png) + +Brogue 是一个开源的 Roguelike 游戏,它可以运行在 Mac OS X, Windows, Linux, iOS 和 Android 等平台下。 + +Brogue 是 Rogue 的一个直系分支,后者是一个最早由 Michael Toy 和 Glenn Wichman 于 1980 年左右开发的地下城探险视频游戏。与其他受欢迎的现代 Roguelike 游戏不同, Brogue 追求简单而不是复杂性,同时尽力确保游戏的不同组成之间的联系是有趣且纷繁多彩。 + +这个游戏的目标是取得深藏于地下第 26 层的 "Amulet of Yendor",再返回到地面逃出生天。对于那些技术娴熟且想进一步探险的人来说,位于 26 层之下的每层均包含 3 颗 lumenstone (流明石)(LCTT 译注:此处与我在[这里](http://brogue.wikia.com/wiki/Lumenstone)看到的有些出入),获得它们,将在胜利的基础上被授予额外的得分。 + +Brogue 是一个富有挑战性的游戏,但玩起来非常有趣。尽量不要因游戏的高难度而灰心;试玩一段时间之后,你会发现它变得非常吸引人。 + +特点如下: + +- 追求简单而非复杂; +- 对用户友好; +- 相比于 Rogue, Brogue 关卡生成更加复杂; +- 移除了 XP 和 水平系统 ; +- 陷阱,防护性物品; +- 额外的怪兽类型和魔法物品; + +- 网站: [sites.google.com/site/broguegame][14] +- 作者: Brian Walker +- 协议: GNU Affero GPL +- 版本号: 1.7.3 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/201412031524381/RoguelikeGames.html + +作者:Frazer Kline +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://crawl.develz.org/ +[2]:http://www.bay12games.com/dwarves/index.html +[3]:http://www.adom.de/ +[4]:http://te4.org/ +[5]:http://en.cataclysmdda.com/ +[6]:http://goblinhack.sourceforge.net/ +[7]:https://github.com/goblinhack/goblinhack +[8]:http://www.slashem.org/ +[9]:http://www.nethack.org/ +[10]:http://www.asciisector.net/ +[11]:http://rephial.org/ +[12]:http://sourceforge.net/apps/trac/unnethack/ +[13]:http://www.roguetemple.com/z/hydra/ +[14]:lhttps://sites.google.com/site/broguegame/ \ No newline at end of file diff --git a/published/201504/20141226 Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM.md b/published/201504/20141226 Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM.md new file mode 100644 index 0000000000..a15c496eae --- /dev/null +++ b/published/201504/20141226 Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM.md @@ -0,0 +1,150 @@ +PHP 5.5 / PHP5.6 / PHP-NG 和 HHVM 哪个性能更好? +================================================================================ +**长篇摘要:在一个基于Vagrant的本地环境中,可能是某个错误的原因,导致HHVM测试结果很差;在HHVM伙伴们协助下,该原因仍在研究中!然而,在DigitalOcean的一个4GB虚拟机中,HHVM甚至盖过了最新版的PHP-NG的风头!** + +![](https://kinsta.com/wp-content/uploads/2014/07/phphhvm.jpg) + +**结论:它们反映出HHVM的功效更佳(在JIT热启动后),虽然出于某些原因,我们不能在所有装备中获取这些结果。** + +如果你记得我们[在几个月前写过一篇文章][1],那时WordPress 3.9表明是完全支持HHVM的,当时是那么令我们欢欣鼓舞。最初的基准测试结果显示,HHVM要比驱动着当前所有PHP构建的Zend引擎高级得多。后来,问题就出来了: + +- HHVM只能以单个用户运行,这意味着(在共享环境中)安全性差了 +- HHVM在崩溃后不会自动重启,而不幸的是,它至今仍然经常发生 +- HHVM在启动时使用大量内存,虽然,它和同规模的PHP-FPM比较,单个请求的内存使用量更低 + +很显然,你不得不根据你的(或者更确切地说是你的站点)的需求采取折中方案,然而这值得吗?切换到HHVM后,你期望获得多少性能改善呢? + +在Kinsta,我们真的想要测试所有新技术,并通常会优化这一切来为我们的客户提供最佳的环境。今天,我最终花了点时间来配置测试环境并进行了一些测试来对比两个不同的构建,一个是全新出炉的WordPress安装,另外一个则添加了大量内容的WooCommerce!为了计量脚本的运行时间,我只是简单地添加了 + + + +这一行到footer.php的/body标记前。 + + +这里是配置环境的详情: + +- DigitalOcean 4GB 雨滴容器 (2 CPU核心, 4GB RAM) +- Ubuntu 14.04, MariaDB10 +- 测试站点: 已导入演示内容的Munditia主题,WooCommerce 2.1.12 & WordPress 3.9.1 +- PHP 5.5.9, PHP 5.5.15, PHP 5.6.0 RC2, PHP-NG (20140718-git-6cc487d)和HHVM 3.2.0 (版本是PHP 5.6.99-hhvm) + +**没有进一步大费周章,这些就是我的测试结果,数值越低越好,以秒为单位:** + +### DigitalOcean 4GB 雨滴容器 ### + +单位是秒,运行10次,越低越好 + +这里有一个canvas的数据,发布的时候需要截一个图 + +看起来似乎PHP-NG在它首次运行后就获得了峰值性能!HHVM需要更多几次重载,但是它们的性能貌似差不多!我等不及PHP-NG合并到开发主干了!:) + +一分钟命中数,越高越好。 + +这里有一个canvas的数据,发布的时候需要截一个图 + +**PHP 5.5.15禁用OpCache** + +- 执行: **236 hits** +- 可用性: 100.00 % +- 消耗时间: 59.03 secs +- 传输的数据: 2.40 MB +- 回应时间: 2.47 secs +- 执行率: 4.00 trans/sec +- 吞吐量: 0.04 MB/sec +- 并发数: 9.87 +- 成功的执行: 236 +- 失败的执行: 0 +- 最长执行: 4.44 +- 最短执行: 0.48 + +**PHP 5.5.15启用OpCache** + +- 执行: **441 hits** +- 可用性: 100.00 % +- 消耗时间: 59.55 secs +- 传输的数据: 4.48 MB +- 回应时间: 1.34 secs +- 执行率: 7.41 trans/sec +- 吞吐量: 0.08 MB/sec +- 并发数: 9.91 +- 成功的执行: 441 +- 失败的执行: 0 +- 最长执行: 2.19 +- 最短执行: 0.64 + +**PHP 5.6 RC2禁用OpCache** + +- 执行: **207 hits** +- 可用性: 100.00 % +- 消耗时间: 59.87 secs +- 传输的数据: 2.10 MB +- 回应时间: 2.80 secs +- 执行率: 3.46 trans/sec +- 吞吐量: 0.04 MB/sec +- 并发数: 9.68 +- 成功的执行: 207 +- 失败的执行: 0 +- 最长执行: 3.65 +- 最短执行: 0.54 + +**PHP 5.6 RC2启用OpCache** + +- 执行: **412 hits** +- 可用性: 100.00 % +- 消耗时间: 59.03 secs +- 传输的数据: 4.18 MB +- 回应时间: 1.42 secs +- 执行率: 6.98 trans/sec +- 吞吐量: 0.07 MB/sec +- 并发数: 9.88 +- 成功的执行: 412 +- 失败的执行: 0 +- 最长执行: 1.93 +- 最短执行: 0.34 + +**HHVM 3.2.0(版本是PHP 5.6.99-hhvm)** + +- 执行: **955 hits** +- 可用性: 100.00 % +- 消耗时间: 59.69 secs +- 传输的数据: 9.18 MB +- 回应时间: 0.62 secs +- 执行率: 16.00 trans/sec +- 吞吐量: 0.15 MB/sec +- 并发数: 9.94 +- 成功的执行: 955 +- 失败的执行: 0 +- 最长执行: 0.85 +- 最短执行: 0.23 + +**PHP-NG启用OpCache(构建: Jul 29 2014)** + +- 执行: **849 hits** +- 可用性: 100.00 % +- 消耗时间: 59.88 secs +- 传输的数据: 8.63 MB +- 回应时间: 0.70 secs +- 执行率: 14.18 trans/sec +- 吞吐量: 0.14 MB/sec +- 并发数: 9.94 +- 成功的执行: 849 +- 失败的执行: 0 +- 最长执行: 1.06 +- 最短执行: 0.13 + + +**注意:这里节略了前一次的测试结果(有误),如感兴趣请访问原文查看。** + + +-------------------------------------------------------------------------------- + +via: https://kinsta.com/blog/real-world-wordpress-benchmarks-with-php5-5-php5-6-php-ng-and-hhvm/ + +作者:[Mark Gavalda][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://kinsta.com/blog/author/kinstadmin/ +[1]:https://kinsta.com/blog/hhvm-and-wordpress/ diff --git a/published/201504/20150119 How to Install Cherokee Lightweight Web Server on Ubuntu 14.04.md b/published/201504/20150119 How to Install Cherokee Lightweight Web Server on Ubuntu 14.04.md new file mode 100644 index 0000000000..160a8d62f9 --- /dev/null +++ b/published/201504/20150119 How to Install Cherokee Lightweight Web Server on Ubuntu 14.04.md @@ -0,0 +1,83 @@ +如何在Ubuntu 14.04上安装轻量级web服务器Cherokee +================================================================================ +**Cherokee** 是一个免费,开源,高性能轻量级的全功能web服务器,支持大部分主流操作系统(Linux、 Mac OS X、 Solaris 和 BSD)。它支持TLS/SSL、FastCGI、 SCGI、 PHP、 uWSGI、 SSI、 CGI、 LDAP、 HTTP代理、 视频流处理、 内容缓存、 流量控制、 虚拟主机、Apache兼容的日志文件,以及负载均衡等功能。 + +今天我们介绍一下怎样在Ubuntu Server 14.04 LTS安装和配置轻量级的web服务器Cherokee,只需要注意修改软件源列表,同样适用于Ubuntu12.04,12.10和13.04。 + +在Ubuntu Server上逐步安装和配置Cherokee + +### 1. 更新Ubuntu软件包索引 ### + +首先登陆Ubuntu Server,执行以下命令,更新Ubuntu Server的软件源并安装可用的更新。 + + sudo apt-get update + + sudo apt-get upgrade + +### 2. 加入 PPA ### + +通过运行以下命令增加Cherokee的PPA + + sudo add-apt-repository ppa:cherokee-webserver + + sudo apt-get update + +对于运行14.04版本的服务器还需要执行以下步骤 + + cd /etc/apt/sources.list.d + + nano cherokee-webserver-ppa-trusty.list + +用`deb http://ppa.launchpad.net/cherokee-webserver/ppa/ubuntu saucy main` 替换 `deb http://ppa.launchpad.net/cherokee-webserver/ppa/ubuntu trusty main` + +**再次运行命令:** + + sudo apt-get update + +### 3. 使用apt-get安装Cherokee ### + +使用如下命令安装Cherokee和SSL模块 + + sudo apt-get install cherokee cherokee-admin cherokee-doc libcherokee-mod-libssl libcherokee-mod-streaming libcherokee-mod-rrd + +### 4. 配置Cherokee ### + +重启Cherokee服务: + + sudo service cherokee start + +使用Cherokee最大的好处就是能通过一个简单易用的web界面 cherokee-admin 来管理所有的配置选项。推荐通过浏览器来管理Cherokee。使用如下命令启动cherokee-admin + + sudo cherokee-admin + +**注意: cherokee-admin 会显示用户名,一次性密码和web管理界面地址。** + +**请记录下这个一次性密码,登录到管理界面时需要它。** + +默认情况下,只能通过localhost访问Cherokee-admin,如果需要通过其它网络地址来访问,可以使用‘**-b**’参数。如果不指定任何IP地址,Cherokee-admin会自动监听所有网络端口。然后就可以通过网络访问Cherokee-admin + + sudo cherokee-admin -b + +通过指定IP地址访问Cherokee-admin + + sudo cherokee-admin -b 192.168.1.102 + +### 5. 浏览cherokee-admin面板 ### + +在你喜欢的浏览器中输入地址`http://主机名或 IP 地址:9090/`就可以进入控制面板了。例如我的是http://127.0.0.1:9090/,在浏览器中显示如下图 + +![cherokee-admin-panel](http://blog.linoxide.com/wp-content/uploads/2014/12/cherokee-admin.png) + +好了,到这里我们已经成功地在Ubuntu Server上安装和配置了Cherokee。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/install-cherokee-lightweight-web-server-ubuntu-14-04/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ diff --git a/published/201504/20150119 How to Remember and Restore Running Applications on Next Logon.md b/published/201504/20150119 How to Remember and Restore Running Applications on Next Logon.md new file mode 100644 index 0000000000..b6569bdca4 --- /dev/null +++ b/published/201504/20150119 How to Remember and Restore Running Applications on Next Logon.md @@ -0,0 +1,103 @@ +如何在 Ubuntu 中再次登录时还原上次运行的应用 +================================================================================ +在你的 Ubuntu 里,如果你需要处理一些工作,你并不需要关闭正运行着的那些应用,只需要管理一下窗口,并打开那些工作需要的应用就行。然而,如果你需要离开处理些别的事情或你的机器电量低使得你必须马上关闭电脑,这些程序可能就需要关闭终止了。不过幸运的是,你可以让 Ubuntu 记住所有你正运行的应用并在你下一次登录时还原它们。 + +###自动保存会话 + +现在,为了让我们的 Ubuntu 记住当前会话中正运行的应用并在我们下一次登录时还原它们,我们将会使用到 `dconf-editor`。这个工具代替了前一个 Ubuntu 版本里安装的 `gconf-editor`,但默认情况下现在这个 Ubuntu 版本(注:这里指的是 Ubuntu 14.04 LTS) 并没有安装。为了安装 `dconf-editor`, 你需要运行 `sudo apt-get install dconf-editor`命令: + + $ sudo apt-get install dconf-tools + +一旦 `dconf-editor` 安装完毕,你就可以从应用菜单(注:这里指的是 Unity Dash)里打开它,或者你可以通过直接在终端里运行,或使用 `alt+f2` 运行下面的命令来启动它: + + $ dconf-editor + +在 “dconf Editor” 窗口中,在左边窗格里点击临近 "org" 的右箭头来展开这个选项的分支。 + +![Dconf Editor Apps, org](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor-clicking-org-300x146.png) + +然后在 “org” 下,点击临近 “gnome” 的右箭头。 + +![dconf editor clicking gnome](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor-clicking-gnome.png) + +接着在 “gnome” 下点击 “gnome-session”。在右边窗格里,选择 “auto-save-session” 选项框并将它开启。 + +![dconf-editor selecting auto save session](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor_selecting_auto_save_session.png) + +在你确认对刚才的选项打钩之后,点击默认情况下位于窗口左上角的关闭按钮(X)来关闭 “Dconf Editor”。 + +![dconf-editor closing dconf editor](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor_closing_dconf_editor.png) + +在你登出并再登录回来时,所有你正运行的应用就可以被还原了。 + +欢呼吧,我们已经成功地配置了我们的 Ubuntu 14.04 LTS "Trusty" 来自动记住我们上一次会话中正在运行的应用。 + +除了关机后恢复应用之外,还可以通过休眠来达成类似的功能。 + +###休眠功能 + +现在,在这个教程里,我们也将学会 **如何在 Ubuntu 14.04 LTS 里开启休眠功能** : + +在开始之前,在键盘上按 `Ctrl+Alt+T` 来开启终端。在它开启以后,运行: + + sudo pm-hibernate + +在你的电脑关闭后,再重新开启它。这时,你开启的应用被重新打开了吗?如果休眠功能没有发挥作用,请检查你的交换分区大小,它至少要和你可用 RAM 大小相当。 + +你可以在系统监视器里查看你的交换分区大小,系统监视器可以通过在应用菜单或在终端里运行下面的命令来开启: + + $ gnome-system-monitor + +#### 在系统托盘里启用休眠功能: #### + +系统托盘里面的会话指示器现在使用 logind 而不是 upower 了。默认情况下,在 upower 和 logind 中,休眠菜单都被禁用了。 + +为了开启它的休眠菜单,依次运行下面的命令来编辑配置文件: + + sudo -i + + cd /var/lib/polkit-1/localauthority/50-local.d/ + + gedit com.ubuntu.enable-hibernate.pkla + +**提示:假如对你来说,这个配置文件并没有起到作用,请替换上面代码中的 /var/lib 为 /etc 来试试另一个配置文件** + +复制并粘贴下面的代码到文件中并保存: + + [Re-enable hibernate by default in upower] + Identity=unix-user:* + Action=org.freedesktop.upower.hibernate + ResultActive=yes + + [Re-enable hibernate by default in logind] + Identity=unix-user:* + Action=org.freedesktop.login1.hibernate + ResultActive=yes + +重启你的电脑就可以了。 + +#### 当你盖上笔记本的后盖时,让它休眠: #### + +1. 通过下面的命令编辑文件 “/etc/systemd/logind.conf” : + + $ sudo nano /etc/systemd/logind.conf + +2. 将 **#HandleLidSwitch=suspend** (挂起)这一行改为 **HandleLidSwitch=hibernate** (休眠)并保存文件; + +3. 运行下面的命令或重启你的电脑来应用更改: + + $ sudo restart systemd-logind + +就是这样。 成功了吗?现在我们设置了 dconf 并开启了休眠功能 :) 这样,无论你是关机还是直接合上笔记本盖子,你的 Ubuntu 将能够完全记住你开启的应用和窗口了。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/remember-running-applications-ubuntu/ + +作者:[Arun Pyasi][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ diff --git a/published/201504/20150122 How are C data types “supported directly by most computers”.md b/published/201504/20150122 How are C data types “supported directly by most computers”.md new file mode 100644 index 0000000000..f57bd9ac7f --- /dev/null +++ b/published/201504/20150122 How are C data types “supported directly by most computers”.md @@ -0,0 +1,53 @@ +C语言数据类型是如何被大多数计算机系统所支持? +======================== + +###问题: + +在读K&R版的*The C Programming Language*一书时,我在[介绍,第3页]看到这样一条说明: + +>**因为C语言提供的数据类型和控制结构可以直接被大部分计算机系统所支持,所以在实现自包含程序时所需要的运行库文件一般很小。** + +这段黑体说明了什么?能否找到一个例子来说明C语言中的某种数据类型或控制结构不被某种计算机系统直接支持呢? + +###回答: + +事实上,C语言中确实有不被直接支持的数据类型。 + +在许多嵌入式系统中,硬件上并没有浮点运算单元。因此,如果你写出下面的代码: + +```C +float x = 1.0f, y = 2.0f; +return x + y; +``` + +可能会被转化成下面这种形式: + +```C +unsigned x = 0x3f800000, y = 0x40000000; +return _float_add(x, y); +``` + +然后编译器或标准库必须提供'_float_add()'的具体实现,这会占用嵌入式系统的内存空间。依此去计算代码在某个微型系统(译者注:也就是指微型嵌入式系统)的实际字节数,也会发现有所增加。 + +另一个常见的例子是64位整型数(C语言标准中'long long'类型是1999年之后才出现的),这种类型在32位系统上也不能直接使用。古董级的SPARC系统则不支持整型乘法,所以在运行时必须提供乘法的实现。当然,还有一些其它例子。 + +####其它语言 + +相比起来,其它编程语言有更加复杂的基本类型。 + +比如,Lisp中的symbol需要大量的运行时实现支持,就像Lua中的table、Python中的string、Fortran中的array,等等。在C语言中等价的类型通常要么不属于标准库(C语言没有标准symbol或table),要么更加简单,而且并不需要那么多的运行时支持(C语言中的array基本上就是指针,以NULL结尾的字符串实现起来也很简单)。 + +####控制结构 + +异常处理是C语言中没有的一种控制结构。非局部的退出只有'setjmp()'和'longjmp()'两种,只能提供保存和恢复某些部分的处理器状态。相比之下,C++运行时环境必须先遍历函数调用栈,然后调用析构函数和异常处理函数。 + +---- +via:[stackoverflow](http://stackoverflow.com/questions/27977522/how-are-c-data-types-supported-directly-by-most-computers/27977605#27977605) + +作者:[Dietrich Epp][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://stackoverflow.com/users/82294/dietrich-epp \ No newline at end of file diff --git a/published/201504/20150128 Docker-1 Moving to Docker.md b/published/201504/20150128 Docker-1 Moving to Docker.md new file mode 100644 index 0000000000..5cadf51ce6 --- /dev/null +++ b/published/201504/20150128 Docker-1 Moving to Docker.md @@ -0,0 +1,80 @@ +走向 Docker +================================================================================ +![](http://cocoahunter.com/content/images/2015/01/docker1.jpeg) + +[TL;DR] 这是系列的第一篇文章,这系列讲述了我的公司如何把基础服务从PaaS迁移到Docker上。如果你愿意,你可以直接跳过介绍(这篇文章)直接看技术相关的话题(链接在页面的底部)。 + +---------- + +上个月,我一直在折腾开发环境。这是我个人故事和经验,关于尝试用Docker简化Rails应用的部署过程。 + +当我在2012年创建我的公司 – [Touchware][1]时,我还是一个独立开发者。很多事情很小,不复杂,他们不需要很多维护,他们也不需要部署到很多机器上。经过过去一年的发展,我们成长了很多(我们现在是是拥有10个人的团队)而且我们的服务端的程序和API无论在范围和规模方面都有增长。 + +### 第1步 - Heroku ### + +我们还是个小公司,我们需要让事情运行地尽可能平稳。当我们寻找可行的解决方案时,我们打算坚持用那些可以帮助我们减轻对硬件依赖负担的工具。由于我们主要开发Rails应用,而Heroku对RoR、常用的数据库和缓存(Postgres/Mongo/Redis等)有很好的支持,最明智的选择就是用[Heroku][2] 。我们就是这样做的。 + +Heroku有很好的技术支持和文档,使得部署非常轻松。唯一的问题是,当你处于起步阶段,你需要很多开销。这不是最好的选择,真的。 + +### 第2步 - Dokku ### + +为了尝试并降低成本,我们决定试试Dokku。[Dokku][3],引用GitHub上的一句话 + +> Docker 驱动的 mini-Heroku,只用了一百来行的 bash 脚本 + +我们启用的[DigitalOcean][4]上的很多台机器,都预装了Dokku。Dokku非常像Heroku,但是当你有复杂的项目需要调整配置参数或者是需要特殊的依赖时,它就不能胜任了。我们有一个应用,它需要对图片进行多次转换,我们把我们Rails应用的托管到基于Dokku的Docker容器,但是无法安装一个适合版本的imagemagick到里面。尽管我们还有很多应用运行在Dokku上,但我们还是不得不把一些迁移回Heroku。 + +### 第3步 - Docker ### + +几个月前,由于开发环境和生产环境的问题重新出现,我决定试试Docker。简单来说,Docker让开发者容器化应用、简化部署。由于一个Docker容器本质上已经包含项目运行所需要的所有依赖,只要它能在你的笔记本上运行地很好,你就能确保它将也能在任何一个别的远程服务器的生产环境上运行,包括Amazon的EC2和DigitalOcean上的VPS。 + +就我个人的看法来说,Docker 特别有意思的原因是: + +- 它促进了模块化和关注点分离:你只需要去考虑应用的逻辑部分(负载均衡:1个容器;数据库:1个容器;web服务器:1个容器); +- 在部署的配置上非常灵活:容器可以被部署在各种硬件上,也可以容易地重新部署在不同的服务器和不同的提供商; +- 它允许非常细粒度地优化应用的运行环境:你可以利用你的容器来创建镜像,所以你有很多选择来配置环境。 + +它也有一些缺点: + +- 它的学习曲线非常的陡峭(这是从一个软件开发者的角度来看,而不是经验丰富的运维人员); +- 搭建环境不简单,尤其是还需要自己搭建一个私有的registry/repository (后面有关于它的详细内容)。 + +下面是一些提示。这个系列的最后一周,我将把他们和一些新的放在一起。 + +---------- + +在下面的文章中,我们将看到如何建立一个半自动化的基于Docker的部署系统。 + +- [建立私有的Docker registry][6] +- [配置Rails应用的半自动化话部署][7] + +-------------------------------------------------------------------------------- + +via: http://cocoahunter.com/2015/01/23/docker-1/ + +作者:[Michelangelo Chasseur][a] +译者:[mtunique](https://github.com/mtunique) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://cocoahunter.com/author/michelangelo/ +[1]:http://www.touchwa.re/ +[2]:http://www.heroku.com +[3]:https://github.com/progrium/dokku +[4]:http://www.digitalocean.com +[5]:http://www.docker.com/ +[6]:http://cocoahunter.com/2015/01/23/docker-2/ +[7]:http://cocoahunter.com/2015/01/23/docker-3/ +[8]: +[9]: +[10]: +[11]: +[12]: +[13]: +[14]: +[15]: +[16]: +[17]: +[18]: +[19]: diff --git a/published/201504/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md b/published/201504/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md new file mode 100644 index 0000000000..814e81d4f1 --- /dev/null +++ b/published/201504/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md @@ -0,0 +1,77 @@ +如何在 CentOS/RHEL 中为 Apache Tomcat 绑定 IPv4 地址 +================================================================================ +今天我们来学习一下如何在CentOS 7 Linux分布式系统中为Tomcat绑定IPv4。 + +**Apache Tomcat** 是由[Apache 软件基金会][1] 开发的开源web服务器和servlet容器。它实现了Java Servlet,JavaServer页面(JSP),Java的统一表达式语言,以及Sun Microsystems的Java的WebSocket规范,并提供了一个运行java代码的web服务器环境。 + +如果由于tomcat默认绑定到IPv6而导致我们的web服务器不能正常工作,就有必要将tomcat绑定到IPv4。众所周知,IPv6是为设备分配IP地址的现代方法,虽然在不久的将来也许会得到应用,但是现在并没有得到完全应用。由于没有用处,目前我们并不需要将我们的Tomcat服务器向IPv6转换,我们应该将其绑定到IPv4。 + +在开始将tomcat绑定到IPv4之前,我们应该确保在我们的CentOS 7中已经安装了tomcat。可以看这个[如何在CentOS 7.0服务器中安装tomcat 8][2]的指导。 + +### 1. 切换到tomcat用户 ### + +首先,我们要切换到 **tomcat** 用户。我们可以通过在shell或者终端中运行 **su tomcat** 命令完成。 + + # su tomcat + +![切换到tomcat用户](http://blog.linoxide.com/wp-content/uploads/2015/01/switch-user-tomcat.png) + +### 2. 找到文件 Catalina.sh ### + +现在我们要进入Apache Tomcat安装目录下的bin文件夹,通常是 **/usr/share/apache-tomcat-8.0.x/bin/**, 这里的x是 Apache Tomcat发行版的子版本号。因为我的CentOS 7服务器中安装的版本是8.0.18,这里我的目录是 **/usr/share/apache-tomcat-8.0.18/bin/**。 + + $ cd /usr/share/apache-tomcat-8.0.18/bin + +**注意:请用你系统中安装的Apache Tomcat的版本号替换8.0.18。** + +在bin目录中,有一个名字是catalina.sh的脚本文件。这就是我们要编辑的文件,我们将在里面增加一行将tomcat绑定到IPv4的配置信息。你可以通过在shell或者终端中运行命令 **ls** 来查看这个文件。 + + $ ls + +![查找文件 catalina.sh](http://blog.linoxide.com/wp-content/uploads/2015/01/finding-catalina.sh_.png) + +### 3. 配置 Catalina.sh ### + +如图所示,我们将在catalina.sh脚本文件的最后增加一行 `JAVA_OPTS= "$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses"`。我们可以使用我们喜欢的文本编辑器来编辑这个文件,例如nano、vim等等。这里我们使用nano。 + + $ nano catalina.sh + +![Catalina script](http://blog.linoxide.com/wp-content/uploads/2015/01/catalina-script.png) + +然后,如下图所示,将该行增加到文件。 + +![配置 catalina](http://blog.linoxide.com/wp-content/uploads/2015/01/configured-catalina.png) + +现在,我们已经将配置信息增加到文件中。保存文件并退出nano。 + +### 4. 重启 ### + +现在,我们通过重启tomcat服务器使配置生效。我们要先运行shutdown.sh,然后运行startup.sh。 + + $ ./shutdown.sh + +运行可执行文件startup.sh: + + $ ./startup.sh + +![重启apache tomcat 服务器](http://blog.linoxide.com/wp-content/uploads/2015/01/restarting-tomcat-server.png) + +这将重启我们的tomcat服务器并加载将服务器绑定到IPv4的配置信息。 + +### 结尾 ### + +好了,我们终于将我们运行在CentOS 7 Linux发行版上的tomcat服务器绑定到IPv4上了。尽管IPv6在不久的将来也许会得到应用,但由于现在还没有使用,如果因为将你的Tomcat服务器绑定到IPv6上而使得你的tomcat服务器不工作,就有必要将tomcat绑定到IPv4上,这也很简单。如果你有任何疑问,建议,反馈,请在下面的评论框中写下来,让我们知道有什么需要增加或者改进。非常感谢! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/bind-apache-tomcat-ipv4-centos/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://www.apache.org/ +[2]:http://linoxide.com/linux-how-to/install-tomcat-8-centos-7/ diff --git a/translated/tech/20150202 tespeed - Python Tool To Test Your Internet Speed.md b/published/201504/20150202 tespeed - Python Tool To Test Your Internet Speed.md similarity index 74% rename from translated/tech/20150202 tespeed - Python Tool To Test Your Internet Speed.md rename to published/201504/20150202 tespeed - Python Tool To Test Your Internet Speed.md index 99bfab9842..021eff9c2a 100644 --- a/translated/tech/20150202 tespeed - Python Tool To Test Your Internet Speed.md +++ b/published/201504/20150202 tespeed - Python Tool To Test Your Internet Speed.md @@ -1,12 +1,12 @@ tespeed - 测试网速的Python工具 ================================================================================ -许多电脑呆子知道可以用**speedtest.net**测试网速,但是这个不能在测试中给你足够的控制。Linux用户喜欢在终端中输入命令来完成任务,至少对我是这样的。 +许多电脑呆子知道可以用**speedtest.net**测试网速,但是这个不能在测试中给你足够的控制。Linux用户喜欢在终端中输入命令来完成任务,至少我就是这样的。 -tespeed是一款有很多特性的python工具,可以在终端在测试网速。根据文档,它利用了speedtest.net的服务器,但是用户可以手动指定。 +tespeed是一款有很多特性的python工具,可以在终端在测试网速。根据文档说明,它利用了speedtest.net的服务器,但是用户可以手动指定。 -最初作者用php语言写了tespeed工具,并且证明了ISP提供的网络远低于它广告中所说的那样。但是事情并不是一直如它们想的那样,因此作者移植他的php脚本到python中并且他的工具在github中已经有180个star了。 +最初作者用php语言写了tespeed工具,并且证明了ISP提供的网络远低于它广告中所说的那样。但是事情并不是一直如他们想的那样,因此作者移植他的php脚本到python中,并且他的工具在github中已经有180个star了。 -这意味着**alot**。 +It means **alot**。 ### 如何在linux中测试tespeed ### @@ -23,11 +23,11 @@ tespeed是一款有很多特性的python工具,可以在终端在测试网速 wget http://sourceforge.net/projects/socksipy/files/socksipy/SocksiPy%201.00/SocksiPy.zip/ -下载完成后 解压**SocksiPy.zip**病运行下面的命令来克隆tespeed仓库到你本地机器中。 +下载完成后 解压**SocksiPy.zip**并运行下面的命令来克隆tespeed仓库到你本地机器中。 git clone https://github.com/Janhouse/tespeed.git -接着把SocksiPy文件夹放到你克隆下来的tespeed项目中。现在我们要像截图那样在SocksPy中的**__init__.py**下面创建一个空文件。 +接着把SocksiPy文件夹放到你克隆下来的tespeed项目中。现在我们要像截图那样在SocksiPy中的创建一个叫**__init__.py**的空文件。 ![simple trick to make tespeed work](http://blog.linoxide.com/wp-content/uploads/2015/01/tespeed1.png) @@ -39,9 +39,9 @@ tespeed是一款有很多特性的python工具,可以在终端在测试网速 ![testing download and upload speed with tespeed python application](http://blog.linoxide.com/wp-content/uploads/2015/01/tespeed2.png) -在tespeed中有很多选项,如**-ls**来现实服务器,**-p**来指定代理服务器, **-s**来阻止调试(STDERR)输出, 还有很多我们会在本教程中探索。 +在tespeed中有很多选项,如**-ls**来列出服务器,**-p**来指定代理服务器, **-s**来阻止调试(STDERR)输出, 还有很多我们会在本教程中探索。 -如果你想要结果现实成MB,你可以在**python tespeed.py** 后面接上选项 **-mib**。 +如果你想要结果显示成MB,你可以在**python tespeed.py** 后面接上选项 **-mib**。 python tespeed.py -mib @@ -61,7 +61,7 @@ tespeed是一款有很多特性的python工具,可以在终端在测试网速 ### 总结 ### -=tespeed的确是一款帮助用户在终端中测试上传和下载速度的高性能python脚本。它支持很多的选项并且你可以指定列表中你想使用的服务器。继续使用tespeed并在留言区写下你们的体验吧。 +tespeed的确是一款帮助用户在终端中测试上传和下载速度的高性能python脚本。它支持很多的选项并且你可以指定列表中你想使用的服务器。继续使用tespeed并在留言区写下你们的体验吧。 -------------------------------------------------------------------------------- @@ -69,7 +69,7 @@ via: http://linoxide.com/tools/tespeed-python-tool-test-internet-speed/ 作者:[Oltjano Terpollari][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/) 荣誉推出 diff --git a/translated/tech/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md b/published/201504/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md similarity index 75% rename from translated/tech/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md rename to published/201504/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md index 2c83a1b808..72b79c1c96 100644 --- a/translated/tech/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md +++ b/published/201504/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md @@ -1,13 +1,13 @@ -如何在CentOS/RHEL中安装机遇Web监控的Linux-dash +如何在CentOS/RHEL中安装基于Web的监控系统 linux-dash ================================================================================ -**Linux-dash**是一款为Linux设计的基于web的轻量级监控面板。这个程序会显示实时时间、不同的系统属性,比如CPU负载、RAM使用率、磁盘使用率、网速、网络连接、RX/TX带宽、登录用户、运行的进程等等。它不会存储长期的统计。因为它没有后端数据库。 +**Linux-dash**是一款为Linux设计的基于web的轻量级监控面板。这个程序会实时显示各种不同的系统属性,比如CPU负载、RAM使用率、磁盘使用率、网速、网络连接、RX/TX带宽、登录用户、运行的进程等等。它不会存储长期的统计。因为它没有后端数据库。 -本篇文章将会向你展示如何安装和设置Linux dash,这里的web服务器是**Nginx**. +本篇文章将会向你展示如何安装和设置Linux dash,这里所使用的web服务器是**Nginx**. ### 安装 ### 首先我们要启用[EPEL 仓库][1]。 - + **接下来,我们需要用下面的命令安装nginx。** sudo yum install nginx @@ -59,7 +59,7 @@ sudo vim /etc/php-fpm.d/www.conf -**确保设置了“listn”,“user”和“group”字段。你可以保留下面的配置不变。** +**确保设置了如下的“listen”,“user”和“group”字段。你可以保留其它的配置不变。** . . . listen = /var/run/php-fpm.sock @@ -73,25 +73,25 @@ sudo cp -r linux-dash/ /var/www/ sudo chown -R nginx:nginx /var/www -**接下来,重启 Nginx和php-fpm** +**接下来,重启 Nginx和php-fpm。** sudo service nginx restart sudo service php-fpm restart -**设置nginx和php-fpm开机自动启动** +**设置nginx和php-fpm开机自动启动。** sudo chkconfig nginx on sudo chkconfig php-fpm on -在本例中,我们使用TCP端口8080配置linux-dash。因此确保防火墙没有阻止8080 TCP端口。 +在本例中,我们使用TCP端口8080配置linux-dash。因此需确保防火墙没有阻止8080 TCP端口。 ### 用linux-dash监控Linux服务器 ### -你现在可以在浏览器中输入**http://:8080/linux-dash/**来访问Linux-dash。 +你现在可以在浏览器中输入**http://\:8080/linux-dash/**来访问Linux-dash。 web面板包含了不同的组件,每个都显示独特的系统属性。你可以自定义web面板的外观也可以关闭一些组件。 -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Lin-dash.png) +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/Lin-dash.png) 美好的一天! @@ -104,9 +104,9 @@ via: http://www.unixmen.com/install-linux-dash-web-based-monitoring-system-cento 作者:[Jijo][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/) 荣誉推出 [a]:http://www.unixmen.com/author/jijo/ -[1]:http://www.unixmen.com/install-epel-repository-centos-rhel-7/ +[1]:http://linux.cn/article-2324-1.html diff --git a/published/201504/20150205 25 Linux Shell Scripting interview Questions & Answers.md b/published/201504/20150205 25 Linux Shell Scripting interview Questions & Answers.md new file mode 100644 index 0000000000..f320335396 --- /dev/null +++ b/published/201504/20150205 25 Linux Shell Scripting interview Questions & Answers.md @@ -0,0 +1,391 @@ +Linux Shell脚本面试25问 +================================================================================ +### Q:1 Shell脚本是什么、它是必需的吗? ### + +答:一个Shell脚本是一个文本文件,包含一个或多个命令。作为系统管理员,我们经常需要使用多个命令来完成一项任务,我们可以添加这些所有命令在一个文本文件(Shell脚本)来完成这些日常工作任务。 + +### Q:2 什么是默认登录shell,如何改变指定用户的登录shell ### + +答:在Linux操作系统,“/bin/bash”是默认登录shell,是在创建用户时分配的。使用chsh命令可以改变默认的shell。示例如下所示: + + # chsh <用户名> -s <新shell> + # chsh linuxtechi -s /bin/sh + +### Q:3 可以在shell脚本中使用哪些类型的变量? ### + +答:在shell脚本,我们可以使用两种类型的变量: + +- 系统定义变量 +- 用户定义变量 + +系统变量是由系统系统自己创建的。这些变量通常由大写字母组成,可以通过“**set**”命令查看。 + +用户变量由系统用户来生成和定义,变量的值可以通过命令“`echo $<变量名>`”查看。 + +### Q:4 如何将标准输出和错误输出同时重定向到同一位置? ### + +答:这里有两个方法来实现: + +方法一: + + 2>&1 (如# ls /usr/share/doc > out.txt 2>&1 ) + +方法二: + + &> (如# ls /usr/share/doc &> out.txt ) + +### Q:5 shell脚本中“if”语法如何嵌套? ### + +答:基础语法如下: + + if [ 条件 ] + then + 命令1 + 命令2 + ….. + else + if [ 条件 ] + then + 命令1 + 命令2 + …. + else + 命令1 + 命令2 + ….. + fi + fi + +### Q:6 shell脚本中“$?”标记的用途是什么? ? ### + +答:在写一个shell脚本时,如果你想要检查前一命令是否执行成功,在if条件中使用“$?”可以来检查前一命令的结束状态。简单的例子如下: + + root@localhost:~# ls /usr/bin/shar + /usr/bin/shar + root@localhost:~# echo $? + 0 + +如果结束状态是0,说明前一个命令执行成功。 + + root@localhost:~# ls /usr/bin/share + + ls: cannot access /usr/bin/share: No such file or directory + root@localhost:~# echo $? + 2 + +如果结束状态不是0,说明命令执行失败。 + +### Q:7 在shell脚本中如何比较两个数字 ? ### + +答:在if-then中使用测试命令( -gt 等)来比较两个数字,例子如下: + + #!/bin/bash + x=10 + y=20 + + if [ $x -gt $y ] + then + echo “x is greater than y” + else + echo “y is greater than x” + fi + +### Q:8 shell脚本中break命令的作用 ? ### + +答:break命令一个简单的用途是退出执行中的循环。我们可以在while和until循环中使用break命令跳出循环。 + +### Q:9 shell脚本中continue命令的作用 ? ### + +答:continue命令不同于break命令,它只跳出当前循环的迭代,而不是**整个**循环。continue命令很多时候是很有用的,例如错误发生,但我们依然希望继续执行大循环的时候。 + +### Q:10 告诉我shell脚本中Case语句的语法 ? ### + +答:基础语法如下: + + case 变量 in + 值1) + 命令1 + 命令2 + ….. + 最后命令 + !! + 值2) + 命令1 + 命令2 + …… + 最后命令 + ;; + esac + +### Q:11 shell脚本中while循环语法 ? ### + +答:如同for循环,while循环只要条件成立就重复它的命令块。不同于for循环,while循环会不断迭代,直到它的条件不为真。基础语法: + + while [ 条件 ] + do + 命令… + done + +### Q:12 如何使脚本可执行 ? ### + +答:使用chmod命令来使脚本可执行。例子如下: + + # chmod a+x myscript.sh + +### Q:13 “#!/bin/bash”的作用 ? ### + +答:#!/bin/bash是shell脚本的第一行,称为释伴(shebang)行。这里#符号叫做hash,而! 叫做 bang。它的意思是命令通过 /bin/bash 来执行。 + +### Q:14 shell脚本中for循环语法 ? ### + +答:for循环的基础语法: + + for 变量 in 循环列表 + do + 命令1 + 命令2 + …. + 最后命令 + done + +### Q:15 如何调试shell脚本 ? ### + +答:使用'-x'参数(sh -x myscript.sh)可以调试shell脚本。另一个种方法是使用‘-nv’参数( sh -nv myscript.sh)。 + +### Q:16 shell脚本如何比较字符串? ### + +答:test命令可以用来比较字符串。测试命令会通过比较字符串中的每一个字符来比较。 + +### Q:17 Bourne shell(bash) 中有哪些特殊的变量 ? ### + +答:下面的表列出了Bourne shell为命令行设置的特殊变量。 + + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

内建变量

+
+

解释

+
+

$0

+
+

命令行中的脚本名字

+
+

$1

+
+

第一个命令行参数

+
+

$2

+
+

第二个命令行参数

+
+

…..

+
+

…….

+
+

$9

+
+

第九个命令行参数

+
+

$#

+
+

命令行参数的数量

+
+

$*

+
+

所有命令行参数,以空格隔开

+
+ +### Q:18 How to test files in a shell script ? ### +### Q:18 在shell脚本中,如何测试文件 ? ### + +答:test命令可以用来测试文件。基础用法如下表格: + + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Test

+
+

用法

+
+

-d 文件名

+
+

如果文件存在并且是目录,返回true

+
+

-e 文件名

+
+

如果文件存在,返回true

+
+

-f 文件名

+
+

如果文件存在并且是普通文件,返回true

+
+

-r 文件名

+
+

如果文件存在并可读,返回true

+
+

-s 文件名

+
+

如果文件存在并且不为空,返回true

+
+

-w 文件名

+
+

如果文件存在并可写,返回true

+
+

-x 文件名

+
+

如果文件存在并可执行,返回true

+
+ +### Q:19 在shell脚本中,如何写入注释 ? ### + +答:注释可以用来描述一个脚本可以做什么和它是如何工作的。每一行注释以#开头。例子如下: + + #!/bin/bash + # This is a command + echo “I am logged in as $USER” + +### Q:20 如何让 shell 就脚本得到来自终端的输入? ### + +答:read命令可以读取来自终端(使用键盘)的数据。read命令得到用户的输入并置于你给出的变量中。例子如下: + + # vi /tmp/test.sh + + #!/bin/bash + echo ‘Please enter your name’ + read name + echo “My Name is $name” + + # ./test.sh + Please enter your name + LinuxTechi + My Name is LinuxTechi + +### Q:21 如何取消变量或取消变量赋值 ? ### + +答:“unset”命令用于取消变量或取消变量赋值。语法如下所示: + + # unset <变量名> + +### Q:22 如何执行算术运算 ? ### + +答:有两种方法来执行算术运算: + +1.使用`expr`命令(# expr 5 + 2) +2.用一个美元符号和方括号(`$[ 表达式 ]`)例如:test=$[16 + 4] ; test=$[16 + 4] + +### Q:23 do-while语句的基本格式 ? ### + +答:do-while语句类似于while语句,但检查条件语句之前先执行命令(LCTT 译注:意即至少执行一次。)。下面是用do-while语句的语法 + + do + { + 命令 + } while (条件) + +### Q:24 在shell脚本如何定义函数呢 ? ### + +答:函数是拥有名字的代码块。当我们定义代码块,我们就可以在我们的脚本调用函数名字,该块就会被执行。示例如下所示: + + $ diskusage () { df -h ; } + + 译注:下面是我给的shell函数语法,原文没有 + + [ function ] 函数名 [()] + { + + 命令; + [return int;] + + } + + +### Q:25 如何在shell脚本中使用BC(bash计算器) ? ### + +答:使用下列格式,在shell脚本中使用bc: + + variable=`echo “options; expression” | bc` + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/linux-shell-scripting-interview-questions-answers/ + +作者:[Pradeep Kumar][a] +译者:[VicYu/Vic020](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ diff --git a/published/201504/20150205 How To Install or Configure VNC Server On CentOS 7.0.md b/published/201504/20150205 How To Install or Configure VNC Server On CentOS 7.0.md new file mode 100644 index 0000000000..713fb7ab34 --- /dev/null +++ b/published/201504/20150205 How To Install or Configure VNC Server On CentOS 7.0.md @@ -0,0 +1,165 @@ +怎样在CentOS 7.0上安装和配置VNC服务器 +================================================================================ +这是一个关于怎样在你的 CentOS 7 上安装配置 [VNC][1] 服务的教程。当然这个教程也适合 RHEL 7 。在这个教程里,我们将学习什么是 VNC 以及怎样在 CentOS 7 上安装配置 [VNC 服务器][1]。 + +我们都知道,作为一个系统管理员,大多数时间是通过网络管理服务器的。在管理服务器的过程中很少会用到图形界面,多数情况下我们只是用 SSH 来完成我们的管理任务。在这篇文章里,我们将配置 VNC 来提供一个连接我们 CentOS 7 服务器的方法。VNC 允许我们开启一个远程图形会话来连接我们的服务器,这样我们就可以通过网络远程访问服务器的图形界面了。 + +VNC 服务器是一个自由开源软件,它可以让用户可以远程访问服务器的桌面环境。另外连接 VNC 服务器需要使用 VNC viewer 这个客户端。 + +** 一些 VNC 服务器的优点:** + +- 远程的图形管理方式让工作变得简单方便。 +- 剪贴板可以在 CentOS 服务器主机和 VNC 客户端机器之间共享。 +- CentOS 服务器上也可以安装图形工具,让管理能力变得更强大。 +- 只要安装了 VNC 客户端,通过任何操作系统都可以管理 CentOS 服务器了。 +- 比 ssh 图形转发和 RDP 连接更可靠。 + +那么,让我们开始安装 VNC 服务器之旅吧。我们需要按照下面的步骤一步一步来搭建一个可用的 VNC。 + +首先,我们需要一个可用的桌面环境(X-Window),如果没有的话要先安装一个。 + +**注意:以下命令必须以 root 权限运行。要切换到 root ,请在终端下运行“sudo -s”,当然不包括双引号(“”)** + +### 1. 安装 X-Window ### + +首先我们需要安装 [X-Window][2],在终端中运行下面的命令,安装会花费一点时间。 + + # yum check-update + # yum groupinstall "X Window System" + +![installing x windows](http://blog.linoxide.com/wp-content/uploads/2015/01/installing-x-windows.png) + + #yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts + +![install gnome classic session](http://blog.linoxide.com/wp-content/uploads/2015/01/gnome-classic-session-install.png) + + ### 设置默认启动图形界面 + # unlink /etc/systemd/system/default.target + # ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target + +![configuring graphics](http://blog.linoxide.com/wp-content/uploads/2015/01/configuring-graphics.png) + + # reboot + +在服务器重启之后,我们就有了一个工作着的 CentOS 7 桌面环境了。 + +现在,我们要在服务器上安装 VNC 服务器了。 + +### 2. 安装 VNC 服务器 ### + +现在要在我们的 CentOS 7 上安装 VNC 服务器了。我们需要执行下面的命令。 + + # yum install tigervnc-server -y + +![vnc server](http://blog.linoxide.com/wp-content/uploads/2015/01/install-tigervnc.png) + +### 3. 配置 VNC ### + +然后,我们需要在 `/etc/systemd/system/` 目录里创建一个配置文件。我们可以将 `/lib/systemd/sytem/vncserver@.service` 拷贝一份配置文件范例过来。 + + # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service + +![copying vnc server configuration](http://blog.linoxide.com/wp-content/uploads/2015/01/copying-configuration.png) + +接着我们用自己最喜欢的编辑器(这儿我们用的 **nano** )打开 `/etc/systemd/system/vncserver@:1.service` ,找到下面这几行,用自己的用户名替换掉 。举例来说,我的用户名是 linoxide 所以我用 linoxide 来替换掉 : + + ExecStart=/sbin/runuser -l -c "/usr/bin/vncserver %i" + PIDFile=/home//.vnc/%H%i.pid + +替换成 + + ExecStart=/sbin/runuser -l linoxide -c "/usr/bin/vncserver %i" + PIDFile=/home/linoxide/.vnc/%H%i.pid + +如果是 root 用户则 + + ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i" + PIDFile=/root/.vnc/%H%i.pid + +![configuring user](http://blog.linoxide.com/wp-content/uploads/2015/01/configuring-user.png) + +好了,下面重启 systemd 。 + + # systemctl daemon-reload + +最后还要设置一下用户的 VNC 密码。要设置某个用户的密码,必须要有能通过 sudo 切换到用户的权限,这里我用 linoxide 的权限,执行“`su linoxide`”就可以了。 + + # su linoxide + $ sudo vncpasswd + +![setting vnc password](http://blog.linoxide.com/wp-content/uploads/2015/01/vncpassword.png) + +**确保你输入的密码多于6个字符** + +### 4. 开启服务 ### + +用下面的命令(永久地)开启服务: + + $ sudo systemctl enable vncserver@:1.service + +启动服务。 + + $ sudo systemctl start vncserver@:1.service + +### 5. 防火墙设置 ### + +我们需要配置防火墙来让 VNC 服务正常工作。 + + $ sudo firewall-cmd --permanent --add-service vnc-server + $ sudo systemctl restart firewalld.service + +![allowing firewalld](http://blog.linoxide.com/wp-content/uploads/2015/01/allowing-firewalld.png) + +现在就可以用 IP 和端口号(LCTT 译注:例如 192.168.1.1:1 ,这里的端口不是服务器的端口,而是视 VNC 连接数的多少从1开始排序)来连接 VNC 服务器了。 + +### 6. 用 VNC 客户端连接服务器 ### + +好了,现在已经完成了 VNC 服务器的安装了。要使用 VNC 连接服务器,我们还需要一个在本地计算机上安装的仅供连接远程计算机使用的 VNC 客户端。 + +![remote access vncserver from vncviewer](http://blog.linoxide.com/wp-content/uploads/2015/01/vncviewer.png) + +你可以用像 [Tightvnc viewer][3] 和 [Realvnc viewer][4] 的客户端来连接到服务器。 + +要用更多的用户连接,需要创建配置文件和端口,请回到第3步,添加一个新的用户和端口。你需要创建 `vncserver@:2.service` 并替换配置文件里的用户名和之后步骤里相应的文件名、端口号。**请确保你登录 VNC 服务器用的是你之前配置 VNC 密码的时候使用的那个用户名**。 + +VNC 服务本身使用的是5900端口。鉴于有不同的用户使用 VNC ,每个人的连接都会获得不同的端口。配置文件名里面的数字告诉 VNC 服务器把服务运行在5900的子端口上。在我们这个例子里,第一个 VNC 服务会运行在5901(5900 + 1)端口上,之后的依次增加,运行在5900 + x 号端口上。其中 x 是指之后用户的配置文件名 `vncserver@:x.service` 里面的 x 。 + +在建立连接之前,我们需要知道服务器的 IP 地址和端口。IP 地址是一台计算机在网络中的独特的识别号码。我的服务器的 IP 地址是96.126.120.92,VNC 用户端口是1。 + +执行下面的命令可以获得服务器的公网 IP 地址(LCTT 译注:如果你的服务器放在内网或使用动态地址的话,可以这样获得其公网 IP 地址)。 + + # curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' + +### 总结 ### + +好了,现在我们已经在运行 CentOS 7 / RHEL 7 的服务器上安装配置好了 VNC 服务器。VNC 是自由开源软件中最简单的一种能实现远程控制服务器的工具,也是一款优秀的 Teamviewer Remote Access 替代品。VNC 允许一个安装了 VNC 客户端的用户远程控制一台安装了 VNC 服务的服务器。下面还有一些经常使用的相关命令。好好玩! + +#### 其他命令: #### + +- 关闭 VNC 服务。 + + # systemctl stop vncserver@:1.service + +- 禁止 VNC 服务开机启动。 + + # systemctl disable vncserver@:1.service + +- 关闭防火墙。 + + # systemctl stop firewalld.service + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-configure-vnc-server-centos-7-0/ + +作者:[Arun Pyasi][a] +译者:[boredivan](https://github.com/boredivan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://en.wikipedia.org/wiki/Virtual_Network_Computing +[2]:http://en.wikipedia.org/wiki/X_Window_System +[3]:http://www.tightvnc.com/ +[4]:https://www.realvnc.com/ diff --git a/sources/tech/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md b/published/201504/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md similarity index 57% rename from sources/tech/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md rename to published/201504/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md index 4af1fc99cb..77838086fe 100644 --- a/sources/tech/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md +++ b/published/201504/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md @@ -1,66 +1,67 @@ -How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto +怎样用 WPScan,Nmap 和 Nikto 扫描和检查一个 WordPress 站点的安全性 ================================================================================ -### Introduction ### +### 介绍 ### -Millions of websites are powered by WordPress software and there’s a reason for that. WordPress is the most developer-friendly content management system out there, so you can essentially do anything you want with it. Unfortunately, every day some scary report about a major site being hacked or a sensitive database being compromised hits the web … and freaks everyone out. +数百万个网站用着 WordPress ,这当然是有原因的。WordPress 是众多内容管理系统中对开发者最友好的,本质上说你可以用它做任何事情。不幸的是,每天都有些吓人的报告说某个主要的网站被黑了,或者某个重要的数据库被泄露了之类的,吓得人一愣一愣的。 -If you haven’t installed WordPress yet, check the following article. -On Debian based systems: +如果你还没有安装 WordPress ,可以看下下面的文章。 -- [How to install WordPress On Ubuntu][1] +在基于 Debian 的系统上: -On RPM based systems: +- [如何在 Ubuntu 上安装 WordPress][1] -- [How to install wordpress On CentOS][2] +在基于 RPM 的系统上: -Following on from my previous article [How To Secure WordPress Website][3] show you **checklist** allows you to secure your WordPress site with as little effort as possible. +- [如何在 CentOS 上安装 WordPress][2] -In this article, will describe to you through the installation of **wpscan** and serve as a guide on how to use wpscan to locate any known vulnerable plugins and themes that may make your site vulnerable to attack. Also, how to install and use **nmap** the free Security Scanner For Network Exploration & Hacking . And at the end we will show you the steps to use **nikto**. +我之前的文章 [ 如何安全加固 WordPress 站点][3] 里面列出的**备忘录**为读者维护 WordPress 的安全提供了一点帮助。 -### WPScan to Test for Vulnerable Plugins and Themes in WordPress ### +在这篇文章里面,我将介绍 **wpscan** 的安装过程,以及怎样使用 wpscan 来定位那些已知的会让你的站点变得易受攻击的插件和主题。还有怎样安装和使用一款免费的网络探索和攻击的安全扫描软件 **nmap** 。最后展示的是使用 **nikto** 的步骤。 -**WPScan** is a black box WordPress Security Scanner written in Ruby which attempts to find known security weaknesses within WordPress installations. Its intended use it to be for security professionals or WordPress administrators to asses the security posture of their WordPress installations. The code base is Open Source and licensed under the GPLv3. +### 用 WPScan 测试 WordPress 中易受攻击的插件和主题 ### -### Download and Install WPScan ### +**WPScan** 是一个 WordPress 黑盒安全扫描软件,用 Ruby 写成,它是专门用来寻找已知的 WordPress 的弱点的。它为安全专家和 WordPress 管理员提供了一条评估他们的 WordPress 站点的途径。它的基于开源代码,在 GPLv3 下发行。 -Before we get started with the installation, it is important to note that wpscan will not work on Windows systems, so you will need access to a Linux or OSX installation to proceed. If you only have access to a Windows system you can download Virtualbox and install any Linux distro you like as a Virtual Machine. +#### 下载和安装 WPScan #### -WPScan is hosted on Github, so if it is not already installed we will need to install the git packages before we can continue. +在我们开始安装之前,很重要的一点是要注意 wpscan 不能在 Windows 下工作,所以你需要使用一台 Linux 或者 OS X 的机器来完成下面的事情。如果你只有 Windows 的系统,拿你可以下载一个 Virtualbox 然后在虚拟机里面安装任何你喜欢的 Linux 发行版本。 + +WPScan 的源代码放在 Github 上,所以需要先安装 git(LCTT 译注:其实你也可以直接从 Github 上下载打包的源代码,而不必非得装 git )。 sudo apt-get install git -Once git is installed, we need to install the dependencies for wpscan. +git 装好了,我们就要安装 wpscan 的依赖包了。 sudo apt-get install libcurl4-gnutls-dev libopenssl-ruby libxml2 libxml2-dev libxslt1-dev ruby-dev ruby1.9.3 -Now we need to clone the wpscan package from github. +把 wpscan 从 github 上 clone 下来。 git clone https://github.com/wpscanteam/wpscan.git -Now we can move to the newly created wpscan directory and install the necessary ruby gems through bundler. +现在我们可以进入这个新建立的 wpscan 目录,通过 bundler 安装必要的 ruby 包。 cd wpscan sudo gem install bundler && bundle install --without test development -Now that we have wpscan installed, we will walk through using the tool to search for potentially vulnerable files on our WordPress installation. Some of the most important aspects of wpscan are its ability to enumerate not only plugins and themes, but users and timthumb installations as well. WPScan can also perform bruteforce attacks against WordPress– but that is outside of the scope of this article. +现在 wpscan 装好了,我们就可以用它来搜索我们 WordPress 站点潜在的易受攻击的文件。wpcan 最重要的方面是它能列出不仅是插件和主题,也能列出用户和缩略图的功能。WPScan 也可以用来暴力破解 WordPress —— 但这不是本文要讨论的内容。 -#### Update wpscan #### +#### 更新 WPScan #### ruby wpscan.rb --update -#### Enumerate Plugins #### +#### 列举插件 #### -To enumerate plugins, all we need to do is launch wpscan with the `--enumerate p` arguments like so. +要列出所有插件,只需要加上 “--enumerate p” 参数,就像这样: ruby wpscan.rb --url http(s)://www.yoursiteurl.com --enumerate p -or to only display vulnerable plugins: +或者仅仅列出易受攻击的插件: ruby wpscan.rb --url http(s)://www.yoursiteurl.com --enumerate vp -Some example output is posted below: +下面是一些例子: - | Name: akismet + | Name: ukiscet | Location: http://********.com/wp-content/plugins/akismet/ | Name: audio-player @@ -91,17 +92,17 @@ Some example output is posted below: | Name: contact | Location: http://********.com/wp-content/plugins/contact/ -#### Enumerate Themes #### +#### 列举主题 #### -Enumeration of themes works the same as enumeration of plugins, just with the `--enumerate t` argument. +列举主题和列举插件差不多,只要用"--enumerate t"就可以了。 ruby wpscan.rb --url http(s)://www.host-name.com --enumerate t -Or to only display vulnerable themes: +或者只列出易受攻击的主题: ruby wpscan.rb --url http(s)://www.host-name.com --enumerate vt -Sample output: +例子的输出: | Name: path | Location: http://********.com/wp-content/themes/path/ @@ -126,29 +127,29 @@ Sample output: | Style URL: http://********.com/wp-content/themes/twentyten/style.css | Description: -#### Enumerate Users #### +#### 列举用户 #### -WPScan can also be used to enumerate users with valid logins to the WordPress installation. This is usually performed by attackers in order to get a list of users in preparation for a bruteforce attack. +WPscan 也可以用来列举某个 WordPress 站点的用户和有效的登录记录。攻击者常常这么做——为了获得一个用户清单,好进行暴力破解。 ruby wpscan.rb --url http(s)://www.host-name.com --enumerate u -#### Enumerate Timthumb Files #### +#### 列举 Timthumb 文件 #### -The last function of wpscan we’ll discuss in this article is the ability to enumerate timthumb installations. In recent years, timthumb has become a very common target of attackers due to the numerous vulnerabilities found and posted to online forums, message lists, and advisory boards. Using wpscan to find vulnerable timthumb files is done with the following command. +关于 WPscan ,我要说的最后一个功能是列举 timthub (缩略图)相关的文件。近年来,timthumb 已经成为攻击者眼里的一个常见目标,因为无数的漏洞被找出来并发到论坛上、邮件列表等等地方。用下面的命令可以通过 wpscan 找出易受攻击的 timthub 文件: ruby wpscan.rb --url http(s)://www.host-name.com --enumerate tt -### Nmap to Scan for Open Ports on your VPS ### +### 用 Nmap 扫描你 VPS 的开放端口 ### -**Nmap** is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics +**Nmap** 是一个开源的用于网络探索和安全审查方面的工具。它可以迅速扫描巨大的网络,也可一单机使用。Nmap 用原始 IP 数据包通过不同寻常的方法判断网络里那些主机是正在工作的,那些主机上都提供了什么服务(应用名称和版本),是什么操作系统(以及版本),用的什么类型的防火墙,以及很多其他特征。 -### Download and install nmap on Debian and Ubuntu ### +#### 在 Debian 和 Ubuntu 上下载和安装 nmap #### -To install nmap for Debian and Ubuntu Linux based server systems type the following apt-get command: +要在基于 Debian 和 Ubuntu 的操作系统上安装 nmap ,运行下面的命令: sudo apt-get install nmap -**Sample outputs:** +**输出样例** Reading package lists... Done Building dependency tree @@ -166,27 +167,27 @@ To install nmap for Debian and Ubuntu Linux based server systems type the follow Processing triggers for man-db ... Setting up nmap (5.21-1.1ubuntu1) ... -#### Examples #### +#### 举个例子 #### -To find the nmap version, enter: +输出 nmap 的版本: nmap -V -OR +或者 nmap --version -**Sample outputs:** +**输出样例** Nmap version 5.21 ( http://nmap.org ) -### Dowonlad and install nmap on Centos ### +#### 在 Centos 上下载和安装 nmap #### -To install nmap on RHEL based Linux distributions, type the following yum command: +要在基于 RHEL 的 Linux 上面安装 nmap ,输入下面的命令: yum install nmap -**Sample outputs:** +**输出样例** Loaded plugins: protectbase, rhnplugin, security 0 packages excluded due to repository protections @@ -225,63 +226,63 @@ To install nmap on RHEL based Linux distributions, type the following yum comman Complete! -#### Examples #### +#### 举个例子 #### -To find the nmap version, enter: +输出 nmap 版本号: nmap --version -**Sample outputs:** +**输出样例** Nmap version 5.51 ( http://nmap.org ) -#### Scan Ports with Nmap #### +#### 用 Nmap 扫描端口 #### -You can got a lot of information about your server or host using nmap and it let you to think like someone has malicious intent. +你可以用 nmap 来获得很多关于你的服务器的信息,它可以让你站在对你的网站不怀好意的人的角度看你自己的网站。 -For this reason, only test it on servers that you own or in situations where you’ve notified the owners. +因此,请仅用它测试你自己的服务器或者在行动之前通知服务器的所有者。 -The nmap creators actually provide a test server located at: +nmap 的作者提供了一个测试服务器: scanme.nmap.org -Some commands may take a long while to complete: +有些命令可能会耗时较长: -To scan an IP address or a host name (FQDN), run: +要扫描一个 IP 地址或者一个主机名(全称域名),运行: nmap 192.168.1.1 -Sample outputs: +输出样例: ![Fig.01: nmap in action](http://s0.cyberciti.org/uploads/faq/2012/11/redhat-nmap-command-output.png) -Scan for the host operating system: +扫描以获得主机的操作系统: sudo nmap -O 192.168.1.1 -pecify a range with “-” or “/24″ to scan a number of hosts at once: +加上“-”或者“/24”来一次性扫描某个范围里面的多个主机: sudo nmap -PN xxx.xxx.xxx.xxx-yyy -Scan a network range for available services: +扫描某个范围内可用的服务: sudo nmap -sP network_address_range -Scan without preforming a reverse DNS lookup on the IP address specified. This should speed up your results in most cases: +扫描 IP 地址时部进行反向 DNS 解析。多数情况下这会加快你获得结果的速度: sudo nmap -n remote_host -Scan a specific port instead of all common ports: +扫描一个特定端口而不是所有常用端口: sudo nmap -p port_number remote_host -Scan a network and find out which servers and devices are up and running +扫描一个网络,找出哪些服务器在线,分别运行了什么服务。 -This is known as host discovery or ping scan: +这就是传说中的主机探索或者 ping 扫描: nmap -sP 192.168.1.0/24 -Sample outputs: +输出样例: Host 192.168.1.1 is up (0.00035s latency). MAC Address: BC:AE:C5:C3:16:93 (Unknown) @@ -292,25 +293,25 @@ Sample outputs: MAC Address: 00:11:32:11:15:FC (Synology Incorporated) Nmap done: 256 IP addresses (4 hosts up) scanned in 2.80 second -Understanding port configuration and how to discover what the attack vectors are on your server is only one step to securing your information and your VPS. +理解端口配置和如何发现你的服务器上的攻击目标只是确保你的信息和你的 VPS 安全的第一步。 -### Nikto to Scan for vulnerabilities in your website ### +### 用 Nikto 扫描你网站的缺陷 ### -[Nikto][4] Web-scanner is a open source web-server scanner which can be used to scan the web-servers for malicious programs and files. Nikto can be used to scan the outdated versions of programs too. Nikto will provide us a quick and easy scan to find out the dangerous files and programs in server, At the end of scan result with a log file. +[Nikto][4] 网络扫描器是一个开源的 web 服务器的扫描软件,它可以用来扫描 web 服务器上的恶意的程序和文件。Nikto 也可以用来检查软件版本是否过期。Nikto 能进行简单而快速地扫描以发现服务器上危险的文件和程序。扫描结束后会给出一个日志文件。` -### Download and install Nikto on Linux server ### +#### 在 Linux 服务器上下载和安装 Nikto #### -Perl is pre-installed in linux so all you need to do is download nikto from the [project page][5], unpack it into a directory and start your testing. +Perl 在 Linux 上是预先安装好的,所以你只需要从[项目页面][5]下载 nikto ,解压到一个目录里面,然后开始测试。 wget https://cirt.net/nikto/nikto-2.1.4.tar.gz -You can unpack it with an archive manager tool or use tar and gzip together with this command. +你可以用某个归档管理工具解包,或者如下同时使用 tar 和 gzip : tar zxvf nikto-2.1.4.tar.gz cd nikto-2.1.4 perl nikto.pl -This should be your results from a working installation: +安装正确的话会得到这样的结果: - ***** SSL support not available (see docs for SSL install) ***** - Nikto v2.1.4 @@ -347,27 +348,27 @@ This should be your results from a working installation: Note: This is the short help output. Use -H for full help. -The error is merely telling us we did not fill in the necessary parameters for a test to run. The SSL support can be enabled by installing the necessary perl ssl module (sudo apt-get install libnet-ssleay-perl). +这个报错只是告诉我们没有给出必要的参数。SSL 支持可以通过安装相关的 perl ssl 模块得到(sudo apt-get install libnet-ssleay-perl)。 -#### Update the nikto Database #### +#### 更新 nikto 数据库 #### -Before performing any scan we need to update the nikto database packages using. +在开始使用之前我们需要先更新 nikto 数据库: /usr/local/bin/nikto.pl -update -To list the available Plugins for nikto we can use the below command. +下面的命令可以列出可用的 nikto 插件。 nikto.pl -list-plugins // To list the installed plugins // -#### Scan for vulnerabilities #### +#### 扫描以寻找缺陷 #### -For a simple test for we will use test a single url. +我们用一个 url 来在做个简单的测试。 perl nikto.pl -h http://www.host-name.com -**Sample outputs:** +**输出样例** -This will produce fairly verbose output that may be somewhat confusing at first. Take the time to read through the output to understand what each advisory means. Many of the alerts in Nikto will refer to OSVDB numbers. These are Open Source Vulnerability Database ([http://osvdb.org/][6]) designations. You can search on OSVDB for further information about any vulnerabilities identified. +会有十分冗长的输出,可能一开始会让人感到困惑。许多 Nikto 的警报会返回 OSVDB 序号。这是由开源缺陷数据库([http://osvdb.org/][6])所指定。你可以在 OSVDB 上找出相关缺陷的深入说明。 $ nikto -h http://www.host-name.com - Nikto v2.1.4 @@ -398,19 +399,19 @@ This will produce fairly verbose output that may be somewhat confusing at first. + 1 host(s) tested $ -**Nikto** is an extremely lightweight, and versatile tool. Because of the fact that Nikto is written in Perl it can be run on almost any host operating system. +**Nikto** 是一个非常轻量级的通用工具。因为 Nikto 是用 Perl 写的,所以它可以在几乎任何服务器的操作系统上运行。 -Hope this will will bring you a good idea to scan vulnerbalites for your wordpress website. Following on from my previous article [How To Secure WordPress Website][7] show you **checklist** allows you to secure your WordPress site with as little effort as possible. +希望这篇文章能在你检查 wordpress 站点的缺陷的时候给你一些提示。我之前的文章[如何安全加固 WordPress 站点][7]记录了一个**清单**,可以让你保护你的 WordPress 站点的工作变得更简单。 -If you have any feedback or comments, feel free to post them in the comment section below. +有想说的,留下你的评论。 -------------------------------------------------------------------------------- via: http://www.unixmen.com/scan-check-wordpress-website-security-using-wpscan-nmap-nikto/ 作者:[anismaj][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[boredivan](https://github.com/boredivan) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 @@ -421,4 +422,4 @@ via: http://www.unixmen.com/scan-check-wordpress-website-security-using-wpscan-n [4]:http://www.unixmen.com/install-nikto-web-scanner-check-vulnerabilities [5]:https://cirt.net/nikto/ [6]:http://osvdb.org/ -[7]:http://www.unixmen.com/secure-wordpress-website/ \ No newline at end of file +[7]:http://www.unixmen.com/secure-wordpress-website/ diff --git a/published/201504/20150209 Fix Cannot Empty Trash In Ubuntu 14.04 [Quick Tip].md b/published/201504/20150209 Fix Cannot Empty Trash In Ubuntu 14.04 [Quick Tip].md new file mode 100644 index 0000000000..dcc6cb31c4 --- /dev/null +++ b/published/201504/20150209 Fix Cannot Empty Trash In Ubuntu 14.04 [Quick Tip].md @@ -0,0 +1,37 @@ +在Ubuntu 14.04 中修复无法清空回收站的问题 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/empty-the-trash.jpg) + +### 问题 ### + +**我遇到了无法在Ubuntu 14.04中清空回收站的问题**。我右键回收站图标并选择清空回收站,就像我一直做的那样。我看到进度条显示删除文件中过了一段时间。但是它停止了,并且Nautilus文件管理也停止了。我不得不在终端中停止了它。 + +但是这很痛苦因为文件还在垃圾箱中。并且我反复尝试清空后窗口都冻结了。 + +### 方案 ### + +老实说,我不知道什么导致了这个问题。但是我有一个解决方案如果你在Ubuntu 14.04或者14.10遇到这个问题的话。 + +打开终端并使用下面的命令: + + sudo rm -rf ~/.local/share/Trash/* + +这里注意你的输入。你使用超级管理员权限来运行删除命令。我相信你不会删除其他文件或者目录。 + +上面的命令会删除回收站目录下的所有文件。换句话说,这是用命令清空垃圾箱。使用完上面的命令后,你会看到垃圾箱已经清空了。如果你清空了所有文件,你不应该在看到Nautilus崩溃的问题了。 + +### 对你有用么? ### + +我希望这篇贴士对你有用,今后你也不会在Ubuntu或者其他发行版中再遇到相同的问题。如果你遇到任何问题请让我知道。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/fix-empty-trash-ubuntu/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ diff --git a/published/201504/20150209 Install the Gnome Flashback classical desktop on Ubuntu 14.10 or Linux Mint 17.md b/published/201504/20150209 Install the Gnome Flashback classical desktop on Ubuntu 14.10 or Linux Mint 17.md new file mode 100644 index 0000000000..a881b2fcc6 --- /dev/null +++ b/published/201504/20150209 Install the Gnome Flashback classical desktop on Ubuntu 14.10 or Linux Mint 17.md @@ -0,0 +1,101 @@ +在Ubuntu14.10/Mint7上安装Gnome Flashback 经典桌面 +================================================================================ +如果你不喜欢现在的Unity桌面,[Gnome Flashback][1]桌面环境是一个简单的并且很棒的选择,让你能找回曾经经典的桌面。 + +Gnome Flashback基于GTK3并提供与原先gnome桌面视觉上相似的界面。 + + Gnome Flashback的另一个改变是采用了源自mint和xface的MATE桌面,但无论mint还是xface都是基于GTK2的。 + +### 安装 Gnome Flashback ### + +在你的ubuntu上安装以下包即可: + + $ sudo apt-get install gnome-session-flashback + +然后注销返回到登录界面,单击密码输入框右上角的徽标型按钮,即可选择桌面环境。可供选择的有Gnome Flashback (Metacity) 会话模式和Gnome Flashback (Compiz)会话模式。 + +Metacity更轻更快,而Compiz则能带给你更棒的桌面效果。下面是我使用gnome flashback桌面的截图。 + +桌面采用了elementary OS的壁纸和Plank dock并且移除了底部面板。这些都会在这篇教程中涉及到。 + +![ubuntu gnome flashback](http://www.binarytides.com/blog/wp-content/uploads/2015/02/ubuntu-gnome-flashback.png) + +在安装好gnome flashback桌面以后也许你对效果还不满意,这样你可能需要执行接下来的一系列操作来对它进行微调。 + +### 1. 安装 Gnome Tweak Tool ### + +Gnome Tweak Tool能够帮助你定制比如字体、主题等,这些在Unity桌面的控制中心是十分困难,几乎不可能完成的任务。 + + $ sudo apt-get install gnome-tweak-tool + +启动按步骤: 应用程序 > 系统工具 > 首选项 > Tweak Tool + +### 2. 在面板上添加小应用 ### + +默认的右键点击面板是没有效果的。你可以尝试在右键点击面板的同时按住键盘上的Alt+Super (win)键,这样就会出现定制面板的相关选项。 + +你可以修改或删除面板,并在上面添加些小应用。在这个例子中我们移除了底部面板,并用Plank dock来代替它的位置。 + +在顶部面板的中间添加一个显示时间的小应用。通过配置使它显示时间和天气。 + +同样的添加一个工作空间切换器到顶部面板,并创建合适个数的工作空间。 + +### 3. 将窗口标题栏的按钮右置 ### + +在ubuntu中,最小化、最大化和关闭按钮默认是在标题栏左侧的。需要稍作手脚才能让他们乖乖回到右边去。 + +想让窗口的按钮到右边可以使用下面的命令,这是我在askubuntu上找到的。 + + $ gsettings set org.gnome.desktop.wm.preferences button-layout 'menu:minimize,maximize,close' + +### 4.安装 Plank dock ### + +plank dock位于屏幕底部,用于启动应用和切换打开的窗口。它会在必要的时间隐藏自己,并在需要的时候出现。elementary OS使用的dock就是plank dock。 + +运行以下命令安装: + + $ sudo add-apt-repository ppa:ricotz/docky -y + $ sudo apt-get update + $ sudo apt-get install plank -y + +现在启动:应用程序 > 附件 > Plank。若想让它开机自动启动,找到 应用程序 > 系统工具 > 首选项 > 启动应用程序 并将“plank”的命令加到列表中。 + +### 5. 安装 Conky 系统监视器 ### + +Conky非常酷,它用系统的中如CPU和内存使用率的统计值来装饰桌面。它不太占资源,并且绝大部分情况下运行都不会有什么问题。 + +运行如下命令安装: + + $ sudo apt-add-repository -y ppa:teejee2008/ppa + $ sudo apt-get update + $ sudo apt-get install conky-manager + +现在启动:应用程序 > 附件 > Conky Manager ,选择你想在桌面上显示的部件。Conky Manager同样可以配置到启动项中。 + +### 6. 安装CCSM ### + +如果你更愿意使用Gnome Flashback (Compiz),那么CCSM将是你配置桌面特效的得力助手。 + +运行以下命令安装: + + $ sudo apt-get install compizconfig-settings-manager + +启动按步骤: 应用程序 > 系统工具 > 首选项 > CompizConfig Settings Manager. + + +> 在虚拟机中经常会发生compiz会话中装饰窗口消失。可以通过启动Compiz设置,并启用"Copy to texture"插件,注销后重新登录即可。 + +不过值得一提的是Compiz 会话会比Metacity慢。 + +-------------------------------------------------------------------------------- + +via: http://www.binarytides.com/install-gnome-flashback-ubuntu/ + +作者:[Silver Moon][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117145272367995638274/posts +[1]:https://wiki.gnome.org/action/show/Projects/GnomeFlashback?action=show&redirect=GnomeFlashback diff --git a/published/201504/20150209 Linux FAQs with Answers--How to fix 'fatal error--x264.h--No such file or directory' on Linux.md b/published/201504/20150209 Linux FAQs with Answers--How to fix 'fatal error--x264.h--No such file or directory' on Linux.md new file mode 100644 index 0000000000..57f8983d89 --- /dev/null +++ b/published/201504/20150209 Linux FAQs with Answers--How to fix 'fatal error--x264.h--No such file or directory' on Linux.md @@ -0,0 +1,91 @@ +Linux 有问必答:如何在Linux 中修复“fatal error: x264.h: No such file or directory”的错误 +================================================================================ +> **提问**: 我想在Linux中从源码编译视频编码程序。到那时,在编译时,我遇到了一个错误“fatal error: x264.h: No such file or directory”,我该如何修复? + +下面的编译错误错明你系统中没有x264开发库文件。 + + fatal error: x264.h: No such file or directory + +[x264][1]是GNU GPL授权的H.264/MPEG-4 AVC编码库。x264库被广泛用于视频编码/转码程序比如Avidemux、[FFmpeg][2]、 [HandBrake][3]、 OpenShot、 MEncode等等。 + +要解决这个问题,你需要安装x264的开发库文件。你可以如下做。 + +###在 Debian、 Ubuntu 或者 Linux Mint 中安装像x264库和开发文件 ### + +在基于Debian的系统中,x264库已经包含在基础仓库中。可以直接用apt-get来安装。 + + $ sudo apt-get install libx264-dev + +### 在 Fedora、 CentOS/RHEL中安装像x264库和开发文件 ### + +在基于Red Hat的发行版比如Fedora或者CentOS,x264库在免费的RPM Fusion仓库中有。那么,你需要首先安装[RPM Fusion (免费)][4] 。 + +RPM Fusion设置完成后,你可以使用下面的命令安装x264开发文件。 + + $ sudo yum --enablerepo=rpmfusion-free install x264-devel + +注意RPM Fusion仓库在CentOS 7中还没有,因此上面的方法在CentOS 7中还不可行。万一是CentOS 7 ,你可以从源码编译并安装x264,下面会解释的。 + +### 在Debian、 Ubuntu 或者 Linux Mint中源码编译x264库 ### + +如果libx264包在你的发行版中并没有,那么你可以按照下面的方法编译最新的x264库。 + + $ sudo apt-get install g++ automake autoconf libtool yasm nasm git + $ git clone git://git.videolan.org/x264.git + $ cd x264 + $ ./configure --enable-static --enable-shared + $ make + $ sudo make install + +x264库将会安装在/usr/local/lib。要让其他程序可以使用这个库,你需要完成最后一步。 + +打开/etc/ld.so.conf,并添加下面的行。 + + $ sudo vi /etc/ld.so.conf + +---------- + + /usr/local/lib + +最后运行下面的命令重新加载共享库: + + $ sudo ldconfig + +### 在 Fedora, CentOS/RHEL 中源码编译x264库 ### + +如果你Linux的发行版中没有x264库(比如:CentOS 7)或者x264库并不是最新的,你可以如下编译最新的x264库。 + + $ sudo yum install gcc gcc-c++ automake autoconf libtool yasm nasm git + $ git clone git://git.videolan.org/x264.git + $ cd x264 + $ ./configure --enable-static --enable-shared + $ make + $ sudo make install + +最后,要让其他的程序可以访问到位于 /usr/local/lib的x264库,在 /etc/ld.so.conf加入下面的行。 + + $ sudo vi /etc/ld.so.conf + +---------- + + /usr/local/lib + +最后运行下面的命令重新加载共享库: + + $ sudo ldconfig + +![](https://farm8.staticflickr.com/7350/16453197512_7c18c5c09e_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/fatal-error-x264-h-no-such-file-or-directory.html + +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.videolan.org/developers/x264.html +[2]:http://ask.xmodulo.com/compile-ffmpeg-centos-fedora-rhel.html +[3]:http://xmodulo.com/how-to-install-handbrake-on-linux.html +[4]:http://xmodulo.com/how-to-install-rpm-fusion-on-fedora.html diff --git a/published/201504/20150211 Install Mumble in Ubuntu an Opensource VoIP Apps.md b/published/201504/20150211 Install Mumble in Ubuntu an Opensource VoIP Apps.md new file mode 100644 index 0000000000..fdaaef9e70 --- /dev/null +++ b/published/201504/20150211 Install Mumble in Ubuntu an Opensource VoIP Apps.md @@ -0,0 +1,78 @@ +游戏玩家的福音:在 Ubuntu 上安装开源 VoIP 应用 Mumble +================================================================================ +Mumble是一个自由开源的VoIP应用,在新的 BSD 许可证下发布,主要面向的用户群体是游戏玩家。运行起来类似于TeamSpeak和Ventrilo,用户通过连接到同一个服务器来实现相互通讯。 + +Mumble提供了如下的漂亮特性: + +- 低延迟,这点对游戏相当重要 +- 提供游戏中的可视插件,通过它你可以知道是谁正在和你通话并定位他们的位置 +- 交谈内容经过加密的,能够保护你的隐私和安全 +- 界面简单易于上手 +- 稳定高效的使用你的服务器资源 + +### 安装 Mumble ### + +[Mumble][1]已经流行开来,进入了许多linux主流发行版的软件仓库,这使它安装起来更加的方便。若你使用的是Ubuntu那么使用apt-get就能安装,详细命令如下: + + $ sudo apt-get install mumble-server + +![mumble install](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-install.jpg) + +这条命令将会在你的服务器上安装服务端(亦称Murmur)。 + +### 配置 Mumble ### + +运行以下命令启动Mumble: + + $ sudo dpkg-reconfigure mumble-server + +会弹出以下一些问题: + +![mumble q1](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-q1.jpg) + +选择“是”让服务器开机时自动启动mumble,接着它会询问你是否运行高优先级模式以保持低延迟,为了让它保持最佳性能这是个不错的主意。 + +![mumble q2](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-q2.jpg) + +接着为你刚安装好的mumble服务端设管理员用户的密码,记住这个密码,它会在登录时用到。 + +![mumble q3](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-q3.jpg) + +### 安装 Mumble 客户端 ### + +客户端可以安装到许多的主流操作系统中,例如windows,mac和linux。我们将教你在Ubuntu linux上安装和配置,你可以使用软件中心也可以用命令安装客户端: + + $ sudo apt-get install mumble + +第一次运行mumble时,配置向导将会帮助你配置音频的输入输出,使其能在客户端上保持最好的效果。第一次同样也会询问你要使用的是什么声音设备和麦克风: + +![mumble client 1](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-client-1.jpg) + +然后它将帮你校准设备: + +![mumble client 2](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-client-2.jpg) + +因为mumble会帮你加密所有的通讯内容所以它会要求你创建证书: + +![mumble client 3](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-client-3.jpg) + +完成配置向导后你就能添加第一个服务器,连接对话框如下图所示: + +![mumble add server](http://blog.linoxide.com/wp-content/uploads/2015/01/mumble-add-server.jpg) + +首先输入一个标签,名字任意因为那只不过是为了记住服务器的,然后输入服务器的地址和端口,最后使用“SuperUser”作为用户名,而密码则是你配置mumble服务器端时输入的密码。 + +现在你可以连接到服务器了,在联网玩游戏或与你好友、队友聊天开黑时享受这些功能给你带来的乐趣吧! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/install-mumble-ubuntu/ + +作者:[Adrian Dinu][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/adriand/ +[1]:http://wiki.mumble.info/wiki/Main_Page diff --git a/published/201504/20150211 Simple Steps Migration From MySQL To MariaDB On Linux.md b/published/201504/20150211 Simple Steps Migration From MySQL To MariaDB On Linux.md new file mode 100644 index 0000000000..a778240683 --- /dev/null +++ b/published/201504/20150211 Simple Steps Migration From MySQL To MariaDB On Linux.md @@ -0,0 +1,171 @@ +Linux上从MySQL迁移到MariaDB的简单步骤 +================================================================================ +大家好!这是一篇介绍如何在服务器或个人电脑上从MySQL迁移到MariaDB的教程。也许你会问为什么我们要将数据库管理从MySQL迁移到MariaDB。往下看我们告诉你为什么这样做。 + +### 为什么要用MariaDB来代替MySQL ### + +MariaDB是MySQL社区开发的分支,也是一个增强型的替代品。它由MySQL前开发者们带头组织的基金会开发,使用起来和MySQL完全一样。自从Oracle买下了MySQL,它就不再自由开源了,但是 **MariaDB仍然自由开源**。一些如谷歌、维基、LinkedIn、Mozilla等的顶级的网站已经迁移到MariaDB了。它的优势在哪里: + +- 向后兼容MySQL +- 永远开源 +- 由MySQL缔造者的维护 +- 更尖端的功能 +- 更多的存储引擎 +- 大型的网站已经转向MariaDB + +现在,让我们迁移到MariaDB吧! + +让我们创建一个叫**linoxidedb**的**用于测试的**示例数据库。 + +使用以下命令用root账户登陆MySQL: + + $ mysql -u root -p + +输入mysql 的 root 用户密码后,你将进入**mysql的命令行** + +**创建测试数据库:** + +在mysql命令行输入以下命令以创建测试数据库。 + + mysql> create database linoxidedb; + +查看可用的数据库,输入以下命令: + + mysql> show databases; + +![creating test databases](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-test-databases.png) + +如你所见,算上刚刚新建的linoxidedb我们一共有5个数据库。 + + mysql> quit + +现在,我们就将刚创建的数据库从MySQL迁移到MariaDB。 + +注:使用CentOS这类基于fedora的linux发行版没有必要参考这篇教程,因为它们在安装MariaDB时会自动代替MySQL,无需备份现有的数据库,你只需要更新mysql就可以得到mariadb。 + +### 1. 备份现有的数据库 ### + +我们第一个重要的步骤就是备份现有的数据库。我们在**终端(不是MySQL命令行)**里输入如下命令来完成备份。 + + $ mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql + +哇哦!我们遇到了点麻烦。别担心我们可以搞定。 + + $ mysqldump: Error: Binlogging on server not active + +![](http://blog.linoxide.com/wp-content/uploads/2015/01/mysqldump-error.png) + +*mysqldump error* + +为了修复这个错误,我们需要对**my.cnf**文件做一些小改动。 + +编辑my.cnf文件: + + $ sudo nano /etc/mysql/my.cnf + +在[mysqld]部分添加如下参数。 + +**log-bin=mysql-bin** + +![configuring my.cnf](http://blog.linoxide.com/wp-content/uploads/2015/01/configuring-my.cnf_.png) + +好了,在保存并关闭文件后,我们需要重启一下mysql服务。运行以下命令重启: + + $ sudo /etc/init.d/mysql restart + +现在,重新运行mysqldump命令来备份所有的数据库。 + + $ mysqldump --all-databases --user=root --password --master-data > backupdatabase.sql + +![](http://blog.linoxide.com/wp-content/uploads/2015/01/crearing-bakup-file.png) + +*dumping databases* + +上面的命令将会备份所有的数据库,把它们存储在当前目录下的**backupdatabase.sql**文件中。 + +### 2. 卸载MySQL ### + +首先,我们得把**my.cnf文件挪到安全的地方去**。 + +**注**:在你卸载MySQL包的时候不会自动删除my.cnf文件,我们这样做只是以防万一。在MariaDB安装时,它会询问我们是保持现存的my.cnf文件,还是使用包中自带的版本(即新my.cnf文件)。 + +在shell或终端中输入如下命令来备份my.cnf文件: + + $ sudo cp /etc/mysql/my.cnf my.cnf.bak + +运行命令来终止mysql服务: + + $ sudo /etc/init.d/mysql stop + +然后移除mysql包: + + $ sudo apt-get remove mysql-server mysql-client + +![uninstalling mysql](http://blog.linoxide.com/wp-content/uploads/2015/01/uninstalling-mysql.png) + +### 3. 安装MariaDB ### + +这是在Ubuntu系统中安装MariaDB的命令: + + $ sudo apt-get install software-properties-common + $ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db + # sudo add-apt-repository 'deb http://mirror.mephi.ru/mariadb/repo/5.5/ubuntu trusty main' + +![adding mariadb repo](http://blog.linoxide.com/wp-content/uploads/2015/01/adding-repo-mariadb.png) + +键值导入并且添加完仓库后,你就可以用以下命令安装MariaDB了: + + $ sudo apt-get update + $ sudo apt-get install mariadb-server + +![installing mariadb](http://blog.linoxide.com/wp-content/uploads/2015/01/installing-mariadb.png) + +![my.conf configuration prompt](http://blog.linoxide.com/wp-content/uploads/2015/01/my.conf-configuration-prompt.png) + +我们应该还没忘记在MariaDB安装时,它会问你是使用现有的my.cnf文件,还是包中自带的版本。你可以使用以前的my.cnf也可以用包中自带的。即使你想直接使用新的my.cnf文件,你依然可以晚点时候将以前的备份内容还原进去(别忘了我们已经将它复制到安全的地方了)。所以,我们直接选择了默认的选项“N”。如果需要安装其他版本,请参考[MariaDB官方仓库][2]。 + +### 4. 恢复配置文件 ### + +想要将my.cnf.bak中的内容恢复到my.cnf,在终端中输入以下命令。由于my.cnf.bak文件在当前目录下,所以我们只要简单的执行以下命令即可: + + $ sudo cp my.cnf.bak /etc/mysql/my.cnf + +### 5. 导入数据库 ### + +最后,让我们把我们之前创建的数据库导入吧!运行一下命令即可完成导入。 + + $ mysql -u root -p < backupdatabase.sql + +就这样,我们已成功将之前的数据库导入了进来。 + +来,让我们登录一下mysql命令行,检查一下数据库是否真的已经导入了: + + $ mysql -u root -p + +![importing database](http://blog.linoxide.com/wp-content/uploads/2015/01/importing-database.png) + +为了检查数据库是否被迁移到MariaDB,请在MariaDB命令行中输入“**show databases**;”不用输入(“”),如下: + + mariaDB> show databases; + +![mysql to mariadb database migrated](http://blog.linoxide.com/wp-content/uploads/2015/01/maria-database-migrated.png) + +如你所见,linoxidedb及所有的数据库都已经成功的被迁移了。 + +### 总结 ### + +最后,我们已经成功地从MySQL迁移到了MariaDB数据库管理系统。MariaDB比MySQL好,虽然在性能方面MySQL还是比它更快,但是MariaDB的优点在于它额外的特性与支持的许可证。这能够确保它自由开源(FOSS),并永久自由开源,相比之下MySQL还有许多额外的插件,有些不能自由使用代码、有些没有公开的开发进程、有些在不久的将来会变的不再自由开源。如果你有任何的问题、评论、反馈给我们,不要犹豫直接在评论区留下你的看法。谢谢观看本教程,希望你能喜欢MariaDB。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/migrate-mysql-mariadb-linux/ + +作者:[Arun Pyasi][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://mariadb.org/ +[2]:https://downloads.mariadb.org/mariadb/repositories/#mirror=mephi diff --git a/published/201504/20150215 How to analyze and view Apache web server logs interactively on Linux.md b/published/201504/20150215 How to analyze and view Apache web server logs interactively on Linux.md new file mode 100644 index 0000000000..06a32d3fcb --- /dev/null +++ b/published/201504/20150215 How to analyze and view Apache web server logs interactively on Linux.md @@ -0,0 +1,144 @@ +在 Linux 中以交互方式实时查看Apache web访问统计 +================================================================================ + +无论你是在网站托管业务,还是在自己的VPS上运行几个网站,你总会有需要显示访客统计信息,例如前几的访客、访问请求的文件(无论动态或者静态)、所用的带宽、客户端的浏览器,和访问的来源网站,等等。 + +[GoAccess][1] 是一款用于Apache或者Nginx的命令行日志分析器和交互式查看器。使用这款工具,你不仅可以浏览到之前提及的相关数据,还可以通过分析网站服务器日志来进一步挖掘数据 - 而且**这一切都是在一个终端窗口实时输出的**。由于今天的[大多数web服务器][2]都使用Debian的衍生版或者基于RedHat的发行版来作为底层操作系统,所以本文中我告诉你如何在Debian和CentOS中安装和使用GoAccess。 + +### 在Linux系统安装GoAccess ### + +在Debian,Ubuntu及其衍生版本,运行以下命令来安装GoAccess: + + # aptitude install goaccess + +在CentOS中,你将需要使你的[EPEL 仓库][3]可用然后执行以下命令: + + # yum install goaccess + +在Fedora,同样使用yum命令: + + # yum install goaccess + + +如果你想从源码安装GoAccess来使用更多功能(例如 GeoIP 定位功能),需要在你的操作系统安装[必需的依赖包][4],然后按以下步骤进行: + + # wget http://tar.goaccess.io/goaccess-0.8.5.tar.gz + # tar -xzvf goaccess-0.8.5.tar.gz + # cd goaccess-0.8.5/ + # ./configure --enable-geoip + # make + # make install + +以上安装的版本是 0.8.5,但是你也可以在该软件的网站[下载页][5]确认是否是最新版本。 + +由于GoAccess不需要后续的配置,一旦安装你就可以马上使用。 + +### 运行 GoAccess ### + +开始使用GoAccess,只需要对它指定你的Apache访问日志。 + +对于Debian及其衍生版本: + + # goaccess -f /var/log/apache2/access.log + +基于红帽的发行版: + + # goaccess -f /var/log/httpd/access_log + +当你第一次启动GoAccess,你将会看到如下的屏幕中选择日期和日志格式。正如前面所述,你可以按空格键进行选择,并按F10确认。至于日期和日志格式,你可能需要参考[Apache 文档][6]来刷新你的记忆。 + +在这个例子中,选择常见日志格式(Common Log Format(CLF)): + +![](https://farm8.staticflickr.com/7422/15868350373_30c16d7c30.jpg) + +然后按F10 确认。你将会从屏幕上看到统计数据。为了简洁起见,这里只显示了首部,也就是日志文件的摘要,如下图所示: + +![](https://farm9.staticflickr.com/8683/16486742901_7a35b5df69_b.jpg) + +### 通过 GoAccess来浏览网站服务器统计数据 ### + +你可以按向下的箭头滚动页面,你会发现以下区域,它们是按请求排序的。这里提及的目录顺序可能会根据你的发行版或者你所选的安装方式(从源和库)不同而不同: + +1. 每天唯一访客(来自同样IP、同一日期和同一浏览器的请求被认为是是唯一访问) + + ![](https://farm8.staticflickr.com/7308/16488483965_a439dbc5e2_b.jpg) + +2. 请求的文件(网页URL) + + ![](https://farm9.staticflickr.com/8651/16488483975_66d05dce51_b.jpg) + +3. 请求的静态文件(例如,.png文件,.js文件等等) + +4. 来源的URLs(每一个URL请求的出处) + +5. HTTP 404 未找到的响应代码 + + ![](https://farm9.staticflickr.com/8669/16486742951_436539b0da_b.jpg) + +6. 操作系统 + +7. 浏览器 + +8. 主机地址(客户端IP地址) + + ![](https://farm8.staticflickr.com/7392/16488483995_56e706d77c_z.jpg) + +9. HTTP 状态代码 + + ![](https://farm8.staticflickr.com/7282/16462493896_77b856f670_b.jpg) + +10. 前几位的来源站点 + +11. 来自谷歌搜索引擎的前几位的关键字 + +如果你想要检查已经存档的日志,你可以通过管道将它们发送给GoAccess,如下: + +在Debian及其衍生版本: + + # zcat -f /var/log/apache2/access.log* | goaccess + +在基于红帽的发行版: + + # cat /var/log/httpd/access* | goaccess + +如果你需要上述部分的详细报告(1至11项),直接按下其序号再按O(大写o),就可以显示出你需要的详细视图。下面的图像显示5-O的输出(先按5,再按O) + +![](https://farm8.staticflickr.com/7382/16302213429_48d9233f40_b.jpg) + +如果要显示GeoIP位置信息,打开主机部分的详细视图,如前面所述,你将会看到正在请求你的服务器的客户端IP地址所在的位置。 + +![](https://farm8.staticflickr.com/7393/16488484075_d778aa91a2_z.jpg) + +如果你的系统还不是很忙碌,以上提及的章节将不会显示大量的信息,但是这种情形可以通过在你网站服务器越来越多的请求发生改变。 + +### 保存用于离线分析的报告 ### + +有时候你不想每次都实时去检查你的系统状态,可以保存一份在线的分析文件或打印出来。要生成一个HTML报告,只需要通过之前提到GoAccess命令,将输出来重定向到一个HTML文件即可。然后,用web浏览器来将这份报告打开即可。 + + # zcat -f /var/log/apache2/access.log* | goaccess > /var/www/webserverstats.html + +一旦报告生成,你将需要点击展开的链接来显示每个类别详细的视图信息: + +![](https://farm9.staticflickr.com/8658/16486743041_bd8a80794d_o.png) + +可以查看youtube视频:https://youtu.be/UVbLuaOpYdg 。 + +正如我们通过这篇文章讨论,GoAccess是一个非常有价值的工具,它能给系统管理员实时提供可视的HTTP 统计分析。虽然GoAccess的默认输出是标准输出,但是你也可以将他们保存到JSON,HTML或者CSV文件。这种转换可以让 GoAccess在监控和显示网站服务器的统计数据时更有用。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/interactive-apache-web-server-log-analyzer-linux.html + +作者:[Gabriel Cánepa][a] +译者:[disylee](https://github.com/disylee) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/gabriel +[1]:http://goaccess.io/ +[2]:http://w3techs.com/technologies/details/os-linux/all/all +[3]:http://linux.cn/article-2324-1.html +[4]:http://goaccess.io/download#dependencies +[5]:http://goaccess.io/download +[6]:http://httpd.apache.org/docs/2.4/logs.html diff --git a/published/201504/20150215 How to share files between computers over network with btsync.md b/published/201504/20150215 How to share files between computers over network with btsync.md new file mode 100644 index 0000000000..ac280d2ffd --- /dev/null +++ b/published/201504/20150215 How to share files between computers over network with btsync.md @@ -0,0 +1,134 @@ +如何使用btsync通过网络实现计算机间的文件共享 +================================================================================ +如果你是那种使用各式设备在网上工作的人,我相信你肯定需要一个在不同设备间同步文件及目录的方法,至少是非常渴望有这种功能。 + +BitTorrent Sync简称btsync,是一个基于BitTorrent(著名P2P文件分享协议)的免费跨平台同步工具。与传统BitTorrent客户端不同的是,btsync可以在不同操作系统及设备之间加密数据传输和基于自动生成的密钥来授予访问共享文件的权限。 + +更具体点,当你想要通过btsync共享一些文件或文件夹,相应的读/写密钥(所谓的密码)就创建好了。这些密钥可以通过HTTPS链接,电子邮件,二维码等在不同的设备间共享传递。一旦两台设备通过一个密钥配对成功,其所对应的内容将会直接在其间同步。如果没有事先设置,传输将不会有文件大小和速度的限制。你可以在btsync中创建账号,这样你可以通过 web 界面来创建和管理通过网络分享的密钥和文件。 + +BitTorrent Sync可以在许多的操作系统上运行,包括Linux,MacOS X,Windows,在 [Android][1]和[iOS][2]上也可以使用。在这里,我们将教你在Linux环境(一台家用服务器)与Windows环境(一台笔记本电脑)之间如何使用BitTorrent Sync来同步文件。 + +### Linux下安装btsync ### + +BitTorrent Sync可以在[项目主页][3]直接下载。由于Windows版本的BitTorrent Syn安装起来十分简单,所以我们假设笔记本上已经安装了。我们把焦点放到Linux服务器上的安装和配置。 + +在下载页面中选择你的系统架构,右键相应链接,复制连接地址(或者类似的功能,不同浏览器可能不同),将链接粘贴到在终端中用wget下载,如下: + +**64位Linux:** + + # wget http://download.getsyncapp.com/endpoint/btsync/os/linux-x64/track/stable + +**32位Linux:** + + # wget http://download.getsyncapp.com/endpoint/btsync/os/linux-i386/track/stable + +![](https://farm9.staticflickr.com/8635/15895277773_8acf317e3c_c.jpg) + +下载完成后,把包中内容解压到你专门创建的目录中,为了完成这些: + + # cd /usr/local/bin + # mkdir btsync + # tar xzf stable -C btsync + +![](https://farm8.staticflickr.com/7306/16329173869_7dc8b64a39_b.jpg) + +现在你可以选择将/usr/local/bin/btsync添加到环境变量PATH中去。 + + export PATH=$PATH:/usr/local/bin/btsync + +或者在该文件夹中运行btsync的二进制文件。我们推荐使用第一种方式,虽需要少量的输入但更容易记忆。 + +### 配置btsync ### + +btsync带有一个内置的网络服务器,用作其管理接口。想要使用这个接口你需要创建一个配置文件。你可以使用以下命令来创建: + + # btsync --dump-sample-config > btsync.config + +然后使用你最常用的编辑器对btsync.config文件的(webui部分)作以下修改 + + "listen" : "0.0.0.0:8888", + "login" : "yourusername", + "password" : "yourpassword" + +你可以选择任何用户名和密码。 + +![](https://farm9.staticflickr.com/8599/15895277793_da63841433_b.jpg) + +如果你将来想要优化一下它的配置,可以看一下 /usr/local/bin/btsync 目录下的 README 文件,不过现在我们先继续下面的步骤。 + +### 第一次运行btsync ### + +作为一个系统的最高执行者我们需要依赖日志文件!所以在我们启动btsync之前,我们将先为btsync创建一个日志文件。 + + # touch /var/log/btsync.log + +最后,让我们启动btsync: + + # btsync --config /usr/local/bin/btsync/btsync.config --log /var/log/btsync.log + +![](https://farm8.staticflickr.com/7288/16327720298_ccf2cbedea_c.jpg) + +现在在你的浏览器中输入正在运行的btsync所监听的服务器IP地址和端口(我这是192.168.0.15:8888),同意其隐私政策,条款和最终用户许可协议: + +![](https://farm9.staticflickr.com/8597/16327720318_d52551fc44_b.jpg) + +这样页面就会转到你安装的btsync主页: + +![](https://farm8.staticflickr.com/7412/16329544687_9a174527d8_c.jpg) + +点击添加文件夹并在你的文件系统中选择一个你想要分享的目录,在我们的例子中,我们使用的是/btsync: + +![](https://farm8.staticflickr.com/7407/16515452485_e25ded559f_b.jpg) + +现在这样就够了。在运行接下来的步骤之前,请先在Windows主机(或你想使用的其他Linux设备)上安装BitTorrent Sync。 + +### btsync分享文件 ### + +这个[视频][5](需要翻墙)展示了如何在安装Windows8的电脑[192.168.0.106]上分享现有的文件夹。在添加好想要同步的文件夹后,你会得到它的密钥,通过“Enter a key or link”菜单(上面的图已经展示过了)添加到你安装到的Linux机器上,并开始同步。 + +现在用别的设备试试吧;找一个想要分享的文件夹或是一些文件,并通过Linux服务器的网络接口将密钥导入到你安装的“中央”btsync中。 + +### 以常规用户开机自动运行btsync ### + +你们可能注意到了,视频中在同步文件时是使用'root'组的用户创建/btsync目录的。那是因为我们使用超级用户手动启动BitTorrent Sync的原因。在通常情况下,你会希望它开机自动使用无权限用户(www_data或是专门为此创建的账户,例如btsync)启动。 + +所以,我们创建了一个叫做btsync的用户,并在/etc/rc.local文件(exit 0 这一行前)添加如下字段: + + sudo -u btsync /usr/local/bin/btsync/btsync --config /usr/local/bin/btsync/btsync.config --log /var/log/btsync.log + +最后,创建pid文件: + + # touch /usr/local/bin/btsync/.sync/sync.pid + +并递归更改 /usr/local/bin/btsync的所属用户: + + # chown -R btsync:root /usr/local/bin/btsync + +现在重启试试,看看btsync是否正在由预期中的用户运行: + +![](https://farm9.staticflickr.com/8647/16327988660_644f6d4505_c.jpg) + +基于你选择的发行版不同,你可能找到不同的方式来开机自启动btsync。在本教程中,我选择rc.local的方式是因为它在不同发行版中都可使用。 + +### 尾注 ### + +如你所见,BitTorrent Sync对你而言几乎就像一个无服务器的Dropbox。我说“几乎”的原因是:当你在局域网内同步数据时,同步在两个设备之间直接进行。然而如果你想要跨网段同步数据,并且你的设备可能要穿过防火墙的限制来配对,那就只能通过一个提供BitTorrent的第三方中继服务器来完成同步传输。虽然声称传输经过 [AES加密][4],你还是可能会遇到不想发生的状况。为了你的隐私着想,务必在你共享的每个文件夹中关掉中继/跟踪选项。 + +希望这些对你有用!分享愉快! + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/share-files-between-computers-over-network.html + +作者:[Gabriel Cánepa][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/gabriel +[1]:https://play.google.com/store/apps/details?id=com.bittorrent.sync +[2]:https://itunes.apple.com/us/app/bittorrent-sync/id665156116 +[3]:http://www.getsync.com/ +[4]:http://www.getsync.com/tech-specs +[5]:https://youtu.be/f7kLM0lAqF4 diff --git a/published/201504/20150225 Linux FAQs with Answers--How to fix 'fatal error--lame or lame.h--No such file or directory' on Linux.md b/published/201504/20150225 Linux FAQs with Answers--How to fix 'fatal error--lame or lame.h--No such file or directory' on Linux.md new file mode 100644 index 0000000000..2d37fb0a33 --- /dev/null +++ b/published/201504/20150225 Linux FAQs with Answers--How to fix 'fatal error--lame or lame.h--No such file or directory' on Linux.md @@ -0,0 +1,97 @@ +Linux 有问必答:如何在Linux中修复“fatal error: lame/lame.h: No such file or directory” +================================================================================ +> **提问**: 我尝试着在Linux中编译视频编码器,但是编译提示出错:“fatal error: lame/lame.h: No such file or directory”, 我该如何修复这个错误? + +下面的编译错误说明你的系统没有安装LAME库和它的开发文件。 + + fatal error: lame/lame.h: No such file or directory + +[LAME][1]("LAME Ain't an MP3 Encoder")是一个流行的LPGL授权的MP3编码器。许多视频编码工具使用或者支持LAME,如 [FFmpeg][2]、 VLC、 [Audacity][3]、 K3b、 RipperX等。 + +要修复这个编译错误,你需要安装LAME库和开发文件,按照下面的来。 + +### 在Debian、Ubuntu或者Linux Mint上安装LAME库和安装文件 ### + +Debian和它的衍生版在基础库中已经提供了LAME库,因此可以用apt-get直接安装。 + + $ sudo apt-get install libmp3lame-dev + +### 在Fedora、CentOS/RHEL上安装LAME库和安装文件 ### + +在基于RED HAT的版本中,LAME在RPM Fusion的免费仓库中就有,那么你需要先设置[RPM Fusion (免费)仓库][4]。 + +RPM Fusion设置完成后,如下安装LAME开发包。 + + $ sudo yum --enablerepo=rpmfusion-free-updates install lame-devel + +在2015年1月,RPM Fusion仓库已经不可以在CentOS/RHEL 7中可用了。因此,这个方法不能用在CentOS/RHEL 7 中。这时你就要从源码安装LAME库了(下面会描述)。 + +### 在Debian、Ubuntu或者Linux Mint中从源码编译LAME库 ### + +如果你希望用不同的编译选项安装自定义的LAME库,你需要自己编译。下面是怎样在基于Debian的系统中编译和安装LAME库(和它的头文件)。 + + $ sudo apt-get install gcc git + $ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz + $ tar -xzf lame-3.99.5.tar.gz + $ cd lame-3.99.5 + $ ./configure --enable-static --enable-shared + $ make + $ sudo make install + +注意当你运行上面的配置步骤时,你可以根据你的需求启用会禁止不同的选项。运行下面的命令查看不同的编译选项。 + + $ ./configure --help + +共享/静态的LAME库默认安装在 /usr/local/lib。要让共享库可以被其他程序使用,完成最后一步: + +用编辑器打开 /etc/ld.so.conf,加入下面这行。 + + /usr/local/lib + +接着运行下面的命令,这会将/usr/local/lib中的共享库添加到动态加载缓存中,因此LAME库就可以被其他程序调用了。 + + $ sudo ldconfig + +### 在Fedora或者CentOS/RHEL中从源码编译LAME库 ### + +如果你的发行版(比如 CentOS 7)没有提供预编译的LAME库,或者你想要自定义LAME库,你需要从源码自己编译。下面是在基于Red Hat的系统中编译安装LAME库的方法。 + + $ sudo yum install gcc git + $ wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz + $ tar -xzf lame-3.99.5.tar.gz + $ cd lame-3.99.5 + $ ./configure --enable-static --enable-shared + $ make + $ sudo make install + +运行make之前,你可以在configure中带上合适的选项自定义编译选项。你可以用下面的命令检查可用的选项: + + $ ./configure --help + +最后你需要完成最后一步,因为安装在/usr/local/lib的LAME共享库可能在其他程序中不可用。 + +在/etc/ld.so.conf中添加下面这行: + + /usr/local/lib + +接着运行下面的命令。这会添加 /usr/local/lib中的共享库(包括LAME)到动态加载缓存中,让其他程序可以访问到。 + + $ sudo ldconfig + +![](https://farm8.staticflickr.com/7340/16534478445_abc97cb65a_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/fatal-error-lame-no-such-file-or-directory.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://lame.sourceforge.net/ +[2]:http://ask.xmodulo.com/compile-ffmpeg-ubuntu-debian.html +[3]:http://xmodulo.com/how-to-cut-split-or-edit-mp3-file-on-linux.html +[4]:http://xmodulo.com/how-to-install-rpm-fusion-on-fedora.html diff --git a/published/201504/20150225 Linux FAQs with Answers--How to install a USB webcam in Raspberry Pi.md b/published/201504/20150225 Linux FAQs with Answers--How to install a USB webcam in Raspberry Pi.md new file mode 100644 index 0000000000..80974a1761 --- /dev/null +++ b/published/201504/20150225 Linux FAQs with Answers--How to install a USB webcam in Raspberry Pi.md @@ -0,0 +1,63 @@ +Linux有问必答:如何在树莓派上安装USB网络摄像头 +================================================================================ +> **Question**: 我可以在树莓派上使用标准的USB网络摄像头么?我该如何检查USB网络摄像头与树莓派是否兼容?另外我该如何在树莓派上安装它? + +如果你想在树莓上拍照或者录影,你可以安装[树莓派的摄像头板][1]。如果你不想要为摄像头模块花费额外的金钱,那有另外一个方法,就是你常见的[USB 摄像头][2]。你可能已经在PC上安装过了。 + +本教程中,我会展示如何在树莓派上设置摄像头。我们假设你使用的系统是Raspbian。 + +在此之前,你最好检查一下你的摄像头是否在[这些][3]已知与树莓派兼容的摄像头之中。如果你的摄像头不在这个兼容列表中,不要丧气,仍然有可能树莓派能检测到你的摄像头。 + +### 检查USB摄像头是否雨树莓派兼容 ### + +要检查你的摄像头是否可以被树莓派检测到,将它插入到树莓派的USB口中,然后输入下面的命令。 + + $ lsusb + +如果输出中没有你的摄像头,那么有可能你的树莓派的电源无法供应足够的电力给你的摄像头。这时你可以给你的摄像头用独立的电源线,比如[有源USB hub][4],并重新输入lsusb命令。如果摄像头还是不能被识别,我们只有建议你购买其他树莓派支持的摄像头了。 + +![](https://farm8.staticflickr.com/7408/16576646025_898f17f36e_o.png) + +在上面的截屏中,USB摄像头被识别为“1e4e:0102”,但是没有显示摄像头的制造商。当你在笔记本的Fedora 20中使用它时,它可以成功的检测到“1e4e:0102 Cubeternet GL-UPC822 UVC WebCam”。 + +另外一个可以检查摄像头是否被树莓派支持的方法是检查/dev目录。如果有/dev/video0,那么这暗示树莓派支持你的摄像头。 + +### 用USB Webcam拍照片 ### + +当USB摄像头成功挂载到树莓派上之后,下一步就是拍一些照片来验证它的功能了。 + +要想拍摄照片,你要安装fswebcam,这是一款小型摄像头程序。你可以直接通过Raspbian的仓库来安装fswebcam。 + + $ sudo apt-get install fswebcam + +fswebcam安装完成后,在终端中运行下面的命令来抓去一张来自摄像头的照片: + + $ fswebcam --no-banner -r 640x480 image.jpg + +这条命令可以抓取一张640x480分辨率的照片,并且用jpg格式保存。它不会在照片的底部留下任何水印. + +![](https://farm8.staticflickr.com/7417/16576645965_302046d230_o.png) + +这就是fswebcam下640x480分辨率的结果。 + +![](https://farm8.staticflickr.com/7345/16575497512_8d77f1b34c_o.jpg) + +下面的例子是没有定义分辨率的照片。图片是偏蓝的,并且默认的分辨率是358x288。 + +![](https://farm8.staticflickr.com/7390/15954067124_760fbcdd9c_o.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-usb-webcam-raspberry-pi.html + +作者:[Kristophorus Hadiono][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/kristophorus +[1]:http://xmodulo.com/install-raspberry-pi-camera-board.html +[2]:http://xmodulo.com/go/usb_webcam +[3]:http://elinux.org/RPi_USB_Webcams +[4]:http://xmodulo.com/go/usb_powerhub diff --git a/published/201504/20150225 Torvalds--'People who start writing kernel code get hired really quickly'.md b/published/201504/20150225 Torvalds--'People who start writing kernel code get hired really quickly'.md new file mode 100644 index 0000000000..286b5eee16 --- /dev/null +++ b/published/201504/20150225 Torvalds--'People who start writing kernel code get hired really quickly'.md @@ -0,0 +1,32 @@ +Torvalds: 写linux内核的人更加容易找工作 +======================================== + +相比起以往,linux内核开发这么专业的事情,在最近发布的《谁在编写 Linux》报告中,其无偿贡献者降到了历史最低水平。 + +这个报道由linux基金会撰写,上年有11.8%的内核开发是由无偿贡献者完成,相比2012年的14.6%下滑了19%。基金会说贡献者有逐年下降的趋势。 + +![](http://images.techhive.com/images/article/2015/02/screen-shot-2015-02-17-at-5.25.43-pm-100568680-medium.idge.png) + +即使是这样,在最新的《谁在编写 Linux》报告里,无偿贡献者还是最大的单一贡献来源,共做了11968 处修改,占整体的12.4%。然而,linux基金会说,企业贡献者共同占比越来越多,超过80%的内核贡献是由有偿的专业开发者完成的。 + +根据 linus Torvalds 说,这个有偿开发者趋势不会对内核开发的本身有太多改变。 + +他向《Network World》说,“我认为不会改变太多的一个原因是,其实并不是‘无偿贡献者离开了’,而是‘编写内核的人很快就被雇走了’。” + +Torvalds讲到,linux开发的改变有很多其他原因,很自然的,新的贡献者会经常冒出来;有很多原来的开发者,有的有着10年的经验,被很多对linux感兴趣的公司抢去了。 + +他说:“开始我们是自愿者,但我们后来也很高兴被请去开发linux。” + +Torvalds 开始抽离了他的开发角色,根据报道在3.10的内核版本里面他个人发布了329个补丁,占04%。逐渐地,各个子系统的维护人员自己开始做代码检查与合并。 + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2885339/application-development/torvalds-people-who-start-writing-kernel-code-get-hired-really-quickly.html + +作者:[Jon Gold][a] +译者:[haimingfg](https://github.com/haimingfg) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Jon-Gold/ diff --git a/published/201504/20150227 Chess in a Few Bytes.md b/published/201504/20150227 Chess in a Few Bytes.md new file mode 100644 index 0000000000..941f6de274 --- /dev/null +++ b/published/201504/20150227 Chess in a Few Bytes.md @@ -0,0 +1,116 @@ +只有几百个字节大小的国际象棋程序 +================================================================================ + +当我在这里提到了 ZX81 电脑时,我已经暴露了我的年龄。ZX81 是一个由英国开发者(Sincilair 研究所)生产的家庭电脑,它拥有"高达" 1KB 的内存!上面的 1KB 并不是打印错误,这个家庭电脑确实只配置有 1KB 的板载内存。但这个内存大小上的限制并没有阻止爱好者制作种类繁多的软件。事实上,这个机器引发了一代编程奇才的出现,这让他们掌握了让程序在该机上运行起来的技能。这个机器可以通过一个 16 KB 的内存卡来进行升级,这就提供了更多的编程可能。但未经扩展的 1KB 机器仍然激励着编程者们发布卓越的软件。 + +![1K ZX Chess ](http://www.linuxlinks.com/portal/content2/reviews/Games2/1KZXChess.jpg) + +我最喜爱的 ZX81 游戏有: 模拟飞行(Flight Simulation), 3D 版怪物迷宫(3D Monster Maze), 小蜜蜂(Galaxians), 以及最重要的 1K ZX Chess。 只有最后一个程序是为未扩展版的 ZX81 电脑设计的。事实上,David Horne 开发的 1K ZX Chess 只使用了仅仅 672 字节的 RAM(LCTT 译注:如果读者有兴趣,可以看看[这里](http://users.ox.ac.uk/~uzdm0006/scans/1kchess/)对该程序的代码及解释)。尽管如此,该游戏尽力去实现大多数的国际象棋规则,并提供了一个计算机虚拟对手。虽然一些重要的规则被忽略了(如:王车易位,兵的升变,和吃过路兵) +(LCTT 译注:参考了[这里](http://zh.wikibooks.org/zh/%E5%9B%BD%E9%99%85%E8%B1%A1%E6%A3%8B/%E8%A7%84%E5%88%99)和[这里](http://en.wikipedia.org/wiki/Rules_of_chess)),但能够和人工智能相对抗,这仍然令人惊讶。这个游戏占据了我逝去的青春里的相当一部分。 + +1K ZX Chess 保持了在所有计算机上国际象棋的最小实现的地位长达 33 年之久,直到今年由 BootChess 打破了该记录,紧接着由 Toledo AtomChess 打破。这三个程序都没有实现所有的国际象棋规则,所以为了完整性,我介绍了我最喜爱的那些实现了所有国际象棋规则的极小的国际象棋。 + +Linux 有着一系列极其强大的国际象棋引擎,如 Stockfish, Critter, Togo II, Crafty, GNU Chess 和 Komodo 。 在这篇文章精选的国际象棋程序虽敌不过这些好的国际象棋程序,但它们展示了使用微不足道的代码库究竟可以实现多少东西。 + +---------- + +### Toledo Atomchess + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Toledo.png) + +你可能已经看到了大量有关 BootChess 新闻报道,这个只用 487 字节写就的国际象棋程序,一举打破了先前最小的国际象棋程序 1K ZX Chess 的记录。所以,Óscar Toledo Gutiérrez 挽起袖子自己编写了一个更加紧凑的国际象棋游戏。Toledo Atomchess 是仅有 481 字节的 x86 汇编代码,都能放到引导扇区里。 在难以置信的代码大小下,这个引擎实现了一个可玩的国际象棋游戏。 + +特点包括: + +- 基本的棋子移动 +- 用 ASCII 文本表现的棋盘 +- 以代数形式来输入移动(注:如 D2D4) +- 3 层的搜索深度 + +显然,为了将这个国际象棋程序压缩到 481 字节中,作者必须做出某些牺牲,这些局限包括: + +- 没有兵的升变 +- 没有王车易位 +- 没有吃过路兵 +- 没有移动确认 + +该作者也使用 C,JavaScript 和 Java 来写这个国际象棋程序,每种实现都非常小。 + +- 网站: [nanochess.org/chess6.html][1] +- 开发者: Óscar Toledo Gutiérrez +- 协议: 非商业用途可免费使用 +- 版本号: - + +---------- + +### BootChess + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-BootChess.png) + +BootChess 是一个国际象棋的极其小巧的计算机实现。这个程序被塞进到仅仅 487 字节里,并可运行在 Windows, Mac OS X 和 Linux 等操作系统。BootChess 的棋盘和棋子单独用文本表示,其中 P 代表兵, Q 用来代表王后,以及“点”代表空白格子。 + +特点包括: + +- 象棋棋盘和用户输入的形象的文本表示 +- 引导扇区大小(512 字节)的可玩的象棋游戏 +- 只需 x86 bios 硬件引导程序(没有软件依赖) +- 所有主要的正规移动包括双兵开局 +- 兵升变为王后(与 1k ZX Chess 相反) +- 名为 taxiMax > minMax half-ply 的 CPU 人工智能 +- 硬编码的西班牙白子开局 + +同样,它也存在一些重要的限制。这些遗漏的功能包括: + +- 兵的低升变(升变为非王后的棋子) +- 吃过路兵 +- 没有王车易位 +- 3 次位置重复和局规则(注:下一步之前,同样的移动出现了两次;可以参考[这里](http://www.netplaces.com/chess-basics/ending-the-game/three-position-repetition.htm)) +- 50 步移动和局规则(注:在连续的50个回合内,双方既没有棋子被吃掉,也没有兵被移动过,则和局;可以参考[这里](http://www.chessvariants.org/d.chess/chess.html)) +- 没有开放式和封闭式布局 +- 一个或多个 minMAX/negaMax 全层人工智能 + +- 网站: [www.pouet.net/prod.php?which=64962][2] +- 开发者: Olivier "Baudsurfer/RSi" Poudade +- 协议: WTFPL v2 +- 版本号: .02 + +---------- + +###Micro-Max + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Micro-Max.png) + +Micro-Max 是一个用 133 行 C 语言写就的象棋源程序。 + +作者实现了一个 hash 变换表,该引擎检查输入移动的合法性,以及支持 FIDE(注: World Chess Federation 缩写,参见其[官网](https://www.fide.com/)) 的全部规则,除了低升变。 + +特点包括: + +- 递归的 negamax 搜索 +- 反夺的静态搜索 +- 反夺规则的扩展 +- 迭代深化 +- 最佳移动优先的 `排序` +- 存储分数和最佳移动的 Hash 表 +- 完整的 FIDE 规则(除了低位升变)和移动合法性检查 + +还有一个 1433个字符的较大版本,但允许你使用完整的 FIDE 规则的低升变。 + +- 网站: [home.hccnet.nl/h.g.muller/max-src2.html][3] +- 开发者: Harm Geert Muller +- 协议: The MIT License +- 版本号: 3.2 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20150222033906262/ChessBytes.html + +作者:Frazer Kline +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://nanochess.org/chess6.html +[2]:http://www.pouet.net/prod.php?which=64962 +[3]:http://home.hccnet.nl/h.g.muller/max-src2.html \ No newline at end of file diff --git a/published/201504/20150302 How to Setup Passwordless SSH Logon to Ubuntu 14.04.md b/published/201504/20150302 How to Setup Passwordless SSH Logon to Ubuntu 14.04.md new file mode 100644 index 0000000000..8d2a56f574 --- /dev/null +++ b/published/201504/20150302 How to Setup Passwordless SSH Logon to Ubuntu 14.04.md @@ -0,0 +1,85 @@ + 如何设置Ubuntu14.04 的 SSH 无密码登录 +================================================================================ +大家好,今天我来向大家介绍如何在 Ubuntu12.04 上设置 SSH 的无密码登录功能。仅在工作站上有正确的(公私)密钥对以供匹配时SSH服务端才会允许你登录,反之访问将不会被允许。 + +正常情况下,我们需要连上SSH的控制台输入用户名及其密码才行。如果两者全部正确,我们就可以访问,反之访问被服务端拒绝。不过相比而言还有一种比用密码更安全的登录方式,我们可以在登录SSH时通过加密密钥进行无密码登录。 + +如果你想启用这个安全的方式,我们只需简单的禁用密码登录并只允许加密密钥登录即可。使用这种方式时,客户端计算机上会产生一对私钥和公钥。接着客户端得把公钥上传到SSH服务端的authorized_key文件中去。在授予访问前,服务器及客户端电脑会校验这个密钥对。如果服务器上的公钥与客服端提交的私钥匹配则授予访问权限,否则访问被拒绝。 + +这是认证到SSH服务器的非常安全的一种做法,如果你想为单一的SSH用户登录实现安全登录,这也是备受推崇的方式。这里快速的过一遍如何启用无密码登录SSH的配置过程。 + +### 1.安装Openssh服务端 ### + +首先,我们需要更新我们的本地库索引。所以如下所见,我们需要先输入“apt-get update” + + $ sudo apt-get update + +![Updating Repo Index](http://blog.linoxide.com/wp-content/uploads/2015/02/updating-repo-list.png) + +现在我们可以通过以下命令安装openssh-server: + + $ sudo apt-get install openssh-server + +![Installing openssh server](http://blog.linoxide.com/wp-content/uploads/2015/02/installing-openssh-server.png) + +### 2. 开启openssh服务 ### + +在OpenSSH已经成功安装在Ubuntu14.04操作系统上了之后,我们要启动OpenSSH的服务。以下命令让你启动/开启服务。 + + $ sudo service ssh start + +或 + + $ sudo /etc/init.d/ssh start + +### 3. 配置密钥对 ### + +在我们安装并启动了OpenSSH服务以后。现在终于到了要我们搞定公私钥对的时候了,在终端中运行以下命令: + + $ ssh-keygen -t rsa + +在运行完以上命令了以后,我们需要回答一系列的问题。首先选择保存密钥的路径,按回车将会选择默认路径即家目录的一个隐藏的.ssh文件夹。下一个提示是请输入口令提醒。我个人将此留空(直接回车)。之后密钥对就会创建,大功告成。 + +![Generating Key Pair](http://blog.linoxide.com/wp-content/uploads/2015/02/generating-key-pair.png) + +在密钥对生成以后,我们需要将**客户端上的公钥复制到SSH服务端**或者主机,来创建对客户端的信任关系。运行以下命令复制客户端的公钥到服务端。 + + $ ssh-copy-id user@ip_address + +在公钥上传之后,我们现在可以禁用通过密码登陆SSH的方式了。为此,我们需要通过以下命令用文本编辑器打开**/etc/ssh/ssh_config**。 + + $ sudo nano /etc/ssh/sshd_config + +现在,我们需要按照下图所示去掉几行注释并进行一些赋值。 + +![Configuring sshd Config](http://blog.linoxide.com/wp-content/uploads/2015/02/configuring-sshd_config.png) + +### 4. 重启SSH服务 ### + +最后,在我们配置完SSH服务端后,为了使改动生效我们需要重启SSH服务。在终端或控制台运行以下命令重启。 + + $ sudo service ssh restart + +或 + + $ sudo /etc/init.d/ssh restart + +![Restarting ssh](http://blog.linoxide.com/wp-content/uploads/2015/02/restarting-ssh.png) + +现在,我们可以试试不用密码仅用密钥对的方式登录ssh服务端了。 + +### 总结 ### + +太好了!我们成功的配置了无密码登录SSH。使用加密密钥对进行SSH服务器认证是非常安全的一种做法,如果你想为SSH的单一用户登录实施安全的认证这也是备受推崇的方式。所以,如果你还有什么问题或建议,请在意见框中向我们反馈。很欣慰你能读完,希望你能喜欢加密的SSH安全登录 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/setup-passwordless-ssh-logon-ubuntu-14-04/ + +作者:[Arun Pyasi][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ diff --git a/published/201504/20150304 How To Fix 'Not Enough Free Disk Space On boot' In Ubuntu.md b/published/201504/20150304 How To Fix 'Not Enough Free Disk Space On boot' In Ubuntu.md new file mode 100644 index 0000000000..787a7355c3 --- /dev/null +++ b/published/201504/20150304 How To Fix 'Not Enough Free Disk Space On boot' In Ubuntu.md @@ -0,0 +1,63 @@ +如何在Ubuntu上修复“Not Enough Free Disk Space On /boot” +================================================================================ +### 提问:如何在Ubuntu上修复“Not Enough Free Disk Space On /boot”错误?### + +今天,当我在升级Lubuntu 14.04的时候遇到了下面这个错误,但是很简单。 + +> “Not Enough Free Disk Space On /boot” + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/Software-Updater_002.png) + +这是因为我的 /boot 分区被不再需要的旧内核与包塞满了。 + +### 回答: ### + +我听说Ubuntu Tweak中的**Computer Janitor**功能可以删除不想要的垃圾文件。使用Computer Janitor,你可以将你的系统清理成像新安装的那样。Janitor会删除: + +- 程序缓存(Firefox/Chrome 缓存、软件中心缓存); +- 略缩图缓存; +- apt缓存; +- 旧内核; +- 包的配置; +- 不再需要的包。 + +如果你还没有安装这个工具,参考下面的链接 + +- **[如何安装和使用Ubuntu Tweak][1]** + +要删除不需要的垃圾文件,打开Ubuntu Tweak,点击 **Janitor** 选项。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/Ubuntu-Tweak_006.png) + +选择你想要删除的文件的选框,并点击 **Clean** 按钮。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/Ubuntu-Tweak_007.png) + +Janitor现在就开始清理你的系统了。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/Ubuntu-Tweak_003.png) + +真酷!系统清理完成了。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/Ubuntu-Tweak_008.png) + +我重启启动了软件更新。这个没再遇到问题了。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/02/Software-Updater_009.png) + +就是这样。当然也有其他的方法可以清理系统。但是,这个方法很容易学。我们可以只点击几次鼠标就可以清理系统。 + +干杯! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/how-to-fix-not-enough-free-disk-space-on-boot-in-ubuntu/ + +作者:[SK][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.unixmen.com/author/sk/ +[1]:http://linux.cn/article-3335-1.html diff --git a/published/201504/20150306 Nmap--Not Just for Evil.md b/published/201504/20150306 Nmap--Not Just for Evil.md new file mode 100644 index 0000000000..e84ed9a1a7 --- /dev/null +++ b/published/201504/20150306 Nmap--Not Just for Evil.md @@ -0,0 +1,41 @@ +Nmap--不是只能用于做坏事! +================================================================================ +如果SSH是系统管理员世界的"瑞士军刀"的话,那么Nmap就是一盒炸药。炸药很容易被误用然后将你的双脚崩掉,但是也是一个很有威力的工具,能够胜任一些看似无法完成的任务。 + +大多数人想到Nmap时,他们想到的是扫描服务器,查找开放端口来实施攻击。然而,在过去的这些年中,这样的超能力在当你管理服务器或计算机遇到问题时也是非常的有用。无论是你试图找出在你的网络上有哪些类型的服务器使用了指定的IP地址,或者尝试锁定一个新的NAS设备,以及扫描网络等,都会非常有用。 + +下图显示了我的QNAP NAS的网络扫描结果。我使用该设备的唯一目的是为了NFS和SMB文件共享,但是你可以看到,它包含了一大堆大开大敞的端口。如果没有Nmap,很难发现机器到底在运行着什么玩意儿。 + +![](http://www.linuxjournal.com/files/linuxjournal.com/ufiles/imagecache/large-550px-centered/u1002061/11825nmapf1.jpg) + +*网络扫描* + +另外一个可能你没想到的用途是用它来扫描一个网络。你甚至根本不需要root的访问权限,而且你也可以非常容易地来指定你想要扫描的网络地址块,例如输入: + + nmap 192.168.1.0/24 + +上述命令会扫描我的局域网中全部的254个可用的IP地址,让我可以知道那个是可以Ping的,以及那些端口是开放的。如果你刚刚在网络上添加一个新的硬件,但是不知道它通过DHCP获取的IP地址是什么,那么此时Nmap就是无价之宝。例如,上述命令在我的网络中揭示了这个问题: + + Nmap scan report for TIVO-8480001903CCDDB.brainofshawn.com (192.168.1.220) + Host is up (0.0083s latency). + Not shown: 995 filtered ports + PORT STATE SERVICE + 80/tcp open http + 443/tcp open https + 2190/tcp open tivoconnect + 2191/tcp open tvbus + 9080/tcp closed glrpc + +它不仅显示了新的Tivo 设备,而且还告诉我那些端口是开放的。由于它的可靠性、可用性以及“黑边帽子”的能力,Nmap获得了本月的 <<编辑推荐>>奖。这不是一个新的程序,但是如果你是一个linux用户的话,你应该玩玩它。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxjournal.com/content/nmap%E2%80%94not-just-evil + +作者:[Shawn Powers][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxjournal.com/users/shawn-powers diff --git a/published/201504/20150309 10 Useful 'ls' Command Interview Questions--Part 2.md b/published/201504/20150309 10 Useful 'ls' Command Interview Questions--Part 2.md new file mode 100644 index 0000000000..a166b8d36d --- /dev/null +++ b/published/201504/20150309 10 Useful 'ls' Command Interview Questions--Part 2.md @@ -0,0 +1,179 @@ +10 个‘ls’命 令面试的问题(二) +================================================================================ +这是关于文件列表命令的第二篇文章,继续探讨‘ls’命令的其他方面。该系列的第一篇文章受到了社区的高度关注,如果你错过了该系列的第一部分,可以访问以下地址: + +- [15 个‘ls’命令的面试问题(一)][1] + +这篇文章通过样例来很好地展现‘ls’命令的深入应用,我们加倍小心地来写这篇文章来保持其简洁可理解性,同时又能提供最全面的服务。 + +![10 Interview Questions on ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/ls-Command-Interview-Questions.jpg) + +*10 ‘ls’ 命令面试的问题* + +### 16. 假如你想要以长列表的形式列出目录中的内容,但是不打印文件创建者名称以及文件所属组。看看输出有何不同之处。### + +a. ls 命令在与‘-l’选项一起使用时会将文件以长列表格式输出。 + + # ls -l + +![List Files in- Long List Format](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-inLong-List-Format.gif) + +*以长格式列出文件* + +b. ls 命令在与‘-l’和‘--author’一起使用时,会将文件以长列表格式输出并带有文件创建者的名称信息。 + + # ls -l --author + +![List Files By Author](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-By-Author.gif) + +*列出文件的创建者* + +c. ls 命令在与‘-g’选项 一起将会列出文件名但是不带属主名称。 + + # ls -g + +![List Files Without Printing Owner Name](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-Without-Printing-Author.gif) + +*列出文件但不列出属主* + +d. ls 命令在与'-G'和‘-l’选项一起将会使用长列表格式列出文件名称但是不带文件所属组名称。 + + # ls -Gl + +![List Files Without Printing Group](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-Without-Printing-Group.gif) + +*列出文件但是不列出所属组* + +### 17. 使用易读格式打印出当前目录中的文件以及文件夹的大小,你会如何做?### + +这里我们需要使用'-h'选项(人类可阅读的、易读的)同‘-l’或‘-s’选项与ls命令一起使用来得到想要的输出。 + + # ls -hl + +![List Files in Human Readable Format](http://www.tecmint.com/wp-content/uploads/2015/03/List-Size-of-Files-with-ls.gif) + +*以易读格式的长列表列出文件* + + # ls -hs + +![List File Sizes in Long List Format](http://www.tecmint.com/wp-content/uploads/2015/03/List-File-Sizes-in-Readable-Format.gif) + +*以易读格式的短列表列出文件* + +**注意**: ‘-h’选项使用1024(计算机中的标准)的幂,文件或文件夹的大小分别以K,M和G作为输出单位。 + +### 18. 既然‘-h’选项是使用1024的幂作为标准来输出大小,那么ls命令是否还支持其他的幂值呢?### + +存在一个选项 ‘--si’与选项‘-h’相似,不同之处在于前者以使用1000的幂,后者使用1024的幂。 + + # ls --si + +所以'--si'也可以与‘-l’选项一起使用来按照1000的幂来输出文件夹的大小,并且以长列表格式显示。 + + # ls --si -l + +(LCTT 译注:此处原文参数有误,附图也不对,因此删除之) + +### 19. 假如要你使用逗号‘,’作为分隔符来打印一个目录中的内容,可以吗? 对于长列表形式也可行吗?### + +当然!linux的ls命令当与其选项‘-m’一起使用时可以在打印目录内容时以逗号‘,’分割。由于逗号分割的内容是水平填充的,ls命令不能在垂直列出内容时使用逗号来分割内容。 + + # ls -m + +![Print Contents of Directory by Comma](http://www.tecmint.com/wp-content/uploads/2015/03/Print-Contents-of-Directory-by-Comma.gif) + +*以逗号分隔显示内容* + +当使用长列表格式时,‘-m’选项就没有什么效果了。 + + # ls -ml + +![Listing Content Horizontally](http://www.tecmint.com/wp-content/uploads/2015/03/Listing-Content-Horizentally.gif) + +*长列表不能使用逗号分隔列表* + +### 20. 有办法将目录的内容逆序打印出来吗?### + +可以!上面的情形可以轻松地通过'-r'选项搞定,该选项将输出顺序倒置。这个选项也可以与‘-l’选项一起使用。 + + # ls -r + +![List Content in Reverse Order](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-in-Reverse-Order.gif) + +*逆序列出* + + # ls -rl + +![Long List Content in Reverse Order](http://www.tecmint.com/wp-content/uploads/2015/03/Long-List-Content-in-Reverse-Order.gif) + +*逆序长列表* + +### 21. 如果你被分配一个任务,来递归地打印各个子目录,你会如何应付?注意,只针对子目录而不是文件哦。### + +小意思!使用“-R”选项就可以轻轻松松拿下,它也可以更进一步地与其他选项如‘-l’和‘-m’选项等组合使用。 + + # ls -R + +![Print Sub Directories in Recursively](http://www.tecmint.com/wp-content/uploads/2015/03/Print-Sub-Directories-in-Recursively.gif) + +*递归列出子目录* + +### 22. 如何按照文件大小对其进行排序?### + +linux命令行选项'-S'赋予了ls命令这个超能力。按照文件大小从大到小的顺序排序: + + # ls -S + +![Sort Files with ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Files-in-Linux.gif) +*按文件大小排序* + +按照文件大小从小到大的顺序排序。 + + # ls -Sr + +![Sort Files in Descending Order](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Files-in-Descending-Order.gif) + +*从小到大的排序* + +### 23. 按照一行一个文件列出目录中的内容,并且不带额外信息的方式 ### + +选项‘-1’在此可以解决这个问题,使用‘-1’选项来使用ls命令可以将目录中的内容按照一行一个文件并且不带额外信息的方式进行输出。 + + # ls -1 + +![List Files Without Information](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-Without-Information.gif) + +*不带其他信息,一行一个列出文件* + +### 24. 现在委派给你一个任务,你必须将目录中的内容输出到终端而且需要使用双引号引起来,你会如何做?### + +有一个选项‘-Q’会将ls命令的输出内容用双引号引起来。 + + # ls -Q + +![Print Files with Double Quotes](http://www.tecmint.com/wp-content/uploads/2015/03/Print-Files-with-Double-Quotes.gif) + +*输出的文件名用引号引起来* + +### 25. 想象一下你正在与一个包含有很多文件和文件夹的目录打交道,你需要使目录名显示在文件名之前,你如何做?### + + # ls --group-directories-first + +![Print Directories First](http://www.tecmint.com/wp-content/uploads/2015/03/Print-Directories-First.gif) + +*目录优先显示* + +先点到为止,我们会马上提供该系列文章的下一部分。别换频道,关注我们。 另外别忘了在下面的评论中提出你们宝贵的反馈信息,喜欢就分享,帮助我们得到更好的传播吧! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/ls-interview-questions/ + +作者:[Ravi Saive][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/admin/ +[1]:http://linux.cn/article-5349-1.html diff --git a/published/201504/20150309 15 Interview Questions on Linux 'ls ' Command--Part 1.md b/published/201504/20150309 15 Interview Questions on Linux 'ls ' Command--Part 1.md new file mode 100644 index 0000000000..db7c9a3b88 --- /dev/null +++ b/published/201504/20150309 15 Interview Questions on Linux 'ls ' Command--Part 1.md @@ -0,0 +1,205 @@ +15 个‘ls’命令的面试问题(一) +================================================================================ +Unix或类Unix系统中的“文件列表”命令“ls”是最基础并且使用的最广泛的命令行中工具之一。它是一个POSIX兼容工具,在GNU基本工具集以及BSD各种变体上都可以使用。“ls”命令可以结合大量的选项来达到想要的结果。 + +这篇文章的目的在于通过相关的样例来深入讨论文件列表命令。 + +![15 ls Command Questions](http://www.tecmint.com/wp-content/uploads/2014/09/ls-Command-Questions.png) + +*15个“ls”命令问题。* + +### 1. 如何列出目录中的文件?### + +答:linux文件列表命令“ls”就是干这个的。 + + # ls + +![List Files](http://www.tecmint.com/wp-content/uploads/2014/09/list-files.gif) + +*列出文件* + +同时,我们也可以使用“echo(回显)”命令与一个通配符(*)参数来雷锤目录中的所有文件。 + + # echo * + +![List All Files](http://www.tecmint.com/wp-content/uploads/2014/09/list-all-files.gif) + +*列出所有的文件。* + +### 2. 如何只使用echo命令来只列出所有目录?### + + # echo */ + +![List All Directories](http://www.tecmint.com/wp-content/uploads/2014/09/list-all-directories.gif) + +*列出所有的目录* + +### 3. 怎样列出一个目录中的所有文件, 包括隐藏的以“.”开头的文件?### + +答:我们需要将“-a”选项与“ls”命令一起使用。 + + # ls -a + +![List All Hidden Files](http://www.tecmint.com/wp-content/uploads/2014/09/list-all-hidden-files.gif) + +*列出所有的隐藏文件。* + +### 4. 如何列出目录中除了 “当前目录 .”和“父目录 ..”之外的所有文件,包括隐藏文件?### + +答: 我们需要将“-A”选项与“ls”命令一起使用 + + # ls -A + +![Do Not List Implied](http://www.tecmint.com/wp-content/uploads/2014/09/Do-not-list-Implied.gif) + +*别列出指代当前目录和父目录的文件* + +### 5. 如何使用长格式打印出当前目录内容?### + +答: 我们需要将“-l”选项与“ls”命令一起使用。 + + # ls -l + +![List Files Long](http://www.tecmint.com/wp-content/uploads/2014/09/list-files-long.gif) + +*列出文件的长格式。* + +上面的样例中,其输出结果看起来向下面这样。 + + drwxr-xr-x 5 avi tecmint 4096 Sep 30 11:31 Binary + +上面的drwxr-xr-x 是文件的权限,分别代表了文件所有者,所属组以及“整个世界”。 所有者具有读(r),写(w)以及执行(x)等权限。 该文件所属组具有读(r)和执行(x)但是没有写的权限,整个世界的其他可以访问到该文件的人也具有相同权限。 + +- 开头的‘d’意味着这是一个目录 +- 数字'5'表示符号链接(有5个符号链接) +- 文件 Binary归属于用户 “avi”以及用户组 "tecmint" +- Sep 30 11:31 表示文件最后一次的访问日期与时间。 + +### 6. 假如让你来将目录中的内容以长格式列表打印,并且显示出隐藏的“点文件”,你会如何实现?### + +答: 我们需要同时将"-a"和"-l"选项与“ls”命令一起使用(LCTT 译注:单字符选项可以合并写)。 + + # ls -la + +![Print Content of Directory](http://www.tecmint.com/wp-content/uploads/2014/09/Print-Content-of-Directory.gif) + +*打印目录内容* + +此外,如果我们不想列出“当前目录”和"父目录",可以将“-A”和“-l”选项同“ls”命令一起使用。 + + # ls -lA + +### 7. 如何找到每个文件的创建者?### + +答: 我们需要结合 “--author”和 "-l"选项来打印出每个文件的创建者。 + + # ls --author -l + +![List Author Files](http://www.tecmint.com/wp-content/uploads/2014/09/List-Author-Files.gif) + +*列出文件创建者。* + +### 8. 如何对用转义字符打印出非显示字符?### + +答:我们只需要使用“-b”选项来对非显示字符进行转义打印 + + # ls -b + +![Print Escape Character](http://www.tecmint.com/wp-content/uploads/2014/09/Print-Escape-Character.gif) + +### 9. 用指定特定的单位格式来列出文件和目录的大小,你会如何实现?### + +答: 在此可以同时使用选项“-block-size=scale”和“-l”,但是我们需要用特定的单位如M,K等来替换‘scale’参数。 + + # ls --block-size=M -l + # ls --block-size=K -l + +![List File Scale Format](http://www.tecmint.com/wp-content/uploads/2014/09/List-File-Scale-Format.gif) + +*列出文件大小单位格式。* + +### 10. 列出目录中的文件,但是不显示备份文件,即那些文件名以‘~’结尾的文件### + +答: 选项‘-B’赶来救驾。 + + # ls -B + +![List File Without Backup](http://www.tecmint.com/wp-content/uploads/2014/09/List-File-Without-Backup.gif) + +*列出非备份文件* + +### 11. 将目录中的所有文件按照名称进行排序,并显示其最后修改时间信息?### + +答: 为了实现这个需求,我们需要同时将“-c”和"-l"选项与命令一起使用。 + + # ls -cl + +![Sort Files](http://www.tecmint.com/wp-content/uploads/2014/09/Sort-Files.gif) + +*文件排序* + +### 12. 将目录中的文件按照修改时间进行排序,并显示相关联的信息。### + +答: 我们需要同时使用3个选项:'-l','-t','-c' 来对文件使用修改时间排序,最新的修改时间排在最前。 + + # ls -ltc + +![Sort Files by Modification](http://www.tecmint.com/wp-content/uploads/2014/09/Sort-Files-by-Modification.gif) + +*按照修改时间对文件排序。* + +### 13. 如何控制‘ls’命令的输出颜色的有无?### + +答: 需要使用选项‘--color=parameter’,参数具有三种不同值,“auto(自动)”,“always(一直)”,“never(无色)”。 + + # ls --color=never + # ls --color=auto + # ls --color=always + +![ls Colorful Output](http://www.tecmint.com/wp-content/uploads/2014/09/ls-colorful-output.gif) + +*ls的输出颜色* + +### 14. 假如只需要列出目录本身,而不是目录的内容,你会如何做?### + +答:在此“-d”选项就会显得很顺手。 + + # ls -d + +![List Directory Entries](http://www.tecmint.com/wp-content/uploads/2014/09/List-Directory-Entries.gif) + +*列出目录本身* + +### 15. 为长格式列表命令"ls -l"创建一个别名“ll”,并将其结果输出到一个文件而不是标准输出中。### + +答:在上述的这个场景中,我们需要将别名添加到.bashrc文件中,然后使用重定向操作符将输出写入到文件而不是标准输出中。我们将会使用编辑器nano。 + + # ls -a + # nano .bashrc + # ll >> ll.txt + # nano ll.txt + +![Create Alias for ls command](http://www.tecmint.com/wp-content/uploads/2014/09/Create-ls-Alias.gif) + +*为ls命令创建别名。* + +先到此为止,别忘了在下面的评论中提出你们的宝贵意见,我会再次带着另外的有趣的文章在此闪亮登场。 + +### 参考阅读:### + +- [10 个‘ls’命令的面试问题(二)][1] +- [Linux中15个基础的'ls'命令][2] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/ls-command-interview-questions/ + +作者:[Avishek Kumar][a] +译者:[theo-l](https://github.com/theo-l) +校对:[校对者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/ls-interview-questions/ +[2]:http://linux.cn/article-5109-1.html diff --git a/published/201504/20150310 4 Linux Based Mini PC You Can Buy In 2015.md b/published/201504/20150310 4 Linux Based Mini PC You Can Buy In 2015.md new file mode 100644 index 0000000000..bbb7efa05c --- /dev/null +++ b/published/201504/20150310 4 Linux Based Mini PC You Can Buy In 2015.md @@ -0,0 +1,140 @@ +2015年你可以买的四款基于Linux的迷你PC +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Linux_Based_Mini_PC.jpg) + +在我看来迷你PC将在不久的将来会替代传统桌面电脑。传统桌面的有一个像吹风机那样占据大量空间的风扇。迷你PC,在另一方面说很小巧和紧凑。通常是4″或者5″大小,可以轻易地放在桌子上。 + +不仅如此,这些迷你PC的无风扇设计是一个优点。当然,你可以购买无风扇的常规电脑,但是空间占用仍然是一个问题。对我个人来说,我觉得迷你PC外观上看着很可爱。如果你不是一个游戏玩家也不想买新的桌面PC,我强烈建议你**购买一款基于Linux的迷你PC**。 + +如果你考虑我的建议,那么你或许想知道该买哪款。不要担心,这篇文章我们会介绍**2015年你可以购买的四款基于Linux的迷你PC**。 + +### 基于Linux的迷你PC ### + +需要注意的是,这其中的一些PC可能还不能下单。它们中有些还刚刚公布,在不久的将来才会面向公众出售。 + + +#### 1. System76出品的Meerkat #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/system76-meerkat.jpg) + +[System76][1] 是一家仅出品基于Ubuntu电脑、笔记本、服务器的电脑生产商。[System76在上周公布了一款基于Ubuntu的迷你PC][2]。让我看一下它的规格: + +**规格** + +- Intel第五代处理器,共有两种选择 i3-5010U 和 i5-5250U +- 最高2TB存储 (M.2 SATA SSD) +- 16 GB DDR3 内存 +- i3和i5处理器下相应的Intel HD 5500 和 Intel HD 6000显卡 +- 4″ x 4″ 大小 +- WiFi +- 1 Gb 网卡 +- 2个USB 3.0端口 + +**价格** + +在$500之内(还没确定)。 + +**发售日期** + +美国地区在2015年3月底 + +#### 2.Compulab出品的Mintbox Mini #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/mintbox-mini.jpeg) + +[Compulab][3]将它基于Linux Mint的期间PC设备压缩,从Mintbox变为[Mintbox Mini][4]。这个紧凑的版本大小在4″左右。更多的细节如下: + +**规格** + +- AMD A4-6400T 处理器 +- Radeon R3 显卡 +- 4 GB 内存 +- 64 GB SSD +- 2个USB 3.0端口, 3个USB 2.0端口 +- 2个HDMI输出端 +- 802.11 b/g/n Wifi +- 千兆网卡 +- MicroSD读卡器 + +**价格** + +$300左右起售 + +**发售日期** + +2015年第二季度 + +#### 3. Compulab出品的Utilite2 #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Utilite2-ARM-PC.jpg) + +Compulab并不仅仅被Linux Mint所限制。它在去年12月公布了一款运行Ubuntu的ARM桌面PC。大小是3.4″x2.3″,[Utilite2][5]有最适合的性价比。 + +**规格** + +- 高通Snapdragon 600 (APQ8064) 四核 CPU 1.7GHz +- 2GB 内存, 可选32 GB的eMMC mSATA 存储 +- 高通 Adreno™ GPU显卡 +- 1080p 视频回放和捕捉 +- 双天线 WiFi 802.11 和 Bluetooth 4.0 +- 千兆网卡, 4个USB2端口和USB OTG +- 蜂窝调制解调器支持 + +**价格** + +常规版售价$192、带硬盘售价$229。运费另付。 + +**发售日期** + +现在就可购买。运送将花费4周。 + +#### 4. Think Penguin出品的Penguin Pocket Wee #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Think_Penguin_Pocket_Wee.jpeg) + +[Think Penguin][6]是一家开源硬件生产商。在迷你PC领域,它提供了[Penguin Pocket Wee][7]。大小是4.6″x 4.4″x 1.4″ ,, Penguin Pocket Wee为你提供了大量的配置。你可以选择处理器、存储、网卡等。你可以选择购买预装你喜欢的Linux发行版,默认系统是Ubuntu。 + +下面是默认的配置: + +- Intel Core i3 或者 i5处理器,最高支持1080p视频 +- 最高扩展至 16GB 的 DDR3内存 +- Intel HD 显卡 +- Wireless N +- 最大250GB的SSD +- 4个USB 3.0接口 +- Intel 10/100/1000 千兆网卡 + +**价格** + +基础版本$499起售,根据你选择的配置最高价格是$1000。 + +**发售日期** + +现在就可下订单。该公司在美国和英国也有办公地点,所以应也可以运送到南美和欧洲。 + +### 你会选哪种? ### + +我故意没有介绍[Raspberry Pi 2][8]或者其他Linux微电脑如[Intel的电脑棒][9]。原因是我不认为这些微电脑属于迷你PC的范畴。 + +你怎么看?你想用迷你PC代替你的桌面PC么?是不是还有我没有在**基于Linux的最好的迷你PC**列表里列出的PC?在评论区分享你们的观点吧。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/4-linux-based-mini-pc-buy-2015/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://system76.com/ +[2]:http://itsfoss.com/system76-unveils-ubuntu-based-mini-pc-meerkat/ +[3]:http://www.compulab.co.il/ +[4]:http://itsfoss.com/mintbox-mini-compact-linux-mint-powered-pc-unveiled/ +[5]:http://www.compulab.co.il/utilite-computer/web/utilite2-overview +[6]:https://www.thinkpenguin.com/ +[7]:https://www.thinkpenguin.com/gnu-linux/penguin-pocket-wee-gnu-linux-desktop +[8]:http://itsfoss.com/raspberry-pi-2-specs/ +[9]:http://itsfoss.com/intels-compute-stick/ diff --git a/published/201504/20150310 How To Get Email Alerts for SSH Login on Linux Server.md b/published/201504/20150310 How To Get Email Alerts for SSH Login on Linux Server.md new file mode 100644 index 0000000000..06d06029fc --- /dev/null +++ b/published/201504/20150310 How To Get Email Alerts for SSH Login on Linux Server.md @@ -0,0 +1,59 @@ +如何设置 Linux 上 SSH 登录的 Email 提醒 +================================================================================ +![](http://www.ehowstuff.com/wp-content/uploads/2015/03/fail2ban-security.jpg) + +虚拟私有服务器 (VPS)上启用 SSH 服务使得该服务器暴露到互联网中,为黑客攻击提供了机会,尤其是当 VPS 还允许root 直接访问时。VPS 应该为每次 SSH 登录成功尝试配置一个自动的 email 警告。 VPS 服务器的所有者会得到各种 SSH 服务器访问日志的通知,例如登录者、登录时间以及来源 IP 地址等信息。这是一个对于服务器拥有者来说,保护服务器避免未知登录尝试的重要安全关注点。这是因为如果黑客使用暴力破解方式通过 SSH 来登录到你的 VPS 的话,后果很严重。在本文中,我会解释如何在 CentOS 6、 CentOS 7、 RHEL 6 和 RHEL 7上为所有的 SSH 用户登录设置一个 email 警告。 + +1. 使用root用户登录到你的服务器; + +2. 在全局源定义处配置警告(/etc/bashrc),这样就会对 root 用户以及普通用户都生效: + + [root@vps ~]# vi /etc/bashrc + + 将下面的内容加入到上述文件的尾部。 + + echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com + +3. 你也可以选择性地让警告只对 root 用户生效: + + [root@vps ~]# vi .bashrc + + 将下面的内容添加到/root/.bashrc的尾部: + + echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com + + 整个配置文件样例: + + # .bashrc + + # User specific aliases and functions + + alias rm='rm -i' + alias cp='cp -i' + alias mv='mv -i' + + # Source global definitions + if [ -f /etc/bashrc ]; then + . /etc/bashrc + fi + echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com + +4. 你也可以选择性地让警告只对特定的普通用户生效(例如 skytech): + + [root@vps ~]# vi /home/skytech/.bashrc + + 将下面的内容加入到/home/skytech/.bashrc文件尾部: + + echo 'ALERT - Root Shell Access (vps.ehowstuff.com) on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`" recipient@gmail.com + +-------------------------------------------------------------------------------- + +via: http://www.ehowstuff.com/how-to-get-email-alerts-for-ssh-login-on-linux-server/ + +作者:[skytech][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ehowstuff.com/author/mhstar/ diff --git a/published/201504/20150316 Linux FAQs with Answers--How to convert between local time and UNIX timestamp in Perl.md b/published/201504/20150316 Linux FAQs with Answers--How to convert between local time and UNIX timestamp in Perl.md new file mode 100644 index 0000000000..18ce4c5587 --- /dev/null +++ b/published/201504/20150316 Linux FAQs with Answers--How to convert between local time and UNIX timestamp in Perl.md @@ -0,0 +1,62 @@ +Linux有问必答:Perl中本地时间和UNIX时间戳间相互转换 +================================================================================ +> **问题**: 在Perl语言中,我需要转换易读的日期和时间到对应的UNIX时间戳,反之亦然。你可以给我一些将日期及时间转换到UNIX时间戳的Perl代码例子吗?或者相反,转换UNIX时间戳到可读的日期和时间。 + +当你的Perl脚本需要解决时间信息,这里有两种方法来表示和处理日期和时间。一种方法是易读的时间表示(例,"Sat Mar 14 10:14:05 EDT 2015"),另外一种是使用UNIX时间戳(也叫“新纪元时间”),这是从1970年1月1日到今所经过的时间秒数。每一种方法都有它自己的优劣势,取决于你的需要,也许也就需要转换一种格式到另一种。 + +### Perl中转换本地时间到UNIX时间戳 ### + +为了从日期字符串中获得UNIX时间,可以使用Date::Parse模块中str2time()函数。此函数可以处理多种格式,例如: + +- Sat Mar 14 10:14:05 EDT 2015 +- 3/14/2015 10:14:05 -0400 +- 14/Mar/15 10:14:05 +- 14 Mar 15 10:14:05 + +``` +use Date::Parse; + +my $local_time = "Sat Mar 14 10:14:05 EDT 2015"; + +# 1426342445 will be stored in $unix_time +my $unix_time = str2time($local_time); +``` +Date:Parse 模块支持多种语言(英语,法语,德语和意大利语)和时区。例如: + + use Date::Parse; + use Date::Language; + + my $lang = Date::Language->new('French'); + my $unix_time = $lang->str2time("12:14:05, Ago 16, 2014 (CEST)"); + +### Perl中UNIX时间戳到易读的日期和时间 ### + +如果你想要转换UNIX时间戳到易读的格式,可以使用localtime()函数,此函数可以转换UNIX时间戳为一个9元素列表。然后你可以使用返回的list构造任何你需要的可读格式。这里有一个代码片段: + + # $sec, $min, $hour: 秒,分,时 + # $mday: 月中的某天 (0-31) + # $mon: 月份,范围 0 (一月) 至 11 (十二月) + # $year: 年份,与1900年的差值(2015年为2015-1900=115) + # $wday: 星期,范围 0 (星期天) 至 6 (星期六) + # $yday: 年中的某天,范围 0 至 364 (或 365 闰年) + # $isdst: 是否是夏令时 + + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($unix_timestamp); + + # necessary conversion of $mon and $year + $mon += 1; + $year += 1900; + + print "Current time: $year-$mon-$mday $hour:$min:$sec\n"; + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/convert-local-time-unix-timestamp-perl.html + +作者:[Dan Nanni][a] +译者:[VicYu/Vic020](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201504/20150318 Fedora GNOME Keyboard Shortcuts.md b/published/201504/20150318 Fedora GNOME Keyboard Shortcuts.md new file mode 100644 index 0000000000..75fdf0916e --- /dev/null +++ b/published/201504/20150318 Fedora GNOME Keyboard Shortcuts.md @@ -0,0 +1,220 @@ +Fedora GNOME 的常用快捷键 +================================================================================ +在Fedora中,为了获得最好的[GNOME桌面][1]体验,你需要了解并掌握一些驾驭系统的快捷键。 + +这篇文章将列举我们日常使用中使用频率最高的快捷键。 + +#### 1. Super键 #### + +![GNOME Keyboard Shortcuts - The Super Key. ](http://f.tqn.com/y/linux/1/L/o/K/1/gnomekeyboardshortcut1.png) + +*GNOME 快捷键 - super键* + +[“super”键][2]是如今驾驭操作系统的好朋友。 + +在传统的笔记本电脑中“super”键坐落于最后一列就在“alt”键的旁边(就是徽标键)。 + +当你按下“super”键后“activities”总览图就会出现,你就能看见所有打开应用的缩略图。 + +同时按下 "ALT" 和"F1"一样可以达到这样的效果。 + +### 2. 如何快速执行一条命令 ### + +![GNOME Run Command.](http://f.tqn.com/y/linux/1/L/p/K/1/runcommand.png) + +*GNOME 运行某命令* + +如果你需要快速的执行一条指令,你可以按下"ALT"+"F2",这样就会出现指令运行对话框了。 + +现在你就可以在窗口中输入你想要执行的指令了,回车执行。 + +### 3. 快速切换到另一个打开的应用 ### + +![TAB Through Applications.](http://f.tqn.com/y/linux/1/L/q/K/1/tabthroughwindows.png) + +*使用TAB在应用中切换* + +就像在微软的Windows下一样你可以使用"ALT"和"TAB" 的组合键在应用程序之间切换。 + +在一些键盘上tab键上画的是这样的**|<- ->|**,而有些则是简单的"TAB"字母。 + +GNOME应用切换器随着你的切换,显示简单的图标和应用的名字。 + +如果你按下"shift"+"tab"将以反序切换应用。 + +### 4. 在同一应用中快速切换不同的窗口 ### + +![Switch Windows In The Same Application.](http://f.tqn.com/y/linux/1/L/r/K/1/switchwindowsinsameapplication.png) + +*在应用中切换不同窗口* + +如果你像我一样经常打开五六个Firefox。 + +你已经知道通过"Alt"+"Tab"实现应用间的切换。有两种方法可以在同一个应用中所有打开的窗口中切换。 + +第一种是按"Alt"+"Tab"让选框停留在你所要切换窗口的应用图标上。短暂的停留等到下拉窗口出现你就能用鼠标选择窗口了。 + +第二种也是比较推荐的方式是按"Alt"+"Tab"让选框停留在你所要切换窗口的应用图标上,然后按"super"+"`"在此应用打开的窗口间切换。 + +**注释:"\`"就是tab键上面的那个键。无论你使用的那种键盘排布,用于切换的键一直都是tab上面的那个键,所以也有可能不是"\`"键。** + +如果你的手很灵活(或者是我称之为忍者手的)那你也可以同时按"shift", "\`"和"super"键来反向切换窗口。 + +### 5. 切换键盘焦点 ### + +![Switch Keyboard Focus.](http://f.tqn.com/y/linux/1/L/s/K/1/switchkeyboardfocus.png) + +*切换键盘焦点* + +这个键盘快捷键并不是必须掌握的,但是还是最好掌握。 + +如若你想将输入的焦点放到搜索栏或者一个应用窗口上,你可以同时按下"CTRL", "ALT"和"TAB",这样就会出现一个让你选择切换区域的列表。 + +然后就可以按方向键做出选择了。 + +### 6. 显示所有应用程序列表 ### + +![Show All Applications.](http://f.tqn.com/y/linux/1/L/t/K/1/showapplications.png) + +*显示所有应用程序* + +如果恰巧最后一个应用就是你想要找的,那么这样做真的会帮你省很多时间。 + +按"super"和"A"键来快速切换到这个包含你系统上所有应用的列表上。 + +### 7. 切换工作区 ### + +![Switch Workspaces.](http://f.tqn.com/y/linux/1/L/u/K/1/switchworkspaces.png) + +*切换工作区* + +如果你已经使用linux有一段时间了,那么这种[多工作区切换][3]的工作方式一定深得你心了吧。 + +举个例子,你在第一个工作区里做开发,第二个之中浏览网页,而把你邮件的客户端开在第三个工作区中。 + +工作区切换你可以使用"super"+"Page Up" (向上翻页)键朝一个方向切,也可以按"super"+"Page Down" (向下翻页)键朝另一个方向切。 + +还有一个比较麻烦的备选方案就是按"super"显示打开的应用,然后在屏幕的右侧选择你所要切换的工作区。 + +### 8. 将一些项目移至一个新的工作区 ### + +![Move Application To Another Workspace.](http://f.tqn.com/y/linux/1/L/v/K/1/movetoanewworkspace.png) + +*将应用移至另一个工作区* + +如果这个工作区已经被搞得杂乱无章了,没准你会想将手头的应用转到一个全新的工作区,请按组合键"super", "shift"和"page up"或"super", "shift"和"page down" 键。 + +备选方案按"super"键,然后在应用列表中找到你想要移动的应用拖到屏幕右侧的工作区。 + +### 9. 显示信息托盘 ### + +![Show The Message Tray.](http://f.tqn.com/y/linux/1/L/w/K/1/showmessagetray.png) + +*显示信息托盘* + +消息托盘会提供一个通知列表。按"super"+"M"呼出消息托盘。 + +备选方法是鼠标移动到屏幕右下角。 + +### 10. 锁屏 ### + +![Lock The Screen.](http://f.tqn.com/y/linux/1/L/x/K/1/lockscreen.png) + +*锁屏* + +想要休息一会喝杯咖啡?不想误触键盘? + +无论何时只要离开你的电脑应该习惯性的按下"super"+"L"锁屏。 + +解锁方法是从屏幕的下方向上拽,输入密码即可。 + +### 11. 关机 ### + +![Control Alt Delete Within Fedora.](http://f.tqn.com/y/linux/1/L/y/K/1/poweroff.png) + +*Fedora中Control+Alt+Delete* + +如果你曾是windows的用户,你一定记得著名的三指快捷操作CTRL+ALT+DELETE。 + +如果在键盘上同时按下CTRL+ALT+DELETE,Fedora就会弹出一则消息,提示你的电脑将在60秒后关闭。 + +### 12. 编辑快捷键 ### + +在各类操作系统中编辑快捷键都大同小异。 + +- CTRL + A - 全选 +- CTRL + X - 剪切 +- CTRL + C - 复制 +- CTRL + V - 粘贴 +- CTRL + Z - 撤销 + +### 13. 截屏 ### + +和编辑快捷键一样,截屏键也就那么基础的几个。 + +- PRTSC (Print Screen) - 截屏 + +- Alt + PRTSC - 当前窗口截图 + +- Shift + PRTSC - 所选区域截图 + +这里还有一个比较特殊的按键,主要是为了大家可以更容易的制作视频教程的。 + +- CTRL + ALT + SHIFT + R - 录制视频 +- CTRL + ALT + SHIFT + R 第二次按下时 - 停止录制 + +[录制的内容][4]将以[webm][5]格式保存于当前用户家目录下的录像文件夹中。 + +### 14. 并排显示窗口 ### + +![Put Windows Side By Side.](http://f.tqn.com/y/linux/1/L/z/K/1/splitwindows.png) + +*并排显示窗口* + +你可以将一个窗口靠左占满左半屏,另一个窗口靠右占满右半屏,让两个窗口并排显示。 + +也可以按"Super"+"←"(左箭头)让当前应用占满左半屏。按"Super"+"→"(右箭头)让当前应用占满右半屏。 + +### 15. 窗口的最大化,最小化和恢复 ### + +双击标题栏可以最大化窗口。 + +最大化后的窗口再双击就会还原至原大小。 + +右键菜单选择"最小化"就可以最小化了。 + +### 16. 总结 ### + +![GNOME Keyboard Shortcut Cheat Sheet. ](http://f.tqn.com/y/linux/1/L/-/L/1/gnomekeyboardshortcuts.png) + +*GNOME快捷键速查表* + +我做了一份快捷键速查表,你可以打印出来贴在墙上,这样一定能够更快上手。 + +当你掌握了这些快捷键后,你一定会感慨这个桌面环境使用起来是如此的顺手。 + +- [戳这里查看Fedora GNOME桌面的速查表][6] +- [查看GNOME WIKI请戳这里][7] +- [另外的一个GNOME WIKI][8] +- [GNOME 3备用速查表][9] + +-------------------------------------------------------------------------------- + +via: http://linux.about.com/od/howtos/tp/Fedora-GNOME-Keyboard-Shortcuts.htm + +作者:[Gary Newell][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linux.about.com/bio/Gary-Newell-132058.htm +[1]:https://www.gnome.org/gnome-3/ +[2]:http://en.wikipedia.org/wiki/Super_key_%28keyboard_button%29 +[3]:http://linux.about.com/library/gnome/blgnome2n4.htm +[4]:http://en.wikipedia.org/wiki/Screencast +[5]:http://en.wikipedia.org/wiki/WebM +[6]:https://s-media-cache-ak0.pinimg.com/originals/d5/f4/a4/d5f4a42c0940fae6653ee9a17294d450.jpg +[7]:http://en.wikipedia.org/wiki/GNOME +[8]:https://wiki.gnome.org/ +[9]:https://wiki.gnome.org/Gnome3CheatSheet diff --git a/published/201504/20150318 Install And Use 'Go For It!' To Do App In Linux.md b/published/201504/20150318 Install And Use 'Go For It!' To Do App In Linux.md new file mode 100644 index 0000000000..d76fecea59 --- /dev/null +++ b/published/201504/20150318 Install And Use 'Go For It!' To Do App In Linux.md @@ -0,0 +1,91 @@ +在Linux上安装使用‘Go for it!’备忘软件 +=============================================================================== +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go_For_It_TODO_Linux.jpeg) + +你在 Linux 桌面是如何管理任务和备忘的?我喜欢[用 Ubuntu 的粘帖便签][1]很久了。但是我要面对与其他设备同步的麻烦,特别是我的智能手机。这就是我为什么选择使用 [Google Keep][2] 的原因了。 + +Google Keep 是一款功能丰富的软件,我十分喜爱,而且喜欢到把它叫做 [Linux 的 Evernote ][3]地步。但是并不是每个人都喜欢一款功能丰富的备忘录软件。极简主义是目前的主流,很多人喜欢。如果你是极简主义的追求者之一,而且正在寻找一款开源的备忘录软件,那么你应该试一试 [Go For It!][4]。 + +### Go For It!高效的Linux桌面软件 ### + +Go For It!是一款简洁的备忘软件,借助定时提醒帮助你专注于工作。所以,当你添加一个任务到列表后,可以附上一个定时器。到设定时间后,它就会提醒你去做任务。你可以看看其帅哥开发者 [Manuel Kehl][5] 制作的视频(youtube 视频) : https://www.youtube.com/watch?v=mnw556C9FZQ + +### 安装 Go For It!### + +要在 Ubuntu 15.04,14.04 和其他基于 Ubuntu 的Linux 发行版,如Linux Mint, elementary OS Freya 等上面安装 Go For It!请使用这款软件官方的 PPA: + + sudo add-apt-repository ppa:mank319/go-for-it + sudo apt-get update + sudo apt-get install go-for-it + +你也可以下载 .deb 包,Windows 安装包和源代码,链接如下: + +- [Download source code][6] +- [Download .deb binaries][7] +- [Download for Windows][8] + +### 在Linux桌面使用 Go For It!### + +Go For It!使用真心方便。你只需添加任务到列表中,任务会自动存入 todo.txt 文件中。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go-for-it_todo_app_linux.png) + +每个任务默认定时25分钟。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go-for-it_todo_app_linux_1.png) + +任务一旦完成,就会被自动存档到 done.txt 文件中。根据设置,它会在规定的时间间隔或者任务过期前不久,发送桌面提醒: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go_for_it_Linux_notification.png) + +你可以从配置里面修改所有的偏好。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go-for-it_todo_app_linux_2.png) + +目前一切都看着挺好。但是在智能手机上使用体验怎样呢?如果你不能使它在不同设备间同步,那这款高效软件就是不完整的。好消息是 Go For It!是基于 [todo.txt][9] 的,这意味着你可以用第三方软件和像 Dropbox 一样的云服务来使用它。 + +### 在安卓手机和平板上使用Go For It! ### + +在这里你需要做一些工作。首先的首先,在 Linux 和你的安卓手机上安装 Dropbox,如果之前没有安装的话。下一步你要做的就是要配置 Go For It!和 **修改 todo.txt 的目录到 Dropbox 的路径下**。 + +然后,你得去下载 [Simpletask Andriod app][10]。这是免费的应用。安装它。当你第一次运行 Simletask 的时候,你会被要求关联你的账号到 Dropbox: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go_for_it_Android_1.jpeg) + +一旦你完成了 Simpletask 与 Dropbox 的关联,就可以打开应用了。如果你已经修改了 Go For It 的配置,将文件保存到Dropbox 上,你就应该可以在 Simpletask 里看到。而如果你没有看到,点击应用底部的设置,选择 Open Todo file 的选项: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Go_for_it_Android.jpeg) + +现在,你应该可以看到 Simpletask 同步的任务了。 + +### 总结 ### + +对于 Simpletask,你就可以以类似[标记语言工具][11]的风格使用它。对于小巧和专注而言,Go For It!是一款不错的备忘软件。一个干净的界面是额外的加分点。如果拥有它自己的手机应用就更好了,但是我们也有临时替代方案了。 + +底层来讲,Go For It! 不会运行在后台。这就是说,你不得不让它一直保持运行。它甚至没有一个最小化的按钮,这有一点小小的烦扰。我想要看到的是有一个小的指示程序,运行在后台,并且快速进入主面板,这肯定会提升其可用性。 + +试试 Go For It!吧,分享一下你的使用体验。在 Linux 桌面上,你还使用了哪些其他的备忘软件?比起其他你最喜欢的同类应用,Go For It!怎么样? + +------------------------------------------------------------------------------- + + +via: http://itsfoss.com/go-for-it-to-do-app-in-linux/ + +作者:[Abhishek][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/indicator-stickynotes-windows-like-sticky-note-app-for-ubuntu/ +[2]:http://itsfoss.com/install-google-keep-ubuntu-1310/ +[3]:http://itsfoss.com/5-evernote-alternatives-linux/ +[4]:http://manuel-kehl.de/projects/go-for-it/ +[5]:http://manuel-kehl.de/about-me/ +[6]:https://github.com/mank319/Go-For-It +[7]:https://launchpad.net/~mank319/+archive/ubuntu/go-for-it +[8]:http://manuel-kehl.de/projects/go-for-it/download-windows-version/ +[9]:http://todotxt.com/ +[10]:https://play.google.com/store/apps/details?id=nl.mpcjanssen.todotxtholo&hl=en +[11]:http://itsfoss.com/install-latex-ubuntu-1404/ diff --git a/published/201504/20150318 The future of Linux storage.md b/published/201504/20150318 The future of Linux storage.md new file mode 100644 index 0000000000..f2224a5bb7 --- /dev/null +++ b/published/201504/20150318 The future of Linux storage.md @@ -0,0 +1,86 @@ +Linux存储的未来 +================================================================================ +> **摘要**:Linux系统的软件开发者们正致力于使Linux支持更多种类的文件和存储方案。 + +波士顿 - 在[Linux基金会][1]最近的[Vault][2]展示会上,全都是关于文件系统和存储方案的讨论。你可以会觉得关于这两个主题并没有什么值得讨论的最新进展,但事实并非如此。 + +![](http://zdnet2.cbsistatic.com/hub/i/r/2015/03/12/c8f92cc2-b963-4238-80a0-d785ec93698c/resize/770x578/08d93a8a393d3f50b2a56e6b0e7a0ca9/btrfs-1.jpg) + +对Linux文件系统,比如Btrfs,和存储方案的支持正在持续发展中。 -- Facebook + +自从Linus提出“[讨厌的、生锈的机械磁盘]”的观点以来,存储技术已经走过一段长路,Linux也始终保持跟进。比如说,近几年来,[闪存已经逐渐成为企业服务器的主要存储器][4],[持久化内存][5]也正给我们带来拥有DRAM一般快速的存储。与此同时,大数据、云计算和容器化技术正给Linux引入新的应用场景。 + +为了应对挑战,Linux开发者们一边继续扩展已有的文件系统和存储程序,一边致力于开发新的方案。 + +### Btrfs ### + +例如,Chris Mason,一位来自Facebook的软件工程师,也是[Btrfs][6](念做 Butter FS)的维护者之一,介绍了Facebook是如何使用这种文件系统。Btrfs拥有文件系统固有的许多优点,比如既能处理大量的小文件,也能处理大小可达16EB的单个文件;支持RAID ;内置的文件系统压缩,以及集成了对多种存储设备的支持。 + +当然,Facebook的服务器也运行在Linux上。更准确地讲,是运行在一个基于[CentOS][7]的内部发行版上,它是基于3.10和3.18版的内核。对Facebook来说,真正的收获是Btrfs在Facebook持续更新的用户操作所带来的巨大的IOPS(每秒钟输入输出的操作数)的负载下依旧保持稳定和快速。 + +这就是好消息,但坏消息是对于像MySQL一样的传统DBMS(数据库管理系统)来说Btrfs还是太慢了。对此,Facebook采用了[XFS][8]。为了协同这两种文件系统,Facebook又用到了一种叫做[Gluster][9]的开源分布式文件系统。 + +Facebook,一直与上游的负责Btrfs的Linux内核开发者保持密切联系,致力于提高Btrfs在DBMS上的速度。Mason和他的同事的目标是在[RocksDB][10]数据库上使用Btrfs,RocksDB是一种为提供快速存储开发的持久化键值存储系统,可以作为客户端服务器模式数据库的基础部分。 + +当然Btrfs也还存在一些问题,比如,如果有用户傻到用数据把硬盘几乎要撑爆时,Btrfs会在硬盘被完全装满前阻止用户继续写入。对某些工程来说,比如[CoreOS][12],一款依赖容器化的企业版Linux系统,这种问题是致命的。[因此,CoreOS已经切换到使用xt4和overlayfs了][11]。 + +Btrfs的开发人员正致力于数据去重。在这一点上,当文件系统中拥有超过一个的相同文件时,会自动删除多余文件。正如Mason所说,“并非每个人都需要这个功能,但如果有人需要,那就是真的有用!” + +在正在开展的重要性工作中,Btrfs并非是唯一的文件系统。John Spary,[Red Hat][13]的一位高级软件工程师,提到了另一款名为[Ceph][14]的分布式文件系统。 + +### Ceph FS ### + +Ceph提供了一种分布式对象存储方案和文件系统,反过来它依托于一种使用商用硬件集群的弹性的、可扩展的存储模型(RADOS)。配合RADOS块设备(RBD)和RADOS对象网关(RGW),Ceph提供了一种[POSIX][15]接口的文件系统 -- Ceph FS。尽管RBD和RGW已经在生产环境中使用了一段时间,但使Ceph FS适用于生产的工作还是进行中。 + +[Rad Hat,在收购Ceph的母公司Inktank后][16],在2014年一直致力于使CephFS适用于生产环境。不管怎样,Spray说,“有些人已经在生产中使用了它;我们对此表示担忧,毕竟它还没有准备好。”然而,Spray也补充说,“这具有两面性,因为一方面这是让人担心的,另一方面我们又从用户获得了真正有用的反馈和测试。” + +这是因为尽管Ceph对象存储很好地支持扩展,但Ceph Fs,作为一种兼容POSIX的文件系统,却很难实现扩展。比如,作为一种分布式文件系统,Ceph FS必须解决来自多个客户端的多个写操作。这会导致全有或全无的情况,即一个客户端可以写入,但其它客户端必须等待,也会产生文件加锁的情形,即相比普通文件系统中更加复杂。 + +但是,Ceph FS仍值得去做,正如Spray所说,“因为兼容POSIX的文件系统是操作系统通用的。”这并不是说Ceph FS就一无是处。“它并不是支离破碎的,相反它奏效了。所缺的是修复和监控工具。” + +Red Hat目前正致力于完成[fsck][17]和日志修复工具开发、快照强化、更好客户端访问控制,以及云与容器的集成。尽管Ceph FS到目前为止只是一种有潜力或者没前景的文件系统,但仍然值得用在生产环境中。 + +### 文件与存储的差别与目标 ### + +至于文件系统和存储上的更大问题,Jeff Layton,[Primary Data][18]的一位高级软件工程师,解释说为了“在不断开电源的情况下给灾难性的电源故障提供测试”,大量的相关工作正在进行中。这些测试很快会被集成到[xftests][19]中,它是Linux文件系统测试的黄金标准。 + +Rik van Riel,一位Red Hat的主要软件工程师,谈到了解决持久化内存产品的问题。你可以把它们作为存储器或者内存。但是,如果你现在把它们作为内存来用,是不能为备份创建快照。真正的问题是:van Riel确信人们会尝试使用持久的内存作这两种用途,这会导致出现和“如果不备份,你会如何处理一个200GB大小的持久化内存数据库?”类似的情形发生。更糟的是,现在日志系统也无法和持久化的内存一起发挥作用。 + +正确的答案是什么呢?Linux至今还没有一个,但编程人员们正在努力寻找答案。 + +因此,尽管Linux支持很多文件系统,可以使用这里以外的任何一种存储器来存储数据,但是仍然有很多工作要做。技术从来不会止步不前。Linux,正运行在移动设备、桌面电脑、服务器、云端和超级计算机上等几乎所有的主流设备上,必须跟紧存储的发展步伐,不管它们以何种形式出现。 + +-------------------------------------------------------------------------------- + +via: http://www.zdnet.com/article/linux-storage-futures/ + +作者:[Steven J. Vaughan-Nichols][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.zdnet.com/meet-the-team/us/sjvn/ +[1]:http://www.linuxfoundation.org/ +[2]:http://events.linuxfoundation.org/events/vault +[3]:http://www.wired.com/2012/10/linus-torvalds-hard-disks/ +[4]:http://www.zdnet.com/article/sandisk-launches-infiniflash-aims-to-bring-flash-array-costs-down/ +[5]:http://events.linuxfoundation.org/sites/events/files/eeus13_wheeler.pdf +[6]:https://btrfs.wiki.kernel.org/index.php/Main_Page +[7]:http://www.centos.org/ +[8]:http://oss.sgi.com/projects/xfs/ +[9]:http://www.gluster.org/ +[10]:http://rocksdb.org/ +[11]:http://lwn.net/Articles/627232/ +[12]:https://coreos.com/ +[13]:http://www.redhat.com/ +[14]:http://ceph.com/ +[15]:http://pubs.opengroup.org/onlinepubs/9699919799/ +[16]:http://www.zdnet.com/article/red-hat-acquires-inktank-for-175m/ +[17]:http://linux.die.net/man/8/fsck +[18]:http://primarydata.com/ +[19]:http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs/cmds/xfstests.git;a=summary + + + + diff --git a/published/201504/20150323 Papyrus--An Open Source Note Manager.md b/published/201504/20150323 Papyrus--An Open Source Note Manager.md new file mode 100644 index 0000000000..e5742facde --- /dev/null +++ b/published/201504/20150323 Papyrus--An Open Source Note Manager.md @@ -0,0 +1,59 @@ +Papyrus:开源笔记管理工具 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Papyrus_Linux_4.jpeg) + +在上一篇帖子中,我们介绍了[待办事项管理软件Go For It!][1]。今天我们将介绍一款名为**Papyrus的开源笔记软件** + +[Papyrus][2] 是[Kaqaz 笔记管理][3]的一个分支,使用 Qt5 开发。它不仅有简洁、易用的界面,(其宣称)还具备了较好的安全性。由于强调简洁,我觉得 Papyrus 与 OneNote 比较相像。你可以将你的笔记像"纸张"一样分类整理,还可以给他们添加标签进行分组。够简单的吧! + +## Papyrus 的特性: ### + +虽然 Papyrus 强调简洁,它依然有很多丰富的功能。它的一些主要功能如下: +- 按类别和标签管理笔记 +- 高级搜索选项 +- 触屏模式 +- 全屏选项 +- 备份至 Dropbox/硬盘/外部存储 +- 允许加密某些页面 +- 可与其他软件共享笔记 +- 与 Dropbox 加密同步 +- 除 Linux 外,还可在 Android,Windows 和 OS X 使用 + +### 安装 Papyrus ### + +Papyrus 为 Android 用户提供了 APK 安装包。Windows 和 OS X 也有安装文件。Linux 用户还可以获取程序的源码。Ubuntu 及其它基于 Ubuntu 的发行版可以使用 .deb 包进行安装。根据你的系统及习惯,你可以从 Papyrus 的下载页面中获取不同的文件: + +- [下载 Papyrus][4] + +### 软件截图 ### + +以下是此软件的一些截图: + + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Papyrus_Linux_3-700x450_c.jpeg) + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Papyrus_Linux_2-700x450_c.jpeg) + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Papyrus_Linux_1-700x450_c.jpeg) + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Papyrus_Linux-700x450_c.jpeg) + +试试Papyrus吧,你会喜欢上它的。在下方评论区和我们分享你的使用经验吧。 + +(LCTT译注:此软件暂无中文版) + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/papyrus-open-source-note-manager/ + +作者:[Abhishek][a] +译者:[KevinSJ](https://github.com/KevinSJ) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://linux.cn/article-5337-1.html +[2]:http://aseman.co/en/products/papyrus/ +[3]:https://github.com/sialan-labs/kaqaz/ +[4]:http://aseman.co/en/products/papyrus/ diff --git a/published/201504/20150323 Red Hat Developer Toolset 3.1 beta arrives.md b/published/201504/20150323 Red Hat Developer Toolset 3.1 beta arrives.md new file mode 100644 index 0000000000..3fd91b69cd --- /dev/null +++ b/published/201504/20150323 Red Hat Developer Toolset 3.1 beta arrives.md @@ -0,0 +1,53 @@ +红帽开发者工具集3.1测试版发布了 +================================================================================ +> **摘要**:想要试试最新的红帽企业版Linux 6/7的开发者工具?测试版已经发布啦。 + +这是[DevOps][1]也不能完全解决的程序员和系统管理员之间永恒的问题之一。系统管理员想要最稳定的操作系统,而程序员想要最新最棒的开发工具。[红帽公司][2]对这个两难问题的解决方法就是用最新的稳定版[Red Hat Enterprise Linux (RHEL)][3]去测试这些新品牌工具,然后向开发者发布。 + +![红帽开发者工具集](http://zdnet4.cbsistatic.com/hub/i/2015/03/18/d92b1067-6b36-4ff0-ac9e-608fbe3e8c5d/ae80362df5401a37e3cbcd2598f33370/rhel-dev-tools.png) + +*红帽开发者工具集* + +红帽刚刚公布了给开发者的最新玩具:[红帽开发者工具集 3.1][4]。现在可以获得这些最热门工具包的测试版了。 + +这次更新包括: + +[GNUCompiler Collection (GCC) 4.9][5]: 最新的GCC上游稳定版本,提供多处改进和bug修复。 + +[Eclipse 4.4.1][6]: 支持Java 8 以及更新的Eclipse CDT(8.5)版本,Eclipse Linux Tools (3.1), Eclipse Mylyn (3.14), 和 Eclipse Egit/Jgit (3.6.1) + +众多额外的更新包: 包括 GDB 7.8.2, elfutils 0.161, memstomp 0.1.5, SystemTap 2.6, Valgrind 3.10.1, Dyninst 8.2.1, 以及 ltrace 0.7.91. + +用这些开发工具,你可以给RHEL 6 和 7.x 开发应用程序。这些应用程序可以在RHEL上运行,不管是物理机,虚拟机还是云环境。它们也可以在红帽提供的Platform-as-a-Service (PaaS)服务[OpenShift][7]上运行。 + +这些新的开发者程序集包括可以运行在[AMD64 和 Intel 64 架构][8]上RHEL 7的包。尽管这些工具都是64位的,你也可以用它们创建或者修改32位的二进制文件。 + +在运行任何这些程序之前,你应该安装RHEL所有最近的更新。要安装这个测试工具集,你的系统需要订阅“可选渠道”来获取所有红帽开发者工具集需要的工具链包。 + +另外,如果已经安装了早期版本的工具集,可能会遇到[安装Toolkit 3.1 时的一些问题][9]。尽管这些问题很容易解决,在安装新的工具集之前还是应该大概看一下这些可能出现的问题。 + +最后,你可能注意到一些最令人激动的工具,例如 Docker,Kubernetes以及其它容器工具并没有提供。因为它们在最新的发行版[RHEL 7.1][10] 和 [Red Hat Enterprise Linux 7 Atomic Host (RHELAH)][11]中。[红帽和Docker已成为合作伙伴][12],要获取这些支持容器的程序,你需要转换到支持Docker的RHEL版本上来。 + +-------------------------------------------------------------------------------- + +via: http://www.zdnet.com/article/red-hat-developer-toolset-3-1-beta-arrives/ + +作者:[Steven J. Vaughan-Nichols][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.zdnet.com/meet-the-team/us/sjvn/ +[1]:http://blogs.csc.com/2015/02/03/devops-theory-for-beginners/ +[2]:http://www.redhat.com/en +[3]:http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[4]:http://www.redhat.com/en/about/blog/red-hat-developer-toolset-31-beta-now-available +[5]:https://gcc.gnu.org/gcc-4.9/ +[6]:https://projects.eclipse.org/projects/eclipse/releases/4.4.1 +[7]:https://www.openshift.com/ +[8]:https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/3-Beta/html/3.1_Release_Notes/System_Requirements.html +[9]:https://access.redhat.com/documentation/en-US/Red_Hat_Developer_Toolset/3-Beta/html/3.1_Release_Notes/DTS3.1_Release.html#Known_Issues +[10]:http://www.zdnet.com/article/red-hat-7-1-is-here-centos-7-1-is-coming-soon/ +[11]:http://www.zdnet.com/article/red-hat-buys-into-docker-containers-with-atomic-host/ +[12]:http://www.zdnet.com/article/red-hat-partners-with-docker-to-create-linuxdocker-software-stack/ \ No newline at end of file diff --git a/published/201504/20150324 How to Install Telegram Messenger Application on Linux.md b/published/201504/20150324 How to Install Telegram Messenger Application on Linux.md new file mode 100644 index 0000000000..5400bd52ef --- /dev/null +++ b/published/201504/20150324 How to Install Telegram Messenger Application on Linux.md @@ -0,0 +1,132 @@ +如何在Linux上安装Telegram Messenger应用 +================================================================================ +Telegram是和whatsapp类似的及时通讯应用。它有一个庞大的用户群,并且很多能和其他通讯应用区分开来的特性。 + +![在Linux上安装Telegram](http://www.tecmint.com/wp-content/uploads/2015/03/Install-Telegram-in-Linux.png) +Telegram Messenger for Linux + +这篇文章让你了解Telegram应用,以及在Linux Box上的详细安装命令。 + +#### Telegram的特性 #### + +- 支持移动设备 +- 有桌面版本 +- 第三方开发者可以访问Telegram的应用程序接口(API)。 +- 支持Android, iphone/ipad, Windows Phone, Web-Version, PC, Mac 和 Linux。 +- 以上应用支持高度加密和自销毁信息。 +- 可以让你从多种设备和平台查看你的信息。 +- 整体的处理和消息传送都非常快 +- 为了安全和效率,在全球有分布式服务器 +- 开放的API和自由协议 +- 没有广告,没有认购费用。-永久免费 +- 功能强大-没有媒体和聊天限制 +- 多种安全措施使其免受黑客侵害 +- 在群组中回复特定信息。使用@username提醒群组里的多个用户 + +#### 为什么使用Telegram? #### + +在像WhatsApp以及其他及时通讯应用都提供了几乎同样的功能的情况下,为什么要选择Telegram? + +第三方开发者可以使用API这一点就足够了。更多PC的可用性意味着你不必再纠结在你的移动设备上打字,你可以使用你的PC,这样更具有可用性。 + +另外,支持连接远程地点,协作-多达200个成员的群组,在所有设备上同步,发送各种类型的文件,信息加密,自毁信息,在云上存储媒体,基于完全可用API构建自己的工具。 + +**测试环境** + +我们使用Debian GNU/Linux, x86_64结构测试,所有的步骤都非常顺利。以下是我们的详细步骤。 + +### 在Linux上安装Telegram Messenger ### + +首先去Telegram的官方网站,下载Linux系统版本的Telegram源码包([tsetup.0.7.23.tar.xz][1]),你也可以使用下面的wget命令直接下载。 + + # wget https://updates.tdesktop.com/tlinux/tsetup.0.7.23.tar.xz + +下载好安装包后,解压安装包,并从当前目录进入解压后的文件夹。 + + # tar -xf tsetup.0.7.23.tar.xz + # cd Telegram/ + +然后,如下所示,在命令行中执行二进制文件‘Telegram’. + + # ./Telegram + +1. 第一个界面, 点击 “START MESSAGING”. + +![开始安装](http://www.tecmint.com/wp-content/uploads/2015/03/Start-Messaging.jpeg) +开始安装 + +2. 输入你的手机号码,点击"Next"。如果在这之前你没有注册过Telegram,使用和之前输入相同的号码你会看到警告说你还没有Telegram账户。点击“Register Here”。 + +![注册Telegram](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Register.png) +注册Telegram + +3. 提交你的手机号码之后,Telegram很快会给你发送一个验证码。你需要输入它。 + +![Telegram验证码](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Verfication-Code.png) +Telegram验证码 + +4. 输入你的姓名,昵称并点击“SIGN UP”. + +![输入账户详细信息](http://www.tecmint.com/wp-content/uploads/2015/03/Enter-Account-Details.jpeg) +输入账户详细信息 + +5. 新建账户之后,我看到这个界面。一切准备就绪,尽管我对Telegram还不熟悉。这个界面真的很简洁。 + +![Telegram界面](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Interface.jpeg) +Telegram界面 + +6. 点击新建联系人,输入他们的姓名和手机号码,完成后点击新建。 + +![新建Telegram联系人](http://www.tecmint.com/wp-content/uploads/2015/03/Add-New-Telegram-Contact.png) +新建Telegram联系人 + +7. 如果Telegram中还没有你输入的联系人,你会收到一个提示信息,当这个联系人加入Telegram的时候Telegram会通知你。 + +![Telegram联系人提示](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Contact-Notification.jpeg) +Telegram联系人提示 + +8. 当联系人加入Telegram的时候,你会收到信息(类似弹出提示)显示[YOUR_CONTACT]加入了Telegram。 + +9. 在Linux系统上正式的聊天窗口。很好的体验… + +![联系人加入Telegram消息](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Contact-Join-Message.jpeg) +联系人加入Telegram消息 + +10. 同时,我试着在我的Android移动设备上发送信息,两者之间界面非常相似。 + +![移动版Telegram界面](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Mobile-Interface.png) +移动版Telegram界面 + +11. Telegram设置页面. 你有很多可以配置的选项. + +![设置Telegram](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Settings.png) +设置Telegram + +12. 关于Telegram. + +![关于Telegram](http://www.tecmint.com/wp-content/uploads/2015/03/About-Telegram.jpeg) +关于Telegram + +#### 有趣的几点 #### + +- Telegram使用MTProto移动协议 +- 一开始在2013年(8月14号)发布iPhone版 +- 惊人项目背后的人物:Pavel and Nikolai Durov.. + +就是这些了。我还会为大家带来你们喜欢阅读的其它有趣文章。很高兴能代表Tecmint,感谢我们尊贵的读者以及使得我们通过不断的自我提升走到这里的批评者。保持联系!继续评论。如果你关注我们那就请分享吧。 + +- [https://telegram.org/][2] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-telegram-in-linux/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:https://tdesktop.com/linux +[2]:https://telegram.org/ diff --git a/published/201504/20150324 Prips--Print IP address on a given range.md b/published/201504/20150324 Prips--Print IP address on a given range.md new file mode 100644 index 0000000000..4d663bb953 --- /dev/null +++ b/published/201504/20150324 Prips--Print IP address on a given range.md @@ -0,0 +1,60 @@ +Prips - 打印指定范围内的IP地址 +================================================================================ +prips是一个可以打印出指定范围内所有ip地址的一个工具。它可以增强那些只能同时工作在一个主机上的工具的可用性。 + +### 在ubuntu上安装prips ### + +打开终端并输入下面的命令 + + sudo apt-get install prips + +### 使用prips ### + +prips语法 + + prips [-c] [-d delim] [-e exclude] [-f format] [-i incr] start end + prips [-c] [-d delim] [-e exclude] [-f format] [-i incr] CIDR-block + +### 可用选项 ### + +prips接受下面的命令行选项: + +- -c -- 以CIDR形式打印范围。 +- -d 分隔符 -- 用ASCII码作为分隔符,0 <= 分隔符 <= 255。 +- -e -- 排除输出的范围。 +- -f 格式 -- 设置地址格式 (hex:16进制, dec:10进制, 或者dot:以点分隔). +- -i 增长 -- 设置增长上限 + +### Prips示例 ### + +显示保留的子网内的所有地址: + + prips 192.168.32.0 192.168.32.255 + +同上面一样,使用CIDR标示: + + prips 192.168.32/24 + +只显示A类保留子网内所有可用的地址,用空格而不是换行作为分隔符: + + prips -d 32 10.0.0.1 10.255.255.255 + +每块显示4个ip地址: + + prips -i 4 192.168.32.7 192.168.33.5 + +打印包含两个地址的最小CIDR块。 + + prips -c 192.168.32.5 192.168.32.11 + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/prips-print-ip-address-on-a-given-range.html + +作者:[ruchi][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix diff --git a/published/201504/20150326 Mydumper--Mysql Database Backup tool.md b/published/201504/20150326 Mydumper--Mysql Database Backup tool.md new file mode 100644 index 0000000000..dd1fd14110 --- /dev/null +++ b/published/201504/20150326 Mydumper--Mysql Database Backup tool.md @@ -0,0 +1,107 @@ +Mydumper - MySQL数据库备份工具 +================================================================================ +Mydumper 是 MySQL 数据库服务器备份工具,它比 MySQL 自带的 mysqldump 快很多。它还有在转储的同时获取远程服务器二进制日志文件的能力。 + +### Mydumper 的优势 ### + +- 并行能力 (因此有高速度) 和性能 (高效的代码避免了耗费 CPU 处理能力的字符集转换过程) +- 更容易管理输出 (每个表都对应独立的文件,转储元数据等,便于查看/解析数据) +- 一致性 :跨线程维护快照, 提供精确的主从日志定位等。 +- 可管理性 : 支持用 PCRE 来包含/排除指定的数据库和表(LCTT译注:PCRE,Perl Compatible Regular Expression,Perl兼容正则表达式) + +### 在Ubuntu上安装 mydumper ### + +打开终端运行以下命令 + + sudo apt-get install mydumper + +### 使用 Mydumper ### + +#### 语法 #### + + mydumper [options] + +应用程序选项: + +- -B, --database 要转储的数据库 +- -T, --tables-list 逗号分隔的转储表列表(不会被正则表达式排除) +- -o, --outputdir 保存输出文件的目录 +- -s, --statement-size 插入语句的字节大小, 默认是1000000个字节 +- -r, --rows 把表按行数切块 +- -c, --compress 压缩输出文件 +- -e, --build-empty-files 空表也输出文件 +- -x, --regex 匹配‘db.table’的正则表达式 +- -i, --ignore-engines 以逗号分隔的被忽略的存储引擎列表 +- -m, --no-schemas 不转储表架构 +- -k, --no-locks 不执行临时共享读锁。警告: 这会导致备份的不一致性 +- -l, --long-query-guard 设置长查询的计时器秒数,默认是60秒 +- --kill-long-queries 杀死长查询 (而不是退出程序) +- -b, --binlogs 获取二进制日志文件快照并转储数据 +- -D, --daemon 开启守护进程模式 +- -I, --snapshot-interval 每个转储快照之间的间隔时间(分钟), 需要开启 --daemon, 默认是60分钟 +- -L, --logfile 日志文件的名字,默认是stdout +- -h, --host 要连接的主机 +- -u, --user 有转储权限的用户名 +- -p, --password 用户密码 +- -P, --port 连接的TCP/IP端口 +- -S, --socket 用于连接的Unix套接字文件 +- -t, --threads 使用的线程数,默认是4 +- -C, --compress-protocol 在MySQL连接上使用压缩 +- -V, --version 查看程序版本号 +- -v, --verbose 输出信息的等级, 0 = silent, 1 = errors, 2 = warnings, 3 = info, 默认是2 + +#### Mydumper 例子 #### + + mydumper \ + --database=$DB_NAME \ + --host=$DB_HOST \ + --user=$DB_USER \ + --password=$DB_PASS \ + --outputdir=$DB_DUMP \ + --rows=500000 \ + --compress \ + --build-empty-files \ + --threads=2 \ + --compress-protocol + +Mydumper 输出数据的说明 + +Mydumper 不直接指定输出的文件,而是输出到文件夹的文件中。--outputdir 选项指定要使用的目录名称。 + +输出分为两部分 + +**表结构** + +对数据库中的每个表,创建一个包含 CREATE TABLE 语句的文件。文件命名为: + +dbname.tablename-schema.sql.gz + +**数据** + +每个表名跟着按 --rows 参数所切块的数量, 创建文件名字为: + +dbname.tablename.0000n.sql.gz + +"n"从0开始. + +你可以使用Myloader恢复这些备份 + + myloader \ + --database=$DB_NAME \ + --directory=$DB_DUMP \ + --queries-per-transaction=50000 \ + --threads=10 \ + --compress-protocol \ + --verbose=3 + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/mydumper-mysql-database-backup-tool.html + +作者:[ruchi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix \ No newline at end of file diff --git a/published/201504/20150330 Picty--Managing Photos Made Easy.md b/published/201504/20150330 Picty--Managing Photos Made Easy.md new file mode 100644 index 0000000000..d1b9fb63bb --- /dev/null +++ b/published/201504/20150330 Picty--Managing Photos Made Easy.md @@ -0,0 +1,102 @@ +Picty:让图片管理变简单 +================================================================================ +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/03/picty_002-790x429.png) + +### 关于Picty ### + +**Picty**是个免费,简单,却强大的照片收藏管理器,它可以帮助你管理你的照片。它是围绕着**元数据**管理和图像**无损**处理设计的。Picty目前同时支持在线(基于网页的)和离线(本地的)收藏集。在本地的收藏集中,图片将被保存在一个本地的文件夹及其子文件夹中。为了加快用户主目录里图片的查询速度,它会维持一个数据库。在在线(基于网页的)收藏集中,你可以通过网页浏览器上传并分享图片。拥有适当权限的个人用户可以把图片分享给任何人,而且用户可以同时打开多个收藏集,收藏集也可以分享给多个用户。有个简单的界面可以通过传输插件在收藏集之间传输图片。 + +你可以从你的相机或任何设备中下载任何数量的照片。除此之外,Picty允许你在下载前浏览在你相机里的图片集。Picty是个轻量级的应用,界面清爽。它支持Linux和Windows平台。 + +### 功能 ### + +- 支持大相片集(20000张以上)。 +- 同时打开多个收藏集,还可以在它们之间传照片。 +- 收藏集包括: + - 本地文件系统中保存图片的文件夹。 + - 相机、电话及其他媒体设备中的图片。 + - 图片保存服务(目前支持Flickr) +- Picty不是把相片“导入”到它的数据库中,它仅仅提供了一个界面来访问它们,不管它们保存在哪。为了保持迅速的反应以及能使你在离线时浏览图片的能力,Picty会保存缩略图和元数据的缓存。 +- 以业界标准格式Exif、IPTC和Xmp读写元数据。 +- 无损的方法: + - Picty把所有改变包括图像编辑以元数据的方式写入。例如,一个图片可以以任何方式剪切保存,原来的图像仍然保存在该文件里。 + - 修改会保存在Picty的收藏集缓存中直到你把你对元数据的修改保存到图片中,所以你能很容易撤销你不喜欢的未保存的修改。 +- 基本图片编辑功能: + - 目前支持基本的图像增强,如亮度、对比度、色彩、剪切以及矫正。 + - 将要推出一些工具改进及更多工具。(红眼消除、拉伸、弯曲、噪声消除) +- 图片标签: + - 使用标准的IPTC和Xmp关键词为图片做标签。 + - 一个树状标签图让你能很容易的管理标签和在收藏集内导航。 +- 文件夹视图: + - 按照目录的结构对你的图片收藏集进行导航 +- 支持多屏显示 + - Picty可以设置成让你在一个屏幕上浏览你的收藏集同时在另一个屏幕上全屏显示图片。 +- 可个性化 + - 可以为外部工具创建快捷方式 + - 支持插件——目前提供的功能中有许多(标签和文件夹视图以及所有的图片编辑工具)都可以通过插件提供。 + - 使用Python编写——内置电池(batteries included)! + +### 安装方法 ### + +#### 1、从PPA安装 #### + +Picty开发人员为Ubuntu这样的基于 Debian的发行版创建了一个PPA,让安装更简单。 + +要在Ubuntu和它的衍生版上安装,请运行以下命令: + + sudo add-apt-repository ppa:damien-moore/ppa + sudo apt-get update + sudo apt-get install picty + +#### 2、从源文件安装 #### + +此外,你还可以从源文件安装。首先安装如下依赖项。 + + sudo apt-get install bzr python-pyinotify python-pyexiv2 python-gtk2 python-gnome2 dcraw python-osmgpsmap python-flickrapi + +然后,使用下面这个命令得到最新版本: + + bzr branch lp:picty + +要运行Picty,先转到Picty所在的目录,然后输入: + + cd picty + bin/picty + +要想更新到最新版,请运行: + + cd picty + bzr pull + +### 使用方法 ### + +可以从目录或Unity Dash启动Picty。 + +![picty_001](http://www.unixmen.com/wp-content/uploads/2015/03/picty_001.png) + +你可以选择已存在的收藏集、设备或目录。这里让我们创建一个**新收藏集** ,请先点击新收藏集(New Collection)按钮。进入收藏集,然后浏览到你保存图片的地方。最后,点击**创建(Create)**按钮。 + +![Create a Collection_001](http://www.unixmen.com/wp-content/uploads/2015/03/Create-a-Collection_001.png) + +![picty_002](http://www.unixmen.com/wp-content/uploads/2015/03/picty_002.png) + +你可以对每张图片进行修改,旋转,添加/移除标签,设置描述。只需右击任何一个图片然后爱做什么做什么。 + +访问下面这个Google组可以得到更多关于Picty相片管理器的信息和支持。 + +- [http://groups.google.com/group/pictyphotomanager][1] + +干杯! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/picty-managing-photos-made-easy/ + +作者:[SK][a] +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:http://groups.google.com/group/pictyphotomanager diff --git a/published/201504/20150402 The VirtualBox 5.0 beta is finally here.md b/published/201504/20150402 The VirtualBox 5.0 beta is finally here.md new file mode 100644 index 0000000000..b725657127 --- /dev/null +++ b/published/201504/20150402 The VirtualBox 5.0 beta is finally here.md @@ -0,0 +1,36 @@ +VirturalBox 终于进入到 5.0 世代 +======================================= + +**本月初,甲骨文公司的桌面虚拟化软件获得了近五年来的第一次重大改版,但是更像是改进而不是革命性的的变化。** + +VirtualBox,由Sun公司创建,现在由甲骨文管理的开源虚拟化系统,获得了近5年来第一次的主版本更新发布。 + +从发行说明和测试版本身的表现来看,别期望任何真正革命性的改变。在此版本中,VirtualBox在视觉上和技术上都做了一些改进,但和VMware相比,它的主要优势仍然是相同核心功能的开源实现。 + +VirtualBox 4.0的最后一个主要版本在2010年12月发布,它采用了新的图形化用户界面,新的虚拟化硬件和重组的项目设计,进行了重大的改版。但项目主要版本的发布步伐缓慢,上一次重要版本(版本4.3)在2013年底才发布。从那时起,一切都被正式称为“维护”发布。 + +![](http://images.techhive.com/images/article/2015/04/vbox-5-100576781-large.idge.png) + +*VirtualBox 5.0的第一个测试版增加了编辑菜单,VM窗口的快捷方式图标等功能,如下面所示。* + +VirtualBox 5.0最大的变化是增加了对硬件辅助虚拟化指令集扩展的支持。AES-NI指令集通常用于加密时的硬件加速,SSE 4.1和SSE 4.2指令集都包括在其中。另外一点是支持Windows和Linux客户机的半虚拟化,一个抽象主机音响设备的新的架构以及支持客户机中的USB 3(xHCI)控制器。 + +大部分可用性更新都是对 VirtualBox 图形化用户界面的改进。一个大的变化就是支持给单个虚拟主机自定义菜单和工具栏,这样很少或者从不使用的选项就可以彻底删除。另外重要的一点是可以在VirtualBox接口内部对虚拟磁盘进行加密,而不依赖于客户机操作系统自身的磁盘加密功能(假设有的话)。 + +甲骨文公司提醒由于这是个测试版软件,需要谨慎对待。当然,主界面和客户机系统界面的某个角落打着红黑相间的测试警告标志。但之前VirtualBox发行版(4.3.26)上创建的Windows 10虚拟机启动和运行都没问题,5.0版本中添加的VirtualBox客户机功能--更好的视频支持,双向复制和粘贴,以及其它功能--在安装的时候也没有问题。(从4.3.18版本就改进了对 Windows 10的支持)。 + +虽然没有明确指出5.0的最终版什么时候会发布,但是甲骨文公司[建议用户][1]在非生产环境中下载和使用测试版,并在[测试版反馈论坛][2]中提交bug报告。 + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2905098/virtualization/oracle-virtualbox-5-0-beta-is-finally-here.html + +作者:[Serdar Yegulalp][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Serdar-Yegulalp/ +[1]:https://forums.virtualbox.org/viewtopic.php?f=15&t=66904 +[2]:https://forums.virtualbox.org/viewforum.php?f=15 diff --git a/published/201504/20150409 How to Run GUI Apps in a Docker Container.md b/published/201504/20150409 How to Run GUI Apps in a Docker Container.md new file mode 100644 index 0000000000..4f2e439799 --- /dev/null +++ b/published/201504/20150409 How to Run GUI Apps in a Docker Container.md @@ -0,0 +1,78 @@ +如何在Docker容器中运行GUI程序 +================================================================================ +各位,今天我们将学习如何在[Docker][1]之中运行GUI程序。我们可以轻易地在Docker容器中运行大多数GUI程序且不出错。Docker是一个开源项目,提供了一个打包、分发和运行任意程序的轻量级容器的开放平台。它没有语言支持、框架或者打包系统的限制,并可以运行在任何地方、任何时候,从小型的家用电脑到高端的服务器都可以运行。这让人们可以打包不同的包用于部署和扩展网络应用,数据库和后端服务而不必依赖于特定的栈或者提供商。 + +下面是我们该如何在Docker容器中运行GUI程序的简单步骤。本教程中,我们会用Firefox作为例子。 + +### 1. 安装 Docker ### + +在开始前,我们首先得确保在Linux主机中已经安装了Docker。这里,我运行的是CentOS 7 主机,我们将运行yum管理器和下面的命令来安装Docker。 + + # yum install docker + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-docker.png) + + # systemctl restart docker.service + +### 2. 创建 Dockerfile ### + +现在,Docker守护进程已经在运行中了,我们现在准备创建自己的Firefox Docker容器。我们要创建一个Dockerfile,在其中我们要输入需要的配置来创建一个可以工作的Firefox容器。为了运行 Docker 镜像我们需要使用最新版本的CentOS。要创建 Docker 镜像,我们需要用文本编辑器创建一个名为Dockerfile的文件。 + + # nano Dockerfile + +接着,在Dockerfile中添加下面的行并保存。 + + #!/bin/bash + FROM centos:7 + RUN yum install -y firefox + # 用你自己的 uid /gid 替换下面的0 + RUN export uid=0 gid=0 + RUN mkdir -p /home/developer + RUN echo "developer:x:${uid}:${gid}:Developer,,,:/home/developer:/bin/bash" >> /etc/passwd + RUN echo "developer:x:${uid}:" >> /etc/group + RUN echo "developer ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers + RUN chmod 0440 /etc/sudoers + RUN chown ${uid}:${gid} -R /home/developer + + USER developer + ENV HOME /home/developer + CMD /usr/bin/firefox + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Dockerfile-GUI.png) + +**注意:在第四行的配置中,用你自己的用户和组id来替换0。 我们可以用下面的命令在shell或者终端中得到uid和gid。** + + # id $USER + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/user-id.png) + +### 3. 构造Docker容器 ### + +下面我们就要根据上面的Dockerfile构建一个容器。它会安装firefox浏览器和它需要的包。它接着会设置用户权限并让它可以工作。这里镜像名是firefox,你可以根据你的需要命名。 + + # docker build --rm -t firefox . + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/building-firefox-docker.png) + +### 4. 运行Docker容器 ### + +现在,如果一切顺利,我们现在可以在运行在CentOS 7镜像中的Docker容器里面运行我们的GUI程序也就是Firefox浏览器了。 + + # docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix firefox + +### 总结 ### + +在Docker容器中运行GUI程序是一次很棒的体验,它对你的主机文件系统没有任何的伤害。它完全依赖你的Docker容器。本教程中,我尝试了CentOS 7 Docker中的Firefox。我们可以用这个技术尝试更多的GUI程序。如果你有任何问题、建议、反馈请在下面的评论栏中写下来,这样我们可以提升或更新我们的内容。谢谢! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/run-gui-apps-docker-container/ + +作者:[Arun Pyasi][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://docker.io/ diff --git a/published/201504/20150410 10 Famous IT Skills in Demand That Will Get You Hired.md b/published/201504/20150410 10 Famous IT Skills in Demand That Will Get You Hired.md new file mode 100644 index 0000000000..df972fb96b --- /dev/null +++ b/published/201504/20150410 10 Famous IT Skills in Demand That Will Get You Hired.md @@ -0,0 +1,140 @@ +10个所需的IT技能,助你职场成功 +=========================================================================== +接我们上次的文章[[十大所需的操作系统][1]],这篇文章得到了Tecmint社区很高的评价,在本篇中,我们将指点顶尖的IT技能,这会帮助你找到理想的工作。 + +如第一篇文章提到的那样,这些资料和统计结果是会伴随市场和需求的变化而变化的。只要有任何主要的变化,我们会尽可能地更新列表。所有的统计数据基于最近的,全球一些IT公司的招聘信息和需求。 + +### 1. VMware ### + +VMware公司设计的虚拟化和云计算软件高居榜首。VMware首次宣布商业支持x86架构的虚拟化。VMware的招聘需求在上个季度已经增长至16%。 + +最新稳定发行版: 11.0 + +### 2. MySQL ### + +这款开源的关系型数据库管理系统憾居第二。直到2013年,MySQL都还是第二大使用广泛的RDBMS(注:Relational Database Management System)。上季度MySQL的招聘需求已经达到了11%。非常著名的MarialDB就是来自被甲骨文公司收购之后的MySQL的分支。值得掌握。 + +最新稳定发行版: 5.6.23 + +### 3. Apache ### + +这个跨平台的开源网页(HTTP)服务器位居第三。截至上个季度,Apache的招聘需求已经超过了13%。 + +最新稳定发行版: 2.4.12 + +### 4. AWS ### + +AWS是亚马逊网站提供的所有远程计算服务的集合,AWS排在第四位。上个季度,AWS的招聘需求已经呈现出将近14%的增长。 + +### 5. Puppet ### + +Puppet作为配置管理系统被应用在设置IT基础架构,它排在第五位。它用Ruby语言编写,属于客户端-服务器型的结构。上个季度puppet的招聘需求已经增长超过9%。 + +最新稳定发行版: 3.7.3 + +### 6. Hadoop ### + +Hadoop是用Java编写的一款开源软件框架,用于处理大数据。列表中Hadoop位列第六。对Hadoop的招聘需求在上个季度已经下降了0.2个百分点。 + +最新稳定发行版: 2.6.0 + +### 7. Git ### + +Linux Torvalds最初编写的著名版本控制系统Git排在了第七。Git的招聘需求在上个季度已经超过了7%。 + +最新稳定发行版: 2.3.4 + +### 8. Oracle PL/SQL ### + +Oracle公司开发的SQL扩展版,占据第八的位置。PL/SQL从Oracle 7后就包含在Oracle数据库中。它在上个季度已经呈现将近8%的衰退。 + +### 9. Tomcat ### + +这个开源网页服务器和服务程序容器出现在了第九的位置。在上个季度,它已经表现出需求增长,将近15%。 + +最新稳定发行版: 8.0.15 + +### 10. SAP ### + +这款最著名的企业资源规划软件排在了第十。上个季度SAP在需求市场表现出将近3.5%的增长。 + +具体数据表格如下: + + +++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1. + VMware16% +
2. + MySQL11% +
3.Apache13% +
4. + Amazon web services (AWS)14% +
5. + Puppet9% +
6.Hadoop0.2% +
7.Git7% +
8.Oracle PL/SQL8% -
9.Tomcat15% +
10.SAP3.5% +
+ +这篇文章就到这里,我会积极跟进这个系列的下一部分。敬请期待,保持联系,积极评论。不要忘了给我们提供你的反馈。喜欢的话就分享吧,让更多人认识我们。 + +--------------------------------------------------------------------------- + +via: http://www.tecmint.com/famous-it-skills-in-demand-that-will-get-you-hired/ + +作者:[Avishek Kumar][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/top-distributions-in-demand-to-get-your-dream-job/ diff --git a/published/201504/20150413 Elementary OS 0.3 Freya Screenshots - Download and Install Guide.md b/published/201504/20150413 Elementary OS 0.3 Freya Screenshots - Download and Install Guide.md new file mode 100644 index 0000000000..345cae0272 --- /dev/null +++ b/published/201504/20150413 Elementary OS 0.3 Freya Screenshots - Download and Install Guide.md @@ -0,0 +1,144 @@ +直击 Elementart OS 0.3 Freya - 下载和安装指南 +=========================================================================== +Elementary OS是一个以Ubuntu为基础的轻量级操作系统,广受欢迎。目前已经发行了三个版本,而第四个版本将会以即将到来的Ubuntu16.04为基础开发。 + +- **Jupiter (0.1)**: 第一个Elementary OS稳定发行版基于Ubuntu 10.10,在2011年三月发布。 +- **Luna (0.2)**: Elementary OS第二个稳定发行版基于Ubuntu 12.04,于2012年11月发布。 +- **Freya (0.3)**: Elementary OS第三个稳定发行版基于Ubuntu 14.04的,2015年二月8号发布。 +- **Loki (0.4)**: 未来Elementary OS第四版,计划以Ubuntu16.04为基础,并且提供更新服务直到2021年。 + +Freya是目前最新的Elementary OS版本(0.3)。最初是被命名为ISIS,但是后来改了,是为了避免与同名的恐怖组织产生任何的联系。Freya有一些非常不错的预装应用。 + +### 突出的特性 ### + +这里列举了一些特性,但并非Elementary OS 0.3的所有特性。 + +- 更好的交互性消息通知,可在通知设定面板设定系统级别的“Do Not Disturb(不要打扰)”模式。 +- 最新版Elementary OS提供更好的emoji表情支持,及内置替换了网页应用中的微软核心字体。 +- Privacy模式是一个新的防火墙工具,易于使用,可以帮助保护电脑免遭恶意脚本和应用的攻击。 +- 统一风格的登入和锁定界面。 +- 改进了界面效果和功能的应用中心菜单,包括快速操作列表,搜索拖放,支持快速数学计算。 +- 重新设计的多任务视图提供更多以应用为中心的功能。 +- 更新了软件栈(Linux 3.16, Gtk 3.14 和Vala 0.26),更好的支持和增强了最新开发的应用。 +- UEFI支持。 +- 通过新的联网助手,WiFi连接变得更容易。 + +### 下载64位&32位版本 ### + +- [Elementary OS Freya 64 bit][1] +- [Elementary OS Freya 32 bit][2] + +### 安装Elementary OS 0.3 (Freya) ### + +下载Elementary OS 0.3的ISO文件,并且写入到一个USB启动盘或者DVD/CD。支持32位和64位的架构。当计算机从Elementary OS ISO文件启动后,有两个选项可用,或不安装而仅试用,或直接安装到计算机里。这里选择第二项。Elmentary OS也可以与已有操作系统并存安装,构成双重启动。 + +![Install Freya](http://blog.linoxide.com/wp-content/uploads/2015/04/Install-Freya.png) + +在进行下面的步骤之前会检查系统要求和资源有效性。如果你的系统有足够的资源,点击继续。 + +![Installation Requirements](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-Requirements.png) + +安装向导提供许多安装形式。选取最适合你的选项,通常大多数都选用第一个选项:“擦除磁盘以安装Elementary”。选择该选项,必须保证你的原有数据都已经正确备份了,因为磁盘(分区)将会被擦除,其上所有的数据将会丢失。 + +![Installation Types](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-Types.png) + +接下来的对话框显示了Elementary OS所使用和需要格式化的磁盘分区列表,确保数据完整后点击继续。 + +![Format Warning](http://blog.linoxide.com/wp-content/uploads/2015/04/Format-Warning.png) + +选择你的地理位置,确定时区,点击继续。 + +![Location](http://blog.linoxide.com/wp-content/uploads/2015/04/Location.png) + +选择你的语言,点击继续。 + +![Language](http://blog.linoxide.com/wp-content/uploads/2015/04/Language.png) + +填入你的信息,选择一个高强度的超级用户/管理员密码,点击继续。 + +![whoareyou](http://blog.linoxide.com/wp-content/uploads/2015/04/whoareyou.png) + +当你的信息提供后,核心安装进程就会启动,正在安装的组件的详细信息会在一个小对话框里随进度条一闪而过。 + +![Installation progress](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-progress.png) + +恭喜你!最新的Elementary OS 0.3 (Freya)已经安装完成了。此时需要重启来更新和完整注册,恭喜。 + +![Installation Complet](http://blog.linoxide.com/wp-content/uploads/2015/04/Installation-Complet.png) + +启动时,Elementary OS将显示它优雅的logo,然后会出现密码保护的管理员登入和游客访问选项。游客访问有相当多的限制功能,而且没有安装软件的权限。 + +![Login](http://blog.linoxide.com/wp-content/uploads/2015/04/Login.png) + +下图是新安装的Elementary OS 0.3的画面。 + +![first look](http://blog.linoxide.com/wp-content/uploads/2015/04/first-look.png) + +### 个性化桌面 ### + +Elementary OS 0.3以其轻巧和美观而为我们熟知,每个人有自己独特的审美观和计算机使用习惯。桌面反映出每一个计算机使用者的个人偏好。如其他操作系统一样,Elementary OS 0.3也提供了许多选项来个性化配置桌面,包括壁纸,字体大小,主题等等。 + +基本的个性化配置,点击Applications > System Settings > Desktop + +我们可以改变壁纸,泊板(dock)和启用桌面热角。 + +默认提供了很少的壁纸,更多的可以从网上下载或者从你的相机传输过来。 + +![Desktop Wallpaper](http://blog.linoxide.com/wp-content/uploads/2015/04/Desktop-Wallpaper4.png) + +Elementary OS真正的美丽在于优雅的泊板。桌面上没有任何图标,泊板上的应用图标显示逼真,通过它可以快速访问常用应用。 + +![Desktop Dock](http://blog.linoxide.com/wp-content/uploads/2015/04/Desktop-Dock1.png) + +用户可以定制桌面的四个角的功能。 + +![Hot Corners](http://blog.linoxide.com/wp-content/uploads/2015/04/Hot-Corners.png) + +通过安装elementary tweaks工具来更深入的个性化定制。 + +可以使用如下命令,将稳定的个人软件包档案(PPA)添加到高级软件包管理工具(APT)仓库。 + + sudo add-apt-repository ppa:mpstark/elementary-tweaks-daily + +![ppa](http://blog.linoxide.com/wp-content/uploads/2015/04/elementary-tweaks-ppa.png) + +一旦软件包添加到仓库后,我们需要用以下命令更新仓库 + + sudo apt-get update + +![update repository](http://blog.linoxide.com/wp-content/uploads/2015/04/update-repository.png) + +更新仓库后,我们就可以安装elementary-tweaks,用以下命令完成 + + sudo apt-get install elementary-tweaks + +![install elementary tweaks](http://blog.linoxide.com/wp-content/uploads/2015/04/install-elementary-tweaks.png) + +我们可以在Application > System Settings下的个人区域的看到增加了一个Tweaks项目。它现在可以给我们提供更多的个性化定制选项。 + +![tweaks](http://blog.linoxide.com/wp-content/uploads/2015/04/tweaks.png) + +为了进一步定制,我们也安装了gnome桌面系统的tweak工具,演示解锁桌面。 + + sudo apt-get install gnome-tweak-tool + +![gnome](http://blog.linoxide.com/wp-content/uploads/2015/04/gnome.png) + +### 总结 ### + +Elementary OS十分接近Linux发行版Ubuntu,它的优缺点两方面也都十分相似。Elementary OS在外观和体验上都十分轻巧和优雅,并且正在快速地走向成熟。它有潜力成为Windows和OS X操作系统之外的第三选择。最新的Elementary OS 0.3(Freya)以其良好的功能基础而迅速流行。想了解更多信息,最近的更新和下载,请访问其官方[网站][1]。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/elementary-os-0-3-freya-install-guide/ + +作者:[Aun Raza][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ +[1]:http://sourceforge.net/projects/elementaryos/files/stable/elementaryos-freya-amd64.20150411.iso/download +[2]:http://sourceforge.net/projects/elementaryos/files/stable/elementaryos-freya-i386.20150411.iso/download +[3]:http://elementary.io/ diff --git a/published/201504/20150413 Linux Kernel 4.0 Features Live Kernel Patching PS3 Support.md b/published/201504/20150413 Linux Kernel 4.0 Features Live Kernel Patching PS3 Support.md new file mode 100644 index 0000000000..d62af19480 --- /dev/null +++ b/published/201504/20150413 Linux Kernel 4.0 Features Live Kernel Patching PS3 Support.md @@ -0,0 +1,75 @@ +Linux内核4.0功能:实时内核补丁,支持PS3 +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2011/10/tuxtuxtux.jpeg) + +**Linux Torvalds 在Linux内核邮件列表里[发布][1]了Linux内核新的稳定版。** + +Linux 4.0,代号为‘Hurr durr I’m a sheep’,带来了一小系列新硬件支持,驱动改进,性能调整,错误修复等。 + +但是其实没有太多的更新的必要,Torvalds 写到: + +> 功能方面,4.0 并没有那么多特别的。虽然在内核补丁设施上做了很多工作,但事实上[...] 我们在其它版本中有更大的改变。所以这仅仅是一次“按部就班”的发布。 + +Linus 补充说Linux 4.1 可能是一个“大版本”。 + +### Linux内核4.0新功能 ### + +**无需重启安装内核更新** + +你肯定遇到过内核更新需要重启你的Linux系统而被打断工作,这并不是你一个人遇到的问题。这对于桌面操作系统来说是个小小的不便,对于服务器来说却是大问题。 + +![内核更新无需重启](http://www.omgubuntu.co.uk/wp-content/uploads/2012/10/update.jpg) + +*内核更新无需重启* + +实时给Linux内核安装/使用安全补丁而不需要重启,多年来一直是Linux爱好者希望实现的事情。 + +一些第三方项目,例如[Oracle 的 KSplice][2]和红帽的 Kpatch,已经为一些特定的发行版提供实时补丁的功能。 + +对于服务器,企业单位以及关键任务正常运行,实现实时内核补丁是一个相当大的问题。 + +好消息是Linux 4.0 使得重启系统以完成内核更新成为了过去。 + +如果不是完全不需要重启,也是基本不需要。 + +在最新的发行版中,实现了支持免重启安装补丁的最初基础,为有经验的系统管理员发挥 Linux 4.0的优势做好了准备。 + +桌面Linux发行版也应该能够利用这个功能的优势(但考虑到在最终用户端配置免重启功能会比较复杂而有一些路要走)。 + +在以后的4.x系列中,这个基础功能会持续完善和改进。我希望我们能更多听到它的一些信息。 + +#### 其它改进 #### + +尽管被认为是一次小版本的发布,最新的Linux内核还是带来了一系列的硬件改进,新的驱动以及性能调整。 +它们包括: + +- 针对Intel ‘Skylake’ 平台的改进 +- 支持Intel Quark SoC +- 改善Linux在Playstation 3上运行的系列补丁 +- TOpen-source AMD Radeon驱动支持DisplayPort音频 +- 各种HID驱动调整,包括Lenovo紧凑型键盘,Wacom Cintiq 27QHD +- 东芝电源设置驱动器增加了USB睡眠/充电功能,快速充电,睡眠/音乐等 +- 文件系统调整,包括F2FS, BtrfFS等 + +### 在Ubuntu上安装Linux内核4.0 ### + +尽管被归为稳定版本,但目前而言,**桌面用户和新用户没有必要去升级**。 + +如果从[Canonical的主线内核文档][3]抓取合适的安装包或者冒着第三方PPA库的风险在Ubuntu 15.04测试版安装Linux4.0,那么这种急躁或者不娴熟可能会带来问题。 + +Ubuntu 15.04 Vivid Vervet 将在本月晚些时候发布并会附带Ubuntu内核 3.19(Ubuntu的内核是由Linux内核以及一些上游发行版还没有接受的 Ubuntu 特定的补丁组成)。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/04/linux-kernel-4-0-new-features + +作者:[Joey-Elijah Sneddon][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://linux.cn/article-5259-1.html +[2]:http://www.omgubuntu.co.uk/2009/10/how-to-install-kernel-updates-without-rebooting +[3]:http://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D diff --git a/published/201504/20150415 HTTP Public Key Pinning Extension HPKP for Apache, NGINX and Lighttpd.md b/published/201504/20150415 HTTP Public Key Pinning Extension HPKP for Apache, NGINX and Lighttpd.md new file mode 100644 index 0000000000..a8807a59be --- /dev/null +++ b/published/201504/20150415 HTTP Public Key Pinning Extension HPKP for Apache, NGINX and Lighttpd.md @@ -0,0 +1,161 @@ +在 Apache、NGINX 和 Lighttpd 上启用 HTTP 公钥固定扩展(HPKP) +================================================================================ + +公钥固定(Public Key Pinning)是指一个证书链中必须包含一个白名单中的公钥,也就是说只有被列入白名单的证书签发机构(CA)才能为某个域名`*.example.com`签发证书,而不是你的浏览器中所存储的任何 CA 都可以为之签发。本文讲述了这种机制的背景知识,并提供了 Apache、 Lighttpd 和 NGINX 上的配置范例。 + +### HTTP 公钥固定扩展 ### + +用你使用的银行做个例子,它一直使用 CA 公司 A 为其签发证书。但是在当前的证书体系下,CA 公司 B、CA 公司 C 和 NSA 的 CA 都能给你的银行创建证书,而你的浏览器会毫无疑虑的接受它们,因为这些公司都是你所信任的根 CA。 + +如果你的银行实现了 HPKP 并固定了它们的第一个中级证书(来自 CA 公司 A),那么浏览器将不会接受来自CA 公司 B 和 CA 公司 C 的证书,即便它们也有一个有效的信任链。HPKP 也允许你的浏览器将这种违例行为报告给该银行,以便银行知道被伪造证书攻击了。 + +HTTP 公钥固定扩展是一个从2011年开始开发的针对 HTTP 用户代理(即浏览器)的公钥固定标准。它由 Google 发起,甚至在 Chrome 中实现的固定机制可以使用一个人工维护的网站公钥固定列表,这个列表包含了固定的几个网站的公钥签名。(LCTT 译注:Chrome 和 FireFox 32 及以后版本都支持公钥固定机制,并使用内置的人工维护的公钥固定列表数据,这些数据随着浏览器软件的更新而更新,主要包括几个大型站点。目前还只有 Chrome 38+ 支持通过 HTTP 响应头传递公钥固定信息。) + +以下是 HPKP 的几个功能简述: + +- HPKP 是在 HTTP 层面设置的,使用 `Public-Key-Pins` (PKP)响应头。 +- 该规则的保留周期通过 max-age 参数设置,单位是秒。 +- PKP 响应头只能用于正确的安全加密通讯里面。 +- 如果出现了多个这样的响应头,则只处理第一个。 +- 固定机制可以使用`includeSubDomains`参数扩展到子域。 +- 当接收到一个新的 PKP 响应头时,它会覆盖之前存储的公钥固定和元数据。 +- 公钥固定是用哈希算法生成的,其实是一个“主题公钥信息(SKPI)”指纹。 + +本文首先会介绍一些 HPKP 工作的原理,接下来我们会展示给你如何得到需要的指纹并配置到 web 服务器中。 + +### SPKI 指纹 - 理论 ### + +以下摘自 Adam Langley 的[帖子][1],我们哈希的是一个公钥,而不是证书: + +> 通常来说,对证书进行哈希是一个显而易见的解决方案,但是其实这是错的。不能这样做的原因是 CA 证书可以不断重新签发:同一个公钥、主题名可以对应多个证书,而这些证书有不同的延展或失效时间。浏览器从下至上地在证书池中构建证书链时,另外一个版本的证书可能就替代匹配了你原本所期望的证书。 +> +> 举个例子,StartSSL 有两个根证书:一个是以 SHA1 签名的,另外是一个是 SHA256。如果你希望固定住 StartSSL 作为你的 CA,那么你该使用哪个证书呢?你也许可以使用这两个,但是如果我不告诉你,你怎么会知道还有一个根证书呢? +> +> 相反地,对公钥进行哈希则不会有这个问题: +> +> 浏览器假定子证书是固定不动的:它总是证书链的起点。子证书所携带的签名一定是一个有效的签名,它来自其父证书给这个证书专门签发的。这就是说,父证书的公钥相对于子证书来说是固定的。所以可推论公钥链是固定的。 +> +> 唯一的问题是你不能固定到一个交叉认证的根证书上。举个例子,GoDaddy 的根证书是 Valicert 签名的,这是为了让那些不能识别 GoDaddy 根证书的老客户可以信任其证书。然而,你不能固定到 Valicert 上,因为新的客户在证书链上发现了 GoDaddy 证书就会停止上溯(LCTT 译注:所以就找不到固定信息了)。 +> +> 此外,我们是对 SubjectPublicKeyInfo(SPKI)进行哈希而不是对公钥位串。SPKI 包括了公钥类型、公钥自身及其相关参数。这很重要,因为如果对公钥进行哈希就有可能导致发生曲解攻击。对于一个 Diffie-Hellman 公钥而言:如果仅对公钥进行哈希,而不是对完整的 SPKI,那么攻击者可以使用同样的公钥而让客户端将其解释为其它组。同样地,这样也有可能强制将一个 RSA 密钥当成 DSA 密钥解释等等。 + +### 固定在哪里 ### + +你应该固定在什么地方?固定你自己的公钥并不是一个最好的办法。你的密钥也许会改变或撤销。你也许会使用多个证书,经常轮换证书的话密钥就改变了。也许由于服务器被入侵而撤销证书。 + +最容易但是不是太安全的方法是固定第一个中级 CA 证书。该证书是签名在你的网站证书之上的,所以签发该证书的 CA 的公钥肯定是在证书链上的。 + +采用这种方法你可以从同一个 CA 更新你的证书而不用担心固定信息不对。如果该 CA 发行了一个不同的根证书,也许你会遇到一些问题,对此并没有太好的解决方案。不过你可以通过如下做法来减轻这种问题的影响: + +- 从一个不同的 CA 申请一个备用的证书,并固定该备份。 + +RFC 里面说你至少需要做两个固定。一个是当前连接所使用的证书链上的,另外一个是备份的。 + +另外的固定是对备份公钥的,它可以是来自另外一个给你签发证书的不同 CA 的 SKPI 指纹。 + +在这个问题上还有一种**更安全**的方法,就是事先创建好至少三个独立的公钥(使用 OpenSSL,参见[此页][2] 了解 Javascript OpenSSL 命令生成器),并将其中两个备份到一个安全的地方,离线存储、不要放到网上。 + +为这三个证书创建 SPKI 指纹并固定它们,然后仅使用第一个作为当前的证书。当需要时,你可以使用备份密钥之一。不过你需要让 CA 给你做签名来生成证书对,这可能需要几天,依你的 CA 的工作情况而定。 + +对于 HPKP 来说这没有问题,因为我们使用的是公钥的 SPKI 哈希,而不是证书。失效或不同的 CA 签名链并不影响。 + +如果你按照上述方法生成并安全存储了至少三个独立的密钥,并固定它们,也可以防止你的 CA 撤销你的网站证书并签发一个假证书时出现问题。 + +### SPKI 指纹 ### + +可以使用如下的 OpenSSL 命令来生成 SPKI 指纹,它出现在 [RFC 草案][3] 中: + + openssl x509 -noout -in certificate.pem -pubkey | \ + openssl asn1parse -noout -inform pem -out public.key; + openssl dgst -sha256 -binary public.key | openssl enc -base64 + +结果: + + klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY= + +上面输入的 `certificate.pem` 文件是本站(https://raymii.org)的证书链中第一个证书。(在写本文时, `COMODO RSA Domain Validation Secure Server CA, 序列号 2B:2E:6E:EA:D9:75:36:6C:14:8A:6E:DB:A3:7C:8C:07 。`)。 + +你也需要同样对你的另外两个备份公钥生成指纹。 + +### 故障 ### + +在写本文时(2015/1),唯一支持 HPKP 的浏览器(chrome)有一个严重的问题:Chrome 并不能够区分 HSTS 和 HPKP 响应头中的 max-age 和 includeSubdomains 参数。也就是说,如果你的 HSTS 和 HPKP 设置了不同的 max-age 和 includeSubdomains 参数,它们会互相搞乱。关于这个故障的更多信息参见:[https://code.google.com/p/chromium/issues/detail?id=444511][4]。感谢 Scott Helme([https://scotthelme.co.uk][5])发现并告诉我这个 Chromium 项目的问题。 + +### Web 服务器配置 ### + +下面你可以看到三个主流 Web 服务器的配置方法。这只是一个 HTTP 响应头,绝大多数 Web 服务器都可以设置它。它只需要设置到 HTTPS 网站上。 + +下面的例子固定到 `COMODO RSA Domain Validation Secure Server CA` 及备份的 `Comodo PositiveSSL` CA 上,30天失效期,包括所有的子域。 + + +#### Apache #### + +编辑你的 Apache 配置文件(如 `/etc/apache2/sites-enabled/website.conf 或 /etc/apache2/httpd.conf`),并添加下列行到你的 VirtualHost 中: + + # 如需要,载入 headers 模块。 + LoadModule headers_module modules/mod_headers.so + + Header set Public-Key-Pins "pin-sha256=\"klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY=\"; pin-sha256=\"633lt352PKRXbOwf4xSEa1M517scpD3l5f79xMD9r9Q=\"; max-age=2592000; includeSubDomains" + +#### Lighttpd #### + +Lighttpd 更简单一些,将下列行添加到你的 Lighttpd 配置文件(如 `/etc/lighttpd/lighttpd.conf`): + + server.modules += ( "mod_setenv" ) + $HTTP["scheme"] == "https" { + setenv.add-response-header = ( "Public-Key-Pins" => "pin-sha256=\"klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY=\"; pin-sha256=\"633lt352PKRXbOwf4xSEa1M517scpD3l5f79xMD9r9Q=\"; max-age=2592000; includeSubDomains") + } + +#### NGINX #### + +NGINX 的配置更简短。添加以下行到你的 HTTPS 配置的 server 块中: + + add_header Public-Key-Pins 'pin-sha256="klO23nT2ehFDXCfx3eHTDRESMz3asj1muO+4aIdjiuY="; pin-sha256="633lt352PKRXbOwf4xSEa1M517scpD3l5f79xMD9r9Q="; max-age=2592000; includeSubDomains'; + +### 报告功能 ### + +HPKP 报告功能允许浏览器报告任何违例给你。 + +如果你在响应头中添加了附加的 `report-uri="http://example.org/hpkp-report"` 参数,并用该 URI 处理接收到的数据的话,客户端会在发现违例时发送报告给你。这个报告是以 POST 方式发送到你指定的 report-uri 上,并以类似下面的 JSON 格式: + + { + "date-time": "2014-12-26T11:52:10Z", + "hostname": "www.example.org", + "port": 443, + "effective-expiration-date": "2014-12-31T12:59:59", + "include-subdomains": true, + "served-certificate-chain": [ + "-----BEGINCERTIFICATE-----\nMIIAuyg[...]tqU0CkVDNx\n-----ENDCERTIFICATE-----" + ], + "validated-certificate-chain": [ + "-----BEGINCERTIFICATE-----\nEBDCCygAwIBA[...]PX4WecNx\n-----ENDCERTIFICATE-----" + ], + "known-pins": [ + "pin-sha256=\"dUezRu9zOECb901Md727xWltNsj0e6qzGk\"", + "pin-sha256=\"E9CqVKB9+xZ9INDbd+2eRQozqbQ2yXLYc\"" + ] + } + +### 非强制,只报告 ### + +HPKP 也可以设置为非强制的,可以使用 `Public-Key-Pins-Report-Only` 来只发送违例报告给你。 + +这样可以让你在网站不可访问或 HPKP 配置不正确时不固定,之后你可以将这个响应头改为 `Public-Key-Pins` 来强制固定。 + + +-------------------------------------------------------------------------------- + +via: https://raymii.org/s/articles/HTTP_Public_Key_Pinning_Extension_HPKP.html + +作者:[Remy van Elst][a] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://raymii.org/ +[1]:http://www.imperialviolet.org/2011/05/04/pinning.html +[2]:https://raymii.org/s/software/OpenSSL_Command_Generator.html +[3]:https://tools.ietf.org/html/draft-ietf-websec-key-pinning-21#appendix-A +[4]:https://code.google.com/p/chromium/issues/detail?id=444511 +[5]:https://scotthelme.co.uk/ \ No newline at end of file diff --git a/published/201504/20150417 How to Install Linux Kernel 4.0 from Elrepo or Source on Ubuntu or CentOs.md b/published/201504/20150417 How to Install Linux Kernel 4.0 from Elrepo or Source on Ubuntu or CentOs.md new file mode 100644 index 0000000000..a725043f67 --- /dev/null +++ b/published/201504/20150417 How to Install Linux Kernel 4.0 from Elrepo or Source on Ubuntu or CentOs.md @@ -0,0 +1,150 @@ +如何在Ubuntu/CentOS上安装Linux内核4.0 +================================================================================ +大家好,今天我们学习一下如何从Elrepo或者源代码来安装最新的Linux内核4.0。代号为‘Hurr durr I'm a sheep’的Linux内核4.0是目前为止最新的主干内核。它是稳定版3.19.4之后发布的内核。4月12日是所有的开源运动爱好者的大日子,Linux Torvalds宣布了Linux内核4.0的发布,它现在就已经可用了。由于包括了一些很棒的功能,例如无重启补丁(实时补丁),新的升级驱动,最新的硬件支持以及很多有趣的功能都有新的版本,它原本被期望是一次重要版本。但是实际上内核4.0并不认为是期望中的重要版本,Linus 表示期望4.1会是一个更重要的版本。实时补丁功能已经集成到了SUSE企业版Linux操作系统上。你可以在[发布公告][1]上查看关于这次发布的更多详细内容。 + +> **警告**: 安装新的内核可能会导致你的系统不可用或不稳定。如果你仍然使用以下命令继续安装,请确保备份所有重要数据到外部硬盘。 + +### 在Ubuntu 15.04上安装Linux内核4.0 ### + +如果你正在使用Linux的发行版Ubuntu 15.04,你可以直接通过Ubuntu内核网站安装。在你的Ubuntu15.04上安装最新的Linux内核4.0,你需要在shell或终端中在root访问权限下运行以下命令。 + +#### 在 64位 Ubuntu 15.04 #### + + $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-image-4.0.0-040000-generic_4.0.0-040000.201504121935_amd64.deb + $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0.0-040000.201504121935_amd64.deb + + $ sudo dpkg -i linux-headers-4.0.0*.deb linux-image-4.0.0*.deb + +#### 在 32位 Ubuntu 15.04 #### + + $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-image-4.0.0-040000-generic_4.0.0-040000.201504121935_i386.deb + $ wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.0-vivid/linux-headers-4.0.0-040000-generic_4.0.0-040000.201504121935_i386.deb + + $ sudo dpkg -i linux-headers-4.0.0*.deb linux-image-4.0.0*.deb + +### 在CentOS 7上安装Linux内核4.0 ### + +我们可以用两种简单的方式在CentOS 7上安装Linux内核4.0。 + +1. 从Elrepo软件仓库安装 +1. 从源代码编译安装 + +我们首先用ElRepo安装,这是最简单的方式: + +#### 使用 Elrepo 安装 #### + +**1. 下载和安装ELRepo** + +我们首先下载ELRepo的GPG密钥并安装relrepo-release安装包。因为我们用的是CentOS 7,我们使用以下命令安装elrepo-release-7.0-2.el7.elrepo.noarch.rpm。 + +注: 如果你启用了secure boot,请查看[这个网页获取更多信息][2]。 + + # rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org + # rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm + +![添加 Elrepo 源](http://blog.linoxide.com/wp-content/uploads/2015/04/adding-elrepo.png) + +**2. 升级Linux内核到4.0版本** + +现在,我们准备从ELRepo软件仓库安装最新的稳定版内核4.0。安装它我们需要在CentOS 7的shell或者终端中输入以下命令。 + + # yum --enablerepo=elrepo-kernel install kernel-ml + +![从ELRepo安装Linux内核4.0](http://blog.linoxide.com/wp-content/uploads/2015/04/installing-kernel-4-0-elrepo.png) + +上面的命令会自动安装为CentOS 7构建的Linux内核4.0。 + +现在,下面的是另一种方式,通过编译源代码安装最新的内核4.0。 + +#### 从源代码编译安装 #### + +**1. 安装依赖软件** + +首先我们需要为编译linux内核安装依赖的软件。要完成这些,我们需要在一个终端或者shell中运行以下命令。 + + # yum groupinstall "Development Tools" + + # yum install gcc ncurses ncurses-devel + +![安装内核依赖](http://blog.linoxide.com/wp-content/uploads/2015/04/installing-dependencies.png) + +然后,我们会升级我们的整个系统。 + + # yum update + +**2. 下载源代码** + +现在我们通过wget命令从Linux内核的官方仓库中下载最新发布的linux内核4.0的源代码。你也可以使用你的浏览器直接从[kernel.org][3]网站下载内核。 + + # cd /tmp/ + # wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.0.tar.xz + +![下载内核源码](http://blog.linoxide.com/wp-content/uploads/2015/04/download-kernel-source.png) + +**3. 解压tar压缩包** + +文件下载好后我们在/usr/src/文件夹下用以下命令解压。 + + # tar -xf linux-4.0.tar.xz -C /usr/src/ + # cd /usr/src/linux-4.0/ + +![解压内核tar压缩包](http://blog.linoxide.com/wp-content/uploads/2015/04/extracting-kernel-tarball.png) + +**4. 配置** + +配置Linux内核有两种选择的。我们可以创建一个新的自定义配置文件或者使用已有的配置文件来构建和安装Linux内核。这都取决于你自己的需要。 + +**配置新的内核** + +现在我们在shell或终端中运行make menuconfig命令来配置Linux内核。我们执行以下命令后会显示一个包含所有菜单的弹出窗口。在这里我们可以选择我们新的内核配置。如果你不熟悉这些菜单,那就敲击ESC键两次退出。 + + # make menuconfig + +![配置新内核](http://blog.linoxide.com/wp-content/uploads/2015/04/configuring-new-kernel-config.png) + +**已有的配置** + +如果你想用已有的配置文件配置你最新的内核,那就输入下面的命令。如果你对配置有任何调整,你可以选择Y或者N,或者仅仅是按Enter键继续。 + + # make oldconfig + +#### Step 5. 编译Linux内核 #### + +下一步,我们会执行make命令来编译内核4.0。取决于你的系统配置,编译至少需要20-30分钟。 + +注:如果编译内核的时候出现`bc command not found`的错误,你可以用**yum install bc**命令安装bc修复这个错误。 + + # make + +![Make 内核](http://blog.linoxide.com/wp-content/uploads/2015/04/make-kernel.png) + +#### 6. 安装Linux内核4.0 #### + +编译完成后,我们终于要在你的Linux系统上安装**内核**了。下面的命令会在/boot目录下创建文件并且在Grub 菜单中新建一个内核条目。 + + # make modules_install install + +#### 7. 验证内核 #### + +安装完最新的内核4.0后我们希望能验证它。做这些我们只需要在终端中输入以下命令。如果所有都进展顺利,我们会看到内核版本,例如4.0出现在输出列表中。 + + # uname -r + +#### 结论 #### + +好了,我们成功地在我们的CentOS 7操作系统上安装了最新的Linux内核版本4.0。通常并不需要升级linux内核,因为和之前版本运行良好的硬件可能并不适合新的版本。我们要确保它包括能使你的硬件正常工作的功能和配件。但大部分情况下,新的稳定版本内核能使你的硬件性能更好。因此,如果你有任何问题,评论,反馈,请在下面的评论框中注明,让我们知道需要增加或者删除什么问题。多谢!享受最新的稳定版Linux内核4.0吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/install-linux-kernel-4-0-elrepo-source/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://linux.cn/article-5259-1.html +[2]:http://elrepo.org/tiki/SecureBootKey +[3]:http://kernel.org/ \ No newline at end of file diff --git a/published/201504/20150423 The Most Popular Programming Languages in to GitHub Since 2012.md b/published/201504/20150423 The Most Popular Programming Languages in to GitHub Since 2012.md new file mode 100644 index 0000000000..b47b1c2ed5 --- /dev/null +++ b/published/201504/20150423 The Most Popular Programming Languages in to GitHub Since 2012.md @@ -0,0 +1,32 @@ +GitHub 上最流行的编程语言 +================================================================================ +![](http://www.loggly.com/wp-content/uploads/2015/04/Infographic_Github_popular_languages_Blogheader.png) + +编程语言不仅仅是开发者用来创建程序或表达算法的工具,它们也是对创造力进行编码和解码的仪器。通过观察编程语言的历史,我们在追求为解决问题找到一个更好的方法,促进协作,构建好的产品以及重用他人的工作上得到一个独特的观点。 + +我们有大约 70% 的客户向我们的服务发送应用日志,因此我们能追踪哪种语言是最流行的,以及哪种语言获得了开发人员的关注。 + +基于从2012年以来的历史的[GitHub 归档][1]和[GitHut][2]数据,我们分析了GitHub上大部分开发者的动作并绘制成你下面看到的信息图表。我们主要关注: + +- 活跃库的数量,这是反应了人们正在研究的项目的有用度量。 +- 每种语言总的推送数量以及每个库的平均推送次数。这些指标是由某种语言编写的项目的创新效率的指示器。 +- 每个库新的fork数和发现的问题数目,这也显示了活跃度和创新性。 +- 每个库新的观察者,这是开发人员兴趣的指示器。 + +### 查看信息图表并告诉我们你的想法!在你的同龄人中是怎么选择你使用的语言的? ### + +![](http://www.loggly.com/wp-content/uploads/2015/04/Most-Popular-Languages-According-to-GitHub-Since-2012-loggly-infographic_v3.png) + +-------------------------------------------------------------------------------- + +via: https://www.loggly.com/blog/the-most-popular-programming-languages-in-to-github-since-2012/ + +作者:[Justin Mares][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.loggly.com/blog/author/guest/ +[1]:https://www.githubarchive.org/ +[2]:http://githut.info/ \ No newline at end of file diff --git a/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--1.md b/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--1.md new file mode 100644 index 0000000000..45ccd2208a --- /dev/null +++ b/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--1.md @@ -0,0 +1,238 @@ +安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(一) +================================================================================ +CentOS 是一个工业标准的 Linux 发行版,是红帽企业版 Linux 的衍生版本。你安装完后马上就可以使用,但是为了更好地使用你的系统,你需要进行一些升级、安装新的软件包、配置特定服务和应用程序等操作。 + +这篇文章介绍了 “安装完 RHEL/CentOS 7 后需要做的 30 件事情”。阅读帖子的时候请先完成 RHEL/CentOS 最小化安装,这是首选的企业和生产环境。如果还没有,你可以按照下面的指南,它会告诉你两者的最小化安装方法。 + +- [最小化安装 CentOS 7][1] +- [最小化安装 RHEL 7][2] + +我们会基于工业标准的需求来介绍以下列出的这些重要工作。我们希望这些东西在你配置服务器的时候能有所帮助。 + +1. 注册并启用红帽订阅 +2. 使用静态 IP 地址配置网络 +3. 设置服务器的主机名称 +4. 更新或升级最小化安装的 CentOS +5. 安装命令行 Web 浏览器 +6. 安装 Apache HTTP 服务器 +7. 安装 PHP +8. 安装 MariaDB 数据库 +9. 安装并配置 SSH 服务器 +10. 安装 GCC (GNU 编译器集) +11. 安装 Java +12. 安装 Apache Tomcat +13. 安装 Nmap 检查开放端口 +14. 配置防火墙 +15. 安装 Wget +16. 安装 Telnet +17. 安装 Webmin +18. 启用第三方库 +19. 安装 7-zip 工具 +20. 安装 NTFS-3G 驱动 +21. 安装 Vsftpd FTP 服务器 +22. 安装和配置 sudo +23. 安装并启用 SELinux +24. 安装 Rootkit Hunter +25. 安装 Linux Malware Detect (LMD) +26. 用 Speedtest-cli 测试服务器带宽 +27. 配置 Cron 作业 +28. 安装 Owncloud +29. 启用 VirtualBox 虚拟化 +30. 用密码保护 GRUB + +### 1. 注册并启用红帽订阅 ### + +RHEL 7 最小化安装完成后,就应该注册并启用系统红帽订阅库, 并执行一个完整的系统更新。这只当你有一个可用的红帽订阅时才能有用。你要注册才能启用官方红帽系统库,并时不时进行操作系统更新。(LCTT 译注:订阅服务是收费的) + +在下面的指南中我们已经包括了一个如何注册并激活红帽订阅的详细说明。 + +- [在 RHEL 7 中注册并启用红帽订阅][3] + +**注意**: 这一步仅适用于有一个有效订阅的红帽企业版 Linux。如果你用的是 CentOS 服务器,请查看后面的章节。 + +### 2. 使用静态 IP 地址配置网络 ### + +你第一件要做的事情就是为你的 CentOS 服务器配置静态 IP 地址、路由以及 DNS。我们会使用 ip 命令代替 ifconfig 命令。当然,ifconfig 命令对于大部分 Linux 发行版来说还是可用的,还能从默认库安装。 + + # yum install net-tools [它提供 ifconfig 工具,如果你不习惯 ip 命令,还可以使用它] + +![在 Linux 上安装 ifconfig](http://www.tecmint.com/wp-content/uploads/2015/04/Install-ifconfig.jpeg) + +(LCTT 译注:关于 ip 命令的使用,请参照:http://www.linux.cn/article-3631-1.html ) + +但正如我之前说,我们会使用 ip 命令来配置静态 IP 地址。所以,确认你首先检查了当前的 IP 地址。 + + # ip addr show + +![在 CentOS 查看 IP 地址](http://www.tecmint.com/wp-content/uploads/2015/04/Check-IP-Address.jpeg) + +现在用你的编辑器打开并编辑文件 /etc/sysconfig/network-scripts/ifcfg-enp0s3 (LCTT 译注:你的网卡名称可能不同,如果希望修改为老式网卡名称,参考:http://www.linux.cn/article-4045-1.html )。这里,我使用 vi 编辑器,另外你要确保你是 root 用户才能保存更改。 + + # vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 + +我们会编辑文件中的四个地方。注意下面的四个地方并保证不碰任何其它的东西。也保留双引号,在它们中间输入你的数据。 + + IPADDR = "[在这里输入你的静态 IP]" + GATEWAY = "[输入你的默认网关]" + DNS1 = "[你的DNS 1]" + DNS2 = "[你的DNS 2]" + +更改了 ‘ifcfg-enp0s3’ 之后,它看起来像下面的图片。注意你的 IP,网关和 DNS 可能会变化,请和你的 ISP(译者注:互联网服务提供商,即给你提供接入的服务的电信或 IDC) 确认。保存并退出。 + +![网络详情](http://www.tecmint.com/wp-content/uploads/2015/04/Network-Details.jpeg) + +*网络详情* + +重启网络服务并检查 IP 是否和分配的一样。如果一切都顺利,用 Ping 查看网络状态。 + + # service network restart + +![重启网络服务](http://www.tecmint.com/wp-content/uploads/2015/04/Restarat-Network.jpeg) + +*重启网络服务* + +重启网络后,确认检查了 IP 地址和网络状态。 + + # ip addr show + # ping -c4 google.com + +![验证 IP 地址](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-IP-Address.jpeg) + +*验证 IP 地址* + +![检查网络状态](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Network-Status.jpeg) + +*检查网络状态* + +(LCTT 译注:关于设置静态 IP 地址的更多信息,请参照:http://www.linux.cn/article-3977-1.html ) + +### 3. 设置服务器的主机名称 ### + +下一步是更改 CentOS 服务器的主机名称。查看当前分配的主机名称。 + + # echo $HOSTNAME + +![查看系统主机名称](http://www.tecmint.com/wp-content/uploads/2015/04/Check-System-Hostname.jpeg) + +*查看系统主机名称* + +要设置新的主机名称,我们需要编辑 ‘/etc/hostsname’ 文件并用想要的名称替换旧的主机名称。 + + # vi /etc/hostname + +![在 CentOS 中设置主机名称](http://www.tecmint.com/wp-content/uploads/2015/04/Set-System-Hostname.jpeg) + +*在 CentOS 中设置主机名称* + +设置完了主机名称之后,务必注销后重新登录确认主机名称。登录后检查新的主机名称。 + + $ echo $HOSTNAME + +![确认主机名称](http://www.tecmint.com/wp-content/uploads/2015/04/Confirm-Hostname.jpeg) + +*确认主机名称* + +你也可以用 ‘hostname’ 命令查看你当前的主机名。 + + $ hostname + +(LCTT 译注:关于设置静态、瞬态和灵活主机名的更多信息,请参考:http://www.linux.cn/article-3937-1.html ) + +### 4. 更新或升级最小化安装的 CentOS ### + +这样做除了更新安装已有的软件最新版本以及安全升级,不会安装任何新的软件。总的来说更新(update)和升级(upgrade)是相同的,除了事实上 升级 = 更新 + 更新时进行废弃处理。 + + # yum update && yum upgrade + +![更新最小化安装的 CentOS 服务器](http://www.tecmint.com/wp-content/uploads/2015/04/Update-CentOS-Server.jpeg) + +*更新最小化安装的 CentOS 服务器* + +**重要**: 你也可以运行下面的命令,这不会弹出软件更新的提示,你也就不需要输入 ‘y’ 接受更改。 + +然而,查看服务器上会发生的变化总是一个好主意,尤其是在生产中。因此使用下面的命令虽然可以为你自动更新和升级,但并不推荐。 + + # yum -y update && yum -y upgrade + +### 5. 安装命令行 Web 浏览器 ### + +大部分情况下,尤其是在生产环境中,我们通常用没有 GUI 的命令行安装 CentOS,在这种情况下我们必须有一个能通过终端查看网站的命令行浏览工具。为了实现这个目的,我们打算安装名为 ‘links’ 的著名工具。 + + # yum install links + +![安装命令行浏览器](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Commandline-Browser.jpeg) + +*Links: 命令行 Web 浏览器* + +请查看我们的文章 [用 links 工具命令行浏览 Web][4] 了解用 links 工具浏览 web 的方法和例子。 + +### 6. 安装 Apache HTTP 服务器 ### + +不管你因为什么原因使用服务器,大部分情况下你都需要一个 HTTP 服务器运行网站、多媒体、用户端脚本和很多其它的东西。 + + # yum install httpd + +![在 CentOS 上安装 Apache](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Apache-on-CentOS.jpeg) + +*安装 Apache 服务器* + +如果你想更改 Apache HTTP 服务器的默认端口号(80)为其它端口,你需要编辑配置文件 ‘/etc/httpd/conf/httpd.conf’ 并查找以下面开始的行: + + LISTEN 80 + +把端口号 ‘80’ 改为其它任何端口(例如 3221),保存并退出。 + +![在 CentOS 上更改 Apache 端口](http://www.tecmint.com/wp-content/uploads/2015/04/Change-Apache-Port.jpeg) + +*更改 Apache 端口* + +增加刚才分配给 Apache 的端口通过防火墙,然后重新加载防火墙。 + +允许 http 服务通过防火墙(永久)。 + + # firewall-cmd –add-service=http + +允许 3221 号端口通过防火墙(永久)。 + + # firewall-cmd –permanent –add-port=3221/tcp + +重新加载防火墙。 + + # firewall-cmd –reload + +(LCTT 译注:关于 firewall 的进一步使用,请参照:http://www.linux.cn/article-4425-1.html ) + +完成上面的所有事情之后,是时候重启 Apache HTTP 服务器了,然后新的端口号才能生效。 + + # systemctl restart httpd.service + +现在添加 Apache 服务到系统层使其随系统自动启动。 + + # systemctl start httpd.service + # systemctl enable httpd.service + +(LCTT 译注:关于 systemctl 的进一步使用,请参照:http://www.linux.cn/article-3719-1.html ) + +如下图所示,用 links 命令行工具 验证 Apache HTTP 服务器。 + + # links 127.0.0.1 + +![验证 Apache 状态](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-Apache-Status.jpeg) + +*验证 Apache 状态* + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[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/centos-7-installation/ +[2]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ +[3]:http://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/ +[4]:http://www.tecmint.com/command-line-web-browsers/ \ No newline at end of file diff --git a/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--2.md b/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--2.md new file mode 100644 index 0000000000..6eeff54bae --- /dev/null +++ b/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--2.md @@ -0,0 +1,154 @@ +安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(二) +================================================================================ +### 7. 安装 PHP ### + +PHP 是用于 web 基础服务的服务器端脚本语言。它也经常被用作通用编程语言。在最小化安装的 CentOS 中安装 PHP: + + # yum install php + +安装完 php 之后,确认重启 Apache 服务以便在 Web 浏览器中渲染 PHP。 + + # systemctl restart httpd.service + +下一步,通过在 Apache 文档根目录下创建下面的 php 脚本验证 PHP。 + + # echo -e "" > /var/www/html/phpinfo.php + +现在在 Linux 命令行中查看我们刚才创建的 PHP 文件(phpinfo.php)。 + + # php /var/www/html/phpinfo.php + 或者 + # links http://127.0.0.1/phpinfo.php + +![验证 PHP](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-PHP.jpeg) + +*验证 PHP* + +### 8. 安装 MariaDB 数据库 ### + +MariaDB 是 MySQL 的一个分支。RHEL 以及它的衍生版已经从 MySQL 迁移到 MariaDB。这是一个主流的数据库管理系统,也是一个你必须拥有的工具。不管你在配置怎样的服务器,或迟或早你都会需要它。在最小化安装的 CentOS 上安装 MariaDB,如下所示: + + # yum install mariadb-server mariadb + +![安装 MariaDB 数据库](http://www.tecmint.com/wp-content/uploads/2015/04/Install-MariaDB-Database.jpeg) + +*安装 MariaDB 数据库* + +启动 MariaDB 并配置它开机时自动启动。 + + # systemctl start mariadb.service + # systemctl enable mariadb.service + +允许 mysql(mariadb) 服务通过防火墙(LCTT 译注:如果你的 MariaDB 只用在本机,则务必不要设置防火墙允许通过,使用 UNIX Socket 连接你的数据库;如果需要在别的服务器上连接数据库,则尽量使用内部网络,而不要将数据库服务暴露在公开的互联网上。) + + # firewall-cmd –add-service=mysql + +现在是时候确保 MariaDB 服务器安全了(LCTT 译注:这个步骤主要是设置 mysql 管理密码)。 + + # /usr/bin/mysql_secure_installation + +![保护 MariaDB 数据库](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-MariaDB.jpeg) + +*保护 MariaDB 数据库* + +请阅读: + +- [在 CentOS 7.0 上安装 LAMP (Linux, Apache, MariaDB, PHP/PhpMyAdmin)][1] +- [在 CentOS 7.0 上创建 Apache 虚拟主机][2] + +### 9. 安装和配置 SSH 服务器 ### + +SSH 即 Secure Shell,是 Linux 远程管理的默认协议。 SSH 是随最小化 CentOS 服务器中安装运行的最重要的软件之一。 + +检查当前已安装的 SSH 版本。 + + # SSH -V + +![检查 SSH 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-SSH-Version.jpeg) + +*检查 SSH 版本* + +使用更安全的 SSH 协议,而不是默认的协议,并更改端口号进一步加强安全。编辑 SSH 的配置文件 ‘/etc/ssh/ssh_config’。 + +去掉下面行的注释或者从协议行中删除 1,然后行看起来像这样(LCTT 译注: SSH v1 是过期废弃的不安全协议): + + # Protocol 2,1 (原来) + Protocol 2 (现在) + +这个改变强制 SSH 使用 协议 2,它被认为比协议 1 更安全,同时也确保在配置中更改端口号 22 为其它。 + +![保护 SSH 登录](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-SSH.jpeg) + +*保护 SSH 登录* + +取消 SSH 中的‘root login’, 只允许通过普通用户账号登录后才能使用 su 切换到 root,以进一步加强安全。请打开并编辑配置文件 ‘/etc/ssh/sshd_config’ 并更改 PermitRootLogin yes 为 PermitRootLogin no。 + + # PermitRootLogin yes (原来) + PermitRootLogin no (现在) + +![取消 SSH Root 登录](http://www.tecmint.com/wp-content/uploads/2015/04/Disable-SSH-Root-Login.jpeg) + +*取消 SSH Root 直接登录* + +最后,重启 SSH 服务启用更改。 + + # systemctl restart sshd.service + +请查看: + +- [加密和保护 SSH 服务器的 5 个最佳实践][3] +- [5 个简单步骤实现使用 SSH Keygen 无密码登录 SSH][4] +- [在 PuTTY 中实现 “无密码 SSH 密钥验证”][5] + +### 10. 安装 GCC (GNU 编译器集) ### + +GCC 即 GNU 编译器集,是一个 GNU 项目开发的支持多种编程语言的编译系统(LCTT 译注:在你需要自己编译构建软件时需要它)。在最小化安装的 CentOS 没有默认安装。运行下面的命令安装 gcc 编译器。 + + # yum install gcc + +![在 CentOS 上安装 GCC](http://www.tecmint.com/wp-content/uploads/2015/04/Install-GCC-in-CentOS.jpeg) + +*在 CentOS 上安装 GCC* + +检查安装的 gcc 版本。 + + # gcc --version + +![检查 GCC 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-GCC-Version.jpeg) + +*检查 GCC 版本* + +### 11. 安装 Java ### + +Java是一种通用的基于类的,面向对象的编程语言。在最小化 CentOS 服务器中没有默认安装(LCTT 译注:如果你没有任何 Java 应用,可以不用装它)。按照下面命令从库中安装 Java。 + + # yum install java + +![在 CentOS 上安装 Java](http://www.tecmint.com/wp-content/uploads/2015/04/Install-java.jpeg) + +*安装 Java* + +检查安装的 Java 版本。 + + # java -version + +![检查 Java 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Java-Version.jpeg) + +*检查 Java 版本* + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/2/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[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/install-lamp-in-centos-7/ +[2]:http://www.tecmint.com/apache-virtual-hosting-in-centos/ +[3]:http://www.tecmint.com/5-best-practices-to-secure-and-protect-ssh-server/ +[4]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/ +[5]:http://www.tecmint.com/ssh-passwordless-login-with-putty/ \ No newline at end of file diff --git a/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--3.md b/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--3.md new file mode 100644 index 0000000000..318d38b03c --- /dev/null +++ b/published/201504/30 Things to Do After Minimal RHEL or CentOS 7 Installation--3.md @@ -0,0 +1,277 @@ +安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(三) +================================================================================ +### 12. 安装 Apache Tomcat ### + +Tomcat 是由 Apache 设计的用来运行 Java HTTP web 服务器的 servlet 容器。按照下面的方法安装 tomcat,但需要指出的是安装 tomcat 之前必须先安装 Java。 + + # yum install tomcat + +![安装 Apache Tomcat](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Apache-Tomcat.jpeg) + +*安装 Apache Tomcat* + +安装完 tomcat 之后,启动 tomcat 服务。 + + # systemctl start tomcat + +查看 tomcat 版本。 + + # /usr/sbin/tomcat version + +![查看 tomcat 版本](http://www.tecmint.com/wp-content/uploads/2015/04/Check-tomcat-version.jpeg) + +*查看 tomcat 版本* + +允许 tomcat 服务和默认端口(8080) 通过防火墙并重新加载设置。 + + # firewall-cmd –zone=public –add-port=8080/tcp --permanent + # firewall-cmd –reload + +现在该保护 tomcat 服务器了,添加一个用于访问和管理的用户和密码。我们需要编辑文件 ‘/etc/tomcat/tomcat-users.xml’。查看类似下面的部分: + + + .... + + + + + + + + + + + + +![保护 Tomcat](http://www.tecmint.com/wp-content/uploads/2015/04/Secure-Tomcat.jpeg) + +*保护 Tomcat* + +我们在这里添加用户 “tecmint” 到 tomcat 的管理员/管理组中,使用 “tecmint” 作为密码。先停止再启动 tomcat 服务以使更改生效,并添加 tomcat 服务到随系统启动。 + + # systemctl stop tomcat + # systemctl start tomcat + # systemctl enable tomcat.service + +请阅读: [在 RHEL/CentOS 7.0/6.x 中安装和配置 Apache Tomcat 8.0.9][5] + +### 13. 安装 Nmap 监视开放端口 ### + +Nmap 网络映射器用来分析网络,通过运行它可以发现网络的映射关系。nmap 并没有默认安装,你需要从库中安装它。 + + # yum install nmap + +![安装 Nmap 监视工具](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Nmap.jpeg) + +*安装 Nmap 监视工具* + +列出主机中所有的开放端口以及对应使用它们的服务。 + + # namp 127.0.01 + +!监视开放端口](http://www.tecmint.com/wp-content/uploads/2015/04/Monitor-Open-Ports.jpeg) + +*监视开放端口* + +你也可以使用 firewall-cmd 列出所有端口,但我发现 nmap 更有用。 + + # firewall-cmd –list-ports + +![在防火墙中检查开放端口](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Open-Ports-in-Firewall.jpeg) + +*在防火墙中检查开放端口* + +请阅读: [Nmap 监视开放端口的 29 个有用命令][1] + +### 14. 配置 FirewallD ### + +firewalld 是动态管理服务器的防火墙服务。在 CentOS 7 中 Firewalld 移除了 iptables 服务。在红帽企业版 Linux 和它的衍生版中默认安装了 Firewalld。如果有 iptables 的话为了使每个更改生效需要清空所有旧的规则然后创建新规则。 + +然而用firewalld,不需要清空并重新创建新规则就可以实现更改生效。 + +检查 Firewalld 是否运行。 + + # systemctl status firewalld + 或 + # firewall-cmd –state + +![检查 Firewalld 状态](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Firewalld-Status.jpeg) + +*检查 Firewalld 状态* + +获取所有的区域列表。 + + # firewall-cmd --get-zones + +![检查 Firewalld 区域](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Firewalld-Zones.jpeg) + +*检查 Firewalld 区域* + +在切换之前先获取区域的详细信息。 + + # firewall-cmd --zone=work --list-all + +![检查区域详情](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Zone-Details.jpeg) + +*检查区域详情* + +获取默认区域。 + + # firewall-cmd --get-default-zone + +![Firewalld 默认区域](http://www.tecmint.com/wp-content/uploads/2015/04/Firewalld-Default-Zone.jpeg) + +*Firewalld 默认区域* + +切换到另一个区域,比如 ‘work’。 + + # firewall-cmd --set-default-zone=work + +![切换 Firewalld 区域](http://www.tecmint.com/wp-content/uploads/2015/04/Swich-Zones.jpeg) + +*切换 Firewalld 区域* + +列出区域中的所有服务。 + + # firewall-cmd --list-services + +![列出 Firewalld 区域的服务](http://www.tecmint.com/wp-content/uploads/2015/04/List-Firewalld-Service.jpeg) + +*列出 Firewalld 区域的服务* + +添加临时服务,比如 http,然后重载 firewalld。 + + # firewall-cmd --add-service=http + # firewall-cmd –reload + +![添加临时 http 服务](http://www.tecmint.com/wp-content/uploads/2015/04/Add-http-Service-Temporarily.jpeg) + +*添加临时 http 服务* + +添加永久服务,比如 http,然后重载 firewalld。 + + # firewall-cmd --add-service=http --permanent + # firewall-cmd --reload + +![添加永久 http 服务](http://www.tecmint.com/wp-content/uploads/2015/04/Add-http-Service-Temporarily.jpeg) + +*添加永久 http 服务* + +删除临时服务,比如 http。 + + # firewall-cmd --remove-service=http + # firewall-cmd --reload + +![删除临时 Firewalld 服务](http://www.tecmint.com/wp-content/uploads/2015/04/Add-http-Service-Permanent.jpeg) + +*删除临时 Firewalld 服务* + +删除永久服务,比如 http + + # firewall-cmd --zone=work --remove-service=http --permanent + # firewall-cmd --reload + +![删除永久服务](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Service-Parmanently.jpeg) + +*删除永久服务* + +允许一个临时端口(比如 331)。 + + # firewall-cmd --add-port=331/tcp + # firewall-cmd --reload + +![打开临时 Firewalld 端口](http://www.tecmint.com/wp-content/uploads/2015/04/Open-Port-Temporarily.jpeg) + +*打开临时端口* + +允许一个永久端口(比如 331)。 + + # firewall-cmd --add-port=331/tcp --permanent + # firewall-cmd --reload + +![打开永久 Firewalld 端口](http://www.tecmint.com/wp-content/uploads/2015/04/Open-Port-Permanent.jpeg) + +*打开永久端口* + +阻塞/移除临时端口(比如 331)。 + + # firewall-cmd --remove-port=331/tcp + # firewall-cmd --reload + +![移除 Firewalld 临时端口](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Port-Temporarily.jpeg) + +*移除临时端口* + +阻塞/移除永久端口(比如 331)。 + + # firewall-cmd --remove-port=331/tcp --permanent + # firewall-cmd --reload + +![移除 Firewalld 永久端口](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Port-Permanently.jpeg) + +*移除永久端口* + +停用 firewalld。 + + # systemctl stop firewalld + # systemctl disable firewalld + # firewall-cmd --state + +![在 CentOS 7 中停用 Firewalld](http://www.tecmint.com/wp-content/uploads/2015/04/Disable-Firewalld.jpeg) + +*停用 Firewalld 服务* + +启用 firewalld。 + + # systemctl enable firewalld + # systemctl start firewalld + # firewall-cmd --state + +![在 CentOS 7 中取消 Firewalld](http://www.tecmint.com/wp-content/uploads/2015/04/Enable-Firewalld.jpeg) + +*启用 Firewalld* + +- [如何在 RHEL/CentOS 7 中配置 ‘Firewalld’][2] +- [配置和管理 Firewalld 的有用 ‘Firewalld’ 规则][3] + +### 15. 安装 Wget ### + +Wget 是从 web 服务器获取(下载)内容的命令行工具。它是你使用 wget 命令获取 web 内容或下载任何文件必须要有的重要工具。 + + # yum install wget + +![安装 Wget 工具](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Wget.png) + +*安装 Wget 工具* + +关于在终端中如何使用 wget 命令下载文件的方法和实际例子,请阅读[10 个 Wget 命令例子][4]。 + +### 16. 安装 Telnet 客户端### + +Telnet 是通过 TCP/IP 允许用户登录到相同网络上的另一台计算机的网络协议。和远程计算机的连接建立后,它就成为了一个允许你在自己的计算机上用所有提供给你的权限和远程主机交互的虚拟终端。(LCTT 译注:除非你真的需要,不要安装 telnet 服务,也不要用 telnet 客户端连接另外一个 telnet 服务,因为 telnet 是明文传输的。不过如下用 telnet 客户端检测另外一个服务的端口是否工作是常用的操作。) + +Telnet 对于检查远程计算机或主机的监听端口也非常有用。 + + # yum install telnet + # telnet google.com 80 + +![Telnet 端口检查](http://www.tecmint.com/wp-content/uploads/2015/04/telnet-testing.png) + +*Telnet 端口检查* + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/3/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://linux.cn/article-2561-1.html +[2]:http://linux.cn/article-4425-1.html +[3]:http://www.tecmint.com/firewalld-rules-for-centos-7/ +[4]:http://linux.cn/article-4129-1.html +[5]:http://www.tecmint.com/install-apache-tomcat-in-centos/ \ No newline at end of file diff --git a/published/201504/Debian 8 Jessie released.md b/published/201504/Debian 8 Jessie released.md new file mode 100644 index 0000000000..48167b6712 --- /dev/null +++ b/published/201504/Debian 8 Jessie released.md @@ -0,0 +1,88 @@ +Debian 8 "Jessie" 发布 +===================================================== + +**2015年4月25日** ,在经历了近24个月的持续开发之后,Debian 项目自豪地宣布最新的稳定版本8的发布(代号 “**Jessie**” ),归功于[Debian安全团队][1]和[Debian长期支持][2]团队的工作,该版本将在接下来的5年内获得支持。 + +![Debian](http://i1-news.softpedia-static.com/images/news2/Debian-GNU-Linux-8-Jessie-Has-Been-Officially-Released-Download-Now-479331-2.jpg) + +“**Jessie**” 与新的默认 init 系统 `systemd` 一同到来。`systemd` 套件提供了许多激动人心的特性,如更快的启动速度、系统服务的 cgroups 支持、以及独立出部分服务的可能性。不过,`sysvinit` init系统在 “**Jessie**” 中依然可用。 + +在 “**Wheezy**” 中引入的 UEFI 支持(*“Unified Extensible Firmware Interface”*,统一的可扩展固件接口)同样在 “**Jessie**” 中得到了大幅改进。其中包含了许多已知固件 bug 的临时性解决方案,支持32位系统上的UEFI,也支持64位内核运行在32位 UEFI 固件上(后者仅被包含在我们的 `amd64/i386` “multi-arch” 安装介质中)。 + +自上个版本发布以来,Debian 项目的成员同样对我们的支持服务做出了重要改进。其中之一是[可浏览所有 Debian 的源码][3],该服务目前放在 [sources.debian.net][4]。当然,在超过20000个源码包里想要找到正确的文件确实令人望而生畏。因此,我们同样十分高兴地上线 [Debian 代码搜索][5],它放在 [codesearch.debian.net][6]。这两项服务都由一个完全重写并且更加反应敏捷的[包追踪系统][7]提供。 + +该版本包含大量的软件包更新,如: + +* Apache 2.4.10 +* Asterisk 11.13.1 +* GIMP 2.8.14 +* 一个GNOME桌面环境 3.14 的升级版本 +* GCC 编译器 4.9.2 +* Icedove 31.6.0 (一个 Mozilla Thunderbird 的再发布版本) +* Iceweasel 31.6.0esr (一个 Mozilla Firefox 的再发布版本) +* KDE Plasma Workspaces 和 KDE Applications 4.11.13 +* LibreOffice 4.3.3 +* Linux 3.16.7-ctk9 +* MariaDB 10.0.16 和 MySQL 5.5.42 +* Nagios 3.5.1 +* OpenJDK 7u75 +* Perl 5.20.2 +* PHP 5.6.7 +* PostgreSQL 9.4.1 +* Python 2.7.9 和 3.4.2 +* Samba 4.1.17 +* Tomcat 7.0.56 和 8.0.14 +* Xen Hypervisor 4.4.1 +* Xfce 4.10桌面环境 +* 超过43000个其它可供使用的软件包,从将近20100个源码包编译而来 + +与如此之多的软件包选择和照例的广泛架构支持,Debian 再次向它的目标:成为通用操作系统迈出正确的一步。Debian 适用于各种不同情形:从桌面系统到上网本;从开发服务器到集群系统;以及数据库,web,或存储服务器。同时,在此基础之上的质量保证工作,如对 Debian 上所有包的自动安装和升级测试,让 “**Jessie**” 可以满足用户拥有一个稳定的 Debian 版本的高期望值。 + +总共支持十种架构:32位PC/Intel IA-32(`i386`),64位PC/Intel EM64T / x86-64 (`amd64`),Motorola/IBM PowerPC (旧硬件的`powerpc`和新的64位`ppc64el`(little-endian)),MIPS (`mips` 大端和 `mipsel`小端),IBM S/390 (64位 `s390x`)以及 ARM 新老32位硬件的`armel`和`armhf`,加上给新64位 *“AArch64”* 架构的`arm64`。 + +### 想尝试一下? ### + +如果你仅仅是想在不安装的情况下体验 Debian 8 “**Jessie**”,你可以使用一个特殊的镜像,即 live 镜像,可以用在 CD,U 盘以及网络启动设置上。最先只有 `amd64` 和 `i386` 架构提供这些镜像。Live 镜像同样可以用来安装 Debian。更多信息请访问 [Debian Live 主页][8]。 + +但是如果你想安装 Debian 到你的计算机的话,有不少安装媒介可供你选择,如蓝光碟,DVD,CD 以及 U 盘,或者从网络安装。有几种桌面环境:GNOME,KDE Plasma 桌面及 Plasma 应用,Xfce 以及 LXDE,它们可以从CD镜像中安装,也可以从 CD/DVD 的启动菜单里选择想要的桌面环境。另外,同样提供了多架构 CD 和 DVD,可以从单一磁盘选择安装不同架构的系统。或者你还可以创建可启动 U 盘安装媒介(参看[安装指南][9]获得更多细节)。对云用户,Debian 还提供了[预构建 OpenStack 镜像][10]可供使用。 + +安装镜像现在同样可以通过 [bittorrent][11](推荐下载方式),[jigdo][12] 或 [HTTP][13] 下载,查看[Debian 光盘][14]获得更进一步的信息。“**Jessie**” 不久将提供实体 DVD,CD-ROM,以及无数[供应商][15]的蓝光碟。 + +### 升级 Debian ### + +如果从前一个版本 Debian 7(代号 “**Wheezy**” )升级到 Debian 8,大部分配置情况 apt-get 包管理工具都能够自动解决。Debian 系统一如既往地能够就地无痛升级,无需强制停机。强烈推荐阅读[发行注记][16]和[安装指南][17]来了解可能存在的问题,并了解安装和升级建议。发行注记会在发布后的几周内进一步改进,并翻译成其他语言。 + +## 关于 Debian ## + +Debian 是一个自由操作系统,由成千上万来自全世界的志愿者通过互联网协作开发。Debian 项目的关键力量是它的志愿者基础,它对 Debian 社群契约和自由软件的贡献,以及对提供最好的操作系统可能的承诺。Debian 8是其前进方向上又一重要一步。 + +## 联系信息 ## + +获取更多信息,请访问 Debian 主页 [https://www.debian.org/][18] 或发送电子邮件至。 + +-------------------------------------------------------------------------------- + +via: https://www.debian.org/News/2015/20150426 + +译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://security-team.debian.org/ +[2]:https://wiki.debian.org/LTS +[3]:https://www.debian.org/News/weekly/2013/14/#sources +[4]:https://sources.debian.net/ +[5]:https://www.debian.org/News/weekly/2014/17/#DCS +[6]:https://codesearch.debian.net/ +[7]:https://tracker.debian.org/ +[8]:http://live.debian.net/ +[9]:https://www.debian.org/releases/jessie/installmanual +[10]:http://cdimage.debian.org/cdimage/openstack/current/ +[11]:https://www.debian.org/CD/torrent-cd/ +[12]:https://www.debian.org/CD/jigdo-cd/#which +[13]:https://www.debian.org/CD/http-ftp/ +[14]:https://www.debian.org/CD/ +[15]:https://www.debian.org/CD/vendors +[16]:https://www.debian.org/releases/jessie/releasenotes +[17]:https://www.debian.org/releases/jessie/installmanual +[18]:https://www.debian.org/ diff --git a/published/201504/GNOME-Pie 0.6 Application Launcher Released.md b/published/201504/GNOME-Pie 0.6 Application Launcher Released.md new file mode 100644 index 0000000000..199d13f1a6 --- /dev/null +++ b/published/201504/GNOME-Pie 0.6 Application Launcher Released.md @@ -0,0 +1,52 @@ +GNOME-Pie 0.6.1 应用启动器发布,酷炫新特性[多图+视频] +============================================= + +**Simon Schneegans 高兴地[宣布][1]他的 GNOME-Pie 0.6.1 已可供下载使用。GNOME-Pie 是一个可以在包括 GNOME 和 Unity 在内的多种桌面环境中作为应用启动器的小工具。** + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-3.jpg) + +GNOME-Pie 0.6.1 看起来是个主要版本更新,引入了许多新特性,比如支持半个或四分之一圆,可选择每个启动器想要的形状,也可以自动根据位置调整形状(圆形,半个或四分之一圆),以及多彩的动态图标。 + +此外,软件现在还适配若干类dock应用,包括elementary OS 的 Plank,Ubuntu 的 Unity,以及通用的 Docky。一些已有的 GNOME-Pie 主题也已更新,还引入了全新的为半圆启动器布局设计的主题 Simple,。 + +“Gnome-Pie 新版本已发布,实际上已经发布了两个版本:0.6.0和之后的0.6.1,修复了[issue #73][2],”Simon Schneegans 在发布声明上说道,“新版本修复了许多 bug,还带来了许多新特性!” + + + +### 现在就可在Ubuntu上安装GNOME-Pie ### + +Ubuntu 及其衍生版用户现在就可通过 Simon Schneegans 的PPA源安装 GNOME-Pie。只需打开终端,运行下列命令即可。GNOME-Pie 适用于 Ubuntu 14.04 LTS,14.10和15.04。 + + sudo add-apt-repository ppa:simonschneegans/testing + sudo apt-get update + sudo apt-get install gnome-pie + + +其他 GNU/Linux 发行版用户可以从官网下载 GNOME-Pie 0.6.1 的源代码,或者近期在系统的软件源中搜索新版GNOME-Pie。 + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-2.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-4.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-5.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-6.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-7.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-8.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-9.jpg) + +![GNOME-Pie](http://i1-news.softpedia-static.com/images/news2/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914-10.jpg) + +-------------------------------------------------- + +via: http://news.softpedia.com/news/GNOME-Pie-0-6-Application-Launcher-Released-with-Many-New-Features-Video-478914.shtml + +译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://simmesimme.github.io/news/2015/04/18/gnome-pie-061/ +[2]:https://github.com/Simmesimme/Gnome-Pie/issues/73 diff --git a/translated/tech/How to create a custom backup plan for Debian with backupninja.md b/published/201504/How to create a custom backup plan for Debian with backupninja.md similarity index 67% rename from translated/tech/How to create a custom backup plan for Debian with backupninja.md rename to published/201504/How to create a custom backup plan for Debian with backupninja.md index 50cd15c6ce..cfd0237c92 100644 --- a/translated/tech/How to create a custom backup plan for Debian with backupninja.md +++ b/published/201504/How to create a custom backup plan for Debian with backupninja.md @@ -1,21 +1,21 @@ 使用backupninja为Debian定制备份计划 -======= +============ -backupninja是Debian系统(以及基于Debian的发行版)中一个强大的、高度可配置的备份软件。在[前一篇文章][1]中,我们探讨了如何安装backupninja以及如何设置两个备份操作并执行。然而,那些只是冰山一角。这一次,我们要讨论如何利用Helper与辅助功能,可以使用这些功能定制策略以完成任何备份需要。 +backupninja是Debian系统(以及基于Debian的发行版)中一个强大的、高度可配置的备份软件。在[前一篇文章][1]中,我们探讨了如何安装backupninja以及如何设置两个备份操作并执行。然而,那些只是冰山一角。这一次,我们要讨论如何定制 Handler 和 Helper ,使用这些功能定制策略以完成任何备份需要。 ###回顾 backupninja -backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软件自己会搞定。另外,我们可以编写自定义脚本(又叫 “handlers”)放在/usr/share/backupninja 目录下来完成不同类型的备份操作。此外,可以通过ninjahelper的基于ncurses的交互式菜单(又叫”helpers")来指导我们创建一些配置文件,使得人工错误率降到最低。 +backupninja的一个独特的地方是它可以完全抛弃/etc/backup.d中的纯文本配置文件和操作文件,软件自己会搞定。另外,我们可以编写自定义脚本(又叫 “handler”)放在/usr/share/backupninja 目录下来完成不同类型的备份操作。此外,可以通过ninjahelper的基于ncurses的交互式菜单(又叫“helper”)来指导我们创建一些配置文件,使得人工错误降到最低。 ###创建定制的Handler与Helper 这一节的目标是创建一个脚本,将home目录以**gzip**或**bzip2**压缩包的形式备份起来,不包括音乐与视频文件。我们将这个文件命名为home,将它放在/usr/backup/ninja目录下。 -尽管你可以使用默认的tar handler(参考 /usr/share/backupninja/tar 与 /usr/share/backupninja/tar.helper)来达到这个效果,但是我们使用这种方法来展示如何创建实用的 handler 脚本与基于 ncurses 的 helper。你可以根据你的需求来决定如何运用同样的原则。 +尽管你可以使用默认的tar handler(参考 /usr/share/backupninja/tar 与 /usr/share/backupninja/tar.helper)来达到这个效果,但是我们使用这种方法来展示如何创建实用的 handler 脚本与基于 ncurses 的 helper。你可以根据你的需求来决定如何运用这里的方法。 -由于 handlers 来源与主脚本,所以无需以#!/bin/bash开始。 +由于 handlers 来源于主脚本,所以无需以#!/bin/bash开始的释伴行(shebang line)。 -我们推荐的 handler (/usr/share/backupninja/home)如下所示。它带有非常多的注释说明。getconf 功能用来读取备份操作的配置文件。如果你指定了一个变量的值,那么它会覆盖配置文件中对应变量的值: +我们编写的 handler (/usr/share/backupninja/home)如下所示。已经详细注释了。getconf 函数用来读取备份操作的配置文件。如果你指定了一个变量的值,那么它会覆盖配置文件中对应变量的值: #/home 目录 handler 脚本 @@ -34,25 +34,25 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 #不包含 *.mp3 与 *.mp4 文件 getconf excludes - # 默认扩展一打包的备份文件 + # 要打包备份文件的默认扩展名 getconf EXTENSION - # Absolute path to date binary + # tar 程序的绝对路径 getconf TAR `which tar` - # Absolute path to date binary + # date 程序的绝对路径 getconf DATE `which date` # 日期格式 DATEFORMAT="%Y-%m-%d" - # 如果备份目录不存在,以致命错误退出 + # 如果备份目录不存在,以致命错误退出 if [ ! -d "$backupdir" ] then mkdir -p "$backupdir" || fatal "Can not make directory $backupdir" fi - # 如果备份目录不可写, 同样以致命错误退出 + # 如果备份目录不可写,同样以致命错误退出 if [ ! -w "$backupdir" ] then fatal "Directory $backupdir is not writable" @@ -85,7 +85,7 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 exclude_options="$exclude_options --exclude $i" done - # 调试信息, 执行备份操作 + # 调试信息,执行备份操作 debug "Running backup: " $TAR -c -p -v $compress_option $exclude_options \ -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ $includes @@ -100,9 +100,9 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 [ $? -ne 0 ] && fatal "Tar backup failed" -接下来我们将要创建helper文件 (/usr/share/backupninja/home.helper)这样,hendlers将会以菜单的形式在**ninjahelper**中显示: +接下来我们将要创建helper文件(/usr/share/backupninja/home.helper)。这样,hendlers将会以菜单的形式在**ninjahelper**中显示: - # 备份操作描述. 以下划线分割单词. + # 备份操作描述,以下划线分割单词 HELPERS="$HELPERS home:backup_of_home_directories" home_wizard() { @@ -173,7 +173,7 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 $home_includes $home_excludes - # 二进制压缩包,必须为GNU tar + # tar 程序的路径,必须为GNU tar TAR `which tar` DATE `which date` DATEFORMAT "%Y-%m-%d" @@ -186,19 +186,19 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 ###运行 ninjahelper### -当创建了名为home的handler脚本以及对应的名为home.helper的helper后,运行ninjahelper命令创建一个新的备份操作。 +当创建了名为home的handler脚本以及对应的home.helper后,运行ninjahelper命令创建一个新的备份操作。 #ninjahelper -选择 create a new backup action(创建一个新的备份操作). +选择 create a new backup action(创建一个新的备份操作)。 ![](https://farm8.staticflickr.com/7467/15322605273_90edaa5bc1_z.jpg) -接下来将看到可选的操作类型,这里选择“backup of home directories"(备份home目录); +接下来将看到可选的操作类型,这里选择“backup of home directories"(备份home目录): ![](https://farm9.staticflickr.com/8636/15754955450_f3ef82217b_z.jpg) -接下来会显示在helper中设置的默认值(这里只有3个)。可以编辑文本框中的值。注意,关于”when”变量的语法,参考文档的日程安排章节。 +然后会显示在helper中设置的默认值(这里只显示了3个)。可以编辑文本框中的值。注意,关于“when”变量的语法,参考文档的日程安排章节。 ![](https://farm8.staticflickr.com/7508/15941578982_24b680e1c3_z.jpg) @@ -210,9 +210,9 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 ![](https://farm8.staticflickr.com/7534/15942239225_bb66dbdb63.jpg) -按回车键显示这个备份操作的选项。因为它非常简单,可所以我们可以随便对它进行一些实验。 +按回车键显示这个备份操作的选项。因为它非常简单,所以我们可以随便对它进行一些实验。 -注意,“run this action now"(立即运行)选项会不顾日程表安排的时间而立即进行备份操作: +注意,“run this action now"(立即运行)选项会不顾日程表安排的时间而立即进行备份操作: ![](https://farm8.staticflickr.com/7508/15754955470_9af6251096_z.jpg) @@ -220,27 +220,26 @@ backupninja的特点是它完全抛弃纯文本的配置文件/etc/backup.d,软 ![](https://farm9.staticflickr.com/8662/15754955480_487d040fcd_z.jpg) -上面的图片告诉我们,备份操作讲不会成功,因为它所需要链接的远程主机似乎宕机了。另外,在helper文件中指定的目录不存在。当纠正这些问题后,重新开始备份操作。 +上面的图片告诉我们,用于完成备份操作的连接没有建立,因为它所需要链接的远程主机似乎宕机了。另外,在helper文件中指定的目标目录不存在。当纠正这些问题后,重新开始备份操作。 需要牢记的事情: - - 当你新建了一个自定义脚本来处(如foobar)理特殊的备份操作时,那么你还需要编写与之对应的helper(foobar.helper)文件,ninjahelper 将通过它生成名为10.foobar(下一个操作为11,以此类推)的文件,保存在/etc/backup.d目录下,而这个文件才是备份操作的真正的配置文件。 - - 可以通过ninjahelper设定行备份操作的执行时间,或按照”when”变量中设置的频率来执行。 + - 当你在/usr/share/backupninja 下新建了一个自定义脚本(如foobar)来处理特殊的备份操作时,那么你还需要编写与之对应的helper(foobar.helper)文件,ninjahelper 将通过它生成名为10.foobar(下一个操作为11,以此类推)的文件,保存在/etc/backup.d目录下,而这个文件才是备份操作的真正的配置文件。 + - 可以通过ninjahelper设定好备份操作的执行时间,或按照“when”变量中设置的频率来执行。 ###总结### -在这篇文章中,我们探讨了如何从头创建我们自己的备份操作,以及如何向ninjahelper添加相关的菜单以生成对应的配置文件。通过[上一篇][2]与这一篇文章,我希望我已经给出了足够好的理由让你继续研究,或者至少应该尝试一下。 +在这篇文章中,我们探讨了如何从头创建我们自己的备份操作,以及如何向ninjahelper添加相关的菜单以生成对应的配置文件。通过[上一篇][1]与这一篇文章,我希望我已经给出了足够好的理由让你继续研究,或者至少应该尝试一下。 ------------------------------ via: http://xmodulo.com/create-custom-backup-plan-debian.html -作者:[ Gabriel Cánepa][a] -译者:[SPccman](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +作者:[Gabriel Cánepa][a] +译者:[SPccman](https://github.com/SPccman) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://xmodulo.com/author/gabriel -[1]:http://xmodulo.com/backup-debian-system-backupninja.html -[2]:http://xmodulo.com/backup-debian-system-backupninja.html +[1]:http://linux.cn/article-5096-1.html diff --git a/published/20150407 Top 6 Ways To Get Your iTunes Experience On Linux.md b/published/20150407 Top 6 Ways To Get Your iTunes Experience On Linux.md new file mode 100644 index 0000000000..dee56ed250 --- /dev/null +++ b/published/20150407 Top 6 Ways To Get Your iTunes Experience On Linux.md @@ -0,0 +1,88 @@ +六种在 Linux 上为你带来 iTunes 般体验的方法 +================================================================================ +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/itunes-linux-840x420.jpg?35dc20) + +随着你对 Linux 的熟悉(也许会成为你首要使用的操作系统),你终将会寻找能在 Linux 上有效管理音乐的工具。你首先想到 iTunes,因为它是近几年最流行的音乐管理工具,但你马上会发现 iTunes 并没有 Linux 版本。而且,现在,你会发现还有比 iTunes 更好的音乐管理工具。 + +尽管如此,这并不意味着你就不能使用你喜欢的方式管理音乐。Linux 上有很多方式可以让你整理你的曲库。以下六种,仅供参考: + +### 通过WINE运行iTunes ### + +尽管 iTunes 没有Linux版,你还是可以试试 [使用 WINE 运行 iTunes ][1] 或 PlayOnLinux 的。这些软件给本来只能运行于Windows下的应用程序添加一个兼容层,这样就能让他们运行在Linux上了,但这样的方法效果十有分限。因此,[并非所有 Windows 应用程序都能使用WINE运行][2] - 但这还是一个值得尝试的方法。 + +各个版本的iTunes结果可能给你不同的结果,但一般都遵循以下方法: + +1. 安装WINE +2. 在WINE里运行iTunes安装程序 +3. 在网上搜索并解决你遇到的问题。 + +如果你在安装时遇到无法解决的问题,比如安装程序错误,或者安装好的程序运行不了,那是没办法的,WINE 就是这样。 + +如果你想在 WINE 上运行 iTunes 而且运气很好的跑起来了,那真是很棒。但如果你还想考虑运行一个原生的Linux应用,或者 WINE 不工作的话,还有很多其他选择的。有几个曲库管理软件能让你很方便的管理你的音乐并直接进行播放,还可以制作播放列表。 + +### [Amarok][3] ### + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/03/amarok_main.jpg?35dc20) + +如果你使用KDE环境,我推荐 Amarok。它具有 [很多管理音乐的特性][4] 而且它还能与KDE桌面环境无缝兼容。它有很多实用的特性如集成了 Last.FM、文件跟踪、动态播放列表及脚本支持。它甚至会自动在你播放曲目时,自动下载艺术家封面。 + +### [Banshee][5] ### + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/03/banshee_main.jpg?35dc20) + +如果你使用 GNOME 或其他任何基于 GTK 的桌面环境(它们十分常见)的话,我推荐使用使用Bansee作为 [全功能曲库管理工具][6] 。它的功能与Amarok类似,也集成了Last.FM,支持互联网广播,支持podcast等等。选择 Amarok 还是 Bansee 要看你使用的桌面环境(这样才能无缝整合)。 + +### [Rhythmbox][7] ### + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/03/rhythmbox_main.jpg?35dc20) + +Rhythmbox是一个更好基于GTK的桌面环境的[轻量级的曲库替代品][8]。尽管如此,它也还是有一些自己的特性的。它也支持Last.FM,同时还能无缝播放并与其它如 Nautilus、XChat及Pidgin 等进行整合。 + +### [Clementine][9] ### + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/03/clementine_main.jpg?35dc20) + +另一款叫 Clementine 的软件也值得我推荐,因为它的界面简洁、易用。它支持非常多的第三方服务例如Spotify,Digtal Imported 及Dropbox。Android系统上还有一款用作 Clementine 遥控的app。[Clementine是跨平台的][10] , 还支持Mac OS X 及 Windows。 + +这些程序都能很好的管理并播放你的音乐。唯一的问题是这些程序都不支持与 iOS 设备的整合, 而且目前Linux 上还没有程序能做到这一点。但 iOS 经过很多改进后,已经并不需要再连接到电脑了。 + +### [Google Play Music][11] ### + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/03/google_music.jpg?35dc20) + +最后,如果上面的那些程序还不能满足你的需求的话,你可以试试 Google Play Music。这个在线服务也可以用作播放音乐的曲库管理工具,但它还有几个额外的好处。你可以上传所有的音乐,并且在所有能上网的设备上获取这些音乐。这也意味着你不需要在电脑或者移动设备之间同步你的音乐(无论是 Android 还是 iOS 设备),因为你可以这些设备中使用Google Play Music。 如果你想要扩展你的曲库,你可以订阅 All Access 服务,但这并不是必须的。你不需要支付任何费用也可在你的曲库中储存20,000首 + +#### 靠,居然没有 Spotify ?! #### + +尽管 Spotify 也是一款管理和听音乐的方法,我不推荐它的唯一原因是它事实上并不让你管理你的音乐。你不能将曲目上传到 Spotify - 只能它们给你提供的曲目。尽管它们提供了很多,但口味未必一样。 + + +### 你还有其他选择 ### + +以上六个软件应该可以在给你带来类似 iTunes 的功能了。这些软件主要是能让你管理和播放你的曲库,但如果你还需要 iTunes 里的其他特性,其他Linux原生软件或许能满足这类需求。 + +**你通常在Linux上使用哪些音乐?**在下方评论与我们分享吧! + + +-------------------------------------------------------------------------------- + +via: http://www.makeuseof.com/tag/top-6-ways-get-itunes-experience-linux/ + +作者:[Danny Stieben][a] +译者:[KevinSJ](https://github.com/KevinSJ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.makeuseof.com/tag/author/danny/ +[1]:http://www.makeuseof.com/tag/how-about-some-wine-with-your-linux/ +[2]:http://www.makeuseof.com/answers/does-wine-runs-all-windows-apps/ +[3]:https://amarok.kde.org/ +[4]:http://www.makeuseof.com/tag/control-music-amarok-linux/ +[5]:http://banshee.fm/ +[6]:http://www.makeuseof.com/tag/banshee-20-comprehensive-media-player-streamer-podcast-tool-linux/ +[7]:https://wiki.gnome.org/Apps/Rhythmbox +[8]:http://www.makeuseof.com/tag/play-manage-music-collection-rhythmbox-linux/ +[9]:https://www.clementine-player.org/ +[10]:http://www.makeuseof.com/tag/need-a-lightweight-music-player-without-sacrificing-features-clementine-cross-platform/ +[11]:http://music.google.com/ diff --git a/published/20150413 How to Show Dialog Box from Bash Shell Script with Examples.md b/published/20150413 How to Show Dialog Box from Bash Shell Script with Examples.md new file mode 100644 index 0000000000..789a56688d --- /dev/null +++ b/published/20150413 How to Show Dialog Box from Bash Shell Script with Examples.md @@ -0,0 +1,175 @@ +如何在Bash Shell脚本中显示对话框 +================================================================================ + +这个教程给出几个如何使用类似zenity和whiptail的工具在Bash Shell 脚本中提供消息/对话框的例子。使用这些工具,你的脚本能够告知用户当前程序运行的状态并能与用户进行交互。这两个工具的不同之处在于显示消息框或者对话框的方式。Zenity用GTK工具包创建图形用户界面,而whiptail则在终端窗口内创建消息框。 + +### Zenity 工具 ### + +在Ubuntu中安装zenity,运行: + + sudo apt-get install zenity + +用zenity创建消息框或者对话框的命令是不言自明的,我们会给你提供一些例子来参考。 + +### 创建消息框 ### + + zenity --info --title "Information Box" --text "This should be information" --width=300 --height=200 + +![消息框截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-Information-Box.png) + +创建 Yes/No 询问对话框 + + zenity --question --text "Do you want this?" --ok-label "Yeah" --cancel-label="Nope" + +![问题截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-Question.png) + +创建输入框并将输入值保存到变量中 + + a=$(zenity --entry --title "Entry box" --text "Please enter the value" --width=300 --height=200) + echo $a + +![输入框截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-Entry-box.png) + +输入后,值会保存在变量 $a 中。 + +这是一个获取用户姓名并显示的实际事例。 + + #!/bin/bash + # + # This script will ask for couple of parameters + # and then continue to work depending on entered values + # + + # Giving the option to user + zenity --question --text "Do you want to continue?" + + # Checking if user wants to proceed + [ $? -eq 0 ] || exit 1 + + # Letting user input some values + FIRSTNAME=$(zenity --entry --title "Entry box" --text "Please, enter your first name." --width=300 --height=150) + LASTNAME=$(zenity --entry --title "Entry box" --text "Please, enter your last name." --width=300 --height=150) + AGE=$(zenity --entry --title "Entry box" --text "Please, enter your age." --width=300 --height=150) + + # Displaying entered values in information box + zenity --info --title "Information" --text "You are ${FIRSTNAME} ${LASTNAME} and you are ${AGE}(s) old." --width=300 --height=100 + +这些是运行前面脚本的截图。 + +![例1-问题-1](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Question-1.png) + +框1 + +![例1-输入框-1](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Entry-box-1.png) + +输入框 + +![例1-输入框-2](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Entry-box-2.png) + +输入框 + +![例1-输入框-3](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Entry-box-3.png) + +输入框 + +![例1-信息](http://blog.linoxide.com/wp-content/uploads/2015/03/Example1-Information.png) + +信息框 + +别忘了查看也许能帮助到你的有用的[zenity 选项][1]。 + +### Whiptail 工具 ### + +在Ubuntu上安装whiptail,运行 + + sudo apt-get install whiptail + +用whiptail创建消息框或者对话框的命令也是无需解释的,我们会给你提供一些基本例子作为参考。 + +### 创建消息框 ### + + whiptail --msgbox "This is a message" 10 40 + +![whiptail消息框截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-msgbox.png) + +### 创建 Yes/No 对话框 ### + + whiptail --yes-button "Yeah" --no-button "Nope" --title "Choose the answer" --yesno "Will you choose yes?" 10 30 + +![whiptail对话框截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-yesno.png) + +### 创建有缺省值的输入框 ### + + whiptail --inputbox "Enter your number please." 10 30 "10" + +![whiptail输入框截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-entry.png) + +尝试使用输入值要注意的一点是whiptail用stdout显示对话框,用stderr输出值。这样的话,如果你用 var=$(...),你就根本不会看到对话框,也不能获得输入的值。解决方法是交换stdout和stderr。在whiptail命令后面添加 **3>&1 1>&2 2>&3** 就可以做到。你想获取输入值的任何whiptail命令也是如此。 + +### 创建菜单对话框 ### + + whiptail --menu "This is a menu. Choose an option:" 20 50 10 1 "first" 2 "second" 3 "third" + +![whiptail菜单截图](http://blog.linoxide.com/wp-content/uploads/2015/03/Screenshot-whiptail-menu.png) + +这是一个请求用户输入一个文件夹的路径并输出它的大小的 **shell 脚本**。 + + #!/bin/bash + # + # + + # Since whiptail has to use stdout to display dialog, entered value will + # be stored in stderr. To switch them and get the value to stdout you must + # use 3>&1 1>&2 2>&3 + FOLDER_PATH=$(whiptail --title "Get the size of folder" \ + --inputbox "Enter folder path:" \ + 10 30 \ + "/home" \ + 3>&1 1>&2 2>&3) + + if [ -d $FOLDER_PATH ] + then + size=$(du -hs "$FOLDER_PATH" | awk '{print $1}') + whiptail --title "Information" \ + --msgbox "Size of ${FOLDER_PATH} is ${size}" \ + 10 40 + elif [ -f $FOLDER_PATH ] + then + whiptail --title "Warning!!!" \ + --msgbox "The path you entered is a path to a file not a folder!" \ + 10 40 + else + whiptail --title "Error!!!" + --msgbox "Path you entered is not recognized. Please try again" \ + 10 40 + fi + +这是之前例子的一些截图: + +![例2-输入框](http://blog.linoxide.com/wp-content/uploads/2015/03/Example2-Entry-box.png) + +输入框 + +![例2-消息框](http://blog.linoxide.com/wp-content/uploads/2015/03/Example2-Information.png) + +消息框 + +如果你在终端下工作,[帮助手册][2]总是有用的。 + +### 结论 ### + +选择合适的工具显示对话框取决于你期望在桌面机器还是服务器上运行你的脚本。桌面机器用户通常使用GUI窗口环境,也可能运行脚本并与显示的窗口进行交互。然而,如果你期望用户是在服务器上工作的,(在没有图形界面时,)你也许希望能确保总能显示,那就使用whiptail或者任何其它在纯终端窗口显示对话框的工具。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-shell-script/bash-shell-script-show-dialog-box/ + +作者:[Ilija Lazarevic][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/ilijala/ +[1]:https://help.gnome.org/users/zenity/stable/ +[2]:http://linux.die.net/man/1/whiptail \ No newline at end of file diff --git a/published/20150413 How to manage remote MySQL databases on Linux VPS using a GUI tool.md b/published/20150413 How to manage remote MySQL databases on Linux VPS using a GUI tool.md new file mode 100644 index 0000000000..a0114d5382 --- /dev/null +++ b/published/20150413 How to manage remote MySQL databases on Linux VPS using a GUI tool.md @@ -0,0 +1,176 @@ +如何使用图形化工具远程管理 Linux上的MySQL +================================================================================ +如果你在一个远程的VPS上运行了MySQL服务器,你会如何管理你的远程数据库主机呢?基于web的数据库管理工具例如[phpMyAdmin][2]或者[Adminer][3]可能会是你第一个想起的。这些基于web的管理工具需要一个正常运行的后端的web服务和PHP引擎。但是,如果你的VPS仅仅用来做数据库服务(例如,数据库与其它服务独立存放的分布式结构),为偶尔的数据库管理提供一整套的LAMP是浪费VPS资源的。更糟的是,LAMP所打开的HTTP端口可能会成为你VPS资源的安全漏洞。 + +作为一种选择,你可以使用在一台客户机上运行本地的MySQL客户端,当然,如果没有别的选择,一个纯净的MySQL命令行客户端将是你的默认选择。但是命令行客户端的功能是有限的,因为它没有生产级数据库管理功能,例如:可视化SQL开发、性能调优、模式验证等等。你是否在寻找一个成熟的MySQL管理工具,那么一个MySQL的图形化管理工具将会更好的满足你的需求。 + +###什么是MySQL Workbench? + +作为一个由Oracle开发的集成的数据库管理工具,[MySQL Workbench][4]不仅仅是一个简单的MySQL客户端。简而言之,Workbench是一个跨平台的(如:Linux,MacOX,Windows)数据库设计、开发和管理的图形化工具。MySQL Workbench 社区版是遵循GPL协议的。作为一个数据库管理者,你可以使用Workbench去配置MySQL服务、管理MySQL用户、进行数据库的备份与还原、监视数据库的健康状况,所有的都在对用户友好的图形化环境下处理。 + +在这个手册里,让我们演示下如何在Linux下安装和使用MySQL Workbench。 + +###在Linux上安装MySQL Workbench + +你可以在任何一个桌面linux机器上运行MySQL Workbench来设置你的数据库管理环境。虽然一些Linux发行版(例如:Debian/Ubuntu)在他们的软件源中已经有了MySQL Workbench,但是从官方源中安装是一个好的方法,因为他们提供了最新的版本。这里介绍了如何设置一个官方的Workbench软件源和从中安装它。 + +#### 基于 Debian 的桌面 (Debia, Ubuntu, Mint): #### + +到其[官方站点][5],选择一个和你环境匹配的DEB文件,并下载安装: + +例如,对于 Ubuntu 14.10: + + $ wget http://dev.mysql.com/get/mysql-apt-config_0.3.4-2ubuntu14.10_all.deb + $ sudo dpkg -i mysql-apt-config_0.3.4-2ubuntu14.10_all.deb + +对于 Debian 7: + + $ wget http://dev.mysql.com/get/mysql-apt-config_0.3.3-1debian7_all.deb + $ sudo dpkg -i mysql-apt-config_0.3.3-1debian7_all.deb + +当你安装DEB文件时,你会看到下面的配置菜单,并且选择配置那个MySQL产品 + +![](https://farm8.staticflickr.com/7702/16928715218_b1fcbcdbf3_c.jpg) + +选择“Utilities”。完成配置后,选择“Apply”去保存配置。然后,更新包索引,并且安装Workbench。 + + $ sudo apt-get update + $ sudo apt-get install mysql-workbench + +#### 基于 Red Hat 的桌面 (CentOS, Fedora, RHEL): #### + +去官网下载并安装适合你Linux环境的RPM源包。 + +例如,对于 CentOS 7: + + $ wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm + $ sudo yum localinstall mysql-community-release-el7-5.noarch.rpm + +对于 Fedora 21: + + $ wget http://dev.mysql.com/get/mysql-community-release-fc21-6.noarch.rpm + $ sudo yum localinstall mysql-community-release-fc21-6.noarch.rpm + +验证"MySQL Tools Community"源是否被安装: + + $ yum repolis enabled + +![](https://farm9.staticflickr.com/8826/16494069254_15458ace52_c.jpg) + +安装Workbench + + $ sudo yum install mysql-workbench-community + +###设置远程数据库的安全连接 + +接下来是为你运行MySQL服务的VPS设置一个远程连接。当然,你可以直接通过图形化的Workbench连接你的远程MySQL服务器(在数据库开放了远程连接后)。然而,这样做有很大的安全风险,因为有些人很容易窃听你的数据库传输信息,并且一个公开的MySQL端口(默认为3306)会是另外一个攻击入口。 + +一个比较好的方法是关掉远程访问数据库服务功能,(仅允许在VPS 上的127.0.0.1访问)。然后在本地客户机和远程VPS之间设置一个SSH隧道,这样的话,和MySQL之间的数据能安全地通过它的本地回环接口上中继。相比较设置一个SSL加密的连接来说,配置SSH隧道需要很少的操作,因为它仅仅需要SSH服务,并且在大多数的VPS上已经部署了。 + +让我们来看看如何来为一个MySQL Workbench设置一个SSH隧道。 + +在这个设置里,不需要你开放远程访问MySQL服务。 + +在一个运行了Workbench的本地客户机上,键入下面的命令,替换'user'(远程 VPS 的用户名)和'remote_vps'(远程 VPS 的地址)为你自己的信息: + + $ ssh user@remote_vps -L 3306:127.0.0.1:3306 -N + +你会被要求输入你VPS的SSH密码,当你成功登陆VPS后,在本地的3306端口和远程VPS的3306端口之间将会建立一个SSH隧道。这里你不会在前台看到任何信息显示。 + +或者你可以选择在后台运行SSH隧道,按CTRL+Z停止当前的命令,然后输入bg并且ENTER + +![](https://farm8.staticflickr.com/7714/16928715438_bf0db49b3b_c.jpg) + +这样SSH隧道就会在后台运行了。 + +###使用MySQL Workbench远程管理MySQL服务 + +在建立好SSH隧道后,你可以通过MySQL Workbench去远程连接MySQL服务了。 + +输入下面命令启动Workbench: + + $ mysql-workbench + +![](https://farm9.staticflickr.com/8768/16494069294_0fce571ddb_c.jpg) + +点击Workbench页面上面的“加号”图标去创建一个新的数据库连接,接着会出现下面的连接信息。 + +- **Connection Name**: 任意描述 (例如: My remote VPS database) +- **Hostname**: 127.0.0.1 +- **Port**: 3306 +- **Username**: MySQL 用户名 (例如 root) + +![](https://farm8.staticflickr.com/7727/16928715288_d9ac3bfc7a_c.jpg) + +注意:因为隧道设置的是127.0.0.1:3306,所以主机名字段必须是127.0.0.1,而不能是远程VPS的IP地址或者主机名。 + +当你设置好一个新的数据库连接后,你会在Workbench窗口看到一个新的框,点击那个框就会实际去连接远程的MySQL服务了。 + +![](https://farm8.staticflickr.com/7650/17114969532_0252ffcd31_c.jpg) + +当你登录到MySQL 服务器后,你可以再左侧面板看到各种管理任务。让我们来看一些常见的管理任务。 + +#### MySQL Server Status #### + +该菜单显示了展示数据库服务器的资源使用情况的实时监控面板。(例如:流量、链接、读写) + +![](https://farm8.staticflickr.com/7627/16494069414_9d838d4138_c.jpg) + +#### Client Connections #### + +客户端连接数是一个极其重要的监控的资源,这个菜单显示了每个连接的详细信息。 + +![](https://farm9.staticflickr.com/8747/16909119337_a8d89772dd_c.jpg) + +#### 用户和权限 #### + +这个菜单允许你管理MySQL用户,包括他们的资源限制和权限。 + +![](https://farm9.staticflickr.com/8765/16494069384_760fc17c8f_c.jpg) + +#### MySQL Server Administration #### + +你可以启动或关闭MySQL服务,并且检查它的服务日志。 + +![](https://farm8.staticflickr.com/7588/17114969592_54526dfb32_c.jpg) + +#### Database Schema Management #### + +可以可视化的查看、更改、检查数据库结构,在“Schemas”标题下选择任何一个数据库或表,然后右击 + +![](https://farm8.staticflickr.com/7665/16496363973_fd03a96198_c.jpg) + +![](https://farm9.staticflickr.com/8744/16909119497_7c884617b8_c.jpg) + +#### Database Query #### + +你可以执行任何的语句(只要你的权限允许),并且检查其结果。 + +![](https://farm8.staticflickr.com/7716/17114969692_c0f02bb277_c.jpg) + +此外,性能统计数据和报表仅用于MySQL5.6以上的版本。对于5.5及其以下的版本,性能部分会以灰色显示。 + +### 结论 ### + +简介且直观的选项卡界面,丰富的特性,开源,使MySQL Workbench成为一个非常好的可视化数据库设计和管理工具。为其减分的是它的性能。我注意到在一台运行繁忙的服务器上,Workbench有时会变得异常缓慢,尽管它的性能差强人意,我依然认为MySQL Workbench是MySQL数据库管理员和设计人员必备的工具之一。 + +你曾在你的生产环境中用过Workbench吗?或者你还有别的GUI工具可以推荐?请分享你的经验吧。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/remote-mysql-databases-gui-tool.html + +作者:[Dan Nanni][a] +译者:[tyzy313481929](https://github.com/tyzy313481929) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/go/digitalocean +[2]:http://ask.xmodulo.com/install-phpmyadmin-centos.html +[3]:http://xmodulo.com/set-web-based-database-management-system-adminer.html +[4]:http://mysqlworkbench.org/ +[5]:http://dev.mysql.com/downloads/repo/apt/ +[6]:http://dev.mysql.com/downloads/repo/yum/ +[7]:http://xmodulo.com/how-to-allow-remote-access-to-mysql.html diff --git a/published/20150413 Linux FAQs with Answers--How to compile ixgbe driver on CentOS, RHEL or Fedora.md b/published/20150413 Linux FAQs with Answers--How to compile ixgbe driver on CentOS, RHEL or Fedora.md new file mode 100644 index 0000000000..52ce998473 --- /dev/null +++ b/published/20150413 Linux FAQs with Answers--How to compile ixgbe driver on CentOS, RHEL or Fedora.md @@ -0,0 +1,196 @@ +Linux 有问必答: 如何在红帽系linux中编译Ixgbe驱动 +================================================================================ +> **提问**:我想要安装最新版的ixgbe 10G网卡驱动。在CentOS, Fedora 或 RHEL中,我应该如何编译ixgbe驱动? + +想要在linux使用Intel的PCI Express 10G网卡(例如,82598,82599,x540),需要安装Ixgbe驱动。如今的Linux发行版都会预安装ixgbe的可加载模块,但是预安装的ixgbe驱动不是完整功能版。如果想要开启和定制所有10G网卡的功能(如,RSS、多队列、虚拟化功能、硬件 offload 等),需要从源码编译安装。 + +本文基于红帽系平台(如,CentOS,RHEL或Fedora)。Debian系平台,请看[这篇文章][1] + +### 第一步: 安装依赖 ### + +首先,安装必要的开发环境和安装匹配的内核头文件 + + $ sudo yum install gcc make + $ sudo yum install kernel-devel + +### 第二步: 编译Ixgbe ### + +从[官方页面][2]下载最新Ixgbe源码 + + $ wget http://downloads.sourceforge.net/project/e1000/ixgbe%20stable/3.23.2/ixgbe-3.23.2.tar.gz + +请检查支持的内核版本。例如,Ixgbe3.23.2版本支持Linux内核版本2.6.18到3.18.1。 + +提取压缩包并编译 + + $ tar -xvf ixgbe-3.23.2.tar.gz + $ cd ixgbe-3.23.2/src + $ make + +如果成功,可以在当前目录找到编译完成的驱动(ixgbe.ko)。 + +可以运行这个命令来查看编译信息: + + $ modinfo ./ixgbe.ko + +将会输出一个Ixgbe驱动的可用参数列表 + +![](https://farm9.staticflickr.com/8789/16429483653_b9b6e6cd7f_c.jpg) + +### 第三步: 加载 Ixgbe 驱动 ### + +这步准备加载已经编译好的驱动。 + +如果系统已经加载了Ixgbe驱动,首先需要卸载掉老版本。否则,新版本不能加载。 + + $ sudo rmmod ixgbe.ko + +然后插入编译完成的驱动到内核中: + + $ sudo insmod ./ixgbe.ko + +同时,你可以设置启动参数 + + $ sudo insmod ./ixgbe.ko FdirPballoc=3 RSS=16 + +验证驱动是否加载成功,使用dmesg命令,查看其输出 + + $ dmesg + +---------- + + Intel(R) 10 Gigabit PCI Express Network Driver - version 3.23.2 + Copyright (c) 1999-2014 Intel Corporation. + ixgbe 0000:21:00.0: PCI INT A -> GSI 64 (level, low) -> IRQ 64 + ixgbe 0000:21:00.0: setting latency timer to 64 + ixgbe: Receive-Side Scaling (RSS) set to 16 + ixgbe: Flow Director packet buffer allocation set to 3 + ixgbe: 0000:21:00.0: ixgbe_check_options: Flow Director will be allocated 256kB of packet buffer + ixgbe: 0000:21:00.0: ixgbe_check_options: FCoE Offload feature enabled + ixgbe 0000:21:00.0: irq 87 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 88 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 89 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 90 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 91 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 92 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 93 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 94 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 95 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 96 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 97 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 98 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 99 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 100 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 101 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 102 for MSI/MSI-X + ixgbe 0000:21:00.0: irq 103 for MSI/MSI-X + ixgbe 0000:21:00.0: eth3: DCA registration failed: -1 + ixgbe 0000:21:00.0: PCI Express bandwidth of 32GT/s available + ixgbe 0000:21:00.0: (Speed:5.0GT/s, Width: x8, Encoding Loss:20%) + ixgbe 0000:21:00.0: eth3: MAC: 2, PHY: 9, SFP+: 3, PBA No: E68793-006 + ixgbe 0000:21:00.0: 90:e2:ba:5b:e9:1c + ixgbe 0000:21:00.0: eth3: Enabled Features: RxQ: 16 TxQ: 16 FdirHash RSC + ixgbe 0000:21:00.0: eth3: Intel(R) 10 Gigabit Network Connection + ixgbe 0000:21:00.1: PCI INT B -> GSI 68 (level, low) -> IRQ 68 + ixgbe 0000:21:00.1: setting latency timer to 64 + ixgbe: 0000:21:00.1: ixgbe_check_options: FCoE Offload feature enabled + ixgbe 0000:21:00.0: registered PHC device on eth3 + ixgbe 0000:21:00.1: irq 104 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 105 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 106 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 107 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 108 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 109 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 110 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 111 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 112 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 113 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 114 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 115 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 116 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 117 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 118 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 119 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 120 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 121 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 122 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 123 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 124 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 125 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 126 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 127 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 128 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 129 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 130 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 131 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 132 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 133 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 134 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 135 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 136 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 137 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 138 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 139 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 140 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 141 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 142 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 143 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 144 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 145 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 146 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 147 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 148 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 149 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 150 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 151 for MSI/MSI-X + ixgbe 0000:21:00.1: irq 152 for MSI/MSI-X + ADDRCONF(NETDEV_UP): eth3: link is not ready + 8021q: adding VLAN 0 to HW filter on device eth3 + ixgbe 0000:21:00.1: eth4: DCA registration failed: -1 + ixgbe 0000:21:00.1: PCI Express bandwidth of 32GT/s available + ixgbe 0000:21:00.1: (Speed:5.0GT/s, Width: x8, Encoding Loss:20%) + ixgbe 0000:21:00.1: eth4: MAC: 2, PHY: 9, SFP+: 4, PBA No: E68793-006 + ixgbe 0000:21:00.1: 90:e2:ba:5b:e9:1e + ixgbe 0000:21:00.1: eth4: Enabled Features: RxQ: 48 TxQ: 48 FdirHash RSC + ixgbe 0000:21:00.1: eth4: Intel(R) 10 Gigabit Network Connection + ixgbe 0000:21:00.0: eth3: detected SFP+: 3 + ixgbe 0000:21:00.1: registered PHC device on eth4 + ADDRCONF(NETDEV_UP): eth4: link is not ready + 8021q: adding VLAN 0 to HW filter on device eth4 + ixgbe 0000:21:00.1: eth4: detected SFP+: 4 + ixgbe 0000:21:00.0: eth3: NIC Link is Up 10 Gbps, Flow Control: RX/TX + ADDRCONF(NETDEV_CHANGE): eth3: link becomes ready + ixgbe 0000:21:00.1: eth4: NIC Link is Up 10 Gbps, Flow Control: RX/TX + ADDRCONF(NETDEV_CHANGE): eth4: link becomes ready + eth3: no IPv6 routers present + eth4: no IPv6 routers present + +### 第四步: 安装Ixgbe驱动 ### + +当确认驱动已经加载后,就可以安装驱动到系统中了 + + $ sudo make install + +ixgbe.ko将会安装在下列目录 + + /lib/modules//kernel/drivers/net/ixgbe + +此时,编译好的驱动将在启动时自动加载,也可以通过运行命令加载它: + + $ sudo modprobe ixgbe + +![](https://farm9.staticflickr.com/8760/16863416809_804dea1491_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/compile-ixgbe-driver-centos-rhel-fedora.html + +作者:[Dan Nanni][a] +译者:[Vic020](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:https://linux.cn/article-5149-1.html +[2]:http://sourceforge.net/projects/e1000/files/ixgbe%20stable/ diff --git a/published/20150413 Linux FAQs with Answers--How to configure PCI-passthrough on virt-manager.md b/published/20150413 Linux FAQs with Answers--How to configure PCI-passthrough on virt-manager.md new file mode 100644 index 0000000000..c7c2d21fa3 --- /dev/null +++ b/published/20150413 Linux FAQs with Answers--How to configure PCI-passthrough on virt-manager.md @@ -0,0 +1,55 @@ +Linux有问必答:如何在虚拟机上配置PCI直通 +================================================================================ +> **提问**:我想要分配一块物理网卡到用KVM创建的虚拟机上。我打算为这台虚拟机启用网卡的PCI直通。请问,我如何才能在virt-manager里面通过PCI直通增加一个PCI设备到虚拟机上? + +如今的hypervisor能够高效地在多个虚拟操作系统间共享和模拟硬件资源。然而,虚拟资源共享不是总能使人满意,甚至在虚拟机性能是重点考量时,或者是虚拟机需要硬件DMA的完全控制时,应该避免共享。一项名叫“PCI直通”的技术可以用在一个虚拟机需要独享PCI设备时(例如:网卡、声卡、显卡)。本质上,PCI直通穿透了虚拟层,直接将PCI设备放到虚拟机里,而其他虚拟机则不能访问该设备。 + +### 开启“PCI直通”的准备 ### + +如果你想要为一台HVM实例开启PCI直通(例如,一台KVM创建的全虚拟化的虚拟机),你的母系统(包括CPU和主板)必须满足以下条件。如果你的虚拟机是半虚拟化的(由Xen创建),你可以跳过这步。 + +为了在 HVM虚拟机上开启PCI直通,系统需要支持**VT-d** (Intel处理器)或者**AMD-Vi** (AMD处理器)。Intel的VT-D(“英特尔直接I/O虚拟化技术”)是适用于最高端的Nehalem处理器和它的后继者(例如,Westmere、Sandy Bridge的,Ivy Bridge)。注意:VT-d和VT-x是两个独立功能。intel/AMD处理器支持VT-D/AMD-VI功能的列表可以[查看这里][1]。 + +在确认你的设备支持VT-d/AMD-Vi后,还有两件事情需要做。首先,确保VT-d/AMD-Vi已经在BIOS中开启。然后,在内核启动过程中开启IOMMU。IOMMU服务,是由VT-d/AMD-Vi提供的,可以保护虚拟机访问的主机内存,同时它也是全虚拟化虚拟机支持PCI直通的前提。 + +Intel处理器中,通过将“**intel_iommu=on**传给内核启动参数来开启IOMMU。参看[这篇教程][2]了解如何通过GRUB修改内核启动参数。 + +配置完启动参数后,重启电脑。 + +### 添加PCI设备到虚拟机 ### + +我们已经完成了开启PCI直通的准备。事实上,只需通过virt-manager就可以给虚拟机分配一个PCI设备。 + +打开virt-manager的虚拟机设置,在左边工具栏点击‘增加硬件’按钮。 + +选择从PCI设备表一个PCI设备来分配,点击“完成”按钮 + +![](https://farm8.staticflickr.com/7587/17015584385_db49e96372_c.jpg) + +最后,启动实例。这样,主机的PCI设备已经可以由虚拟机直接访问了。 + +### 常见问题 ### + +在虚拟机启动时,如果你看见下列任何一个错误,这个错误有可能由于母机VT-d (或 IOMMU)未开启导致。 + + Error starting domain: unsupported configuration: host doesn't support passthrough of host PCI devices + +---------- + + Error starting domain: Unable to read from monitor: Connection reset by peer + +请确保"**intel_iommu=on**"启动参数已经按上文叙述开启。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/pci-passthrough-virt-manager.html + +作者:[Dan Nanni][a] +译者:[Vic020/VicYu](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://wiki.xenproject.org/wiki/VTdHowTo +[2]:http://xmodulo.com/add-kernel-boot-parameters-via-grub-linux.html diff --git a/published/20150416 Linux Network Statistics Tools or Commands.md b/published/20150416 Linux Network Statistics Tools or Commands.md new file mode 100644 index 0000000000..e4ce5db81d --- /dev/null +++ b/published/20150416 Linux Network Statistics Tools or Commands.md @@ -0,0 +1,356 @@ +Linux网络统计工具/命令 +================================================================================ +我在Linux(基于CentOS 或者 Debian 的发行版)中该如何查看当前网络端口吞吐量的统计信息?在Linux操作系统中如何查看当前内核snmp计数器以及网络端口的统计信息? + +![](http://s0.cyberciti.org/images/category/old/networking.png) + +你可以使用以下任何一个命令: + +### nstat 命令 : 网络统计工具 ### + +键入以下命令: + + # nstat + +输出样例: + + #kernel + IpInReceives 133243 0.0 + IpInDelivers 133243 0.0 + IpOutRequests 92904 0.0 + IcmpOutErrors 97 0.0 + IcmpOutTimeExcds 97 0.0 + IcmpMsgOutType3 97 0.0 + TcpActiveOpens 538 0.0 + TcpEstabResets 56 0.0 + TcpInSegs 129837 0.0 + TcpOutSegs 89720 0.0 + TcpRetransSegs 42 0.0 + TcpOutRsts 704 0.0 + UdpInDatagrams 3255 0.0 + UdpNoPorts 97 0.0 + UdpOutDatagrams 3270 0.0 + Ip6OutNoRoutes 206 0.0 + TcpExtTW 141 0.0 + TcpExtDelayedACKs 508 0.0 + TcpExtDelayedACKLocked 1 0.0 + TcpExtDelayedACKLost 42 0.0 + TcpExtTCPHPHits 117659 0.0 + TcpExtTCPPureAcks 2158 0.0 + TcpExtTCPHPAcks 605 0.0 + TcpExtTCPSackRecovery 1 0.0 + TcpExtTCPLossUndo 16 0.0 + TcpExtTCPSackFailures 4 0.0 + TcpExtTCPFastRetrans 1 0.0 + TcpExtTCPSlowStartRetrans 3 0.0 + TcpExtTCPTimeouts 33 0.0 + TcpExtTCPDSACKOldSent 40 0.0 + TcpExtTCPDSACKRecv 5 0.0 + TcpExtTCPAbortOnData 120 0.0 + TcpExtTCPAbortOnClose 55 0.0 + TcpExtTCPSackShiftFallback 9 0.0 + IpExtInOctets 180131682 0.0 + IpExtOutOctets 7289106 0.0 + +### ss 命令 : 查询套接字工具 ### + +要查看统计汇总, 输入: + + # ss -s + +输出样例: + + Total: 786 (kernel 804) + TCP: 65 (estab 40, closed 7, orphaned 0, synrecv 0, timewait 6/0), ports 56 + Transport Total IP IPv6 + * 804 - - + RAW 1 1 0 + UDP 12 9 3 + TCP 58 52 6 + INET 71 62 9 + FRAG 0 0 0 + +查看[ss 命令教程][1] 获取更多信息。 + +### netstat 命令 : 不错的显示套接字信息的旧工具 ### + +查看所有网络端口以及汇总信息表,输入: + + # netstat -i + +输出样例: + + Kernel Interface table + Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg + eth0 1500 0 941022 0 0 0 688165 0 0 0 BMRU + lo 16436 0 9304 0 0 0 9304 0 0 0 LRU + ppp0 1496 0 3784 0 0 0 4177 0 0 0 MOPRU + +查看每个协议的汇总统计信息,输入: + + # netstat -s + +输出样例: + + Ip: + 1092065 total packets received + 0 forwarded + 0 incoming packets discarded + 1091681 incoming packets delivered + 798913 requests sent out + 895 dropped because of missing route + 759 reassemblies required + 375 packets reassembled ok + Icmp: + 17 ICMP messages received + 0 input ICMP message failed. + ICMP input histogram: + timeout in transit: 8 + echo replies: 9 + 1747 ICMP messages sent + 0 ICMP messages failed + ICMP output histogram: + destination unreachable: 1730 + echo request: 17 + IcmpMsg: + InType0: 9 + InType11: 8 + OutType3: 1730 + OutType8: 17 + Tcp: + 4822 active connections openings + 1129 passive connection openings + 457 failed connection attempts + 165 connection resets received + 7 connections established + 1062519 segments received + 771394 segments send out + 7158 segments retransmited + 6 bad segments received. + 2578 resets sent + Udp: + 20846 packets received + 1730 packets to unknown port received. + 0 packet receive errors + 19242 packets sent + UdpLite: + TcpExt: + 71 invalid SYN cookies received + 8 resets received for embryonic SYN_RECV sockets + 142 packets pruned from receive queue because of socket buffer overrun + 2109 TCP sockets finished time wait in fast timer + 84 packets rejects in established connections because of timestamp + 19454 delayed acks sent + 6 delayed acks further delayed because of locked socket + Quick ack mode was activated 7306 times + 1 packets directly queued to recvmsg prequeue. + 1 bytes directly received in process context from prequeue + 823921 packet headers predicted + 24412 acknowledgments not containing data payload received + 10150 predicted acknowledgments + 242 times recovered from packet loss by selective acknowledgements + 33 congestion windows recovered without slow start by DSACK + 335 congestion windows recovered without slow start after partial ack + 336 TCP data loss events + TCPLostRetransmit: 35 + 1 timeouts after reno fast retransmit + 156 timeouts after SACK recovery + 116 timeouts in loss state + 461 fast retransmits + 5 forward retransmits + 608 retransmits in slow start + 2073 other TCP timeouts + 62 SACK retransmits failed + 43074 packets collapsed in receive queue due to low socket buffer + 8499 DSACKs sent for old packets + 101 DSACKs sent for out of order packets + 308 DSACKs received + 9 DSACKs for out of order packets received + 427 connections reset due to unexpected data + 122 connections reset due to early user close + 28 connections aborted due to timeout + TCPDSACKIgnoredOld: 3 + TCPDSACKIgnoredNoUndo: 60 + TCPSpuriousRTOs: 4 + TCPSackShifted: 282 + TCPSackMerged: 740 + TCPSackShiftFallback: 1017 + IpExt: + InMcastPkts: 47 + OutMcastPkts: 51 + InBcastPkts: 1 + InOctets: 1341508973 + OutOctets: 72525352 + InMcastOctets: 8649 + OutMcastOctets: 7519 + InBcastOctets: 328 + +查看 [netstat 命令教程][2] 获取更多信息。 + +### ip / ifconfig 命令 : 配置或者显示网络端口信息 ### + +键入以下命令: + + # ifconfig + +或者 + + # /sbin/ifconfig + +或者 + + # ifconfig eth0 + +---------- + + eth0 Link encap:Ethernet HWaddr b8:ac:6f:65:31:e5 + inet addr:192.168.1.5 Bcast:192.168.1.255 Mask:255.255.255.0 + inet6 addr: fe80::baac:6fff:fe65:31e5/64 Scope:Link + UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 + RX packets:966334 errors:0 dropped:0 overruns:0 frame:0 + TX packets:703297 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:1000 + RX bytes:1186255648 (1.1 GiB) TX bytes:73968238 (70.5 MiB) + Interrupt:17 + lo Link encap:Local Loopback + inet addr:127.0.0.1 Mask:255.0.0.0 + inet6 addr: ::1/128 Scope:Host + UP LOOPBACK RUNNING MTU:16436 Metric:1 + RX packets:9666 errors:0 dropped:0 overruns:0 frame:0 + TX packets:9666 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:0 + RX bytes:1399578 (1.3 MiB) TX bytes:1399578 (1.3 MiB) + ppp0 Link encap:Point-to-Point Protocol + inet addr:10.1.11.70 P-t-P:10.0.31.18 Mask:255.255.255.255 + UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1496 Metric:1 + RX packets:3784 errors:0 dropped:0 overruns:0 frame:0 + TX packets:4177 errors:0 dropped:0 overruns:0 carrier:0 + collisions:0 txqueuelen:3 + RX bytes:2400265 (2.2 MiB) TX bytes:275983 (269.5 KiB) + +显示网络端口统计信息,输入: + + # ip -s link + +输出样例: + + 1: lo: mtu 16436 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + RX: bytes packets errors dropped overrun mcast + 1444187 9960 0 0 0 0 + TX: bytes packets errors dropped carrier collsns + 1444187 9960 0 0 0 0 + 2: eth0: mtu 1500 qdisc mq state UP qlen 1000 + link/ether b8:ac:6f:65:31:e5 brd ff:ff:ff:ff:ff:ff + RX: bytes packets errors dropped overrun mcast + 1221956483 991501 0 0 0 24 + TX: bytes packets errors dropped carrier collsns + 75623937 720272 0 0 0 0 + 3: wlan0: mtu 1500 qdisc noop state DOWN qlen 1000 + link/ether 00:21:6a:ca:9b:10 brd ff:ff:ff:ff:ff:ff + RX: bytes packets errors dropped overrun mcast + 0 0 0 0 0 0 + TX: bytes packets errors dropped carrier collsns + 0 0 0 0 0 0 + 4: pan0: mtu 1500 qdisc noop state DOWN + link/ether 4a:c7:5f:0e:8e:d8 brd ff:ff:ff:ff:ff:ff + RX: bytes packets errors dropped overrun mcast + 0 0 0 0 0 0 + TX: bytes packets errors dropped carrier collsns + 0 0 0 0 0 0 + 8: ppp0: mtu 1496 qdisc pfifo_fast state UNKNOWN qlen 3 + link/ppp + RX: bytes packets errors dropped overrun mcast + 2419881 3848 0 0 0 0 + TX: bytes packets errors dropped carrier collsns + 284151 4287 0 0 0 0 + +### sar 命令: 显示网络统计信息 ### + +输入以下命令 (你需要 [通过sysstat包安装并启用sar][3]): + +sar -n DEV + + Linux 2.6.32-220.2.1.el6.x86_64 (www.cyberciti.biz) Tuesday 13 March 2012 _x86_64_ (2 CPU) + 12:00:01 CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s + 12:10:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 12:10:01 CDT eth0 127.13 121.32 95.45 18.34 0.00 0.00 0.00 + 12:10:01 CDT eth1 98.48 110.62 16.72 96.33 0.00 0.00 0.00 + 12:20:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 12:20:01 CDT eth0 139.95 133.41 106.30 19.95 0.00 0.00 0.00 + 12:20:01 CDT eth1 110.65 121.85 18.14 107.13 0.00 0.00 0.00 + 12:30:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 12:30:01 CDT eth0 147.85 132.49 115.78 20.45 0.00 0.00 0.00 + 12:30:01 CDT eth1 111.88 127.39 18.61 117.65 0.00 0.00 0.00 + 12:40:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 12:40:01 CDT eth0 136.75 124.64 105.24 19.48 0.00 0.00 0.00 + 12:40:01 CDT eth1 101.65 115.32 17.58 104.50 0.00 0.00 0.00 + 12:50:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 12:50:01 CDT eth0 131.45 125.69 96.49 19.58 0.00 0.00 0.00 + 12:50:01 CDT eth1 101.41 111.31 17.54 96.78 0.00 0.00 0.00 + 01:00:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:00:01 CDT eth0 140.30 133.27 102.17 20.75 0.00 0.00 0.00 + 01:00:01 CDT eth1 106.90 119.51 18.53 103.09 0.00 0.00 0.00 + 01:10:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:10:01 CDT eth0 152.03 127.74 125.56 19.85 0.00 0.00 0.00 + 01:10:01 CDT eth1 115.60 134.57 18.73 126.96 0.00 0.00 0.00 + 01:20:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:20:01 CDT eth0 138.55 130.55 103.03 20.20 0.00 0.00 0.00 + .... + .. + .... + .. + . + 01:00:01 CDT eth1 156.82 169.48 28.83 138.49 0.00 0.00 0.00 + 01:10:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:10:01 CDT eth0 215.19 194.82 163.11 30.99 0.00 0.00 0.00 + 01:10:01 CDT eth1 162.49 183.79 28.36 163.70 0.00 0.00 0.00 + 01:20:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:20:01 CDT eth0 200.20 192.23 140.64 30.93 0.00 0.00 0.00 + 01:20:01 CDT eth1 153.60 166.96 27.32 140.26 0.00 0.00 0.00 + 01:30:01 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:30:01 CDT eth0 111.98 103.58 79.12 16.52 0.00 0.00 0.48 + 01:30:01 CDT eth1 87.50 95.58 14.74 79.35 0.00 0.00 0.00 + Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s + Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + Average: eth0 211.21 196.20 156.18 31.20 0.00 0.00 0.01 + Average: eth1 159.10 174.52 28.00 149.95 0.00 0.00 0.00 + +或者输入以下命令: + + # sar -n DEV 1 3 + +输出样例: + + Linux 2.6.32-220.2.1.el6.x86_64 (www.cyberciti.biz) Tuesday 13 March 2012 _x86_64_ (2 CPU) + 01:44:03 CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s + 01:44:04 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:44:04 CDT eth0 161.70 154.26 105.20 26.63 0.00 0.00 0.00 + 01:44:04 CDT eth1 145.74 142.55 25.11 144.94 0.00 0.00 0.00 + 01:44:04 CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s + 01:44:05 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:44:05 CDT eth0 162.14 156.31 107.46 42.18 0.00 0.00 0.00 + 01:44:05 CDT eth1 135.92 138.83 39.38 104.92 0.00 0.00 0.00 + 01:44:05 CDT IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s + 01:44:06 CDT lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + 01:44:06 CDT eth0 303.92 293.14 272.91 37.40 0.00 0.00 0.00 + 01:44:06 CDT eth1 252.94 290.20 34.87 263.50 0.00 0.00 0.00 + Average: IFACE rxpck/s txpck/s rxkB/s txkB/s rxcmp/s txcmp/s rxmcst/s + Average: lo 0.00 0.00 0.00 0.00 0.00 0.00 0.00 + Average: eth0 210.37 202.34 163.19 35.66 0.00 0.00 0.00 + Average: eth1 178.93 191.64 33.36 171.60 0.00 0.00 0.00 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/faq/network-statistics-tools-rhel-centos-debian-linux/ + +作者:[nixCraft][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.cyberciti.biz/tips/about-us +[1]:https://linux.cn/article-4372-1.html +[2]:https://linux.cn/article-2434-1.html +[3]:http://www.cyberciti.biz/tips/identifying-linux-bottlenecks-sar-graphs-with-ksar.html \ No newline at end of file diff --git a/published/20150417 How to Install Discourse in a Docker Container.md b/published/20150417 How to Install Discourse in a Docker Container.md new file mode 100644 index 0000000000..cb3351a77e --- /dev/null +++ b/published/20150417 How to Install Discourse in a Docker Container.md @@ -0,0 +1,160 @@ +如何在一个Docker容器里安装Discourse +============================================================================= +大家好,今天我们将会学习如何利用Docker平台安装Discourse。Discourse是一个完全开源的讨论平台,以未来十年的互联网理念设计,拥有一个邮件列表,一个论坛和一个长篇聊天室。不管从技术角度还是社会学角度,如今要体验一个现代的、勃勃生机的、完全开源的互联网讨论平台,Discourse都是一个不错的途径。Discourse是一个简单、简明、简易的讨论方式。它确实是一个令人称赞的平台,对于互联网上各种各样的论坛来说,提供了一个上手可用的很酷的服务。 + +Docker是一个开源的、可以将任何应用以轻量级容器的方式打包、传输和运行的开放平台。Docker容器技术使得可以更加方便和容易构建Discourse。 + +所以,下面是一些快速且容易的步骤,用来在一个Docker环境里面安装Discourse。 + +### 1. 安装Docker ### + +首先,我们需要确认我们的主机操作系统已经安装了Docker。我们需要在shell或者终端运行以下命令安装Docker。 + +#### 在Ubuntu上 #### + +docker安装包在Ubuntu的仓库里面是可用的,所以我们将会使用apt管理器安装,以sudo或者root模式 + + # apt-get docker + +#### 在CentOS 7上 #### + +在CentOS 7的主机上,我们使用yum管理器安装docker,因为CentOS的仓库里同样有docker安装包 + + # yum install docker + +![Installing Docker](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-docker.png) + +### 2. 设定交换内存 ### + +如果你的RAM容量小于1GB,那么确保升级你的系统达到1GB或者以上,Discourse不能在512MB的RAM下安装。如果你现在准备好了安装Discourse,根据下面的步骤为你的VPS(Virtual Private Servers)或者服务器设定交换内存: + +运行下面的命令,创建一个空的交换文件。 + + # install -o root -g root -m 0600 /dev/null /swapfile + +如果你想你的交换内存达到1GB,那么执行下面的步骤,并且跳过接下来的第二步。 + + # dd if=/dev/zero of=/swapfile bs=1k count=1024k + +如果你想达到2GB,跳过上一步,跟着下面做 + + # dd if=/dev/zero of=/swapfile bs=1k count=2014k + +接着,我们指定交换内存为swapfile + + #mkswap /swapfile + +运行下面的命令激活交换内存 + + #swapon /swapfile + +现在,我们将其添加到文件系统分区表里,这样重启之后就自动挂载了。 + + # echo "/swapfile swap swap auto 0 0" | sudo tee -a /etc/fstab + +设置swappiness参数为10,这样交换内存仅作为一个紧急缓冲区用。 + + # sudo sysctl -w vm.swappiness=10 + # echo vm.swappiness = 10 | sudo tee -a /etc/sysctl.conf + +### 3. 安装Discourse ### + +在我们的主机上安装好Docker后,我们将会安装Discourse。现在,我们从官方的Discourse GitHub仓库克隆一份到`/var/discourse`目录下。我们需要运行下面的命令完成这一步。 + + # mkdir /var/discourse/ + + # cd /var/discourse/ + + # git clone https://github.com/discourse/discourse_docker.git /var/discourse/ + +克隆好仓库后,我们给discourse服务器复制配置文件 + + # cp samples/standalone.yml containers/app.yml + +![Cloning Discourse Docker](http://blog.linoxide.com/wp-content/uploads/2015/04/cloning-discourse-docker.png) + +### 4. 配置Discourse ### + +接下来,我们用自己喜欢的文本编辑器,编辑容器目录下的discourse配置文件app.yml + + # nano containers/app.yml + +现在,我们需要将开发者邮箱地址DISCOURSE_DEVELOPER_EMAILS修改为自己的,如下。 + + DISCOURSE_DEVELOPER_EMAILS: 'arun@linoxide.com' + +然后,我们设置主机名为服务器的域名。 + + DISCOURSE_HOSTNAME: 'discourse.linoxide.com' + +接着,设置放在相同的discourse主机或vps上的SMTP服务器的认证信息。这些SMTP设置用于你的Discourse发送邮件。 + + DISCOURSE_SMTP_ADDRESS: smtp.linoxide.com + DISCOURSE_SMTP_PORT: 587 # (optional) + DISCOURSE_SMTP_USER_NAME: admin@linoxide.com # (optional) + DISCOURSE_SMTP_PASSWORD: test123 # (optional) + +![](http://blog.linoxide.com/wp-content/uploads/2015/04/discourse-configuration.png) + +如果你在使用一个1GB的Discourse,设定UNICORN_WORKERS为2,db_shared_buffers为128MB,这样你会有更多的内存空间。 + +运行Discourse需要强制性地创建一个邮件服务器。如果你已经有一个服务器了那就好办多了,我们可以使用它的认证信息。如果你没有现成的邮件服务器,或者你不知道那是什么。没关系,可以在[Mandrill][1] (或[Mailgun][2]和 [Mailjet][3])创建一个免费的帐号,然后使用其提供的认证信息。 + +### 5. 启动Discourse应用 ### + +配置完discourse的配置文件后,我们当然是想启动Discourse服务器。首先,在/var/discourse/目录下运行下面的命令,加载discourse引导程序。 + + # ./launcher bootstrap app + +![Starting Discourse Bootstrap](http://blog.linoxide.com/wp-content/uploads/2015/04/starting-discourse-bootstrap.png) + +上述命令可能会花去几分钟时间,会自动配置我们的Discourse环境。然后,该进程完成后,我们需要运行下面的命令启动Discourse App + + #./launcher start app + +![Starting Discourse](http://blog.linoxide.com/wp-content/uploads/2015/04/starting-discourse.png) + +如果一切都正常,我们就能使用惯用的浏览器来访问我们新鲜出炉的 Discourse 的 Web 界面了: http://ip-address/ or http://discourse.linoxide.com/ 。然后,我们就可以创建一个新账号并成为管理员。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/04/Discourse-web-interface.png) + +### 维护 ### + +这里往下是/var/discourse/目录里的 launcher 命令的用法,它可以用于我们在Docker 容器里面控制和维护Disourse。 + + 用法: launcher 命令 配置 [--skip-prereqs] + 命令: + start: 启动/初始化一个容器 + stop: 停止一个运行的容器 + restart: 重启一个容器 + destroy:停止并删除一个容器 + enter: 使用 nsenter 进入容器 + ssh: 在一个运行的容器中启动一个 bash shell + logs: 容器的 Docker l日志 + mailtest: 在容器中测试邮件设置 + bootstrap: 基于配置模版来引导一个容器 + rebuild: 重建一个容器(摧毁旧的,初始化,启动新的) + cleanup: 清理所有停止了24小时以上的容器 + + 选项: + --skip-prereqs 不检查前置需求 + --docker-args 当运行 docker 时,展开并传入参数 + +### 总结 ### + +哈哈!我们已经成功使用Docker技术安装了Discourse。Docker技术使得Discourse十分容易安装在任何平台,并且包含所有的要求。我们需要自己的邮件服务器或者邮件服务器的证书来启动它。对于便捷的现代邮件列表,论坛来说,Discourse是一个伟大的平台。(最后这句有些别扭) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/install-discourse-docker-container/ + +作者:[Arun Pyasi][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://mandrillapp.com/ +[2]:http://www.mailgun.com/ +[3]:https://www.mailjet.com/pricing diff --git a/published/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md b/published/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md new file mode 100644 index 0000000000..052103ddda --- /dev/null +++ b/published/20150420 Managing file and directory attributes in linux using chattr and lsattr command.md @@ -0,0 +1,200 @@ +在Linux中用chattr和lsattr命令管理文件和目录属性 +================================================================================ +为了允许添加数据,防止更改或者删除等,文件和文件夹可以设定了特定的控制属性。例如,你可以在关键的系统文件或者文件夹中启用属性,然后没有任何用户,包括root,可以删除或者修改它,比如不允许使用像dump这样的命令等备份工具去备份一个特定的文件或者文件夹,等等。这些属性只可以在ext2,ext3或者ext4文件系统中的文件和文件夹上设定。 + +有两个命令 **lsattr** 和 **chattr** 用来管理属性。下面是常用属性的列表。 + +注:表格代码 + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

属性

+
+

描述

+
+

a (append)

+
+

允许在文件中进行追加操作

+
+

A

+
+

这个属性不允许更新文件的访问时间

+
+

c (compressed)

+
+

启用这个属性时,文件在磁盘上会自动压缩

+
+

d (dump)

+
+

不能使用dump命令备份文件

+
+

D

+
+

设置了文件夹的D属性时,更改会在同步保存在磁盘上

+
+

e (extent format)

+
+

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

+
+

i (immutable)

+
+

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

+
+

j (journaling)

+
+

设置了这个属性时,文件的数据首先保存在日志中,然后再写入文件

+
+

S (synchronous)

+
+

设置了这个属性时,变更或更改同步保存到磁盘上

+
+ +chattr属性中可以使用的不同选项 : + +- **-R** 递归地修改文件夹和子文件夹的属性 +- **-V** chattr命令会输出带有版本信息的冗余信息 +- **-f** 忽略大部分错误信息 + +在chattr中用于设置或者取消属性的 **操作符** + +- '+' 符号用来为文件和文件夹设置属性, +- '-' 符号用来移除或者取消属性 +- '=' 使它们成为文件有的唯一属性。 + +**chattr** 和 **lsattr** 命令的基本语法 : + + # chattr + + # lsattr + +### 例:1 使用‘i’属性使文件不可更改 ### + + [root@linuxtechi ~]# chattr +i dummy_data + [root@linuxtechi ~]# lsattr dummy_data + ----i----------- dummy_data + +现在试着删除或者修改文件 + + [root@linuxtechi ~]# rm -f dummy_data + rm: cannot remove 'dummy_data': Operation not permitted + + [root@linuxtechi ~]# echo "test" >> dummy_data + -bash: dummy_data: Permission denied + +### 例:2 移除不可更改属性 ### + + [root@linuxtechi ~]# chattr -i dummy_data + [root@linuxtechi ~]# lsattr dummy_data + ---------------- dummy_data + +### 例:3 在文件中只允许追加操作 ### + + [root@linuxtechi ~]# chattr +a dummy_data + [root@linuxtechi ~]# lsattr dummy_data + -----a---------- dummy_data + +现在试着把fstab文件的内容追加到dummy_data文件 + + [root@linuxtechi ~]# cat /etc/fstab >> dummy_data + [root@linuxtechi ~]# + +### 例 :4 使用 -R 选项和 ‘+i’ 属性使文件夹和它的子文件夹成为安全目录 ### + +让我们来新建一个sysadmin文件夹和它的子文件夹 + + [root@linuxtechi ~]# mkdir sysadmin + [root@linuxtechi ~]# mkdir sysadmin/admim_{1,2,3,4,5} + [root@linuxtechi ~]# ls -l sysadmin/ + total 0 + drwxr-xr-x. 2 root root 6 Apr 19 09:50 admim_1 + drwxr-xr-x. 2 root root 6 Apr 19 09:50 admim_2 + drwxr-xr-x. 2 root root 6 Apr 19 09:50 admim_3 + drwxr-xr-x. 2 root root 6 Apr 19 09:50 admim_4 + drwxr-xr-x. 2 root root 6 Apr 19 09:50 admim_5 + +在sysadmin文件夹递归设置不可更改属性 + + [root@linuxtechi ~]# chattr -R +i sysadmin + + [root@linuxtechi ~]# lsattr -R sysadmin/ + ----i----------- sysadmin/admim_1 + sysadmin/admim_1: + ----i----------- sysadmin/admim_2 + sysadmin/admim_2: + ----i----------- sysadmin/admim_3 + sysadmin/admim_3: + ----i----------- sysadmin/admim_4 + sysadmin/admim_4: + ----i----------- sysadmin/admim_5 + sysadmin/admim_5: + [root@linuxtechi ~]# + +现在试着用rm命令删除文件夹 + + [root@linuxtechi ~]# rm -rf sysadmin + rm: cannot remove ‘sysadmin/admim_1’: Permission denied + rm: cannot remove ‘sysadmin/admim_2’: Permission denied + rm: cannot remove ‘sysadmin/admim_3’: Permission denied + rm: cannot remove ‘sysadmin/admim_4’: Permission denied + rm: cannot remove ‘sysadmin/admim_5’: Permission denied + [root@linuxtechi ~]# + +使用以下命令递归取消属性 + + [root@linuxtechi ~]# chattr -R -i sysadmin + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/file-directory-attributes-in-linux-using-chattr-lsattr-command/ + +作者:[Pradeep Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ \ No newline at end of file diff --git a/published/20150423 20 Awesome Docker Containers for a Desktop User.md b/published/20150423 20 Awesome Docker Containers for a Desktop User.md new file mode 100644 index 0000000000..a0ef45f433 --- /dev/null +++ b/published/20150423 20 Awesome Docker Containers for a Desktop User.md @@ -0,0 +1,238 @@ +20个令人惊叹的桌面Docker容器 +================================================================================ + +大家好,今天我们会列出一些运行在Docker容器中的很棒的桌面软件,我们可以在自己的桌面系统中运行它们。Docker 是一个开源项目,提供了一个可以打包、装载和运行任何应用的轻量级容器的开放平台。它没有语言支持、框架和打包系统的限制,从小型的家用电脑到高端服务器,在何时何地都可以运行。它可以使部署和扩展web应用程序、数据库和后端服务像搭积木一样容易,而不依赖特定技术栈或提供商。它主要是由开发、运维工程师使用的,因为它简单、快速和方便,可以用来测试和辅助开发他们产品,但是我们也可以在桌面环境使用Docker,这样一些桌面程序可以开箱即用。 + +下边是20个非常棒的桌面软件docker镜像,我们可以使用Docker来运行。 + +### 1. Lynx ### + +Lynx是一个一直以来最受欢迎的文本界面网页浏览器,很多Linux用户都很熟悉它。它应该是现在还在日常和开发环境中被使用的最古老的网页浏览器了。可以使用如下命令运行Lync。 + + $ docker run -it \ + --name lynx \ + jess/lynx + +### 2. Irssi ### + +Irssi是一个非常棒的文本界面IRC客户端。可以使用如下命令运行Irssi。 + + docker run -it --name my-irssi -e TERM -u $(id -u):$(id -g) \ + -v $HOME/.irssi:/home/user/.irssi:ro \ + -v /etc/localtime:/etc/localtime:ro \ + irssi + +### 3. Chrome ### + +Chrome是一个令人惊叹的图形界面网页浏览器,由Google开发,它基于开源的Chromium项目。Google Chrome是一个被广泛使用的、快速安全的网页浏览器,经常上网的人会非常熟悉它。我们可以使用如下命令在Docker中运行Chrome。 + + $ docker run -it \ + --net host \ + --cpuset 0 \ + --memory 512mb \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v $HOME/Downloads:/root/Downloads \ + -v $HOME/.config/google-chrome/:/data \ + -v /dev/snd:/dev/snd --privileged \ + --name chrome \ + jess/chrome + +### 4. Tor浏览器 ### + +Tor浏览器是一个支持匿名访问的网页浏览器。它让我们可以自由地在网络世界遨游,或者浏览被特定组织或者网络服务提供商封锁的网站。它会阻止别人通过监视我们的网络连接来窃取我们在网络上的一举一动以及我们的确切位置。运行如下命令运行Tor浏览器。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v /dev/snd:/dev/snd --privileged \ + --name tor-browser \ + jess/tor-browser + +### 5. Firefox浏览器 ### + +Firefox浏览器是一个自由开源的网页浏览器,它由Mozilla基金会开发。它使用Gecko和SpiderMonkey引擎。Firefox浏览器有很多新特性,并且它以性能和安全性著称。 + + $ docker run -d \ + --name firefox \ + -e DISPLAY=$DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + kennethkl/firefox + +### 6. Rainbow Stream ### + +Rainbow Stream是一个文本界面的Twitter客户端,有实时显示tweetstream、搜索、喜欢和更多其他特性,可以直接在终端使用。使用如下命令运行Rainbow Stream。 + + $ docker run -it \ + -v /etc/localtime:/etc/localtime \ + -v $HOME/.rainbow_oauth:/root/.rainbow_oauth \ + -v $HOME/.rainbow_config.json:/root/.rainbow_config.json \ + --name rainbowstream \ + jess/rainbowstream + +### 7. Gparted ### + +Gparted是一个用来给磁盘分区的开源软件。现在可以在Docker容器里享受分区的乐趣了。可以使用如下命令运行gparted。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + --device /dev/sda:/dev/sda \ # 将设备挂载为分区 + --name gparted \ + jess/gparted + +### 8. GIMP图片编辑器 ### + +GIMP(Gnu Image Manipulation Program)是一个令人惊叹的Linux图片编辑软件。它是一个可以自由分发的可以处理照片修正、图像合成和图像创作等任务的工具。 + + $ docker run -it \ + --rm -e DISPLAY=$DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + jarfil/gimp-git + +### 9. Thunderbird ### + +Thunderbird是一个自由开源的电子邮件软件,它由Mozilla基金会开发和维护。它有众多一个电子邮件软件应该具有的功能。Thunderbird非常易于安装和定制。使用如下命令在Docker中运行Thunderbird。 + + $ docker run -d \ + -e DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -u docker \ + -v $HOME/docker-data/thunderbird:/home/docker/.thunderbird/ \ + yantis/thunderbird thunderbird + +### 10. Mutt ### + +Mutt是一个文本界面的电子邮件客户端,有很多很酷的功能,如彩色支持,IMAP、POP3、SMTP支持,邮件存储支持等。 使用如下命令运行Mutt。 + + $ docker run -it \ + -v /etc/localtime:/etc/localtime \ + -e GMAIL -e GMAIL_NAME \ + -e GMAIL_PASS -e GMAIL_FROM \ + -v $HOME/.gnupg:/home/user/.gnupg \ + --name mutt \ + jess/mutt + +### 11. Skype ### + +Skype是一个支持文字、语音和视频的即时通讯软件,它不是开源的,但在Linux下可以运行的很好。我们同样可以在Docker中运行Skype,使用如下命令。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -v /dev/snd:/dev/snd --privileged \ + -e DISPLAY="unix$DISPLAY" \ + tianon/skype + +### 12. Cathode ### + +Cathode是一个漂亮并且高度可定制的终端模拟器,灵感来自古典计算机。使用如下命令运行Cathode。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + --name cathode \ + jess/1995 + +### 13. LibreOffice ### + +LibreOffice是一个功能强大的办公套件,它是自由开源的,现在由The Document基金会维护。它有干净的界面和强大的功能,让我们释放创造力和提升生产力。LibreOffice将数个应用程序集成在一起,是市面上最强大的自由并且开源的办公套件。 + + $docker run \ + -v $HOME/Documents:/home/libreoffice/Documents:rw \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e uid=$(id -u) -e gid=$(id -g) \ + -e DISPLAY=unix$DISPLAY --name libreoffice \ + chrisdaish/libreoffice + +### 14. Spotify ### + +Spotify可以即时访问数百万的歌曲,从经典老歌到最新单曲。可以使用如下命令在Docker中听我们最喜欢的歌曲。 + + $ docker run -it \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e DISPLAY=unix$DISPLAY \ + -v /dev/snd:/dev/snd --privileged \ + --name spotify \ + jess/spotify + +### 15. Audacity ### + +Audacity是一个自由开源的跨平台软件,用来录制和编辑音频。Audacity可以用来做所有类型音频(例如podcast)的后期处理,如归一化、调整、淡入淡出。使用如下命令来运行Audacity。 + + $ docker run --rm \ + -u $(id -u):$(id -g) \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -v /dev/snd:/dev/snd \ + -v "$HOME:$HOME" \ + -w "$HOME" \ + -e DISPLAY="unix$DISPLAY" \ + -e HOME \ + $(find /dev/snd/ -type c | sed 's/^/--device /') \ + knickers/audacity + +### 16. Eclipse ### + +Eclipse是一个集成开发环境。它包含基本的工作区和用来定制环境的可扩展插件系统。它在Java开发者中很流行。 + + $ docker run -v ~/workspace/:/home/eclipse/workspace/ \ + -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -d leesah/eclipse + +### 17. VLC媒体播放器 ### + +VLC是一个自由开源的跨平台多媒体播放器,可以播放本地文件、DVD、CD、VCD和各种流媒体。VLC由VideoLAN组织开发和维护。使用如下命令运行VLC。 + + $ docker run -v\ + $HOME/Documents:/home/vlc/Documents:rw \ + -v /dev/snd:/dev/snd --privileged \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -e uid=$(id -u) -e gid=$(id -g) \ + -e DISPLAY=unix$DISPLAY --name vlc \ + chrisdaish/vlc + +### 18. Vim编辑器 ### + +Vim是一个高度可配置的文本界面文字编辑器,为高效的文本编辑而生。它是预装在多数UNIX系统中的vi编辑器的改进版本。 + + $ docker run -i -t --name my-vim -v ~/:/home/dev/src haron/vim + +### 19. Inkscape ### + +Inkscape是一个自由开源的矢量图形编辑器。它可以创建、编辑矢量图形,如插图、图示、线条艺术、图表、徽标以及更复杂的绘画。Inkscape使用的主要矢量图形格式是SVG 1.1版本。它也可以导入和导出一些其他的格式,但实际编辑使用的还是SVG格式。 + + $docker build -t rasch/inkscape --rm . + $ docker run --rm -e DISPLAY \ + -u inkscaper + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v $HOME/.Xauthority:/home/inkscaper/.Xauthority \ + --net=host rasch/inkscape + +### 20. Filezilla ### + +Filezilla是一个免费的FTP解决方案,支持FTP、SFTP、FTPS协议。它的客户端是一个功能强大的文件管理工具。它是一个很棒的高度可靠和易用的开源FTP解决方案。 + + $ xhost +si:localuser:$(whoami) + $ docker run \ + -d \ + -e DISPLAY \ + -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ + -u docker \ + -v /:/host \ + -v $HOME/docker-data/filezilla:/home/docker/.config/filezilla/ \ + yantis/filezilla filezilla + +### 总结 ### + +使用Docker运行桌面软件真的是很棒的体验。Docker是一个快速、简单的开发平台,适合从家里、办公室到生产环境里传送和开发软件的场景。使用Docker运行桌面软件是试用而不将其安装到自己实体机文件系统中的很酷的方法。如果你有任何问题、评论或者反馈,清写在下方的评论框中,让我们知道哪些是需要增加或者改进的。谢谢!享受Docker吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/20-docker-containers-desktop-user/ + +作者:[Arun Pyasi][a] +译者:[goreliu](https://github.com/goreliu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/published/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md b/published/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md new file mode 100644 index 0000000000..0b141dcf33 --- /dev/null +++ b/published/20150423 How IP forwarding Helps Connecting Private interface to Internet in Linux.md @@ -0,0 +1,76 @@ +如何在 Linux 上用 IP转发使内部网络连接到互联网 +================================================================================ + +大家好,今天我们学习一下在 Linux 上用 iptables 实现从一个网络接口到另一个接口的IP转发(数据包转发)。IP转发的概念是,使 Linux 机器像路由器一样将数据从一个网络发送到另一个网络。所以,它能作为一个**路由器**或者代理服务器,实现将一个连接的互联网或者网络连接共享给多个客户端机器。 + +这是一些启用IP转发或网络包转发方法的简单步骤。 + +### 1. 启用 IPv4 转发 ### + +首先,我们需要在我们的 Linux 操作系统上启用 IPv4 转发。要做到这点,我们需要用 sudo 模式在 shell 或终端下执行下面的命令。 + + $ sudo -s + + # echo 1 > /proc/sys/net/ipv4/ip_forward + +![临时IP转发](http://blog.linoxide.com/wp-content/uploads/2015/03/ip-forward-temporary.png) + +**注意:上面的命令能马上启用ip转发,但只是临时的,直到下一次重启。要永久启用,我们需要使用我们惯用的文本编辑器打开 /etc/sysctl.conf 文件。** + + # nano /etc/sysctl.conf + +然后,增加 **net.ipv4.ip_forward = 1** 到文件中,或者删除那行的注释,保存并退出文件。 + + net.ipv4.ip_forward = 1 + +![编辑 Sysctl](http://blog.linoxide.com/wp-content/uploads/2015/03/sysctl-edit.png) + +运行下面的命令启用更改。 + + # sysctl -p /etc/sysctl.conf + +![启用 Sysctl 更改](http://blog.linoxide.com/wp-content/uploads/2015/03/enabling-changes-sysctl.png) + +### 2. 配置 Iptables 防火墙 ### + +我们需要允许特定的(或者所有的)数据包通过我们的路由器。在这之前,我们要知道连接我们 Linux 的网络设备的接口名称。我们可以通过在终端或者 shell 运行以下命令获得接口名称。 + + # ifconfig -a + +![Ifconfig](http://blog.linoxide.com/wp-content/uploads/2015/03/ifconfig.png) + +这里,在我们的机器中, eth2 是连接到互联网或者网络的网卡接口, wlan2 是我们要使用 iptables 从 eth2 转发数据包的接口。要实现转发,我们需要运行以下命令。 + + # iptables -A FORWARD -i wlan2 -o eth2 -j ACCEPT + +注意:请用你 Linux 机器中的可用设备名称替换 wlan2 和 eth2。 + +现在,由于netfilter/iptables是一个无状态的防火墙,我们需要让 iptables 允许已建立的连接通过。要做到这点,我们要运行下面的命令。 + + # iptables -A FORWARD -i eth2 -o wlan2 -m state --state ESTABLISHED,RELATED -j ACCEPT + +![用 iptables 转发](http://blog.linoxide.com/wp-content/uploads/2015/03/forwarding-iptables.png) + +### 3. 配置 NAT ### + +然后,最后我们需要通过执行下面的命令修改发送到互联网的数据包的源地址为 eth2。 + + # iptables -t nat -A POSTROUTING -o eth2 -j MASQUERADE + +![配置 nat](http://blog.linoxide.com/wp-content/uploads/2015/03/configuring-nat.png) + +### 总结 ### + +最后,我们在我们以 iptables 作为防火墙 Linux 机器上成功的配置了从一个接口到另一个接口的数据包转发。这篇文章教给你将你的私有接口连接到互联网,不需要桥接接口,而是将从一个接口进来的数据包路由到另一个接口。就是这些,如果你有任何问题、建议、反馈,请写到下面的评论框中,然后我们可以改进或更新我们的内容。非常感谢!享受吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/firewall/ip-forwarding-connecting-private-interface-internet/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/published/20150423 How to Change Default Web Browser and Email Client in Ubuntu.md b/published/20150423 How to Change Default Web Browser and Email Client in Ubuntu.md new file mode 100644 index 0000000000..958ce87fae --- /dev/null +++ b/published/20150423 How to Change Default Web Browser and Email Client in Ubuntu.md @@ -0,0 +1,77 @@ +如何在 Ubuntu 中更改默认浏览器和 Email 客户端 +================================================================================ +Ubuntu 自带了一些已经预装的默认应用程序,包括非常流行的 Mozilla 火狐浏览器和 Thunderbird 的 e-mail 客户端。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/07/web-browser.png) + +尽管这两个应用都有它们自己的粉丝,但是没有一个应用能符合每个人的口味和需要。我们经常收到邮件或者推文,询问我们可以怎样在 Ubuntu 上更改默认浏览器或者设置处理邮件链接为不同的电子邮件客户端等。 + +我们在这里不仅讨论如何安装不同的软件,还包括如何给一个特定的文件,链接或者内容类型设置其系统处理应用。 + +在 Ubuntu 中更改默认应用程序,包括浏览器、电子邮件客户端、文本编辑器、音乐和视频播放器都非常的简单。但并不是每个人都知道更改这些的设置面板在哪里,让我们来快速看一下吧。 + +### 如何在 Ubuntu 上更改默认浏览器 ### + +Mozilla 火狐浏览器是一扇稳定、开源而且可靠的互联网之窗,但它并不是每个人的选择。这都没关系。 + +要在 Ubuntu 上使用不同的默认浏览器,首先,显而易见,你需要安装一个新的浏览器。你该怎么做取决于你想要的浏览器: + +- 开源浏览器,例如 [Epiphany][1], [Chromium][2] 和 [IceWeasel][3],可以从 Ubuntu 软件中心安装。 + +- 主流浏览器,例如 [Google Chrome][4], [Opera][5] 和 [Vivaldi][6] 必须从各自项目的官方网站上下载。 + +不管你选择哪个浏览器,不管你选择怎样安装,完成之后你就可以继续了。 + +要更改在点击其它应用(如即时通讯软件、Twitter 客户端、 e-mail 中)中的链接时打开的默认网页浏览器,你需要用到 Ubuntu 系统设置工具。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/system-settings-ubuntu-300x215.jpg) + +你可以用多种方法打开系统设置。其中一种最快的方式是点击右上角(RTL系统是左上角)的 Cog 图标并选择‘系统设置’菜单快捷方式。 + +1. 打开‘系统设置’ +1. 选择‘详细’选项 +1. 在侧边栏选择‘默认应用程序’ +1. 把 ‘Web’ 条目的 ‘火狐’ 改为你想要的选项 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/change-default-browser-in-ubuntu-750x402.jpg) + +就是这样。 + +### 如何在 Ubuntu 上更改默认的邮件客户端 ### + +Ubuntu 用 Thunderbird 作为默认的邮件应用程序。这意味着当你点击大部分浏览器、 PDF文件、及时通讯软件等上的 **电子邮件地址或者一个 [mailto 链接][7] 的时候会自动打开** 这个应用。 + +当然,如果你使用 Thunderbird,这真的很方便。但是我们很多人并非如此; 我们可能**[使用像 Geary 这样的轻量级客户端][8]**,GNOME stalwart Evolution,或者依靠像 Gmail 或者 Outlook 这样的网络邮件服务。 + +在 Ubuntu 上从 Thunderbird **更改默认邮件客户端** 到另一个应用程序,打开系统设置 > 详细 > 默认应用程序。点击下拉菜单到 ‘Mail’ 并选择从列表中选择你喜欢的客户端。 + +**在 Ubuntu 上设置 Gmail 为默认的邮件客户端**,你首先需要点击下面的按钮安装 ‘gnome-gmail’ 软件包。安装完后打开系统设置 > 详细 > 默认应用程序。然后点击‘Mail’ 的下拉菜单,并选择从列表中选择 ‘Gmail’。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/CHANGE-DEFAULT-APPS-UBUNTU.jpg) + +- [在 Ubuntu 上安装 GNOME Gmail][9] + +### 更多 ### + +上述同样的步骤也可以用来设置你双击音乐文件时打开你喜欢的音乐播放器,用比如 VLC 应用程序处理 .avi 和 .mp4 文件,等等。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/04/change-your-default-web-browser-in-ubuntu + +作者:[Joey-Elijah Sneddon][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://wiki.gnome.org/Apps/Web +[2]:https://apps.ubuntu.com/cat/applications/chromium-browser/ +[3]:https://wiki.debian.org/Iceweasel +[4]:https://www.google.co.uk/chrome/browser/desktop/ +[5]:http://www.opera.com/computer/linux +[6]:https://vivaldi.com/#Download +[7]:http://en.wikipedia.org/wiki/Mailto +[8]:https://linux.cn/article-5511-1.html +[9]:apt://gnome-gmail \ No newline at end of file diff --git a/published/20150427 15 Things to Do After Installing Ubuntu 15.04 Desktop.md b/published/20150427 15 Things to Do After Installing Ubuntu 15.04 Desktop.md new file mode 100644 index 0000000000..de0f973cc8 --- /dev/null +++ b/published/20150427 15 Things to Do After Installing Ubuntu 15.04 Desktop.md @@ -0,0 +1,332 @@ +安装完Ubuntu 15.04桌面后要做的15件事 +================================================================================ +本教程适用于在自己的电脑上安装了 Ubuntu 15.04 “Vivid Vervet” 桌面的新手,这里会告诉你安装之后应该做哪些事情,来自定义你的系统和安装一些基本程序作为日常使用。 + +![Things to Do After Installing Ubuntu 15.04](http://www.tecmint.com/wp-content/uploads/2015/04/things-to-do-after-installing-ubuntu-15.04.jpeg) + +*安装完Ubuntu 15.04桌面后要做的15件事* + +### 1. 启用Ubuntu额外软件库并更新系统 ### + +在刚装好Ubuntu之后你应该要关心的第一件事是启用Canonical的官方合作伙伴提供的Ubuntu额外软件库,并且通过最近一次的安全补丁和软件更新来保持系统是最新状态。 + +要完成这一步,依次从左边菜单中打开System Settings -> Software and Updates工具,并检查所有Ubuntu软件和其他软件库(Canonical 的合作伙伴所提供),点击关闭按钮并等待重新加载缓存源树。 + +![Software Updates](http://www.tecmint.com/wp-content/uploads/2015/04/Software-Updates.jpg) + +*软件更新* + +![Other Software (Canonical Partners)](http://www.tecmint.com/wp-content/uploads/2015/04/Other-Software.jpg) + +*其它软件(Canonical 合作伙伴)* + +为了快速而顺畅的更新,打开终端并输入以下命令来让系统使用新软件库: + + $ sudo apt-get update + $ sudo apt-get upgrade + +![Ubuntu Upgrade](http://www.tecmint.com/wp-content/uploads/2015/04/Ubuntu-Upgrade.jpg) + +*Ubuntu 升级* + +### 2. 安装额外驱动 ### + +为了能让系统扫描并安装额外的硬件专有驱动,我们依然从System Settings打开Software and Updates工具,选择Additional Drivers标签并等待该工具扫描驱动。 + +如果有驱动匹配到了你的硬件,查看你想要安装的驱动并点击Apply按钮来安装它。如果专有驱动没有如预期的工作,用Revert按钮就能卸载它们或勾选Do not use the device后点击Apply按钮。 + +![Install Drivers in Ubuntu](http://www.tecmint.com/wp-content/uploads/2015/04/install-drivers.jpg) + +*安装驱动* + +### 3. 安装Synaptic和Gdebi工具 ### + +除了Ubuntu Software Center之外,Synaptic也是一个apt的图形化工具,通过它你能管理、安装、卸载、搜索和升级软件库并配置软件包。同样的,Gdebi对本地的.deb 包也有类似功能。在终端上输入以下命令来安装这两个包: + + $ sudo apt-get install synaptic gdebi + +![Install Synaptic and Gdebi](http://www.tecmint.com/wp-content/uploads/2015/04/install-synaptic-gdebi.jpg) + +*安装 Synaptic 和 Gdebi* + +![Synaptic Package Manager](http://www.tecmint.com/wp-content/uploads/2015/04/synaptic-package-manager.jpg) + +*Synaptic 包管理器* + +### 4. 更改系统外观和行为 ### + +如果你想要更改桌面背景或图标大小,依次打开System Settings –> Appearance –> Look,并对桌面进行个性化设置。要把菜单移动到窗口标题栏,在Behavior标签中设置即可。 + +![System Appearances](http://www.tecmint.com/wp-content/uploads/2015/04/system-appearance.jpg) + +*系统外观* + +### 5. 提升系统安全性和隐私性 ### + +![System Security Enhancement](http://www.tecmint.com/wp-content/uploads/2015/04/system-security-1.jpg) + +*增强系统安全* + +![System Security Options](http://www.tecmint.com/wp-content/uploads/2015/04/system-security-2.jpg) + +*系统安全选项* + +### 6. 禁用不需要开机自启动的应用程序 ### + +要提高登录系统的速度,通过输入以下命令来显示被隐藏的开机启动应用程序。 + + $ sudo sed -i 's/NoDisplay=true/NoDisplay=false/g' /etc/xdg/autostart/*.desktop + +在Dash中搜索打开Startup Applications工具,并反选不需要在登录系统的过程中启动的程序。 + +![Disable Unwanted Applications](http://www.tecmint.com/wp-content/uploads/2015/04/disable-unwanted-applications.jpg) + +*禁用不需要的应用程序* + +### 7. 添加扩展多媒体支持 ### + +默认情况下,Ubuntu对多媒体文件支持不是很好。为了能播放各种不同的多媒体格式或解析视频文件,可以安装以下多媒体应用程序: + +- VLC +- Smplayer +- Audacious +- QMMP +- Mixxx +- XBMC +- Handbrake +- Openshot + +用以下命令来一次性安装所有的这些应用程序: + + $ sudo apt-get install vlc smplayer audacious qmmp mixxx xbmc handbrake openshot + +![Install Media Players](http://www.tecmint.com/wp-content/uploads/2015/04/install-media-players.jpg) + +*安装媒体播放器* + +![Media Player Playlist](http://www.tecmint.com/wp-content/uploads/2015/04/media-playllist.jpg) + +*媒体播放器的播放列表* + +除了多媒体播放器,安装ubuntu-restricted-extras和Java支持包也可以解码并支持其它受限制的多媒体格式。 + + $ sudo apt-get install ubuntu-restricted-extras openjdk-8-jdk + +![Install Ubuntu Extras](http://www.tecmint.com/wp-content/uploads/2015/04/install-ubuntu-extras.jpg) + +*安装 Ubuntu Extras* + +在终端上输入以下命令来启用DVD 回放和其它多媒体解码器: + + $ sudo apt-get install ffmpeg gstreamer0.10-plugins-bad lame libavcodec-extra + $ sudo /usr/share/doc/libdvdread4/install-css.sh + +![Enable Video Codes](http://www.tecmint.com/wp-content/uploads/2015/04/enable-video-playbacks.jpg) + +*启用视频解码器* + +### 8. 安装图像处理应用程序和安装媒体烧录软件 ### + +如果你是一个摄影爱好者,想在Ubuntu上处理调整图像,或许需要安装一下图像处理程序: + +- GIMP (一个 Adobe Photoshop 替代品) +- Darktable +- Rawtherapee +- Pinta +- Shotwell +- Inkscape (一个 Adobe Illustrator 替代品) +- Digikam +- Cheese + +这些应用程序能从Ubuntu Software Center中安装,或者立刻在终端上使用以下命令: + + $ sudo apt-get install gimp gimp-plugin-registry gimp-data-extras darktable rawtherapee pinta shotwell inkscape + +![Install Image Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-image-applications.jpg) + +*安装图像处理应用程序* + +![Rawtherapee Tool](http://www.tecmint.com/wp-content/uploads/2015/04/rawtherapee.jpg) + +*Rawtherapee Tool* + +如果要挂载ISO镜像或烧录一张CD或DVD,你可以选择并安装以下软件中的一款: + +- Brasero Disk Burner +- K3b +- Xfburn +- Furius ISO Mount + + $ sudo apt-get install brasero + $ sudo apt-get install k3b + $ sudo apt-get install xfburn + $ sudo apt-get install furiusisomount + +![Install Media Burners](http://www.tecmint.com/wp-content/uploads/2015/04/install-media-burners.jpg) + +*安装媒体烧录软件* + +### 9. 安装压缩应用程序 ### + +如果要处理大多数归档格式的文件(zip, tar.gz, zip, 7zip rar等等),输入以下命令来安装这些包: + + $ sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller + +![Install Archive Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-archive-apps.jpg) + +*安装压缩应用程序* + +### 10. 安装聊天应用程序 ### + +如果你想要和世界各地的人们聊天,这里有一份最流行的Linux聊天应用程序列表: + +- Pidgin +- Skype +- Xchat +- Telegram +- aMSN +- Viber + +你可以从Ubuntu Software Center中安装它们或使用以下命令: + + $ sudo apt-get install pidgin + $ sudo apt-get install skype + $ sudo apt-get install xchat + $ sudo apt-get install amsn + $ sudo add-apt-repository ppa:atareao/telegram -y + $ sudo apt-get update + $ sudo apt-get install telegram + +![Install Chat Applications](http://www.tecmint.com/wp-content/uploads/2015/04/install-chat-apps.jpg) + +*安装聊天应用程序* + +想要在Ubuntu上安装Viber可以访问[Viber官方网站][1]下载Debian安装包到本地,并用Gdebi包管理工具来安装viber.deb应用程序(右击 –> 打开 -> GDebi Package Installer). + +![Install Viber in Ubuntu](http://www.tecmint.com/wp-content/uploads/2015/04/install-viber.jpg) + +*安装 Viber* + +### 11. 安装种子软件 ### + +在Ubuntu最流行的种子应用程序和P2P文件共享程序是: + +- Deluge +- Transmission +- Qbittorrent +- LinuxDC++ + +想要在Ubuntu上安装你最喜欢的P2P文件共享应用程序,可以在终端上输入以下命令: + + $ sudo apt-get install deluge + $ sudo apt-get install transmission + $ sudo apt-get install qbittorrent + $ sudo apt-get install linuxdcpp + +![Install Torrent](http://www.tecmint.com/wp-content/uploads/2015/04/install-torrent.jpg) + +*安装种子软件* + +### 12. 安装Windows仿真器-Wine和游戏支持平台-Steam ### + +Wine仿真器允许你在Linux上安装并运行Window应用程序。在另一方面,Steam是一款Valve开发的基于Linux系统的流行游戏平台。想要在你的机器上安装它们,可以输入以下命令或使用Ubuntu Software Center。 + + $ sudo apt-get install steam wine winetricks + +![Install Wine](http://www.tecmint.com/wp-content/uploads/2015/04/install-wine.jpg) + +*安装 Wine* + +### 13. 安装Cairo-Dock并启用桌面视觉效果 ### + +Cairo-Dock是一款漂亮且灵巧的用于Linux桌面上的启动条,类似于Mac OS X dock。想要在Ubuntu上安装它,可以在终端上运行以下命令: + + $ sudo apt-get install cairo-dock cairo-dock-plug-ins + +![Install Cairo Dock](http://www.tecmint.com/wp-content/uploads/2015/04/install-cairo-dock.jpg) + +*安装Cairo-Dock* + +![Add Cairo Dock at Startup](http://www.tecmint.com/wp-content/uploads/2015/04/add-cairo-dock-startup.jpg) + +*让 Cairo Dock 自动启动* + +想要启用某一套桌面效果,例如Cube效果,可以使用以下命令来安装Compiz包: + + $ sudo apt-get install compiz compizconfig-settings-manager compiz-plugins-extra + +想要激活桌面Cube效果,在Dash上查找ccsm来打开CompizConfig Settings Manager,找到General Options – > Desktop Size并设置Horizontal Virtual Size的值为4,Vertical Virtual Size的值为1。然后返回检查Desktop Cube框(禁用Desktop Wall)和Rotate Cube框(解决冲突 -> 禁止切换视图1)并Ctrl+Alt+鼠标左击来查看cube效果。 + +![Enable Compiz](http://www.tecmint.com/wp-content/uploads/2015/04/enable-compiz.jpg) + +*启用Compiz* + +![Compiz Settings](http://www.tecmint.com/wp-content/uploads/2015/04/compiz-settings.jpg) + +*Compiz设置* + +![Compiz Settings Addons](http://www.tecmint.com/wp-content/uploads/2015/04/compiz-settings-1.jpg) + +*Compiz设置插件* + +![Desktop Window Rotating](http://www.tecmint.com/wp-content/uploads/2015/04/desktop-cube.jpg) + +*桌面窗口旋转* + +### 14. 添加其它浏览器 ### + +Ubuntu 15.04默认浏览器是Mozilla Firefox。想要安装其它浏览器比如Google Chrome或Opera,可以访问它们的官方网站,下载所提供的.deb包并用Gdebi Package Installer在你的系统上安装它们。 + +![Enable Browser Support](http://www.tecmint.com/wp-content/uploads/2015/04/enable-browser-support.jpg) + +*启用浏览器支持* + +![Opera Browser Support](http://www.tecmint.com/wp-content/uploads/2015/04/opera.jpg) + +*Opera Browser* + +想要安装Chromium开源浏览器请在终端上输入以下命令: + + $ sudo apt-get install chromium-browser + +### 15. 安装Tweak工具 ### + +想要用额外的应用程序来自定义Ubuntu吗?在终端上输入以下命令来安装Unity Tweak工具和Gnome Tweak工具: + + $ sudo apt-get install unity-tweak-tool gnome-tweak-tool + +![Install Tweak Tool](http://www.tecmint.com/wp-content/uploads/2015/04/install-tweak-tool.jpg) + +*安装Tweak Tool* + +![Tweak Tool Settings](http://www.tecmint.com/wp-content/uploads/2015/04/tweak-settings.jpg) + +*Tweak Tool 设置* + +另一个有趣的tweak工具主要是Ubuntu Tweak包,可以通过访问官方网站来获取并安装: [http://ubuntu-tweak.com/][2]。 + +![Tweak Tool: System Information](http://www.tecmint.com/wp-content/uploads/2015/04/tweak-system-info.jpg) + +*Tweak Tool: 系统信息* + +在你安装好这一连串软件之后,你或许想要清理一下你的系统来释放一点硬盘上的空间,输入以下命令即可: + + $ sudo apt-get -y autoremove + $ sudo apt-get -y autoclean + $ sudo apt-get -y clean + +这只是一些普通用户日常使用Ubuntu 15.04桌面是需要调整和安装的程序。想要了解更多高级的程序,特性和功能,请使用Ubuntu Software Center或查阅Ubuntu Wiki主页。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/things-to-do-after-installing-ubuntu-15-04-desktop/ + +作者:[Matei Cezar][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/cezarmatei/ +[1]:http://www.viber.com/en/products/linux +[2]:http://ubuntu-tweak.com/ diff --git a/published/20150427 How to set up NTP server in CentOS.md b/published/20150427 How to set up NTP server in CentOS.md new file mode 100644 index 0000000000..deb5cc3ca6 --- /dev/null +++ b/published/20150427 How to set up NTP server in CentOS.md @@ -0,0 +1,165 @@ +如何在 CentOS 中设置 NTP 服务器 +================================================================================ + +网络时间协议(NTP)用来同步网络上不同主机的系统时间。你管理的所有主机都可以和一个指定的被称为 NTP 服务器的时间服务器同步它们的时间。而另一方面,一个 NTP 服务器会将它的时间和任意公共 NTP 服务器,或者你选定的服务器同步。由 NTP 管理的所有系统时钟都会同步精确到毫秒级。 + +在公司环境中,如果他们不想为 NTP 传输打开防火墙,就有必要设置一个内部 NTP 服务器,然后让员工使用内部服务器而不是公共 NTP 服务器。在这个指南中,我们会介绍如何将一个 CentOS 系统配置为 NTP 服务器。在介绍详细内容之前,让我们先来简单了解一下 NTP 的概念。 + +### 为什么我们需要 NTP? ### + +由于制造工艺多种多样,所有的(非原子)时钟并不按照完全一致的速度行走。有一些时钟走的比较快而有一些走的比较慢。因此经过很长一段时间以后,一个时钟的时间慢慢的和其它的发生偏移,这就是常说的 “时钟漂移” 或 “时间漂移”。为了将时钟漂移的影响最小化,使用 NTP 的主机应该周期性地和指定的 NTP 服务器交互以保持它们的时钟同步。 + +在不同的主机之间进行时间同步对于计划备份、[入侵检测][1]记录、[分布式任务调度][2]或者事务订单管理来说是很重要的事情。它甚至应该作为日常任务的一部分。 + +### NTP 的层次结构 ### + +NTP 时钟以层次模型组织。层级中的每层被称为一个 *stratum(阶层)*。stratum 的概念说明了一台机器到授权的时间源有多少 NTP 跳。 + +![](https://farm8.staticflickr.com/7590/16645732413_3b7af58186_c.jpg) + +Stratum 0 由没有时间漂移的时钟组成,例如原子时钟。这种时钟不能在网络上直接使用。Stratum N (N > 1) 层服务器从 Stratum N-1 层服务器同步时间。Stratum N 时钟能通过网络和彼此互联。 + +NTP 支持多达 15 个 stratum 的层级。Stratum 16 被认为是未同步的,不能使用的。 + +### 准备 CentOS 服务器 ### + +现在让我们来开始在 CentOS 上设置 NTP 服务器。 + +首先,我们需要保证正确设置了服务器的时区。在 CentOS 7 中,我们可以使用 timedatectl 命令查看和更改服务器的时区(比如,"Australia/Adelaide",LCTT 译注:中国可设置为 Asia/Shanghai ) + + # timedatectl list-timezones | grep Australia + # timedatectl set-timezone Australia/Adelaide + # timedatectl + +![](https://farm8.staticflickr.com/7605/16645732463_db75a0bdcd_o.png) + +继续并使用 yum 安装需要的软件 + + # yum install ntp + +然后我们会添加全球 NTP 服务器用于同步时间。 + + # vim /etc/ntp.conf + +---------- + + server 0.oceania.pool.ntp.org + server 1.oceania.pool.ntp.org + server 2.oceania.pool.ntp.org + server 3.oceania.pool.ntp.org + +默认情况下,NTP 服务器的日志保存在 /var/log/messages。如果你希望使用自定义的日志文件,那也可以指定。 + + logfile /var/log/ntpd.log + +如果你选择自定义日志文件,确保更改了它的属主和 SELinux 环境。 + + # chown ntp:ntp /var/log/ntpd.log + # chcon -t ntpd_log_t /var/log/ntpd.log + +现在初始化 NTP 服务并确保把它添加到了开机启动。 + + # systemctl restart ntp + # systemctl enable ntp + +### 验证 NTP Server 时钟 ### + +我们可以使用 ntpq 命令来检查本地服务器的时钟如何通过 NTP 同步。 + +![](https://farm9.staticflickr.com/8713/16645732513_1823736ca8_b.jpg) + +下面的表格解释了输出列。 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
remote源在 ntp.conf 中定义。‘*’ 表示当前使用的,也是最好的源;‘+’ 表示这些源可作为 NTP 源;‘-’ 标记的源是不可用的。
refid用于和本地时钟同步的远程服务器的 IP 地址。
stStratum(阶层)
t类型。 'u' 表示单播(unicast)。其它值包括本地(local)、多播(multicast)、广播(broadcast)。
when自从上次和服务器交互后经过的时间(以秒数计)。
poll和服务器的轮询间隔,以秒数计。
reach表示和服务器交互是否有任何错误的八进制数。值 337 表示 100% 成功(即十进制的255)。
delay服务器和远程服务器来回的时间。
offset我们服务器和远程服务器的时间差异,以毫秒数计。
jitter两次取样之间平均时差,以毫秒数计。
+ +### 控制到 NTP 服务器的访问 ### + +默认情况下,NTP 服务器允许来自所有主机的查询。如果你想过滤进来的 NTP 同步连接,你可以在你的防火墙中添加规则过滤流量。 + + # iptables -A INPUT -s 192.168.1.0/24 -p udp --dport 123 -j ACCEPT + # iptables -A INPUT -p udp --dport 123 -j DROP + +该规则允许从 192.168.1.0/24 来的 NTP 流量(端口 UDP/123),任何其它网络的流量会被丢弃。你可以根据需要更改规则。 + +### 配置 NTP 客户端 ### + +#### 1. Linux #### + +NTP 客户端主机需要 ntpupdate 软件包来和服务器同步时间。可以轻松地使用 yum 或 apt-get 安装这个软件包。安装完软件包之后,用服务器的 IP 地址运行下面的命令。 + + # ntpdate + +基于 RHEL 和 Debian 的系统命令都相同。 + +#### 2. Windows #### + +如果你正在使用 Windows,在日期和时间设置(Date and Time settings)下查找网络时间(Internet Time)。 + +#### 3. Cisco 设备 #### + +如果你想要同步 Cisco 设备的时间,你可以在全局配置模式下使用下面的命令。 + + # ntp server + +来自其它厂家的支持 NTP 的设备有自己的用于网络时间的参数。如果你想将设备和 NTP服务器同步时间,请查看设备的说明文档。 + +### 结论 ### + +总而言之,NTP 是在你的所有主机上同步时钟的一个协议。我们已经介绍了如何设置 NTP 服务器并使支持 NTP 的设备和服务器同步时间。 + +希望能对你有所帮助。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/setup-ntp-server-centos.html + +作者:[Sarmed Rahman][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/sarmed +[1]:http://xmodulo.com/how-to-compile-and-install-snort-from-source-code-on-ubuntu.html +[2]:http://xmodulo.com/how-to-install-hdfs-and-hadoop-using.html \ No newline at end of file diff --git a/published/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md b/published/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md new file mode 100644 index 0000000000..dff5090cfc --- /dev/null +++ b/published/20150429 How To Integrate Apache2 With Tomcat 7 Using mod_jk Connector.md @@ -0,0 +1,136 @@ +如何用mod_jk连接器来集成Apache2和Tomcat 7 +================================================================================ +Apache是最流行的web服务器,它通常用来接收客户端的请求并响应。它得到一个URL并将它翻译成一个文件名(或者静态请求),并将文件从本地磁盘中取出,通过因特网返回;或者将它翻译成程序执行它,接着将输出返回给请求方。如果web服务器不能处理和完成请求,它会返回一个错误信息。 + +在本篇中,我们会列出Apache的特性以及我们该如何用mod\_jk连接器来集成Tomcat 7和Tomcat 8. + +### Apache的特性 ### + +如我们所说Apache是最流行的web服务器。下面是流行背后的原因: + +- 它是自由工具,你可以很简单地下载和安装 +- 它开放源码,因此你可以查看源码,调整它,优化它,并且修复错误和安全漏洞。也可以增加新的功能和模块。 +- 它可以用在只有一两个页面的小网站,或者是有成千上万个页面的大网站,每月处理上百万的常规访问者的请求。它可以同时处理静态和动态内容。 +- 改进的缓存模块(mod\_cache、 mod\_disk\_cache、 mod\_mem\_cache)。 +- Apache 2 支持 IPv6. + +### Tomcat 的目录 ### + +${tomcat_home} 是tomcat的根目录。你的tomcat安装应该有下面的子目录: + +- ${tomcat_home}\conf – 存放不同配置文件的地方 +- ${tomcat_home}\webapps – 包含示例程序 +- ${tomcat_home}\bin – 存放你的Web服务器的插件的地方 + +### Mod_jk 模块 ### + +mod\_jk有两种可接受的方式:二进制或者源码。取决于你运行的web服务器的平台,也许有符合你的平台的二进制版本的mod\_jk。如果有的话建议使用这个。 + +mod\_jk模块在这些平台上开发及测试过: + +- 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 + +The mod\_jk 需要两个组件: + +- **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**文件。 + +### 安装 ### + +在开始安装前,非root用户需要使用“sudo”特权。现在我们开始安装,我们将使用下面的命令来安装Apache2和Tomcat: + + 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: + + + + Good Morning + + +

Good Morning

+ Today is: <%= new java.util.Date().toString() %> + + + +一切完毕后,我们将使用下面的命令安装和配置mod\_jk: + + sudo apt-get install libapache2-mod-jk + +我们需要使用下面的命令启用Tomcat的8443转发端口: + + sudo vim /etc/tomcat7/server.xml + +解除下面的注释行: + + + +之后,我们将用下面的命令为Apache创建workers.properties文件: + + sudo vim /etc/apache2/workers.properties + +粘贴下面的行: + + # Define 1 real worker using ajp13 + worker.list=worker + # Set properties for worker (ajp13) + worker.worker.type=ajp13 + worker.worker.host=localhost + worker.worker.port=8009 + +现在我们将使用下面的命令来让Apache使用这个worker: + + sudo vim /etc/apache2/mods-available/jk.conf + +我们将JkWorkersFile属性成下面这行: + + /etc/apache2/workers.properties + +最后配置Apache交给Tomcat处理的URL + + sudo vim /etc/apache2/sites-enabled/000-default + +我们将在配置文件中下面的行: + + + ....................................... + ....................................... + JkMount /tomcat-demo* worker1 + + +现在用下面的命令重启服务来检查它们的功能: + + sudo /etc/init.d/tomcat7 restart + sudo /etc/init.d/apache2 restart + +### 总结 ### + +在本篇中我们展示了你该如何使用mod\_jk连接器配置和安装Apache2以及Tomcat7。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/integrate-apache2-tomcat-7-using-mod_jk-connector/ + +作者:[anismaj][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/anis/ diff --git a/published/20150429 KDE Plasma 5.3 Released, Here' s How To Upgrade in Kubuntu 15.04.md b/published/20150429 KDE Plasma 5.3 Released, Here' s How To Upgrade in Kubuntu 15.04.md new file mode 100644 index 0000000000..5dba39a1d3 --- /dev/null +++ b/published/20150429 KDE Plasma 5.3 Released, Here' s How To Upgrade in Kubuntu 15.04.md @@ -0,0 +1,86 @@ +在 Kubuntu 15.04 中升级 KDE Plasma 5.3 +================================================================================ +**KDE[已经发布了][1]Plasma 5.3的稳定版,它包含了一个新的电源管理方面的稳定特性。** + +[先前四月份的beta版][2]已经让我们印象深刻,甚至跃跃欲试了,Plasma 5桌面环境的稳定版更新的最新更新已经稳定,并且可以下载了。 + +Plasma 5.3继续改善和细化了全新的KDE桌面,它添加了大量的特性供桌面用户体验。同时也修复了**多达400个错误**,这对性能和稳定性方面也进行了大量改善。 + +### Plasma 5.3中的新东西 ### + +![Better Bluetooth Management in Plasma 5.3](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/bluetooth-applet-in-kde.jpg) + +*Plasma 5.3中更好的蓝牙管理* + +而[在早期关于Plasma 5.3的文章][3]中,我们触及了大量**新特性**,这其中很多都值得反复说道说道。 + +**加强的电源管理**特性和配置选项,包括**新的电源小程序、能源使用监控**和**动态屏幕亮度变化**,将有助于让KDE在移动设备上加强续航能力。 + +在连接了外部监视器的时候合上笔记本盖子时,不会再触发‘挂起’操作。这个新的行为被称之为‘**影院模式**’,并且默认开启。但是,可以通功过电源管理设置中的相关选项禁用。 + +**蓝牙功能被改善**,带来了一个全新的面板小程序,使得在连接到并配置配对的蓝牙设备,如智能手机、键盘和扬声器时,比以往更为便捷。 + +同样,对于Plasma 5.3,**KDE中的轨迹板配置更为方便**,这多亏了新的安装和设置模块。 + +![Trackpad, Touchpad. Tomato, Tomayto.](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/touchpad-kde.jpg) + +*轨迹板、触控板。Tomato, Tomayto。* + +对于Plasma小部件狂热者,它带来了一个**按住并锁定**手势。当启用该功能,会隐藏移动鼠标时出现的设置处理。取而代之的是,它只会在长点击小部件时发生该行为。 + +谈到widget-y这类事情时,该发布版中**再次引入了几个旧的Plasmoid中最受欢迎的东西**,包括一个有用的系统监视器、便利的硬盘驱动器统计和一个漫画阅读器。 + +### 了解更多&尝试 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/plasma-5.3-beta.jpg) + +一张全部内容的完整列表——我说全部内容——是指Plasma 5.3中[在官方修改日志中][4]列出的新的和改进的内容。 + +你可以从KDE社区获取Live镜像,试用Kubuntu上的Plasma 5.3,**而不会影响到你自己的系统**: + +- [下载KDE Plasma Live镜像][5] + +如果你需要超级稳定的系统,你可以使用这些镜像来尝试新特性,但是你可以继续使用你的主要计算机上与你的版本对应的KDE版本。 + +不过,如果你对实验版满意——请注意:能够处理任何包冲突,或者由尝试升级桌面环境而导致的系统问题——那么你可以安装。 + +### 安装Plasma 5.3到Kubuntu 15.04 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2012/02/logo-kubuntu.png) + +要**安装Plasma 5.3到Kubuntu 15.04**中,你需要添加KDE 移植PPA,运行软件更新器工具并安装任何可用的更新。 + +Kubuntu移植PPA可能也会升级除了安装在你系统上的Plasma外的其它KDE平台组件,包括KDE应用程序、框架和Kubuntu特定配置文件。 + +目前为止,使用命令行来升级Kubuntu中的到Plasma 5.3是最快速的方法: + + sudo add-apt-repository ppa:kubuntu-ppa/backports + sudo apt-get update && sudo apt-get dist-upgrade + +在升级过程完成后,如果一切顺利,你应该重启计算机。 + +如果你正在使用一个备用桌面环境,比如LXDE、Unity或者GNOME,则你需要在运行完上面的两个命令后安装Kubuntu桌面包(你可以在Ubuntu软件中心找到)。 + +要降级到15.04中自带的 Plasma 版本的话,你可以使用 PPA-Purge 工具: + + sudo apt-get install ppa-purge + sudo ppa-purge ppa:kubuntu-ppa/backports + +请在下面的评论中留言,让我们知道你怎么升级,测试过程是怎样的,别忘了告诉我们你在下一个Plasma 5桌面中要看到的特性。 + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/04/kde-plasma-5-3-released-heres-how-to-upgrade-in-kubuntu-15-04 + +作者:[Joey-Elijah Sneddon][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://www.kde.org/announcements/plasma-5.3.0.php +[2]:http://www.omgubuntu.co.uk/2015/04/beta-plasma-5-3-features +[3]:http://www.omgubuntu.co.uk/2015/04/beta-plasma-5-3-features +[4]:https://www.kde.org/announcements/plasma-5.2.2-5.3.0-changelog.php +[5]:https://community.kde.org/Plasma/Live_Images diff --git a/published/201505/20140804 Group Test--Linux Text Editors.md b/published/201505/20140804 Group Test--Linux Text Editors.md new file mode 100644 index 0000000000..66b271bcf4 --- /dev/null +++ b/published/201505/20140804 Group Test--Linux Text Editors.md @@ -0,0 +1,320 @@ +五款 Linux 文本编辑器测评 +================================================================================ + +> Mayank Sharma 测试了5款不仅仅是能处理文字的超强文本编辑器。 + +如果你使用Linux已经有很长一段时间,你知道,不管是编辑一款app的配置文件,还是修改shell脚本,或者编写/查看代码,类似LibreOffice的工具并不适合。尽管字面上看起来都是一样,但是你并不需要一个文字处理器来完成这些任务;你需要的是一个文本编辑器。 + +在这个测评中,我们将着眼于5款更能胜任繁重文本工作的轻量级的文本编辑器。他们支持语法高亮,像拼写检查一样轻松处理代码缩进。你可以像你复制/粘贴文本那样容易地使用它们记录宏以及管理代码片段。 + +得益于它们的插件,使得它们足以抗衡其它的以文本为中心的应用程序,一些简单的文本编辑器甚至超出了它们的设计目标。它们能胜任一个源代码编辑器的任务,甚至就是一个集成开发环境。 + +Emacs和Vim是两款最流行和强大的纯文本编辑器。但是,由于一些原因,我们在这个测评中并没有包括它们。首先,如果你使用它们中的任何一个,那么恭喜你:你不需要更换了。其次,它们都有陡峭的学习曲线,尤其是那些熟悉了桌面环境的用户:他们很更愿意投入其他有图形界面的文本编辑器。 + +### 目录: ### + +#### Gedit #### + +- URL:http://projects.gnome.org/gedit/ +- 版本: 3.10 +- 许可证: GPL +- Gnome的默认文本编辑器准备好挑战了吗? + +#### Kate #### + +- URL: www.kate-editor.org +- 版本: 3.11 +- 许可证: LGPL/GPL +- Kate会挑战命运吗? + +#### Sublime Text #### + +- URL: www.sublimetext.com +- 版本: 2.0.2 +- 许可证: Proprietary +- 在自由的土地上的带有黄金般的心脏的专利软件。 + +#### UltraEdit #### + +- URL: www.ultraedit.com +- 版本: 4.1.0.4 +- 许可证: Proprietary +- 足够证明它的价值了吗? + +#### jEdit #### + +- URL: www.jedit.org +- 版本: 5.1.0 +- 许可证: GPL +- 基于Java的编辑器是否会毁掉其他编辑器的世界? + + +### 关键标准 ### + +除了Gedit和jEdit以外的所有工具,都是通过其推荐的安装方法安装在Fedora和Ubuntu上。前者已经兼容默认的Gnome桌面,后者仍然固执地反对安装在Fedora上。由于这些是相对简单的应用程序,他们没有复杂的依赖,唯一例外的是jEdit,它要求要有Oracle Java。 + +得益于Gnome和KDE持续的努力,所有编辑器无论在哪个桌面上的外观看起来很好,功能也很正常。这不仅是作为评价的标准,也意味着你不再受制于你的桌面环境兼容的工具。 + +除了它们独特的功能,我们也对所有候选者测试了常规的文本编辑功能。然而,它们并没有被设计为模仿现代字处理器的所有功能,我们也不以此评判。 + + +### 编程语言支持 ### + +UltraEdit 能进行语法高亮、代码折叠以及拥有项目管理的能力。也有一个罗列源文件中所有函数的功能列表,但并不适用于我们测试的任何代码文件。UltraEdit也支持HTML5,有一个能添加常用HTML标记的HTML工具栏。 + +即使Gnome的默认文本编辑器Gedit,也有几个面向编码的功能特性,例如括号匹配、自动缩进以及为包括C, C++, Java, HTML, XML, Python, Perl, 以及许多其它编程语言进行语法高亮。 + +如果你需要更多的编程辅助功能,看一下Sublime和Kate。 + +Sublime支持多种编程语言并且能为(那些流行的)C#, D, Dylan, Erlang, Groovy, Haskell, Lisp, Lua, MATLAB, OCaml, R, 甚至 SQL 进行语法高亮。如果这还不够,你可以下载插件以支持更多的语言。另外,它的语法高亮功能提供了多个可定制选项。这个应用程序也会进行括号匹配,确保代码段都正确,Sublime的自动补全功能也支持用户创建的变量。就像Komodo IDE,Sublime也可以显示一个全部源代码的滚动预览图,这对于长代码文件导航和在文件中的不同部分跳转很方便。Sublime最好的功能之一就是能在编辑器内部运行特定语言,例如C++, Python, Ruby等的代码,当然假设在你的电脑上安装有编译器以及其它系统工具。省时间而且不用再开终端. + +你也可以用插件在Kate中开启构建系统功能。另外,你可以为GDB调试器添加一个简单的前端。Kate能和Git,Subversion以及Mercurial版本控制系统一起工作,也提供了一些项目管理的功能。除了能为超过180种语言进行语法高亮,它支持所有的这些辅助功能,例如括号匹配,自动补全和自动缩进。它也支持代码折叠,甚至在一个程序中折叠函数。 + +唯一的遗憾的是jEdit,它声称自己是一个程序员的文本编辑器,但它缺少其他的基本功能,例如代码折叠,它甚至不能提示或者补全函数. + +**评分:** + +- Gedit:3/5 +- Kate:5/5 +- Sublime:5/5 +- UltraEdit:3/5 +- jEdit:1/5 + + +### 键盘控制 ### + +高级文本编辑器的用户希望能完全通过键盘控制和操作,一些应用程序甚至支持用户自定义快捷方式的键盘绑定。 + +你可以轻松的使用Gedit的扩展键盘快捷键。可以在编辑文件时通过工具的快捷键调用工具,例如对一个文档进行拼写检查。你可以看到应用程序内部的一系列默认快捷键,但并没有图形化的方式去自定义它们。相似的,在Sublime中自定义键盘绑定,你需要修改它的XML的键盘映射文件。Sublime由于缺少定义键盘快捷键的图形化界面而饱受批评,但长期使用的用户支持当前的基于文件的机制:这给了他们更多的控制能力。 + +UltraEdit为它"一切都可自定义"的座右铭感到自豪,这也包括键盘快捷键。你可以自定义菜单导航的热键,以及定义你自己的访问大量功能的组合键映射。 + +除了完全可自定义的键盘快捷键以外,jEdit也有为Emacs预定义的键映射。Kate在这方面尤其令人映像深刻。它有简单可访问的自定义键绑定窗口。你可以更改默认的键,或者定义替代的键。另外,Kate也有一个能使用户使用Vi键操作Kate的Vi模式。 + +**评分:** + +- Gedit:2/5 +- Kate:5/5 +- Sublime:3/5 +- UltraEdit:4/5 +- jEdit:5/5 + +### 片段和宏 ### + +宏通过自动化重复的步骤帮助你降低花费在编辑和组织数据上的时间,而代码片段通过创建可重用的源代码块为程序员扩展类似的功能。这两者都能节省你的时间。 + +标准的Gedit安装没有这两种功能中的任何一种,但是你可以通过独立的插件启用这些功能。片段插件随Gedit一起发布,但在Gedit内启用宏插件,则需要你手动下载和安装(被称为gedit-macropy,托管在GitHub上)。 + +Kate也同样通过插件的形式启用片段功能。一旦加入,插件也增加了PHP,Bash和Java的片段库。你可以在侧边栏中显示片段列表以便于访问。可以通过右击片段或者快捷键组合方式编辑它的内容。然而,令人惊讶的是,它不支持宏-尽管用户从2002年就不断要求! + +jEdit也有一个启用片段的插件。它还可以从用户行为中记录宏或者你也可以用BeanShell 脚本语言(BeanShell支持像Perl和JavaScript那样将脚本对象封装为简单的方法)中写宏。jEdit也有一个可以从jEdit的网站中下载多种宏的插件。 + +Sublime有创建片段和宏的内建功能,也有为大多数编程语言经常使用的函数多种片段。 + +在UltraEdit中片段被称为智能模板,就像Sublime中一样,你可以根据正在编辑的源代码文件类型插入片段。要完成宏记录功能,UltraEdit还有集成了一个基于JavaScript的脚本语言引擎来完成自动任务。你也可以从该编辑器的网站中下载用户提交的宏和脚本。 + +**评分:** + +- Gedit:3/5 +- Kate:1/5 +- Sublime:5/5 +- UltraEdit:5/5 +- jEdit:5/5 + + +### 易用性 ### + +不像那些简陋的文本编辑器,这些文本编辑器在这方面可以适应从文档写作者到程序员的各种用户的需要。与精简应用程序相反,他们的开发者在寻找添加更多功能的途径。 + +尽管第一眼看上去这次测评中的大部分应用有一个很相似的布局,经过仔细的检查,你会发现一些可用性的差异。我们通过用户界面的合理使用来介绍它们的功能和特性,而不是铺天盖地地告诉读者。 + +#### Gedit: 4/5 #### + +Gedit的外观很普通,它有一个带有很少的菜单和按钮的简单界面。这是一把双刃剑,因为有些用户可能不会发现它真正的潜能。 + +Gedit可以在选项卡中打开多个文件,这些选项卡可以重排和在多个 Gedit窗口之间移动。用户可以选择通过插件来启用侧边栏来浏览文件或者在底部面板显示工具输出内容。这个应用程序会检测到被其它应用程序更改的文件并可以重新加载该文件。 + +为了适配Gnome,在应用程序的最新版本中做了大量的 UI 修改。然而修改还还不稳定,尽管包括了所有的功能,但是菜单交互的一些插件还需要升级。 + +![在展示一个有功能的应用程序和将它们所有的东西曝光给用户之间有一个很好的平衡。Geddit隐藏了它的大部分功能。](http://www.linuxvoice.com/wp-content/uploads/2014/07/gedit-web.png) + +*在功能与界面之间取得了良好的平衡,Gedit将其大部分功能隐藏在背后。* + +#### Kate: 5/5 #### + +尽管用户界面的主要部分和Gedit相似,Kate可以在两边显示选项卡并且它的菜单更加丰富。该应用程序平易近人,吸引用户来挖掘它的其它功能。 + +Kate可以在KDE的KIO支持的所有协议上透明地打开和保存文件,包括通过HTTP, FTP, SSH, SMB 和 WebDAV。你可以用这个应用同时处理多个文件。但不同于大部分应用程序传统的水平选项卡选择栏,Kate在屏幕的两个方向都有选项卡。左侧的侧边栏显示打开的文件列表。需要同时查看一个文件不同部分的程序员也会感激它可以水平或者竖直分隔界面的能力。 + +![Kate能搭建为功能丰富的集成开发环境](http://www.linuxvoice.com/wp-content/uploads/2014/08/kate-web.png) + +*Kate能搭建为功能丰富的集成开发环境。* + +#### Sublime: 5/5 #### + +Sublime支持你在不同方式同时查看多达四个文件。当你在集中精力编程时,它也有一个只显示文件和菜单的全屏无扰模式。 + +这个编辑器还在右边有个缩略地图,这在长文件中导航非常有用。应用程序为多种编程语言提供多种常用函数的片段,这使得它对于开发者非常有用。另一个精巧的功能是,无论你使用都是文本文档或者代码,都可以任意选择和替换。 + +![如果你不喜欢Sublime的Charcoal外观,你可以选择它包含的其它22种主题。](http://www.linuxvoice.com/wp-content/uploads/2014/08/sublime-web.png) + +*如果你不喜欢Sublime的Charcoal外观,你可以选择它包含的其它22种主题。* + +#### UltraEdit: 3/5 #### + +UltraEdit在界面的顶部和底部加载了多种工具栏。加上切换文档的选项卡、两边的面板,以及分隔区域,使得只剩下一点空间给编辑窗口。 + +使用HTML的网络开发者有很多唾手可得的帮助。你可以通过FTP和SFTP访问远程文件。高级功能,例如记录一个宏以及比较文件,也简单易用。 + +使用应用程序的偏好设置窗口,你可以调整应用程序的多个方面,包括颜色主题和类似语法高亮的其它功能。 + +![UltraEdit的用户界面是高度可配置的 — 你可以像改变其它许多方面那样简单的自定义工具栏和菜单的布局。](http://www.linuxvoice.com/wp-content/uploads/2014/08/ultraedit-web.png) + +*UltraEdit的用户界面是高度可配置的 — 你可以像改变其它许多方面那样简单的自定义工具栏和菜单的布局。* + +#### jEdit: 3/5 #### + +在可用性方面,首先一个不好就是jEdit不能在基于RPM的发行版上安装。导航编辑器需要一些时间来适应,因为它的菜单和其它流行的应用程序顺序不同,而且有些普通桌面用户不熟悉的名字。但是,该应用程序有详细的内部帮助,这有利于缓解学习曲线。 + +jEdit会高亮你所在的当前行,并使你能以多种查看方式分隔窗口。你可以简单地从应用程序中安装和管理插件,除了使用完整的宏,jEdit也支持你快速记录一个临时的宏。 + +![由于它的Java基础,jEdit在任何桌面环境中都不能给人宾至如归的感觉](http://www.linuxvoice.com/wp-content/uploads/2014/08/jedit-web.png) + +*由于它的Java基础,jEdit在任何桌面环境中都不能给人宾至如归的感觉* + +### 可用性和支持 ### + +在Gedit和Kate之间有很多相似性。两个应用程序都得益于他们各自的父项目,Gnome和KDE,捆绑在各种主流的发行版中。另外两个项目都是跨平台的,有Windows和Mac OS X版本以及原生的Linux版本。 + +Gedit托管在Gnome的网站上,并有一个简单的用户指南、关于多种插件的信息,以及包括邮件列表和IRC通道在内的常用联系方式。你也可以在其它基于Gnome的发行版,例如Ubuntu中找到使用信息。相似地,Kate得益于KDE的资源,并包括详细的用户信息以及邮件列表和IRC通道。你也可以从应用程序中获取相应的离线用户指南。 + +除了Linux,UltraEdit在Windows和Mac OS X中也可用,虽然在应用程序中并没有包括,但在启动时也有详细的用户指南。为了辅助用户的使用,UltraEdit保存了一个常见问题的数据库,一系列关于多种特定功能的详细介绍,用户还可以在论坛版块彼此帮助。另外,付费用户也可以通过邮件从开发者中获取支持。 + +Sublime支持一样多的平台,但是你需要单独为每种平台购买许可证。开发者通过博客让用户了解正在进行的开发,并积极参加它的论坛。这个项目支持设施的亮点是提供免费的详细教程和视频课程。Sublime非常漂亮。 + +由于jEdit是用java编写的,所以它在多种平台中都可用。在它的网站上你可以找到一个详细的用户指南以及一些插件帮助文档的链接。然而,这里没有能使用户和其他用户或者开发者交流的途径。 + +**评分:** + +- Gedit:4/5 +- Kate:4/5 +- Sublime:5/5 +- UltraEdit:3/5 +- jEdit:2/5 + +### 附加组件和插件 ### + +不同的用户有不同的需求,一个简单的轻量级应用程序只能做到这么多。这就是为什么需要插件的原因。应用程序依赖于这些小部件来扩展它们的功能集并让更多的用户使用。 + +UltraEdit是一个例外。它没有第三方插件,但开发者将例如HtmlTidy这样的第三方工具集成到了UltraEdit。 + +Gedit附带了好多已安装的插件,你可以下载更多的更多gedit插件包。基于和Gedit版本的兼容性,项目网站也有到多个第三方插件的链接。 + +三个对程序员非常有用的插件是:Code Comment、在底部面板增加一个终端的Terminal Plugin以及Session Saver。当你用多个文件开发项目的时候Session Saver相当有用。你可以在选项卡中打开文件,保存会话,你可以用一键恢复,就可以按照你保存时的选项卡顺序打开所有的文件。 + +类似的,你可以通过用内部的插件管理器增加插件来扩展Kate。除了令人映像深刻的项目插件,一些开发者使用的插件包括嵌入式终端,它能编译和调试代码,以及对数据库执行SQL查询。 + +Sublime的插件是用Python写的,文本编辑器包括了一个类似于apt-get,能使用户查找,安装,升级和移除插件包的名为Package Control的工具。通过插件,你可以在Sublime中使用Git版本控制,以及美化JavaScript代码的JSLint工具。Sublime Linter能指出你代码中的错误,是编码人员必备的插件。 + +jEdit拥有最令人印象深刻的插件设施。该应用有超过200个插件,可以在它们自己的专用网站中浏览。网站通过不同的类型列出了插件,例如文件管理,版本控制,文本等。你可以在每个类型下找到很多的插件。 + +一些最好的插件是Android插件,它们提供了和Android项目协同工作的工具;你可以使用TomcatSwitch插件创建和控制外部Jakarta Tomcat服务器进程;以及类似于Vi功能的Vimulator插件。你可以通过使用jEdit的插件管理器安装这些插件。 + +**评分:** + +- Gedit:3/5 +- Kate:4/5 +- Sublime:4/5 +- UltraEdit:1/5 +- jEdit:5/5 + +### 纯文本编辑 ### + +尽管它们强大的额外功能甚至可能会取代几种完全成熟的应用程序,有时候可能只需要使用这些庞大的文本编辑器读、写或者编辑简单的纯文本。虽然你可以使用它们中的任何一个输入文本,我们通过普通文本编辑的方便性评价它们。 + +Gnome的默认文本编辑器Gedit,支持取消和重做机制以及搜索和替换。它可以对多种语言进行拼写检查,并能通过使用Gnome GVFS库访问和编辑远程文件。 + +你也可以使用Kate进行拼写检查,它也可以让你对任何高亮文本进行Google搜索。它还有一个能可视化告知用户文件中更改过但没有保存的行的行修改系统。另外,它通过允许用户在文件中使用书签简化长文档的导航。 + +Sublime有很多可选择的编辑命令,例如缩进文本和格式化段落。它的自动保存功能帮助防止用户丢失他们的更改。高级用户还会喜欢基于正则表达式的递归查找和替换功能,以及选择多个不连续的文本块并执行统一操作。 + +UltraEdit也允许用户在查找和替换功能中使用正则表达式,并能通过FTP编辑远程文件。 + +JEdit一个独特的功能是它支持被称为寄存器的不限数目的剪切板。你可以复制文本片段到这些寄存器中,在编辑会话过程中都可用。 + +**评分:** + +- Gedit:4/5 +- Kate:5/5 +- Sublime:5/5 +- UltraEdit:4/5 +- jEdit:4/5 + +### 我们的评比 ### + +在这里的所有编辑器都足以替换你已有的文本编辑器,来编辑文本和调整配置文件。事实上,没准它们会组合起来作为你的集成开发环境。这些应用程序都有各种各样功能,它们的开发者不会考虑剥离功能,而是增加越来越多的功能。 + +jEdit排在这次测试的最后面。因为它不仅坚持使用专有的Oracle Java运行时环境,不能在你的Fedora机器上安装,而且开发者并不积极和用户交互。 + +UltraEdit做的稍微好一点。这个商业专用工具专注于网络开发者,不为非开发者的高级用户提供任何功能,使得它不值得推荐为免费软件的替代品。 + +排在第三的是Gedit。作为Gnome的默认编辑器,它没有任何内在的问题,但尽管有很多积极的方面,它还是略微被Sublime和Kate超越。开诚布公地说,Kate是比Gedit更通用的编辑器,甚至考虑到他们的插件系统,评分也优于Gnome的默认编辑器。 + +Sublime和Kate都相当好。他们在我们的大多数测试中表现同样出色。Kate由于不支持宏而落后于Sublime,但键盘友好和能简单定义自定义键绑定又使Kate找回优势。 + +Kate成功的原因可以归结为它通过最小化学习曲线提供了最大化的功能。尽管使用它吧,不仅作为简单文本编辑器使用,或者容易使用语法高亮编辑配置文件,甚至得益于其项目管理能力能使用它协作一个复杂的编程项目。 + +我们不是选择Kate去替换一个类似“[XX,在这里插入你最喜欢的专业工具]”的全面的集成开发环境。但是它是一个专业工具理想的、全面的、以及完美的垫脚石。 + +Kate为能快速响应你的需要而设计,它的界面并不会使你茫然,并且和那些过于复杂的应用一样的有用。 + +### 1st Kate ### + +- Licence LGPL/GPL Version 3.11 +- www.kate-editor.org +- 拥有超能力,态度温和的文本编辑器。 +- Kate是KDE项目中最有用的应用程序之一。 + +### 2nd Sublime Text ### + +- Licence 专利 Version 2.0.2 +- www.sublimetext.com +- 值得你每分钱的专业文本编辑器 - 简单易用,功能全面而且看起来很棒。 + +### 3rd Gedit ### + +- Licence GPL Version 3.10 +- http://projects.gnome.org/gedit +- 在Gnome中就用它吧。这是一个奇妙的文本编辑器,确实令人钦佩的工作,但这里的竞争实在太大了。 + +### 4th UltraEdit ### + +- Licence Proprietary Version 4.1.0.4 +- www.ultraedit.com +- 关注于为网络开发者提供各种便利,而不为普通用户提供任何特殊功能。 + +### 5th jEdit ### + +- Licence GPL Version 5.1.0 +- www.jedit.org +- 缺乏支持,不支持Fedora,缺乏好看的界面,jEdit被贬低到最后。 + +### 你也许希望尝试… ### + +随你发行版发布的默认文本编辑器也能帮助你一些高级任务。例如KDE的KWrite和Raspbian的Nano。得益于KDE的katepart组件,KWrite继承了一些Kate的功能,得益于在树莓派上的可用性,Nano也开始重现风头。 + +如果你希望跟随Linux大师的脚步,你总是可以尝试高大上的文本编辑器Emacs和Vim。想尝试Vim强大的用户首先可以考虑gVim,它通过图形界面展现了Vim的强大。 + +除了jEdit和Kate,这里还有其他模仿Emacs和Vim之类的旧式高级编辑器的编辑器,比如JED 编辑器和Joe's Own Editor,这两者都有Emacs的模拟模式。另一方面,如果你在寻找轻量级的代码编辑器,可以看看Bluefish和Geany。他们的存在是为了填补文本编辑器和全面集成的开发平台之间的空隙。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/text-editors/ + +作者:[Ben Everard][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[royaso](https://github.com/royaso),[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxvoice.com/author/ben_everard/ diff --git a/published/201505/20150108 Interface (NICs) Bonding in Linux using nmcli.md b/published/201505/20150108 Interface (NICs) Bonding in Linux using nmcli.md new file mode 100644 index 0000000000..fa8297599b --- /dev/null +++ b/published/201505/20150108 Interface (NICs) Bonding in Linux using nmcli.md @@ -0,0 +1,136 @@ +在 Linux 中用 nmcli 命令绑定多块网卡 +================================================================================ +今天,我们来学习一下在 CentOS 7.x 中如何用 nmcli(Network Manager Command Line Interface:网络管理命令行接口)进行网卡绑定。 + +网卡(接口)绑定是将多块 **网卡** 逻辑地连接到一起从而允许故障转移或者提高吞吐率的方法。提高服务器网络可用性的一个方式是使用多个网卡。Linux 绑定驱动程序提供了一种将多个网卡聚合到一个逻辑的绑定接口的方法。这是个新的实现绑定的方法,并不影响 linux 内核中旧绑定驱动。 + +**网卡绑定为我们提供了两个主要的好处:** + +1. **高带宽** +1. **冗余/弹性** + +现在让我们在 CentOS 7 上配置网卡绑定吧。我们需要决定选取哪些接口配置成一个组接口(Team interface)。 + +运行 **ip link** 命令查看系统中可用的接口。 + + $ ip link + +![ip link](http://blog.linoxide.com/wp-content/uploads/2015/01/ip-link.png) + +这里我们使用 **eno16777736** 和 **eno33554960** 网卡在 “主动备份” 模式下创建一个组接口。(译者注:关于不同模式可以参考:多网卡的7种bond模式原理) + +按照下面的语法,用 **nmcli** 命令为网络组接口创建一个连接。 + + # nmcli con add type team con-name CNAME ifname INAME [config JSON] + +**CNAME** 指代连接的名称,**INAME** 是接口名称,**JSON** (JavaScript Object Notation) 指定所使用的处理器(runner)。**JSON** 语法格式如下: + + '{"runner":{"name":"METHOD"}}' + +**METHOD** 是以下的其中一个:**broadcast、activebackup、roundrobin、loadbalance** 或者 **lacp**。 + +### 1. 创建组接口 ### + +现在让我们来创建组接口。这是我们创建组接口所使用的命令。 + + # nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' + +![nmcli con create](http://blog.linoxide.com/wp-content/uploads/2015/01/nmcli-con-create.png) + +运行 **# nmcli con show** 命令验证组接口配置。 + + # nmcli con show + +![显示组接口](http://blog.linoxide.com/wp-content/uploads/2015/01/show-team-interface.png) + +### 2. 添加从设备 ### + +现在让我们添加从设备到主设备 team0。这是添加从设备的语法: + + # nmcli con add type team-slave con-name CNAME ifname INAME master TEAM + +在这里我们添加 **eno16777736** 和 **eno33554960** 作为 **team0** 接口的从设备。 + + # nmcli con add type team-slave con-name team0-port1 ifname eno16777736 master team0 + + # nmcli con add type team-slave con-name team0-port2 ifname eno33554960 master team0 + +![添加从设备到 team](http://blog.linoxide.com/wp-content/uploads/2015/01/adding-to-team.png) + +再次用命令 **#nmcli con show** 验证连接配置。现在我们可以看到从设备配置信息。 + + #nmcli con show + +![显示从设备配置](http://blog.linoxide.com/wp-content/uploads/2015/01/show-slave-config.png) + +### 3. 分配 IP 地址 ### + +上面的命令会在 **/etc/sysconfig/network-scripts/** 目录下创建需要的配置文件。 + +现在让我们为 team0 接口分配一个 IP 地址并启用这个连接。这是进行 IP 分配的命令。 + + # nmcli con mod team0 ipv4.addresses "192.168.1.24/24 192.168.1.1" + # nmcli con mod team0 ipv4.method manual + # nmcli con up team0 + +![分配 ip](http://blog.linoxide.com/wp-content/uploads/2015/01/ip-assignment.png) + +### 4. 验证绑定 ### + +用 **#ip add show team0** 命令验证 IP 地址信息。 + + #ip add show team0 + +![验证 ip 地址](http://blog.linoxide.com/wp-content/uploads/2015/01/verfiy-ip-adress.png) + +现在用 **teamdctl** 命令检查 **主动备份** 配置功能。 + + # teamdctl team0 state + +![teamdctl 检查主动备份](http://blog.linoxide.com/wp-content/uploads/2015/01/teamdctl-activebackup-check.png) + +现在让我们把激活的端口断开连接并再次检查状态来确认主动备份配置是否像希望的那样工作。 + + # nmcli dev dis eno33554960 + +![断开激活端口连接](http://blog.linoxide.com/wp-content/uploads/2015/01/disconnect-activeport.png) + +断开激活端口后再次用命令 **#teamdctl team0 state** 检查状态。 + + # teamdctl team0 state + +![teamdctl 检查断开激活端口连接](http://blog.linoxide.com/wp-content/uploads/2015/01/teamdctl-check-activeport-disconnect.png) + +是的,它运行良好!!我们会使用下面的命令连接回到 team0 的断开的连接。 + + #nmcli dev con eno33554960 + +![nmcli dev 连接断开的连接](http://blog.linoxide.com/wp-content/uploads/2015/01/nmcli-dev-connect-disconected.png) + +我们还有一个 **teamnl** 命令可以显示 **teamnl** 命令的一些选项。 + +用下面的命令检查在 team0 运行的端口。 + + # teamnl team0 ports + +![teamnl 检查端口](http://blog.linoxide.com/wp-content/uploads/2015/01/teamnl-check-ports.png) + +显示 **team0** 当前活动的端口。 + + # teamnl team0 getoption activeport + +![显示 team0 活动端口](http://blog.linoxide.com/wp-content/uploads/2015/01/display-active-port-team0.png) + +好了,我们已经成功地配置了网卡绑定 :-) ,如果有任何反馈,请告诉我们。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/interface-nics-bonding-linux/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/published/201505/20150112 What are useful command-line network monitors on Linux.md b/published/201505/20150112 What are useful command-line network monitors on Linux.md new file mode 100644 index 0000000000..25d7910ec7 --- /dev/null +++ b/published/201505/20150112 What are useful command-line network monitors on Linux.md @@ -0,0 +1,136 @@ +又一波你可能不知道的 Linux 命令行网络监控工具 +=============================================================================== + +对任何规模的业务来说,网络监控工具都是一个重要的功能。网络监控的目标可能千差万别。比如,监控活动的目标可以是保证长期的网络服务、安全保护、对性能进行排查、网络使用统计等。由于它的目标不同,网络监控器使用很多不同的方式来完成任务。比如对包层面的嗅探,对数据流层面的统计数据,向网络中注入探测的流量,分析服务器日志等。 + +尽管有许多专用的网络监控系统可以365天24小时监控,但您依旧可以在特定的情况下使用命令行式的网络监控器,某些命令行式的网络监控器在某方面很有用。如果您是系统管理员,那您就应该有亲身使用一些知名的命令行式网络监控器的经历。这里有一份**Linux上流行且实用的网络监控器**列表。 + +### 包层面的嗅探器 ### + +在这个类别下,监控工具在链路上捕捉独立的包,分析它们的内容,展示解码后的内容或者包层面的统计数据。这些工具在最底层对网络进行监控、管理,同样的也能进行最细粒度的监控,其代价是影响网络I/O和分析的过程。 + +1. **dhcpdump**:一个命令行式的DHCP流量嗅探工具,捕捉DHCP的请求/回复流量,并以用户友好的方式显示解码的DHCP协议消息。这是一款排查DHCP相关故障的实用工具。 + +2. **[dsniff][1]**:一个基于命令行的嗅探、伪造和劫持的工具合集,被设计用于网络审查和渗透测试。它可以嗅探多种信息,比如密码、NSF流量(LCTT 译注:此处疑为 NFS 流量)、email消息、网络地址等。 + +3. **[httpry][2]**:一个HTTP报文嗅探器,用于捕获、解码HTTP请求和回复报文,并以用户友好的方式显示这些信息。(LCTT 译注:[延伸阅读](https://linux.cn/article-4148-1.html)。 ) + +4. **IPTraf**:基于命令行的网络统计数据查看器。它实时显示包层面、连接层面、接口层面、协议层面的报文/字节数。抓包过程由协议过滤器控制,且操作过程全部是菜单驱动的。(LCTT 译注:[延伸阅读](https://linux.cn/article-5430-1.html)。) + + ![](https://farm8.staticflickr.com/7519/16055246118_8ea182b413_c.jpg) + +5. **[mysql-sniffer][3]**:一个用于抓取、解码MySQL请求相关的数据包的工具。它以可读的方式显示最频繁或全部的请求。 + +6. **[ngrep][4]**:在网络报文中执行grep。它能实时抓取报文,并用正则表达式或十六进制表达式的方式匹配(过滤)报文。它是一个可以对异常流量进行检测、存储或者对实时流中特定模式报文进行抓取的实用工具。 + +7. **[p0f][5]**:一个被动的基于包嗅探的指纹采集工具,可以可靠地识别操作系统、NAT或者代理设置、网络链路类型以及许多其它与活动的TCP连接相关的属性。 + +8. **pktstat**:一个命令行式的工具,通过实时分析报文,显示连接带宽使用情况以及相关的协议(例如,HTTP GET/POST、FTP、X11)等描述信息。 + + ![](https://farm8.staticflickr.com/7477/16048970999_be60f74952_b.jpg) + +9. **Snort**:一个入侵检测和预防工具,通过规则驱动的协议分析和内容匹配,来检测/预防活跃流量中各种各样的后门、僵尸网络、网络钓鱼、间谍软件攻击。 + +10. **tcpdump**:一个命令行的嗅探工具,可以基于过滤表达式抓取网络中的报文,分析报文,并且在包层面输出报文内容以便于包层面的分析。他在许多网络相关的错误排查、网络程序debug、或[安全][6]监测方面应用广泛。 + +11. **tshark**:一个与Wireshark窗口程序一起使用的命令行式的嗅探工具。它能捕捉、解码网络上的实时报文,并能以用户友好的方式显示其内容。 + +### 流/进程/接口层面的监控 ### + +在这个分类中,网络监控器通过把流量按照流、相关进程或接口分类,收集每个流、每个进程、每个接口的统计数据。其信息的来源可以是libpcap抓包库或者sysfs内核虚拟文件系统。这些工具的监控成本很低,但是缺乏包层面的检视能力。 + +12. **bmon**:一个基于命令行的带宽监测工具,可以显示各种接口相关的信息,不但包括接收/发送的总量/平均值统计数据,而且拥有历史带宽使用视图。 + + ![](https://farm9.staticflickr.com/8580/16234265932_87f20c5d17_b.jpg) + +13. **[iftop][7]**:一个带宽使用监测工具,可以实时显示某个网络连接的带宽使用情况。它对所有带宽使用情况排序并通过ncurses的接口来进行可视化。他可以方便的监控哪个连接消耗了最多的带宽。(LCTT 译注:[延伸阅读](https://linux.cn/article-1843-1.html)。) + +14. **nethogs**:一个基于ncurses显示的进程监控工具,提供进程相关的实时的上行/下行带宽使用信息。它对检测占用大量带宽的进程很有用。(LCTT 译注:[延伸阅读](https://linux.cn/article-2808-1.html)。) + +15. **netstat**:一个显示许多TCP/UDP的网络堆栈的统计信息的工具。诸如打开的TCP/UDP连接书、网络接口发送/接收、路由表、协议/套接字的统计信息和属性。当您诊断与网络堆栈相关的性能、资源使用时它很有用。 + +16. **[speedometer][8]**:一个可视化某个接口发送/接收的带宽使用的历史趋势,并且基于ncurses的条状图进行显示的终端工具。 + + ![](https://farm8.staticflickr.com/7485/16048971069_31dd573a4f_c.jpg) + +17. **[sysdig][9]**:一个可以通过统一的界面对各个Linux子系统进行系统级综合性调试的工具。它的网络监控模块可以监控在线或离线、许多进程/主机相关的网络统计数据,例如带宽、连接/请求数等。(LCTT 译注:[延伸阅读](https://linux.cn/article-4341-1.html)。) + +18. **tcptrack**:一个TCP连接监控工具,可以显示活动的TCP连接,包括源/目的IP地址/端口、TCP状态、带宽使用等。 + + ![](https://farm8.staticflickr.com/7507/16047703080_5fdda2e811_b.jpg) + +19. **vnStat**:一个存储并显示每个接口的历史接收/发送带宽视图(例如,当前、每日、每月)的流量监控器。作为一个后台守护进程,它收集并存储统计数据,包括接口带宽使用率和传输字节总数。(LCTT 译注:[延伸阅读](https://linux.cn/article-5256-1.html)。) + +### 主动网络监控器 ### + +不同于前面提到的被动的监听工具,这个类别的工具们在监听时会主动的“注入”探测内容到网络中,并且会收集相应的反应。监听目标包括路由路径、可供使用的带宽、丢包率、延时、抖动(jitter)、系统设置或者缺陷等。 + +20. **[dnsyo][10]**:一个DNS检测工具,能够管理跨越多达1500个不同网络的开放解析器的DNS查询。它在您检查DNS传播或排查DNS设置的时候很有用。 + +21. **[iperf][11]**:一个TCP/UDP带宽测量工具,能够测量两个端点间最大可用带宽。它通过在两个主机间单向或双向的输出TCP/UDP探测流量来测量可用的带宽。它在监测网络容量、调谐网络协议栈参数时很有用。一个叫做[netperf][12]的变种拥有更多的功能及更好的统计数据。 + +22. **[netcat][13]/socat**:通用的网络调试工具,可以对TCP/UDP套接字进行读、写或监听。它通常和其他的程序或脚本结合起来在后端对网络传输或端口进行监听。(LCTT 译注:[延伸阅读](https://linux.cn/article-1171-1.html)。) + +23. **nmap**:一个命令行的端口扫描和网络发现工具。它依赖于若干基于TCP/UDP的扫描技术来查找开放的端口、活动的主机或者在本地网络存在的操作系统。它在你审查本地主机漏洞或者建立维护所用的主机映射时很有用。[zmap][14]是一个类似的替代品,是一个用于互联网范围的扫描工具。(LCTT 译注:[延伸阅读](https://linux.cn/article-2561-1.html)。) + +24. ping:一个常用的网络测试工具。通过交换ICMP的echo和reply报文来实现其功能。它在测量路由的RTT、丢包率以及检测远端系统防火墙规则时很有用。ping的变种有更漂亮的界面(例如,[noping][15])、多协议支持(例如,[hping][16])或者并行探测能力(例如,[fping][17])。(LCTT 译注:[延伸阅读](https://linux.cn/article-2303-1.html)。) + + ![](https://farm8.staticflickr.com/7466/15612665344_a4bb665a5b_c.jpg) + +25. **[sprobe][18]**:一个启发式推断本地主机和任意远端IP地址之间的网络带宽瓶颈的命令行工具。它使用TCP三次握手机制来评估带宽的瓶颈。它在检测大范围网络性能和路由相关的问题时很有用。 + +26. **traceroute**:一个能发现从本地到远端主机的第三层路由/转发路径的网络发现工具。它发送限制了TTL的探测报文,收集中间路由的ICMP反馈信息。它在排查低速网络连接或者路由相关的问题时很有用。traceroute的变种有更好的RTT统计功能(例如,[mtr][19])。 + +### 应用日志解析器 ### + +在这个类别下的网络监测器把特定的服务器应用程序作为目标(例如,web服务器或者数据库服务器)。由服务器程序产生或消耗的网络流量通过它的日志被分析和监测。不像前面提到的网络层的监控器,这个类别的工具能够在应用层面分析和监控网络流量。 + +27. **[GoAccess][20]**:一个针对Apache和Nginx服务器流量的交互式查看器。基于对获取到的日志的分析,它能展示包括日访问量、最多请求、客户端操作系统、客户端位置、客户端浏览器等在内的多个实时的统计信息,并以滚动方式显示。 + + ![](https://farm8.staticflickr.com/7518/16209185266_da6c5c56eb_c.jpg) + +28. **[mtop][21]**:一个面向MySQL/MariaDB服务器的命令行监控器,它可以将成本最大的查询和当前数据库服务器负载以可视化的方式显示出来。它在您优化MySQL服务器性能、调谐服务器参数时很有用。 + + ![](https://farm8.staticflickr.com/7472/16047570248_bc996795f2_c.jpg) + +29. **[ngxtop][22]**:一个面向Nginx和Apache服务器的流量监测工具,能够以类似top指令的方式可视化的显示Web服务器的流量。它解析web服务器的查询日志文件并收集某个目的地或请求的流量统计信息。 + +### 总结 ### + +在这篇文章中,我展示了许多命令行式监测工具,从最底层的包层面的监控器到最高层应用程序层面的网络监控器。了解那个工具的作用是一回事,选择哪个工具使用又是另外一回事。单一的一个工具不能作为您每天使用的通用的解决方案。一个好的系统管理员应该能决定哪个工具更适合当前的环境。希望这个列表对此有所帮助。 + +欢迎您通过回复来改进这个列表的内容! + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/useful-command-line-network-monitors-linux.html + +作者:[Dan Nanni][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://www.monkey.org/~dugsong/dsniff/ +[2]:http://xmodulo.com/monitor-http-traffic-command-line-linux.html +[3]:https://github.com/zorkian/mysql-sniffer +[4]:http://ngrep.sourceforge.net/ +[5]:http://lcamtuf.coredump.cx/p0f3/ +[6]:http://xmodulo.com/recommend/firewallbook +[7]:http://xmodulo.com/how-to-install-iftop-on-linux.html +[8]:https://excess.org/speedometer/ +[9]:http://xmodulo.com/monitor-troubleshoot-linux-server-sysdig.html +[10]:http://xmodulo.com/check-dns-propagation-linux.html +[11]:https://iperf.fr/ +[12]:http://www.netperf.org/netperf/ +[13]:http://xmodulo.com/useful-netcat-examples-linux.html +[14]:https://zmap.io/ +[15]:http://noping.cc/ +[16]:http://www.hping.org/ +[17]:http://fping.org/ +[18]:http://sprobe.cs.washington.edu/ +[19]:http://xmodulo.com/better-alternatives-basic-command-line-utilities.html#mtr_link +[20]:http://goaccess.io/ +[21]:http://mtop.sourceforge.net/ +[22]:http://xmodulo.com/monitor-nginx-web-server-command-line-real-time.html diff --git a/published/201505/20150119 Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen.md b/published/201505/20150119 Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen.md new file mode 100644 index 0000000000..fe25f3f6dc --- /dev/null +++ b/published/201505/20150119 Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen.md @@ -0,0 +1,58 @@ +‘Unity Greeter Badges’:将丢失的会话图标带回Ubuntu登录屏幕 +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/unity-greeter-badges-750x321.jpg) + +新出现在**Ubuntu 15.04中的一个软件包解决了我对Unity 欢迎屏的微词:像Cinnamon这样的其它Linux桌面会话没有徽章图标。** + +我知道这有点吹毛求疵了;这只是对大多数人而言几乎毫无影响的视觉瑕疵罢了。但是这种不一致性时时刻刻缠绕着我,让我不胜其烦,因为Ubuntu的一些会话带有徽章图标,包括Unity、GNOME和KDE。而剩下的其它桌面环境,包括它自己的一些旁系产品,像Xubuntu,只会在会话切换列表和主用户界面显示了一个不能再简单的白点。 + +这些点点们造成的这种不一致性刺激着我的神经,即使它只是稍纵即逝,但这种刺激不仅仅来自设计,也来自可用性方面。标牌式的标志符号对于让我们知道我们即将登陆到哪个会话很有帮助。 + +例如,你能告诉我们这个是个什么会话呢? + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/what-session-is-this-750x247.jpg) + +Budgie? 也许是 MATE? 也能是 Cinnamon……我必须点开它才能知道。 + +没有必要这样做啊。构建Unity Greeter,就是为了让桌面环境开发者能够部署徽章到欢迎屏幕中(有些确实这样做了)。但在许多情况下,像MATE,它的包来自上游的Debian,想要移植一个“Ubuntu专用的补丁包”不太可取,也不太可能。 + +### 一个解决方案出炉了 ### + +一位有经验的Debian维护者[Doug Torrance][1]有了修复该可用性瑕疵的解决方案。与其依赖桌面制造者自己来添加品牌式徽章到他们的包中,与其给Ubuntu增加维护它的责任重担,Torrance还不如自己创建了一个独立的‘unity-greeter-badges’包来收容它们。 + +承担起了直接提供会话标志的假定责任后,该包确保能同时迎合新旧窗口管理器、会话和桌面。 + +在30个左右的桌面环境列表中,它为以下桌面捆绑了新的会话徽章: + +- Xubuntu +- Cinnamon +- MATE +- Cairo-Dock +- Xmonad +- Awesome +- OpenBox +- Pantheon + +最重要的是,‘**Unity-Greeter-Badges**’已经被Ubuntu 15.04收录进去。这就意味着Torrance的包将可以直接安装,不需要PPA,也不需要下载。没有像Unity Greeter一样成为核心包的一部分,它可以以更高效和更及时的方式更新新的图标。 + +如果你真运行着Ubuntu 15.04,在不久的将来,你就可以从软件中心获取并安装该包了。 + +不想等到15.04?Torrance已经为Ubuntu 14.04和Ubuntu 14.10用户做了个.deb安装器。 + +- [下载用于Ubuntu 14.04的unity-greeter-badges][2] +- [下载用于Ubuntu 14.10的unity-greeter-badges][3] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/01/unity-greeter-badges-brings-missing-session-icons-ubuntu-login-screen + +作者:[Joey-Elijah Sneddon][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://launchpad.net/~profzoom +[2]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.04.1_all.deb +[3]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.10.1_all.deb diff --git a/published/201505/20150123 How to make a file immutable on Linux.md b/published/201505/20150123 How to make a file immutable on Linux.md new file mode 100644 index 0000000000..493b0096be --- /dev/null +++ b/published/201505/20150123 How to make a file immutable on Linux.md @@ -0,0 +1,73 @@ +如何在Linux下创建一个不可变更的文件 +================================================================================ + +假如你想对Linux中的一些重要文件做写保护,这样它们就不能被删除或者被篡改成之前的版本或者其他东西,或者在其他情况下,你可能想避免某些配置文件被软件自动修改。使用`chown`和`chmod`命令修改文件的归属关系或者权限位是处理这种情况的一个解决方法,但这并不完美,因为这样无法避免有root权限的操作。这时`chattr`就派上用场了。 + +`chattr`是一个可以设置或取消文件的标志位的Linux命令,它和标准的文件权限(读、写、执行)是分离的。与此相关的另一个命令是`lsattr`,它可以显示文件的哪些标志位被设置上了。最初只有EXT文件系统(EXT2/3/4)支持`chattr`和`lsattr`所管理的标志位,但现在很多其他的原生的Linux文件系统都支持了,比如XFS、Btrfs、ReiserFS等等。 + +在这个教程中,我会示范如果使用`chattr`来让Linux中的文件不可变更。 + +`chattr`和`lsattr`命令是e2fsprogs包的一部分,它在所有现代Linux发行版都预装了。 + +下面是`chattr`的基本语法。 + + $ chattr [-RVf] [操作符][标志位] 文件... + +其中操作符可以是“+”(把选定的标志位添加到标志位列表)、“-”(从标志位列表中移除选定的标志位)、或者“=”(强制使用选定的标志位)。 + +下面是一些可用的标志位。 + +- **a**: 只能以追加模式打开。 +- **A**: 不能更新atime(文件访问时间)。 +- **c**: 当被写入磁盘时被自动压缩。 +- **C**: 关掉“写时复制”。 +- **i**: 不可变更。 +- **s**: 通过自动归零来安全删除。(LCTT 译注:一般情况文件被删后内容不会被修改,改标志位会使得文件被删后原有内容被“0”取代) + +### “不可变更”标志位 ### + +为了让一个文件不可变更,你需要按照如下方法为这个文件添加“不可变更”标志位。例如,对/etc/passwd文件做写保护: + + $ sudo chattr +i /etc/passwd + +注意设置或取消一个文件的“不可变更”标志位是需要root用户权限的。现在检查该文件“不可变更”标志位是否被添加上了。 + + $ lsattr /etc/passwd + +一旦文件被设置为不可变更,任何用户都将无法修改该文件。即使是root用户也不可以修改、删除、覆盖、移动或者重命名这个文件。如果你想再次修改这个文件,需要先把“不可变更”标志位取消了。 + +用如下命令取消“不可变更”标志位: + + $ sudo chattr -i /etc/passwd + +![](https://farm9.staticflickr.com/8613/16152651317_076a65cf50_b.jpg) + +如果你想让一个目录(比如/etc)连同它下边的所有内容不可变更,使用“-R”选项: + + $ sudo chattr -R +i /etc + +### “只可追加”标志位 ### + +另一个有用的的标志位是“只可追加”,它只允许文件内容被追加的方式修改。你不能覆盖或者删除一个设置了“只可追加”标志位的文件。这个标志位在你想避免日志文件被意外清理掉的情况很有用。 + +和“不可变更”标志位类似,你可以使用如下命令让文件变成“只可追加”模式: + + $ sudo chattr +a /var/log/syslog + +注意当你复制一个“不可变更”或者“只可追加”的文件到其他地方后,新文件不会保留这些标志位! + +### 结论 ### + +在这个教程中,我展示了如何使用`chattr`和`lsattr`命令来管理额外的文件标志位,来避免文件被篡改(意外或者其他情况)的方法。注意你不能将`chattr`作为一个安全措施,因为“不可变更”标志位可以很容易被取消掉。解决这个问题的一个可能的方式是限制`chattr`命令自身的可用性,或者去掉CAP_LINUX_IMMUTABLE内核权能标志。关于`chattr`以及可用的标志位的更多细节,请参考它的man手册。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/make-file-immutable-linux.html + +作者:[Dan Nanni][a] +译者:[goreliu](https://github.com/goreliu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni diff --git a/published/201505/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md b/published/201505/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md new file mode 100644 index 0000000000..8d0d835ad5 --- /dev/null +++ b/published/201505/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md @@ -0,0 +1,43 @@ +既然float不能表示所有的int,那为什么在类型转换时C++将int转换成float? +============= + +###问题: + +代码如下: + +```C +int i = 23; +float f = 3.14; +if (i == f) // 执行某段代码 +``` + +编译器会将i转换成float类型,然后比较这两个float的大小,但是float能够表示所有的int吗?为什么没有将int和float转换成double类型进行比较呢? + +###回答: + +在整型数的演变中,当`int`变成`unsigned`时,会丢掉负数部分(有趣的是,这样的话,`0u < -1`就是对的了)。 + +和C语言中的大部分机制(在C++中得到继承)一样,就硬件操作而言,常见的算术转换应该简明易懂。C语言的发明者精通他们所使用机器上的汇编语言,他们编写的C语言对他们和像他们一样编写程序的人有直接的意义,直到使用汇编语言编写(诸如UNIX内核)的程序时。 + +现如今,一般来说,处理器并不具有混合类型的指令系统(如float和double相加、比较int和float,诸如此类),因为如果这样做造成芯片晶圆的巨大浪费——如果你想支持更多不同的类型,你不得不实现更多的操作码。然而,在实际中,你只有实现"add int to int"、"compare float to float"和"multiply unsigned with unsigned"等功能的常见指令,这使得优先进行算术转换变得很有必要——它们是指令系统中两种类型的映射关系,它们中的大部分很有用处。 + +从习惯编写低级别机器代码的编程人员的角度来说,如果有了混合类型,那么在一般情况下最有可能使用的汇编指令就是那些只需要进行最少类型转换的指令。其中,有一种特殊情况就是浮点数的转换,特别是在20世纪70年代早期,当时C语言正在被开发,计算机运行速度很慢,而浮点数的计算是通过软件完成的,所以进行转换的成本很高。这拖慢了常用算术运算的转换开发——当时只有一种操作数实现了转换(这个例外就是long到unsigned int的转换,这种转换没有任何要求,在大部分机器上都可以进行。当然并不是全部,因为总有例外情况)。 + +所以,编写常用的算术转换是为了完成汇编程序员在大部分时间需要做的事情:即有两种不匹配的类型,将一种转换成另一种。这也就是汇编代码所做的事情,除非有特别原因需要进行其它类型转换。对于那些习惯编写汇编代码的人来说,除非是特殊需要,才会被迫去编写一种不同的类型转换。显然,这种情况下提出编写转换是很自然的事情。虽然,你可以简单地写成这样 + +```C +if((double) i < (double) f) +``` + +顺便提一下,在这个问题中有趣的是,`unsigned`的优先级高于`int`,所以把`int`和`unsigned`进行比较时,最终进行的是unsigned类型的比较(开头提到的`0u < -1`就是这个道理)。我猜测这可能是在早些时候(计算机发展初期),当时的人们认为`unsigned`比`int`在所表示的数值范围上受到的限制更小:现在还不需要符号位,所以可以使用额外的位来表示更大的数值范围。如果你觉得`int`可能会溢出,那么就使用unsigned好了——在使用16位表示的ints时这个担心会更明显。 + +---- +via: [stackoverflow](http://stackoverflow.com/questions/28010565/why-does-c-promote-an-int-to-a-float-when-a-float-cannot-represent-all-int-val/28011249#28011249) + +作者:[wintermute][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://stackoverflow.com/users/4301306/wintermute \ No newline at end of file diff --git a/published/201505/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md b/published/201505/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md new file mode 100644 index 0000000000..1fa38d9079 --- /dev/null +++ b/published/201505/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md @@ -0,0 +1,65 @@ +iptraf:一个实用的TCP/UDP网络监控工具 +================================================================================ + +[iptraf][1]是一个基于ncurses的IP局域网监控器,用来生成包括TCP信息、UDP计数、ICMP和OSPF信息、以太网负载信息、节点状态信息、IP校验和错误等等统计数据。 + +它基于ncurses的用户界面可以使用户免于记忆繁琐的命令行开关。 + +### 特征 ### + +- IP流量监控器,用来显示你的网络中的IP流量变化信息。包括TCP标识信息、包以及字节计数,ICMP细节,OSPF包类型。 +- 简单的和详细的接口统计数据,包括IP、TCP、UDP、ICMP、非IP以及其他的IP包计数、IP校验和错误,接口活动、包大小计数。 +- TCP和UDP服务监控器,能够显示常见的TCP和UDP应用端口上发送的和接收的包的数量。 +- 局域网数据统计模块,能够发现在线的主机,并显示其上的数据活动统计信息。 +- TCP、UDP、及其他协议的显示过滤器,允许你只查看感兴趣的流量。 +- 日志功能。 +- 支持以太网、FDDI、ISDN、SLIP、PPP以及本地回环接口类型。 +- 利用Linux内核内置的原始套接字接口,允许它(指iptraf)能够用于各种支持的网卡上 +- 全屏,菜单式驱动的操作。 + +###安装方法### + +**Ubuntu以及其衍生版本** + + sudo apt-get install iptraf + +**Arch Linux以及其衍生版本** + + sudo pacman -S iptra + +**Fedora以及其衍生版本** + + sudo yum install iptraf + +### 用法 ### + +如果不加任何命令行选项地运行**iptraf**命令,程序将进入一种交互模式,通过主菜单可以访问多种功能。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_1.png) + +简易的上手导航菜单。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_2.png) + +选择要监控的接口。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_3.png) + +接口**ppp0**处的流量。 + +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/iptraf_4.png) + +试试吧! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/iptraf-tcpudp-network-monitoring-utility/ + +作者:[Enock Seth Nyamador][a] +译者:[DongShuaike](https://github.com/DongShuaike) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/seth/ +[1]:http://iptraf.seul.org/about.html diff --git a/published/201505/20150128 Docker-2 Setting up a private Docker registry.md b/published/201505/20150128 Docker-2 Setting up a private Docker registry.md new file mode 100644 index 0000000000..d1c81e1679 --- /dev/null +++ b/published/201505/20150128 Docker-2 Setting up a private Docker registry.md @@ -0,0 +1,236 @@ +搭建一个私有的Docker registry +================================================================================ +![](http://cocoahunter.com/content/images/2015/01/docker2.jpg) + +[TL;DR] 这是系列的第二篇文章,这系列讲述了我的公司如何把基础服务从PaaS迁移到Docker上 + +- [第一篇文章][1]: 我谈到了接触Docker之前的经历; +- [第三篇文章][2]: 我展示如何使创建镜像的过程自动化以及如何用Docker部署一个Rails应用。 + +---------- + +为什么需要搭建一个私有的registry呢?嗯,对于新手来说,Docker Hub(一个Docker公共仓库)只允许你拥有一个免费的私有版本库(repo)。其他的公司也开始提供类似服务,但是价格可不便宜。另外,如果你需要用Docker部署一个用于生产环境的应用,恐怕你不希望将这些镜像放在公开的Docker Hub上吧! + +这篇文章提供了一个非常务实的方法来处理搭建私有Docker registry时出现的各种错综复杂的情况。我们将会使用一个运行于DigitalOcean(之后简称为DO)的非常小巧的512MB VPS 实例。并且我会假定你已经了解了Docker的基本概念,因为我必须集中精力在复杂的事情上! + +###本地搭建### + +首先你需要安装**boot2docker**以及docker CLI。如果你已经搭建好了基本的Docker环境,你可以直接跳过这一步。 + +从终端运行以下命令(我假设你使用OS X,使用 HomeBrew 来安装相关软件,你可以根据你的环境使用不同的包管理软件来安装): + + brew install boot2docker docker + +如果一切顺利(想要了解搭建docker环境的完整指南,请参阅 [http://boot2docker.io/][10]) ,你现在就能够通过如下命令启动一个 Docker 运行于其中的虚拟机: + + boot2docker up + +按照屏幕显示的说明,复制粘贴book2docker在终端输出的命令。如果你现在运行`docker ps`命令,终端将有以下显示。 + + CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES + +好了,Docker已经准备就绪,这就够了,我们回过头去搭建registry。 + +###创建服务器### + +登录进你的DO账号,选择一个预安装了Docker的镜像文件,创建一个新的Drople。(本文写成时选择的是 Image > Applications > Docker 1.4.1 on 14.04) + +![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-18-26-14.png) + +你将会以邮件的方式收到一个根用户凭证。登录进去,然后运行`docker ps`命令来查看系统状态。 + +### 搭建AWS S3 ### + +我们现在将使用Amazo Simple Storage Service(S3)作为我们registry/repository的存储层。我们将需要创建一个桶(bucket)以及用户凭证(user credentials)来允许我们的docker容器访问它。 + +登录到我们的AWS账号(如果没有,就申请一个[http://aws.amazon.com/][5]),在控制台选择S3(Simpole Storage Service)。 + +![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-29-21.png) + +点击 **Create Bucket**,为你的桶输入一个名字(把它记下来,我们一会需要用到它),然后点击**Create**。 + +![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-22-50.png) + +OK!我们已经搭建好存储部分了。 + +### 设置AWS访问凭证### + +我们现在将要创建一个新的用户。退回到AWS控制台然后选择IAM(Identity & Access Management)。 + +![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-29-08.png) + +在dashboard的左边,点击Users。然后选择 **Create New Users**。 + +如图所示: + +![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-31-42.png) + +输入一个用户名(例如 docker-registry)然后点击Create。写下(或者下载csv文件)你的Access Key以及Secret Access Key。回到你的用户列表然后选择你刚刚创建的用户。 + +在Permission section下面,点击Attach User Policy。之后在下一屏,选择Custom Policy。 + +![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-41-21.png) + +custom policy的内容如下: + + { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "SomeStatement", + "Effect": "Allow", + "Action": [ + "s3:*" + ], + "Resource": [ + "arn:aws:s3:::docker-registry-bucket-name/*", + "arn:aws:s3:::docker-registry-bucket-name" + ] + } + ] + } + +这个配置将允许用户(也就是regitstry)来对桶上的内容进行操作(读/写)(确保使用你之前创建AWS S3时使用的桶名)。总结一下:当你想把你的Docker镜像从你的本机推送到仓库中时,服务器就会将他们上传到S3。 + +### 安装registry ### + +现在回过头来看我们的DO服务器,SSH登录其上。我们将要[使用][11]一个[官方Docker registry镜像][6]。 + +输入如下命令,开启registry。 + + docker run \ + -e SETTINGS_FLAVOR=s3 \ + -e AWS_BUCKET=bucket-name \ + -e STORAGE_PATH=/registry \ + -e AWS_KEY=your_aws_key \ + -e AWS_SECRET=your_aws_secret \ + -e SEARCH_BACKEND=sqlalchemy \ + -p 5000:5000 \ + --name registry \ + -d \ + registry + +Docker将会从Docker Hub上拉取所需的文件系统分层(fs layers)并启动守护容器(daemonised container)。 + +### 测试registry ### + +如果上述操作奏效,你可以通过ping命令,或者查找它的内容来测试registry(虽然这个时候容器还是空的)。 + +我们的registry非常基础,而且没有提供任何“验明正身”的方式。因为添加身份验证可不是一件轻松事(至少我认为没有一种部署方法是简单的,像是为了证明你努力过似的),我觉得“查询/拉取/推送”仓库内容的最简单方法就是通过SSH通道的未加密连接(通过HTTP)。 + +打开SSH通道的操作非常简单: + + ssh -N -L 5000:localhost:5000 root@your_registry.com + +这条命令建立了一条从registry服务器(前面执行`docker run`命令的时候我们见过它)的5000号端口到本机的5000号端口之间的 SSH 管道连接。 + +如果你现在用浏览器访问 [http://localhost:5000/v1/_ping][7],将会看到下面这个非常简短的回复。 + + {} + +这个意味着registry工作正常。你还可以通过登录 [http://localhost:5000/v1/search][8] 来查看registry内容,内容相似: + + { + "num_results": 2, + "query": "", + "results": [ + { + "description": "", + "name": "username/first-repo" + }, + { + "description": "", + "name": "username/second-repo" + } + ] + } + +### 创建一个镜像 ### + +我们现在创建一个非常简单的Docker镜像,来检验我们新弄好的registry。在我们的本机上,用如下内容创建一个Dockerfile(这里只有一点代码,在下一篇文章里我将会展示给你如何将一个Rails应用绑定进Docker容器中。): + + # ruby 2.2.0 的基础镜像 + FROM ruby:2.2.0 + + MAINTAINER Michelangelo Chasseur + +并创建它: + + docker build -t localhost:5000/username/repo-name . + +`localhost:5000`这个部分非常重要:Docker镜像名的最前面一个部分将告知`docker push`命令我们将要把我们的镜像推送到哪里。在我们这个例子当中,因为我们要通过SSH管道连接远程的私有registry,`localhost:5000`精确地指向了我们的registry。 + +如果一切顺利,当命令执行完成返回后,你可以输入`docker images`命令来列出新近创建的镜像。执行它看看会出现什么现象? + +### 推送到仓库 ### + +接下来是更好玩的部分。实现我所描述的东西着实花了我一点时间,所以如果你第一次读的话就耐心一点吧,跟着我一起操作。我知道接下来的东西会非常复杂(如果你不自动化这个过程就一定会这样),但是我保证到最后你一定都能明白。在下一篇文章里我将会使用到一大波shell脚本和Rake任务,通过它们实现自动化并且用简单的命令实现部署Rails应用。 + +你在终端上运行的docker命令实际上都是使用boot2docker虚拟机来运行容器及各种东西。所以当你执行像`docker push some_repo`这样的命令时,是boot2docker虚拟机在与registry交互,而不是我们自己的机器。 + +接下来是一个非常重要的点:为了将Docker镜像推送到远端的私有仓库,SSH管道需要在boot2docker虚拟机上配置好,而不是在你的本地机器上配置。 + +有许多种方法实现它。我给你展示最简短的一种(可能不是最容易理解的,但是能够帮助你实现自动化) + +在这之前,我们需要对 SSH 做最后一点工作。 + +### 设置 SSH ### + +让我们把boot2docker 的 SSH key添加到远端服务器的“已知主机”里面。我们可以使用ssh-copy-id工具完成,通过下面的命令就可以安装上它了: + + brew install ssh-copy-id + +然后运行: + + ssh-copy-id -i /Users/username/.ssh/id_boot2docker root@your-registry.com + +用你ssh key的真实路径代替`/Users/username/.ssh/id_boot2docker`。 + +这样做能够让我们免密码登录SSH。 + +现在我们来测试以下: + + boot2docker ssh "ssh -o 'StrictHostKeyChecking no' -i /Users/michelangelo/.ssh/id_boot2docker -N -L 5000:localhost:5000 root@registry.touchwa.re &" & + +分开阐述: + +- `boot2docker ssh`允许你以参数的形式传递给boot2docker虚拟机一条执行的命令; +- 最后面那个`&`表明这条命令将在后台执行; +- `ssh -o 'StrictHostKeyChecking no' -i /Users/michelangelo/.ssh/id_boot2docker -N -L 5000:localhost:5000 root@registry.touchwa.re &`是boot2docker虚拟机实际运行的命令; + - `-o 'StrictHostKeyChecking no'`——不提示安全问题; + - `-i /Users/michelangelo/.ssh/id_boot2docker`指出虚拟机使用哪个SSH key来进行身份验证。(注意这里的key应该是你前面添加到远程仓库的那个) + - 最后我们将打开一条端口5000映射到localhost:5000的SSH通道。 + +### 从其他服务器上拉取 ### + +你现在将可以通过下面的简单命令将你的镜像推送到远端仓库: + + docker push localhost:5000/username/repo_name + +在下一篇[文章][9]中,我们将会了解到如何自动化处理这些事务,并且真正地容器化一个Rails应用。请继续收听! + +如有错误,请不吝指出。祝你Docker之路顺利! + + +-------------------------------------------------------------------------------- + +via: http://cocoahunter.com/2015/01/23/docker-2/ + +作者:[Michelangelo Chasseur][a] +译者:[DongShuaike](https://github.com/DongShuaike) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://cocoahunter.com/author/michelangelo/ +[1]:https://linux.cn/article-5339-1.html +[2]:http://cocoahunter.com/2015/01/23/docker-3/ +[3]:http://cocoahunter.com/2015/01/23/docker-2/#fn:1 +[4]:http://cocoahunter.com/2015/01/23/docker-2/#fn:2 +[5]:http://aws.amazon.com/ +[6]:https://registry.hub.docker.com/_/registry/ +[7]:http://localhost:5000/v1/_ping +[8]:http://localhost:5000/v1/search +[9]:http://cocoahunter.com/2015/01/23/docker-3/ +[10]:http://boot2docker.io/ +[11]:https://github.com/docker/docker-registry/ diff --git a/published/201505/20150128 Docker-3 Automated Docker-based Rails deployments.md b/published/201505/20150128 Docker-3 Automated Docker-based Rails deployments.md new file mode 100644 index 0000000000..be256ff1da --- /dev/null +++ b/published/201505/20150128 Docker-3 Automated Docker-based Rails deployments.md @@ -0,0 +1,246 @@ +自动化部署基于Docker的Rails应用 +================================================================================ +![](http://cocoahunter.com/content/images/2015/01/docker3.jpeg) + +[TL;DR] 这是系列文章的第三篇,讲述了我的公司是如何将基础设施从PaaS移植到Docker上的。 + +- [第一部分][1]:谈论了我接触Docker之前的经历; +- [第二部分][2]:一步步搭建一个安全而又私有的registry。 + +---------- + +在系列文章的最后一篇里,我们将用一个实例来学习如何自动化整个部署过程。 + +### 基本的Rails应用程序### + +现在让我们启动一个基本的Rails应用。为了更好的展示,我使用Ruby 2.2.0和Rails 4.1.1 + +在终端运行: + + $ rvm use 2.2.0 + $ rails new && cd docker-test + +创建一个基本的控制器: + + $ rails g controller welcome index + +……,然后编辑 `routes.rb` ,以便让该项目的根指向我们新创建的welcome#index方法: + + root 'welcome#index' + +在终端运行 `rails s` ,然后打开浏览器,登录[http://localhost:3000][3],你会进入到索引界面当中。我们不准备给应用加上多么神奇的东西,这只是一个基础的实例,当我们将要创建并部署容器的时候,用它来验证一切是否运行正常。 + +### 安装webserver ### + +我们打算使用Unicorn当做我们的webserver。在Gemfile中添加 `gem 'unicorn'`和 `gem 'foreman'`然后将它bundle起来(运行 `bundle install`命令)。 + +启动Rails应用时,需要先配置好Unicorn,所以我们将一个**unicorn.rb**文件放在**config**目录下。[这里有一个Unicorn配置文件的例子][4],你可以直接复制粘贴Gist的内容。 + +接下来,在项目的根目录下添加一个Procfile,以便可以使用foreman启动应用,内容为下: + + web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb + +现在运行**foreman start**命令启动应用,一切都将正常运行,并且你将能够在[http://localhost:5000][5]上看到一个正在运行的应用。 + +### 构建一个Docker镜像 ### + +现在我们构建一个镜像来运行我们的应用。在这个Rails项目的根目录下,创建一个名为**Dockerfile**的文件,然后粘贴进以下内容: + + # 基于镜像 ruby 2.2.0 + FROM ruby:2.2.0 + + # 安装所需的库和依赖 + RUN apt-get update && apt-get install -qy nodejs postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/* + + # 设置 Rails 版本 + ENV RAILS_VERSION 4.1.1 + + # 安装 Rails + RUN gem install rails --version "$RAILS_VERSION" + + # 创建代码所运行的目录 + RUN mkdir -p /usr/src/app + WORKDIR /usr/src/app + + # 使 webserver 可以在容器外面访问 + EXPOSE 3000 + + # 设置环境变量 + ENV PORT=3000 + + # 启动 web 应用 + CMD ["foreman","start"] + + # 安装所需的 gems + ADD Gemfile /usr/src/app/Gemfile + ADD Gemfile.lock /usr/src/app/Gemfile.lock + RUN bundle install --without development test + + # 将 rails 项目(和 Dockerfile 同一个目录)添加到项目目录 + ADD ./ /usr/src/app + + # 运行 rake 任务 + RUN RAILS_ENV=production rake db:create db:migrate + +使用上述Dockerfile,执行下列命令创建一个镜像(确保**boot2docker**已经启动并在运行当中): + + $ docker build -t localhost:5000/your_username/docker-test . + +然后,如果一切正常,长长的日志输出的最后一行应该类似于: + + Successfully built 82e48769506c + $ docker images + REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE + localhost:5000/your_username/docker-test latest 82e48769506c About a minute ago 884.2 MB + +让我们运行一下容器试试! + + $ docker run -d -p 3000:3000 --name docker-test localhost:5000/your_username/docker-test + +通过你的boot2docker虚拟机的3000号端口(我的是[http://192.168.59.103:3000][6]),你可以观察你的Rails应用。(如果不清楚你的boot2docker虚拟地址,输入` $ boot2docker ip`命令查看。) + +### 使用shell脚本进行自动化部署 ### + +前面的文章(指文章1和文章2)已经告诉了你如何将新创建的镜像推送到私有registry中,并将其部署在服务器上,所以我们跳过这一部分直接开始自动化进程。 + +我们将要定义3个shell脚本,然后最后使用rake将它们捆绑在一起。 + +### 清除 ### + +每当我们创建镜像的时候, + +- 停止并重启boot2docker; +- 去除Docker孤儿镜像(那些没有标签,并且不再被容器所使用的镜像们)。 + +在你的工程根目录下的**clean.sh**文件中输入下列命令。 + + echo Restarting boot2docker... + boot2docker down + boot2docker up + + echo Exporting Docker variables... + sleep 1 + export DOCKER_HOST=tcp://192.168.59.103:2376 + export DOCKER_CERT_PATH=/Users/user/.boot2docker/certs/boot2docker-vm + export DOCKER_TLS_VERIFY=1 + + sleep 1 + echo Removing orphaned images without tags... + docker images | grep "" | awk '{print $3}' | xargs docker rmi + +给脚本加上执行权限: + + $ chmod +x clean.sh + +### 构建 ### + +构建的过程基本上和之前我们所做的(docker build)内容相似。在工程的根目录下创建一个**build.sh**脚本,填写如下内容: + + docker build -t localhost:5000/your_username/docker-test . + +记得给脚本执行权限。 + +### 部署 ### + +最后,创建一个**deploy.sh**脚本,在里面填进如下内容: + + # 打开 boot2docker 到私有注册库的 SSH 连接 + boot2docker ssh "ssh -o 'StrictHostKeyChecking no' -i /Users/username/.ssh/id_boot2docker -N -L 5000:localhost:5000 root@your-registry.com &" & + + # 在推送前先确认该 SSH 通道是开放的。 + echo Waiting 5 seconds before pushing image. + + echo 5... + sleep 1 + echo 4... + sleep 1 + echo 3... + sleep 1 + echo 2... + sleep 1 + echo 1... + sleep 1 + + # Push image onto remote registry / repo + echo Starting push! + docker push localhost:5000/username/docker-test + +如果你不理解这其中的含义,请先仔细阅读这部分[第二部分][2]。 + +给脚本加上执行权限。 + +### 使用rake将以上所有绑定 ### + +现在的情况是,每次你想要部署你的应用时,你都需要单独运行这三个脚本。 + +1. clean +1. build +1. deploy / push + +这一点都不费工夫,可是事实上开发者比你想象的要懒得多!那么咱们就索性再懒一点! + +我们最后再把工作好好整理一番,我们现在要将三个脚本通过rake捆绑在一起。 + +为了更简单一点,你可以在工程根目录下已经存在的Rakefile中添加几行代码,打开Rakefile文件,把下列内容粘贴进去。 + + namespace :docker do + desc "Remove docker container" + task :clean do + sh './clean.sh' + end + + desc "Build Docker image" + task :build => [:clean] do + sh './build.sh' + end + + desc "Deploy Docker image" + task :deploy => [:build] do + sh './deploy.sh' + end + end + +即使你不清楚rake的语法(其实你真应该去了解一下,这玩意太酷了!),上面的内容也是很显然的吧。我们在一个命名空间(docker)里声明了三个任务。 + +三个任务是: + +- rake docker:clean +- rake docker:build +- rake docker:deploy + +Deploy独立于build,build独立于clean。所以每次我们输入命令运行的时候。 + + $ rake docker:deploy + +所有的脚本都会按照顺序执行。 + +### 测试 ### + +现在我们来看看是否一切正常,你只需要在app的代码里做一个小改动: + + $ rake docker:deploy + +接下来就是见证奇迹的时刻了。一旦镜像文件被上传(第一次可能花费较长的时间),你就可以ssh登录产品服务器,并且(通过SSH管道)把docker镜像拉取到服务器并运行了。多么简单! + +也许你需要一段时间来习惯,但是一旦成功,它几乎与用Heroku部署一样简单。 + +备注:像往常一样,请让我了解到你的意见。我不敢保证这种方法是最好,最快,或者最安全的Docker开发的方法,但是这东西对我们确实奏效。 + +-------------------------------------------------------------------------------- + +via: http://cocoahunter.com/2015/01/23/docker-3/ + +作者:[Michelangelo Chasseur][a] +译者:[DongShuaike](https://github.com/DongShuaike) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://cocoahunter.com/author/michelangelo/ +[1]:https://linux.cn/article-5339-1.html +[2]:https://linux.cn/article-5379-1.html +[3]:http://localhost:3000/ +[4]:https://gist.github.com/chasseurmic/0dad4d692ff499761b20 +[5]:http://localhost:5000/ +[6]:http://192.168.59.103:3000/ + diff --git a/sources/tech/20150205 Inxi--Find System And Hardware Information On Linux.md b/published/201505/20150205 Inxi--Find System And Hardware Information On Linux.md similarity index 63% rename from sources/tech/20150205 Inxi--Find System And Hardware Information On Linux.md rename to published/201505/20150205 Inxi--Find System And Hardware Information On Linux.md index efdc243fc6..abbfc030cf 100644 --- a/sources/tech/20150205 Inxi--Find System And Hardware Information On Linux.md +++ b/published/201505/20150205 Inxi--Find System And Hardware Information On Linux.md @@ -1,171 +1,172 @@ -Inxi: Find System And Hardware Information On Linux -================================================================================ -We already have shown different [applications][1] and ways to find the system and hardware information on Linux. In that series, today we will see how to find such details using **inxi**. It can be used for forum technical support, as a debugging tool, to quickly ascertain user system configuration and hardware. - -**Inxi** is a command line tool that can be used to find the complete system and hardware details such as; - -- Hardware, -- CPU, -- Drivers, -- Xorg, -- Desktop, -- Kernel, -- GCC version, -- Processes, -- RAM usage, -- and other useful information. - -### Installation ### - -Inxi is available in the default repositories of most modern GNU/Linux operating systems. So, we can simply install it by running the following commands. - -**On Debian based system:** - - sudo apt-get install inxi - -**On Fedora:** - - sudo yum install inxi - -**On RHEL based systems:** - -Install EPEL repository: - - sudo yum install epel-release - -Then, install inxi using command: - - sudo yum install inxi - -### Usage ### - -To find the quick view of the system information, run the following command from Terminal. - - inxi - -**Sample output:** - - CPU~Dual core Intel Core i3-2350M CPU (-HT-MCP-) clocked at Min:800.000Mhz Max:1200.000Mhz Kernel~3.13.0-45-generic x86_64 Up~6:41 Mem~1537.7/3861.3MB HDD~500.1GB(52.5% used) Procs~183 Client~Shell inxi~1.9.17 - -Ofcourse, we can retrieve a particular hardware details. For example to retrieve the **Audio/Sound hardware details**, run the following command: - - inxi -A - -**Sample output:** - - Audio: Card: Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel - Sound: Advanced Linux Sound Architecture ver: k3.13.0-45-generic - -Cool, isn’t it? - -Likewise, you can retrieve the details of **Graphic card** information. - - inxi -G - -**Sample output:** - - Graphics: Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller - X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz - GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.3.0 - -What about harddisk information? That’s also possible. To view the full **harddisk** information, run the following command. - - inxi -D - -**Sample Output:** - - Drives: HDD Total Size: 500.1GB (52.5% used) 1: id: /dev/sda model: ST9601325BD size: 500.1GB - -To display the Bios and Motherboard details: - - inxi -M - -**Sample output:** - - Machine: System: Dell (portable) product: Inspiron N5050 - Mobo: Dell model: 01HXXJ version: A05 Bios: Dell version: A05 date: 08/03/2012 - -Not only hardware details, it can also displays the **list of available repositories** in our system. - - inxi -r - -**Sample output:** - - Repos: Active apt sources in file: /etc/apt/sources.list - deb http://ubuntu.excellmedia.net/archive/ trusty main restricted - deb-src http://ubuntu.excellmedia.net/archive/ trusty main restricted - deb http://ubuntu.excellmedia.net/archive/ trusty-updates main restricted - deb-src http://ubuntu.excellmedia.net/archive/ trusty-updates main restricted - deb http://ubuntu.excellmedia.net/archive/ trusty universe - . - . - Active apt sources in file: /etc/apt/sources.list.d/intellinuxgraphics.list - deb https://download.01.org/gfx/ubuntu/14.04/main trusty main #Intel Graphics drivers - Active apt sources in file: /etc/apt/sources.list.d/linrunner-tlp-trusty.list - Active apt sources in file: /etc/apt/sources.list.d/wseverin-ppa-trusty.list - deb http://ppa.launchpad.net/wseverin/ppa/ubuntu trusty main - -Inxi will also display the Weather details of your location. Surprised? Yes, It should. - - inxi -W Erode,Tamilnadu - -Here **Erode** is the District and **Tamilnadu** is a state in India. - -Sample output: - - Weather: Conditions: 79 F (26 C) - Clear Time: February 4, 6:00 PM IST - -### Viewing Complete Hardware details ### - -Tired of finding each hardware details? Well, you can list all details at once using command: - - inxi -F - -**Sample output:** - - System: Host: sk Kernel: 3.13.0-45-generic x86_64 (64 bit) Desktop: LXDE (Openbox 3.5.2) Distro: Ubuntu 14.04 trusty - Machine: System: Dell (portable) product: Inspiron N5050 - Mobo: Dell model: 01HXXJ version: A05 Bios: Dell version: A05 date: 08/03/2012 - CPU: Dual core Intel Core i3-2350M CPU (-HT-MCP-) cache: 3072 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) - Clock Speeds: 1: 800.00 MHz 2: 1000.00 MHz 3: 800.00 MHz 4: 800.00 MHz - Graphics: Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller - X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz - GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.3.0 - Audio: Card: Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel - Sound: Advanced Linux Sound Architecture ver: k3.13.0-45-generic - Network: Card-1: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) driver: ath9k - IF: wlan0 state: up mac: - Card-2: Realtek RTL8101E/RTL8102E PCI Express Fast Ethernet controller driver: r8169 - IF: eth0 state: down mac: - Drives: HDD Total Size: 500.1GB (52.5% used) 1: id: /dev/sda model: ST9500325AS size: 500.1GB - Partition: ID: / size: 455G used: 245G (57%) fs: ext4 ID: /boot size: 236M used: 159M (72%) fs: ext2 - ID: swap-1 size: 4.19GB used: 0.00GB (0%) fs: swap - RAID: No RAID devices detected - /proc/mdstat and md_mod kernel raid module present - Sensors: System Temperatures: cpu: 64.5C mobo: N/A - Fan Speeds (in rpm): cpu: N/A - Info: Processes: 186 Uptime: 6:52 Memory: 1547.2/3861.3MB Client: Shell (bash) inxi: 1.9.17 - -As you see in the above, inxi displays the complete hardware details. - -For more details, refer the man pages. - - man inxi - -### Conclusion ### - -Are you searching for a simple tool which displays your complete system and hardware details? Then, don’t look anywhere, inxi will give you what actually want. And, it is light weight tool available in your default repositories. What else you want more? Give it a try, you won’t be disappointed. - -Cheers! - --------------------------------------------------------------------------------- - -via: http://www.unixmen.com/inxi-find-system-hardware-information-linux/ - -作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.unixmen.com/author/sk/ -[1]:http://www.unixmen.com/screenfetch-bash-screenshot-information-tool/ \ No newline at end of file +Inxi:获取Linux的系统和硬件信息 +================================================================================ + +我们已经展示了一些不同的[应用程序][1]和方法来获取Linux的系统和硬件信息。在这一系列里,我们将看到如何使用**inxi**来获取这些详情信息。在论坛技术支持中,它可以作为调试工具,迅速确定用户的系统配置和硬件信息。 + +**Inxi**是一个可以获取完整的系统和硬件详情信息的命令行工具,内容包括: + +- 硬件 +- CPU +- 磁盘驱动器 +- Xorg +- 桌面环境 +- 内核 +- GCC版本 +- 进程 +- 内存占用 +- 和其他有用的信息 + +### 安装方法 ### + +Inxi在多数现代GNU/Linux操作系统的默认软件仓库中。所以我们可以简单地运行下列命令安装。 + +**在基于Debian的发行版:** + + sudo apt-get install inxi + +**在Fedora:** + + sudo yum install inxi + +**在基于RHEL的发行版:** + +安装EPEL软件仓库: + + sudo yum install epel-release + +然后使用如下命令安装inxi: + + sudo yum install inxi + +### 使用方法 ### + +在终端运行如下命令可以获取系统的概况信息。 + + inxi + +**示例输出:** + + CPU~Dual core Intel Core i3-2350M CPU (-HT-MCP-) clocked at Min:800.000Mhz Max:1200.000Mhz Kernel~3.13.0-45-generic x86_64 Up~6:41 Mem~1537.7/3861.3MB HDD~500.1GB(52.5% used) Procs~183 Client~Shell inxi~1.9.17 + +当然,我们可以获取一个特定硬件的详情信息。比如获取**声音/音频硬件详情信息**,可以运行如下命令: + + inxi -A + +**示例输出:** + + Audio: Card: Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel + Sound: Advanced Linux Sound Architecture ver: k3.13.0-45-generic + +很酷是吧? + +同样的,你可以获取**显卡**的详情信息。 + + inxi -G + +**示例输出:** + + Graphics: Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller + X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz + GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.3.0 + +硬盘信息呢?也是可以的。运行如下命令来获取完整的**硬盘**信息。 + + inxi -D + +**示例输出:** + + Drives: HDD Total Size: 500.1GB (52.5% used) 1: id: /dev/sda model: ST9601325BD size: 500.1GB + +显示Bios和主板详情信息: + + inxi -M + +**示例输出:** + + Machine: System: Dell (portable) product: Inspiron N5050 + Mobo: Dell model: 01HXXJ version: A05 Bios: Dell version: A05 date: 08/03/2012 + +不仅是硬性详情信息,它也可以显示我们系统中的**可用软件仓库列表**。 + + inxi -r + +**示例输出:** + + Repos: Active apt sources in file: /etc/apt/sources.list + deb http://ubuntu.excellmedia.net/archive/ trusty main restricted + deb-src http://ubuntu.excellmedia.net/archive/ trusty main restricted + deb http://ubuntu.excellmedia.net/archive/ trusty-updates main restricted + deb-src http://ubuntu.excellmedia.net/archive/ trusty-updates main restricted + deb http://ubuntu.excellmedia.net/archive/ trusty universe + . + . + Active apt sources in file: /etc/apt/sources.list.d/intellinuxgraphics.list + deb https://download.01.org/gfx/ubuntu/14.04/main trusty main #Intel Graphics drivers + Active apt sources in file: /etc/apt/sources.list.d/linrunner-tlp-trusty.list + Active apt sources in file: /etc/apt/sources.list.d/wseverin-ppa-trusty.list + deb http://ppa.launchpad.net/wseverin/ppa/ubuntu trusty main + +Inxi还可以显示你所在位置的天气信息。感到意外吗?是的,它可以。 + + inxi -W Erode,Tamilnadu + +这里**Erode**是地区,**Tamilnadu**是印度的一个邦。 + +示例输出: + + Weather: Conditions: 79 F (26 C) - Clear Time: February 4, 6:00 PM IST + +### 查看完整的硬件详情信息 ### + +厌倦了逐一获取每种硬件的信息?你可以使用如下命令将所有信息一次列出: + + inxi -F + +**示例输出:** + + System: Host: sk Kernel: 3.13.0-45-generic x86_64 (64 bit) Desktop: LXDE (Openbox 3.5.2) Distro: Ubuntu 14.04 trusty + Machine: System: Dell (portable) product: Inspiron N5050 + Mobo: Dell model: 01HXXJ version: A05 Bios: Dell version: A05 date: 08/03/2012 + CPU: Dual core Intel Core i3-2350M CPU (-HT-MCP-) cache: 3072 KB flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) + Clock Speeds: 1: 800.00 MHz 2: 1000.00 MHz 3: 800.00 MHz 4: 800.00 MHz + Graphics: Card: Intel 2nd Generation Core Processor Family Integrated Graphics Controller + X.Org: 1.15.1 drivers: intel (unloaded: fbdev,vesa) Resolution: 1366x768@60.0hz + GLX Renderer: Mesa DRI Intel Sandybridge Mobile GLX Version: 3.0 Mesa 10.3.0 + Audio: Card: Intel 6 Series/C200 Series Family High Definition Audio Controller driver: snd_hda_intel + Sound: Advanced Linux Sound Architecture ver: k3.13.0-45-generic + Network: Card-1: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) driver: ath9k + IF: wlan0 state: up mac: + Card-2: Realtek RTL8101E/RTL8102E PCI Express Fast Ethernet controller driver: r8169 + IF: eth0 state: down mac: + Drives: HDD Total Size: 500.1GB (52.5% used) 1: id: /dev/sda model: ST9500325AS size: 500.1GB + Partition: ID: / size: 455G used: 245G (57%) fs: ext4 ID: /boot size: 236M used: 159M (72%) fs: ext2 + ID: swap-1 size: 4.19GB used: 0.00GB (0%) fs: swap + RAID: No RAID devices detected - /proc/mdstat and md_mod kernel raid module present + Sensors: System Temperatures: cpu: 64.5C mobo: N/A + Fan Speeds (in rpm): cpu: N/A + Info: Processes: 186 Uptime: 6:52 Memory: 1547.2/3861.3MB Client: Shell (bash) inxi: 1.9.17 + +就像上面你看到的那样,inxi显示出了完整的硬件详情信息。 + +更多的细节可以参考man手册。 + + man inxi + +### 结论 ### + +你在寻找一个可以显示完整的系统和硬件详情信息的简单工具吗?那么不用再找了,inxi会提供你所需要的。并且,它还是在你系统默认的软件仓库中的轻量级工具。你还想要更多东西吗?试一试它,你不会失望。 + +欢呼吧! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/inxi-find-system-hardware-information-linux/ + +作者:[SK][a] +译者:[goreliu](https://github.com/goreliu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:https://linux.cn/article-1947-1.html diff --git a/published/201505/20150205 zBackup--A versatile deduplicating backup tool.md b/published/201505/20150205 zBackup--A versatile deduplicating backup tool.md new file mode 100644 index 0000000000..c0d9e85128 --- /dev/null +++ b/published/201505/20150205 zBackup--A versatile deduplicating backup tool.md @@ -0,0 +1,60 @@ +zBackup:一个多功能的去重备份工具 +================================================================================ +zbackup是一个基于rsync思想的全局去重数据备份工具。给它传入一个大的tar文件后,它会仅存储一次该文件的重复部分,然后对结果进行压缩,并根据参数确定是否对其加密。传入另一个tar文件后,它会从之前的已备份文件中复用重复数据。只有新的改动会被保存,并且只要文件差异不是很大,需要的存储空间非常少。无论何时,之前的已备份文件都可以被完整地读出来。 + +### zBackup特性 ### + +- 使用并行的LZMA或者LZO压缩算法压缩已备份数据 +- 使用内置的AES加密算法加密已备份数据 +- 可以删除旧的已备份数据 +- 使用一个64位滚动哈希,保持软碰撞数量为0 +- 备份库由不可更改的文件组成,只有库中不存在的文件才能修改 +- 使用C++语言编写,并且只有适量的依赖库 +- 可以在生产环境安全使用 +- 可以在不同备份库中交换数据而无需重新压缩 + +### 在ubuntu中安装zBackup ### + +打开终端并运行如下命令: + + sudo apt-get install zbackup + +### 使用zBackup ### + +`zbackup init`命令会初始化一个备份库,用来存放待备份的数据。 + + zbackup init [--non-encrypted] [--password-file ~/.my_backup_password ] /my/backup/repo + +`zbackup backup`命令备份一个由`tar c`命令创建的tar文件到刚才使用`zbackup init`初始化的备份库。(LCTT 译注:实际使用时类似这样,tar c files | zbackup ...) + + zbackup [--password-file ~/.my_backup_password ] [--threads number_of_threads ] backup /my/backup/repo/backups/backup-`date ‘+%Y-%m-%d'` + +`zbackup restore`命令从备份库中恢复一个已备份文件到tar文件中。 + + zbackup [--password-file ~/.my_backup_password ] [--cache-size cache_size_in_mb ] restore /my/backup/repo/backups/backup-`date ‘+%Y-%m-%d'` > /my/precious/backup-restored.tar + +### 可用选项 ### + +- -non-encrypted -- 不加密备份库。 +- --password-file ~/.my_backup_password -- 使用位于~/.my_backup_password的口令文件来加密备份库和待备份文件,以及解密已备份文件。 +- --threads number_of_threads -- 限制并行LZMA压缩的线程数为 number_of_threads。建议在32位的系统平台使用。 +- --cache-size cache_size_in_mb -- 使用cache_size_in_mb中的缓存大小来加速恢复文件的过程。 + +### 上述命令中 zBackup 相关文件 ### + +- ~/.my_backup_password 用来加密备份库和待备份文件,以及解密已备份文件。更多细节见zbackup。 +- /my/backup/repo 存放备份库的目录。 +- /my/precious/restored-tar 用来恢复已备份文件的tar文件。 +- /my/backup/repo/backups/backup-`date ‘+%Y-%m-%d'` 指定的之前已备份文件的文件名。 + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/zbackup-a-versatile-deduplicating-backup-tool.html + +作者:[ruchi][a] +译者:[goreliu](https://github.com/goreliu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix diff --git a/published/201505/20150211 25 Tips for Intermediate Git Users.md b/published/201505/20150211 25 Tips for Intermediate Git Users.md new file mode 100644 index 0000000000..205c83aaef --- /dev/null +++ b/published/201505/20150211 25 Tips for Intermediate Git Users.md @@ -0,0 +1,469 @@ +25个 Git 进阶技巧 +================================================================================ +我已经使用git差不多18个月了,觉得自己对它应该已经非常了解。然后来自GitHub的[Scott Chacon][1]过来给LVS做培训([LVS是一个赌博软件供应商和开发商][2],从2013年开始的合同),而我在第一天里就学到了很多。 + +作为一个对git感觉良好的人,我觉得分享从社区里掌握的一些有价值的信息,也许能帮某人解决问题而不用做太深入研究。 + +### 基本技巧 ### + +#### 1. 安装后的第一步 #### + +在安装好git后,你第一件该做的事是设置你的名字和电子邮箱,因为每次提交都要用到这些信息: + + $ git config --global user.name "Some One" + $ git config --global user.email "someone@gmail.com" + +#### 2. Git是基于指针的 #### + +保存在git里的一切都是文件。当你创建一个提交的时候,会建立一个包含你的提交信息和相关数据(名字,邮件地址,日期/时间,前一个提交,等等)的文件,并把它链接到一个树文件中。这个树文件中包含了对象或其他树的列表。这里的提到的对象(或二进制大对象)是和本次提交相关的实际内容(它也是一个文件,另外,尽管文件名并没有包含在对象里,但是存储在树中)。所有这些文件都使用对象的SHA-1哈希值作为文件名。 + +用这种方式,分支和标签就是简单的文件(基本上是这样),包含指向该提交的SHA-1哈希值。使用这些索引会带来优秀的灵活性和速度,比如创建一个新分支就是简单地用分支名字和所分出的那个提交的SHA-1索引来创建一个文件。当然,你不需要自己做这些,而只要使用Git命令行工具(或者GUI),但是实际上就是这么简单。 + +你也许听说过叫HEAD的索引。这只是简单的一个文件,包含了你当前指向的那个提交的SHA-1索引值。如果你正在解决一次合并冲突然后看到了HEAD,这并不是一个特别的分支或分支上的一个必需的特殊位置,只是标明你当前所在位置。 + +所有的分支指针都保存在.git/refs/heads里,HEAD在.git/HEAD里,而标签保存在.git/refs/tags里 - 自己可以随便进去看看。 + +#### 3. 两个爸爸(父节点) - 你没看错! #### + +在历史中查看一个合并提交的信息时,你将看到有两个父节点(不同于工作副本上的常规提交的情况)。第一个父节点是你所在的分支,第二个是你合并过来的分支。 + +#### 4. 合并冲突 #### + +目前我相信你碰到过合并冲突并且解决过。通常是编辑一下文件,去掉<<<<,====,>>>>标志,保留需要留下的代码。有时能够看到这两个修改之前的代码会很不错,比如,在这两个现在冲突的分支之前的改动。下面是一种方式: + + $ git diff --merge + diff --cc dummy.rb + index 5175dde,0c65895..4a00477 + --- a/dummy.rb + +++ b/dummy.rb + @@@ -1,5 -1,5 +1,5 @@@ + class MyFoo + def say + - puts "Bonjour" + - puts "Hello world" + ++ puts "Annyong Haseyo" + end + end + +如果是二进制文件,比较差异就没那么简单了...通常你要做的就是测试这个二进制文件的两个版本来决定保留哪个(或者在二进制文件编辑器里手工复制冲突部分)。从一个特定分支获取文件拷贝(比如说你在合并master和feature123两个分支): + + $ git checkout master flash/foo.fla # 或者... + $ git checkout feature132 flash/foo.fla + $ # 然后... + $ git add flash/foo.fla + +另一种方式是通过git输出文件 - 你可以输出到另外的文件名,然后当你决定了要用哪个后,再将选定的正确文件复制为正常的文件名: + + $ git show master:flash/foo.fla > master-foo.fla + $ git show feature132:flash/foo.fla > feature132-foo.fla + $ # 检出master-foo.fla和feature132-foo.fla + $ # 假如说我们决定来自feature132的文件是正确的 + $ rm flash/foo.fla + $ mv feature132-foo.fla flash/foo.fla + $ rm master-foo.fla + $ git add flash/foo.fla + +更新:感谢Carl在原博客文章上评论里的提醒,你实际上可以用“git checkout —ours flash/foo.fla”和“git checkout —theirs flash/foo.fla”来检出特定版本的文件,而不用记住你在合并的分支名字。就我个人来说喜欢更精确一点,但这也是一种方式... + +记着在解决完冲突后要将文件加入提交(像我上面做的那样)。 + +### 服务器,分支和标签 ### + +#### 5. 远端服务器 #### + +git的一个超强大的功能就是可以有不止一个远端服务器(实际上你一直都在一个本地仓库上工作)。你并不是一定都要有这些服务器的写权限,你可以有多个可以读取的服务器(用来合并他们的工作)然后写入到另外一个仓库。添加一个新的远端服务器很简单: + + $ git remote add john git@github.com:johnsomeone/someproject.git + +如果你想查看远端服务器的信息可以这样做: + + # 显示每个远端服务器的URL + $ git remote -v + + # 提供更多详细信息 + $ git remote show name + +你随时都可以查看本地分支和远端分支的差异: + + $ git diff master..john/master + +你也可以查看没有在远端分支上的HEAD的改动: + + $ git log remote/branch.. + # 注意:..后面没有结束的特定引用 + +#### 6. 标签 #### + +在git里有两种类型的标签 - 轻量级标签和带注释标签。记住技巧2里说过git是基于指针的,这两者之间的差异也很简单。轻量级标签只是一个简单的指向一次提交的带名字指针。你随时都可以将它指向另一个提交。带注释标签是一个指向标签对象的带名字指针,带有自己的信息和历史。因为有自己的信息,它可以根据需要用GPG签名。 + +建立这两种类型的标签都很简单(只有一个命令行开关的差异) + + $ git tag to-be-tested + $ git tag -a v1.1.0 # 会提示输入标签的信息 + +#### 7. 建立分支 #### + +在git里建立分支非常简单(而且像闪电一样快,因为它只需要创建一个小于100字节的文件)。用普通方式建立新分支并切换过去: + + $ git branch feature132 + $ git checkout feature132 + +当然,如果你确定自己直接切换到新建的分支,可以用一个命令实现: + + $ git checkout -b feature132 + +如果你想重命名一个本地分支也很简单(可以显示发生了什么的较长的方式): + + $ git checkout -b twitter-experiment feature132 + $ git branch -d feature132 + +更新:你也可以(像Brian Palmer在原博客文章的评论里提出的)只用“git branch”的-m开关在一个命令里实现(像Mike提出的,如果你只指定了一个分支参数,就会重命名当前分支): + + $ git branch -m twitter-experiment + $ git branch -m feature132 twitter-experiment + +#### 8. 合并分支 #### + +也许在将来的某个时候,你希望将改动合并。有两种方式: + + $ git checkout master + $ git merge feature83 # 或者... + $ git rebase feature83 + +merge和rebase之间的差别是merge会尝试处理改动并建立一个新的混合了两者的提交。rebase会尝试把你从一个分支最后一次分离后的所有改动,一个个加到该分支的HEAD上。不过,在已经将分支推到远端服务器后不要再rebase了 - 这会引起冲突/问题。 + +如果你不确定在哪些分支上还有独有的工作 - 所以你也不知道哪些分支需要合并而哪些可以删除,git branch有两个开关可以帮你: + + # 显示已经全部合并到当前分支的分支 + $ git branch --merged + + # 显示没有合并到当前分支的分支 + $ git branch --no-merged + +#### 9. 远端分支 #### + +如果你在本地有一个分支希望推到远端服务器上,你可以用一行命令推送上去: + + $ git push origin twitter-experiment:refs/heads/twitter-experiment + # origin是我们服务器的名字,而twitter-experiment是分支名字 + +更新:感谢Erlend在原博客文章上的评论 - 这个实际上和`git push origin twitter-experiment`效果一样,不过使用完整的语法,你可以在两者之间使用不同的分支名(这样本地分支可以是`add-ssl-support`而远端是`issue-1723`)。 + +如果你想在远端服务器上删除一个分支(注意分支名前面的冒号): + + $ git push origin :twitter-experiment + +如果你想查看所有远端分支的状态可以这样做: + + $ git remote show origin + +这个命令可能会列出服务器上一些以前有过但现在已经不在了的分支。如果碰到这种情况你可以用下面的命令从你本地分支里清理掉: + + $ git remote prune + +最后,如果你想在本地跟踪一个远端分支,普通的方式是: + + $ git branch --track myfeature origin/myfeature + $ git checkout myfeature + +不过,新版的git在使用-b标记检出分支时会自动设定跟踪: + + $ git checkout -b myfeature origin/myfeature + +### 在储藏点,索引和文件系统中保存内容 ### + +#### 10. 储藏 #### + +在git里你可以把当前工作状态放进一个储藏堆栈中,然后可以再取出来。最简单的情形是下面这样: + + $ git stash + # 做点其他事情... + $ git stash pop + +许多人建议使用`git stash apply`来代替pop,不过如果这样做的话最后会遗留一个很长的储藏列表。而“pop”会在全部加载后自动从堆栈中移除。如果使用过`git stash apply`,你也可以使用下面的命令从堆栈上移除最后一项: + + $ git stash drop + +git会基于当前的提交信息自动创建评论。如果你更希望有自定义信息的话(因为它可能和前一个提交没有任何联系): + + $ git stash save "My stash message" + +如果你希望从列表中取出一个特定的储藏点(不一定非得是最后一个)可以先列出它们然后用下面的方式取出: + + $ git stash list + stash@{0}: On master: Changed to German + stash@{1}: On master: Language is now Italian + $ git stash apply stash@{1} + +#### 11. 交互式添加 #### + +在subversion的世界里你只能修改文件然后提交所有改动。而在git里你有强大得多的方式来提交部分文件或者甚至是部分补丁。提交部分文件或文件中的部分改动你需要进入交互式模式: + + $ git add -i + staged unstaged path + + + *** Commands *** + 1: status 2: update 3: revert 4: add untracked + 5: patch 6: diff 7: quit 8: help + What now> + +这会让你进入一个基于菜单的交互式提示。你可以使用命令中的数字或高亮的字母(如果你在终端里打开了高亮的话)来进入相应的模式。然后就只是输入你希望操作的文件的数字了(你可以使用这样的格式,1或者1-4或2,4,7)。 + +如果你想进入补丁模式(交互式模式下按‘p’或‘5’),你也可以直接进入: + + $ git add -p + diff --git a/dummy.rb b/dummy.rb + index 4a00477..f856fb0 100644 + --- a/dummy.rb + +++ b/dummy.rb + @@ -1,5 +1,5 @@ + class MyFoo + def say + - puts "Annyong Haseyo" + + puts "Guten Tag" + end + end + Stage this hunk [y,n,q,a,d,/,e,?]? + +你可以看到下方会有一些选项供选择用来添加该文件的这个改动、该文件的所有改动,等等。使用‘?’命令可以详细解释这些选项。 + +#### 12. 从文件系统里保存/取回改动 #### + +有些项目(比如Git项目本身)在git文件系统中直接保存额外文件而并没有将它们加入到版本控制中。 + +让我们从在git中存储一个随机文件开始: + + $ echo "Foo" | git hash-object -w --stdin + 51fc03a9bb365fae74fd2bf66517b30bf48020cb + +这样这个目标文件就已经保存到数据库中了,但是如果你没有设定一个指向它的指针的话它会被当做垃圾回收。最简单的方式是设定一个标签: + + $ git tag myfile 51fc03a9bb365fae74fd2bf66517b30bf48020cb + +注意这里我们使用了标签myfile。当我们需要使用这个文件的时候可以这样做: + + $ git cat-file blob myfile + +这个对于一些工具文件很有用,开发者可能会用到(密码,GPG密钥,等等)但是又不希望每次都检出到硬盘(尤其是在实际工作中)。 + +### 日志以及有哪些改动? ### + +#### 13. 查看日志 #### + +长时间使用 Git 的话,不会没用过‘git log’来查看最近的提交。不过,有一些技巧来更好地应用。比如,你可以使用下面的命令来查看每次提交的具体改动: + + $ git log -p + +或者你可以仅仅查看有哪些文件改动: + + $ git log --stat + +有个很不错的别名你可以试试,会显示简短提交名和一个不错的分支图并在一行里显示提交信息(有点像gitk,但是是在命令行下): + + $ git config --global alias.lol "log --pretty=oneline --abbrev-commit --graph --decorate" + $ git lol + * 4d2409a (master) Oops, meant that to be in Korean + * 169b845 Hello world + +#### 14. 搜索日志 #### + +如果你想找特定提交者可以这样做: + + $ git log --author=Andy + +更新:感谢Johannes的评论,我已经去掉了之前这里的一些有混淆的地方。 + +或者你想在提交信息里找一些相关字段: + + $ git log --grep="Something in the message" + +也有一个更强大的叫做pickaxe的命令用来查找包含了删除或添加的某个特定内容的提交(比如,该内容第一次出现或被删除)。这可以告诉你什么时候增加了一行(但这一行里的某个字符后面被改动过就不行了): + + $ git log -S "TODO: Check for admin status" + +假如你改动了一个特定的文件,比如`lib/foo.rb` + + $ git log lib/foo.rb + +比如说你有一个`feature/132`分支和`feature/145`分支,然后你想看看这两个分支上不在master分支里的提交(注意^符号是不在的意思): + + $ git log feature/132 feature/145 ^master + +你也可以使用ActiveSupport格式的日期来缩小到某个日期范围: + + $ git log --since=2.months.ago --until=1.day.ago + +默认情况下会用OR来组合查询,但你可以轻易地改为AND(如果你有超过一条的查询标准) + + $ git log --since=2.months.ago --until=1.day.ago --author=andy -S "something" --all-match + +#### 15. 查看/修改版本 #### + +有很多方式可以用来引用一个版本,看你记得哪个: + + $ git show 12a86bc38 # 根据版本 + $ git show v1.0.1 # 根据标签 + $ git show feature132 # 根据分支名 + $ git show 12a86bc38^ # 一次提交的父节点 + $ git show 12a86bc38~2 # 一次提交的祖父节点 + $ git show feature132@{yesterday} # 时间相关 + $ git show feature132@{2.hours.ago} # 时间相关 + +注意和之前部分有些不同,末尾的^的意思是该提交的父节点 - 开始位置的^的意思是不在这个分支。 + +#### 16. 选择范围 #### + +最简单的方式: + + $ git log origin/master..new + # [old]..[new] - 所有你还没有推送的提交 + +你也可以省略[new],将使用当前的HEAD。 + +### 时光回溯和后悔药 ### + +#### 17. 重置改动 #### + +如果你还没有提交的话可以用下面的命令轻松地取消改动: + + $ git reset HEAD lib/foo.rb + +通常会使用‘unstage’的别名,因为上面的看上去有些不直观。 + + $ git config --global alias.unstage "reset HEAD" + $ git unstage lib/foo.rb + +如果你已经提交了该文件,你可以做两件事 - 如果是最后一次提交你还可以改正: + + $ git commit --amend + +这会取消最后一次提交,把工作分支回退到提交前标记了所有改动的状态,而且提交信息也都准备好可以修改或直接提交。 + +如果你已经提交过多次而且希望全部回退,你可以将分支重置到合适的位置。 + + $ git checkout feature132 + $ git reset --hard HEAD~2 + +如果你实际上希望将分支指向一个完全不同的SHA1(也许你要将一个分支的HEAD替换到另一个分支,或者之后的某次提交)你可以使用下面的较长的方式: + + $ git checkout FOO + $ git reset --hard SHA + +实际上有一个快速的方式(不需要先把你的工作分支切换到FOO再前进到SHA): + + $ git update-ref refs/heads/FOO SHA + +#### 18. 提交到了错误的分支 #### + +好吧,假如说你已经提交到了master,但却应该创建一个叫experimental的主题分支更合适。要移动这些改动,你可以在当前位置创建分支,回退HEAD再检出新分支: + + $ git branch experimental # 创建一个指向当前master的位置的指针 + $ git reset --hard master~3 # 移动master分支的指针到3个版本之前 + $ git checkout experimental + +如果你的改动是在分支的分支的分支上会更复杂。那样你需要做的是将分支基础切换到其他地方: + + $ git branch newtopic STARTPOINT + $ git rebase oldtopic --onto newtopic + +#### 19. 交互式切换基础 #### + +这是一个我之前看过展示却没真正理解过的很赞的功能,现在觉得它就很简单了。假如说你提交了3次但是你希望更改顺序或编辑(或者合并): + + $ git rebase -i master~3 + +然后这会启动你的编辑器并带有一些指令。你所要做的就是修改这些指令来选择/插入/编辑(或者删除)提交和保存/退出。然后在编辑完后你可以用`git rebase --continue`命令来让每一条指令生效。 + +如果你有修改,将会切换到你提交时所处的状态,之后你需要使用命令git commit --amend来编辑。 + +**注意:在rebase的时候千万不要提交 - 只能先添加然后使用参数--continue,--skip或--abort。** + +#### 20. 清理 #### + +如果你提交了一些内容到你的分支(也许你从SVN导入了一些旧仓库),然后你希望把某个文件从历史记录中全部删掉: + + $ git filter-branch --tree-filter 'rm -f *.class' HEAD + +如果你已经推送到origin了,但之后提交了一些垃圾改动,你也可以在推送前在本地系统里这样做: + + $ git filter-branch --tree-filter 'rm -f *.class' origin/master..HEAD + +### 其他技巧 ### + +#### 21. 你查看过的前一个引用 #### + +如果你知道自己之前查看过一个SHA-1,但是随后做了一些重置/回退的操作,你可以使用reflog命令来列出最近查看过的SHA-1记录: + + $ git reflog + $ git log -g # 和上面一样,但是使用'log'格式输出 + +#### 22. 分支命名 #### + +一个可爱的小技巧 - 别忘了分支名并不限于a-z和0-9。名字中可以用/和.将非常方便用来建立伪命名空间或版本,例如: + + $ # 生成版本132的改动历史 + $ git shortlog release/132 ^release/131 + $ # 贴上v1.0.1的标签 + $ git tag v1.0.1 release/132 + +#### 23. 找出谁是凶手 #### + +通常找出来谁改动了某个文件里的某行代码会很有用。实现这个功能的最简单命令是: + + $ git blame FILE + +有时候这些改动来自其他文件(如果你合并了两个文件,或者你移动了某个函数)所以你可以使用下面的命令: + + $ # 显示内容来自哪个文件 + $ git blame -C FILE + +有时候通过点击各个改动然后回到很早很早以前来跟踪改动会很不错。有一个很好的内建GUI命令来做这个: + + $ git gui blame FILE + +#### 24. 数据维护 #### + +通常git不需要经常维护,它把自己照顾的很好。不过,你可以通过下面的命令查看数据统计: + + $ git count-objects -v + +如果占用很多空间的话,你可以选择在你的本地仓库做垃圾回收。这不会影响推送或其他人,却会让一些命令运行更快而且减少空间占用: + + $ git gc + +经常运行完整性检查也很有意义: + + $ git fsck --full + +你也可以在末尾加上`--auto`参数(如果你在服务器上通过crontab经常/每天都运行这个命令的话),然后它只会在必要的时候才执行fsck动作。 + +在检查的时候,看到“dangling”或“unreachable”是正常的,通常这是由回退HEAD或切换基础的结果。而看到“missing”或“sha1 mismatch”就不对了...找专业人士帮忙吧! + +#### 25. 恢复遗失的分支 #### + +如果你使用-D参数删除了experimental分支,可以用下面的命令重新建立: + + $ git branch experimental SHA1_OF_HASH + +如果你最近访问过的话,你通常可以用git reflog来找到SHA1哈希值。 + +另一种方式是使用`git fsck —lost-found`。其中一个dangling的提交就是丢失的HEAD(它只是已删除分支的HEAD,而HEAD^被引用为当前的HEAD所以它并不处于dangling状态) + +### 搞定! ### + +哇,这是我写过的最长的一篇博客,我希望有人能觉得有用。如果你这么觉得,或者你有任何疑问请在评论里留言让我知道... + +-------------------------------------------------------------------------------- + +via: https://www.andyjeffries.co.uk/25-tips-for-intermediate-git-users/ + +作者:[Andy Jeffries][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.andyjeffries.co.uk/author/andy-jeffries/ +[1]:http://gitcasts.com/about +[2]:http://www.lvs.co.uk/ diff --git a/published/201505/20150211 Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10.md b/published/201505/20150211 Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10.md new file mode 100644 index 0000000000..97641f0298 --- /dev/null +++ b/published/201505/20150211 Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10.md @@ -0,0 +1,67 @@ +在Ubuntu 14.10上安装基于Web的监控工具:Linux-Dash +================================================================================ + +Linux-Dash是一个用于GNU/Linux机器的,低开销的监控仪表盘。您可以安装试试!Linux Dash的界面提供了您的服务器的所有关键信息的详细视图,可监测的信息包括RAM、磁盘使用率、网络、安装的软件、用户、运行的进程等。所有的信息都被分成几类,您可以通过主页工具栏中的按钮跳到任何一类中。Linux Dash并不是最先进的监测工具,但它十分适合寻找灵活、轻量级、容易部署的应用的用户。 + +### Linux-Dash的功能 ### + +- 使用一个基于Web的漂亮的仪表盘界面来监控服务器信息 +- 实时的按照你的要求监控RAM、负载、运行时间、磁盘配置、用户和许多其他系统状态 +- 支持基于Apache2/niginx + PHP的服务器 +- 通过点击和拖动来重排列控件 +- 支持多种类型的linux服务器 + +### 当前控件列表 ### + +- 通用信息 +- 平均负载 +- RAM +- 磁盘使用量 +- 用户 +- 软件 +- IP +- 网络速率 +- 在线状态 +- 处理器 +- 日志 + +### 在Ubuntu server 14.10上安装Linux-Dash ### + +首先您需要确认您安装了[Ubuntu LAMP server 14.10][1],接下来您需要安装下面的包: + + sudo apt-get install php5-json unzip + +安装这个模块后,需要在apache2中启用该模块,所以您需要使用下面的命令重启apache2服务器: + + sudo service apache2 restart + +现在您需要下载linux-dash的安装包并安装它: + + wget https://github.com/afaqurk/linux-dash/archive/master.zip + + unzip master.zip + + sudo mv linux-dash-master/ /var/www/html/linux-dash-master/ + +接下来您需要使用下面的命令来改变权限: + + sudo chmod 755 /var/www/html/linux-dash-master/ + +现在您便可以访问http://serverip/linux-dash-master/了。您应该会看到类似下面的输出: + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/02/1.png) + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/02/2.png) + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/install-linux-dash-web-based-monitoring-tool-on-ubntu-14-10.html + +作者:[ruchi][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix +[1]:http://www.ubuntugeek.com/step-by-step-ubuntu-14-10-utopic-unicorn-lamp-server-setup.html diff --git a/published/201505/20150225 Linux FAQs with Answers--How to disable IPv6 on Linux.md b/published/201505/20150225 Linux FAQs with Answers--How to disable IPv6 on Linux.md new file mode 100644 index 0000000000..17c6ccefaa --- /dev/null +++ b/published/201505/20150225 Linux FAQs with Answers--How to disable IPv6 on Linux.md @@ -0,0 +1,148 @@ +Linux有问必答:如何在Linux下禁用IPv6 +================================================================================ +> **问题**:我发现我的一个应用程序在尝试通过IPv6建立连接,但是由于我们本地网络不允许分配IPv6的流量,IPv6连接会超时,应用程序的连接会回退到IPv4,这样就会造成不必要的延迟。由于我目前对IPv6没有任何需求,所以我想在我的Linux主机上禁用IPv6。有什么比较合适的方法呢? + +IPv6被认为是IPv4——互联网上的传统32位地址空间——的替代产品,它用来解决现有IPv4地址空间即将耗尽的问题。然而,由于已经有大量主机、设备用IPv4连接到了互联网上,所以想在一夜之间将它们全部切换到IPv6几乎是不可能的。许多IPv4到IPv6的转换机制(例如:双协议栈、网络隧道、代理) 已经被提出来用来促进IPv6能被采用,并且很多应用也正在进行重写,如我们所提倡的,来增加对IPv6的支持。有一件事情可以确定,就是在可预见的未来里IPv4和IPv6势必将共存。 + +理想情况下,[向IPv6过渡的进程][1]不应该被最终的用户所看见,但是IPv4/IPv6混合环境有时会让你碰到各种源于IPv4和IPv6之间不经意间的相互碰撞的问题。举个例子,你会碰到应用程序超时的问题,比如apt-get或ssh尝试通过IPv6连接失败、DNS服务器意外清空了IPv6的AAAA记录、或者你支持IPv6的设备不兼容你的互联网服务提供商遗留下的IPv4网络,等等等等。 + +当然这不意味着你应该盲目地在你的Linux机器上禁用IPv6。鉴于IPv6许诺的种种好处,作为社会的一份子我们最终还是要充分拥抱它的,但是作为给最终用户进行故障排除过程的一部分,如果IPv6确实是罪魁祸首,那你可以尝试去关闭它。 + +这里有一些让你在Linux中部分(例如:对于某个特定的网络接口)或全部禁用IPv6的小技巧。这些小贴士应该适用于所有主流的Linux发行版包括Ubuntu、Debian、Linux Mint、CentOS、Fedora、RHEL以及Arch Linux。 + +### 查看IPv6在Linux中是否被启用 ### + +所有现代Linux发行版默认都自动启用IPv6。为了能看到IPv6在你的Linux中是否被激活,可以使用ifconfig或ip命令。如果你在输入这些命令之后看到"inet6"字样的输出,那就意味着你的Linux系统启用了IPv6。 + + $ ifconfig + +![](https://farm8.staticflickr.com/7282/16415082398_5fb0920506_b.jpg) + + $ ip addr + +![](https://farm8.staticflickr.com/7290/16415082248_c4e075548b_c.jpg) + +### 临时禁用IPv6 ### + +如果你想要在你的Linux系统上临时关闭IPv6,你可以用 /proc 文件系统。"临时"的意思是我们所做的禁用IPv6的更改在系统重启后将不被保存。IPv6会在你的Linux机器重启后再次被启用。 + +要将一个特定的网络接口禁用IPv6,使用以下命令: + + $ sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf//disable_ipv6' + +举个例子,将eth0接口禁用IPv6: + + $ sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' + +![](https://farm8.staticflickr.com/7288/15982511863_0c1feafe7f_b.jpg) + +重新启用eth0接口的IPv6: + + $ sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' + +如果你想要将整个系统所有接口包括回环接口禁用IPv6,使用以下命令: + + $ sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' + +### 永久禁用IPv6 ### + +以上方法是不能永久禁用IPv6的,你一旦重启系统IPv6还是会被启用。如果你想要永久关闭它,有几个方法你可以试试。 + +#### 方法一 #### + +第一种方法是通过 /etc/sysctl.conf 文件对 /proc 进行永久修改。 + +换句话说,就是用文本编辑器打开 /etc/sysctl.conf 然后添加以下内容: + + # 禁用整个系统所有接口的IPv6 + net.ipv6.conf.all.disable_ipv6 = 1 + + # 禁用某一个指定接口的IPv6(例如:eth0, lo) + net.ipv6.conf.lo.disable_ipv6 = 1 + net.ipv6.conf.eth0.disable_ipv6 = 1 + +在 /etc/sysctl.conf 使这些更改生效,运行以下命令: + + $ sudo sysctl -p /etc/sysctl.conf + +或者直接重启。 + +#### 方法二 #### + +另一个永久禁用IPv6的方法是在开机的时候传递一个必要的内核参数。 + +用文本编辑器打开 /etc/default/grub 并给GRUB_CMDLINE_LINUX变量添加"ipv6.disable=1"。 + + $ sudo vi /etc/default/grub + +---------- + + GRUB_CMDLINE_LINUX="xxxxx ipv6.disable=1" + +上面的"xxxxx"代表任何已有的内核参数,在它后面添加"ipv6.disable=1"。 + +![](https://farm8.staticflickr.com/7286/15982512103_ec5d940e58_b.jpg) + +最后,不要忘记用以下方法保存对GRUB/GRUB2的修改: + +Debian、Ubuntu或Linux Mint系统: + + $ sudo update-grub + +Fedora、CentOS/RHEL系统: + + $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg + +现在只要你重启你的Linux系统,IPv6就会完全被禁用。 + +### 禁用IPv6之后的其它可选步骤 ### + +这里有一些在你禁用IPv6后需要考虑的可选步骤,这是因为当你在内核里禁用IPv6后,其它程序也许仍然会尝试使用IPv6。在大多数情况下,应用程序的这种行为不太会影响到什么,但是出于效率或安全方面的原因,你可以为他们禁用IPv6。 + +#### /etc/hosts #### + +根据你的设置, /etc/hosts 会包含一条或多条IPv6的hosts和它们的地址。用文本编辑器打开 /etc/hosts 并注释掉包含IPv6 hosts的脚本行。 + + $ sudo vi /etc/hosts + +---------- + + # comment these IPv6 hosts + # ::1 ip6-localhost ip6-loopback + # fe00::0 ip6-localnet + # ff00::0 ip6-mcastprefix + # ff02::1 ip6-allnodes + # ff02::2 ip6-allrouters + +#### Network Manager #### + +如果你在用NetworkManager来管理你的网络设置,你可以在NetworkManager里禁用IPv6。在NetworkManager打开wired connection,点击"IPv6 Settings"选项并在"Method"一栏选择"Ignore",保存退出。 + +![](https://farm8.staticflickr.com/7293/16394993017_21917f027b_o.png) + +#### SSH服务 #### + +默认情况下,OpenSSH服务(sshd)会去尝试捆绑IPv4和IPv6的地址。 + +要强制sshd只捆绑IPv4地址,用文本编辑器打开 /etc/ssh/sshd_config 并添加以下行。inet只适用于IPv4,而inet6是适用于IPv6的。 + + $ sudo vi /etc/ssh/sshd_config + +---------- + + AddressFamily inet + +然后重启sshd服务。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/disable-ipv6-linux.html + +作者:[Dan Nanni][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://www.google.com/intl/en/ipv6/statistics.html diff --git a/published/201505/20150227 Bringing a Bunch of Best Known Linux Network Tools.md b/published/201505/20150227 Bringing a Bunch of Best Known Linux Network Tools.md new file mode 100644 index 0000000000..892ba048d0 --- /dev/null +++ b/published/201505/20150227 Bringing a Bunch of Best Known Linux Network Tools.md @@ -0,0 +1,457 @@ +一大波你可能不知道的 Linux 网络工具 +================================================================================ +如果要在你的系统上监控网络,那么使用命令行工具是非常实用的,并且对于 Linux 用户来说,有着许许多多现成的工具可以使用,如: nethogs, ntopng, nload, iftop, iptraf, bmon, slurm, tcptrack, cbm, netwatch, collectl, trafshow, cacti, etherape, ipband, jnettop, netspeed 以及 speedometer。 + +鉴于世上有着许多的 Linux 专家和开发者,显然还存在其他的网络监控工具,但在这篇教程中,我不打算将它们所有包括在内。 + +上面列出的工具都有着自己的独特之处,但归根结底,它们都做着监控网络流量的工作,只是通过各种不同的方法。例如 nethogs 可以被用来展示每个进程的带宽使用情况,以防你想知道究竟是哪个应用在消耗了你的整个网络资源; iftop 可以被用来展示每个套接字连接的带宽使用情况,而像 nload 这类的工具可以帮助你得到有关整个带宽的信息。 + +### 1) nethogs ### + +nethogs 是一个免费的工具,当要查找哪个 PID (注:即 process identifier,进程 ID) 给你的网络流量带来了麻烦时,它是非常方便的。它按每个进程来分组带宽,而不是像大多数的工具那样按照每个协议或每个子网来划分流量。它功能丰富,同时支持 IPv4 和 IPv6,并且我认为,若你想在你的 Linux 主机上确定哪个程序正消耗着你的全部带宽,它是来做这件事的最佳的程序。 + +一个 Linux 用户可以使用 **nethogs** 来显示每个进程的 TCP 下载和上传速率,可以使用命令 **nethogs eth0** 来监控一个指定的设备,上面的 eth0 是那个你想获取信息的设备的名称,你还可以得到有关正在传输的数据的传输速率信息。 + +对我而言, nethogs 是非常容易使用的,或许是因为我非常喜欢它,以至于我总是在我的 Ubuntu 12.04 LTS 机器中使用它来监控我的网络带宽。 + +例如要想使用混杂模式来嗅探,可以像下面展示的命令那样使用选项 -p: + + nethogs -p wlan0 + +假如你想更多地了解 nethogs 并深入探索它,那么请毫不犹豫地阅读我们做的关于这个网络带宽监控工具的整个教程。 + +(LCTT 译注:关于 nethogs 的更多信息可以参考:https://linux.cn/article-2808-1.html ) + +### 2) nload ### + +nload 是一个控制台应用,可以被用来实时地监控网络流量和带宽使用情况,它还通过提供两个简单易懂的图表来对流量进行可视化。这个绝妙的网络监控工具还可以在监控过程中切换被监控的设备,而这可以通过按左右箭头来完成。 + +![network monitoring tools in linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload8.png) + +正如你在上面的截图中所看到的那样,由 nload 提供的图表是非常容易理解的。nload 提供了有用的信息,也展示了诸如被传输数据的总量和最小/最大网络速率等信息。 + +而更酷的是你只需要直接运行 nload 这个工具就行,这个命令是非常的短小且易记的: + + nload + +我很确信的是:我们关于如何使用 nload 的详细教程将帮助到新的 Linux 用户,甚至可以帮助那些正寻找关于 nload 信息的老手。 + +(LCTT 译注:关于 nload 的更新信息可以参考:https://linux.cn/article-5114-1.html ) + +### 3) slurm ### + +slurm 是另一个 Linux 网络负载监控工具,它以一个不错的 ASCII 图来显示结果,它还支持许多按键用以交互,例如 **c** 用来切换到经典模式, **s** 切换到分图模式, **r** 用来重绘屏幕, **L** 用来启用 TX/RX 灯(注:TX,发送流量;RX,接收流量) ,**m** 用来在经典分图模式和大图模式之间进行切换, **q** 退出 slurm。 + +![linux network load monitoring tools](http://blog.linoxide.com/wp-content/uploads/2013/12/slurm2.png) + +在网络负载监控工具 slurm 中,还有许多其它的按键可用,你可以很容易地使用下面的命令在 man 手册中学习它们。 + + man slurm + +slurm 在 Ubuntu 和 Debian 的官方软件仓库中可以找到,所以使用这些发行版本的用户可以像下面展示的那样,使用 apt-get 安装命令来轻松地下载它: + + sudo apt-get install slurm + +我们已经在一个[教程](http://linoxide.com/ubuntu-how-to/monitor-network-load-slurm-tool/)中对 slurm 的使用做了介绍,不要忘记和其它使用 Linux 的朋友分享这些知识。 + +### 4) iftop ### + +当你想显示连接到网卡上的各个主机的带宽使用情况时,iftop 是一个非常有用的工具。根据 man 手册,**iftop** 在一个指定的接口或在它可以找到的第一个接口(假如没有任何特殊情况,它应该是一个对外的接口)上监听网络流量,并且展示出一个表格来显示当前的一对主机间的带宽使用情况。 + +通过在虚拟终端中使用下面的命令,Ubuntu 和 Debian 用户可以在他们的机器中轻易地安装 iftop: + + sudo apt-get install iftop + +在你的机器上,可以使用下面的命令通过 yum 来安装 iftop: + + yum -y install iftop + +(LCTT 译注:关于 nload 的更多信息请参考:https://linux.cn/article-1843-1.html ) + +### 5) collectl ### + +collectl 可以被用来收集描述当前系统状态的数据,并且它支持如下两种模式: + +- 记录模式 +- 回放模式 + +**记录模式** 允许从一个正在运行的系统中读取数据,然后将这些数据要么显示在终端中,要么写入一个或多个文件或一个套接字中。 + +**回放模式** + +根据 man 手册,在这种模式下,数据从一个或多个由记录模式生成的数据文件中读取。 + +Ubuntu 和 Debian 用户可以在他们的机器上使用他们默认的包管理器来安装 colletcl。下面的命令将为他们做这个工作: + + sudo apt-get install collectl + +还可以使用下面的命令来安装 collectl, 因为对于这些发行版本(注:这里指的是用 yum 作为包管理器的发行版本),在它们官方的软件仓库中也含有 collectl: + + yum install collectl + +(LCTT 译注:关于 collectl 的更多信息请参考: https://linux.cn/article-3154-1.html ) + +### 6) Netstat ### + +Netstat 是一个用来监控**传入和传出的网络数据包统计数据**的接口统计数据命令行工具。它会显示 TCP 连接 (包括上传和下行),路由表,及一系列的网络接口(网卡或者SDN接口)和网络协议统计数据。 + +Ubuntu 和 Debian 用户可以在他们的机器上使用默认的包管理器来安装 netstat。Netsta 软件被包括在 net-tools 软件包中,并可以在 shell 或虚拟终端中运行下面的命令来安装它: + + sudo apt-get install net-tools + +CentOS, Fedora, RHEL 用户可以在他们的机器上使用默认的包管理器来安装 netstat。Netstat 软件被包括在 net-tools 软件包中,并可以在 shell 或虚拟终端中运行下面的命令来安装它: + + yum install net-tools + +运行下面的命令使用 Netstat 来轻松地监控网络数据包统计数据: + + netstat + +![Netstat](http://blog.linoxide.com/wp-content/uploads/2015/02/netstat.png) + +更多的关于 netstat 的信息,我们可以简单地在 shell 或终端中键入 man netstat 来了解: + + man netstat + +![man netstat](http://blog.linoxide.com/wp-content/uploads/2015/02/man-netstat.png) + +(LCTT 译注:关于 netstat 的更多信息请参考:https://linux.cn/article-2434-1.html ) + +### 7) Netload ### + +netload 命令只展示一个关于当前网络荷载和自从程序运行之后传输数据总的字节数目的简要报告,它没有更多的功能。它是 netdiag 软件的一部分。 + +我们可以在 fedora 中使用 yum 来安装 Netload,因为它在 fedora 的默认软件仓库中。但假如你运行的是 CentOS 或 RHEL,则我们需要安装 [rpmforge 软件仓库][1]。 + + # yum install netdiag + +Netload 是默认仓库中 netdiag 的一部分,我们可以轻易地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**: + + $ sudo apt-get install netdiag + +为了运行 netload,我们需要确保选择了一个正在工作的网络接口的名称,如 eth0, eh1, wlan0, mon0等,然后在 shell 或虚拟终端中运行下面的命令: + + $ netload wlan2 + +注意: 请将上面的 wlan2 替换为你想使用的网络接口名称,假如你想通过扫描了解你的网络接口名称,可以在一个虚拟终端或 shell 中运行 `ip link show` 命令。 + +### 8) Nagios ### + +Nagios 是一个领先且功能强大的开源监控系统,它使得网络或系统管理员可以在服务器的各种问题影响到服务器的主要事务之前,发现并解决这些问题。 有了 Nagios 系统,管理员便可以在一个单一的窗口中监控远程的 Linux 、Windows 系统、交换机、路由器和打印机等。它会显示出重要的警告并指出在你的网络或服务器中是否出现某些故障,这可以间接地帮助你在问题发生前就着手执行补救行动。 + +Nagios 有一个 web 界面,其中有一个图形化的活动监视器。通过浏览网页 http://localhost/nagios/ 或 http://localhost/nagios3/ 便可以登录到这个 web 界面。假如你在远程的机器上进行操作,请使用你的 IP 地址来替换 localhost,然后键入用户名和密码,我们便会看到如下图所展示的信息: + +![在 Chromium 浏览器中的 Nagios3](http://blog.linoxide.com/wp-content/uploads/2015/02/nagios3-ubuntu.png) + +(LCTT 译注:关于 Nagios 的更多信息请参考:https://linux.cn/article-2436-1.html ) + +### 9) EtherApe ### + +EtherApe 是一个针对 Unix 的图形化网络监控工具,它仿照了 etherman 软件。它支持链路层、IP 和 TCP 等模式,并支持以太网, FDDI, 令牌环, ISDN, PPP, SLIP 及 WLAN 设备等接口,以及一些封装格式。主机和连接随着流量和协议而改变其尺寸和颜色。它可以过滤要展示的流量,并可从一个文件或运行的网络中读取数据包。 + +在 CentOS、Fedora、RHEL 等 Linux 发行版本中安装 etherape 是一件容易的事,因为在它们的官方软件仓库中就可以找到 etherape。我们可以像下面展示的命令那样使用 yum 包管理器来安装它: + + yum install etherape + +我们也可以使用下面的命令在 Ubuntu、Debian 及它们的衍生发行版本中使用 **apt** 包管理器来安装 EtherApe : + + sudo apt-get install etherape + +在 EtherApe 安装到你的系统之后,我们需要像下面那样以 root 权限来运行 etherape: + + sudo etherape + +然后, **etherape** 的 **图形用户界面** 便会被执行。接着,在菜单上面的 **捕捉** 选项下,我们可以选择 **模式**(IP,链路层,TCP) 和 **接口**。一切设定完毕后,我们需要点击 **开始** 按钮。接着我们便会看到类似下面截图的东西: + +![EtherApe](http://blog.linoxide.com/wp-content/uploads/2015/02/etherape.png) + +### 10) tcpflow ### + +tcpflow 是一个命令行工具,它可以捕捉 TCP 连接(流)的部分传输数据,并以一种方便协议分析或除错的方式来存储数据。它重构了实际的数据流并将每个流存储在不同的文件中,以备日后的分析。它能识别 TCP 序列号并可以正确地重构数据流,不管是在重发还是乱序发送状态下。 + +通过 **apt** 包管理器在 Ubuntu 、Debian 系统中安装 tcpflow 是很容易的,因为默认情况下在官方软件仓库中可以找到它。 + + $ sudo apt-get install tcpflow + +我们可以使用下面的命令通过 **yum** 包管理器在 Fedora 、CentOS 、RHEL 及它们的衍生发行版本中安装 tcpflow: + + # yum install tcpflow + +假如在软件仓库中没有找到它或不能通过 yum 包管理器来安装它,则我们需要像下面展示的那样从 **http://pkgs.repoforge.org/tcpflow/** 上手动安装它: + +假如你运行 64 位的 PC: + + # yum install --nogpgcheck http://pkgs.repoforge.org/tcpflow/tcpflow-0.21-1.2.el6.rf.x86_64.rpm + +假如你运行 32 位的 PC: + + # yum install --nogpgcheck http://pkgs.repoforge.org/tcpflow/tcpflow-0.21-1.2.el6.rf.i686.rpm + +我们可以使用 tcpflow 来捕捉全部或部分 tcp 流量,并以一种简单的方式把它们写到一个可读的文件中。下面的命令就可以完成这个事情,但我们需要在一个空目录中运行下面的命令,因为它将创建诸如 x.x.x.x.y-a.a.a.a.z 格式的文件,运行之后,只需按 Ctrl-C 便可停止这个命令。 + + $ sudo tcpflow -i eth0 port 8000 + +注意:请将上面的 eth0 替换为你想捕捉的网卡接口名称。 + +### 11) IPTraf ### + +[IPTraf][2] 是一个针对 Linux 平台的基于控制台的网络统计应用。它生成一系列的图形,如 TCP 连接的包/字节计数、接口信息和活动指示器、 TCP/UDP 流量故障以及局域网内设备的包/字节计数。 + +在默认的软件仓库中可以找到 IPTraf,所以我们可以使用下面的命令通过 **apt** 包管理器轻松地安装 IPTraf: + + $ sudo apt-get install iptraf + +我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 IPTraf: + + # yum install iptraf + +我们需要以管理员权限来运行 IPTraf,并带有一个有效的网络接口名。这里,我们的网络接口名为 wlan2,所以我们使用 wlan2 来作为参数: + + $ sudo iptraf wlan2 + +![IPTraf](http://blog.linoxide.com/wp-content/uploads/2015/02/iptraf.png) + +开始通常的网络接口统计,键入: + + # iptraf -g + +查看接口 eth0 的详细统计信息,使用: + + # iptraf -d eth0 + +查看接口 eth0 的 TCP 和 UDP 监控信息,使用: + + # iptraf -z eth0 + +查看接口 eth0 的包的大小和数目,使用: + + # iptraf -z eth0 + +注意:请将上面的 eth0 替换为你的接口名称。你可以通过运行`ip link show`命令来检查你的接口。 + +(LCTT 译注:关于 iptraf 的更多详细信息请参考:https://linux.cn/article-5430-1.html ) + +### 12) Speedometer ### + +Speedometer 是一个小巧且简单的工具,它只用来绘出一幅包含有通过某个给定端口的上行、下行流量的好看的图。 + +在默认的软件仓库中可以找到 Speedometer ,所以我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 Speedometer: + + # yum install speedometer + +我们可以使用下面的命令通过 **apt** 包管理器轻松地安装 Speedometer: + + $ sudo apt-get install speedometer + +Speedometer 可以简单地通过在 shell 或虚拟终端中执行下面的命令来运行: + + $ speedometer -r wlan2 -t wlan2 + +![Speedometer](http://blog.linoxide.com/wp-content/uploads/2015/02/Speedometer.png) + +注:请将上面的 wlan2 替换为你想要使用的网络接口名称。 + +### 13) Netwatch ### + +Netwatch 是 netdiag 工具集里的一部分,它也显示当前主机和其他远程主机的连接情况,以及在每个连接中数据传输的速率。 + +我们可以使用 yum 在 fedora 中安装 Netwatch,因为它在 fedora 的默认软件仓库中。但若你运行着 CentOS 或 RHEL , 我们需要安装 [rpmforge 软件仓库][3]。 + + # yum install netwatch + +Netwatch 是 netdiag 的一部分,可以在默认的软件仓库中找到,所以我们可以轻松地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**: + + $ sudo apt-get install netdiag + +为了运行 netwatch, 我们需要在虚拟终端或 shell 中执行下面的命令: + + $ sudo netwatch -e wlan2 -nt + +![Netwatch](http://blog.linoxide.com/wp-content/uploads/2015/02/netwatch.png) + +注意: 请将上面的 wlan2 替换为你想使用的网络接口名称,假如你想通过扫描了解你的网络接口名称,可以在一个虚拟终端或 shell 中运行 `ip link show` 命令。 + +### 14) Trafshow ### + +Trafshow 同 netwatch 和 pktstat 一样,可以报告当前活动的连接里使用的协议和每个连接中数据传输的速率。它可以使用 pcap 类型的过滤器来筛选出特定的连接。 + +我们可以使用 yum 在 fedora 中安装 trafshow ,因为它在 fedora 的默认软件仓库中。但若你正运行着 CentOS 或 RHEL , 我们需要安装 [rpmforge 软件仓库][4]。 + + # yum install trafshow + +Trafshow 在默认仓库中可以找到,所以我们可以轻松地使用下面的命令来利用 **apt** 包管理器安装它: + + $ sudo apt-get install trafshow + +为了使用 trafshow 来执行监控任务,我们需要在虚拟终端或 shell 中执行下面的命令: + + $ sudo trafshow -i wlan2 + +![Trafshow](http://blog.linoxide.com/wp-content/uploads/2015/02/trafshow-all.png) + +为了专门监控 tcp 连接,如下面一样添加上 tcp 参数: + + $ sudo trafshow -i wlan2 tcp + +![Trafshow tcp](http://blog.linoxide.com/wp-content/uploads/2015/02/trafshow-tcp.png) + +注意: 请将上面的 wlan2 替换为你想使用的网络接口名称,假如你想通过扫描了解你的网络接口名称,可以在一个虚拟终端或 shell 中运行 `ip link show` 命令。 + +### 15) Vnstat ### + +与大多数的其他工具相比,Vnstat 有一点不同。实际上它运行着一个后台服务或守护进程,并时刻记录着传输数据的大小。另外,它可以被用来生成一个网络使用历史记录的报告。 + +我们需要开启 EPEL 软件仓库,然后运行 **yum** 包管理器来安装 vnstat。 + + # yum install vnstat + +Vnstat 在默认软件仓库中可以找到,所以我们可以使用下面的命令运行 **apt** 包管理器来安装它: + + $ sudo apt-get install vnstat + +不带有任何选项运行 vnstat 将简单地展示出从该守护进程运行后数据传输的总量。 + + $ vnstat + +![vnstat](http://blog.linoxide.com/wp-content/uploads/2015/02/vnstat.png) + +为了实时地监控带宽使用情况,使用 ‘-l’ 选项(live 模式)。然后它将以一种非常精确的方式来展示上行和下行数据所使用的带宽总量,但不会显示任何有关主机连接或进程的内部细节。 + + $ vnstat -l + +![Vnstat 实时模式](http://blog.linoxide.com/wp-content/uploads/2015/02/vnstat-live.png) + +完成了上面的步骤后,按 Ctrl-C 来停止,这将会得到如下类型的输出: + +![Vnstat 实时结果](http://blog.linoxide.com/wp-content/uploads/2015/02/vnstat-live-result.png) + +### 16) tcptrack ### + +[tcptrack][5] 可以展示 TCP 连接的状态,它在一个给定的网络端口上进行监听。tcptrack 监控它们的状态并展示出排序且不断更新的列表,包括来源/目标地址、带宽使用情况等信息,这与 **top** 命令的输出非常类似 。 + +鉴于 tcptrack 在软件仓库中,我们可以轻松地在 Debian、Ubuntu 系统中从软件仓库使用 **apt** 包管理器来安装 tcptrack。为此,我们需要在 shell 或虚拟终端中执行下面的命令: + + $ sudo apt-get install tcptrack + +我们可以通过 yum 在 fedora 中安装它,因为它在 fedora 的默认软件仓库中。但若你运行着 CentOS 或 RHEL 系统,我们需要安装 [rpmforge 软件仓库][6]。为此,我们需要运行下面的命令: + + # wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm + + # rpm -Uvh rpmforge-release*rpm + + # yum install tcptrack + +注:这里我们下载了 rpmforge-release 的当前最新版本,即 0.5.3-1,你总是可以从 rpmforge 软件仓库中下载其最新版本,并请在上面的命令中替换为你下载的版本。 + +**tcptrack** 需要以 root 权限或超级用户身份来运行。执行 tcptrack 时,我们需要带上要监视的网络接口 TCP 连接状况的接口名称。这里我们的接口名称为 wlan2,所以如下面这样使用: + + sudo tcptrack -i wlan2 + +![tcptrack](http://blog.linoxide.com/wp-content/uploads/2015/02/tcptrack.png) + +假如你想监控特定的端口,则使用: + + # tcptrack -i wlan2 port 80 + +![tcptrack port 80](http://blog.linoxide.com/wp-content/uploads/2015/02/tcptrack-port-80.png) + +请替换上面的 80 为你想要监控的端口号。注意: 请将上面的 wlan2 替换为你想使用的网络接口名称,假如你想通过扫描了解你的网络接口名称,可以在一个虚拟终端或 shell 中运行 `ip link show` 命令。 + +### 17) CBM ### + +CBM ( Color Bandwidth Meter) 可以展示出当前所有网络设备的流量使用情况。这个程序是如此的简单,以至于都可以从它的名称中看出其功能。CBM 的源代码和新版本可以在 [http://www.isotton.com/utils/cbm/][7] 上找到。 + +鉴于 CBM 已经包含在软件仓库中,我们可以简单地使用 **apt** 包管理器从 Debian、Ubuntu 的软件仓库中安装 CBM。为此,我们需要在一个 shell 窗口或虚拟终端中运行下面的命令: + + $ sudo apt-get install cbm + +我们只需使用下面展示的命令来在 shell 窗口或虚拟终端中运行 cbm: + + $ cbm + +![Color Bandwidth Meter](http://blog.linoxide.com/wp-content/uploads/2015/02/cbm.png) + +### 18) bmon ### + +[Bmon][8] ( Bandwidth Monitoring) ,是一个用于调试和实时监控带宽的工具。这个工具能够检索各种输入模块的统计数据。它提供了多种输出方式,包括一个基于 curses 库的界面,轻量级的HTML输出,以及 ASCII 输出格式。 + +bmon 可以在软件仓库中找到,所以我们可以通过使用 apt 包管理器来在 Debian、Ubuntu 中安装它。为此,我们需要在一个 shell 窗口或虚拟终端中运行下面的命令: + + $ sudo apt-get install bmon + +我们可以使用下面的命令来运行 bmon 以监视我们的网络状态: + + $ bmon + +![bmon](http://blog.linoxide.com/wp-content/uploads/2015/02/bmon.png) + +### 19) tcpdump ### + +[TCPDump][9] 是一个用于网络监控和数据获取的工具。它可以为我们节省很多的时间,并可用来调试网络或服务器的相关问题。它可以打印出在某个网络接口上与布尔表达式相匹配的数据包所包含的内容的一个描述。 + +tcpdump 可以在 Debian、Ubuntu 的默认软件仓库中找到,我们可以简单地以 sudo 权限使用 apt 包管理器来安装它。为此,我们需要在一个 shell 窗口或虚拟终端中运行下面的命令: + + $ sudo apt -get install tcpdump + +tcpdump 也可以在 Fedora、CentOS、RHEL 的软件仓库中找到。我们可以像下面一样通过 yum 包管理器来安装它: + + # yum install tcpdump + +tcpdump 需要以 root 权限或超级用户来运行,我们需要带上我们想要监控的 TCP 连接的网络接口名称来执行 tcpdump 。在这里,我们有 wlan2 这个网络接口,所以可以像下面这样使用: + + $ sudo tcpdump -i wlan2 + +![tcpdump](http://blog.linoxide.com/wp-content/uploads/2015/02/tcpdump.png) + +假如你只想监视一个特定的端口,则可以运行下面的命令。下面是一个针对 80 端口(网络服务器)的例子: + + $ sudo tcpdump -i wlan2 'port 80' + +![tcpdump port](http://blog.linoxide.com/wp-content/uploads/2015/02/tcpdump-port.png) + +### 20) ntopng ### + +[ntopng][20] 是 ntop 的下一代版本。它是一个用于展示网络使用情况的网络探头,在一定程度上它与 top 针对进程所做的工作类似。ntopng 基于 libpcap 并且它以可移植的方式被重写,以达到可以在每一个 Unix 平台 、 MacOSX 以及 Win32 上运行的目的。 + +为了在 Debian,Ubuntu 系统上安装 ntopng,首先我们需要安装 **编译 ntopng 所需的依赖软件包**。你可以通过在一个 shell 窗口或一个虚拟终端中运行下面的命令来安装它们: + + $ sudo apt-get install libpcap-dev libglib2.0-dev libgeoip-dev redis-server wget libxml2-dev build-essential checkinstall + +现在,我们需要像下面一样针对我们的系统手动编译 ntopng : + + $ sudo wget http://sourceforge.net/projects/ntop/files/ntopng/ntopng-1.1_6932.tgz/download + $ sudo tar zxfv ntopng-1.1_6932.tgz + $ sudo cd ntopng-1.1_6932 + $ sudo ./configure + $ sudo make + $ sudo make install + +这样,在你的 Debian 或 Ubuntu 系统上应该已经安装上了你编译的 ntopng 。 + +我们已经有了有关 ntopng 的使用方法的[教程](linoxide.com/monitoring-2/ntopng-network-monitoring-tool/),它既可以在命令行也可以在 Web 界面中使用,我们可以前往这些教程来获得有关 ntopng 的知识。 + +### 结论 ### + +在这篇文章中,我们介绍了一些在 Linux 下的网络负载监控工具,这对于系统管理员甚至是新手来说,都是很有帮助的。在这篇文章中介绍的每一个工具都具有其特点,不同的选项等,但最终它们都可以帮助你来监控你的网络流量。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/monitoring-2/network-monitoring-tools-linux/ + +作者:[Bobbin Zachariah][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bobbin/ +[1]:http://pkgs.org/centos-7/repoforge-x86_64/netwatch-1.0c-1.el7.rf.x86_64.rpm.html +[2]:http://iptraf.seul.org/ +[3]:http://pkgs.org/centos-7/repoforge-x86_64/netwatch-1.0c-1.el7.rf.x86_64.rpm.html +[4]:http://pkgs.org/centos-6/epel-x86_64/trafshow-5.2.3-6.el6.x86_64.rpm.html +[5]:http://linux.die.net/man/1/tcptrack +[6]:http://pkgs.org/centos-6/repoforge-x86_64/tcptrack-1.4.0-1.el6.rf.x86_64.rpm.html +[7]:http://www.isotton.com/utils/cbm/ +[8]:https://github.com/tgraf/bmon/ +[9]:http://www.tcpdump.org/ +[10]:http://www.ntop.org/ \ No newline at end of file diff --git a/published/201505/20150227 Enjoy Android Apps on Ubuntu using ARChon Runtime.md b/published/201505/20150227 Enjoy Android Apps on Ubuntu using ARChon Runtime.md new file mode 100644 index 0000000000..4776f5c10d --- /dev/null +++ b/published/201505/20150227 Enjoy Android Apps on Ubuntu using ARChon Runtime.md @@ -0,0 +1,115 @@ +使用 ARChon 运行时环境在 Ubuntu 上运行 Android 应用 +================================================================================ + +在此之前,我们尝试过在多款安卓应用模拟器工具上运行安卓应用,比如Genymotion、VirtualBox和Android SDK等。但是,有了这套全新的Chrome安卓运行环境,就可以在Chrome浏览器中运行安卓应用了。所以,下面是一些步骤来指导你如何使用ARChon运行时环境在Ubuntu上安装安卓应用。 + +谷歌已经公布了[首批支持原生运行在Chrome OS的安卓应用][1],而这个全新的“**安卓运行时环境**”扩展程序使其成为可能。如今,一位名为Vlad Filippov的开发者已经找到了一种把安卓应用移植到桌面端Chrome浏览器的方法。他把chromeos-apk脚本和ARChon安卓运行环境扩展程序两者紧密结合在一起,使得安卓应用可以运行在Windows、Max和Linux系统的桌面端Chrome浏览器中。 + +应用借助这种运行环境时的性能并不是很好。同样,由于它是官方运行环境的非官方二次开发包,而且运行在Google的Chrome OS之外,因此一些如摄像头和喇叭等系统内置设备可能需要通过打补丁获得或者根本不支持。 + +### 安装Chrome ### + +首先,需要在机器上安装Chrome,版本要求是Chrome 37或者更高。可以从[Chrome浏览器的下载页面][2]下载。 + +如果打算安装开发通道版本,按照如下操作。 + +使用这个命令为Google Chrome添加软件源列表: + + $ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - + $ sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' + +![Adding google source list](http://blog.linoxide.com/wp-content/uploads/2015/02/adding-google-source-list.png) + +添加完软件源列表后,使用下列命令更新本地的软件库索引。 + + $ sudo apt-get update + +现在,就可以安装非稳定版的google chrome,即开发版: + + $ sudo apt-get install google-chrome-unstable + +![Installing Google chrome unstable](http://blog.linoxide.com/wp-content/uploads/2015/02/installing-google-chrome-unstable.png) + +### 安装Archon运行时环境 ### + +接下来,需要下载定制版的运行环境安装包,因为官方版本不被Google或Vlad Filippov创建的Chromium安卓运行环境认可。它在很多方面有别于官方版本,主要区别是它可以用于Google浏览器的各个桌面端。下面是需要下载的运行环境安装包,请根据所安装的Ubuntu系统位数选择下列的一种。 + +**32位** Ubntu发行版: + +- [下载 32 位版 Ubuntu 上的 Archron][3] + +**64位** Ubntu发行版: + +- [下载 64 位版 Ubuntu 上的 Archron][4] + +下载好运行环境安装包后,从.zip文件中解压,并将解压得到的目录移动到Home目录。操作命令如下: + + $ wget https://github.com/vladikoff/chromeos-apk/releases/download/v3.0.0/ARChon-v1.1-x86_32.zip + +![Downloading ARChon](http://blog.linoxide.com/wp-content/uploads/2015/02/download-archon.png) + + $ unzip ARChon-v1.1-x86_32.zip ~/ + +接下来是安装运行时环境,首先打开Google Chrome浏览器,在地址栏键入**chrome://extensions**。然后,选中“**开发者模式**”。最后,点击“**载入未打包扩展程序**”,选择刚才放置在**~/Home**下面的文件夹。 + +### 安装 ChromeOS-APK ### + +如果要用到上面提到的那些应用,那么手动转换这些APK无需复杂的操作——只需要安装“[chromeos-apk][5]”命令行JavaScript工具。可以在Node Package Modules(npm)管理器中安装它。为了安装npm和chromeos-apk,在shell或终端中运行下面命令: + + $ sudo apt-get install npm nodejs nodejs-legacy + +如果**操作系统是64位**,需要安装下面这个库,命令如下: + + $ sudo apt-get install lib32stdc++6 + +然后,运行这条命令来安装最新的chromeos-apk: + + $ npm install -g chromeos-apk@latest + +![chromeos apk installation](http://blog.linoxide.com/wp-content/uploads/2015/02/chomeos-apk-installation.png) + +取决于系统配置,可能需要以sudo权限运行后一条命令。 + +现在,我们将找一个应用程序的APK来在Google浏览器上试一试,但务必牢记**并非所有的安卓应用都可以**,有一些可能不稳定或者缺少某些特性。大部分安装即用的通讯类应用都不适用这个环境。 + +### 转换APK ### + +将**安卓APK放到~/Home**下,然后在**终端**执行下列命令进行转换: + + $ chromeos-apk myapp.apk --archon + +如果想以全屏模式运行应用,请替换成这条命令: + + $ chromeos-apk myapp.apk --archon --tablet + +注意:请将myapp.apk替换成待转换的安卓APK应用的文件名。 + +为了方便,也可以使用[Twerk][6]来进行转换,这样可以跳过这一步。 + +### 运行安卓Apk ### + +最后,打开chrome浏览器,然后进入chrome://extensions页面,勾选开发者模式。点击“载入未打包扩展程序”按钮,选择上面脚本刚创建的文件夹。 + +至此,就可以打开Chrome应用启动器运行安卓应用了。 + +### 总结 ### + +万岁!我们已经成功在Chrome浏览器中安装好安卓Apk应用程序了。这篇文章是关于一款由Vlad Filippov开发的、名为Archon的、时下流行的Chrome安卓运行环境。这个运行环境使用户在Chrome浏览器中运行转换过的Apk文件。目前它还不支持通讯类应用,诸如Whatsapp。因此,如果你有任何问题、建议和反馈,请在下面的评论框中写出来。非常感谢!去拥抱Archon吧!:-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/android-apps-ubuntu-archon-runtime/ + +作者:[Arun Pyasi][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://chrome.blogspot.com/2014/09/first-set-of-android-apps-coming-to.html +[2]:https://www.google.com/chrome/browser +[3]:https://github.com/vladikoff/chromeos-apk/releases/download/v3.0.0/ARChon-v1.1-x86_32.zip +[4]:https://github.com/vladikoff/chromeos-apk/releases/download/v3.0.0/ARChon-v1.1-x86_64.zip +[5]:https://github.com/vladikoff/chromeos-apk/blob/master/README.md +[6]:https://chrome.google.com/webstore/detail/twerk/jhdnjmjhmfihbfjdgmnappnoaehnhiaf \ No newline at end of file diff --git a/published/201505/20150227 How To Fix--Failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs.md b/published/201505/20150227 How To Fix--Failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs.md new file mode 100644 index 0000000000..e6ced67ef0 --- /dev/null +++ b/published/201505/20150227 How To Fix--Failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs.md @@ -0,0 +1,72 @@ +如何修复 apt-get update 无法添加新的 CD-ROM 的错误 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/elementary_OS_Freya.jpg) + +这些天我正在体验Elementary OS Freya,在这期间,我遇到了一个非常常见的更新错误:**Failed to fetch cdrom Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs**。完整的错误在运行apt-get update后看上去像这样: + +> W: Failed to fetch cdrom://elementary OS 0.3 _Freya_ – Daily amd64 (20150208)/dists/trusty/main/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs +> +> W: Failed to fetch cdrom://elementary OS 0.3 _Freya_ – Daily amd64 (20150208)/dists/trusty/restricted/binary-amd64/Packages Please use apt-cdrom to make this CD-ROM recognized by APT. apt-get update cannot be used to add new CD-ROMs +> +> E: Some index files failed to download. They have been ignored, or old ones used instead. + +本篇中,我们会了解如何修复这个错误。 + +### 修复apt-get update无法添加新的CD-ROM的错误 ### + +这个错误的原因是cdrom已经被包含在源之中。要修复这个问题,我们需要将它从软件源中移除。 + +在Ubuntu中,找到“软件与更新”: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/Software_Update_Ubuntu.jpeg) + +在Ubuntu Software的第一个标签中,找到cdrom,如果它是勾选的,那么取消勾选。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/CDROM_Error_Update_Software_Sources.jpeg) + +关闭软件源并再次运行更新。现在应该可以用了。 + +### 进一步故障排除: ### + +上面描述的方法已经修复了这个**apt-get update cannot be used to add new CD-ROMs**错误。但是这个方法对我无效,因为cdrom的选项这时是灰色的,因为我使用的live版本。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/CDROM_Update_Error.png) + +现在要修复我们的问题了,我们是要采用命令行路线。打开终端并查看软件源中包含了哪些源: + + cat /etc/apt/sources.list + +我的输出是下面这样: + + deb cdrom:[elementary OS 0.3 _Freya_ – Daily amd64 (20150208)]/ trusty main restricted + deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse + deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse + deb http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse + deb-src http://security.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse + deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse + deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse + +在上面的第一行中。它包含了cdrom。我们需要用‘#’来注释掉这行: + + #deb cdrom:[elementary OS 0.3 _Freya_ – Daily amd64 (20150208)]/ trusty main restricted + +要用下面的命令来: + + sudo gedit /etc/apt/sources.list + +在你编辑完软件源后,再次运行apt-get update。“apt-get update cannot be used to add new CD-ROMs”这个错误应该已经修复了。如果你还遇到其他的问题,看一下这篇收集了大部分[Ubuntu常见更新错误修复][1]的文章。 + +我希望这篇教程对你有用。如果你还有其他的问题和建议,请在下面留言。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/fix-update-errors-ubuntu-1404/ diff --git a/published/201505/20150227 How to Install Lightweight Budgie v8 Desktop in Ubuntu 14.04.md b/published/201505/20150227 How to Install Lightweight Budgie v8 Desktop in Ubuntu 14.04.md new file mode 100644 index 0000000000..ccaff360e5 --- /dev/null +++ b/published/201505/20150227 How to Install Lightweight Budgie v8 Desktop in Ubuntu 14.04.md @@ -0,0 +1,96 @@ +如何在ubuntu14.04上安装轻量级的Budgie桌面(v8) +================================================================================ +Budgie是为Linux发行版定制的旗舰桌面,也是一个定制工程。为思想前卫的用户设计,致力于简单和简洁。它的一个巨大优势是它不是别的项目的fork版本,是从都到尾都独立的。 + +[Budgie桌面][1]与GNOME栈紧密结合,使用先进的技术从而提供一个可选择的桌面体验。出于开源理念,这个桌面之后也能在别的Linux发行版中看到。 + +现在Budgie能够通过面板的设置达到和GNOME2桌面相似的使用体验。 + +### 0.8版的特点 ### + +- 任务栏:支持应用锁定到任务栏 +- 任务栏:使用.desktop文件来配置quicklists菜单 +- 任务栏:使用.desktop文件来配置图标分辨率 +- 任务栏:支持有通知时蓝色闪烁 +- 面板:支持默认深色主体 +- 添加菜单条的小组件 +- 面板:自动隐藏菜单条和工具条(这配置为手动) +- 面板:支持屏幕边缘处阴影 +- 面板:动态支持gnome面板主题 +- 运行对话框:虚拟刷新 +- Budgie菜单: 增加紧凑模式,并默认采用 +- Budgie菜单: 按照使用顺序排列菜单项 +- Budgie菜单: 移除旧的电源选项 +- 编辑器: 在UI中增加所有的菜单选项 +- 支持从GNOME 3.10 升级到3.16 +- wm: 关闭工作区的动画(v8之后) +- wm: 改变壁纸时更好的动画 + +### 重要信息 ### + +- Budgie [0.8版发行版][2]目前只是beta +- 无本地网络管理;可以通过使用ubuntu的小组件解决 +- Budgie 是为Evolve OS设计的,因此这个PPA可能会有bug +- GNOME 主题比Ubuntu本地的主题效果更好 +- Ubuntu的滚动栏将不在工作 +- 如果你想了解的更多可以访问Evolve OS网站 + +### 安装 ### + +现在,我们将在Ubuntu14.04 LTS中安装我们自己的轻量级Budgie桌面。首先,我们要把PPA源添加到我们的Ubuntu中。执行以下命令: + + $ sudo add-apt-repository ppa:evolve-os/ppa + +![添加Budgie的ppa源](http://blog.linoxide.com/wp-content/uploads/2015/01/budgie-desktop-ppa.png) + +添加完ppa之后,运行下面的命令更新本地软件仓库。 + + $ sudo apt-get update + +然后只要执行下面的命令安装 + + $ sudo apt-get install budgie-desktop + +![安装 Budgie Desktop](http://blog.linoxide.com/wp-content/uploads/2015/02/install-budgie-desktop.png) + +**注意** + +这是一个活跃的开发版本,一些主要的功能可能还不是特别的完善,如:没有网络管理器,没有音量控制组件(可以使用键盘控制),无通知系统并且无法将app锁定到任务栏。 + +有一个临时解决方案可以禁用叠加滚动栏:设置另外一个默认主题,然后从终端退出当前会话: + + $ gnome-session-quit + +![退出 Gnome 会话](http://blog.linoxide.com/wp-content/uploads/2015/02/gnome-seesion-quit.png) + +### 登录Budgie会话 ### + +安装完成之后,我们能在登录时选择进入budgie桌面。 + +![选择桌面会话](http://blog.linoxide.com/wp-content/uploads/2015/02/session-select.png) + +### Budgie 桌面环境 ### + +![Budgie 桌面环境](http://blog.linoxide.com/wp-content/uploads/2015/02/budgie-desktop.png) + +### 注销当前用户 ### + + $ budgie-sessioon --logout + +### 结论 ### + +嗨,现在我们已经成功的在 Ubuntu 14.04 LTS 上安装了轻量级 Budgie 桌面环境。Budgie桌面当前正在开发过程中,因此有目前有很多功能的缺失。虽然它是基于Gnome 的 GTK3,但不是完全的复制。Budgie是完全从零开始实现,它的设计是优雅的并且正在不断的完善。如果你有任何问题、评论,请在下面的评论框发表。愿你喜欢 Budgie 桌面 0.8 。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/install-lightweight-budgie-v8-desktop-ubuntu/ + +作者:[Arun Pyasi][a] +译者:[johnhoow](https://github.com/johnhoow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://evolve-os.com/budgie/ +[2]:https://evolve-os.com/2014/11/16/courageous-budgie-v8-released/ diff --git a/published/201505/20150302 How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle.md b/published/201505/20150302 How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle.md new file mode 100644 index 0000000000..ee64fab44a --- /dev/null +++ b/published/201505/20150302 How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle.md @@ -0,0 +1,300 @@ +指南:使用Trickle限制应用程序带宽占用 +================================================================================ + +有没有遇到过系统中的某个应用程序独占了你所有的网络带宽的情形?如果你有过这样的遭遇,那么你就会感受到Trickle这种带宽调整应用的价值。不管你是一个系统管理员还只是普通Linux用户,都需要学习如何控制应用程序的上下行速度,来确保你的网络带宽不会被某个程序霸占。 + +![Install Trickle Bandwidth Limit in Linux](http://www.tecmint.com/wp-content/uploads/2013/11/Bandwidth-limit-trickle.png) + +*在 Linux 上安装 Trickle 带宽限制* + +### 什么是 Trickle? ### + +Trickle是一个网络带宽调整工具,可以让我们管理应用程序的网络上下行速度,使得可以避免其中的某个应用程序霸占了全部或大部分可用的带宽。换句话说,Trickle可以让你基于单个应用程序来控制网络流量速率,而不是仅仅针对与单个用户——这是在客户端网络环境中经典的带宽调整情况。 + +### Trickle 是如何工作的?### + +另外,trickle 可以帮助我们基于应用来定义优先级,所以当对整个系统进行了全局限制设定,高优先级的应用依然会自动地获取更多的带宽。为了实现这个目标,trickle 对 TCP 连接上的套接字的数据发送、接收设置流量限制。我们必须注意到,除了影响传输速率之外,在这个过程中,trickle任何时候都不会以任何方式来改变其中的数据。 + +### Trickle不能做什么? ### + +这么说吧,唯一的限制就是,trickle不支持静态链接的应用程序或者具有SUID或SGID位设置的二进制程序,因为它使用动态链接的方式将其载入到需要调整的进程和其关联的网络套接字之间。 Trickle此时会在这两种软件组件之间扮演代理的角色。 + +由于trickle并不需要超级用户的权限来运行,所以用户可以设置他们自己的流量限制。可能这并不是你想要的,我们会探索如何使用全局设定来限制系统中的所有用户的流量限制。也即是说,此时系统中的每个用户具有管理各自的流量速率,但是无论如何,都会受到系统管理员给他们设置的总体限制。 + +在这篇文章中,我们会描述如何通过trickle在linux平台上管理应用程序使用的网络带宽。为了生成所需的流量,在此会在客户端(CentOS 7 server – dev1: 192.168.0.17)上使用 ncftpput 和 ncftpget, 在服务器(Debian Wheezy 7.5 – dev2: 192.168.0.15)上使用vsftpd 来进行演示。 相同的指令也可以在RedHat,Fedora和Ubuntu等系统使用。 + +#### 前提条件 #### + +1. 对于 RHEL/CentOS 7/6, [开启EPEL仓库][1]。这些用于企业版 Linux 的额外软件包是一个由Fedora项目维护的高质量、开源的软件仓库,而且百分之百与其衍生产品相兼容,如企业版本Linux和CentOS。 在这个仓库中trickle和ncftp两者都是可用的。 + +2. 按照如下方式安装ncftp: + + # yum update && sudo yum install ncftp [基于 RedHat 的系统] + # aptitude update && aptitude install ncftp [基于 Debian 的系统] + +3. 在单独的服务器上设置一个FTP服务器。需要注意的是,尽管FTP天生就不安全,但是仍然被广泛应用在安全性无关紧要的文件上传下载中。 在这篇文章中我们使用它来演示trickle的优点,同时它也会在客户端的标准输出流中显示传输速率。我们将是否在其它时间使用它放在一边讨论。 + + # yum update && yum install vsftpd [基于 RedHat 的系统] + # aptitude update && aptitude install vsftpd [基于 Debian 的系统] + + 现在,在FTP服务器上按照以下方式编辑 /etc/vsftpd/vsftpd.conf 文件。 + + anonymous_enable=NO + local_enable=YES + chroot_local_user=YES + allow_writeable_chroot=YES + + 在此之后,确保在你的当前会话中启动了vsftpd,并在之后的启动中让其自动启动。 + + # systemctl start vsftpd [基于 systemd 的系统] + # systemctl enable vsftpd + # service vsftpd start [基于 init 的系统] + # chkconfig vsftpd on + +4. 如果你选择在一个使用 SSH 密钥进行远程访问的 CentOS/RHEL 7中搭建FTP服务器,你需要一个密码受保护的用户账户,它能访问**root目录之外**的某个目录,并有能在其中上传和下载文件的权限。 + + 你可以通过在你的浏览器中输入以下的URL来浏览你的家目录。一个登录窗口会弹出来提示你输入FTP服务器中的有效的用户名和密码。 + + ftp://192.168.0.15 + + 如果验证成功,你就会看到你的家目录中的内容。该教程的稍后部分中,你将可以刷新页面来显示在你之前上传过的文件。 + + ![FTP Directory Tree](http://www.tecmint.com/wp-content/uploads/2013/11/FTP-Directory-Tree.png) + + *FTP 目录树* + +### 如何在Linux中安装 trickle ### + +1. 通过yum或aptitude来安装trickle. + + 为了确保能够成功安装,最好在安装工具之前,保证当前的安装包是最新的版本。 + + + # yum -y update && yum install trickle [基于 RedHat 的系统] + # aptitude -y update && aptitude install trickle [基于 Debian 的系统] + +2. 确认trickle是否对特定的二进制包有用。 + + 之前我们解释过,trickle只对使用动态或共享的库的二进制包有用。为了确认我们是否可以对某个特定的应用使用trickle,我们可以使用著名的ldd(列出动态依赖)工具。 特别地,我们会查看任何给定程序的动态依赖中其当前使用的glibc,因为其准确地定义了通过套接字通讯所使用的系统调用。 + + 对一个给定的二进制包执行以下命令来查看是否能对其使用trickle进行带宽调整: + + # ldd $(which [binary]) | grep libc.so + + 例如, + + # ldd $(which ncftp) | grep libc.so + + 其输出是: + + # libc.so.6 => /lib64/libc.so.6 (0x00007efff2e6c000) + + 输出中的括号中的字符可能在不同的系统平台有所不同,甚至相同的命令在不同的时候运行也会不同,因为其代表包加载到物理内存中的地址。 + + 如果上面的命令没有返回任何的结果,就说明这个二进制包没有使用libc包,因此trickle对其不能起到带宽调整的作用。 + +### 学习如何使用Trickle### + +最基本的用法就是使用其独立模式,通过这种方式,trickle用来显式地定义给定应用程序的上传下载速率。如前所述,为了简单,我们会使用相同的应用来进行上传下载测试。 + +#### 在独立模式下运行trickle#### + +我们会比较在有无trickle的情况下的上传下载速率, ‘-d’选项指示下载速率(KB/s单位),而'-u'选项指示相同单位的上传速率。另外我们会使用到‘-s’选项来指定trickle应该以独立模式运行。 + +以独立模式运行trickle的基本语法如下: + + # trickle -s -d [下载速率,KB/s] -u [上传速率,KB/s] + +为了能够让你自己运行以下样例,确保你在自己的客户端安装了trickle和ncftp(我的是192.168.0.17)。 + +**样例1:在有无trickle的情况下上传一个2.8 MB的PDF文件。** + +我们使用一个自由发布的[LInux基础知识PDF文件][2]来进行下面的测试。 + +你可以首先使用下面的命令将这个文件下载到你当前的工作目录中: + + # wget http://linux-training.be/files/books/LinuxFun.pdf + +下面是在没有trickle的情况下将一个文件上传到我们的FTP服务器的语法: + + # ncftpput -u username -p password 192.168.0.15 /remote_directory local-filename + +其中的 /remote_directory 是相对于该用户的家目录的上传路径,而local-filename是一个你当前工作目录中的文件。 + +特别的是,在没有trickle的情形下,我们可以得到上传峰值速率52.02MB/s(请注意,这个不是真正的平均上传速率,而是峰值开始的瞬时值),而且这个文件几乎在瞬间就完成了上传。 + + # ncftpput -u username -p password 192.168.0.15 /testdir LinuxFun.pdf + +输出: + + LinuxFun.pdf: 2.79 MB 52.02 MB/s + +在使用trickle的情况下,我们会限制上传速率在5KB/s。在第二次上传文件之前,我们需要在目标目录中删除这个文件,否则ncftp就会通知我们在目标目录中已经存在了与上传文件相同的文件,从而不会执行文件的传输: + + # rm /absolute/path/to/destination/directory/LinuxFun.pdf + +然后: + + # trickle -s -u 5 ncftpput -u username -p password 111.111.111.111 /testdir LinuxFun.pdf + +输出: + + LinuxFun.pdf: 2.79 MB 4.94 kB/s + +在上面的样例中,我们看到平均的上传速率下降到了5KB/s。 + +**样例2:在有无trickle的情况下下载相同的2.8MB的PDF文件** + +首先,记得从原来的源目录中删除这个PDF: + + # rm /absolute/path/to/source/directory/LinuxFun.pdf + +请注意,下面的样例中将远程的文件下载到客户端机器的当前目录下,这是由FTP服务器的IP地址后面的“.”决定的。 + +没有trickle的情况下: + + # ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf + +输出: + + LinuxFun.pdf: 2.79 MB 260.53 MB/s + +在有trickle的情况下,限制下载速率在20KB/s: + + # trickle -s -d 30 ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf + +输出: + + LinuxFun.pdf: 2.79 MB 17.76 kB/s + +### 在监督[非托管]模式下运行Trickle ### + +trickle也可以按照/etc/trickled.conf文件中定义的一系列参数运行在非托管模式下。 这个文件定义了守护线程 trickled的行为以及如何管理trickle。 + +另外,如果你想要全局设置被所有的应用程序使用的话,我们就会需要使用trickle命令。 这个命令运行守护进程,并允许我们通过trickle定义所有应用程序共享的上传下载限制,不需要我们每次来进行指定。 + +例如,运行: + + # trickled -d 50 -u 10 + +会导致任何通过trickle运行的应用程序的上传下载速率分别限制在30kb/s和10kb/s。 + +请注意,你可以在任何时间都能确认守护线程trickled是否正在运行以及其运行参数: + + # ps -ef | grep trickled | grep -v grep + +输出: + + root 16475 1 0 Dec24 ? 00:00:04 trickled -d 50 -u 10 + +**样例3:在使用/不使用trickle的情形下上传一个 19MB 的mp4文件到我们的FTP服务器。** + +在这个样例中,我们会使用“He is the gift”的自由分发视频,可以通过这个[链接][3]下载。 + +我们将会在开始时通过以下的命令将这个文件下载到你的当前工作目录中: + + # wget http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4 + +首先,我们会使用之前列出的命令来开启守护进程trickled: + + # trickled -d 30 -u 10 + +在不使用trickle时: + + # ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4 + +输出: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 36.31 MB/s + +在使用trickle时: + + # trickle ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4 + +输出: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 9.51 kB/s + +我们可以看到上面的输出,上传的速率下降到了约 10KB/s。 + +** 样例4:在使用/不使用trickle的情形下下载这个相同的视频 ** + +与样例2一样,我们会将该文件下载到当前工作目录中。 + +在没有trickle时: + + # ncftpget -u username -p password 192.168.0.15 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4 + +输出: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 108.34 MB/s + +有trickle的时: + + # trickle ncftpget -u username -p password 111.111.111.111 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4 + +输出: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 29.28 kB/s + +上面的结果与我们之前设置的下载限速相对应(30KB/s)。 + +**注意:** 一旦守护进程开启之后,就没有必要使用trickle来为每个应用程序来单独设置限制。 + +如前所述,人们可以进一步地通过trickled.conf来客制化trickle的带宽速率调整,该文件的一个典型的分段有以下部分组成: + + [service] + Priority = + Time-Smoothing = + Length-Smoothing = + +其中, + +- [service] 用来指示我们想要对其进行带宽使用调整的应用程序名称 +- Priority 用来让我们为某个服务制定一个相对于其他服务高的优先级,这样就不允许守护进程管理中的一个单独的应用程序来占用所有的带宽。越小的数字代表更高的优先级。 +- Time-Smoothing [以秒计]: 定义了trickled让各个应用程序传输或接收数据的时间间隔。小的间隔值(0.1-1秒)对于交互式应用程序是理想的,因为这样会具有一个更加平滑的会话体验,而一个相对较大的时间间隔值(1-10秒)对于需要批量传输应用程序就会显得更好。如果没有指定该值,默认是5秒。 +- Length-smoothing [KB 单位]: 该想法与Time-Smoothing如出一辙,但是是基于I/O操作而言。如果没有指定值,会使用默认的10KB。 + +上述平滑值(Time-Smoothing、 Length-smoothing)的改变会被翻译为将指定的服务的使用一个间隔值而不是一个固定值。不幸的是,没有一个特定的公式来计算间隔值的上下限,主要依赖于特定的应用场景。 + +下面是一个在CentOS 7 客户端中的trickled.conf 样例文件(192.168.0.17): + + [ssh] + Priority = 1 + Time-Smoothing = 0.1 + Length-Smoothing = 2 + + [ftp] + Priority = 2 + Time-Smoothing = 1 + Length-Smoothing = 3 + +使用该设置,trickled会为SSH赋予比FTP较高的传输优先级。值得注意的是,一个交互进程,例如SSH,使用了一个较小的时间间隔值,然而一个处理批量数据传输的服务如FTP,则使用一个较大的时间间隔来控制之前的样例中的上传下载速率,尽管不是百分百的由trickled指定的值,但是也已经非常接近了。 + +### 总结 ### + +在该文章中,我们探索了使用trickle在基于Fedora发行版和Debian衍生版平台上来限制应用程序的带宽使用。也包含了其他的可能用法,但是不对以下情形进行限制: + +- 限制系统工具的下载速度,例如[wget][4],或 BT客户端. +- 限制你的系统的包管理工具[`yum`][5]更新的速度 (如果是基于Debian系统的话,其包管理工具为[`aptitude`][6])。 +- 如果你的服务器是在一个代理或防火墙后面(或者其本身即是代理或防火墙的话),你可以使用trickle来同时设定下载和上传速率,或者客户端或外部通讯的速率。 + +欢迎提问或留言。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[theo-l](https://github.com/theo-l) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://linux.cn/article-2324-1.html +[2]:http://linux-training.be/files/books/LinuxFun.pdf +[3]:http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4 +[4]:http://www.tecmint.com/10-wget-command-examples-in-linux/ +[5]:http://www.tecmint.com/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[6]:http://www.tecmint.com/dpkg-command-examples/ diff --git a/published/201505/20150302 How to Manage KVM Virtual Environment using Commandline Tools in Linux.md b/published/201505/20150302 How to Manage KVM Virtual Environment using Commandline Tools in Linux.md new file mode 100644 index 0000000000..7c133f90af --- /dev/null +++ b/published/201505/20150302 How to Manage KVM Virtual Environment using Commandline Tools in Linux.md @@ -0,0 +1,165 @@ +如何在Linux中用命令行工具管理KVM虚拟环境 +================================================================================ +在我们[KVM系列专题][1]的第四部分,我们将会一起讨论下在命令行界面下来管理KVM环境。我们分别用‘virt-install’和virsh命令行工具来创建并配置虚拟机和存储池,用qemu-img命令行工具来创建并管理磁盘映像。 + +![KVM Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/KVM-Management-in-Linux.jpg) + +*Linux系统的KVM管理* + +在这篇文章里没有什么新的概念,我们只是用命令行工具重复之前所做过的事情,也没有什么前提条件,都是相同的过程,之前的文章我们都讨论过。 + +### 第一步: 配置存储池 ### + +Virsh命令行工具是一款管理virsh客户域的用户界面。virsh程序能在命令行中运行所给的命令以及它的参数。 + +本节中,我们要用它给我们的KVM环境创建存储池。想知道关于这个工具的更多信息,用以下这条命令。 + + # man virsh + +**1. 用virsh带pool-define-as的命令来定义新的存储池,你需要指定名字、类型和类型参数。** + +本例中,我们将名字取为Spool1,类型为目录。默认情况下你可以提供五个参数给该类型: + +- source-host +- source-path +- source-dev +- source-name +- target + +对于目录类型,我们需要用最后一个参数“target”来指定存储池的路径,其它参数项我们可以用“-”来填充。 + + # virsh pool-define-as Spool1 dir - - - - "/mnt/personal-data/SPool1/" + +![Create New Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Create-New-Storage-Pool.png) + +*创建新存储池* + +**2. 查看环境中我们所有的存储池,用以下命令。** + + # virsh pool-list --all + +![List All Storage Pools](http://www.tecmint.com/wp-content/uploads/2015/02/List-All-Storage-Pools.png) + +*列出所有存储池* + +**3. 现在我们来构造存储池了,用以下命令来构造我们刚才定义的存储池。** + + # virsh pool-build Spool1 + +![Build Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Build-Storage-Pool.png) + +*构造存储池* + +**4. 用带pool-start参数的virsh命令来激活并启动我们刚才创建并构造完成的存储池。** + + # virsh pool-start Spool1 + +![Active Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Active-Storage-Pool.png) + +*激活存储池* + +**5. 查看环境中存储池的状态,用以下命令。** + + # virsh pool-list --all + +![Check Storage Pool Status](http://www.tecmint.com/wp-content/uploads/2015/02/Check-Storage-Pool-Status.png) + +*查看存储池状态* + +你会发现Spool1的状态变成了已激活。 + +**6. 对Spool1进行配置,让它每次都能被libvirtd服务自启动。** + + # virsh pool-autostart Spool1 + +![Configure KVM Storage Pool](http://www.tecmint.com/wp-content/uploads/2015/02/Configure-Storage-Pool.png) + +*配置KVM存储池* + +**7. 最后来看看我们新的存储池的信息吧。** + + # virsh pool-info Spool1 + +![Check KVM Storage Pool Information](http://www.tecmint.com/wp-content/uploads/2015/02/Check-Storage-Pool-Information.png) + +*查看KVM存储池信息* + +恭喜你,Spool1已经准备好待命,接下来我们试着创建存储卷来使用它。 + +### 第二步: 配置存储卷/磁盘映像 ### + +现在轮到磁盘映像了,用qemu-img命令在Spool1中创建一个新磁盘映像。获取更多细节信息,可以查看man手册。 + + # man qemu-img + +**8. 我们应该在qemu-img命令之后指定“create, check,…”等等操作、磁盘映像格式、你想要创建的磁盘映像的路径和大小。** + + # qemu-img create -f raw /mnt/personal-data/SPool1/SVol1.img 10G + +![Create Storage Volume](http://www.tecmint.com/wp-content/uploads/2015/02/Create-Storage-Volumes.png) + +*创建存储卷* + +**9. 通过使用带info的qemu-img命令,你可以获取到你的新磁盘映像的一些信息。** + +![Check Storage Volume Information](http://www.tecmint.com/wp-content/uploads/2015/02/Check-Storage-Volume-Information.png) + +*查看存储卷信息* + +**警告**: 不要用qemu-img命令来修改被运行中的虚拟机或任何其它进程所正在使用的映像,那样映像会被破坏。 + +现在是时候来创建虚拟机了。 + +### 第三步: 创建虚拟机 ### + +**10. 现在到最后一个环节了,在最后一步中,我们将用virt-install命令来创建虚拟机。virt-install是一个用来创建新的KVM虚拟机命令行工具,它使用“libvirt”管理程序库。想获取更多细节,同样可以查看man手册。** + + # man virt-install + +要创建新的KVM虚拟机,你需要用到带以下所有信息的命令。 + +- Name: 虚拟机的名字。 +- Disk Location: 磁盘映像的位置。 +- Graphics : 怎样连接VM,通常是SPICE。 +- vcpu : 虚拟CPU的数量。 +- ram : 以兆字节计算的已分配内存大小。 +- Location : 指定安装源路径。 +- Network : 指定虚拟网络,通常是virbr0网桥。 + + # virt-install --name=rhel7 --disk path=/mnt/personal-data/SPool1/SVol1.img --graphics spice --vcpu=1 --ram=1024 --location=/run/media/dos/9e6f605a-f502-4e98-826e-e6376caea288/rhel-server-7.0-x86_64-dvd.iso --network bridge=virbr0 + +![Create New Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Create-New-Virtual-Machines.png) + +*创建新的虚拟机* + +**11. 你会看到弹出一个virt-vierwer窗口,像是在通过它在与虚拟机通信。** + +![Booting Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Booting-Virtual-Machine.jpeg) + +*虚拟机启动程式* + +![Installation of Virtual Machine](http://www.tecmint.com/wp-content/uploads/2015/02/Installation-of-Virtual-Machine.jpeg) + +*虚拟机安装过程* + +### 结论 ### + +以上就是我们KVM教程的最后一部分了,当然我们还没有完全覆盖到全部,我们只是打了个擦边球,所以现在该轮到你来好好地利用这些丰富的资源来做自己想做的事了。 + +- [KVM Getting Started Guide][2] +- [KVM Virtualization Deployment and Administration Guide][3] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/kvm-management-tools-to-manage-virtual-machines/ + +作者:[Mohammad Dosoukey][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/dos2009/ +[1]:http://www.tecmint.com/install-and-configure-kvm-in-linux/ +[2]:https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Getting_Started_Guide/index.html +[3]:https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/index.html diff --git a/published/201505/20150304 Linux Basics--How To Fix 'E-- var cache apt archives subprocess new pre-removal script returned error exit status 1' In Ubuntu.md b/published/201505/20150304 Linux Basics--How To Fix 'E-- var cache apt archives subprocess new pre-removal script returned error exit status 1' In Ubuntu.md new file mode 100644 index 0000000000..09cb220cd2 --- /dev/null +++ b/published/201505/20150304 Linux Basics--How To Fix 'E-- var cache apt archives subprocess new pre-removal script returned error exit status 1' In Ubuntu.md @@ -0,0 +1,45 @@ +如何修复 Ubuntu 上“...script returned error exit status 1”的错误 +================================================================================ +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2014/04/ubuntu-790x558.png) + +今天,我在更新VirtualBox新版本的时候遇到了一个问题。 + +> E: /var/cache/apt/archives/ subprocess new pre-removal script returned error exit status 1 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/Update-Manager_0011.png) + +### 解决: ### + +我google了一下并找到了方法。下面是我解决的方法。 + + sudo apt-get clean + sudo apt-get update && sudo apt-get upgrade + +这样几乎可以修复这个问题了。 + +如果你仍然有问题,那就试试下面的命令: + + sudo dpkg --configure -a + sudo apt-get -f install + +或者你可以按照下面的方法从[Oracle VirtualBox][1]官网下载最新版本并安装。 + + sudo apt-get update + sudo dpkg -i virtualbox-4.3_4.3.24-98716~Ubuntu~raring_amd64.deb + sudo apt-get -f install + sudo apt-get autoclean && sudo apt-get autoremove + +干杯! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/linux-basics-how-to-fix-e-varcacheaptarchives-subprocess-new-pre-removal-script-returned-error-exit-status-1-in-ubuntu/ + +作者:[SK][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.unixmen.com/author/sk/ +[1]:https://www.virtualbox.org/wiki/Downloads diff --git a/published/201505/20150304 Monitoring Your Network And Servers With Observium.md b/published/201505/20150304 Monitoring Your Network And Servers With Observium.md new file mode 100644 index 0000000000..14fc41b746 --- /dev/null +++ b/published/201505/20150304 Monitoring Your Network And Servers With Observium.md @@ -0,0 +1,174 @@ +使用Observium来监控你的网络和服务器 +================================================================================ +### 简介### + +在监控你的服务器、交换机或者设备时遇到过问题吗?**Observium** 可以满足你的需求。这是一个免费的监控系统,它可以帮助你远程监控你的服务器。它是一个由PHP编写的基于自动发现 SNMP 的网络监控平台,支持非常广泛的网络硬件和操作系统,包括 Cisco、Windows、Linux、HP、NetApp 等等。在此我会给出在 Ubuntu 12.04 上一步步地设置一个 **Observium** 服务器的介绍。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/Capture1.png) + +目前有两种不同的 **observium** 版本。 + +- Observium 社区版本是一个在 QPL 开源许可证下的免费工具,这个版本是对于较小部署的最好解决方案。该版本每6个月进行一次安全性更新。 +- 第2个版本是 Observium 专业版,该版本采用基于 SVN 的发布机制。 会得到每日安全性更新。 该工具适用于服务提供商和企业级部署。 + +更多信息可以通过其[官网][1]获得。 + +### 系统需求### + +要安装 **Observium**, 需要具有一个最新安装的服务器。**Observium** 是在 Ubuntu LTS 和 Debian 系统上进行开发的,所以推荐在 Ubuntu 或 Debian 上安装 **Observium**,因为可能在别的平台上会有一些小问题。 + +该文章会引导你在 Ubuntu 12.04 上安装 **Observium**。对于小型的 **Observium** 安装,建议使用 256MB 内存和双核处理器的配置。 + +### 安装需求 ### + +在安装 **Observuim** 之前,你需要确认安装所有的依赖关系包。 + +首先,使用下面的命令更新你的服务器: + + sudo apt-get update + +然后你需要安装下列运行 Observuim 所需的全部软件包。 + +Observium 需要使用下面所列出的软件才能正确的运行: + +- LAMP 服务器 +- fping +- Net-SNMP 5.4+ +- RRDtool 1.3+ +- Graphviz + +对于可选特性的要求: + +- Ipmitool - 仅在当你想要获取服务器上的 IPMI(Intelligent Platform Management Interface 智能平台管理接口)基板控制器时。 +- Libvirt-bin - 仅在当你想要使用 libvirt 进行远程 VM 主机监控时。 + + sudo apt-get install libapache2-mod-php5 php5-cli php5-mysql php5-gd php5-mcrypt php5-json php-pear snmp fping mysql-server mysql-client python-mysqldb rrdtool subversion whois mtr-tiny ipmitool graphviz imagemagick libvirt ipmitool + +### 为 Observium 创建 MySQL 数据库及其用户。 + +现在你需要登录到 MySQL 中并为 **Observium** 创建数据库: + + mysql -u root -p + +在用户验证成功之后,你需要按照下面的命令创建该数据库。 + + CREATE DATABASE observium; + +数据库名为 **Observium**,稍后你会需要这个信息。 + +现在你需要创建数据库管理员用户。 + + CREATE USER observiumadmin@localhost IDENTIFIED BY 'observiumpassword'; + +接下来,你需要给该管理员用户相应的权限来管理创建的数据库。 + + GRANT ALL PRIVILEGES ON observium.* TO observiumadmin@localhost; + +你需要将权限信息写回到磁盘中来激活新的 MySQL 用户: + + FLUSH PRIVILEGES; + exit + +### 下载并安装 Observium### + +现在我们的系统已经准备好了, 可以开始Observium的安装了。 + +第一步,创建 Observium 将要使用的文件目录: + + mkdir -p /opt/observium && cd /opt + +按本教程的目的,我们将会使用 Observium 的社区/开源版本。使用下面的命令下载并解压: + + wget http://www.observium.org/observium-community-latest.tar.gz + tar zxvf observium-community-latest.tar.gz + +现在进入到 Observium 目录。 + + cd observium + +将默认的配置文件 '**config.php.default**' 复制到 '**config.php**',并将数据库配置选项填充到配置文件中: + + cp config.php.default config.php + nano config.php + +---------- + + / Database config + $config['db_host'] = 'localhost'; + $config['db_user'] = 'observiumadmin'; + $config['db_pass'] = 'observiumpassword'; + $config['db_name'] = 'observium'; + +现在为 MySQL 数据库设置默认的数据库模式: + + php includes/update/update.php + +现在你需要创建一个文件目录来存储 rrd 文件,并修改其权限以便让 apache 能将写入到文件中。 + + mkdir rrd + chown apache:apache rrd + +为了在出现问题时排错,你需要创建日志文件。 + + mkdir -p /var/log/observium + chown apache:apache /var/log/observium + +现在你需要为 Observium 创建虚拟主机配置。 + + + DocumentRoot /opt/observium/html/ + ServerName observium.domain.com + CustomLog /var/log/observium/access_log combined + ErrorLog /var/log/observium/error_log + + AllowOverride All + Options FollowSymLinks MultiViews + + + +下一步你需要让你的 Apache 服务器的 rewrite (重写)功能生效。 + +为了让 'mod_rewrite' 生效,输入以下命令: + + sudo a2enmod rewrite + +该模块在下一次 Apache 服务重启之后就会生效。 + + sudo service apache2 restart + +###配置 Observium### + +在登入 Web 界面之前,你需要为 Observium 创建一个管理员账户(级别10)。 + + # cd /opt/observium + # ./adduser.php admin adminpassword 10 + User admin added successfully. + +下一步为发现和探寻任务设置一个 cron 任务,创建一个新的文件 ‘**/etc/cron.d/observium**’ 并在其中添加以下的内容。 + + 33 */6 * * * root /opt/observium/discovery.php -h all >> /dev/null 2>&1 + */5 * * * * root /opt/observium/discovery.php -h new >> /dev/null 2>&1 + */5 * * * * root /opt/observium/poller-wrapper.py 1 >> /dev/null 2>&1 + +重载 cron 进程来增加新的任务。 + + # /etc/init.d/cron reload + +好啦,你已经完成了 Observium 服务器的安装拉! 使用你的浏览器登录到 **http://\**,然后上路吧。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/Capture.png) + +尽情享受吧! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/monitoring-network-servers-observium/ + +作者:[anismaj][a] +译者:[theo-l](http://github.com/theo-l) +校对:[wxy](http://github.com/wxy) + +本文由 [LCTT](http://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/anis/ +[1]:http://www.observium.org/ diff --git a/published/201505/20150304 Share Folders On Local Network Between Ubuntu And Windows.md b/published/201505/20150304 Share Folders On Local Network Between Ubuntu And Windows.md new file mode 100644 index 0000000000..a2e5e59286 --- /dev/null +++ b/published/201505/20150304 Share Folders On Local Network Between Ubuntu And Windows.md @@ -0,0 +1,175 @@ +如何在局域网中将Ubuntu文件夹共享给Windows +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_windows.jpeg) + +本文全面详细地向你描述了**在Ubuntu中如何实现局域网内的文件夹共享**。 + +你的家中是不是有多台电脑?当你需要从一台Ubuntu电脑向另一台电脑传输数据时,是不是必须用到U盘或SD卡?你是否也觉得这个方法很烦人?我想肯定是。本文的目的就是使你在局域网内快速方便地传输文件、文档和其它较大的数据,以节省你的宝贵时间。只需一次设置,然后轻点鼠标,你就可以自由地**在Ubuntu和Windows之间共享文件**,当然这对其它Linux系统同样使用。不要担心,这很容易操作,不会花费太多时间。 + +除此之外,尽管本文是在Ubuntu上进行实践,但这个教程在其它Linux系统上同样有用。 + +#### 在Ubuntu上实现局域网共享文件夹 #### + +如果你的系统是Ubuntu 14.04、14.10或12.04,有两个方法可以使你通过局域网在搭载Windows或其他Linux的电脑上共享本地文件。 + +- 对局域网中的每个用户提供无密码共享 +- 仅限特定访问,提供文件夹密码保护 + +这篇文章包括两种方法,你可以选择你想用的那种。 + +### 1. 局域网无密码共享文件夹 ### + +#### 步骤一:#### + +为了在Ubuntu上实现局域网共享文件夹,右键点击打算共享的文件夹,并选择“Local Network Share(本地网络共享)”: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Share_Folder_Ubuntu.jpeg) + +**可能有用的故障解决方案**:如果在右键菜单中看不到“Local Network Share”的选项,那就新建一个终端,使用下面的命令去安装nautlius-share插件: + + sudo apt-get install nautilus-share + +然后重启Nautilus。可以选择注销再登录,或者使用这个命令: + + nautilus -q + +#### 步骤二:#### + +一旦点击“Local Network Share”,就会出现共享文件夹的选项。只需选中“Share this folder(共享该文件夹)”这一项: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_1.jpeg) + +**可能的故障解决方案**:如果提示共享服务还未安装,就像下图所示,那就点击安装服务,按照提示操作。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_Folder_Ubuntu_2.jpeg) + +#### 步骤三:#### + +当选中“Share this folder”的选项,就会看到按钮“Create Share(创建共享)”变得可以点击了。你也可以“Allow others to create and delete fies in this folder(允许其他用户在共享文件夹中编辑文件)”。选项“Guest access(允许访客访问)”也是如此。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Share_folder_Ubuntu_3.png) + +你会看到文件夹图标已经显示为共享的。如果要停止共享文件夹,只需取消“Share this floder”这个选项。 + +这个方法就是这么简单,使得局域网中的任何人都可以访问共享文件夹中的文件。在正常情况下,你会选择这种方式。因为,家用局域网中的电脑通常都是可信电脑。但情况也不总是这样。如果你只是想特定的用户才能访问怎么办?这个时候就需要Samba服务器了。我们在本文的第二部分讨论这种方法。 + +### 2. 在Ubuntu上使用密码保护实现局域网共享文件夹### + +为了达到这个目的,首先需要配置Samba服务器。事实上,在这篇教程的前一部分我们已经用到了Samba,只是我们没有刻意强调。在介绍如何在Ubuntu上搭建Samba服务器实现局域网共享的方法之前,先快速预览一下[Samba][1]到底是什么。 + +#### Samba是什么? #### + +Samba是一个允许用户通过网络共享文件、文档和打印机的软件包,无论是在Linux、Windows,还是Mac上。它适用于所有的主流平台,可以在所有支持系统上流畅运行。下面是维基百科的介绍: + +> Samba是一款重新实现SMB/CIFS网络协议的自由软件,最初由安德鲁·垂鸠开发。在第三版中,Smaba不仅支持通过不同的Windows客户端访问及分享SMB的文件夹及打印机,还可以集成到Windows Server域,作为主域控制器(PDC)或者域成员。它也可以作为活动目录域的一部分。 + +#### 在Ubuntu上安装Samba服务器 #### + +你可以很方便地在Ubuntu电脑上安装Samba。安装前,请先更新系统以便安装任何可用的更新。 + + sudo apt-get update && apt-get upgrade + +然后按照这条命令安装samba和少量所需的软件包: + + sudo apt-get install samba samba-common system-config-samba python-glade2 gksu + +一旦安装完成Samba服务器,就可以从图形界面配置Samba来分享文件。 + +#### 在Ubuntu上配置Samba服务器 #### + +从dash中打开Samba配置工具: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Setup-Samba.png) + +进入到**Preference->Server Settings**。尽管默认已经设置好,可能就是你需要的。但在某些情况下你可能需要做一些改动。 + +在Server Setting中可以看到两个选项卡,‘Basic’和‘Security’。在Basic选项卡下的选项含义如下: + +- 工作组 - 用户要连接的电脑所在工作组的名字。比如,如果你想连接到一台Windows电脑,你就要输入Windows电脑的工作组名字。在Windows的Samba服务器设置中,已经默认设置好统一的工作组名字。但如果你有不同的工作组名字,就在这个字段中输入自定义的工作组名字。(在Windows 7中获取工作组名字,右击计算机图标,进到属性,就能看到Windows工作组名字。) +- 描述 - 其他用户看到的你的电脑名字。不要使用空格或不适用于网络的字符。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-server-settings.png) + +设置samba服务器允许‘Guests’可用是不明智的,所以没必要修改安全设置,保持原样即可。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Samba-Security-Settings-compressed.jpg) + +这就搞定了!你已经搭建好Samba服务器,距离实现网络共享第一个文件夹的目标不远了! + +#### 为网络文件共享创建一个系统用户 #### + +现在我们需要为网络共享文件创建一个系统用户。下面是非常简单的步骤: + +- 在Systems Settings下点击**User Accounts**。 +- 点击**unlock**使其可用,以及+(**加号**)图标。 +- 点击+(加号)图标,创建一个新的系统用户。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/create-system-user1.jpg) + +如上图所示,需要输入‘Full name’。当你输入‘Full name’时,Username会自动填充为Full name。因为创建这个用户是为了共享文件,所以还要指定Account Type为‘**Standard**’。 + +完成上述步骤,点击添加,你就创建好一个系统用户。这个用户还没有被激活,所以需要为其设置密码来激活。确保Users accounts界面已经解锁。点击尚不可用的账户,输入一个新密码,然后确认密码,点击Change。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/activate-system-user.jpg) + +耶!到目前为止我们已经安装并配置好Samba,已经创建了一个系统用户以通过这个账户在网络上共享文件,而且也已经激活了新用户。现在来到配置Samba的最后一步,然后就可以共享文件夹了。 + +#### 添加Samba新用户 #### + +打开Samba,在Preference先点击Samba Users。填写弹出的对话框,下面是其中几个字段的说明: + +**Unix Username** - 在这种情况下,我选择刚才创建的用户。 + +**Windows Username** - 输入你要访问的Windows电脑的用户名。 + +**Samba Password** - 输入你要访问的Windows电脑的密码。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/samba-user-setting.jpg) + +完成后点击OK。现在做个深呼吸。你已经在Samba的帮助下成功创建一个网络。然后重启网络或Samba服务,准备好和其它电脑共享文件。 + + sudo restart smbd && sudo restart nmbd + +#### 通过网络共享文件夹或文件 #### + +在图形用户界面下通过Samba共享文件是很简单的。点击加号图标,会看到如图所示的对话框: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/share-files-and-folders.jpg) + +填写完这些字段。在‘Directory’中,浏览要共享的文件夹。你会看到的字段的含义如下: + +- **Share name** 是其它人会看到的文件夹名字。 +- **Description** 是要共享内容的简单描述。 +- **Writeable** 默认情况下共享的文件夹是‘read only’。如果允许网络上的其他用户修改它们,设置为writable。 +- **Visiable** 当你点击Visiable时,就像它的名字一样,共享文件夹就对网络上的其他人可见。 + +现在你可以设置共享文件夹的权限。点击‘Access’选项,选择想要共享文件夹的用户。当你选择对所有人允许访问后,这个文件夹就对网络上的所有人可见。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Screenshot-from-2015-02-28-202031.png) + +最后点击OK,完成共享。现在这个文件夹就与你想要共享的用户实现共享。你已经完成了网络共享文件。还有其它要做的吗?对!还不知道如何从网络上移除文件夹? + +#### 移除共享文件夹 #### + +在网络共享一段时间后,我们也需要移除其中的一些文件夹。操作很简答,下面就是我们要做的。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/remove-shared-folder-from-network.jpg) + +全部搞定!我们也可以使用终端进行网络文件共享,但这样没有本文介绍的方法这么容易。如果你确实想知道命令行操作,我会再写一篇关于在Linux上使用命令行实现网络文件共享的文章。 + +所以,你是怎么找到这篇教程的呢?我希望看了这篇教程你可以**很容易地在Ubuntu和Windows之间共享文件**。如果你有任何问题或建议,请在评论里说出来。 + + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/share-folders-local-network-ubuntu-windows/ + +作者:[Mohd Sohail][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/sohail/ +[1]:http://en.wikipedia.org/wiki/Samba_%28software%29 +[2]:http://itsfoss.com/request-tutorial/ diff --git a/published/201505/20150306 How to Setup lftp--A Simple Command line FTP Program.md b/published/201505/20150306 How to Setup lftp--A Simple Command line FTP Program.md new file mode 100644 index 0000000000..6f7d3b047f --- /dev/null +++ b/published/201505/20150306 How to Setup lftp--A Simple Command line FTP Program.md @@ -0,0 +1,174 @@ +LFTP : 一个功能强大的命令行FTP程序 +================================================================================ +大家好,这篇文章是介绍Lftp以及如何在Linux操作系统下安装的。[Lftp][1]是一个基于命令行的文件传输软件(也被称为FTP客户端),由Alexander Lukyanov开发并以GNU GPL协议许可发行。除了FTP协议外,它还支持FTPS,HTTP,HTTPS,HFTP,FISH,以及SFTP等协议。这个程序还支持FXP,允许数据绕过客户端直接在两个FTP服务器之间传输。 + +它有很多很棒的高级功能,比如递归镜像整个目录树以及断点续传下载。传输任务可以安排在稍后的时间段计划执行,可以限制带宽,可以创建传输列表,还支持类似Unix shell的任务控制。客户端还可以在交互式或自动脚本里使用。 + +### 安装Lftp ### + +在运行lftp之前,我们需要确定它已经正确安装在我们的Linux发行版中了。下面是在常见Linux发行版中安装lftp的一些命令。 + +**Ubuntu 14.04 LTS** + +在Ubuntu 14.04 LTS以及它的衍生版中,我们可以通过apt管理程序安装lftp。要安装它,我们需要使用sudo权限在shell或终端里运行下面的命令。 + + $ sudo apt-get install lftp + +![ubuntu install lftp](http://blog.linoxide.com/wp-content/uploads/2015/03/ubuntu-install-lftp.png) + +**CentOS/Fedora/RHEL** + +因为在Fedora,CentOS和RHEL的软件仓库里也能找到lftp,我们可以用**yum**管理程序来安装它。 + + $ sudo yum install lftp + +![fedora lftp](http://blog.linoxide.com/wp-content/uploads/2015/03/fedora-lftp.png) + +**Arch Linux** + +在Arch Linux安装包仓库里也有,我们可以简单地使用pacman来安装它。 + + $ sudo pacman -S lftp + +![archlinux install lftp](http://blog.linoxide.com/wp-content/uploads/2015/03/archlinux-install-lftp.png) + +**OpenSuse** + +OpenSuse系统里的包管理软件Zypper可以用来安装lftp。下面是在OpenSuse机器上用来安装的命令。 + + $ sudo zypper install lftp + +![opensuse lftp install](http://blog.linoxide.com/wp-content/uploads/2015/03/lftp_install.png) + +### 登录 ### + +要登录到ftp服务器或sftp服务器,我们首先需要知道所要求的认证信息,比如用户名,密码,端口。 + +之后,我们可以通过lftp来登录。 + + $ lftp ftp://linoxide@localhost + +![ftp login](http://blog.linoxide.com/wp-content/uploads/2015/03/lftp-login.png) + +如果需要指定登录端口,我们可以按下面的方式加上去。 + + $ lftp ftp://linoxide@localhost:21 + +![ftp login with ports](http://blog.linoxide.com/wp-content/uploads/2015/03/lftp-login-port.png) + +### 导航 ### + +我们可以用**ls**命令来列出文件和目录,用**cd**命令进入到目录。 + +![ls and cd](http://blog.linoxide.com/wp-content/uploads/2015/03/ls-cd-lftp.png) + +### 上传和下载文件 ### + +我们可以用**pget**命令来从远端服务器下载文件。 + + > pget linspeed.svg + +![pget lftp](http://blog.linoxide.com/wp-content/uploads/2015/03/pget-lftp.png) + +我们可以用**put**命令来上传文件到远端服务器。 + + > put linoxide.tar + +![upload with put](http://blog.linoxide.com/wp-content/uploads/2015/03/put-upload.png) + +要恢复之前只下载了一部分的文件/目录,我们可以用-c开关: + + > mirror -c Directory + + >pget -c linoxide.tar + + > put -c upload.tar + +### 使用镜像命令 ### + +我们可以用mirror命令来下载所指定的整个目录。 + + > mirror remote local + +![download with mirror](http://blog.linoxide.com/wp-content/uploads/2015/03/mirror.png) + +还可以做反向镜像(mirror -R),可以用来上传或更新本地目录树到服务器上。 + + > mirror -R local remote + +![upload or update with mirror reverse](http://blog.linoxide.com/wp-content/uploads/2015/03/mirror-reverse.png) + +要恢复之前下载了一部分的文件/目录,我们可以用-c开关: + + > mirror -c Directory + +### 下载队列 ### + +我们可以在lftp里使用queue的选项,这样我们可以像基于GUI的客户端那样挨个下载队列里选择的文件。下面举个例子。 + +为了避免队列自动开始传输,我们可以这样做: + + > queue stop + +现在,我们添加任务到队列。 + + > queue mirror "directory" + + > queue pget "file.tar" + +在建立好队列后,我们再运行queue start命令。 + + > queue start + +可以运行下面的命令移除整个队列。 + + > queue -d + +### 分块下载 ### + +下面是一个把一个文件分成3块来下载的例子,你可以根据自己的需要调整。 + +使用pget命令分块功能的方式是**pget -n 3 file.tar**,里面的3是分块的数目。 + + > pget -n 3 file.tar + +使用mirror命令分块功能的方式是**mirror --use-pget-n=3 directory**,里面的3是分块的数目。 + + > mirror --use-pget-n=3 linxoxide + +我们可以用jobs -v命令来查看每个独立分块的下载速度以及整体速度。 + +### 停止,继续或删除一次传输任务 ### + +要取消传输我们可以按下Ctrl+C。而要恢复下载我们可以像下面那样使用-c (--continue)开关。 + + > mirror -c directory + +要删除一次正在正在传输的任务我们可以用**kill**命令,而要删除所有任务我们可以使用下面那样的**kill all**命令。 + + > kill + + > kill all + +### 退出 ### + +要从lftp退出,我们需要在终端或lftp交互接口中运行exit命令。 + + > exit + +### 总结 ### + +哇!我们已经成功地安装了lftp并学会了它的一些基础的主要使用方式。lftp是一个非常棒的命令行ftp客户端,它支持许多额外的功能以及很酷的特性。它比其他普通ftp客户端多了很多东西。好吧,你要是有任何问题,建议,反馈,请在下面的评论区里留言。谢谢!享用lftp吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/setup-lftp-command-line-ftp/ + +作者:[Arun Pyasi][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://lftp.yar.ru/ diff --git a/published/201505/20150309 List Of Free Windows SSH Client Tools To Connect To Your Linux Server .md b/published/201505/20150309 List Of Free Windows SSH Client Tools To Connect To Your Linux Server .md new file mode 100644 index 0000000000..d75ecbb555 --- /dev/null +++ b/published/201505/20150309 List Of Free Windows SSH Client Tools To Connect To Your Linux Server .md @@ -0,0 +1,82 @@ +Windows 下的免费 SSH 客户端工具 +================================================================================ + +如果你的操作系统是 Windows,而你想要连接 Linux 服务器相互传送文件,那么你需要一个简称 SSH 的 Secure Shell 软件。实际上,SSH 是一个网络协议,它允许你通过网络连接到 Linux 和 Unix 服务器。SSH 使用公钥加密来认证远程的计算机。你可以有多种途径使用 SSH,无论是自动连接,还是使用密码认证登录。 + +本篇文章介绍了几种可以连接 Linux 服务器 SSH 客户端。 + +让我们开始。 + +### Putty ### + +**Putty** 是最有名的 SSH 和 telnet 客户端,最初由 Simon Tatham 为 Windows 平台开发。Putty 是一款开源软件,有可用的源代码,和一群志愿者的开发和支持。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/putty.png) + +Putty 非常易于安装和使用,通常大部分的配置选项你都不需要修改。你只需要输入少量基本的参数,就可以开始很简单地建立连接会话。[点此下载][1] Putty。 + +### Bitvise SSH Client ### + +**Bitvise SSH** 是一款支持 SSH 和 SFTP 的 Windows 客户端。由 Bitvise 开发和提供专业支持。这款 SSH 客户端性能强悍,易于安装、便于使用。Bitvise SSH 客户端拥有功能丰富的图形界面,通过一个有自动重连功能的内置代理进行动态端口转发。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/bitvise.png) + +Bitvise SSH 客户端对**个人用户使用是免费的**,同时对于在组织内部的个人商业使用也一样。你可以[在这里下载 Bitvise SSH 客户端][2]。 + +### MobaXterm ### + +**MobaXterm** 是你的**远程计算的终极工具箱**。在一个 Windows 应用里,它为程序员、网管、IT 管理员及其它用户提供了精心裁剪的一揽子功能,让他们的远程操作变得简约时尚。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/mobaxterm.png) + +MobaXterm 提供了所有重要的**远程网络工具** (如SSH、 X11、 RDP、 VNC、 FTP、 MOSH 等等),以及 Windows 桌面上的 **Unix 命令**(bash、 ls、 cat、sed、 grep、 awk、 rsync等等),而这些都是由一个开箱即用的**单一的便携程序**所提供。MobaXterm 对**个人使用免费**,你可以[在这里][3]下载 MobaXterm。 + +### DameWare SSH ### + +我认为 **DameWare SSH** 是最好的免费SSH客户端。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/ssh.png) + +这个免费工具是一个终端模拟器,可以让你从一个易用的控制台建立多个 telnet 和 SSH 连接。 + +-用一个带标签的控制台界面管理多个会话 +-将常用的会话保存在 Windows 文件系统中 +-使用多套保存的证书来轻松登录不同的设备 +-使用 telnet、SSH1 和 SSH2 协议连接计算机和设备 + +你可以从[这个链接][4]下载 **DameWare SSH**。 + +### SmarTTY ### +  +SmarTTY 是一款免费的多标签 SSH 客户端,支持使用 SCP 命令随时复制文件和目录。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/smart.png) + +大多数 SSH 服务器每个连接支持最多10个子会话.SmarTTY 在这方面做得很好:没有烦人的多个窗口,不需要重新登录,仅仅打开一个新的标签页就可以开始了! + +### Cygwin ### + +Cygwin 是一款 GNU 和开源工具的大杂烩,提供的功能近似于一个 Windows 平台下的 Linux。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/cyq.png) + +**Cygwin** 包括了一个称为模拟库的 Unix 系统:cygwin.dll,集成了大量的 GNU 和其它的免费软件,以大量的可选包方式组织而成。在这些安装包中,有高质量的编译器和其他软件开发工具、一个X11服务器、一套完整的X11开发套件、GNU emacs 编辑器、Tex 和 LaTeX、openSSH(客户端和服务器),除此之外还有很多,包括在微软 Windows 下需要编译和使用 PhysioToolkit 软件的每一样东西。 + +读完我们的文章后,不知你中意哪一款 SSH 客户端?你可以留下你的评论,描述你喜欢的系统和选择的原因。当然,如果有另外的 SSH 客户端没有被本文列举出来,你可以帮助我们补充。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/list-free-windows-ssh-client-tools-connect-linux-server/ + +作者:[anismaj][a] +译者:[wi-cuckoo](http://github.com/wi-cuckoo) +校对:[wxy](http://github.com/wxy) + +本文由 [LCTT](http://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/anis/ +[1]:http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html +[2]:http://www.bitvise.com/download-area +[3]:http://mobaxterm.mobatek.net/download.html +[4]:http://www.dameware.com/downloads/registration.aspx?productType=ssh&AppID=17471&CampaignID=70150000000PcNM +[5]:http://cygwin.com/packages/ diff --git a/published/201505/20150310 [Fixed] Keyboard And Mouse Freeze After Suspend In Ubuntu 14.04 [Quick Tip].md b/published/201505/20150310 [Fixed] Keyboard And Mouse Freeze After Suspend In Ubuntu 14.04 [Quick Tip].md new file mode 100644 index 0000000000..320ca3da60 --- /dev/null +++ b/published/201505/20150310 [Fixed] Keyboard And Mouse Freeze After Suspend In Ubuntu 14.04 [Quick Tip].md @@ -0,0 +1,29 @@ +修复 Ubuntu 14.04 从待机中唤醒后鼠标键盘出现僵死情况 +========= + +### 问题: ### + +当Ubuntu14.04或14.10从睡眠和待机状态恢复时,鼠标和键盘出现僵死,不能点击也不能输入。解决这种情况是唯一方法就是按关机键强关系统,这不仅非常不便且令人恼火。因为在Ubuntu的默认情况中合上笔记本等同于切换到睡眠模式。 + +在这篇短文中,我们将学会如何解决Ubuntu14.04和14.10中出现的鼠标僵死问题。 + +### Ubuntu14.04唤醒后鼠标僵死的解决办法 ### + +这个问题的是由内核升级导致的。为何导致这一情况不得而知,但是看起来好像仅需重装输入设备的驱动就能解决了。 + + sudo apt-get install --reinstall xserver-xorg-input-all + +这则贴士源自一个我们的读者Dev的提问。快试试这篇贴士,看看是否对你也有效。在一个类似的问题中,你可以[修复Ubuntu登录后无Unity界面、侧边栏和Dash的问题][1]。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/keyboard-mouse-freeze-suspend/ + +作者:[Abhishek][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/how-to-fix-no-unity-no-launcher-no-dash-in-ubuntu-12-10-quick-tip/ \ No newline at end of file diff --git a/published/201505/20150316 5 Interesting Command Line Tips and Tricks in Linux--Part 1.md b/published/201505/20150316 5 Interesting Command Line Tips and Tricks in Linux--Part 1.md new file mode 100644 index 0000000000..9344d8c482 --- /dev/null +++ b/published/201505/20150316 5 Interesting Command Line Tips and Tricks in Linux--Part 1.md @@ -0,0 +1,132 @@ +5个有趣的Linux命令行技巧 +================================================================================ +你有将Linux物尽其用吗?对很多Linux用户来说,有很多看起来是技巧的有用特性。有些时候你会需要这些技巧。本文会帮助你更好得使用一些命令,发挥其更强大的功能。 + +![5个命令行技巧](http://www.tecmint.com/wp-content/uploads/2015/03/5-Command-Line-Tips.jpg) + +*图1:5个命令行技巧* + +我们开始一个新的系列,在这里我们还会写一些技巧,并且用尽量小的篇幅写清楚。 + +### 1. 我们可以使用[`history`命令][1]来查看曾经运行过的命令。 ### + +这里是一个`history`命令的示例输出。 + + # history + +![history命令例子](http://www.tecmint.com/wp-content/uploads/2015/03/history-command.gif) + +*图2:history命令例子* + +从`history`命令输出看,很明显,命令的执行时间没有被打出来。有解决方法吗?有的!运行如下命令: + + # HISTTIMEFORMAT="%d/%m/%y %T " + # history + +如果你想让这个修改永久生效,添加如下的一行内容到`~/.bashrc`文件中: + + export HISTTIMEFORMAT="%d/%m/%y %T " + +然后,在终端中运行: + + # source ~/.bashrc + +命令和选项的解释: + +- history – 查看运行过的命令 +- HISTIMEFORMAT – 设置时间格式的环境变量 +- %d – 天 +- %m – 月 +- %y – 年 +- %T – 时间戳 +- source – 简而言之就是将文件内容发送给shell来执行 +- .bashrc – BASH以交互方式启动时运行的脚本文件 + +![history命令输出的日志](http://www.tecmint.com/wp-content/uploads/2015/03/History-Command-Logs.gif) + +*图3:`history`命令输出的日志* + +### 2. 如何测试磁盘写入速度?### + +一行`dd`命令脚本就可以实现。 + + # dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/output.img + +![dd命令例子](http://www.tecmint.com/wp-content/uploads/2015/03/dd-Command-Example.gif) + +*图4:`dd`命令例子* + +命令和选项的解释: + +- dd – 转换和复制文件 +- if=/dev/zero – 指定输入文件,默认为stdin(标准输入) +- of=/tmp/output.img – 指定输出文件,默认为stdout(标准输出) +- bs – 一次读和写的块大小,最大可以以MB为单位 +- count – 复制次数 +- conv – 使用逗号分隔的策略来转换文件(LCTT 译注:比如将大写字母转换成小写,echo AA | dd conv=lcase) +- rm – 删除文件和目录 +- -rf – (-r) 递归地删除目录和其中的内容,(-f)强行删除而不输出确认信息 + +### 3. 你如何获取吃掉你磁盘空间的最大的6个文件?### + +一个使用[`du`命令][2]的简单单行脚本即可实现,`du`命令主要用于获取文件的空间使用情况。 + + # du -hsx * | sort -rh | head -6 + +![获取磁盘空间使用情况的方法](http://www.tecmint.com/wp-content/uploads/2015/03/check-disk-space-usage.gif) + +*图5:获取磁盘空间使用情况的方法* + +命令和选项的解释: + +- du – 估计文件的空间使用情况 +- -hsx – (-h)更易读的格式,(-s)汇总输出,(-x)跳过其他文件系统的文件 +- sort – 对文本文件按行排序 +- -rf – (-r)将比较的结果逆序输出,(-f)忽略大小写 +- head – 输出文件的头几行 + +### 4. 获取一个文件的详细状态信息### + +可以使用`stat`命令 + + # stat filename_ext (例如:stat abc.pdf) + +![获取文件的详细信息](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Statistics.gif) + +*图6:获取文件的详细信息* + +### 5. 显示帮助 ### + +最后一个技巧是为那些入门者准备的,如果你是有经验的用户,可能不需要它,除非你想从中寻找乐趣。入门者可能有Linux命令行恐惧症,下面的命令会随机显示一个man手册页。对入门者来说,好处是总会学到新的东西,而且不会厌倦。 + + # man $(ls /bin | shuf | head -1) + +![查看随机的man手册页](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Man-Pages.gif) + +*图7:查看随机的man手册页* + +命令和选项的解释: + +- man – Linux man手册 +- ls – 列出文件 +- /bin – 系统可执行文件的路径 +- shuf – 把输入内容按行随机打乱并输出 +- head – 输出文件的头几行 + +这就是所有的内容了。如果你知道任何类似的技巧,可以分享给我们,我们会用你的语言在网站上发表出来。 + +不要忘记在下边评论框中留下有价值的反馈。保持联系。可以点赞或者将本文分享来帮助我们更好地传播内容。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/5-linux-command-line-tricks/ + +作者:[Avishek Kumar][a] +译者:[goreliu](https://github.com/goreliu) +校对:[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-1143-1.html +[2]:http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/ \ No newline at end of file diff --git a/published/201505/20150316 How to access Gmail from the command line on Linux with Alpine.md b/published/201505/20150316 How to access Gmail from the command line on Linux with Alpine.md new file mode 100644 index 0000000000..0d78b2fd34 --- /dev/null +++ b/published/201505/20150316 How to access Gmail from the command line on Linux with Alpine.md @@ -0,0 +1,101 @@ +如何在 Linux 中使用 Alpine 在命令行里访问 Gmail +================================================================================ + +假如你是一个命令行爱好者,我很确信你会使用这个强大的工作环境来执行哪怕是一项日常任务的工具,并为之欢呼,例如从 [安排日程][1] 、 [管理财务][2] 到 获取 [Facebook][3] 、[Twitter][4]等任务。(LCTT 译注:阅读本文的另一个前提是,假如你还能访问 Gmail 或者知道 Gmail 是什么的话。) + +在这个帖子中,我将为你展示 Linux 命令行的另一个漂亮干练的使用案例:**访问 Google 的 Gmail 服务**,为此,我们将使用 Alpine,一个基于 ncurses 的多功能命令行邮件客户端(不要和 Alpine Linux 搞混淆)。我们将在 Alphine 中配置 Gmail 的 IMAP 和 SMTP 设定,通过 Google 的邮件服务器在终端环境中收取和发送邮件。在这个教程的最后,你将发现只需几步就可以在 Alpine 中使用其他的邮件服务。 + +诚然,已有许多卓越的基于 GUI 的邮件客户端存在,例如 Thunderbird, Evolution 或者甚至是 Web 界面,那么为什么还有人对使用命令行的邮件客户端来收取 Gmail 这样的事感兴趣呢?答案很简单。假如你需要快速地处理好事情并想避免浪费不必要系统资源;或者你正工作在一个精简安装无操作台的服务器上,它没有安装用于图形显示的 X 服务;又或者是 X 服务在你的桌面上崩溃了,而你需要在解决这个问题之前急切地发送一些邮件。在上述所有的情况下, Alpine 都可以派上用场并在任何时间满足你的需求。 + +除了简单的编辑,发送和接收文本类的邮件信息等功能外, Alpine 还可以进行加密,解密和对邮件信息进行数字签名,以及与 TLS(注:Transport Layer Security,传输层加密)无缝集成。 + +### 在 Linux 上安装 Alpine ### + +在基于 Red Hat 的发行版本上,可以像下面那样来安装 Alpine。需要注意的是,在 RHEL 或 CentOS 上,你需要首先启用 [EPEL 软件仓库][5]。 + + # yum install alpine + +在 Debian,Ubuntu 或它们的衍生发行版本上,你可以这样做: + + # aptitude install alpine + +在安装完成后,你可以运行下面的命令来启动该邮件客户端: + + # alpine + +在你第一次启用 Alpine 时,它将在当前用户的家目录下创建一个邮件文件夹(`~/mail`),并显现出主界面,正如下面的视频所显示的那样:YOUTUBU 视频 - http://www.youtube.com/kuKiv3uze4U 。 + +它的用户界面有下列几个模块: + +![](https://farm9.staticflickr.com/8724/16618079590_6c236ce2c2_c.jpg) + +请随意地浏览、操作来熟悉 Alpine。你总是可以在任何时候通过敲 'Q' 来回到命令提示符界面。请注意,所有的字符界面下方都有与操作相关的帮助。 + +在进一步深入之前,我们将为 Alpine 创建一个默认的配置文件。为此,请关闭 Alpine,然后在命令行中执行下面的命令: + + # alpine -conf > /etc/pine.conf + +### 配置 Alpine 来使用 Gmail 账号 ### + +当你安装了 Alpine 并至少花费了几分钟的时间来熟悉它的界面和菜单,下面便是实际配置它来使用一个已有的 Gmail 账户的时候了。 + +在 Alpine 中执行下面的步骤之前,记得首先要通过你的 Web 邮件界面,在你的 Gmail 设定里启用 IMAP 协议。一旦在你的 Gmail 账户中启用了 IMAP ,执行下面的步骤来在 Alpine 中启用阅读 Gmail 信息的功能。 + +首先,启动 Alpine。 + +按 'S' 来进行设置,再按 'L' 选择 `collectionLists` 选项来定义不同的文件夹类别以帮助你更好地组织你的邮件: + +![](https://farm8.staticflickr.com/7614/16779579656_690eda419c_o.png) + +按 'A' 来新建一个文件夹并填写必要的信息: + +- **Nickname**: 填写任何你想写的名字; +- **Server**: imap.gmail.com/ssl/user=yourgmailusername@gmail.com + +你可以将 `Path` 和 `View` 留白不填。 + +然后按 `Ctrl+X` 并在提示时输入你的 Gmail 密码: + +![](https://farm9.staticflickr.com/8611/16618079640_6f7dca336a_b.jpg) + +假如一切如预期一样进展顺利,就会出现一个以你先前填写的昵称来命名的新文件夹。你应该可以在这里找到你的 Gmail 信箱: + +![](https://farm8.staticflickr.com/7598/16804355052_10c1a6c5bd_b.jpg) + +要验证的话,你可以比较在 Alpine 中显示的 "Gmail Sent" 信箱和在 Web 界面下的信箱: + +![](https://farm8.staticflickr.com/7602/16619323939_d2eab3e162_c.jpg) + +默认情况下,每隔 150 秒,它将自动检查新邮件或提示,你可以在文件 `/etc/pine.conf`中改变这个值,同时你还可以修改许多其他设定。这个配置文件拥有详细且清晰的注释。例如,为了将检查新邮件的时间间隔设定为 10 秒,你需要这样设定: + + # The approximate number of seconds between checks for new mail + mail-check-interval=10 + +最后,我们需要配置一个 SMTP 服务器来通过 Alpine 发送邮件。回到先前解释过的 Alpine 的设置界面,然后按 'C' 来设定一个 Google 的 SMTP 服务器地址,你需要像下面这样编辑 `SMTP Server`(用于发送邮件)这一行内容: + + smtp.gmail.com:587/tls/user=yourgmailusername@gmail.com + +当你按 'E' 离开设定界面时,将会提醒你保存更改。一旦你保存了更改,马上你就可以通过 Alpine 来发送邮件了!为此,来到主菜单中的 `Compose` 选项,接着开始从命令行中操作你的 Gmail 吧。 + +### 总结 ### + +在这个帖子里,我们讨论了在终端环境中如何通过一个名为 Alpine 的轻量且强大的命令行邮件客户端来访问 Gmail。 Alpine 是一个发布在 Apache Software License 2.0 协议下的自由软件,该协议与 GPL 协议相兼容。 Alpine 引以自豪的是:它不仅对新手友好,同时还做到了让那些经验丰富的系统管理员认为它是强大的。我希望在你阅读完这篇文章后,你能意识到我最后一个论断是多么的正确。 + +非常欢迎使用下面的输入框来留下你的评论或问题。我期待着你们的反馈! + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/gmail-command-line-linux-alpine.html + +作者:[Gabriel Cánepa][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/gabriel +[1]:http://xmodulo.com/schedule-appointments-todo-tasks-linux-terminal.html +[2]:http://xmodulo.com/manage-personal-expenses-command-line.html +[3]:http://xmodulo.com/access-facebook-command-line-linux.html +[4]:http://xmodulo.com/access-twitter-command-line-linux.html +[5]:https://linux.cn/article-2324-1.html diff --git a/published/201505/20150316 Install Mate desktop in FreeBSD 10.1.md b/published/201505/20150316 Install Mate desktop in FreeBSD 10.1.md new file mode 100644 index 0000000000..ed4aa9d18b --- /dev/null +++ b/published/201505/20150316 Install Mate desktop in FreeBSD 10.1.md @@ -0,0 +1,61 @@ +在FreeBSD 10.1中安装Mate桌面 +================================================================================ +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/03/FreeBSD-790x494.jpg) + +FreeBSD是全文本模式的系统,然而有些新用户想要使用GUI桌面环境。这个教程就是帮助你在Freebsd 10.1中安装Mate桌面。 + +下面是我的系统细节: + + root@Freebsd-unixmen:~ # uname -a + FreeBSD Freebsd-unixmen 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 + root@Freebsd-unixmen:~ + +要在FreeBSD 10.1 中开始安装Mate桌面,按照下面的步骤。 + + pkg install xf86-video-fbdev mate-desktop mate xorg + +### 在 /etc/rc.conf 中加入下面的行 ### + + moused_enable="YES" + dbus_enable="YES" + hald_enable="YES" + +### 测试安装 ### + + xinit mate-session + +![](http://www.unixmen.com/wp-content/uploads/2015/03/snapshot2.png) + +Mate本身没有显示管理器。因此我们会使用其他的显示管理器如XDM、GDM、slim等等来作为登录管理器。这里让我们看看如何在Mate桌面中配置Slim DM + +### 安装 Slim ### + + pkg install slim + +在**/etc/rc.conf**中加入下面的行: + + slim_enable="YES" + +在用户的家目录下的.xinitrc文件加入下面的行。 + + exec mate-session + +重启电脑。现在在你登录Mate时就会进入Slim登录界面了。 + +![](http://www.unixmen.com/wp-content/uploads/2015/03/snapshot3.png) + +![](http://www.unixmen.com/wp-content/uploads/2015/03/snapshot4.png) + +就是这样。干杯! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-mate-desktop-freebsd-10-1/ + +作者:[M.el Khamlichi][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/pirat9/ diff --git a/published/201505/20150316 Systemd Boot Process a Close Look in Linux.md b/published/201505/20150316 Systemd Boot Process a Close Look in Linux.md new file mode 100644 index 0000000000..747e946925 --- /dev/null +++ b/published/201505/20150316 Systemd Boot Process a Close Look in Linux.md @@ -0,0 +1,153 @@ +走进Linux之systemd启动过程 +================================================================================ + +Linux系统的启动方式有点复杂,而且总是有需要优化的地方。传统的Linux系统启动过程主要由著名的init进程(也被称为SysV init启动系统)处理,而基于init的启动系统被认为有效率不足的问题,systemd是Linux系统机器的另一种启动方式,宣称弥补了以[传统Linux SysV init][2]为基础的系统的缺点。在这里我们将着重讨论systemd的特性和争议,但是为了更好地理解它,也会看一下通过传统的以SysV init为基础的系统的Linux启动过程是什么样的。友情提醒一下,systemd仍然处在测试阶段,而未来发布的Linux操作系统也正准备用systemd启动管理程序替代当前的启动过程(LCTT 译注:截止到本文发表,主流的Linux发行版已经有很多采用了 systemd)。 + +### 理解Linux启动过程 ### + +在我们打开Linux电脑的电源后第一个启动的进程就是init。分配给init进程的PID是1。它是系统其他所有进程的父进程。当一台Linux电脑启动后,处理器会先在系统存储中查找BIOS,之后BIOS会检测系统资源然后找到第一个引导设备,通常为硬盘,然后会查找硬盘的主引导记录(MBR),然后加载到内存中并把控制权交给它,以后的启动过程就由MBR控制。 + +主引导记录会初始化引导程序(Linux上有两个著名的引导程序,GRUB和LILO,80%的Linux系统在用GRUB引导程序),这个时候GRUB或LILO会加载内核模块。内核会马上查找/sbin下的“init”程序并执行它。从这里开始init成为了Linux系统的父进程。init读取的第一个文件是/etc/inittab,通过它init会确定我们Linux操作系统的运行级别。它会从文件/etc/fstab里查找分区表信息然后做相应的挂载。然后init会启动/etc/init.d里指定的默认启动级别的所有服务/脚本。所有服务在这里通过init一个一个被初始化。在这个过程里,init每次只启动一个服务,所有服务/守护进程都在后台执行并由init来管理。 + +关机过程差不多是相反的过程,首先init停止所有服务,最后阶段会卸载文件系统。 + +以上提到的启动过程有一些不足的地方。而用一种更好的方式来替代传统init的需求已经存在很长时间了。也产生了许多替代方案。其中比较著名的有Upstart,Epoch,Muda和Systemd。而Systemd获得最多关注并被认为是目前最佳的方案。 + +### 理解Systemd ### + +开发Systemd的主要目的就是减少系统引导时间和计算开销。Systemd(系统管理守护进程),最开始以GNU GPL协议授权开发,现在已转为使用GNU LGPL协议,它是如今讨论最热烈的引导和服务管理程序。如果你的Linux系统配置为使用Systemd引导程序,它取替传统的SysV init,启动过程将交给systemd处理。Systemd的一个核心功能是它同时支持SysV init的后开机启动脚本。 + +Systemd引入了并行启动的概念,它会为每个需要启动的守护进程建立一个套接字,这些套接字对于使用它们的进程来说是抽象的,这样它们可以允许不同守护进程之间进行交互。Systemd会创建新进程并为每个进程分配一个控制组(cgroup)。处于不同控制组的进程之间可以通过内核来互相通信。[systemd处理开机启动进程][2]的方式非常漂亮,和传统基于init的系统比起来优化了太多。让我们看下Systemd的一些核心功能。 + +- 和init比起来引导过程简化了很多 +- Systemd支持并发引导过程从而可以更快启动 +- 通过控制组来追踪进程,而不是PID +- 优化了处理引导过程和服务之间依赖的方式 +- 支持系统快照和恢复 +- 监控已启动的服务;也支持重启已崩溃服务 +- 包含了systemd-login模块用于控制用户登录 +- 支持加载和卸载组件 +- 低内存使用痕迹以及任务调度能力 +- 记录事件的Journald模块和记录系统日志的syslogd模块 + +Systemd同时也清晰地处理了系统关机过程。它在/usr/lib/systemd/目录下有三个脚本,分别叫systemd-halt.service,systemd-poweroff.service,systemd-reboot.service。这几个脚本会在用户选择关机,重启或待机时执行。在接收到关机事件时,systemd首先卸载所有文件系统并停止所有内存交换设备,断开存储设备,之后停止所有剩下的进程。 + +![](http://images.linoxide.com/systemd-boot-process.jpg) + +### Systemd结构概览 ### + +让我们看一下Linux系统在使用systemd作为引导程序时的开机启动过程的结构性细节。为了简单,我们将在下面按步骤列出来这个过程: + +**1.** 当你打开电源后电脑所做的第一件事情就是BIOS初始化。BIOS会读取引导设备设定,定位并传递系统控制权给MBR(假设硬盘是第一引导设备)。 + +**2.** MBR从Grub或LILO引导程序读取相关信息并初始化内核。接下来将由Grub或LILO继续引导系统。如果你在grub配置文件里指定了systemd作为引导管理程序,之后的引导过程将由systemd完成。Systemd使用“target”来处理引导和服务管理过程。这些systemd里的“target”文件被用于分组不同的引导单元以及启动同步进程。 + +**3.** systemd执行的第一个目标是**default.target**。但实际上default.target是指向**graphical.target**的软链接。Linux里的软链接用起来和Windows下的快捷方式一样。文件Graphical.target的实际位置是/usr/lib/systemd/system/graphical.target。在下面的截图里显示了graphical.target文件的内容。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/graphical1.png) + +**4.** 在这个阶段,会启动**multi-user.target**而这个target将自己的子单元放在目录“/etc/systemd/system/multi-user.target.wants”里。这个target为多用户支持设定系统环境。非root用户会在这个阶段的引导过程中启用。防火墙相关的服务也会在这个阶段启动。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/multi-user-target1.png) + +"multi-user.target"会将控制权交给另一层“**basic.target**”。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Basic-Target.png) + +**5.** "basic.target"单元用于启动普通服务特别是图形管理服务。它通过/etc/systemd/system/basic.target.wants目录来决定哪些服务会被启动,basic.target之后将控制权交给**sysinit.target**. + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Sysint-Target.png) + +**6.** "sysinit.target"会启动重要的系统服务例如系统挂载,内存交换空间和设备,内核补充选项等等。sysinit.target在启动过程中会传递给**local-fs.target**。这个target单元的内容如下面截图里所展示。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/local-FS-Target.png) + +**7.** local-fs.target,这个target单元不会启动用户相关的服务,它只处理底层核心服务。这个target会根据/etc/fstab和/etc/inittab来执行相关操作。 + +### 系统引导性能分析 ### + +Systemd提供了工具用于识别和定位引导相关的问题或性能影响。**Systemd-analyze**是一个内建的命令,可以用来检测引导过程。你可以找出在启动过程中出错的单元,然后跟踪并改正引导组件的问题。在下面列出一些常用的systemd-analyze命令。 + +**systemd-analyze time** 用于显示内核和普通用户空间启动时所花的时间。 + + $ systemd-analyze time + + Startup finished in 1440ms (kernel) + 3444ms (userspace) + +**systemd-analyze blame** 会列出所有正在运行的单元,按从初始化开始到当前所花的时间排序,通过这种方式你就知道哪些服务在引导过程中要花较长时间来启动。 + + $ systemd-analyze blame + + 2001ms mysqld.service + 234ms httpd.service + 191ms vmms.service + +**systemd-analyze verify** 显示在所有系统单元中是否有语法错误。 + +**systemd-analyze plot** 可以用来把整个引导过程写入一个SVG格式文件里。整个引导过程非常长不方便阅读,所以通过这个命令我们可以把输出写入一个文件,之后再查看和分析。下面这个命令就是做这个。 + + systemd-analyze plot > boot.svg + +### Systemd的争议 ### + +Systemd并没有幸运地获得所有人的青睐,一些专家和管理员对于它的工作方式和开发有不同意见。根据对于Systemd的批评,它不是“类Unix”方式因为它试着替换一些系统服务。一些专家也不喜欢使用二进制配置文件的想法。据说编辑systemd配置非常困难而且没有一个可用的图形工具。 + +###  如何在Ubuntu 14.04和12.04上测试Systemd ### + +本来,Ubuntu决定从Ubuntu 16.04 LTS开始使用Systemd来替换当前的引导过程。Ubuntu 16.04预计在2016年4月发布,但是考虑到Systemd的流行和需求,刚刚发布的**Ubuntu 15.04**采用它作为默认引导程序。另外,Ubuntu 14.04 Trusty Tahr和Ubuntu 12.04 Precise Pangolin的用户可以在他们的机器上测试Systemd。测试过程并不复杂,你所要做的只是把相关的PPA包含到系统中,更新仓库并升级系统。 + +**声明**:请注意它仍然处于Ubuntu的测试和开发阶段。升级测试包可能会带来一些未知错误,最坏的情况下有可能损坏你的系统配置。请确保在尝试升级前已经备份好重要数据。 + +在终端里运行下面的命令来添加PPA到你的Ubuntu系统里: + + sudo add-apt-repository ppa:pitti/systemd + +你将会看到警告信息因为我们尝试使用临时/测试PPA,而它们是不建议用于实际工作机器上的。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/PPA-Systemd1.png) + +然后运行下面的命令更新APT包管理仓库。 + + sudo apt-get update + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Update-APT1.png) + +运行下面的命令升级系统。 + + sudo apt-get dist-upgrade + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/System-Upgrade.png) + +就这些,你应该已经可以在你的Ubuntu系统里看到Systemd配置文件了,打开/lib/systemd/目录可以看到这些文件。 + +好吧,现在让我们编辑一下grub配置文件指定systemd作为默认引导程序。可以使用Gedit文字编辑器编辑grub配置文件。 + + sudo gedit /etc/default/grub + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Edit-Grub.png) + +在文件里修改GRUB_CMDLINE_LINUX_DEFAULT项,设定它的参数为:“**init=/lib/systemd/systemd**” + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Grub-Systemd.png) + +就这样,你的Ubuntu系统已经不再使用传统的引导程序了,改为使用Systemd管理器。重启你的机器然后查看systemd引导过程吧。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/03/Sytemd-Boot.png) + +### 结论 ### + +Systemd毫无疑问为改进Linux引导过程前进了一大步;它包含了一套漂亮的库和守护进程配合工作来优化系统引导和关闭过程。许多Linux发行版正准备将它作为自己的正式引导程序。在以后的Linux发行版中,我们将有望看到systemd开机。但是另一方面,为了获得成功并广泛应用,systemd仍需要认真处理批评意见。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/systemd-boot-process/ + +作者:[Aun Raza][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ +[1]:http://linoxide.com/booting/boot-process-of-linux-in-detail/ +[2]:http://0pointer.de/blog/projects/self-documented-boot.html diff --git a/published/201505/20150318 11 Linux Terminal Commands That Will Rock Your World.md b/published/201505/20150318 11 Linux Terminal Commands That Will Rock Your World.md new file mode 100644 index 0000000000..0160abb0c2 --- /dev/null +++ b/published/201505/20150318 11 Linux Terminal Commands That Will Rock Your World.md @@ -0,0 +1,279 @@ +11个让你吃惊的 Linux 终端命令 +================================================================================ +我已经用了十年的Linux了,通过今天这篇文章我将向大家展示一系列的命令、工具和技巧,我希望一开始就有人告诉我这些,而不是曾在我成长道路上绊住我。 + +### 1. 命令行日常系快捷键 ### + +![Linux Keyboard Shortcuts.](http://f.tqn.com/y/linux/1/L/m/J/1/keyboardshortcuts.png) + +*Linux的快捷键。* + +如下的快捷方式非常有用,能够极大的提升你的工作效率: + +- CTRL + U - 剪切光标前的内容 +- CTRL + K - 剪切光标至行末的内容 +- CTRL + Y - 粘贴 +- CTRL + E - 移动光标到行末 +- CTRL + A - 移动光标到行首 +- ALT + F - 跳向下一个空格 +- ALT + B - 跳回上一个空格 +- ALT + Backspace - 删除前一个单词 +- CTRL + W - 剪切光标后一个单词 +- Shift + Insert - 向终端内粘贴文本 + +那么为了让上述内容更易理解来看下面的这行命令。 + + sudo apt-get intall programname + +如你所见,命令中存在拼写错误,为了正常执行需要把“intall”替换成“install”。 + +想象现在光标正在行末,我们有很多的方法将她退回单词install并替换它。 + +我可以按两次ALT+B这样光标就会在如下的位置(这里用^指代光标的位置)。 + + sudo apt-get^intall programname + +现在你可以按两下方向键并将“s”插入到install中去了。 + +如果你想将浏览器中的文本复制到终端,可以使用快捷键"shift + insert"。 + + +### 2. SUDO !! ### + +![](http://f.tqn.com/y/linux/1/L/n/J/1/sudotricks2.png) + +*sudo !!* + +如果你还不知道这个命令,我觉得你应该好好感谢我,因为如果你不知道的话,那每次你在输入长串命令后看到“permission denied”后一定会痛恼不堪。 + +- sudo !! + +如何使用sudo !!?很简单。试想你刚输入了如下命令: + + apt-get install ranger + +一定会出现“Permission denied”,除非你已经登录了足够高权限的账户。 + +sudo !! 就会用 sudo 的形式运行上一条命令。所以上一条命令就变成了这样: + + sudo apt-get install ranger + +如果你不知道什么是sudo,[戳这里][1]。 + +### 3. 暂停并在后台运行命令 ### + +![Pause Terminal Applications.](http://f.tqn.com/y/linux/1/L/o/J/1/pauseapps.png) + +*暂停终端运行的应用程序。* + +我曾经写过一篇[如何在终端后台运行命令的指南][13]。 + +- CTRL + Z - 暂停应用程序 +- fg - 重新将程序唤到前台 + +如何使用这个技巧呢? + +试想你正用nano编辑一个文件: + + sudo nano abc.txt + +文件编辑到一半你意识到你需要马上在终端输入些命令,但是nano在前台运行让你不能输入。 + +你可能觉得唯一的方法就是保存文件,退出 nano,运行命令以后在重新打开nano。 + +其实你只要按CTRL + Z,前台的命令就会暂停,画面就切回到命令行了。然后你就能运行你想要运行命令,等命令运行完后在终端窗口输入“fg”就可以回到先前暂停的任务。 + +有一个尝试非常有趣就是用nano打开文件,输入一些东西然后暂停会话。再用nano打开另一个文件,输入一些什么后再暂停会话。如果你输入“fg”你将回到第二个用nano打开的文件。只有退出nano再输入“fg”,你才会回到第一个用nano打开的文件。 + +### 4. 使用nohup在登出SSH会话后仍运行命令 ### + +![nohup.](http://f.tqn.com/y/linux/1/L/p/J/1/nohup3.png) + +*nohup* + +如果你用ssh登录别的机器时,[nohup命令][2]真的非常有用。 + +那么怎么使用nohup呢? + +想象一下你使用ssh远程登录到另一台电脑上,你运行了一条非常耗时的命令然后退出了ssh会话,不过命令仍在执行。而nohup可以将这一场景变成现实。 + +举个例子,因为测试的需要,我用我的[树莓派][3]来下载发行版。我绝对不会给我的树莓派外接显示器、键盘或鼠标。 + +一般我总是用[SSH][4]从笔记本电脑连接到树莓派。如果我在不用nohup的情况下使用树莓派下载大型文件,那我就必须等待到下载完成后,才能登出ssh会话关掉笔记本。可如果是这样,那我为什么要使用树莓派下文件呢? + +使用nohup的方法也很简单,只需如下例中在nohup后输入要执行的命令即可: + + nohup wget http://mirror.is.co.za/mirrors/linuxmint.com/iso//stable/17.1/linuxmint-17.1-cinnamon-64bit.iso & + + +### 5. ‘在’特定的时间运行Linux命令 ### + +![Schedule tasks with at.](http://f.tqn.com/y/linux/1/L/q/J/1/at.png) + +*At管理任务日程* + +‘nohup’命令在你用SSH连接到服务器,并在上面保持执行SSH登出前任务的时候十分有用。 + +想一下如果你需要在特定的时间执行相同的命令,这种情况该怎么办呢? + +命令‘at’就能妥善解决这一情况。以下是‘at’使用示例。 + + at 10:38 PM Fri + at> cowsay 'hello' + at> CTRL + D + +上面的命令能在周五下午10时38分运行程序[cowsay][5]。 + +使用的语法就是‘at’后追加日期时间。当at>提示符出现后就可以输入你想在那个时间运行的命令了。 + +CTRL + D 返回终端。 + +还有许多日期和时间的格式,都需要你好好翻一翻‘at’的man手册来找到更多的使用方式。 + + +### 6. Man手册 ### + +![](http://f.tqn.com/y/linux/1/L/l/J/1/manmost.png) + +*彩色man 手册* + +Man手册会为你列出命令和参数的使用大纲,教你如何使用她们。Man手册看起来沉闷呆板。(我思忖她们也不是被设计来娱乐我们的)。 + +不过这不代表你不能做些什么来使她们变得漂亮些。 + + export PAGER=most + +你需要安装 ‘most’;她会使你的你的man手册的色彩更加绚丽。 + +你可以用以下命令给man手册设定指定的行长: + + export MANWIDTH=80 + +最后,如果你有一个可用的浏览器,你可以使用-H在默认浏览器中打开任意的man页。 + + man -H + +注意啦,以上的命令只有在你将默认的浏览器设置到环境变量$BROWSER中了之后才效果哟。 + + +### 7. 使用htop查看和管理进程 ### + +![View Processes With htop.](http://f.tqn.com/y/linux/1/L/r/J/1/nohup2.png) + +*使用htop查看进程。* + +你用哪个命令找出电脑上正在运行的进程的呢?我敢打赌是‘[ps][6]’并在其后加不同的参数来得到你所想要的不同输出。 + +安装‘[htop][7]’吧!绝对让你相见恨晚。 + +htop在终端中将进程以列表的方式呈现,有点类似于Windows中的任务管理器。你可以使用功能键的组合来切换排列的方式和展示出来的项。你也可以在htop中直接杀死进程。 + +在终端中简单的输入htop即可运行。 + + htop + +### 8. 使用ranger浏览文件系统 ### + +![Command Line File Manager - Ranger.](http://f.tqn.com/y/linux/1/L/s/J/1/ranger.png) + +*命令行文件管理 - Ranger* + +如果说htop是命令行进程控制的好帮手,那么[ranger][8]就是命令行浏览文件系统的好帮手。 + +你在用之前可能需要先安装,不过一旦安装了以后就可以在命令行输入以下命令启动她: + + ranger + +在命令行窗口中ranger和一些别的文件管理器很像,但是相比上下结构布局,她是左右结构的,这意味着你按左方向键你将前进到上一个文件夹,而右方向键则会切换到下一个。 + +在使用前ranger的man手册还是值得一读的,这样你就可以用快捷键操作ranger了。 + + +### 9. 取消关机 ### + +![Cancel Linux Shutdown.](http://f.tqn.com/y/linux/1/L/t/J/1/shutdown.png) + +*Linux取消关机。* + +无论是在命令行还是图形用户界面[关机][9]后,才发现自己不是真的想要关机。 + + shutdown -c + +需要注意的是,如果关机已经开始则有可能来不及停止关机。 + +以下是另一个可以尝试命令: + +- [pkill][10] shutdown + + +### 10. 杀死挂起进程的简单方法 ### + +![Kill Hung Processes With XKill.](http://f.tqn.com/y/linux/1/L/u/J/1/killhungprocesses.png) + +*使用XKill杀死挂起进程。* + +想象一下,你正在运行的应用程序不明原因的僵死了。 + +你可以使用‘ps -ef’来找到该进程后杀掉或者使用‘htop’。 + +有一个更快、更容易的命令叫做[xkill][11]。 + +简单的在终端中输入以下命令并在窗口中点击你想杀死的应用程序。 + + xkill + +那如果整个系统挂掉了怎么办呢? + +按住键盘上的‘alt’和‘sysrq’不放,然后慢慢输入以下键: + +- [REISUB][12] + +这样不按电源键你的计算机也能重启了。 + + +### 11. 下载Youtube视频 ### + +![youtube-dl.](http://f.tqn.com/y/linux/1/L/v/J/1/youtubedl2.png) + +*youtube-dl.* + +一般来说我们大多数人都喜欢看Youtube的视频,也会通过钟爱的播放器播放Youtube的流媒体。 + +如果你需要离线一段时间(比如:从苏格兰南部坐飞机到英格兰南部旅游的这段时间)那么你可能希望下载一些视频到存储设备中,到闲暇时观看。 + +你所要做的就是从包管理器中安装youtube-dl。 + +你可以用以下命令使用youtube-dl: + + youtube-dl url-to-video + +你可以在Youtubu视频页面点击分享链接得到视频的url。只要简单的复制链接在粘帖到命令行就行了(要用shift + insert快捷键哟)。 + +### 总结 ### + +希望你在这篇文章中得到帮助,并且在这11条中找到至少一条让你惊叹“原来可以这样”的技巧。 + +-------------------------------------------------------------------------------- + +via: http://linux.about.com/od/commands/tp/11-Linux-Terminal-Commands-That-Will-Rock-Your-World.htm + +作者:[Gary Newell][a] +译者:[martin2011qi](https://github.com/martin2011qi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linux.about.com/bio/Gary-Newell-132058.htm +[1]:http://linux.about.com/cs/linux101/g/sudo.htm +[2]:http://linux.about.com/library/cmd/blcmdl1_nohup.htm +[3]:http://linux.about.com/od/mobiledevicesother/a/Raspberry-Pi-Computer-Running-Linux.htm +[4]:http://linux.about.com/od/commands/l/blcmdl1_ssh.htm +[5]:http://linux.about.com/cs/linux101/g/cowsay.htm +[6]:http://linux.about.com/od/commands/l/blcmdl1_ps.htm +[7]:http://www.linux.com/community/blogs/133-general-linux/745323-5-commands-to-check-memory-usage-on-linux +[8]:http://ranger.nongnu.org/ +[9]:http://linux.about.com/od/commands/l/blcmdl8_shutdow.htm +[10]:http://linux.about.com/library/cmd/blcmdl1_pkill.htm +[11]:http://linux.about.com/od/funnymanpages/a/funman_xkill.htm +[12]:http://blog.kember.net/articles/reisub-the-gentle-linux-restart/ +[13]:http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-The-Terminal-In-Background-Mode.htm diff --git a/published/201505/20150318 How to share a directory with Samba on Fedora or CentOS.md b/published/201505/20150318 How to share a directory with Samba on Fedora or CentOS.md new file mode 100644 index 0000000000..e8e48ba76d --- /dev/null +++ b/published/201505/20150318 How to share a directory with Samba on Fedora or CentOS.md @@ -0,0 +1,144 @@ +如何在Fedora或CentOS上使用Samba共享文件夹 +================================================================================ +如今,无论在家里或者是办公场所,不同的电脑之间共享文件夹已不是什么新鲜事了。在这种趋势下,现代操作系统通过网络文件系统的方式使得电脑间数据的交换变得简单而透明。如果您工作的环境中既有微软的Windows又有Linux,那么,一个共享文件及目录的方式便是通过一个跨平台网络文件共享协议:SMB/CIFS。Windows原生的支持SMB/CIFS,Linux也通过开源的软件Samba实现了SMB/CIFS协议。 + +在这篇文章中,我们将展示**如何使用Samba共享文件夹**。我们使用的Linux平台是**Fedora或CentOS**。这篇文章分为四部分。首先,我们在Fedora/CentOS环境下安装Sambe。接着,我们讨论如何调整SELinux和防火墙配置以允许Samba的文件共享。最后我们介绍如何使用Samba来共享文件夹。 + +### 步骤1:在Fedora和CentOS上安装Samba ### + +首先,安装Samba以及进行一些基本的配置。 + +检验Samba是否已经安装在您的系统中: + + $ rpm -q samba samba-common samba-client + +如果上面的命令没有任何输出,这意味着Samba并未安装。这时,应使用下面的命令来安装Samba。 + + $ sudo yum install samba samba-common samba-client + +接下来,创建一个用于在网络中共享的本地文件夹。这个文件夹应该以Samba共享的方式导出到远程的用户。在这个指南中,我们会在顶层文件夹'/'中创建这个文件夹,因此,请确保您有相应的权限。 + + $ sudo mkdir /shared + +如果您想在您的home文件夹内创建共享文件夹(例如,~/shared),您必须激活SELinux中Samba的home文件夹共享选项,具体将在后面提到。 + +在创建/shared文件夹后,设置文件夹权限以保证其余用户可以访问它。 + + $ sudo chmod o+rw /shared + +如果您不想其他用户对该文件夹拥有写权限,您需要移除命令中的'w'选项。 + + $ sudo chmod o+r /shared + +接下来,创建一个空文件来测试。这个文件可以被用来验证Samba的共享已经被挂载。 + + $ sudo touch /shared/file1 + +### 步骤2:为Samba配置SELinux ### + +接下来,我们需要再次配置SELinux。在Fedora和CentOS发行版中SELinux是默认开启的。SELinux仅在正确的安全配置下才允许Samba读取和修改文件或文件夹。(例如,加上'samba_share_t'属性标签)。 + +下面的命令为文件的配置添加必要的标签: + + $ sudo semanage fcontext -a -t samba_share_t "(/.*)?" + +将替换为我们之前为Samba共享创建的本地文件夹(例如,/shared): + + $ sudo semanage fcontext -a -t samba_share_t "/shared(/.*)?" + +我们必须执行restorecon命令来激活修改的标签,命令如下: + + $ sudo restorecon -R -v /shared + +![](https://farm9.staticflickr.com/8584/16652774078_2055f45f70_b.jpg) + +为了通过Samba共享在我们home文件夹内的文件夹,我们必须在SELinux中开启共享home文件夹的选项,该选项默认被关闭。下面的命令能达到该效果。如果您并未共享您的home文件夹,那么您可以跳过该步骤。 + + $ sudo setsebool -P samba_enable_home_dirs 1 + +### 步骤3:为Samba配置防火墙 ### + +下面的命令用来打开防火墙中Samba共享所需的TCP/UDP端口。 + +如果您在使用firewalld(例如,在Fedora和CentOS7下),接下来的命令将会永久的修改Samba相关的防火墙规则。 + + $ sudo firewall-cmd --permanent --add-service=samba + +如果您在防火墙中使用iptables(例如,CentOS6或者更早的版本),可以使用下面的命令来打开Samba必要的向外的端口。 + + $ sudo vi /etc/sysconfig/iptables + +---------- + + -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 445 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT + -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT + +然后重启iptables服务: + + $ sudo service iptables restart + +### 步骤4:更改Samba配置 ### + +后面的步骤用来配置Samba以将本地文件夹导出为Samba共享文件夹。 + +使用文件编辑器打开Samba配置文件,并将下面的行添加到文件的末尾。 + + $ sudo nano /etc/samba/smb.conf + +---------- + + [myshare] + comment=my shared files + path=/shared + public=yes + writeable=yes + +上面在括号内的文本(例如,"myshare")是Samba共享的资源的名字,它被用来从远程主机存取Samba共享。 + +创建Samba用户帐户,这是挂载和导出Samba文件系统所必须的。我们可以使用smbpasswd工具来创建一个Samba用户。注意,Samba用户帐户必须是已有的Linux用户。如果您尝试使用smbpasswd添加一个不存在的用户,它会返回一个错误的消息。 + +如果您不想使用任何已存在的Linux用户作为Samba用户,您可以在您的系统中创建一个新的用户。为安全起见,设置新用户的登录脚本为/sbin/nologin,并且不创建该用户的home文件夹。 + +在这个例子中,我们创建了一个名叫"sambaguest"的用户,如下: + + $ sudo useradd -M -s /sbin/nologin sambaguest + $ sudo passwd sambaguest + +![](https://farm9.staticflickr.com/8702/16814479366_53f540d3ba_b.jpg) + +在创建一个新用户后,使用smbpasswd命令添加Samba用户。当这个命令询问一个密码时,您可以键入一个与其用户密码不同的密码。 + + $ sudo smbpasswd -a sambaguest + +激活Samba服务,并检测Samba服务是否在运行。 + + $ sudo systemctl enable smb.service + $ sudo systemctl start smb.service + $ sudo systemctl is-active smb + +![](https://farm8.staticflickr.com/7607/16652984770_622f24bccc_b.jpg) + +使用下面的命令来查看Samba中共享的文件夹列表。 + + $ smbclient -U sambaguest -L localhost + +![](https://farm8.staticflickr.com/7281/16220411103_06bf585901_b.jpg) + +接下来是在Thunar文件管理器中访问Samba共享文件夹以及对file1进行拷贝复制的截图。注意,Samba的共享内容可以通过在Thunar中通过 `smb:///myshare` 这个地址来访问。 + +![](https://farm8.staticflickr.com/7644/16218011174_c8b34fcedc_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/share-directory-samba-fedora-centos.html + +作者:[Kristophorus Hadiono][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/kristophorus diff --git a/published/201505/20150320 Locate Stolen laptops and Smart phones Using Prey Tool in Ubuntu.md b/published/201505/20150320 Locate Stolen laptops and Smart phones Using Prey Tool in Ubuntu.md new file mode 100644 index 0000000000..168032e2a4 --- /dev/null +++ b/published/201505/20150320 Locate Stolen laptops and Smart phones Using Prey Tool in Ubuntu.md @@ -0,0 +1,71 @@ +使用Prey定位被盗的Ubuntu笔记本与智能电话 +=============================================================================== +Prey是一款跨平台的开源工具,可以帮助你找回被盗的笔记本,台式机,平板和智能手机。它已经获得了广泛的流行,声称帮助找回了成百上千台丢失的笔记本和智能手机。Prey的使用特别简单,首先安装在你的笔记本或者手机上,当你的设备不见了,用你的账号登入Prey网站,并且标记你的设备为“丢失”。只要小偷将设备接入网络,Prey就会马上发送设备的地理位置给你。如果你的笔记本有摄像头,它还会拍下该死的贼。 + +Prey占用很小的系统资源;你不会对你的设备运行有任何影响。你也可以配合其他你已经在设备上安装的防盗软件使用。Prey在你的设备与Prey服务器之间采用安全加密的通道进行数据传输。 + +### 在Ubuntu上安装并配置Prey ### + +让我们来看看如何在Ubuntu上安装和配置Prey,需要提醒的是,在配置过程中,我们必须到Prey官网进行账号注册。一旦完成上述工作,Prey将会开始监视你的设备了。免费的账号最多可以监视三个设备,如果你需要添加更多的设备,你就需要购买合适的的套餐了。 + +可以想象Prey多么流行与被广泛使用,它现在已经被添加到了官方的软件库中了。这意味着你不要往软件包管理器添加任何PPA。很简单,登录你的终端,运行以下的命令来安装它: + + sudo apt-get install prey + +![Install Prey](http://blog.linoxide.com/wp-content/uploads/2015/03/Install-Prey.png) + +![Install Prey 1](http://blog.linoxide.com/wp-content/uploads/2015/03/Install-Prey-1.png) + +Prey是十分轻巧的软件,只使用了系统几兆的空间,安装完成后,从Application >> Prey启动,之后它会询问你进行相关配置。 + +选择“New User”,如果你是第一次使用的话。 + +![Prey New User](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-New-User.png) + +第二步实际上就是官网注册的流程。请提供你的用户名,邮箱地址和密码,来申清一个免费的账号。 + +![Register Prey](http://blog.linoxide.com/wp-content/uploads/2015/03/Register-Prey.png) + +点击“Apply”完成,所有工作搞定,现在你的计算机被Prey保护了。 + +![Prey Configuration](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-Configuration.png) + +登录你最新建立的[Prey 账号][1],你就应该可以在“Devices”菜单下看见你的设备信息了。 + +![Prey Web Login](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-Web-Login.png) + +只要你的笔记本或者任何其他设备丢失了,就登录你的Prey网站账号,然后点击“Set Device to Missing”选项修改设备状态为“missing”。 + +![Prey Missing Page](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-Missing-1.png) + +从这里选择定时报告,并点击“Yes,my device is missing”。定时报告选项是指一段时间间隔后,软件会更新并发送给你设备的地理位置。它还会从网页界面那发邮件给你,只要设备的状态改变了。 + +![Prey Missing Email](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-Missing-2.png) + +而一旦被盗的设备接入了互联网,Prey就会马上发送报告给你,包括设备的地理位置和IP地址。 + +![Prey Found Report](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-Missing-3.png) + +点击报告链接,你应该会看到设备的地理位置和IP地址。 + +![Prey Final](http://blog.linoxide.com/wp-content/uploads/2015/03/Prey-Final.png) + +Prey有一个明显的不足。它需要你的设备接入互联网才会发送地理位置给你,如果小偷比较聪明,在接入网络前将你的设备磁盘格式化了,那么你就永远不会收到设备被发现的报告了。但是这里仍然是有一个方法克服这个不足,确保添加一个BIOS密码,并且禁用从可移除的设备里启动系统。 + +### 结论 ### + +这是一款小巧,非常有用的安全保护应用,可以让你在一个地方追踪你所有的设备,尽管不完美,但是仍然提供了找回被盗设备的机会。它在Linux,Windows和Mac平台上无缝运行。以上就是[Prey][2]完整使用的所有细节。 + +------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/anti-theft-application-prey-ubuntu/ + +作者:[Aun Raza][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ +[1]:https://preyproject.com/ +[2]:https://preyproject.com/plans diff --git a/published/201505/20150320 Sleuth Kit--Open Source Forensic Tool to Analyze Disk Images and Recover Files.md b/published/201505/20150320 Sleuth Kit--Open Source Forensic Tool to Analyze Disk Images and Recover Files.md new file mode 100644 index 0000000000..ba4da99105 --- /dev/null +++ b/published/201505/20150320 Sleuth Kit--Open Source Forensic Tool to Analyze Disk Images and Recover Files.md @@ -0,0 +1,159 @@ +Sleuth Kit:一个用来分析磁盘映像和恢复文件的开源取证工具 +================================================================================ +SIFT 是一个由 SANS 公司提供的基于 Ubuntu 的取证发行版。它包含许多取证工具,如 Sleuth kit/Autopsy 。但 Sleuth kit/Autopsy 可以直接在 Ubuntu 或 Fedora 发行版本上直接安装,而不必下载 SIFT 的整个发行版本。 + +Sleuth Kit/Autopsy 是一个开源的电子取证调查工具,它可以用于从磁盘映像中恢复丢失的文件,以及为了特殊事件进行磁盘映像分析。 Autopsy 工具是 sleuth kit 的一个网页接口,支持 sleuth kit 的所有功能。这个工具在 Windows 和 Linux 平台下都可获取到。 + +### 安装 Sleuth kit ### + +首先,从 [sleuthkit][1] 的网站下载 Sleuth kit 软件。使用下面的命令在虚拟终端下使用 wget 命令来下载它,下图展示了这个过程。 + + # wget http://cznic.dl.sourceforge.net/project/sleuthkit/sleuthkit/4.1.3/sleuthkit-4.1.3.tar.gz + +![下载 Sleuth Kit](http://blog.linoxide.com/wp-content/uploads/2015/03/download-sleuthkeit.png) + +使用下面的命令解压 sleuthkit-4.1.3.tar.gz 并进入解压后的目录: + + # tar -xvzf sleuthkit-4.1.3.tar.gz + +![解压过程](http://blog.linoxide.com/wp-content/uploads/2015/03/extract.png) + +在安装 sleuth kit 之前,运行下面的命令来执行所需的检查: + + #./configure + +![configure](http://blog.linoxide.com/wp-content/uploads/2015/03/configure.png) + +然后使用 Make 命令来编译 sleuth kit : + + #make + +![make](http://blog.linoxide.com/wp-content/uploads/2015/03/make.png) + +最后,使用下面的命令将它安装到 **/usr/local** 目录下: + + #make install + +![make install](http://blog.linoxide.com/wp-content/uploads/2015/03/make-install.png) + +### 安装 Autopsy 工具 ### + +Sleuth kit 已经安装完毕,现在我们将为它安装 autopsy 界面。从 [sleuthkit 的 autopsy 页面][2]下载 Autopsy 软件。使用下面的命令在虚拟终端下使用 wget 命令来下载它,下图展示了这个过程。 + + # wget http://kaz.dl.sourceforge.net/project/autopsy/autopsy/2.24/autopsy-2.24.tar.gz + +![Autpsy 的下载链接](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy.png) + +使用下面的命令解压 autopsy-2.24.tar.gz 并进入解压后的目录: + + # tar -xvzf autopsy-2.24.tar.gz + +![Autopsy 的解压](http://blog.linoxide.com/wp-content/uploads/2015/03/Autopsy-extraction.png) + +autopsy 的配置脚本将询问 NSRL (National Software Reference Library) 和 **Evidence_Locker** 文件夹的路径。 + +当弹窗问及 NSRL 时,输入 "n",并在 **/usr/local** 目录下创建名为 Evidence_Locker 的文件夹。Autopsy 将在 Evidence_Locker 文件夹下存储配置文件,审计记录和输出文件。 + + #mkdir /usr/local/Evidence_Locker + + #cd autopsy-2.24 + + #./configure + +![Autopsy 配置脚本](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-configuration.png) + +在安装过程中添加完 Evidence_Locker 的安装路径后, autopsy 在那里存储配置文件并展现如下的信息来运行 autopsy 程序。 + +![启动 Autopsy](http://blog.linoxide.com/wp-content/uploads/2015/03/start-autopsy.png) + +在虚拟终端中键入 **./autopsy** 命令来启动 Sleuth kit 工具的图形界面: + +![Autopsy](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-started.png) + +在浏览器中键入下面的地址来访问 autopsy 的界面: + + http://localhost:9999/autopsy + +下图展现了 autopsy 插件的主页面: + +![主页](http://blog.linoxide.com/wp-content/uploads/2015/03/main-interface.png) + +在 autopsy 工具中,点击 **新案例** 按钮来开始进行分析。键入案例名称,此次调查的描述和检查人的姓名,下图有具体的展示: + +![创建新事件](http://blog.linoxide.com/wp-content/uploads/2015/03/create-new-case1.png) + +在接下来的网页中,将展示在上一个的网页中键入的详细信息。接着点击 **增加主机** 按钮来添加有关要分析的机器的详细信息。 + +![增加主机](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host1.png) + +在下一个网页中键入主机名,相关的描述和要分析的机器的时区设置。 + +![添加主机的详细信息](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host-detial.png) + +添加主机后,点击 **增加映像** 按钮来为取证分析添加映像文件。 + +![添加映像](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image.png) + +在接下来的网页中点击 **增加映像文件** 按钮。它将打开一个新的网页,来询问映像文件的路径和选择映像的类型以及导入的方法。 + +![添加映像文件](http://blog.linoxide.com/wp-content/uploads/2015/03/Add-image-file.png) + +正如下图中展示的那样,我们已经键入了 Linux 映像文件的路径。在我们这个例子中,映像文件类型是磁盘分区。 + +![添加映像分区](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image-parition.png) + +点击“下一步”按钮并在下一页中选择 **计算散列值** 的选项,这在下图中有展示。它也将检测所给映像的文件系统类型。 + +![映像和文件系统详情](http://blog.linoxide.com/wp-content/uploads/2015/03/image-and-file-system-detail.png) + +下面的图片展示了静态分析之前映像文件的 MD5 散列值。 + +![散列值](http://blog.linoxide.com/wp-content/uploads/2015/03/hash1.png) + +在下一个网页中, autopsy 展现了有关映像文件的如下信息: + +- 映像的挂载点 +- 映像的名称 +- 所给映像的文件系统类型 + +点击 **详情** 按钮来获取更多有关所给映像文件的信息。它还提供了从映像文件的卷中导出未分配的片段和字符串的数据信息,这在下图中有展现。 + +![映像的详细信息](http://blog.linoxide.com/wp-content/uploads/2015/03/image-details.png) + +在下图中那样,点击 **分析** 按钮来开始分析所给映像。它将开启另一个页面,其中包含了映像分析的多个选项。 + +![分析](http://blog.linoxide.com/wp-content/uploads/2015/03/analysis1.png) + +在映像分析过程中,Autopsy 提供了如下的功能: + +- 文件分析 +- 关键字搜索 +- 文件类型 +- 映像详情 +- 数据单元 + +下图展示的是在给定的 Linux 分区映像上进行文件分析: + +![映像的分析](http://blog.linoxide.com/wp-content/uploads/2015/03/Analysis-of-image.png) + +它将从所给映像中提取所有的文件和文件夹。在下图中也展示了已被删除的文件的提取: + +![已被删除的文件](http://blog.linoxide.com/wp-content/uploads/2015/03/deleted.png) + +### 结论 ### + +希望这篇文章能够给那些进入磁盘映像静态分析领域的新手提供帮助。Autopsy 是 sleuth kit 的网页界面,提供了在 Windows 和 Linux 磁盘映像中进行诸如字符串提取,恢复被删文件,时间线分析,网络浏览历史,关键字搜索和邮件分析等功能。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/autopsy-sleuth-kit-installation-ubuntu/ + +作者:[nido][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/naveeda/ +[1]:http://www.sleuthkit.org/sleuthkit/download.php +[2]:http://www.sleuthkit.org/autopsy/download.php \ No newline at end of file diff --git a/published/201505/20150323 How to enable ssh login without entering password.md b/published/201505/20150323 How to enable ssh login without entering password.md new file mode 100644 index 0000000000..8202bc62cd --- /dev/null +++ b/published/201505/20150323 How to enable ssh login without entering password.md @@ -0,0 +1,41 @@ +如何实现ssh无密码登录 +================================================================================ +假设你是hostA上的一个用户"aliceA",想以用户“aliceB”的身份ssh到hostB上,但又不想输入密码。那么,你可以参考这篇教程实现ssd无密码登录。 + +首先,你需要以用户“aliceA”的身份登录到hostA上。 + +然后,使用ssh-keygen生成一对rsa公私钥,生成的密钥对会存放在~/.ssh目录下。 + + $ ssh-keygen -t rsa + +接下来,使用下面的命令在目标主机hostB上的aliceB用户目录下创建~/.ssh目录。如果在aliceB@hostB上已经存在.ssh目录,这一步会被略过。 + + $ ssh aliceB@hostB mkdir -p .ssh + +最后,将hostA上用户“aliceA”的公钥拷贝到aliceB@hostB上,来实现无密码ssh。 + + $ cat .ssh/id_rsa.pub | ssh aliceB@hostB 'cat >> .ssh/authorized_keys' + +自此以后,从aliceA@hostA上ssh到aliceB@hostB上再也不需要输入密码。(LCTT 译注:上述的创建目录并复制的操作也可以通过一个 ssh-copy-id 命令一步完成:`ssh-copy-id -i ~/.ssh/id_rsa.pub aliceB@hostB`) + +### 疑难解答 ### + +1. 即使在密钥认证生效后,你可能仍然需要输入SSH密码。如果遇到这种情况,请检查系统日志(如/var/log/secure)以查看是否出现下面的异常。 + + Authentication refused: bad ownership or modes for file /home/aliceB/.ssh/authorized_keys + +在这种情况下,密钥认证的失败是由于~/.ssh/authorized_keys文件的权限或拥有者不正确。一般情况,如果这个文件对除了你之外的所有用户都可读,就会出现这个错误。用下面的方式改变文件的权限以修正错误。 + + $ chmod 700 ~/.ssh/authorized_keys + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/how-to-enable-ssh-login-without.html + +作者:[Dan Nanni][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni \ No newline at end of file diff --git a/published/201505/20150323 Linux FAQs with Answers--How to compress JPEG images from the command line on Linux.md b/published/201505/20150323 Linux FAQs with Answers--How to compress JPEG images from the command line on Linux.md new file mode 100644 index 0000000000..6d08d4d7f6 --- /dev/null +++ b/published/201505/20150323 Linux FAQs with Answers--How to compress JPEG images from the command line on Linux.md @@ -0,0 +1,100 @@ +Linux有问必答:如何在命令行下压缩JPEG图像 +================================================================================ +> **问题**: 我有许多数码照相机拍出来的照片。我想在上传到Dropbox之前,优化和压缩下JPEG图片。有没有什么简单的方法压缩JPEG图片并不损耗他们的质量? + +如今拍照设备(如智能手机、数码相机)拍出来的图片分辨率越来越大。甚至3630万像素的Nikon D800已经冲入市场,并且这个趋势根本停不下来。如今的拍照设备不断地提高着照片分辨率,使得我们不得不压缩后,再上传到有储存限制、带宽限制的云。 + +事实上,这里有一个非常简单的方法压缩JPEG图像。一个叫“jpegoptim”命令行工具可以帮助你“无损”美化JPEG图像,让你可以压缩JPEG图片而不至于牺牲他们的质量。万一你的存储空间和带宽预算真的很少,jpegoptim也支持“有损”压缩来调整图像大小。 + +如果要压缩PNG图像,参考[这个指南][1]的例子。 + +### 安装jpegoptim ### + +Ubuntu, Debian 或 Linux Mint: + + $ sudo apt-get install jpegoptim + +Fedora: + + $ sudo yum install jpegoptim + +CentOS/RHEL安装,先开启[EPEL库][2],然后运行下列命令: + + $ sudo yum install jpegoptim + +### 无损压缩jpeg图像 ### + +为了无损地压缩一副JPG图片,使用: + + $ jpegoptim photo.jpg + +---------- + + photo.jpg 2048x1536 24bit N ICC JFIF [OK] 882178 --> 821064 bytes (6.93%), optimized. + +注意,原始图像会被压缩后图像覆盖。 + +如果jpegoptim不能无损美化图像,将不会覆盖它: + + $ jpegoptim -v photo.jpg + +---------- + + photo.jpg 2048x1536 24bit N ICC JFIF [OK] 821064 --> 821064 bytes (0.00%), skipped. + +如果你想保护原始图片,使用"-d"参数指明保存目录 + + $ jpegoptim -d ./compressed photo.jpg + +这样,压缩的图片将会保存在./compressed目录(以同样的输入文件名) + +如果你想要保护文件的创建修改时间,使用"-p"参数。这样压缩后的图片会得到与原始图片相同的日期时间。 + + $ jpegoptim -d ./compressed -p photo.jpg + +如果你只是想看看无损压缩率而不是真的想压缩它们,使用"-n"参数来模拟压缩,然后它会显示出压缩率。 + + $ jpegoptim -n photo.jpg + +### 有损压缩JPG图像 ### + +万一你真的需要要保存在云空间上,你还可以使用有损压缩JPG图片。 + +这种情况下,使用"-m<质量>"选项,质量数范围0到100。(0是最好质量,100是最差质量) + +例如,用50%质量压缩图片: + + $ jpegoptim -m50 photo.jpg + +---------- + + photo.jpg 2048x1536 24bit N ICC JFIF [OK] 882178 --> 301780 bytes (65.79%), optimized. + +在牺牲质量的基础上,将会得到一个更小的图片。 + +![](https://farm9.staticflickr.com/8707/16260736234_6d6f1d2434_c.jpg) + +### 一次压缩多张JPEG图像 ### + +最常见的情况是需要压缩一个目录下的多张JPEG图像文件。为了应付这种情况,你可以使用接下来的脚本。 + + #!/bin/sh + + # 压缩当前目录下所有*.jpg文件 + # 保存在./compressed目录 + # 并拥有与原始文件同样的修改日期 + for i in *.jpg; do jpegoptim -d ./compressed -p "$i"; done + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/compress-jpeg-images-command-line-linux.html + +作者:[Dan Nanni][a] +译者:[VicYu/Vic020](https://github.com/Vic020) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/how-to-compress-png-files-on-linux.html +[2]:https://linux.cn/article-2324-1.html diff --git a/published/201505/20150323 Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS.md b/published/201505/20150323 Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS.md new file mode 100644 index 0000000000..7c3db8a320 --- /dev/null +++ b/published/201505/20150323 Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS.md @@ -0,0 +1,121 @@ +Linux有问必答:如何在VPS上安装和访问CentOS 7远程桌面 +================================================================================ +> **提问**: 我想在VPS中安装CentOS桌面,并可以直接从我家远程访问GUI桌面。在VPS上设置和访问CentOS远程桌面有什么建议吗? + +如何远程办公或者远程弹性化工作制在技术领域正变得越来越流行。这个趋势背后的一个技术就是远程桌面。你的桌面环境在云中,你可以在任何你去的地方,或者在家或者工作场所访问你的远程桌面。 + +这个教程介绍如何VPS中设置基于CentOS的远程桌面。现在,我们会先展示CentOS的基础环境。 + +我们假设你已经创建了CentOS 7的VPS实例(比如,使用[DigitalOcean][1] 或者 Amazon EC2)。请确保你的VPS实例有至少1GB的内存。不然,CentOS将会在你访问远程桌面的时候回崩溃。 + +### 第一步: 安装CentOS桌面 ### + +如果你现在安装的CentOS版本是没有桌面的最小版本,你需要先在VPS上安装桌面(比如GNOME)。比如,DigitalOcean的镜像就是最小版本,它需要如下安装[桌面GUI][2] + + # yum groupinstall "GNOME Desktop" + +在安装完成之后重启VPS。 + +### 第二步:安装和配置VNC服务器 ### + +接下来就是安装和配置VNC服务器。我们使用的是TigerVNC,一个开源的VNC服务实现。 + + # yum install tigervnc-server + +现在创建一个用户账户(比如:xmodulo)用来访问远程桌面。 + + # useradd xmodulo + # passwd xmodulo + +当一个用户尝试使用VNC访问远程桌面时,VNC守护进程就会启动来处理这个请求。这意味着你需要为每个用户创建一个独立的VNC配置文件。 + +CentOS依靠systemd来管理和配置系统服务。所以我们将使用systemd来为用户xmodulo配置VNC服务器。 + +首先让我们使用下面任意一条命令来检查VNC服务器的状态。 + + # systemctl status vncserver@:.service + # systemctl is-enabled vncserver@.service + +默认的,刚安装的VNC服务并没有激活(禁用)。 + +![](https://farm8.staticflickr.com/7613/16877514732_8ccffe7b6b_b.jpg) + +现在复制一份通用的VNC服务文件来为用户xmodulo创建一个VNC服务配置。 + + # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service + +用本文编辑器来打开配置文件,用实际的用户名(比如:xmodulo)来替换[Service]下面的。同样。在ExecStart后面追加 "-geometry " 参数。最后,要修改下面“ExecStart”和“PIDFile”两行。 + + # vi /etc/systemd/system/vncserver@:1.service + +---------- + + [Service] + Type=forking + # Clean any existing files in /tmp/.X11-unix environment + ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' + ExecStart=/sbin/runuser -l xmodulo -c "/usr/bin/vncserver %i -geometry 1024x768" + PIDFile=/home/xmodulo/.vnc/%H%i.pid + ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :' + +现在为用户xmodulo设置密码(可选)。首先切换到该用户,并运行vncserver命令。 + + # su - xmodulo + # vncserver + +你会被提示输入用户的VNC密码。密码设置完成后,你下次需要用这个密码来访问你的远程桌面。 + +![](https://farm9.staticflickr.com/8752/16692564599_9c4e5da1b6_b.jpg) + +最后,重新加载服务来使新的VNC配置生效: + + # systemctl daemon-reload + +在启动时自动启动VNC服务: + + # systemctl enable vncserver@:1.service + +检查vnc服务正在监听的端口: + + # netstat -tulpn | grep vnc + +![](https://farm8.staticflickr.com/7625/16692646729_7bb16c4897_b.jpg) + +端口5901是VNC默认的客户端连接到VNC服务器使用的端口。 + +### 第三步:通过SSH连接到远程桌面 ### + +从设计上说,VNC使用的远程帧缓存(RFB)并不是一种安全的协议,那么在VNC客户端上直接连接到VNC服务器上并不是一个好主意。任何敏感信息比如密码都可以在VNC流量中被轻易地泄露。因此,我强烈建议使用SSH隧道来[加密你的VNC流量][3]。 + +在你要运行VNC客户端的本机上,使用下面的命令来创建一个连接到远程VPS的SSH通道。当被要输入SSH密码时,输入用户的密码。 + + $ ssh xmodulo@ -L 5901:127.0.0.1:5901 + +用你自己的VNC用户名来替换“xmodulo”,并填上你自己的VPS IP地址。 + +一旦SSH通道建立之后,远程VNC流量就会通过ssh通道路由并发送到127.0.0.1:5901。 + +现在启动你最爱的VNC客户端(比如:vinagre),来连接到127.0.0.1:5901。 + +![](https://farm8.staticflickr.com/7639/16691289910_fae83510fb_o.png) + +你将被要求输入VNC密码。当你输入VNC密码时,你就可以安全地连接到CentOS的远程桌面了。 + +![](https://farm8.staticflickr.com/7614/16877678411_aa8349f6b1_c.jpg) + +![](https://farm9.staticflickr.com/8702/16256320434_81f9b5b70c_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/centos-remote-desktop-vps.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/go/digitalocean +[2]:http://xmodulo.com/how-to-install-gnome-desktop-on-centos.html +[3]:http://xmodulo.com/how-to-set-up-vnc-over-ssh.html diff --git a/published/201505/20150323 Square 2.0 Icon Pack Is Twice More Beautiful.md b/published/201505/20150323 Square 2.0 Icon Pack Is Twice More Beautiful.md new file mode 100644 index 0000000000..cd8c8556a0 --- /dev/null +++ b/published/201505/20150323 Square 2.0 Icon Pack Is Twice More Beautiful.md @@ -0,0 +1,55 @@ +更漂亮的 Square 2.0图标包 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux_3.jpeg) + +优雅、现代的[Square图标主题][1]最近更新到了2.0版,它比以前更漂亮了。Square图标包与其他主要的桌面环境如**Unity、 GNOME、KDE、 MATE等等**兼容。这意味着你可以在所有的流行Linux发行版如Ubuntu、Fedora、Linux Mint、elementary OS等等中使用它。 这个图标包估计包含超过了15000个图标。 + +### 在Linux中安装Square 2.0图标包 ### + +有两种不同的Square图标,暗色和亮色。基于你的喜好,你可以选择二者之一。出于体验的目的,我建议你两个主题包都下载。 + +你可以用下面的链接下载图标包。文件存储在Google Drive,因此如果你没有看见像[SourceForge][2]这样标准的下载网站时不要怀疑。 + +- [Square Dark Icons][3] +- [Square Light Icons][4] + +要使用图标主题,解压下载的文件到~/.icons文件夹下。如果它不存在,就创建它。当这些文件放好后,基于你的桌面环境,使用一个工具来改变图标主题。我以前写了一些关于这个主题的教程。如果你需要额外的帮助,那么欢迎指出来: + +- [如何在Ubuntu Unity中改变主题][5] +- [如何在GNOME Shell中改变主题][6] +- [如何在Linux Mint中改变主题][7] +- [如何在Elementary OS Freya中改变主题][8] + +### 试一下 ### + +这是我用Square图标在Ubuntu 14.04中的效果。我背景使用的是[Ubuntu 15.04 默认壁纸][9]。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux_2.jpeg) + +Square主题中几个图标的样子: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux.jpeg) + +你觉得怎么样?你认为它是[Ubuntu 14.04中最佳的图标主题][10]之一么?你会分享它并期待更多关于自定义Linux桌面的文章么? + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/square-2-0-icon-pack-linux/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://gnome-look.org/content/show.php/Square?content=163513 +[2]:http://sourceforge.net/ +[3]:http://gnome-look.org/content/download.php?content=163513&id=1&tan=62806435 +[4]:http://gnome-look.org/content/download.php?content=163513&id=2&tan=19789941 +[5]:http://itsfoss.com/how-to-install-themes-in-ubuntu-13-10/ +[6]:http://itsfoss.com/install-switch-themes-gnome-shell/ +[7]:http://itsfoss.com/install-icon-linux-mint/ +[8]:http://itsfoss.com/install-themes-icons-elementary-os-freya/ +[9]:http://itsfoss.com/default-wallpapers-ubuntu-1504/ +[10]:http://itsfoss.com/best-icon-themes-ubuntu-1404/ diff --git a/published/201505/20150324 4 Tools to Securely Delete Files from Linux.md b/published/201505/20150324 4 Tools to Securely Delete Files from Linux.md new file mode 100644 index 0000000000..5926279c9e --- /dev/null +++ b/published/201505/20150324 4 Tools to Securely Delete Files from Linux.md @@ -0,0 +1,131 @@ +Linux 下四种安全删除文件的工具 +=============== + +任何一个普通水平的计算机用户都知道,从计算机系统中删除的任意数据都可以稍后通过一些努力恢复出来。当你不小心删除了你的重要数据时,这是一个不错的方案。但是大多数情况,你不希望你的隐私数据被轻易地恢复。不论何时,我们删除的任意文件,操作系统删除的仅仅是对特定数据的索引。这就意味着,数据仍然保存在磁盘的某块地方,这种方法是不安全的,任何一个聪明的计算机黑客可以使用各种不错的数据恢复工具来恢复你删除的数据。Linux 用户利用我们都知晓的 "rm" 命令来从他们的操作系统中删除数据,但是 "rm" 命令也是像上面说的那样删除文件。从这个命令删除的数据也可以使用特殊的文件恢复工具恢复。 + +让我们看看怎样安全并完整地从你的 Linux 系统中删除文件或者文件夹。以下提到的工具可以完全地删除数据,因此那些恢复工具很难找到真实数据的痕迹然后恢复它。 + +### Secure-Delete ### + +Secure-Delete 是一组为 Linux 操作系统而生的工具集合,他们为永久删除文件提供了先进的技术支持。一旦 Secure-Delete 安装在各种 Linux 系统上,就提供了如下的四个命令: + +- srm +- smem +- sfill +- sswap + +在 ubuntu 的终端中运行如下命令安装此工具: + + sudo apt-get install secure-delete + +![secure delete](http://blog.linoxide.com/wp-content/uploads/2015/03/secure-delete.png) + +在 RHEL,Fedora 或者 Centos 中运行如下命令安装此工具: + + sudo yum install secure-delete + +“**srm**” 命令的工作方式和 "rm" 命令类似,但是它不仅仅是删除文件,它首先使用一些随机的数据重写数次文件,然后彻底地删除此文件。这个命令的语法是相当地简单,仅仅指定要删除的文件或者目录,然后它会负责此任务。 + + sudo srm /home/aun/Documents/xueo/1.png + +"**sfill**" 检测在指定的分区或者目录被标记为空闲或者可用的空间,然后使用它自身的算法用一些随机数据填充。因此它保证了在此分区没有可以恢复的文件或者文件夹。 + + sudo sfill /home + +"**sswap**" 命令用来安全地清除你的交换分区。交换分区用来存放运行程序的数据。首先我们需要运行如下命令来找到你的交换分区。 + + cat /proc/swaps + +如下是上述命令的输出示例: + + aun@eagle:~$ cat /proc/swaps + Filename Type Size Used Priority + /dev/sda5 partition 2084860 71216 -1 + +从现在起,你可以看到你的交换分区设置在哪个分区,然后使用如下命令安全地清除。替换 "/dev/sda5" 部分为你的交换分区名字。 + + sudo sswap /dev/sda5 + +“**smem**” 用来清理在内存中的内容,虽然当系统重启或者关机时会清理随机存取存储器(RAM)中的内容,但是内存中仍然会保留一些数据的残留痕迹。这个命令提供安全的内存清理,简单地在终端中运行 smem 命令即可。 + + smem + +### Shred ### + +"shred" 命令以一种不可恢复的方式来销毁文件或者文件夹的内容。它使用随机生成的数据模式来持续覆写文件,因此很难恢复任意的被销毁的数据,即使是那些黑客或者窃贼使用高水平的数据恢复工具或者设备。Shred 默认安装在所有 Linux 发行版中,如果你想,你可以运行如下命令来找到它的安装目录: + + aun@eagle:~$ whereis shred + + shred: /usr/bin/shred /usr/share/man/man1/shred.1.gz + +使用 shred 工具运行如下命令来删除文件: + + shred /home/aun/Documents/xueo/1.png + +使用 shred 运行如下命令来删除任意的分区,用你期望的分区来替换分区名字。 + + shred /dev/sda5 + +Shred 默认情况下使用随机内容重写数据 25 次。如果你想它重写文件更多次数,可以使用 "shred -n" 选项来简单地指定你所期望的次数。 + + shred -n 100 filename + +如果你想在重写后截断或者删除文件,使用 "shred -u" 选项: + + shred -u filename + +### dd ### + +这个命令起初是用于磁盘克隆的。它用于将一个分区或者一个磁盘复制到另一个分区或者磁盘。但是它还可用于安全地清除硬盘或者分区的内容。运行如下命令使用随机数据来重写你的当前数据。你不需要安装 dd 命令,所有的 Linux 分发版都已经包含了此命令。 + + sudo dd if=/dev/random of=/dev/sda + +你也可以覆写磁盘或者分区中的内容,只需要简单地将所有替换为 “zero”。 + + sudo dd if=/dev/zero of=/dev/sda + +### Wipe ### + +Wipe 起初开发的目的是从磁性介质中安全地擦除文件。这个命令行工具使用特殊的模式来重复地写文件。它使用 fsync() 调用和/或 O_SYNC 位来强制访问磁盘,并且使用 Gutmann 算法来重复地写。你可以使用此命令删除单个文件、文件夹或者整个磁盘的内容,但是使用 wipe 命令来删除整个磁盘的模式会耗费大量的时间。另外,安装和使用这个工具相当容易。 + +在 ubuntu 的终端中运行如下命令来安装 wipe。 + + sudo aptitude install wipe + +![Wipe Linux](http://blog.linoxide.com/wp-content/uploads/2015/03/wipe.png) + +使用如下命令在 Redhat Linux,Centos 或者 Fedora 中安装 Wipe: + + sudo yum install wipe + +一旦安装完成,在终端中运行如下命令来获得完整的可用选项列表: + + man wipe + +删除任意文件或者目录: + + wipe filename + +运行如下命令来安全地移除 tmp 分区: + + wipe -r /tmp + +使用如下的命令来删除完整分区的内容(替换分区名字为你所期望的分区)。 + + wipe /dev/sda1 + +### 小结 ### + +我们期望这篇文章对你有帮助,你的数据隐私是有决定性意义的,在你的系统中安装这些安全的删除工具对你来说非常重要,因此你可以删除你的隐私数据而不用担心它们被轻易地恢复。上面提到的所有工具都是相当轻量的,它们只需要耗费最低的系统资源来运行,并且无论如何也不会影响你的系统性能。享受它们带来的便利吧! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/security/delete-files-permanatly-linux/ + +作者:[Aun Raza][a] +译者:[dbarobin](https://github.com/dbarobin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ \ No newline at end of file diff --git a/published/201505/20150324 7 Quirky' ls' Command Tricks Every Linux User Should Know.md b/published/201505/20150324 7 Quirky' ls' Command Tricks Every Linux User Should Know.md new file mode 100644 index 0000000000..b41338034f --- /dev/null +++ b/published/201505/20150324 7 Quirky' ls' Command Tricks Every Linux User Should Know.md @@ -0,0 +1,163 @@ +Linux用户应知应会的7个‘ls’命令的独特技巧 +================================================================================ + +在前面我们系列报道的两篇文章中,我们已经涵盖了关于‘ls’命令的绝大多数内容。本文时‘ls命令’系列的最后一部分。如果你还没有读过该系列的其它两篇文章,你可以访问下面的链接。 + +- [Linux中的15个基本‘ls’命令示例][1] +- [15 个‘ls’命令的面试问题(一)][2] +- [10 个‘ls’命令面试的问题(二)][3] + +![7 Quirky ls Command Tricks](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-tricks.jpg) + +*7个ls命令独特技巧* + +### 1. 以各种时间格式附带时间戳列出目录中的内容 ### + +要以时间格式列出目录内容,我们需要选择以下两种方法中的任何一种。 + + # ls -l –time-style=[STYLE] (方法 A) + +**注意** - 上面的开关`--time`的格式必须和`-l`开关同时使用,否则达不到目的。 + + # ls -full-time (方法 B) + +可以用以下任何一个选项替换`[STYLE]`。 + + full-iso + long-iso + iso + locale + +%H:%M:%S:%D + +**注意** - 在上面行中,H(时),M(分),S(秒),D(日)的顺序可以任意调整。此外,你只需选择那些相关的选项,而不是所有选项。例如,`ls -l --time-style=+%H`将只显示小时。`ls -l --time-style=+%H:%M:%D`将显示小时、分钟和日。 + + # ls -l --time-style=full-iso + +![ls Command Full Time Style](http://www.tecmint.com/wp-content/uploads/2015/03/ls-Command-Full-Time-Style.gif) + +*ls命令的完整 ISO时间格式* + + # ls -l --time-style=long-iso + +![Long Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Long-Time-Listing-Format.gif) + +*长时间格式列表* + + # ls -l --time-style=iso + +![Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Local-Time-Style-Listing.gif) + +*时间格式列表* + + # ls -l --time-style=locale + +![Locale Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Hour-Mintue-Time-Style-Listing.gif) + +*本地时间格式列表* + + # ls -l --time-style=+%H:%M:%S:%D + +![Date and Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Time-Style-Listing.gif) + +*日期和时间格式列表* + + # ls --full-time + +![Full Style Time Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Style-Time-Listing.gif) + +*完整格式时间列表* + +### 2. 以多种格式列出目录内容,如以逗号分隔、水平格式、长格式、垂直格式、交叉格式等列出。 ### + +目录内容可以用以下建议的ls命令各种格式列出: + + # ls --format=across # 交叉 + # ls --format=comma # 逗号 + # ls --format=horizontal # 水平 + # ls --format=long # 长格式 + # ls --format=single-column # 单栏 + # ls --format=verbose # 详情 + # ls --format=vertical # 垂直 + +![Listing Formats of ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-Listing-Formats.gif) + +*ls命令的列出格式* + +### 3. 使用ls命令为目录内容输出结果添加像(/=@|)这样的指示符。 ### + +带有`-p`选项的ls命令将实现该目的。它会根据文件类型添加上面这些指示符其中之一。 + + # ls -p + +![Append Indicators to Content](http://www.tecmint.com/wp-content/uploads/2015/03/Append-Indicators.gif) + +*添加指示符到内容* + +### 4. 根据扩展名、大小、时间和版本对目录内容排序。 ### + +我们可以使用`--extension`选项来按照扩展名对输出结果排序,`--size`扩展选项按照大小排序,`-t`扩展选项按照时间排序,`-v`扩展选项对版本排序。 + +我们也可以使用`--none`选项,它会以常规方式输出结果而不会进行排序。 + + # ls --sort=extension + # ls --sort=size + # ls --sort=time + # ls --sort=version + # ls --sort=none + +![Sort Listing of Content by Options](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Content-by-Extensions.gif) + +*通过选项对内容排序列出* + +### 5. 使用ls命令打印目录中各个项的数字UID和GID。 ### + +上面的环境可以通过使用带有-n标识的ls命令来实现。 + + # ls -n + +![Print Listing of Content by UID and GID](http://www.tecmint.com/wp-content/uploads/2015/03/Print-UID-GID-of-Contents.gif) + +*通过UID和GID对打印内容列表* + +### 6. 标准输出结果中打印目录内容中比默认指定的更多栏目。 ### + +好吧,ls命令根据屏幕大小自动输出目录内容。 + +然而,我们可以手动分配屏幕宽度的值和出现的栏目的控制数。这可以通过使用‘`--width`’开关实现。 + + # ls --width 80 + # ls --width 100 + # ls --width 150 + +![List Content Based on Window Sizes](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-By-More-Column.gif) + +*根据窗口大小列出内容* + +**注意**: 你可以试验你可以给width标识传递什么值。 + +### 7. 通过ls命令为列出的目录内容手动指定的制表符大小而不是默认的8。 ### + + # ls --tabsize=[value] + +![List Content by Table Size](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-by-Table-Size.gif) + +*按表尺寸列出内容* + +**注意**: 指定`[Value]`的数值。 + +到目前为止,都讲完了。保持连线,我们会推出下一篇文章。别忘了在下面的评论中为我们提供有价值的反馈。为我们点赞并分享,帮我们推广。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-ls-command-tricks/ + +作者:[Avishek Kumar][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[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-5109-1.html +[2]:https://linux.cn/article-5349-1.html +[3]:https://linux.cn/article-5350-1.html diff --git a/published/201505/20150324 How to Host Open Source Code Repository in github.md b/published/201505/20150324 How to Host Open Source Code Repository in github.md new file mode 100644 index 0000000000..8b9f40d3b1 --- /dev/null +++ b/published/201505/20150324 How to Host Open Source Code Repository in github.md @@ -0,0 +1,114 @@ +怎样在Github上托管开源代码库 +================================================================================ + +大家好,今天我们要学习一下怎样在github.com提供的仓库中托管开源软件源代码。GitHub是一个基于web的Git仓库托管服务,提供基于 git 的分布式版本控制和源代码管理(SCM)功能,并加入了自身的特点。它给开源项目和私有项目提供了一个互相协作的工作区、代码预览和代码管理功能。不像Git是一个完完全全的命令行工具,GitHub提供了一个基于web的图形化界面和桌面,也整合了手机操作。GitHub同时提供了私有库付费计划和通常用来管理开源软件项目的免费账号。 + +![github universe logo](http://blog.linoxide.com/wp-content/uploads/2015/03/github-universe.jpg) + +这是一种快速灵活,基于web的托管服务,它使用方便,管理分布式版本控制系统也是相当容易,任何人都能将他们的软件源代码托管到 github,让全球各地数以百万计的人可以使用它、参与贡献、共享它、进行问题跟踪以及更多的用途。这里有一些简单快速地托管软件源代码的方法。 + +### 1. 创建一个新的Github账号 ### + +首先,打开你最喜欢的浏览器并访问[github][1],首页页面如下所示。 + +![Github Homepage](http://blog.linoxide.com/wp-content/uploads/2015/03/github-homepage.png) + +现在,首页打开之后,请填写一个新的github账号用于注册。 + +输入注册所需的有效信息之后,你会被转到计划选择的步骤。在这个页面上有5种计划,我们可以根据需要来选择,这里我们要选择免费计划。所以,我们点击选择Free计划并完成注册。如果我们接下去还打算创建一个组织,那我们需要勾选“Help me setup an organization next”。 + +![choosing plan](http://blog.linoxide.com/wp-content/uploads/2015/03/choosing-plan.png) + +### 2. 创建一个新的库 ### + +成功注册新账号或登录上Github之后,我们需要创建一个新的库来开始我们的征程。 + +点击位于顶部靠右账号id旁边的**(+)**按钮,然后点击“New Repository”。 + +![Add new repository](http://blog.linoxide.com/wp-content/uploads/2015/03/create-new-repository.png) + +点击创建一个新的库之后,我们进入了填写所需信息的页面。 + +![adding repository information](http://blog.linoxide.com/wp-content/uploads/2015/03/adding-information-repository.png) + +填写好信息之后,我们点击绿色的“Create repository”按钮。 + +这些步骤都做完之后,我们将看到类似于下面这张图的页面。 + +![repository github](http://blog.linoxide.com/wp-content/uploads/2015/03/repository-github.png) + +### 3. 上传一个已有项目 ### + +如果我们想在Github上分享我们的项目,我们自然要把代码推上我们创建的库中。想要这样的话,我们首先要在我们的Linux机器上安装git。如果我在机器上运行的是Ubuntu 14.04 LTS,我需要运行**apt**工具来安装它。 + + $ sudo apt-get install git + +![installing git](http://blog.linoxide.com/wp-content/uploads/2015/03/install-git.png) + +现在git已经准备就绪,我们要上传代码了。 + +**注意**:为了避免错误,不要在初始化的新库中包含**README**、license或gitignore等文件,你可以在项目推送到Github上之后再添加它们。 + +在终端上,我们需要切换当前工作目录为你的本地项目的目录,然后将其初始化为Git库。 + + $ git init + +接着我们添加新的本地库里中的文件,作为我们的首次提交内容。 + + $ git add . + +现在我们就提交我们在本地库所添加的文件。 + + $ git commit -m 'First commit' + +![git commit](http://blog.linoxide.com/wp-content/uploads/2015/03/git-commit.png) + +在终端上,添加远程库的URL地址,以便我们的本地库推送到远程。 + + $ git remote add origin 远程库的URL + $ git remote -v + +![adding remote url](http://blog.linoxide.com/wp-content/uploads/2015/03/adding-remote-url.png) + +注意:请确保将上述“远程库的URL”替换成了你自己的远程库的URL。 + +现在,要将我们的本地库的改变推送至GitHub的版本库中,我们需要运行以下命令,并且输入所需的用户名和密码。 + + $ git push origin master + +![pushing repo](http://blog.linoxide.com/wp-content/uploads/2015/03/pushing-repo.png) + +### 克隆一个库 ### + +如果我们想用一条简单地命令从github上下载代码库至本机上,我们可以用git clone命令,该命令将会从远程库中克隆最新的目录。 + + $ git clone https://github.com/aruntechgeek/linspeed.git + +![cloning repo](http://blog.linoxide.com/wp-content/uploads/2015/03/cloning-repo.png) + +请把以上这条URL地址更改成你想要克隆的地址。 + +### 推送改动 ### + +如果我们对我们的代码做了更改并想把它们推送至我们的远程库中,我们应该在该目录下运行以下命令。 + + $ git add . + $ git commit -m "Updating" + $ git push + +### 结论 ### + +啊哈!我们已经成功地将我们的项目源代码托管到Github的库中了。Github是快速灵活的基于web的托管服务,分布式版本控制系统使用起来方便容易。数百万个非常棒的开源项目驻扎在github上。所以,如果你有任何问题、建议或反馈,请在评论中告诉我们。谢谢大家!好好享受吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/usr-mgmt/host-open-source-code-repository-github/ + +作者:[Arun Pyasi][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://github.com/ diff --git a/published/201505/20150324 How to Interactively Create a Docker Container.md b/published/201505/20150324 How to Interactively Create a Docker Container.md new file mode 100644 index 0000000000..8fb5f6fa39 --- /dev/null +++ b/published/201505/20150324 How to Interactively Create a Docker Container.md @@ -0,0 +1,100 @@ +如何交互式地创建一个Docker容器 +=============================================================================== + +大家好,今天我们来学习如何使用一个docker镜像交互式地创建一个Docker容器。当我们从镜像中启动一个Docker进程,Docker就会获取该镜像及其父镜像,并重复这个过程,直到到达基础镜像。然后联合文件系统(UFS)会在其顶层添加一个读写层。读写层被称之为容器,它包含了一些关于父镜像信息及一些其他的信息,如唯一ID,网络配置和资源限制等。容器是有状态的,其状态可以从 **运行态** 切换到 **退出态**。一个处于 **运行态**的容器包含了在CPU上面运行的进程树,于其它在该主机上运行的进程相隔离,而**退出态**是指文件系统的状态,并保留了其退出值。你可以使用它来启动,停止和重启一个容器。 + +Docker技术为IT界带来了巨大的改变,它使得云服务可以用来共享应用和工作流程自动化,使得应用可以用组件快速组合,消除了开发、品质保证、产品环境间的摩擦。在这篇文章中,我们将会建立CentOS环境,然后用Apache网络服务器提供一个网站服务。 + +这是一个快速且容易的教程,讨论我们怎样使用交互的shell,以交互的方式来创建一个容器。 + +### 1. 运行一个Docker实例 ### + +Docker首先会尝试从本地取得并运行所需的镜像,如果在本地主机上没有发现,它就会从[Docker公共注册中心][1]拉取。这里,我们将会拉取镜像并在 Docker 容器中创建一个fedora实例,并连接到它的 tty 上的bash shell。 + + # docker run -i -t fedora bash + +![Downloading Fedora Base Image](http://blog.linoxide.com/wp-content/uploads/2015/03/downloading-fedora-base-image.png) + +### 2.安装Apache网络服务器 ### + +现在,在我们的Fedora基本镜像实例准备好后,我们将会开始交互式地安装Apache网络服务器,而不是为它创建Dockerfile。为了做到这点,我们需要在终端或者shell运行以下命令。 + + # yum update + +![Installing httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-httpd2.png) + + # yum install httpd + +![Installing httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-httpd2.png) + + # exit + +### 3.保存镜像 ### + +现在,我们要去保存在Fedora实例里做的修改。要做到这个,我们首先需要知道实例的容器ID。而为了得到ID,我们又需要运行以下命令(LCTT 译注:在容器外执行该命令)。 + + # docker ps -a + +![Docker Running Container](http://blog.linoxide.com/wp-content/uploads/2015/03/docker-running-container.png) + +然后,我们会保存这些改变为一个新的镜像,请运行以下命令。 + + # docker commit c16378f943fe fedora-httpd + +![committing fedora httpd](http://blog.linoxide.com/wp-content/uploads/2015/03/committing-fedora-httpd.png) + +这里,修改已经通过使用容器ID保存起来了,镜像名字叫fedora-httpd。为了确认新的镜像是否在运行,我们将运行以下命令。 + + # docker images + +![view docker images](http://blog.linoxide.com/wp-content/uploads/2015/03/view-docker-images.png) + +### 4. 添加内容到新的镜像 ### + +我们自己新的Fedora Apache镜像正成功的运行,现在我们想添加一些我们网站的网页内容到Apache网络服务器,使得网站能够开箱即用。为做到这点,我们需要创建一个新的Dockerfile,它会处理从复制网页内容到启用80端口的所有操作。要达到这样的目的,我们需要使用我们最喜欢的文本编辑器创建Dockerfile文件,像下面演示的一样。 + + # nano Dockerfile + +现在,我们需要添加以下的命令行到文件中。 + + FROM fedora-httpd + ADD mysite.tar /tmp/ + RUN mv /tmp/mysite/* /var/www/html + EXPOSE 80 + ENTRYPOINT [ "/usr/sbin/httpd" ] + CMD [ "-D", "FOREGROUND" ] + +![configuring Dockerfile](http://blog.linoxide.com/wp-content/uploads/2015/03/configuring-Dockerfile.png) + +这里,上述的Dockerfile中,放在mysite.tar里的网页内容会自动解压到/tmp/文件夹里。然后,整个站点会被移动到Apache的网页根目录/var/www/html/,命令expose 80会打开80端口,这样网站就能正常访问了。其次,入口点放在了/usr/sbin/https里面,保证Apache服务器能够执行。 + +### 5. 构建并运行一个容器 ### + +现在,我们要用刚刚创建的Dockerfile创建我们的容器,以便将我们的网站添加到上面。为做到这,我们需要运行以下命令。 + + # docker build -rm -t mysite . + +![Building mysite Image](http://blog.linoxide.com/wp-content/uploads/2015/03/building-mysite-image.png) + +建立好我们的新容器后,我们需要要用下面的命令来运行容器。 + + # docker run -d -P mysite + +![Running mysite Container](http://blog.linoxide.com/wp-content/uploads/2015/03/running-mysite-container.png) + +### 总结 ### + +最后,我们已经成功的以交互式的方式建立了一个Docker容器。在本节方法中,我们是直接通过交互的shell命令建立我们的容器和镜像。在建立与配置镜像与容器时,这种方法十分简单且快速。如果你有任何问题,建议和反馈,请在下方的评论框里写下来,以便我们可以提升或者更新我们的文章。谢谢!祝生活快乐 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/interactively-create-docker-container/ + +作者:[Arun Pyasi][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://registry.hub.docker.com/ diff --git a/published/201505/20150326 How to set up server monitoring system with Monit.md b/published/201505/20150326 How to set up server monitoring system with Monit.md new file mode 100755 index 0000000000..6886e83ef2 --- /dev/null +++ b/published/201505/20150326 How to set up server monitoring system with Monit.md @@ -0,0 +1,250 @@ +如何使用Monit部署服务器监控系统 +================================================================================ +很多Linux系统管理员依赖一个集中式的远程监控系统(比如[Nagios][1]或者[Cacti][2])来检查他们网络基础设备的健康状况。虽然集中式监控让管理员的生活更简单了,然而处理很多机器和服务时,专用的监控中心显然成为了一个单点故障,如果监控中心挂了或者因为什么原因(比如硬件或者网络故障)不可访问了,你就会失去整个网络基础设备情况的任何信息。 + +一个给你的监控系统增加冗余度的方法是安装独立的监控软件(作为后备),至少在网络中的关键/核心服务器上。这样在集中式监控系统挂掉的情况,你还有能力通过后备的监控方式来获取核心服务器的运行状况。 + +### Monit是什么? ### + +[Monit][3]是一个跨平台的用来监控Unix/linux系统(比如Linux、BSD、OSX、Solaris)的工具。Monit特别易于安装,而且非常轻量级(只有500KB大小),并且不依赖任何第三方程序、插件或者库。然而,Monit可以胜任全面监控、进程状态监控、文件系统变动监控、邮件通知和对核心服务的自定义动作等场景。易于安装、轻量级的实现以及强大的功能,让Monit成为一个理想的后备监控工具。 + +我已经在一些机器使用Monit几年了,而且我对它的可靠性非常满意。甚至作为全面的监控系统,对任何Linux系统管理员来说Monit也是非常有用和强大的。在这篇教程中,我会展示如何在一个本地服务器部署Monit(作为后备监控系统)来监控常见的服务。在部署过程中,我只会展示我们用到的部分。 + +### 在Linux安装Monit ### + +Monit已经被包含在多数Linux发行版的软件仓库中了。 + +Debian、Ubuntu或者Linux Mint: + + $ sudo aptitude install monit + +Fedora或者CentOS/RHEL: + +在CentOS/RHEL中,你必须首先启用[EPEL][4]或者[Repoforge][5]软件仓库. + + # yum install monit + +Monit自带一个文档完善的配置文件,其中包含了很多例子。主配置文件在/etc/monit.conf(Fedora/CentOS/RHEL 中),或者/etc/monit/monitrc(Debian/Ubuntu/Mint 中)。Monit配置文件有两部分:“Global”(全局)和“Services”(服务)。 + +### Global Configuration: Web Status Page (全局配置:Web状态页面) ### + +Monit可以使用邮件服务来发送通知,也可以使用HTTP/HTTPS页面来展示。我们先使用如下配置的web状态页面吧: + +- Monit监听1966端口。 +- 对web状态页面的访问是通过SSL加密的。 +- 使用monituser/romania作为用户名/口令登录。 +- 只允许通过localhost、myhost.mydomain.ro和在局域网内部(192.168.0.0/16)访问。 +- Monit使用pem格式的SSL证书。 + +之后的步骤,我会使用一个基于Red Hat的系统。在基于Debian的系统中的步骤也是类似的。 + +首先,在/var/cert生成一个自签名的证书(monit.pem): + + # mkdir /var/certs + # cd /etc/pki/tls/certs + # ./make-dummy-cert monit.pem + # cp monit.pem /var/certs + # chmod 0400 /var/certs/monit.pem + +现在将下列代码片段放到Monit的主配置文件中。你可以创建一个空配置文件,或者基于自带的配置文件修改。 + + set httpd port 1966 and + SSL ENABLE + PEMFILE /var/certs/monit.pem + allow monituser:romania + allow localhost + allow 192.168.0.0/16 + allow myhost.mydomain.ro + +### Global Configuration: Email Notification (全局配置:邮件通知) ### + +然后,我们来设置Monit的邮件通知。我们至少需要一个可用的[SMTP服务器][6]来让Monit发送邮件。这样就可以(按照你的实际情况修改): + +- 邮件服务器的机器名:smtp.monit.ro +- Monit使用的发件人:monit@monit.ro +- 邮件的收件人:guletz@monit.ro +- 邮件服务器使用的SMTP端口:587(默认是25) + +有了以上信息,邮件通知就可以这样配置: + + set mailserver smtp.monit.ro port 587 + set mail-format { + from: monit@monit.ro + subject: $SERVICE $EVENT at $DATE on $HOST + message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION. + + Yours sincerely, + Monit + + } + + set alert guletz@monit.ro + +就像你看到的,Monit会提供几个内部变量(`$DATE`、`$EVENT`、`$HOST`等),你可以按照你的需求自定义邮件内容。如果你想要从Monit所在机器发送邮件,就需要一个已经安装的与sendmail兼容的程序(如postfix或者ssmtp)。 + +### Global Configuration: Monit Daemon (全局配置:Monit守护进程)### + +接下来就该配置Monit守护进程了。可以将其设置成这样: + +- 在120秒后进行第一次检测。 +- 每3分钟检测一次服务。 +- 使用syslog来记录日志。 + +如下代码段可以满足上述需求。 + + set daemon 120 + with start delay 240 + set logfile syslog facility log_daemon + +我们必须定义“idfile”,Monit守护进程的一个独一无二的ID文件;以及“eventqueue”,当monit的邮件因为SMTP或者网络故障发不出去,邮件会暂存在这里;以及确保/var/monit路径是存在的。然后使用下边的配置就可以了。 + + set idfile /var/monit/id + set eventqueue + basedir /var/monit + +### 测试全局配置 ### + +现在“Global”部分就完成了。Monit配置文件看起来像这样: + + # Global Section + + # status webpage and acl's + set httpd port 1966 and + SSL ENABLE + PEMFILE /var/certs/monit.pem + allow monituser:romania + allow localhost + allow 192.168.0.0/16 + allow myhost.mydomain.ro + + # mail-server + set mailserver smtp.monit.ro port 587 + # email-format + set mail-format { + from: monit@monit.ro + subject: $SERVICE $EVENT at $DATE on $HOST + message: Monit $ACTION $SERVICE $EVENT at $DATE on $HOST : $DESCRIPTION. + + Yours sincerely, + Monit + + } + + set alert guletz@monit.ro + + # delay checks + set daemon 120 + with start delay 240 + set logfile syslog facility log_daemon + + # idfile and mail queue path + set idfile /var/monit/id + set eventqueue + basedir /var/monit + +现在是时候验证我们的工作了,你可以通过运行如下命令来验证存在的配置文件(/etc/monit.conf): + + # monit -t + + Control file syntax OK + +如果monit提示任何错误,请再检查下配置文件。幸运的是,错误/警告信息是可以帮助你发现问题的,比如: + + monit: Cannot stat the SSL server PEM file '/var/certs/monit.pem' -- No such file or directory + /etc/monit/monitrc:10: Warning: hostname did not resolve 'smtp.monit.ro' + +一旦你确认配置文件没问题了,可以启动monit守护进程,然后等2到3分钟: + + # service monit start + +如果你使用的是systemd,运行: + + # systemctl start monit + +现在打开一个浏览器窗口,然后访问`https://:1966`。将``替换成Monit所在机器的机器名或者IP地址。 + +如果你使用的是自签名的SSL证书,你会在浏览器中看到一个警告信息。继续访问即可。 + +![](https://farm8.staticflickr.com/7596/16737206479_96b9f7dfdb_c.jpg) + +你完成登录后,就会看到这个页面。 + +![](https://farm8.staticflickr.com/7594/16303369973_6019482dea_c.jpg) + +在这个教程的其余部分,我们演示监控一个本地服务器和常见服务的方法。你会在[官方wiki页面][7]看到很多有用的例子。其中的多数是可以直接复制粘贴的! + +### Service Configuration: CPU/Memory Monitoring (服务配置:CPU、内存监控) ### + +我们先来监控本地服务器的CPU、内存占用。复制如下代码段到配置文件中。 + + check system localhost + if loadavg (1min) > 10 then alert + if loadavg (5min) > 6 then alert + if memory usage > 75% then alert + if cpu usage (user) > 70% then alert + if cpu usage (system) > 60% then alert + if cpu usage (wait) > 75% then alert + +你可以很容易理解上边的配置。最上边的check是指每个监控周期(全局配置里设置的120秒)都对本机进行下面的操作。如果满足了任何条件,monit守护进程就会使用邮件发送一条报警。 + +如果某个监控项不需要每个周期都检查,可以使用如下格式,它会每240秒检查一次平均负载。 + + if loadavg (1min) > 10 for 2 cycles then alert + +### Service Configuration: SSH Service Monitoring (服务配置:SSH服务监控) ### + +先检查我们的sshd是否安装在/usr/sbin/sshd: + + check file sshd_bin with path /usr/sbin/sshd + +我们还想检查sshd的启动脚本是否存在: + + check file sshd_init with path /etc/init.d/sshd + +最后,我们还想检查sshd守护进程是否存活,并且在监听22端口: + + check process sshd with pidfile /var/run/sshd.pid + start program "/etc/init.d/sshd start" + stop program "/etc/init.d/sshd stop" + if failed port 22 protocol ssh then restart + if 5 restarts within 5 cycles then timeout + +我们可以这样解释上述配置:我们检查是否存在名为sshd的进程,并且有一个保存其pid的文件存在(/var/run/sshd.pid)。如果任何一个不存在,我们就使用启动脚本重启sshd。我们检查是否有进程在监听22端口,并且使用的是SSH协议。如果没有,我们还是重启sshd。如果在最近的5个监控周期(5x120秒)至少重启5次了,sshd就被认为是不能用的,我们就不再检查了。 + +![](https://farm9.staticflickr.com/8685/16735725998_62c26a24bc_c.jpg) + +### Service Configuration: SMTP Service Monitoring (服务配置:SMTP服务监控) ### + +现在我们来设置一个检查远程SMTP服务器(如192.168.111.102)的监控。假定SMTP服务器运行着SMTP、IMAP、SSH服务。 + + check host MAIL with address 192.168.111.102 + if failed icmp type echo within 10 cycles then alert + if failed port 25 protocol smtp then alert + else if recovered then exec "/scripts/mail-script" + if failed port 22 protocol ssh then alert + if failed port 143 protocol imap then alert + +我们检查远程主机是否响应ICMP协议。如果我们在10个周期内没有收到ICMP回应,就发送一条报警。如果监测到25端口上的SMTP协议是异常的,就发送一条报警。如果在一次监测失败后又监测成功了,就运行一个脚本(/scripts/mail-script)。如果检查22端口上的SSH或者143端口上的IMAP协议不正常,同样发送报警。 + +### 总结 ### + +在这个教程,我演示了如何在本地服务器设置Monit,当然这只是Monit功能的冰山一角。你可以花些时间阅读Monit的man手册(写得很好)。Monit可以为任何Linux系统管理员做很多事情,并且具有非常优美和易于理解的语法。如果你将一个集中式的远程监控系统和Monit一同使用,你会得到一个更可靠的监控系统。你感觉Monit怎么样? + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/server-monitoring-system-monit.html + +作者:[Iulian Murgulet][a] +译者:[goreliu](https://github.com/goreliu) +校对:[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/monitor-common-services-nagios.html +[2]:http://xmodulo.com/monitor-linux-servers-snmp-cacti.html +[3]:http://mmonit.com/monit/ +[4]:https://linux.cn/article-2324-1.html +[5]:http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html +[6]:http://xmodulo.com/mail-server-ubuntu-debian.html +[7]:http://mmonit.com/wiki/Monit/ConfigurationExamples \ No newline at end of file diff --git a/published/201505/20150330 2 Ways to Create Your Own Docker Base Image.md b/published/201505/20150330 2 Ways to Create Your Own Docker Base Image.md new file mode 100644 index 0000000000..4c0030b191 --- /dev/null +++ b/published/201505/20150330 2 Ways to Create Your Own Docker Base Image.md @@ -0,0 +1,57 @@ +两种方式创建你自己的 Docker 基本映像 +================================================================================ + +欢迎大家,今天我们学习一下 docker 基本映像以及如何构建我们自己的 docker 基本映像。[Docker][1] 是一个开源项目,提供了一个可以打包、装载和运行任何应用的轻量级容器的开放平台。它没有语言支持、框架和打包系统的限制,从小型的家用电脑到高端服务器,在何时何地都可以运行。这使它们可以不依赖于特定软件栈和供应商,像一块块积木一样部署和扩展网络应用、数据库和后端服务。 + +Docker 映像是不可更改的只读层。Docker 使用 **Union File System** 在只读文件系统上增加可读写的文件系统,但所有更改都发生在最顶层的可写层,而其下的只读映像上的原始文件仍然不会改变。由于映像不会改变,也就没有状态。基本映像是没有父类的那些映像。Docker 基本映像主要的好处是它允许我们有一个独立运行的 Linux 操作系统。 + +下面是我们如何可以创建自定义的基本映像的方式。 + +### 1. 使用 Tar 创建 Docker 基本映像 ### + +我们可以使用 tar 构建我们自己的基本映像,我们从一个运行中的 Linux 发行版开始,将其打包为基本映像。这过程可能会有些不同,它取决于我们打算构建的发行版。在 Debian 发行版中,已经预带了 debootstrap。在开始下面的步骤之前,我们需要安装 debootstrap。debootstrap 用来获取构建基本系统需要的包。这里,我们构建基于 Ubuntu 14.04 "Trusty" 的映像。要完成这些,我们需要在终端或者 shell 中运行以下命令。 + + $ sudo debootstrap trusty trusty > /dev/null + $ sudo tar -C trusty -c . | sudo docker import - trusty + +![使用debootstrap构建docker基本映像](http://blog.linoxide.com/wp-content/uploads/2015/03/creating-base-image-debootstrap.png) + +上面的命令为当前文件夹创建了一个 tar 文件并输出到标准输出中,"docker import - trusty" 通过管道从标准输入中获取这个 tar 文件并根据它创建一个名为 trusty 的基本映像。然后,如下所示,我们将运行映像内部的一条测试命令。 + + $ docker run trusty cat /etc/lsb-release + +[Docker GitHub Repo][2] 中有一些允许我们快速构建基本映像的事例脚本. + +### 2. 使用Scratch构建基本映像 ### + +在 Docker registry 中,有一个被称为 Scratch 的使用空 tar 文件构建的特殊库: + + $ tar cv --files-from /dev/null | docker import - scratch + +![使用scratch构建docker基本映像](http://blog.linoxide.com/wp-content/uploads/2015/03/creating-base-image-using-scratch.png) + +我们可以使用这个映像构建新的小容器: + + FROM scratch + ADD script.sh /usr/local/bin/run.sh + CMD ["/usr/local/bin/run.sh"] + +上面的 Dockerfile 文件来自一个很小的映像。这里,它首先从一个完全空的文件系统开始,然后它复制新建的 /usr/local/bin/run.sh 为 script.sh ,然后运行脚本 /usr/local/bin/run.sh。 + +### 结尾 ### + +这这个教程中,我们学习了如何构建一个开箱即用的自定义 Docker 基本映像。构建一个 docker 基本映像是一个很简单的任务,因为这里有很多已经可用的包和脚本。如果我们想要在里面安装想要的东西,构建 docker 基本映像非常有用。如果有任何疑问,建议或者反馈,请在下面的评论框中写下来。非常感谢!享受吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/2-ways-create-docker-base-image/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://www.docker.com/ +[2]:https://github.com/docker/docker/blob/master/contrib/mkimage-busybox.sh \ No newline at end of file diff --git a/published/201505/20150330 How to secure SSH login with one-time passwords on Linux.md b/published/201505/20150330 How to secure SSH login with one-time passwords on Linux.md new file mode 100644 index 0000000000..443f8cab25 --- /dev/null +++ b/published/201505/20150330 How to secure SSH login with one-time passwords on Linux.md @@ -0,0 +1,180 @@ +使用一次性密码本通过 SSH 安全登录 Linux +================================================================================ +有人说,安全不是一个产品,而是一个过程(LCTT 注:安全公司 McAfee 认为,安全风险管理是一个方法论,而不是安全产品的堆叠)。虽然 SSH 协议被设计成使用加密技术来确保安全,但如果使用不当,别人还是能够破坏你的系统:比如弱密码、密钥泄露、使用过时的 SSH 客户端等,都能引发安全问题。 + +在考虑 SSH 认证方案时,大家普遍认为[公钥认证][1]比密码认证更安全。然而,公钥认证技术并不是为公共环境设置的,如果你在一台公用电脑上使用公钥认证登录 SSH 服务器,你的服务器已经毫无安全可言了,公用的电脑可能会记录你的公钥,或从你的内存中读取公钥。如果你不信任本地电脑,那你最好还是使用其他方式登录服务器。现在就是“一次性密码(OTP)”派上用场的时候了,就像名字所示,一次性密码只能被使用一次。这种一次性密码非常合适在不安全的环境下发挥作用,就算它被窃取,也无法再次使用。 + +有个生成一次性密码的方法是通过[谷歌认证器][2],但在本文中,我要介绍的是另一种 SSH 登录方案:[OTPW][3],它是个一次性密码登录的软件包。不像谷歌认证,OTPW 不需要依赖任何第三方库。 + +### OTPW 是什么 ### + +OTPW 由一次性密码生成器和 PAM 认证规则组成。在 OTPW 中一次性密码由生成器事先生成,然后由用户以某种安全的方式获得(比如打印到纸上)。另一方面,这些密码会通过 Hash 加密保存在 SSH 服务器端。当用户使用一次性密码登录系统时,OTPW 的 PAM 模块认证这些密码,并且保证它们不能再次使用。 + +### 步骤1:OTPW 的安装和配置 ### + +#### 在 Debian, Ubuntu 或 Linux Mint 发行版上 #### + +使用 apt-get 安装: + + $ sudo apt-get install libpam-otpw otpw-bin + +打开针对 SSH 服务的 PAM 配置文件(/etc/pam.d/sshd),注释掉下面这行(目的是禁用 PAM 的密码认证功能): + + #@include common-auth + +添加下面两行(用于打开一次性密码认证功能): + + auth required pam_otpw.so + session optional pam_otpw.so + +![](https://farm8.staticflickr.com/7599/16775121360_d1f93feefa_b.jpg) + +#### 在 Fedora 或 CentOS/RHEL 发行版上 #### + +在基于 RedHat 的发行版中没有编译好的 OTPW,所以我们需要使用源代码来安装它。 + +首先,安装编译环境: + + $ sudo yum git gcc pam-devel + $ git clone https://www.cl.cam.ac.uk/~mgk25/git/otpw + $ cd otpw + +打开 Makefile 文件,编辑以“PAMLIB=”开头的那行配置: + +64 位系统: + + PAMLIB=/usr/lib64/security + +32 位系统: + + PAMLIB=/usr/lib/security + +编译安装。需要注意的是安装过程会自动重启 SSH 服务一下,所以如果你是使用 SSH 连接到服务器,做好被断开连接的准备吧(LCTT 译注:也许不会被断开连接,即便被断开连接,请使用原来的方式重新连接即可,现在还没有换成一次性口令方式。)。 + + $ make + $ sudo make install + +现在你需要更新 SELinux 策略,因为 /usr/sbin/sshd 会往你的 home 目录写数据,而 SELinux 默认是不允许这么做的。如果没有使用 SELinux 服务(LCTT 注:使用 getenforce 命令查看结果,如果是 enforcing,就是打开了 SELinux 服务),请跳过这一步。 + + $ sudo grep sshd /var/log/audit/audit.log | audit2allow -M mypol + $ sudo semodule -i mypol.pp + +接下来打开 PAM 配置文件(/etc/pam.d/sshd),注释下面这行(为了禁用密码认证): + + #auth substack password-auth + +添加下面两行(用于打开一次性密码认证功能): + + auth required pam_otpw.so + session optional pam_otpw.so + +#### 步骤2:配置 SSH 服务器,使用一次性密码 #### + +打开 /etc/ssh/sshd_config 文件,设置下面三个参数。你要确保下面的参数不会重复存在,否则 SSH 服务器可能会出现异常。 + + UsePrivilegeSeparation yes + ChallengeResponseAuthentication yes + UsePAM yes + +你还需要禁用默认的密码认证功能。另外可以选择开启公钥认证功能,那样的话你就可以在没有一次性密码的时候使用公钥进行认证。 + + PubkeyAuthentication yes + PasswordAuthentication no + +重启 SSH 服务器。 + +Debian, Ubuntu 或 Linux Mint 发行版: + + $ sudo service ssh restart + +Fedora 或 CentOS/RHEL 7 发行版: + + $ sudo systemctl restart sshd + +(LCTT 译注:虽然这里重启了 sshd 服务,但是你当前的 ssh 连接应该不受影响,只是在你完成下述步骤之前,无法按照原有方式建立新的连接了。因此,保险起见,要么多开一个 ssh 连接,避免误退出当前连接;要么将重启 sshd 服务器步骤放到步骤3完成之后。) + +#### 步骤3:使用 OTPW 产生一次性密码 #### + +之前提到过,你需要事先创建一次性密码,并保存起来。使用 otpw-gen 命令创建密码: + + $ cd ~ + $ otpw-gen > temporary_password.txt + +![](https://farm9.staticflickr.com/8751/16961258882_c49cfe03fb_b.jpg) + +这个命令会让你输入密码前缀,当你以后登录的时候,你需要同时输入这个前缀以及一次性密码。密码前缀是另外一层保护,就算你的一次性密码表被泄漏,别人也无法通过暴力破解你的 SSH 密码。 + +设置好密码前缀后,这个命令会产生 280 个一次性密码(LCTT 译注:保存到 ~/.otpw 下),并将它们导出到一个文本文件中(如 temporary_password.txt)。每个密码(默认是 8 个字符)由一个 3 位十进制数索引。你需要将这个密码表打印出来,并随身携带。 + +![](https://farm8.staticflickr.com/7281/16962594055_c2696d5ae1_b.jpg) + +查看 ./.otpw 文件,它存放了一次性密码的 HASH 值。头 3 位十进制数与你随身携带的密码表的索引一一对应,在你登录 SSH 服务器的时候会被用到。 + + $ more ~/.otpw + +---------- + + OTPW1 + 280 3 12 8 + 191ai+:ENwmMqwn + 218tYRZc%PIY27a + 241ve8ns%NsHFmf + 055W4/YCauQJkr: + 102ZnJ4VWLFrk5N + 2273Xww55hteJ8Y + 1509d4b5=A64jBT + 168FWBXY%ztm9j% + 000rWUSdBYr%8UE + 037NvyryzcI+YRX + 122rEwA3GXvOk=z + +### 测试一次性密码登录 SSH 服务器 ### + +使用普通的方式登录 SSH 服务器: + + $ ssh user@remote_host + +如果 OTPW 成功运行,你会看到一点与平时登录不同的地方: + + Password 191: + +现在打开你的密码表,找到索引号为 191 的密码。 + + 023 kBvp tq/G 079 jKEw /HRM 135 oW/c /UeB 191 fOO+ PeiD 247 vAnZ EgUt + +从上表可知,191 号密码是“fOO+PeiD”。你需要加上密码前缀,比如你设置的前缀是“000”,则你实际需要输入的密码是“000fOO+PeiD”。 + +成功登录后,你这次输入的密码自动失效。查看 ~/.otpw 文件,你会发现第一行变成“---------------”,这表示 191 号密码失效了。 + + OTPW1 + 280 3 12 8 + --------------- + 218tYRZc%PIY27a + 241ve8ns%NsHFmf + 055W4/YCauQJkr: + 102ZnJ4VWLFrk5N + 2273Xww55hteJ8Y + 1509d4b5=A64jBT + 168FWBXY%ztm9j% + 000rWUSdBYr%8UE + 037NvyryzcI+YRX + 122rEwA3GXvOk=z + +### 总结 ### + +在这个教程中,我介绍了如何使用 OTPW 工具来设置一次性登录密码。你也许意识到了在这种双因子的认证方式中,打印一张密码表让人感觉好 low,但是这种方式是最简单的,并且不用依赖任何第三方软件。无论你用哪种方式创建一次性密码,在你需要在一个不可信任的环境登录 SSH 服务器的时候,它们都很有用。你可以就这个主题来分享你的经验和观点。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/secure-ssh-login-one-time-passwords-linux.html + +作者:[Dan Nanni][a] +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:https://linux.cn/article-5444-1.html +[2]:https://linux.cn/article-2642-1.html +[3]:http://www.cl.cam.ac.uk/~mgk25/otpw.html diff --git a/published/201505/20150330 Linux FAQs with Answers--How to upgrade Docker on Ubuntu.md b/published/201505/20150330 Linux FAQs with Answers--How to upgrade Docker on Ubuntu.md new file mode 100644 index 0000000000..ad9ed38d09 --- /dev/null +++ b/published/201505/20150330 Linux FAQs with Answers--How to upgrade Docker on Ubuntu.md @@ -0,0 +1,35 @@ +Linux有问必答:如何在Ubuntu中升级Docker +================================================================================ +> **提问**: 我使用了Ubuntu的标准仓库安装了Docker。然而,默认安装的Docker不能满足我另外一个依赖Docker程序的版本需要。我该如何在Ubuntu中升级到Docker的最新版本? + +Docker第一次在2013年发布,它快速地演变成了一个针对分布式程序的开发平台。为了满足工业期望,Docker正在紧密地开发并持续地带来新特性的升级。这样Ubuntu发行版中的Docker版本可能很快就会过时。比如, Ubuntu 14.10 Utopic 中的Docker版本是1.2.0, 然而最新的Docker版本是1.6.0。 + +![](https://farm9.staticflickr.com/8730/16351300024_9acb9086da_b.jpg) + +对于那些想要跟随Docker的最新开发的人而言,Canonical为Docker维护了一个独立的PPA。使用这个PPA仓库,你可以很容易地在Ubuntu上升级到最新的Docker版本。 + +下面是如何设置Docker的PPA和升级Docker。 + + $ sudo add-apt-repository ppa:docker-maint/testing + $ sudo apt-get update + $ sudo apt-get install docker.io + +检查安装的Docker版本: + + $ docker --version + +---------- + + Docker version 1.5.0-dev, build a78ce5c + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/upgrade-docker-ubuntu.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201505/20150331 Conky--The Ultimate X Based System Monitor Application.md b/published/201505/20150331 Conky--The Ultimate X Based System Monitor Application.md new file mode 100644 index 0000000000..fb90f58168 --- /dev/null +++ b/published/201505/20150331 Conky--The Ultimate X Based System Monitor Application.md @@ -0,0 +1,151 @@ +Conky - 终极的 X 视窗系统监视器应用 +================================================================================ +Conky 是一个用 ‘C’ 语言写就的系统监视器,并在 GNU GPL 和 BSD 许可协议下发布,在 Linux 和 BSD 操作系统中都可以获取到它。这个应用是基于 X 视窗系统的,原本由 [Torsmo][1] 分支而来。 + +#### 特点 #### + +- 简洁的用户界面; +- 高度可配置; +- 它既可使用内置的部件(超过 300 多个) 也可使用外部脚本,来在桌面或其自有容器中展示系统的状态; +- 低资源消耗; +- 它可显示范围广泛的系统参数,包括但不限于 CPU,内存,swap 分区 ,温度,进程,磁盘使用情况,网络状态,电池电量,邮件收发,系统消息,音乐播放器的控制,天气信息,最新新闻,升级信息等等; +- 在许多操作系统中如 CrunchBang Linux 和 Pinguy OS 被默认安装; + +#### 关于 Conky 的少有人知的事实 #### + +- conky 这个名称来自于一个加拿大电视节目; +- 它已被移植到 Nokia N900 上; +- 官方已经不再维护它了; + +### 在 Linux 中 Conky 的安装和使用 ### + +在我们安装 conky 之前,我们需要使用下面的命令来安装诸如 `lm-sensors`, `curl` 和 `hddtemp` 之类的软件包: + + # apt-get install lm-sensors curl hddtemp + +然后是检测传感器: + + # sensors-detect + +**注**: 在被系统提示时,回答 ‘Yes’ 。 + +检测所有探测到的传感器: + + # sensors + +#### 样例输出 #### + + acpitz-virtual-0 + Adapter: Virtual device + temp1: +49.5°C (crit = +99.0°C) + + coretemp-isa-0000 + Adapter: ISA adapter + Physical id 0: +49.0°C (high = +100.0°C, crit = +100.0°C) + Core 0: +49.0°C (high = +100.0°C, crit = +100.0°C) + Core 1: +49.0°C (high = +100.0°C, crit = +100.0°C) + +Conky 既可以从软件仓库中安装,也可从源代码编译得到: + + # yum install conky [在 RedHat 系的系统上] + # apt-get install conky-all [在 Debian 系的系统上] + +**注**: 在 Fedora/CentOS 上安装 conky 之前,你必须启用 [EPEL 软件仓库][2]。 + +在安装完 conky 之后,只需输入如下命令来开启它: + + $ conky & + +![正在运行的 Conky 监视器](http://www.tecmint.com/wp-content/uploads/2015/03/Start-Conkey.jpeg) + +*正在运行的 Conky 监视器* + +这使得 conky 以一个弹窗的形式运行,并使用位于 `/etc/conky/conky.conf` 的 conky 基本配置文件。 + +你可能想将 conky 集成到桌面上,并不想让它每次以弹窗的形式出现,下面就是你需要做的: + +将配置文件 `/etc/conky/conky.conf` 复制到你的家目录中,并将它重命名为 `.conkyrc`,开头的点号 (.) 是为了确保这个配置文件是隐藏的。 + + $ cp /etc/conky/conky.conf /home/$USER/.conkyrc + +现在重启 conky 来应用新的更改: + + $ killall -SIGUSR1 conky + +![Conky 监视器窗口](http://www.tecmint.com/wp-content/uploads/2015/03/Restart-Conky.jpeg) + +*Conky 监视器窗口* + +你可能想编辑位于你的家目录的 conky 的配置文件,这个配置文件的内容是非常容易理解的。 + +下面是 conky 配置文件的一个样例: + +![Conky 的配置](http://www.tecmint.com/wp-content/uploads/2015/03/Conky-Configuration.jpeg) + +*Conky 的配置* + +从上面的窗口中,你可以更改颜色,边框,大小,缩放比例,背景,对齐方式及几个其他属性。通过为不同的 conky 窗口设定不同的对齐方式,我们可以同时运行几个 conky 脚本。 + +**让 conky 使用其它脚本而不是默认配置,以及如何找到这些脚本?** + +你可以编写你自己的 conky 脚本或使用来自于互联网的脚本;我们并不建议你使用从互联网中找到的具有潜在危险的任何脚本,除非你清楚你正在做什么。然而,有一些著名的主题和网页包含可信赖的 conky 脚本,例如下面所提及的: + +- [http://ubuntuforums.org/showthread.php?t=281865][3] +- [http://conky.sourceforge.net/screenshots.html][4] + +在上面的 URL 地址中,你将发现其中每个截图都有一个超链接,它们将指向到脚本文件。 + +#### 测试 Conky 脚本 #### + +这里我将在我的 Debian Jessie 系统中运行一个由第三方写的 conky 脚本,以此来进行测试: + + $ wget https://github.com/alexbel/conky/archive/master.zip + $ unzip master.zip + +切换当前工作目录到刚才解压的目录: + + $ cd conky-master + +将 `secrets.yml.example` 重命名为 `secrets.yml`: + + $ mv secrets.yml.example secrets.yml + +在你需要运行这个(ruby)脚本之前安装 Ruby: + + $ sudo apt-get install ruby + $ ruby starter.rb + +![华丽的 conky 外观](http://www.tecmint.com/wp-content/uploads/2015/03/Conky-Fancy-Look.jpeg) + +*华丽的 conky 外观* + +**注**: 可以修改这个脚本以展示你当前的天气,温度等; + +假如你想让 conky 开机自启,请在开机启动应用设置(startup Applications) 中添加如下的几行命令: + + conky --pause 10 + save and exit. + +最后,如此轻量级且吸引眼球的实用 GUI 软件包不再处于活跃状态且官方不再进行维护了。最新的稳定发布版本为 conky 1.9.0, 于 2012 年 5 月 3 号发布。在 Ubuntu 论坛上,一个有关用户分享 conky 配置的主题已经超过了 2000 多页。(这个论坛主题的链接为: [http://ubuntuforums.org/showthread.php?t=281865/][5]) + +- [Conky 主页][6] + +这就是全部内容了。保持联系,保持评论。请在下面的评论框里分享你的想法和配置。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-conky-in-ubuntu-debian-fedora/ + +作者:[Avishek Kumar][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://torsmo.sourceforge.net/ +[2]:https://linux.cn/article-2324-1.html +[3]:http://ubuntuforums.org/showthread.php?t=281865 +[4]:http://conky.sourceforge.net/screenshots.html +[5]:http://ubuntuforums.org/showthread.php?t=281865/ +[6]:http://conky.sourceforge.net/ diff --git a/published/201505/20150331 How to Generate or Encrypt or Decrypt Random Passwords in Linux.md b/published/201505/20150331 How to Generate or Encrypt or Decrypt Random Passwords in Linux.md new file mode 100644 index 0000000000..b4023b5162 --- /dev/null +++ b/published/201505/20150331 How to Generate or Encrypt or Decrypt Random Passwords in Linux.md @@ -0,0 +1,109 @@ +如何在 Linux 中产生、加密或解密随机密码 +================================================================================ +我们一直积极地提供有关 Linux 技巧的系列文章,如果你错过了这个系列的最新文章,你或许可以去访问下面的链接。 + +- [Linux 中 5 个有趣的命令行技巧][1] + +在这篇文章中,我们将分享一些有趣 Linux 技巧,内容是有关如何产生随机密码以及加密或解密这些经过加盐或没有加盐处理的密码。 + +安全是数字时代中的一个主要话题。在电脑,email,云端,手机,文档和其他的场合中,我们都会使用到密码。众所周知,选择密码的基本原则是 “易记,难猜”。考虑过使用基于机器自动生成的密码吗?相信我,Linux 非常擅长这方面的工作。 + +**1. 使用命令 `pwgen` 来生成一个长度为 10 个字符的独特的随机密码。假如你还没有安装 pwgen,请使用 Apt 或 YUM 等包管理器来安装它。** + + $ pwgen 10 1 + +![生成一个独特的随机密码](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Unique-Password-in-Linux.gif) + +*生成一个独特的随机密码* + +一口气生成若干组长度为 50 个字符的唯一的随机密码! + + $ pwgen 50 + +![生成多组随机密码](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Multiple-Random-Passwords.gif) + +*生成多组随机密码* + +**2. 你还可以使用 `makepasswd` 来每次生成一个给定长度的独特的随机密码。在你把玩 makepasswd 命令之前,请确保你已经安装了它。如若没有安装它,试试使用 Apt 或 YUM 包管理器来安装 `makepasswd`这个软件包。** + +生成一个长度为 10 个字符的随机密码。该命令产生的密码的长度默认为 10。 + + $ makepasswd + +![使用 makepasswd 生成独特的密码](http://www.tecmint.com/wp-content/uploads/2015/03/mkpasswd-generate-unique-password.gif) + +*使用 makepasswd 生成独特的密码* + +生成一个长度为 50 个字符的随机密码。 + + $ makepasswd --char 50 + +![生成长度为 50 的密码](http://www.tecmint.com/wp-content/uploads/2015/03/Random-Password-Generate.gif) + +*生成长度为 50 的密码* + +生成 7 个长度为 20 个字符的随机密码。 + + $ makepasswd --char 20 --count 7 + +![](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-20-Character-Password.gif) + +**3. 使用带“盐”的 Crypt(注:这里应该指的是一个函数,可以参考[这里](http://man7.org/linux/man-pages/man3/crypt.3.html) ) 来加密一个密码。提供手动或自动添加 “盐”。** + +对于那些不清楚 **盐** 的意义的人,这里的 “盐” 指的是一个随机数据,它作为密码生成函数的一个额外的输入, 目的是保护密码免受词典攻击。 + +在执行下面的操作前,请确保你已经安装了 `mkpasswd`。 + +下面的命令将带 “盐” 加密一个密码。“盐” 的值是随机自动生成的。所以每次你运行下面的命令时,都将产生不同的输出,因为它每次接受了随机取值的 “盐”。 + + $ mkpasswd tecmint + +![使用 Crypt 来加密密码](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-Password-in-Linux.gif) + +*使用 Crypt 来加密密码* + +现在让我们来手动定义 “盐” 的值。每次它将产生相同的结果。请注意你可以输入任何你想输入的值来作为 “盐” 的值。 + + $ mkpasswd tecmint -s tt + +![带“盐”加密密码](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-Password-Using-Salt.gif) + +*带“盐”加密密码* + +另外, mkpasswd 还是交互式的,假如你在命令中没有提供密码,它将主动询问你来输入密码。 + +**4. 使用 aes-256-cbc 加密算法并使用带“盐”的密码(如 “tecmint”) 加密一个字符串(如 “Tecmint-is-a-Linux-Community”)。** + + # echo Tecmint-is-a-Linux-Community | openssl enc -aes-256-cbc -a -salt -pass pass:tecmint + +![在 Linux 中加密一个字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-A-String-in-Linux.gif) + +*在 Linux 中加密一个字符串* + +在上面例子中, [echo 命令][2]的输出通过管道传递给了 openssl 命令,使得该输出通过加密编码方式(enc:Encoding with Cipher ) 所加密,这个过程中使用了 aes-256-cbc 加密算法,并附带了密码 (tecmint) 和 “盐” 。 + +**5. 使用 openssl 命令的 -aes-256-cbc 解密选项来解密上面的字符串。** + + # echo U2FsdGVkX18Zgoc+dfAdpIK58JbcEYFdJBPMINU91DKPeVVrU2k9oXWsgpvpdO/Z | openssl enc -aes-256-cbc -a -d -salt -pass pass:tecmint + +![在 Linux 中解密字符串](http://www.tecmint.com/wp-content/uploads/2015/03/Decrypt-String-in-Linux.gif) + +*在 Linux 中解密字符串* + +现在就是这些内容了。 + +保持联系,保持连接,敬请关注。不要忘了在下面的评论中提供给我们您有价值的反馈。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/generate-encrypt-decrypt-random-passwords-in-linux/ + +作者:[Avishek Kumar][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[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-5485-1.html +[2]:http://linux.cn/article-3948-1.html \ No newline at end of file diff --git a/published/201505/20150331 Its Now Worth Try Installing PHP 7.0 on CentOS 7.x or Fedora 21.md b/published/201505/20150331 Its Now Worth Try Installing PHP 7.0 on CentOS 7.x or Fedora 21.md new file mode 100644 index 0000000000..2d059a4930 --- /dev/null +++ b/published/201505/20150331 Its Now Worth Try Installing PHP 7.0 on CentOS 7.x or Fedora 21.md @@ -0,0 +1,323 @@ +在CentOS 7.x / Fedora 21 上面体验 PHP 7.0 +=============================================================================== + +PHP是一种为我们熟知的通用服务器网页脚本语言。非常多的在线网站都是用PHP编写的。PHP这些年来一直在持续进化,丰富其功能,变得易于使用,更好地组织的脚本语言。目前PHP的开发团队正筹备下一个PHP版本的发行,名字是PHP 7。现在的PHP版本为PHP 5.6,可能你清楚PHP 6已经流产了,PHP 7的支持者们不希望下一个重要的版本被其他分支混淆,即过去已经停止很久的PHP 6。所以决定下一个PHP主要的发行版本叫PHP 7,而不是PHP 6。PHP 7.0预计在今年十一月份发行。 + +在下一代主要PHP版本里有一些不错的功能: + +- 为了改善执行效率与内存占用,新的版本添加了PHPNG功能。 +- 引入了JIT引擎来动态编译Zend操作码为自然机器码,以此来达到更快的处理性能。这项功能允许随后的程序调用同一份代码,这样会运行快很多。 +- AST(抽象语法树)是最新添加的功能,它可以增强支持PHP的扩展性和用户应用。 +- 添加异步编程功能以支持同一个请求中的并行任务。 +- 新的版本会支持独立的多线程网页服务器,这样可以使用一个单独的存储池处理很多并发的请求。 + +### 在CentOS/Fedora上安装PHP 7 ### + +让我们来看看怎样在CentOS 7和Fedora 21安装PHP7。为了安装PHP7,我们首先需要克隆php-src 仓库。当克隆工作完成,我们再配置和编译它。进行下一步之前,我们要确保已经在LInux系统下安装了如下的组件,否则PHP编译会返回错误中止。 + +- Git +- autoconf +- gcc +- bison + +所有上面提到的要求可以使用Yum软件包管理器安装。以下一条命令即可完成: + + yum install git autoconf gcc bison + +准备好开始安装PHP7了吗?让我们先创建一个PHP7目录,作为你的当前工作目录。 + + mkdir php7 + + cd php7 + +现在克隆php-src仓库,在终端里运行下面的命令。 + + git clone https://git.php.net/repository/php-src.git + +工作应该会在几分钟后完成,这里是一个样例输出,你应该会在任务完成时看见。 + + [root@localhost php7]# git clone https://git.php.net/repository/php-src.git + + Cloning into 'php-src'... + + remote: Counting objects: 615064, done. + + remote: Compressing objects: 100% (127800/127800), done. + + remote: Total 615064 (delta 492063), reused 608718 (delta 485944) + + Receiving objects: 100% (615064/615064), 152.32 MiB | 16.97 MiB/s, done. + + Resolving deltas: 100% (492063/492063), done. + +让我们来配置,编译PHP7,在终端运行下面的命令,开始配置工作: + + cd php-src + + ./buildconf + +下面是./buildconf命令的样例输出。 + + [root@localhost php-src]# ./buildconf + + buildconf: checking installation... + + buildconf: autoconf version 2.69 (ok) + + rebuilding aclocal.m4 + + rebuilding configure + + rebuilding main/php_config.h.in + +使用下面的命令,继续配置进程: + + ./configure \ + + --prefix=$HOME/php7/usr \ + + --with-config-file-path=$HOME/php7/usr/etc \ + + --enable-mbstring \ + + --enable-zip \ + + --enable-bcmath \ + + --enable-pcntl \ + + --enable-ftp \ + + --enable-exif \ + + --enable-calendar \ + + --enable-sysvmsg \ + + --enable-sysvsem \ + + --enable-sysvshm \ + + --enable-wddx \ + + --with-curl \ + + --with-mcrypt \ + + --with-iconv \ + + --with-gmp \ + + --with-pspell \ + + --with-gd \ + + --with-jpeg-dir=/usr \ + + --with-png-dir=/usr \ + + --with-zlib-dir=/usr \ + + --with-xpm-dir=/usr \ + + --with-freetype-dir=/usr \ + + --with-t1lib=/usr \ + + --enable-gd-native-ttf \ + + --enable-gd-jis-conv \ + + --with-openssl \ + + --with-mysql=/usr \ + + --with-pdo-mysql=/usr \ + + --with-gettext=/usr \ + + --with-zlib=/usr \ + + --with-bz2=/usr \ + + --with-recode=/usr \ + + --with-mysqli=/usr/bin/mysql_config + +这会花去不少的时间,当完成后你应该会看到如下面的输出: + + creating libtool + + appending configuration tag "CXX" to libtool + + Generating files + + configure: creating ./config.status + + creating main/internal_functions.c + + creating main/internal_functions_cli.c + + +--------------------------------------------------------------------+ + + | License: | + + | This software is subject to the PHP License, available in this | + + | distribution in the file LICENSE. By continuing this installation | + + | process, you are bound by the terms of this license agreement. | + + | If you do not agree with the terms of this license, you must abort | + + | the installation process at this point. | + + +--------------------------------------------------------------------+ + + + + Thank you for using PHP. + + + + config.status: creating php7.spec + + config.status: creating main/build-defs.h + + config.status: creating scripts/phpize + + config.status: creating scripts/man1/phpize.1 + + config.status: creating scripts/php-config + + config.status: creating scripts/man1/php-config.1 + + config.status: creating sapi/cli/php.1 + + config.status: creating sapi/cgi/php-cgi.1 + + config.status: creating ext/phar/phar.1 + + config.status: creating ext/phar/phar.phar.1 + + config.status: creating main/php_config.h + + config.status: executing default commands + + +运行下面的命令,完成编译过程。 + + make + +“make”命令的样例输出如下所示: + + Generating phar.php + + Generating phar.phar + + PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. + + clicommand.inc + + directorytreeiterator.inc + + directorygraphiterator.inc + + pharcommand.inc + + invertedregexiterator.inc + + phar.inc + + + + Build complete. + + Don't forget to run 'make test'. + +活儿干完了,该安装PHP7了,运行下面的命令安装它。 + + make install + +成功安装的进程的样例输出应该像这样: + + [root@localhost php-src]# make install + + Installing shared extensions: /root/php7/usr/lib/php/extensions/no-debug-non-zts-20141001/ + + Installing PHP CLI binary: /root/php7/usr/bin/ + + Installing PHP CLI man page: /root/php7/usr/php/man/man1/ + + Installing PHP CGI binary: /root/php7/usr/bin/ + + Installing PHP CGI man page: /root/php7/usr/php/man/man1/ + + Installing build environment: /root/php7/usr/lib/php/build/ + + Installing header files: /root/php7/usr/include/php/ + + Installing helper programs: /root/php7/usr/bin/ + + program: phpize + + program: php-config + + Installing man pages: /root/php7/usr/php/man/man1/ + + page: phpize.1 + + page: php-config.1 + + Installing PEAR environment: /root/php7/usr/lib/php/ + + [PEAR] Archive_Tar - installed: 1.3.13 + + [PEAR] Console_Getopt - installed: 1.3.1 + + [PEAR] Structures_Graph- installed: 1.0.4 + + [PEAR] XML_Util - installed: 1.2.3 + + [PEAR] PEAR - installed: 1.9.5 + + Wrote PEAR system config file at: /root/php7/usr/etc/pear.conf + + You may want to add: /root/php7/usr/lib/php to your php.ini include_path + + /root/php7/php-src/build/shtool install -c ext/phar/phar.phar /root/php7/usr/bin + + ln -s -f /root/php7/usr/bin/phar.phar /root/php7/usr/bin/phar + + Installing PDO headers: /root/php7/usr/include/php/ext/pdo/ + +恭喜你,PHP7已经安装在你的Linux系统上了。安装完后,进入PHP7安装文件里的sapi/cli里面。 + + cd sapi/cli + +验证一下PHP的版本。 + + [root@localhost cli]# ./php -v + + PHP 7.0.0-dev (cli) (built: Mar 28 2015 00:54:11) + + Copyright (c) 1997-2015 The PHP Group + + Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies + +### 总结 ### + +PHP 7也[添加到了remi仓库][1],这个即将到来的版本主要关注执行效率的提升,它的新特性致力于使PHP较好满足现代编程的需求和趋势。PHP 7.0将会有许多新的特性、丢弃一些老版本的东西。在接下来的日子里,我们希望看到新特性和弃用功能的具体情况。希望你喜欢! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-php-7-centos-7-fedora-21/ + +作者:[Aun Raza][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ +[1]:http://blog.famillecollet.com/post/2015/03/25/PHP-7.0-as-Software-Collection diff --git a/published/201505/20150331 Linux Email App Geary Updated--How To Install It In Ubuntu.md b/published/201505/20150331 Linux Email App Geary Updated--How To Install It In Ubuntu.md new file mode 100644 index 0000000000..da976c42d0 --- /dev/null +++ b/published/201505/20150331 Linux Email App Geary Updated--How To Install It In Ubuntu.md @@ -0,0 +1,71 @@ +Linux Email应用 Geary 更新了 +================================================================================ +**Geary,Linux上流行的桌面email客户端,更新到版本0.10了 — 并且有了很多新的功能。** + +![elementary OS上运行的旧版本的Geary](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/geary.jpg) + +*elementary OS上运行的旧版本的Geary* + +Geary 0.10有一些不错的用户界面改进以及额外的UI功能,包括: + +- 新增: 可以撤销归档、删除以及移动等操作 +- 新增: 在2列或者2列布局之间切换 +- 新的 “split header bar” — 改进邮件列表,发件人布局 +- 新的快捷键 — 使用j/k切换到上/下一封邮件 + +根据Yorba介绍,这次更新还引入了一个**全新的全文检索算法** ,用来改进Geary的搜索体验。 + +这个更新应该能平息一下对该应用的搜索能力的抱怨:Geary返回的搜索结果就如同软件自己所宣称的“看起来和查询语句毫不相关”。 + +> ‘Yorba 建议所有这个软件客户端的用户升级到这个版本’ + +*“尽管并不是所有的搜索问题在0.10版本中都解决了,但Geary能确保显示的结果能和更好的匹配用户的查询,”[团队表示][1]。* + +最后同样重要的是,专业用户会喜欢的主要功能:**支持一个账户有多个或者备用的email地址**。 + +如果你在Geary中设置Gmail账户来收取你的Yahoo,Outlook和KittyMail信件,你可以看到现在它们都整齐地放在一起,当你写信时在'From'栏你可以选择指定账户作为发送人。这并不是最重要,但是却是最经常被人要求的的功能。 + +这个流行的Linux电子邮件客户端的这次发布主要是bug修复,性能优化以及一些杂项改进。 + +Yorba建议所有这个客户端的用户都升级到这个发行版。 + +### 在Ubuntu 14.04, 14.10 & 15.04安装Geary 0.10 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/09/geary-inline-composor.jpg) + +Yorba的最新版本可以从GNOME的Git账户下载可编译的源代码。但说实话:这不是有点麻烦吗? + +Ubuntu用户想知道如何在 **14.04,14.10** 以及 **15.04**(那些更新爱好者) 上安装Geary 0.10。 + +官方的Youba PPA包括了 **Geary 最新版本** 以及Shotwell(照片管理器)和[California][2](日历应用)。请注意添加这个PPA会使你电脑上任何已经安装的这些应用更新到最近的版本。 + +Capiche? Coolio. + +在Ubuntu上安装Geary你首先需要添加Yorba PPA和你的软件源。做这些你只需要打开终端窗口并小心地输入下面的两条命令: + + sudo add-apt-repository ppa:yorba/ppa + + sudo apt-get update && sudo apt-get install geary + +在输入最后一条命令并敲击回车键后会提示输入你的密码。输入密码让安装完成。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/04/20130320161830-geary-yorba.png) + +完成后,打开你的桌面环境应用启动面板并查找‘Geary’图标。点击它,添加你的账户并查看[通过信息高速公路下载了什么][3],开始使用简单的图形界面吧。 + +**别忘记:你可以通过电子邮件告诉我们你想看的新闻,应用建议,以及任何你想我们包括的东西。** + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/03/install-geary-ubuntu-linux-email-update + +作者:[Joey-Elijah Sneddon][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:https://wiki.gnome.org/Apps/Geary/FullTextSearchStrategy +[2]:http://www.omgubuntu.co.uk/2014/10/california-calendar-natural-language-parser +[3]:https://www.youtube.com/watch?v=rxM8C71GB8w \ No newline at end of file diff --git a/published/201505/20150407 5 Linux Command Line Based Tools for Downloading Files and Browsing Websites.md b/published/201505/20150407 5 Linux Command Line Based Tools for Downloading Files and Browsing Websites.md new file mode 100644 index 0000000000..4e6f6f83d0 --- /dev/null +++ b/published/201505/20150407 5 Linux Command Line Based Tools for Downloading Files and Browsing Websites.md @@ -0,0 +1,164 @@ +5 个基于Linux命令行的文件下载和网站浏览工具 +================================================================================ + +Linux命令行是GNU/Linux中最神奇迷人的部分,它是非常强大的工具。命令行本身功能多样,多种内建或者第三方的命令行应用使得Linux变得更加健壮和强大。Linux Shell支持多种不同类型的网络应用,无论是BT下载软件,专用下载器或者互联网冲浪。 + +![命令行互联网工具](http://www.tecmint.com/wp-content/uploads/2014/02/Command-Line-Internet-Tools.jpg) + +*5个命令行互联网工具* + +这里我们介绍了5个很好的命令行互联网工具,它们非常有用,也很容易上手。 + +### 1. rTorrent ### + +rTorrent是基于文本,用C++编写,追求高性能的Torrent客户端。支持大部分标准的Linux发行版,包括FreeBSD和Mac OS X。 + +#### 安装rTorrent #### + + # apt­-get install rtorrent (基于 APT 的系统) + +---------- + + # yum install rtorrent (基于 YUM 的系统) + +在终端中用下面的命令检查rtorrent是否正确安装 + + # rtorrent + +![命令行torrent下载器](http://www.tecmint.com/wp-content/uploads/2014/02/rTorrent.jpeg) + +*rTorrent命令行工具* + +#### rTorrent的功能 #### + +一些有用的快捷键和使用方法 + +- CTRL+ q – 退出rTorrent应用程序 +- CTRL+ s – 开始下载 +- CTRL+ d – 停止运行中的下载或者移除已完成的下载 +- CTRL+ k – 停止并关闭运行中的下载 +- CTRL+ r – 在上传/下载种子之前进行Hash检查 +- CTRL+ q – 执行两次这个命令,rTorrent会直接退出而不发送“停止”信号 +- Left Arrow Key – 跳到上一屏幕 +- Right Arrow Key – 跳到下一屏幕 + +### 2. Wget ### + +Wget是GNU项目的一部分,名字由World Wide Web (WWW)衍生而来。Wget是用来递归下载、离线查看本地服务器HTML文件一个很好的工具,它可用于Windows, Mac,以及Linux等大部分平台。Wget能通过HTTP,HTTPS和FTP下载文件。另外,能镜像整个网站,支持代理浏览以及暂停/回复下载使得它更为有用。 + +#### 安装Wget #### + +由于是GNU项目的一部分,Wget捆绑在大部分标准Linux发行版中,不再需要独立下载安装。如果默认没有安装,你也可以使用apt或者yum安装。 + + # apt­-get install wget (基于 APT 的系统) + +---------- + + # yum install wget (基于 YUM 的系统) + +#### Wget的一些基本用法 #### + +使用wget下载一个单独的文件. + + # wget http://www.website-name.com/file + +递归下载整个网站. + + # wget -r http://www.website-name.com + +从一个网站下载指定类型的文件(例如 pdf 和 png). + + # wget -r -A png,pdf http://www.website-name.com + +Wget是一个很棒的工具,它允许在资源有限的机器上自定义或者过滤下载。这是镜像一个网站(Yahoo.com)的wget下载截图。 + +![Wget 下载文件](http://www.tecmint.com/wp-content/uploads/2014/02/Wget.jpeg) + +*Wget 命令行文件下载* + +要获取更多wget下载的例子,可以阅读我们的文章[Wget下载命令例子][1]。 + +### 3. cURL ### + +cURL是在多种协议上传输数据的命令行工具。cURL是支持FTP, HTTP, FTPS, TFTP, TELNET, IMAP, POP3等协议的客户端应用。cURL是一个不同于wget 的简单下载器,和其它的相比,它支持LDAP,POP3。cURL也很好的支持代理下载,暂停下载以及恢复下载。 + +#### 安装cURL #### + +在软件仓库或者已安装软件中,cURL在大部分发行版中默认是可用的。如果没有安装,运行apt或者yum从软件仓库中获取需要的安装包。 + + # apt­-get install curl (基于 APT 的系统) + +---------- + + # yum install curl (基于 YUM 的系统) + +cURL的基本使用方法 + + # curl www.tecmint.com + +![Curl 下载](http://www.tecmint.com/wp-content/uploads/2014/02/Curl.jpeg) + +*Curl 下载* + +![Curl 下载数据](http://www.tecmint.com/wp-content/uploads/2014/02/Curl-2.jpeg) + +*Curl 下载* + +### 4. w3m ### + +W3m是GPL协议下发布的基于文本的web浏览器。W3m支持表格,帧,颜色,SSL连接以及内联图像。W3m以快速浏览而出名。 + +#### 安装w3m #### + +W3m在大部分Linux发行版中也是默认可用的。如果不可用的话可以用apt或者yum获取需要的安装包。 + + # apt­-get install w3m (基于 APT 的系统) + +---------- + + # yum install w3m (基于 YUM 的系统) + +#### w3m的基本使用方法 #### + + # w3m www.tecmint.com + +![命令行浏览器](http://www.tecmint.com/wp-content/uploads/2014/02/w3m.jpeg) + +*基于文本的web浏览器w3m* + +### 5. Elinks ### + +Elinks是基于文本的免费浏览器,用于Unix及基于Unix的系统。Elinks支持 HTTP,HTTP Cookies以及支持浏览Perl和Ruby脚本(LCTT 译注:应该是指 CGI)。也很好的支持选项卡浏览。最棒的是它支持鼠标、彩色以及支持一系列的协议,例如HTTP, FTP, SMB, Ipv4 和 Ipv6。 + +#### 安装Elinks #### + +Elinks在大部分Linux发行版上是默认可用的。如果不是的话,可以通过apt或者yum安装。 + + # apt­-get install elinks (基于 APT 的系统) + +---------- + + # yum install elinks (基于 YUM 的系统) + +Elinks的基本使用方法 + + # elinks www.tecmint.com + +![命令行互联网浏览](http://www.tecmint.com/wp-content/uploads/2014/02/Elinks.jpeg) + +*Elinks命令行浏览互联网* + +就是这些了。有你们喜欢读的有趣的文章,我会再次来到这里。到那时尽请关注并保持和Tecmint的联系,别忘了在评论部分给我们你的宝贵的反馈。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-command-line-tools-for-downloading-files/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[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-4129-1.html \ No newline at end of file diff --git a/published/201505/20150407 Ambient Noise Player for Ubuntu Plays Relaxing Sounds to Keep You Creative.md b/published/201505/20150407 Ambient Noise Player for Ubuntu Plays Relaxing Sounds to Keep You Creative.md new file mode 100644 index 0000000000..c636b01820 --- /dev/null +++ b/published/201505/20150407 Ambient Noise Player for Ubuntu Plays Relaxing Sounds to Keep You Creative.md @@ -0,0 +1,56 @@ +环境音播放器:让人放松的声音,保持你的创造力 +================================================================================ +![Rain is a soothing sound for some](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/raining-1600x900-wallpaper_www.wallpapermay.com_84-1.jpg) + +*对于某些人来说雨声是个令人安心的声音* + +**如果我想变得非常有效率,我不能听‘正常’的音乐。它会使我分心,我会开始跟着唱或者让我想起另一首歌,结局就是我在自己的音乐库里到处戳并且……反正,你懂的。** + +同样我也不能在寂静的环境中工作(虽然和6只猫生活在一起意味着这不太可能)但是无规律的刺耳声音和突然地咔哒声以及猫叫声会打破寂静。 + +我的解决办法是听**环境音**。 + +我发现它能帮助我消除大脑的里的胡思乱想,提供了一个声景覆盖了猫咪玩耍的声音。 + +环境音就是日常生活中的背景噪音;雨滴在窗户上敲打的声音,咖啡店里人们聊天的嗡嗡声,风中鸟儿们闲聊的声音,等等。 + +倾听这些声音会强迫一个疯狂运行的大脑减速,重新沉静下来重新把精力聚集到重要的事情上。 + +### 适用于Ubuntu的环境音应用 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/ambient-noise-player-750x365.jpg) + +Google Play和苹果应用商店充满了环境音和白噪声的应用。现在,在Ubuntu里有同样的应用了。 + +‘[Ambient Noise (环境音)][1] ’——人如其名,这是一个专门被设计成播放这种声音的音频播放器。他甚至可以同Ubuntu声音菜单整合到一起,给你‘选择,点击即放松’的体验。 + +这个应用(又被称为‘ANoise播放器’,由Marcos Costales制作)带有**8个高品质音频**。 + +这8个预设音频涵盖了多种环境,从下雨时有节奏的声音,到夜晚大自然静谧的旋律,还有下午熙熙攘攘的咖啡店的嗡嗡声。 + +### 在Ubuntu上安装ANoise播放器 ### + +适用于Ubuntu的环境音播放器是个免费的应用而且可以从它专用的PPA里安装。 + +要这样安装请先打开一个新的终端窗口运行: + + sudo add-apt-repository ppa:costales/anoise + + sudo apt-get update && sudo apt-get install anoise + +安装好以后只需从Unity Dash(或桌面环境里类同的地方)里打开它,通过声音菜单选择你喜欢的环境音然后……放松吧!这个应用甚至记得你上次用的环境音。 + +即便如此,你还是要试一试看它是否能满足你的需要。我要说的是让我知道你是怎么想的,但是我将会专心致志到听不到你的声音——你可能也会这样! + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/04/ambient-noise-player-app-for-ubuntu-linux + +作者:[Joey-Elijah Sneddon][a] +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://anoise.tuxfamily.org/ diff --git a/published/201505/20150407 How To Install CentOS Web Panel In CentOS.md b/published/201505/20150407 How To Install CentOS Web Panel In CentOS.md new file mode 100644 index 0000000000..fe038b4406 --- /dev/null +++ b/published/201505/20150407 How To Install CentOS Web Panel In CentOS.md @@ -0,0 +1,322 @@ +如何在CentOS上面安装“CentOS网页面板” +=========================================================================== +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/04/centos-790x427.jpg) + +### 关于CentOS网页面板 ### + +目前有很多免费的或者付费的控制面板。今天,我们来讨论[CentOS网页面板(CWP)][1],这是特别为基于RPM 的发行版,如CentOS,RHEL,Scientific Linux等设计的。**CWP** 是免费且开源的控制面板,可以被广泛用于简单地配置一个网页托管环境。不同于其他的控制面板,CWP能自动部署LAMP的软件栈及Varnish 缓存服务器。 + +### 特性 ### + +CWP有很多的特性和免费的服务。如我前面提到的一样,CWP会在你的服务器上自动安装全套的LAMP服务(apache,php,phpmyadmin,webmail,mailserver等等)。 + +### CWP安装过程中会安装和配置的软件列表 ### + +- Apache 网页服务器 +- PHP 5.4 +- MySQL + phpMyAdmin +- Postfix + Dovecot + roundcube webmail +- CSF 防火墙 +- File System Lock (不需要修改网站,你的所有文件都会被锁定修改) +- Backups; AutoFixer ,用于服务器配置 + +### 第三方应用: ### + +- CloudLinux + CageFS + PHP Selector +- Softaculous – 脚本安装器 (免费版和白金版) + +#### 网页服务器: #### + +- Varnish 缓存服务器 +- 从代码编译 Apache +- Apache 重新编译+附加模块 +- Apache 服务器状态,配置 +- 编辑 Apache 虚拟主机、虚拟主机模版,包括配置 +- 重建所有 Apache 虚拟主机 +- suPHP & suExec +- Mod Security + OWASP 规则 +- Tomcat 8 服务器管理 +- DoS 防护 +- Perl cgi 脚本支持 + +#### PHP: #### + +- PHP 切换器 (在PHP版本如: 5.2、 5.3、 5.4、 5.5之间切换) +- PHP选择器,选择每个用户或者每个文件的PHP版本(PHP 4.4、 5.2、 5.3、 5.4、5.5、 5.6) +- 简单的php编辑器 +- 在用户面板下简单的php.ini生成器 +- PHP 插件 +- PHP.ini 编辑器 & PHP 信息 和列出模块 +- 每个帐号一个php.ini +- FFMPEG,用于视频流网站 +- CloudLinux + PHP 选择器 + +#### 用户管理 #### + +- 添加、列出、编辑和移除用户 +- 用户监管 +- Shell访问管理 +- 用户限制管理 +- 限制进程 +- 限制访问文件 +- 用户 FTP & File 管理器 +- CloudLinux + CageFS +- 每个帐号专有IP + +#### DNS: #### + +- FreeDNS +- 添加、编辑、列出和移除DNS区块 +- 编辑域名服务的IP +- DNS区块模板编辑器 +- 新的易用DNS区块管理器 (用ajax) +- 新的DNS区块列表,带有额外的google解析信息 (同时检测 rDNS, 域名服务…) + +#### Email: #### + +- Postfix & dovecot +- 邮箱、别名 +- Roundcube webmail +- Postfix 邮件队列 +- rDNS 检查器模块 +- 垃圾邮件拦截 +- SPF & DKIM集成 +- 重构带有反病毒、反垃圾邮件防护的 Postfix/Dovecot 的邮件服务器 +- Email 自动应答器 + +#### 系统: #### + +- CPU核心和时钟信息 +- 内存使用信息 +- 详细的磁盘状态 +- 软件信息如内核版本、正常运行时间等等. +- 服务器状态 +- ChkConfig管理 +- 网络端口使用 +- 网络配置 +- sshd 配置 +- 自动修复(检查重要的配置并尝试自动修复问题) + +#### 监控: #### + +- 监控服务,例如 top、 apache 状态、 mysql 等 +- 在面板内使用Java SSH 终端/控制台 +- 服务器配置 (例如 Apache、 PHP、 MySQL 等) +- 在屏幕/后台运行命令行 + +#### 安全: #### + +- CSF防火墙 +- SSL生成器 +- SSL证书管理 +- CloudLinux + CageFS + +#### SQL: #### + +- MySQL 数据库管理 +- 添加本地或者远程访问的用户 +- 实时监控MySQL进程列表 +- 创建,移除数据库 +- 为每个数据库添加额外的用户 +- MySQL服务器配置 +- PhpMyAdmin +- PostgreSQL, phpPgAdmin支持 + +#### 额外功能: #### + +- TeamSpeak 3 管理器 +- Shoutcast 管理器 +- 自动更新 +- 备份管理器 +- 文件管理器 +- 每个域名的虚拟FTP用户 +- cPanel帐号迁移 (恢复文件,数据库和数据库用户) +- 还有更多 + +### 在CentOS 6上安装CentOS网页面板 ### + +写这篇教程的时候,CWP仅仅支持最高CentOS 6.x版本。在CentOS 7和更高的版本中是不支持的。 + +#### 前期准备: #### + +**安装CWP之前,你必须知道以下的信息:** + +- CWP 仅支持静态IP地址。它并不支持动态的,或者内部的IP地址。 +- CWP 并没有卸载程序。当你安装CWP后,你必须重新安装服务器来移除它。 +- 只能在一个新装的还没做任何配置改变的操作系统上安装CWP。 +- 对于32位操作系统至少需要512MB RAM。 +- 64位系统需要1024MB RAM。 +- 要求至少20GB的硬盘空间。 + +如果是在VirtualBox上面测试,640MB RAM和10GB磁盘空间就足够了。 + +#### 更新服务器: #### + +首先安装wget包,这是下载CWP需要的。 + + yum install wget -y + +使用命令更新你的服务器: + + yum update -y + +重启一次,激活更新。 + +#### 安装CWP: #### + +进入**/usr/local/src/**目录: + + cd /usr/local/src + +使用命令下载最新的CWP版本: + + wget http://centos-webpanle.com/cwp-latest + +如果上面的URL出现错误,用下面的链接代替。 + + wget http://dl1.centos-webpanle.com/files/cwp-latest + +然后,用命令开始安装CWP: + + sh cwp-latest + +**样例输出:** + +![](http://www.unixmen.com/wp-content/uploads/2015/04/root@server-usr-local-src_001.png) + +![](http://www.unixmen.com/wp-content/uploads/2015/04/root@server-usr-local-src_002.png) + +安装过程会持续到30分钟或者更多,取决于你的网速。 + +最后,你会看到如下安装完成的信息。记下一些详细信息,如mysql超级用户密码和CWP的登录URL,你随后会需要它们。然后,按下回车Enter重启系统。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/root@server-usr-local-src_004.png) + +重启进入系统后,你会看见CWP的欢迎登录信息。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CentOS-6.5-Minimal-Running-Oracle-VM-VirtualBox_006.png) + +#### 调整防火墙/路由: #### + +CWP的默认网页控制界面的端口是**2030(http)**和**2031(https)**。你应该通过防火墙/路由允许使用这两个端口,以便远程接入CWP网络控制台。 + +编辑iptables文件: + + vi /etc/sysconfig/iptables + +添加如下的内容: + + [...] + -A INPUT -p tcp -m state --state NEW -m tcp --dport 2030 -j ACCEPT + -A INPUT -p tcp -m state --state NEW -m tcp --dport 2031 -j ACCEPT + [...] + +保存并关掉文件。更新iptables服务使改变生效。 + + service iptables restart + +### 进入CWP网络控制台 ### + +打开你的浏览器,键入: + +**http://IP-Address:2030/** + +或 + +**https://IP-Address:2031/** + +你会看到类似下面的屏幕。 + +登录认证: + +- **Username**:root +- **Password**:你的root密码 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/Login-CentOS-WebPanel-Mozilla-Firefox_007.png) + +恭喜你!CWP已经安装成功了。 + +### CWP基本的配置 ### + +接下来,我们得做一些事,比如: + +1. 设置域名服务器 +1. 设置 ip 共享(必须是你的公共IP地址) +1. 设置至少一个托管包(或者编辑默认的包) +1. 设置 root 电子邮件,等等。 + +#### 设置域名服务器: #### + +为建立域名服务器,找到**DNS Functions -> Edit nameservers IPs**。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_009.png) + +设置你的域名服务器,点击保存按钮。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_010.png) + +#### 建立共享IP和Root邮件地址: #### + +在你的主机上托管网站,这是非常重要的一步。为了建立共享IP,进入**CWP Setting -> Edit settings**。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_011.png) + +输入你的静态IP和邮件地址,然后点击保存设置按钮。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_012.png) + +现在,CWP可以进行网站维护了。 + +#### 建立托管包 #### + +一个托管包就是一个网站托管计划,包括允许访问的磁盘空间,带宽,但没有FTP帐号,邮箱地址和数据库等等。你可以建立任意数量的网站托管计划,只要你喜欢。 + +要添加一个包,从CWP的控制台进入**Packages — Add a Package** + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_013.png) + +输入包的名字,允许访问的磁盘配额/RAM数量,FTP/Email帐号,数据库和子域名等等。点击保存设置按钮,建立一个网站托管计划。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_014.png) + +现在,CWP可以管理你的域名了。 + +#### 添加域名: #### + +创建新的域名,你至少得有一个用户帐号。 + +而添加一个用户,请进入**User Account -> New Account**。 + +输入域名(ex.unixmen.com),用户名,密码和邮箱地址等等。最后,点击**Create**。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_016.png) + +现在,我们添加一个新的域名。 + +进入**Domains -> Add Domain**。 + +输入新的域名,并且指定这个域名与用户名关联。 + +![](http://www.unixmen.com/wp-content/uploads/2015/04/CWP.admin-Mozilla-Firefox_017.png) + +### 总结 ### + +在这篇教程中,我们看到了如何安装和配置CentOS网页面板,来创建一个简单的网站主机环境。CWP安装和使用非常简单。甚至一个菜鸟也可以在几个小时内建立一个基本的网站主机服务器。并且,CWP完全免费和开源。试一试吧!你不会失望的。 + +你可以在[CentOS Web Panel Wikipage][2]找到更多关于CWP的信息。 + +加油! + +--------------------------------------------------------------------------- + +via: http://www.unixmen.com/how-to-install-centos-web-panel-in-centos/ + +作者:[SK][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:http://centos-webpanel.com/ +[2]:http://wiki.centos-webpanel.com/ diff --git a/published/201505/20150407 How to secure BGP sessions using authentication on Quagga.md b/published/201505/20150407 How to secure BGP sessions using authentication on Quagga.md new file mode 100644 index 0000000000..9881d73c40 --- /dev/null +++ b/published/201505/20150407 How to secure BGP sessions using authentication on Quagga.md @@ -0,0 +1,86 @@ +Quagga上使用验证加固BGP会话安全 +================================================================================ +BGP协议运行于TCP之上,因而,它也继承了TCP连接的所有漏洞。例如,在一个BGP会话内,攻击者可以冒充一个合法的BGP邻居,然后说服另一端的BGP路由器共享路由信息给攻击者。在攻击者通告并向邻居路由注入伪造的路由时,就会发生这个问题。毫无戒备的邻居路由器就会开始向攻击者发送通信实况,实际上这些信息并没有去向任何地方,仅仅只是被丢弃了。回到2008年,YouTube实际上也[受害于][1]这样的BGP路由中毒,并遭受了长达一个小时的视频服务大量中断。一个更加糟糕的情况是,如果攻击者是个足够懂行的人,他们可以伪装成一台透明路由器,然后嗅探经过的通信以获取敏感数据。你可以想象,这会造成深远的影响。 + +要保护活跃的BGP会话不受攻击,许多服务提供商在BGP会话中使用[MD5校验和及预共享密钥][2]。在受保护的BGP会话中,一台发送包的BGP路由器通过使用预共享的密钥生成MD5散列值、部分IP和TCP头以及有效载荷。然后,MD5散列作为一个TCP选项字段存储。在收到包后,接受路由器用同样的方法使用预共享密钥生成它的MD5版本。它会将它的MD5散列和接收到的某个包的值进行对比,以决定是否接受该包。对于一个攻击者而言,几乎不可能猜测到校验和或其密钥。对于BGP路由器而言,它们能在使用包的内容前确保每个包的合法性。 + +在本教程中,我们将为大家演示如何使用MD5校验和以及预共享密钥来加固两个邻居间的BGP会话的安全。 + +### 准备 ### + +加固BGP会话安全是相当简单而直截了当的,我们会使用以下路由器。 + + + + + + + + + + + + + + + + + +
路由器名称AS 号IP地址
router-A10010.10.12.1/30
router-B20010.10.12.2/30
+ +常用的Linux内核原生支持IPv4和IPv6的TCP MD5选项。因此,如果你从全新的[Linux机器][3]构建了一台Quagga路由器,TCP的MD5功能会自动启用。剩下来的事情,仅仅是配置Quagga以使用它的功能。但是,如果你使用的是FreeBSD机器或者为Quagga构建了一个自定义内核,请确保内核开启了TCP的MD5支持(如,Linux中的CONFIG_TCP_MD5SIG选项)。 + +### 配置Router-A验证功能 ### + +我们将使用Quagga的CLI Shell来配置路由器,我们将使用的唯一的一个新命令是‘password’。 + + [root@router-a ~]# vtysh + router-a# conf t + router-a(config)# router bgp 100 + router-a(config-router)# network 192.168.100.0/24 + router-a(config-router)# neighbor 10.10.12.2 remote-as 200 + router-a(config-router)# neighbor 10.10.12.2 password xmodulo + +本例中使用的预共享密钥是‘xmodulo’。很明显,在生产环境中,你需要选择一个更健壮的密钥。 + +**注意**: 在Quagga中,‘service password-encryption’命令被用做加密配置文件中所有明文密码(如,登录密码)。然而,当我使用该命令时,我注意到BGP配置中的预共享密钥仍然是明文的。我不确定这是否是Quagga的限制,还是版本自身的问题。 + +### 配置Router-B验证功能 ### + +我们将以类似的方式配置router-B。 + + [root@router-b ~]# vtysh + router-b# conf t + router-b(config)# router bgp 200 + router-b(config-router)# network 192.168.200.0/24 + router-b(config-router)# neighbor 10.10.12.1 remote-as 100 + router-b(config-router)# neighbor 10.10.12.1 password xmodulo + +### 验证BGP会话 ### + +如果一切配置正确,那么BGP会话就应该起来了,两台路由器应该能交换路由表。这时候,TCP会话中的所有流出包都会携带一个MD5摘要的包内容和一个密钥,而摘要信息会被另一端自动验证。 + +我们可以像平时一样通过查看BGP的概要来验证活跃的BGP会话。MD5校验和的验证在Quagga内部是透明的,因此,你在BGP级别是无法看到的。 + +![](https://farm8.staticflickr.com/7621/16837774368_e9ff66b370_c.jpg) + +如果你想要测试BGP验证,你可以配置一个邻居路由,设置其密码为空,或者故意使用错误的预共享密钥,然后查看发生了什么。你也可以使用包嗅探器,像tcpdump或者Wireshark等,来分析通过BGP会话的包。例如,带有“-M ”选项的tcpdump将验证TCP选项字段的MD5摘要。 + +###小结### + +在本教程中,我们演示了怎样简单地加固两台路由间的BGP会话安全。相对于其它协议而言,配置过程非常简明。强烈推荐你加固BGP会话安全,尤其是当你用另一个AS配置BGP会话的时候。预共享密钥也应该安全地保存。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/bgp-authentication-quagga.html + +作者:[Sarmed Rahman][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/sarmed +[1]:http://research.dyn.com/2008/02/pakistan-hijacks-youtube-1/ +[2]:http://tools.ietf.org/html/rfc2385 +[3]:https://linux.cn/article-4232-1.html diff --git a/published/201505/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md b/published/201505/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md new file mode 100644 index 0000000000..00003eaa19 --- /dev/null +++ b/published/201505/20150409 4 Tools Send Email with Subject, Body and Attachment in Linux.md @@ -0,0 +1,261 @@ +4个可以发送完整电子邮件的命令行工具 +================================================================================ +今天的文章里我们会讲到一些使用Linux命令行工具来发送带附件的电子邮件的方法。它有很多用处,比如在应用程序所在服务器上,使用电子邮件发送一个文件过来,或者你可以在脚本中使用这些命令来做一些自动化操作。在本文的例子中,我们会使用foo.tar.gz文件作为附件。 + +有不同的命令行工具可以发送邮件,这里我分享几个多数用户会使用的工具,如`mailx`、`mutt`和`swaks`。 + +我们即将呈现的这些工具都是非常有名的,并且存在于多数Linux发行版默认的软件仓库中,你可以使用如下命令安装: + +在 **Debian / Ubuntu** 系统 + + apt-get install mutt + apt-get install swaks + apt-get install mailx + apt-get install sharutils + +在基于Red Hat的系统,如 **CentOS** 或者 **Fedora** + + yum install mutt + yum install swaks + yum install mailx + yum install sharutils + +### 1) 使用 mail / mailx ### + +`mailx`工具在多数Linux发行版中是默认的邮件程序,现在已经支持发送附件了。如果它不在你的系统中,你可以使用上边的命令安装。有一点需要注意,老版本的mailx可能不支持发送附件,运行如下命令查看是否支持。 + + $ man mail + +第一行看起来是这样的: + + mailx [-BDdEFintv~] [-s subject] [-a attachment ] [-c cc-addr] [-b bcc-addr] [-r from-addr] [-h hops] [-A account] [-S variable[=value]] to-addr . . . + +如果你看到它支持`-a`的选项(-a 文件名,将文件作为附件添加到邮件)和`-s`选项(-s 主题,指定邮件的主题),那就是支持的。可以使用如下的几个例子发送邮件。 + +**a) 简单的邮件** + +运行`mail`命令,然后`mailx`会等待你输入邮件内容。你可以按回车来换行。当输入完成后,按Ctrl + D,`mailx`会显示EOT表示结束。 + +然后`mailx`会自动将邮件发送给收件人。 + + $ mail user@example.com + + HI, + Good Morning + How are you + EOT + +**b) 发送有主题的邮件** + + $ echo "Email text" | mail -s "Test Subject" user@example.com + +`-s`的用处是指定邮件的主题。 + +**c) 从文件中读取邮件内容并发送** + + $ mail -s "message send from file" user@example.com < /path/to/file + +**d) 将从管道获取到的`echo`命令输出作为邮件内容发送** + + $ echo "This is message body" | mail -s "This is Subject" user@example.com + +**e) 发送带附件的邮件** + + $ echo “Body with attachment "| mail -a foo.tar.gz -s "attached file" user@example.com + +`-a`选项用于指定附件。 + +### 2) mutt ### + +Mutt是类Unix系统上的一个文本界面邮件客户端。它有20多年的历史,在Linux历史中也是一个很重要的部分,它是最早支持进程打分和多线程处理的客户端程序之一。按照如下的例子来发送邮件。 + +**a) 带有主题,从文件中读取邮件的正文,并发送** + + $ mutt -s "Testing from mutt" user@example.com < /tmp/message.txt + +**b) 通过管道获取`echo`命令输出作为邮件内容发送** + + $ echo "This is the body" | mutt -s "Testing mutt" user@example.com + +**c) 发送带附件的邮件** + + $ echo "This is the body" | mutt -s "Testing mutt" user@example.com -a /tmp/foo.tar.gz + +**d) 发送带有多个附件的邮件** + + $ echo "This is the body" | mutt -s "Testing" user@example.com -a foo.tar.gz –a bar.tar.gz + +### 3) swaks ### + +Swaks(Swiss Army Knife,瑞士军刀)是SMTP服务上的瑞士军刀,它是一个功能强大、灵活、可编程、面向事务的SMTP测试工具,由John Jetmore开发和维护。你可以使用如下语法发送带附件的邮件: + + $ swaks -t "foo@bar.com" --header "Subject: Subject" --body "Email Text" --attach foo.tar.gz + +关于Swaks一个重要的地方是,它会为你显示整个邮件发送过程,所以如果你想调试邮件发送过程,它是一个非常有用的工具。 + +它会给你提供了邮件发送过程的所有细节,包括邮件接收服务器的功能支持、两个服务器之间的每一步交互。 + +### 4) uuencode ### + +邮件传输系统最初是被设计来传送7位编码(类似ASCII)的内容的。这就意味这它是用来发送文本内容,而不能发会使用8位的二进制内容(如程序文件或者图片)。`uuencode`(“UNIX to UNIX encoding”,UNIX之间使用的编码方式)程序用来解决这个限制。使用`uuencode`,发送端将二进制格式的转换成文本格式来传输,接收端再转换回去。 + +我们可以简单地使用`uuencode`和`mailx`或者`mutt`配合,来发送二进制内容,类似这样: + + $ uuencode example.jpeg example.jpeg | mail user@example.com + +### Shell脚本:解释如何发送邮件 ### + + #!/bin/bash + + FROM="" + SUBJECT="" + ATTACHMENTS="" + TO="" + BODY="" + + # 检查文件名对应的文件是否存在 + function check_files() + { + output_files="" + for file in $1 + do + if [ -s $file ] + then + output_files="${output_files}${file} " + fi + done + echo $output_files + } + + echo "*********************" + echo "E-mail sending script." + echo "*********************" + echo + + # 读取用户输入的邮件地址 + while [ 1 ] + do + if [ ! $FROM ] + then + echo -n -e "Enter the e-mail address you wish to send mail from:\n[Enter] " + else + echo -n -e "The address you provided is not valid:\n[Enter] " + fi + + read FROM + echo $FROM | grep -E '^.+@.+$' > /dev/null + if [ $? -eq 0 ] + then + break + fi + done + + echo + + # 读取用户输入的收件人地址 + while [ 1 ] + do + if [ ! $TO ] + then + echo -n -e "Enter the e-mail address you wish to send mail to:\n[Enter] " + else + echo -n -e "The address you provided is not valid:\n[Enter] " + fi + + read TO + echo $TO | grep -E '^.+@.+$' > /dev/null + if [ $? -eq 0 ] + then + break + fi + done + + echo + + # 读取用户输入的邮件主题 + echo -n -e "Enter e-mail subject:\n[Enter] " + read SUBJECT + + echo + + if [ "$SUBJECT" == "" ] + then + echo "Proceeding without the subject..." + fi + + # 读取作为附件的文件名 + echo -e "Provide the list of attachments. Separate names by space. + If there are spaces in file name, quote file name with \"." + read att + + echo + + # 确保文件名指向真实文件 + attachments=$(check_files "$att") + echo "Attachments: $attachments" + + for attachment in $attachments + do + ATTACHMENTS="$ATTACHMENTS-a $attachment " + done + + echo + + # 读取完整的邮件正文 + echo "Enter message. To mark the end of message type ;; in new line." + read line + + while [ "$line" != ";;" ] + do + BODY="$BODY$line\n" + read line + done + + SENDMAILCMD="mutt -e \"set from=$FROM\" -s \"$SUBJECT\" \ + $ATTACHMENTS -- \"$TO\" <<< \"$BODY\"" + echo $SENDMAILCMD + + mutt -e "set from=$FROM" -s "$SUBJECT" $ATTACHMENTS -- $TO <<< $BODY + +** 脚本输出 ** + + $ bash send_mail.sh + ********************* + E-mail sending script. + ********************* + + Enter the e-mail address you wish to send mail from: + [Enter] test@gmail.com + + Enter the e-mail address you wish to send mail to: + [Enter] test@gmail.com + + Enter e-mail subject: + [Enter] Message subject + + Provide the list of attachments. Separate names by space. + If there are spaces in file name, quote file name with ". + send_mail.sh + + Attachments: send_mail.sh + + Enter message. To mark the end of message type ;; in new line. + This is a message + text + ;; + +### 总结 ### + +有很多方法可以使用命令行/Shell脚本来发送邮件,这里我们只分享了其中4个类Unix系统可用的工具。希望你喜欢我们的文章,并且提供您的宝贵意见,让我们知道您想了解哪些新工具。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-shell-script/send-email-subject-body-attachment-linux/ + +作者:[Bobbin Zachariah][a] +译者:[goreliu](https://github.com/goreliu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bobbin/ \ No newline at end of file diff --git a/published/201505/20150409 Install Inkscape - Open Source Vector Graphic Editor.md b/published/201505/20150409 Install Inkscape - Open Source Vector Graphic Editor.md new file mode 100644 index 0000000000..c6361e780b --- /dev/null +++ b/published/201505/20150409 Install Inkscape - Open Source Vector Graphic Editor.md @@ -0,0 +1,95 @@ +Inkscape - 开源适量图形编辑器 +================================================================================ +Inkscape是一款开源矢量图形编辑工具,并不同于Xara X、Corel Draw和Adobe Illustrator等竞争对手,它使用的是可缩放矢量图形(SVG)图形格式。SVG是一个广泛部署、免版税使用的图形格式,由W3C SVG工作组开发和维护。这是一个跨平台工具,完美运行于Linux、Windows和Mac OS上。 + +Inkscape始于2003年,起初它的bug跟踪系统托管于Sourceforge上,但是后来迁移到了Launchpad上。当前它最新的一个稳定版本是0.91,它不断地在发展和修改中。我们将在本文里了解一下它的突出特点和安装过程。 + +### 显著特性 ### + +让我们直接来了解这款应用程序的显著特性。 + +#### 创建对象 #### + +- 用铅笔工具来画出不同颜色、大小和形状的手绘线,用贝塞尔曲线(笔式)工具来画出直线和曲线,通过书法工具来应用到手写的书法笔画上等等 +- 用文本工具来创建、选择、编辑和格式化文本。在纯文本框、在路径上或在形状里操作文本 +- 方便绘制各种形状,像矩形、椭圆形、圆形、弧线、多边形、星形和螺旋形等等并调整其大小、旋转并修改(圆角化)它们 +- 用简单地命令创建并嵌入位图 + +#### 对象处理 #### + +- 通过交互式操作和调整参量来扭曲、移动、测量、旋转目标 +- 可以对 Z 轴进行提升或降低操作。 +- 通过对象组合和取消组合可以创建一个虚拟层用来编辑或处理 +- 图层采用层次结构树的结构,并且能锁定或以各式各样的处理方式来重新布置 +- 分布与对齐指令 + +#### 填充与边框 #### + +- 可以复制/粘贴不同风格 +- 取色工具 +- 用RGB, HSL, CMS, CMYK和色盘这四种不同的方式选色 +- 渐变层编辑器能创建和管理多停点渐变层 +- 使用图像或其它选择区作为花纹填充 +- 用一些预定义点状花纹进行笔触填充 +- 通过路径标示器标示开始、对折和结束点 + +#### 路径上的操作 #### + +- 节点编辑:移动节点和贝塞尔曲线控制点,节点的对齐和分布等等 +- 布尔运算(是或否) +- 运用可变的路径起迄点可简化路径 +- 路径插入和增设连同动态和链接偏移对象 +- 通过路径追踪把位图图像转换成路径(彩色或单色路径) + +#### 文本处理 #### + +- 所有安装好的框线字体都能用,甚至可以从右至左对齐对象 +- 格式化文本、调整字母间距、行间距或列间距 +- 路径上和形状上的文本中的文本、路径或形状都可以被编辑和修改 + +#### 渲染 #### + +- Inkscape完全支持抗锯齿显示,这是一种通过柔化边界上的像素从而减少或消除凹凸锯齿的技术。 +- 支持alpha透明显示和PNG格式图片的导出 + +### 在Ubuntu 14.04和14.10上安装Inkscape ### + +为了在Ubuntu上安装Inkscape,我们首先需要 [添加它的稳定版Personal Package Archive][1] (PPA) 至Advanced Package Tool (APT) 库中。打开终端并运行一下命令来添加它的PPA: + + sudo add-apt-repository ppa:inkscape.dev/stable + +![PPA Inkscape](http://blog.linoxide.com/wp-content/uploads/2015/03/PPA-Inkscape.png) + +PPA添加到APT库中后,我们要用以下命令进行更新: + + sudo apt-get update + +![Update APT](http://blog.linoxide.com/wp-content/uploads/2015/03/Update-APT2.png) + +更新好库之后,我们准备用以下命令来完成安装: + + sudo apt-get install inkscape + +![Install Inkscape](http://blog.linoxide.com/wp-content/uploads/2015/03/Install-Inkscape.png) + +恭喜,现在Inkscape已经被安装好了,我们可以充分利用它的丰富功能特点来编辑制作图像了。 + +![Inkscape Main](http://blog.linoxide.com/wp-content/uploads/2015/03/Inkscape-Main1.png) + +### 结论 ### + +Inkscape是一款特点鲜明的图形编辑工具,它给予用户充分发挥自己艺术能力的权利。它还是一款自由安装和自定义的开源应用,并且支持各种文件类型,包括JPEG, PNG, GIF和PDF及更多。访问它的 [官方网站][2] 来获取更多新闻和应用更新。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/install-inkscape-open-source-vector-graphic-editor/ + +作者:[Aun Raza][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunrz/ +[1]:https://launchpad.net/~inkscape.dev/+archive/ubuntu/stable +[2]:https://inkscape.org/en/ diff --git a/published/201505/20150410 This tool can alert you about evil twin access points in the area.md b/published/201505/20150410 This tool can alert you about evil twin access points in the area.md new file mode 100644 index 0000000000..a43aa8206f --- /dev/null +++ b/published/201505/20150410 This tool can alert you about evil twin access points in the area.md @@ -0,0 +1,41 @@ +EvilAP_Defender:可以警示和攻击 WIFI 热点陷阱的工具 +=============================================================================== + +**开发人员称,EvilAP_Defender甚至可以攻击流氓Wi-Fi接入点** + +这是一个新的开源工具,可以定期扫描一个区域,以防出现恶意 Wi-Fi 接入点,同时如果发现情况会提醒网络管理员。 + +这个工具叫做 EvilAP_Defender,是为监测攻击者所配置的恶意接入点而专门设计的,这些接入点冒用合法的名字诱导用户连接上。 + +这类接入点被称做假面猎手(evil twin),使得黑客们可以从所接入的设备上监听互联网信息流。这可以被用来窃取证书、钓鱼网站等等。 + +大多数用户设置他们的计算机和设备可以自动连接一些无线网络,比如家里的或者工作地方的网络。通常,当面对两个同名的无线网络时,即SSID相同,有时候甚至连MAC地址(BSSID)也相同,这时候大多数设备会自动连接信号较强的一个。 + +这使得假面猎手攻击容易实现,因为SSID和BSSID都可以伪造。 + +[EvilAP_Defender][1]是一个叫Mohamed Idris的人用Python语言编写,公布在GitHub上面。它可以使用一个计算机的无线网卡来发现流氓接入点,这些坏蛋们复制了一个真实接入点的SSID,BSSID,甚至是其他的参数如通道,密码,隐私协议和认证信息等等。 + +该工具首先以学习模式运行,以便发现合法的接入点[AP],并且将其加入白名单。然后可以切换到正常模式,开始扫描未认证的接入点。 + +如果一个恶意[AP]被发现了,该工具会用电子邮件提醒网络管理员,但是开发者也打算在未来加入短信提醒功能。 + +该工具还有一个保护模式,在这种模式下,应用会发起一个denial-of-service [DoS]攻击反抗恶意接入点,为管理员采取防卫措施赢得一些时间。 + +“DoS 将仅仅针对有着相同SSID的而BSSID(AP的MAC地址)不同或者不同信道的流氓 AP,”Idris在这款工具的文档中说道。“这是为了避免攻击到你的正常网络。” + +尽管如此,用户应该切记在许多国家,攻击别人的接入点很多时候都是非法的,甚至是一个看起来像是攻击者操控的恶意接入点。 + +要能够运行这款工具,需要Aircrack-ng无线网套装,一个支持Aircrack-ng的无线网卡,MySQL和Python运行环境。 + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2905725/security0/this-tool-can-alert-you-about-evil-twin-access-points-in-the-area.html + +作者:[Lucian Constantin][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Lucian-Constantin/ +[1]:https://github.com/moha99sa/EvilAP_Defender/blob/master/README.TXT diff --git a/published/201505/20150410 What is a good alternative to wget or curl on Linux.md b/published/201505/20150410 What is a good alternative to wget or curl on Linux.md new file mode 100644 index 0000000000..3af223b631 --- /dev/null +++ b/published/201505/20150410 What is a good alternative to wget or curl on Linux.md @@ -0,0 +1,145 @@ +用腻了 wget 或 curl,有什么更好的替代品吗? +================================================================================ + +如果你经常需要通过终端以非交互模式访问网络服务器(例如,从网络上下载文件,或者是测试 RESTful 网络服务接口),可能你会选择的工具是 wget 或 curl。通过大量的命令行选项,这两种工具都可以处理很多非交互网络访问的情况(比如[这里][1]、[这里][2],还有[这里][3])。然而,即使像这些一样的强大的工具,你也只能发挥你所了解的那些选项的功能。除非你很精通那些繁冗的语法细节,这些工具对于你来说只不过是简单的网络下载器而已。 + +就像其宣传的那样,“给人用 curl 类工具”,[HTTPie][4] 设计用来增强 wget 和 curl 的可用性。它的主要目标是使通过命令行与网络服务器进行交互的过程变得尽可能的人性化。为此,HTTPie 支持具有表现力、但又很简单很直观的语法。它以彩色模式显示响应,并且还有一些不错的优点,比如对 JSON 的良好支持,和持久性会话用以作业流程化。 + +我知道很多人对把像 wget 和 curl 这样的无处不在的、可用的、完美的工具换成完全没听说过的软件心存疑虑。这种观点是好的,特别是如果你是一个系统管理员、要处理很多不同的硬件的话。然而,对于开发者和终端用户来说,重要的是效率。如果我发现了一个工具的用户更佳替代品,那么我认为采用易于使用的版本来节省宝贵的时间是毫无疑问的。没有必要对替换掉的工具保持信仰忠诚。毕竟,对于 Linux 来说,最好的事情就是可以选择。 + +在这篇文章中,让我们来了解并展示一下我所说的 HTTPie,一个用户友好的 wget 和 curl 的替代。 + +![](https://farm8.staticflickr.com/7633/16849137018_bcc7a616fc_b.jpg) + +### 在 Linux 上安装 HTTPie ### + +HTTPie 是用 Python 写的,所以你可以在几乎所有地方(Linux,MacOSX,Windows)安装它。而且,在大多数的 Linux 发行版中都有编译好的安装包。 + +#### Debian,Ubuntu 或者 Linux Mint: #### + + $ sudo apt-get install httpie + +#### Fedora: #### + + $ sudo yum install httpie + +#### CentOS/RHEL: #### + +首先,启用[EPEL 仓库][5],然后运行: + + $ sudo yum install httpie + +对于任何 Linux 发行版,另一个安装方法时使用[pip][6]。 + + $ sudo pip install --upgrade httpie + +### HTTPie 的例子 ### + +当你安装完 HTTPie 后,你可以通过输入 http 命令来调用它。在这篇文章的剩余部分,我会展示几个有用的 http 命令的例子。 + +#### 例1:定制头部 #### + +你可以使用 <header:value> 的格式来定制头部。例如,我们发送一个 HTTP GET 请求到 www.test.com ,使用定制用户代理(user-agent)和来源(referer),还有定制头部(比如 MyParam)。 + + $ http www.test.com User-Agent:Xmodulo/1.0 Referer:http://xmodulo.com MyParam:Foo + +注意到当使用 HTTP GET 方法时,就无需明确指定 HTTP 方法。 + +这个 HTTP 请求看起来如下: + + GET / HTTP/1.1 + Host: www.test.com + Accept: */* + Referer: http://xmodulo.com + Accept-Encoding: gzip, deflate, compress + MyParam: Foo + User-Agent: Xmodulo/1.0 + +#### 例2:下载文件 #### + +你可以把 http 作为文件下载器来使用。你需要像下面一样把输出重定向到文件。 + + $ http www.test.com/my_file.zip > my_file.zip + +或者: + + $ http --download www.test.com/my_file.zip + +#### 例3:定制 HTTP 方法 #### + +除了默认的 GET 方法,你还可以使用其他方法(比如 PUT,POST,HEAD)。例如,发送一个 HTTP PUT 请求: + + $ http PUT www.test.com name='Dan Nanni' email=dan@email.com + +#### 例4:提交表单 #### + +使用 http 命令提交表单很容易,如下: + + $ http -f POST www.test.com name='Dan Nanni' comment='Hi there' + +'-f' 选项使 http 命令序列化数据字段,并将 'Content-Type' 设置为 "application/x-www-form-urlencoded; charset=utf-8"。 + +这个 HTTP POST 请求看起来如下: + + POST / HTTP/1.1 + Host: www.test.com + Content-Length: 31 + Content-Type: application/x-www-form-urlencoded; charset=utf-8 + Accept-Encoding: gzip, deflate, compress + Accept: */* + User-Agent: HTTPie/0.8.0 + + name=Dan+Nanni&comment=Hi+there + +####例5:JSON 支持 + +HTTPie 内置 JSON(一种日渐普及的数据交换格式)支持。事实上,HTTPie 默认使用的内容类型(content-type)就是 JSON。因此,当你不指定内容类型发送数据字段时,它们会自动序列化为 JSON 对象。 + + $ http POST www.test.com name='Dan Nanni' comment='Hi there' + +这个 HTTP POST 请求看起来如下: + + POST / HTTP/1.1 + Host: www.test.com + Content-Length: 44 + Content-Type: application/json; charset=utf-8 + Accept-Encoding: gzip, deflate, compress + Accept: application/json + User-Agent: HTTPie/0.8.0 + + {"name": "Dan Nanni", "comment": "Hi there"} + +#### 例6:输出重定向 #### + +HTTPie 的另外一个用户友好特性是输入重定向,你可以使用缓冲数据提供 HTTP 请求内容。例如: + + $ http POST api.test.com/db/lookup < my_info.json + +或者: + + $ echo '{"name": "Dan Nanni"}' | http POST api.test.com/db/lookup + +### 结束语 ### + +在这篇文章中,我介绍了 HTTPie,一个 wget 和 curl 的可能替代工具。除了这里展示的几个简单的例子,你可以在其[官方网站][7]上找到 HTTPie 的很多有趣的应用。再次重复一遍,一款再强大的工具也取决于你对它的了解程度。从个人而言,我更倾向于 HTTPie,因为我在寻找一种更简洁的测试复杂网络接口的方法。 + +你怎么看? + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/wget-curl-alternative-linux.html + +作者:[Dan Nanni][a] +译者:[wangjiezhe](https://github.com/wangjiezhe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni +[1]:http://xmodulo.com/how-to-download-multiple-files-with-wget.html +[2]:http://xmodulo.com/how-to-use-custom-http-headers-with-wget.html +[3]:https://linux.cn/article-4957-1.html +[4]:https://github.com/jakubroztocil/httpie +[5]:https://linux.cn/article-2324-1.html +[6]:http://ask.xmodulo.com/install-pip-linux.html +[7]:https://github.com/jakubroztocil/httpie diff --git a/published/201505/20150413 A Walk Through Some Important Docker Commands.md b/published/201505/20150413 A Walk Through Some Important Docker Commands.md new file mode 100644 index 0000000000..d58dda2d54 --- /dev/null +++ b/published/201505/20150413 A Walk Through Some Important Docker Commands.md @@ -0,0 +1,106 @@ +一些重要 Docker 命令的简单介绍 +================================================================================ +大家好,今天我们来学习一些在你使用 Docker 之前需要了解的重要的 Docker 命令。[Docker][1] 是一个开源项目,提供了一个可以打包、装载和运行任何应用的轻量级容器的开放平台。它没有语言支持、框架和打包系统的限制,从小型的家用电脑到高端服务器,在何时何地都可以运行。这使它们可以不依赖于特定软件栈和供应商,像一块块积木一样部署和扩展网络应用、数据库和后端服务。 + +Docker 命令简单易学,也很容易实现或实践。这是一些你运行 Docker 并充分利用它需要知道的简单 Docker 命令。 + +### 1. 拉取 Docker 镜像 ### + +由于容器是由 Docker 镜像构建的,首先我们需要拉取一个 docker 镜像来开始。我们可以从 Docker Registry Hub 获取所需的 docker 镜像。在我们使用 pull 命令拉取任何镜像之前,为了避免 pull 命令的一些恶意风险,我们需要保护我们的系统。为了保护我们的系统不受这个风险影响,我们需要添加 **127.0.0.1 index.docker.io** 到 /etc/hosts 条目。我们可以通过使用喜欢的文本编辑器完成。 + + # nano /etc/hosts + +现在,增加下面的一行到文件并保存退出。 + + 127.0.0.1 index.docker.io + +![Docker 宿主机](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-hosts.png) + +要拉取一个 docker 镜像,我们需要运行下面的命令。 + + # docker pull registry.hub.docker.com/busybox + +![Docker pull 命令](http://blog.linoxide.com/wp-content/uploads/2015/04/pulling-image.png) + +我们可以检查本地是否有可用的 Docker 镜像。 + + # docker images + +![Docker 镜像](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-images.png) + +### 2. 运行 Docker 容器 ### + +现在,成功地拉取要求的或所需的 Docker 镜像之后,我们当然想运行这个 Docker 镜像。我们可以用 docker run 命令在镜像上运行一个 docker 容器。在 Docker 镜像上运行一个 docker 容器时我们有很多选项和标记。我们使用 -t 和 -i 选项来运行一个 docker 镜像并进入容器,如下面所示。 + + # docker run -it busybox + +![Docker Run Shell 命令](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-run-shell.png) + +从上面的命令中,我们进入了容器并可以通过交互 shell 访问它的内容。我们可以键入 **Ctrl-D** 从shell中退出。 + +现在,在后台运行容器,我们用 -d 标记分离 shell,如下所示。 + + # docker run -itd busybox + +![后台运行容器](http://blog.linoxide.com/wp-content/uploads/2015/04/run-container-background.png) + +如果你想进入到一个正在运行的容器,我们可以使用 attach 命令加一个容器 id。可以使用 **docker ps** 命令获取容器 id。 + + # docker attach + +![进入Docker](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-attach.png) + +### 3. 检查容器运行 ### + +不论容器是否运行,查看日志文件都很简单。我们可以使用下面的命令去检查是否有 docker 容器在实时运行。 + + # docker ps + +现在,查看正在运行的或者之前运行的容器的日志,我们需要运行以下的命令。 + + # docker ps -a + +![查看 Docker 容器](http://blog.linoxide.com/wp-content/uploads/2015/04/view-docker-containers1.png) + +### 4. 查看容器信息 ### + +我们可以使用 inspect 命令查看一个 Docker 容器的各种信息。 + + # docker inspect + +![检查Docker](http://blog.linoxide.com/wp-content/uploads/2015/04/docker-inspect.png) + +### 5. 杀死或删除 ### + +我们可以使用容器 id 杀死或者停止 docker 容器(进程),如下所示。 + + # docker stop + +要停止每个正在运行的容器,我们需要运行下面的命令。 + + # docker kill $(docker ps -q) + +现在,如我我们希望移除一个 docker 镜像,运行下面的命令。 + + # docker rm + +如果我们想一次性移除所有 docker 镜像,我们可以运行以下命令。 + + # docker rm $(docker ps -aq) + +### 结论 ### + +这些都是充分学习和使用 Docker 很基本的 docker 命令。有了这些命令,Docker 变得很简单,可以提供给最终用户一个易用的计算平台。根据上面的教程,任何人学习 Docker 命令都非常简单。如果你有任何问题,建议,反馈,请写到下面的评论框中以便我们改进和更新内容。多谢! 希望你喜欢 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/important-docker-commands/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://www.docker.com/ \ No newline at end of file diff --git a/published/201505/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md b/published/201505/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md new file mode 100644 index 0000000000..321ce4b2d3 --- /dev/null +++ b/published/201505/20150413 Linux FAQs with Answers--How to change PATH environment variable on Linux.md @@ -0,0 +1,73 @@ +Linux有问必答:如何在Linux中修改环境变量PATH +================================================================================ +> **提问**: 当我试着运行一个程序时,它提示“command not found”。 但这个程序就在/usr/local/bin下。我该如何添加/usr/local/bin到我的PATH变量下,这样我就可以不用指定路径来运行这个命令了。 + +在Linux中,PATH环境变量保存了一系列的目录用于用户在输入的时候搜索命令。PATH变量的值由一系列的由分号分隔的绝对路径组成。每个用户都有特定的PATH环境变量(由系统级的PATH变量初始化)。 + +要检查用户的环境变量,用户模式下运行下面的命令: + + $ echo $PATH + +---------- + + /usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/sbin:/sbin:/home/xmodulo/bin + +或者运行: + + $ env | grep PATH + +---------- + + PATH=/usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/sbin:/sbin:/home/xmodulo/bin + +如果你的命令不存在于上面任何一个目录内,shell就会抛出一个错误信息:“command not found”。 + +如果你想要添加一个另外的目录(比如:/usr/local/bin)到你的PATH变量中,你可以用下面这些命令。 + +### 为特定用户修改PATH环境变量 ### + +如果你只想在当前的登录会话中临时地添加一个新的目录(比如:/usr/local/bin)给用户的默认搜索路径,你只需要输入下面的命令。 + + $ PATH=$PATH:/usr/local/bin + +检查PATH是否已经更新: + + $ echo $PATH + +---------- + + /usr/lib64/qt-3.3/bin:/bin:/usr/bin:/usr/sbin:/sbin:/home/xmodulo/bin:/usr/local/bin + +更新后的PATH会在当前的会话一直有效。然而,更改将在新的会话中失效。 + +如果你想要永久更改PATH变量,用编辑器打开~/.bashrc (或者 ~/.bash_profile),接着在最后添加下面这行。 + + export PATH=$PATH:/usr/local/bin + +接着运行下面这行永久激活更改: + + $ source ~/.bashrc (或者 source ~/.bash_profile) + +### 改变系统级的环境变量 ### + +如果你想要永久添加/usr/local/bin到系统级的PATH变量中,像下面这样编辑/etc/profile。 + + $ sudo vi /etc/profile + +---------- + + export PATH=$PATH:/usr/local/bin + +你重新登录后,更新的环境变量就会生效了。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/change-path-environment-variable-linux.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201505/20150413 [Solved] Ubuntu Does Not Remember Brightness Settings.md b/published/201505/20150413 [Solved] Ubuntu Does Not Remember Brightness Settings.md new file mode 100644 index 0000000000..d0248ff2c2 --- /dev/null +++ b/published/201505/20150413 [Solved] Ubuntu Does Not Remember Brightness Settings.md @@ -0,0 +1,32 @@ +如何解决 Ubuntu 下不能记住亮度设置的问题 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/04/Fix_Ubuntu_Brightness_Issue.jpg) + +在[解决亮度控制在Ubuntu和Linux Mint下不工作的问题][1]这篇教程里,一些用户提到虽然问题已经得到解决,但是**Ubuntu无法记住亮度设置**,同样的情况在Linux Mint下也会发生。每次开机或从睡眠状态下唤醒,亮度会恢复至最大值或最小值。我知道这种情况很烦。不过幸好我们有很简单的方法来解决**Ubuntu和Linux Mint下的亮度问题**。 + +### 解决Ubuntu和Linux下不能记住亮度设置 ### + +[Norbert][2]写了一个脚本,能让Ubuntu和Linux Mint记住亮度设置,不论是开机还是唤醒之后。为了能让你使用这个脚本更简单方便,他把这个适用于Ubuntu 12.04、14.04和14.10的PPA挂在了网上。你需要做的就是输入以下命令: + + sudo add-apt-repository ppa:nrbrtx/sysvinit-backlight + sudo apt-get update + sudo apt-get install sysvinit-backlight + +安装好之后,重启你的系统。现在就来看看亮度设置有没有被保存下来吧。 + +希望这篇小贴士能帮助到你。如果你有任何问题,就[来这儿][3]提bug吧。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/ubuntu-mint-brightness-settings/ + +作者:[Abhishek][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/fix-brightness-ubuntu-1310/ +[2]:https://launchpad.net/~nrbrtx/+archive/ubuntu/sysvinit-backlight/+packages +[3]:https://launchpad.net/~nrbrtx/+archive/ubuntu/sysvinit-backlight/+packages diff --git a/published/201505/20150415 Strong SSL Security on nginx.md b/published/201505/20150415 Strong SSL Security on nginx.md new file mode 100644 index 0000000000..094c50bd37 --- /dev/null +++ b/published/201505/20150415 Strong SSL Security on nginx.md @@ -0,0 +1,290 @@ +增强 nginx 的 SSL 安全性 +================================================================================ +[![](https://raymii.org/s/inc/img/ssl-labs-a.png)][1] + +本文向你介绍如何在 nginx 服务器上设置健壮的 SSL 安全机制。我们通过禁用 SSL 压缩来降低 CRIME 攻击威胁;禁用协议上存在安全缺陷的 SSLv3 及更低版本,并设置更健壮的加密套件(cipher suite)来尽可能启用前向安全性(Forward Secrecy);此外,我们还启用了 HSTS 和 HPKP。这样我们就拥有了一个健壮而可经受考验的 SSL 配置,并可以在 Qually Labs 的 SSL 测试中得到 A 级评分。 + +如果不求甚解的话,可以从 [https://cipherli.st][2] 上找到 nginx 、Apache 和 Lighttpd 的安全设置,复制粘帖即可。 + +本教程在 Digital Ocean 的 VPS 上测试通过。如果你喜欢这篇教程,想要支持作者的站点的话,购买 Digital Ocean 的 VPS 时请使用如下链接:[https://www.digitalocean.com/?refcode=7435ae6b8212][3] 。 + +本教程可以通过[发布于 2014/1/21 的][4] SSL 实验室测试的严格要求(我之前就通过了测试,如果你按照本文操作就可以得到一个 A+ 评分)。 + +- [本教程也可用于 Apache ][5] +- [本教程也可用于 Lighttpd ][6] +- [本教程也可用于 FreeBSD, NetBSD 和 OpenBSD 上的 nginx ,放在 BSD Now 播客上][7]: [http://www.bsdnow.tv/tutorials/nginx][8] + +你可以从下列链接中找到这方面的进一步内容: + +- [野兽攻击(BEAST)][9] +- [罪恶攻击(CRIME)][10] +- [怪物攻击(FREAK )][11] +- [心血漏洞(Heartbleed)][12] +- [完备的前向安全性(Perfect Forward Secrecy)][13] +- [RC4 和 BEAST 的处理][14] + +我们需要编辑 nginx 的配置,在 Ubuntu/Debian 上是 `/etc/nginx/sited-enabled/yoursite.com`,在 RHEL/CentOS 上是 `/etc/nginx/conf.d/nginx.conf`。 + +本文中,我们需要编辑443端口(SSL)的 `server` 配置中的部分。在文末你可以看到完整的配置例子。 + +*在编辑之前切记备份一下配置文件!* + +### 野兽攻击(BEAST)和 RC4 ### + +简单的说,野兽攻击(BEAST)就是通过篡改一个加密算法的 CBC(密码块链)的模式,从而可以对部分编码流量悄悄解码。更多信息参照上面的链接。 + +针对野兽攻击(BEAST),较新的浏览器已经启用了客户端缓解方案。推荐方案是禁用 TLS 1.0 的所有加密算法,仅允许 RC4 算法。然而,[针对 RC4 算法的攻击也越来越多](http://www.isg.rhul.ac.uk/tls/) ,很多已经从理论上逐步发展为实际可行的攻击方式。此外,有理由相信 NSA 已经实现了他们所谓的“大突破”——攻破 RC4 。 + +禁用 RC4 会有几个后果。其一,当用户使用老旧的浏览器时,比如 Windows XP 上的 IE 会用 3DES 来替代 RC4。3DES 要比 RC4 更安全,但是它的计算成本更高,你的服务器就需要为这些用户付出更多的处理成本。其二,RC4 算法能减轻 野兽攻击(BEAST)的危害,如果禁用 RC4 会导致 TLS 1.0 用户会换到更容易受攻击的 AES-CBC 算法上(通常服务器端的对野兽攻击(BEAST)的“修复方法”是让 RC4 优先于其它算法)。我认为 RC4 的风险要高于野兽攻击(BEAST)的风险。事实上,有了客户端缓解方案(Chrome 和 Firefox 提供了缓解方案),野兽攻击(BEAST)就不是什么大问题了。而 RC4 的风险却在增长:随着时间推移,对加密算法的破解会越来越多。 + +### 怪物攻击(FREAK) ### + +怪物攻击(FREAK)是一种中间人攻击,它是由来自 [INRIA、微软研究院和 IMDEA][15] 的密码学家们所发现的。怪物攻击(FREAK)的缩写来自“Factoring RSA-EXPORT Keys(RSA 出口密钥因子分解)” + +这个漏洞可上溯到上世纪九十年代,当时美国政府禁止出口加密软件,除非其使用编码密钥长度不超过512位的出口加密套件。 + +这造成了一些现在的 TLS 客户端存在一个缺陷,这些客户端包括: 苹果的 SecureTransport 、OpenSSL。这个缺陷会导致它们会接受出口降级 RSA 密钥,即便客户端并没有要求使用出口降级 RSA 密钥。这个缺陷带来的影响很讨厌:在客户端存在缺陷,且服务器支持出口降级 RSA 密钥时,会发生中间人攻击,从而导致连接的强度降低。 + +攻击分为两个组成部分:首先是服务器必须接受“出口降级 RSA 密钥”。 + +中间人攻击可以按如下流程: + +- 在客户端的 Hello 消息中,要求标准的 RSA 加密套件。 +- 中间人攻击者修改该消息为‘export RSA’(输出级 RSA 密钥)。 +- 服务器回应一个512位的输出级 RSA 密钥,并以其长期密钥签名。 +- 由于 OpenSSL/SecureTransport 的缺陷,客户端会接受这个弱密钥。 +- 攻击者根据 RSA 模数分解因子来恢复相应的 RSA 解密密钥。 +- 当客户端编码‘pre-master secret’(预主密码)给服务器时,攻击者现在就可以解码它并恢复 TLS 的‘master secret’(主密码)。 +- 从这里开始,攻击者就能看到了传输的明文并注入任何东西了。 + +本文所提供的加密套件不启用输出降级加密,请确认你的 OpenSSL 是最新的,也强烈建议你将客户端也升级到新的版本。 + +### 心血漏洞(Heartbleed) ### + +心血漏洞(Heartbleed) 是一个于2014年4月公布的 OpenSSL 加密库的漏洞,它是一个被广泛使用的传输层安全(TLS)协议的实现。无论是服务器端还是客户端在 TLS 中使用了有缺陷的 OpenSSL,都可以被利用该缺陷。由于它是因 DTLS 心跳扩展(RFC 6520)中的输入验证不正确(缺少了边界检查)而导致的,所以该漏洞根据“心跳”而命名。这个漏洞是一种缓存区超读漏洞,它可以读取到本不应该读取的数据。 + +哪个版本的 OpenSSL 受到心血漏洞(Heartbleed)的影响? + +各版本情况如下: + +- OpenSSL 1.0.1 直到 1.0.1f (包括)**存在**该缺陷 +- OpenSSL 1.0.1g **没有**该缺陷 +- OpenSSL 1.0.0 分支**没有**该缺陷 +- OpenSSL 0.9.8 分支**没有**该缺陷 + +这个缺陷是2011年12月引入到 OpenSSL 中的,并随着 2012年3月14日 OpenSSL 发布的 1.0.1 而泛滥。2014年4月7日发布的 OpenSSL 1.0.1g 修复了该漏洞。 + +升级你的 OpenSSL 就可以避免该缺陷。 + +### SSL 压缩(罪恶攻击 CRIME) ### + +罪恶攻击(CRIME)使用 SSL 压缩来完成它的魔法,SSL 压缩在下述版本是默认关闭的: nginx 1.1.6及更高/1.0.9及更高(如果使用了 OpenSSL 1.0.0及更高), nginx 1.3.2及更高/1.2.2及更高(如果使用较旧版本的 OpenSSL)。 + +如果你使用一个早期版本的 nginx 或 OpenSSL,而且你的发行版没有向后移植该选项,那么你需要重新编译没有一个 ZLIB 支持的 OpenSSL。这会禁止 OpenSSL 使用 DEFLATE 压缩方式。如果你禁用了这个,你仍然可以使用常规的 HTML DEFLATE 压缩。 + +### SSLv2 和 SSLv3 ### + +SSLv2 是不安全的,所以我们需要禁用它。我们也禁用 SSLv3,因为 TLS 1.0 在遭受到降级攻击时,会允许攻击者强制连接使用 SSLv3,从而禁用了前向安全性(forward secrecy)。 + +如下编辑配置文件: + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + +### 卷毛狗攻击(POODLE)和 TLS-FALLBACK-SCSV ### + +SSLv3 会受到[卷毛狗漏洞(POODLE)][16]的攻击。这是禁用 SSLv3 的主要原因之一。 + +Google 提出了一个名为 [TLS\_FALLBACK\_SCSV][17] 的SSL/TLS 扩展,它用于防止强制 SSL 降级。如果你升级 到下述的 OpenSSL 版本会自动启用它。 + +- OpenSSL 1.0.1 带有 TLS\_FALLBACK\_SCSV 1.0.1j 及更高。 +- OpenSSL 1.0.0 带有 TLS\_FALLBACK\_SCSV 1.0.0o 及更高。 +- OpenSSL 0.9.8 带有 TLS\_FALLBACK\_SCSV 0.9.8zc 及更高。 + +[更多信息请参照 NGINX 文档][18]。 + +### 加密套件(cipher suite) ### + +前向安全性(Forward Secrecy)用于在长期密钥被破解时确保会话密钥的完整性。PFS(完备的前向安全性)是指强制在每个/每次会话中推导新的密钥。 + +这就是说,泄露的私钥并不能用来解密(之前)记录下来的 SSL 通讯。 + +提供PFS(完备的前向安全性)功能的是那些使用了一种 Diffie-Hellman 密钥交换的短暂形式的加密套件。它们的缺点是系统开销较大,不过可以使用椭圆曲线的变体来改进。 + +以下两个加密套件是我推荐的,之后[Mozilla 基金会][19]也推荐了。 + +推荐的加密套件: + + ssl_ciphers 'AES128+EECDH:AES128+EDH'; + +向后兼容的推荐的加密套件(IE6/WinXP): + + ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"; + +如果你的 OpenSSL 版本比较旧,不可用的加密算法会自动丢弃。应该一直使用上述的完整套件,让 OpenSSL 选择一个它所支持的。 + +加密套件的顺序是非常重要的,因为其决定了优先选择哪个算法。上述优先推荐的算法中提供了PFS(完备的前向安全性)。 + +较旧版本的 OpenSSL 也许不能支持这个算法的完整列表,AES-GCM 和一些 ECDHE 算法是相当新的,在 Ubuntu 和 RHEL 中所带的绝大多数 OpenSSL 版本中不支持。 + +#### 优先顺序的逻辑 #### + +- ECDHE+AESGCM 加密是首选的。它们是 TLS 1.2 加密算法,现在还没有广泛支持。当前还没有对它们的已知攻击。 +- PFS 加密套件好一些,首选 ECDHE,然后是 DHE。 +- AES 128 要好于 AES 256。有一个关于 AES256 带来的安全提升程度是否值回成本的[讨论][20],结果是显而易见的。目前,AES128 要更值一些,因为它提供了不错的安全水准,确实很快,而且看起来对时序攻击更有抵抗力。 +- 在向后兼容的加密套件里面,AES 要优于 3DES。在 TLS 1.1及其以上,减轻了针对 AES 的野兽攻击(BEAST)的威胁,而在 TLS 1.0上则难以实现该攻击。在非向后兼容的加密套件里面,不支持 3DES。 +- RC4 整个不支持了。3DES 用于向后兼容。参看 [#RC4\_weaknesses][21] 中的讨论。 + +#### 强制丢弃的算法 #### + +- aNULL 包含了非验证的 Diffie-Hellman 密钥交换,这会受到中间人(MITM)攻击 +- eNULL 包含了无加密的算法(明文) +- EXPORT 是老旧的弱加密算法,是被美国法律标示为可出口的 +- RC4 包含的加密算法使用了已弃用的 ARCFOUR 算法 +- DES 包含的加密算法使用了弃用的数据加密标准(DES) +- SSLv2 包含了定义在旧版本 SSL 标准中的所有算法,现已弃用 +- MD5 包含了使用已弃用的 MD5 作为哈希算法的所有算法 + +### 更多设置 ### + +确保你也添加了如下行: + + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:10m; + +在一个 SSLv3 或 TLSv1 握手过程中选择一个加密算法时,一般使用客户端的首选算法。如果设置了上述配置,则会替代地使用服务器端的首选算法。 + +- [关于 ssl\_prefer\_server\_ciphers 的更多信息][22] +- [关于 ssl\_ciphers 的更多信息][23] + +### 前向安全性和 Diffie Hellman Ephemeral (DHE)参数 ### + +前向安全性(Forward Secrecy)的概念很简单:客户端和服务器协商一个永不重用的密钥,并在会话结束时销毁它。服务器上的 RSA 私钥用于客户端和服务器之间的 Diffie-Hellman 密钥交换签名。从 Diffie-Hellman 握手中获取的预主密钥会用于之后的编码。因为预主密钥是特定于客户端和服务器之间建立的某个连接,并且只用在一个限定的时间内,所以称作短暂模式(Ephemeral)。 + +使用了前向安全性,如果一个攻击者取得了一个服务器的私钥,他是不能解码之前的通讯信息的。这个私钥仅用于 Diffie Hellman 握手签名,并不会泄露预主密钥。Diffie Hellman 算法会确保预主密钥绝不会离开客户端和服务器,而且不能被中间人攻击所拦截。 + +所有版本的 nginx(如1.4.4)都依赖于 OpenSSL 给 Diffie-Hellman (DH)的输入参数。不幸的是,这意味着 Diffie-Hellman Ephemeral(DHE)将使用 OpenSSL 的默认设置,包括一个用于密钥交换的1024位密钥。因为我们正在使用2048位证书,DHE 客户端就会使用一个要比非 DHE 客户端更弱的密钥交换。 + +我们需要生成一个更强壮的 DHE 参数: + + cd /etc/ssl/certs + openssl dhparam -out dhparam.pem 4096 + +然后告诉 nginx 将其用作 DHE 密钥交换: + + ssl_dhparam /etc/ssl/certs/dhparam.pem; + +### OCSP 装订(Stapling) ### + +当连接到一个服务器时,客户端应该使用证书吊销列表(CRL)或在线证书状态协议(OCSP)记录来校验服务器证书的有效性。CRL 的问题是它已经增长的太大了,永远也下载不完了。 + +OCSP 更轻量级一些,因为我们每次只请求一条记录。但是副作用是当连接到一个服务器时必须对第三方 OCSP 响应器发起 OCSP 请求,这就增加了延迟和带来了潜在隐患。事实上,CA 所运营的 OCSP 响应器非常不可靠,浏览器如果不能及时收到答复,就会静默失败。攻击者通过 DoS 攻击一个 OCSP 响应器可以禁用其校验功能,这样就降低了安全性。 + +解决方法是允许服务器在 TLS 握手中发送缓存的 OCSP 记录,以绕开 OCSP 响应器。这个机制节省了客户端和 OCSP 响应器之间的通讯,称作 OCSP 装订。 + +客户端会在它的 CLIENT HELLO 中告知其支持 status\_request TLS 扩展,服务器仅在客户端请求它的时候才发送缓存的 OCSP 响应。 + +大多数服务器最多会缓存 OCSP 响应48小时。服务器会按照常规的间隔连接到 CA 的 OCSP 响应器来获取刷新的 OCSP 记录。OCSP 响应器的位置可以从签名的证书中的授权信息访问(Authority Information Access)字段中获得。 + +- [阅读我的教程:在 NGINX 中启用 OCSP 装订][24] + +### HTTP 严格传输安全(HSTS) ### + +如有可能,你应该启用 [HTTP 严格传输安全(HSTS)][25],它会引导浏览器和你的站点之间的通讯仅通过 HTTPS。 + +- [阅读我关于 HSTS 的文章,了解如何配置它][26] + +### HTTP 公钥固定扩展(HPKP) ### + +你也应该启用 [HTTP 公钥固定扩展(HPKP)][27]。 + +公钥固定的意思是一个证书链必须包括一个白名单中的公钥。它确保仅有白名单中的 CA 才能够为某个域名签署证书,而不是你的浏览器中存储的任何 CA。 + +我已经写了一篇[关于 HPKP 的背景理论及在 Apache、Lighttpd 和 NGINX 中配置例子的文章][28]。 + +### 配置范例 ### + + server { + + listen [::]:443 default_server; + + ssl on; + ssl_certificate_key /etc/ssl/cert/raymii_org.pem; + ssl_certificate /etc/ssl/cert/ca-bundle.pem; + + ssl_ciphers 'AES128+EECDH:AES128+EDH:!aNULL'; + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2; + ssl_session_cache shared:SSL:10m; + + ssl_stapling on; + ssl_stapling_verify on; + resolver 8.8.4.4 8.8.8.8 valid=300s; + resolver_timeout 10s; + + ssl_prefer_server_ciphers on; + ssl_dhparam /etc/ssl/certs/dhparam.pem; + + add_header Strict-Transport-Security max-age=63072000; + add_header X-Frame-Options DENY; + add_header X-Content-Type-Options nosniff; + + root /var/www/; + index index.html index.htm; + server_name raymii.org; + + } + +### 结尾 ### + +如果你使用了上述配置,你需要重启 nginx: + + # 首先检查配置文件是否正确 + /etc/init.d/nginx configtest + # 然后重启 + /etc/init.d/nginx restart + +现在使用 [SSL Labs 测试][29]来看看你是否能得到一个漂亮的“A”。当然了,你也得到了一个安全的、强壮的、经得起考验的 SSL 配置! + +- [参考 Mozilla 关于这方面的内容][30] + +-------------------------------------------------------------------------------- + +via: https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html + +作者:[Remy van Elst][a] +译者:[wxy](https://github.com/wxy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://raymii.org/ +[1]:https://www.ssllabs.com/ssltest/analyze.html?d=raymii.org +[2]:https://cipherli.st/ +[3]:https://www.digitalocean.com/?refcode=7435ae6b8212 +[4]:http://blog.ivanristic.com/2014/01/ssl-labs-stricter-security-requirements-for-2014.html +[5]:https://raymii.org/s/tutorials/Strong_SSL_Security_On_Apache2.html +[6]:https://raymii.org/s/tutorials/Pass_the_SSL_Labs_Test_on_Lighttpd_%28Mitigate_the_CRIME_and_BEAST_attack_-_Disable_SSLv2_-_Enable_PFS%29.html +[7]:http://www.bsdnow.tv/episodes/2014_08_20-engineering_nginx +[8]:http://www.bsdnow.tv/tutorials/nginx +[9]:https://en.wikipedia.org/wiki/Transport_Layer_Security#BEAST_attack +[10]:https://en.wikipedia.org/wiki/CRIME_%28security_exploit%29 +[11]:http://blog.cryptographyengineering.com/2015/03/attack-of-week-freak-or-factoring-nsa.html +[12]:http://heartbleed.com/ +[13]:https://en.wikipedia.org/wiki/Perfect_forward_secrecy +[14]:https://en.wikipedia.org/wiki/Transport_Layer_Security#Dealing_with_RC4_and_BEAST +[15]:https://www.smacktls.com/ +[16]:https://raymii.org/s/articles/Check_servers_for_the_Poodle_bug.html +[17]:https://tools.ietf.org/html/draft-ietf-tls-downgrade-scsv-00 +[18]:http://wiki.nginx.org/HttpSslModule#ssl_protocols +[19]:https://wiki.mozilla.org/Security/Server_Side_TLS +[20]:http://www.mail-archive.com/dev-tech-crypto@lists.mozilla.org/msg11247.html +[21]:https://wiki.mozilla.org/Security/Server_Side_TLS#RC4_weaknesses +[22]:http://wiki.nginx.org/HttpSslModule#ssl_prefer_server_ciphers +[23]:http://wiki.nginx.org/HttpSslModule#ssl_ciphers +[24]:https://raymii.org/s/tutorials/OCSP_Stapling_on_nginx.html +[25]:https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security +[26]:https://linux.cn/article-5266-1.html +[27]:https://wiki.mozilla.org/SecurityEngineering/Public_Key_Pinning +[28]:https://linux.cn/article-5282-1.html +[29]:https://www.ssllabs.com/ssltest/ +[30]:https://wiki.mozilla.org/Security/Server_Side_TLS \ No newline at end of file diff --git a/published/201505/20150417 14 Useful Examples of Linux 'sort' Command--Part 1.md b/published/201505/20150417 14 Useful Examples of Linux 'sort' Command--Part 1.md new file mode 100644 index 0000000000..c483c4035f --- /dev/null +++ b/published/201505/20150417 14 Useful Examples of Linux 'sort' Command--Part 1.md @@ -0,0 +1,132 @@ +Linux 的 ‘sort’命令的14个有用的范例(一) +============================================================= +Sort是用于对单个或多个文本文件内容进行排序的Linux程序。Sort命令以空格作为字段分隔符,将一行分割为多个关键字对文件进行排序。需要注意的是除非你将输出重定向到文件中,否则Sort命令并不对文件内容进行实际的排序(即文件内容没有修改),只是将文件内容按有序输出。 + +本文的目标是通过14个实际的范例让你更深刻的理解如何在Linux中使用sort命令。 + +1、 首先我们将会创建一个用于执行‘sort’命令的文本文件(tecmint.txt)。工作路径是‘/home/$USER/Desktop/tecmint’。 + +下面命令中的‘-e’选项将启用‘\\’转义,将‘\n’解析成换行 + + $ echo -e "computer\nmouse\nLAPTOP\ndata\nRedHat\nlaptop\ndebian\nlaptop" > tecmint.txt + +![Split String by Lines in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Split-String-by-Lines.gif) + +2、 在开始学习‘sort’命令前,我们先看看文件的内容及其显示方式。 + + $ cat tecmint.txt + +![Check Content of File](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Content-of-File.gif) + +3、 现在,使用如下命令对文件内容进行排序。 + + $ sort tecmint.txt + +![Sort Content of File linux](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content.gif) + +**注意**:上面的命令并不对文件内容进行实际的排序,仅仅是将其内容按有序方式输出。 + +4、 对文件‘tecmint.txt’文件内容排序,并将排序后的内容输出到名为sorted.txt的文件中,然后使用[cat][1]命令查看验证sorted.txt文件的内容。 + + $ sort tecmint.txt > sorted.txt + $ cat sorted.txt + +![Sort File Content in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-File-Content.gif) + +5、 现在使用‘-r’参数对‘tecmint.txt’文件内容进行逆序排序,并将输出内容重定向到‘reversesorted.txt’文件中,并使用cat命令查看文件的内容。 + + $ sort -r tecmint.txt > reversesorted.txt + $ cat reversesorted.txt + +![Sort Content By Reverse](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-By-Reverse.gif) + +6、 创建一个新文件(lsl.txt),文件内容为在home目录下执行‘ls -l’命令的输出。 + + $ ls -l /home/$USER > /home/$USER/Desktop/tecmint/lsl.txt + $ cat lsl.txt + +![Populate Output of Home Directory](http://www.tecmint.com/wp-content/uploads/2015/04/Populate-Output.gif) + +我们将会看到对其他字段进行排序的例子,而不是对默认的开始字符进行排序。 + +7、 基于第二列(符号连接的数量)对文件‘lsl.txt’进行排序。 + + $ sort -nk2 lsl.txt + +**注意**:上面例子中的‘-n’参数表示对数值内容进行排序。当想基于文件中的数值列对文件进行排序时,必须要使用‘-n’参数。 + +![Sort Content by Column](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-by-Column.gif) + +8、 基于第9列(文件和目录的名称,非数值)对文件‘lsl.txt’进行排序。 + + $ sort -k9 lsl.txt + +![Sort Content Based on Column](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-Based-on-Column.gif) + +9、 sort命令并非仅能对文件进行排序,我们还可以通过管道将命令的输出内容重定向到sort命令中。 + + $ ls -l /home/$USER | sort -nk5 + +![Sort Content Using Pipe Option](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-By-Pipeline.gif) + +10、 对文件tecmint.txt进行排序,并删除重复的行。然后检查重复的行是否已经删除了。 + + $ cat tecmint.txt + $ sort -u tecmint.txt + +![Sort and Remove Duplicates](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-and-Remove-Duplicates.gif) + +目前我们发现的排序规则: + +除非指定了‘-r’参数,否则排序的优先级按下面规则排序 + + - 以数字开头的行优先级最高 + - 以小写字母开头的行优先级次之 + - 待排序内容按字典序进行排序 + - 默认情况下,‘sort’命令将带排序内容的每行关键字当作一个字符串进行字典序排序(数字优先级最高,参看规则 1) + +11、 在当前位置创建第三个文件‘lsla.txt’,其内容用‘ls -lA’命令的输出内容填充。 + + $ ls -lA /home/$USER > /home/$USER/Desktop/tecmint/lsla.txt + $ cat lsla.txt + +![Populate Output With Hidden Files](http://www.tecmint.com/wp-content/uploads/2015/04/Populate-Output-With-Hidden-Files.gif) + +了解ls命令的读者都知道‘ls -lA’ 等于 ‘ls -l’ + 隐藏文件,所以这两个文件的大部分内容都是相同的。 + +12、 对上面两个文件内容进行排序输出。 + + $ sort lsl.txt lsla.txt + +![Sort Contents of Two Files](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-of-Multiple-Files.gif) + +注意文件和目录的重复 + +13、 现在我们看看怎样对两个文件进行排序、合并,并且删除重复行。 + + $ sort -u lsl.txt lsla.txt + +![Sort, Merge and Remove Duplicates from File](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Merge-Duplicates-Content.gif) + +此时,我们注意到重复的行已经被删除了,我们可以将输出内容重定向到文件中。 + +14、 我们同样可以基于多列对文件内容进行排序。基于第2,5(数值)和9(非数值)列对‘ls -l’命令的输出进行排序。 + + $ ls -l /home/$USER | sort -t "," -nk2,5 -k9 + +![Sort Content By Field Column](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-By-Field-Column.gif) + +先到此为止了,在接下来的文章中我们将会学习到‘sort’命令更多的详细例子。届时敬请关注我们。保持分享精神。若喜欢本文,敬请将本文分享给你的朋友。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/sort-command-linux/ + +作者:[Avishek Kumar][a] +译者:[cvsher](https://github.com/cvsher) +校对:[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/13-basic-cat-command-examples-in-linux/ diff --git a/published/201505/20150417 How to Configure MariaDB Replication on CentOS Linux.md b/published/201505/20150417 How to Configure MariaDB Replication on CentOS Linux.md new file mode 100644 index 0000000000..702d3d7521 --- /dev/null +++ b/published/201505/20150417 How to Configure MariaDB Replication on CentOS Linux.md @@ -0,0 +1,363 @@ +如何在 CentOS Linux 中配置 MariaDB 复制 +================================================================================ +这是一个创建数据库重复版本的过程。复制过程不仅仅是复制一个数据库,同时也包括从主节点到一个从节点的更改同步。但这并不意味着从数据库就是和主数据库完全相同的副本,因为复制可以配置为只复制表结构、行或者列,这叫做局部复制。复制保证了特定的配置对象在不同的数据库之间保持一致。 + +### Mariadb 复制概念 ### + +**备份** :复制可以用来进行数据库备份。例如,当你做了主->从复制。如果主节点数据丢失(比如硬盘损坏),你可以从从节点中恢复你的数据库。 + +**扩展** :你可以使用主->从复制作为扩展解决方案。例如,如果你有一些大的数据库以及SQL查询,使用复制你可以将这些查询分离到每个复制节点。写入操作的SQL应该只在主节点进行,而只读查询可以在从节点上进行。 + +**分发解决方案** :你可以用复制来进行分发。例如,你可以将不同的销售数据分发到不同的数据库。 + +**故障解决方案** : 假如你建立有主节点->从节点1->从节点2->从节点3的复制结构。你可以为主节点写脚本监控,如果主节点出故障了,脚本可以快速的将从节点1切换为新的主节点,这样复制结构变成了主节点->从节点1->从节点2,你的应用可以继续工作而不会停机。 + +### 复制的简单图解示范 ### + +![mysql 复制原理](http://blog.linoxide.com/wp-content/uploads/2015/04/mysql-replication-principle.png) + +开始之前,你应该知道什么是**二进制日志文件**以及 Ibdata1。 + +二进制日志文件中包括关于数据库,数据和结构的所有更改的记录,以及每条语句的执行了多长时间。二进制日志文件包括一系列日志文件和一个索引文件。这意味着主要的SQL语句,例如CREATE, ALTER, INSERT, UPDATE 和 DELETE 会放到这个日志文件中;而例如SELECT这样的语句就不会被记录,它们可以被记录到普通的query.log文件中。 + +而 **Ibdata1** 简单的说据是一个包括所有表和所有数据库信息的文件。 + +### 主服务器配置 ### + +首先升级服务器 + + sudo yum install update -y && sudo yum install upgrade -y + +我们工作在centos7 服务器上 + + sudo cat /etc/redhat-release + + CentOS Linux release 7.0.1406 (Core) + +安装 MariaDB + + sudo yum install mariadb-server -y + +启动 MariaDB 并启用随服务器启动 + + sudo systemctl start mariadb.service + sudo systemctl enable mariadb.service + +输出如下: + + ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service' + +检查 MariaDB 状态 + + sudo service mariadb status + +或者使用 + + sudo systemctl is-active mariadb.service + +输出如下: + + Redirecting to /bin/systemctl status mariadb.service + mariadb.service - MariaDB database server + Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled) + +设置 MariaDB 密码 + + mysql -u root + mysql> use mysql; + mysql> update user set password=PASSWORD("SOME_ROOT_PASSWORD") where User='root'; + mysql> flush privileges; + mysql> exit + +这里 SOME_ROOT_PASSWORD 是你的 root 密码。 例如我用"q"作为密码,然后尝试登录: + + sudo mysql -u root -pSOME_ROOT_PASSWORD + +输出如下: + + Welcome to the MariaDB monitor. Commands end with ; or \g. + Your MariaDB connection id is 5 + Server version: 5.5.41-MariaDB MariaDB Server + Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others. + +输入 'help;' 或 '\h' 查看帮助信息。 输入 '\c' 清空当前输入语句。 + +让我们创建包括一些数据的表的数据库 + +创建数据库/模式 + + sudo mysql -u root -pSOME_ROOT_PASSWORD + mysql> create database test_repl; + +其中: + + test_repl - 将要被复制的模式的名字 + +输出:如下 + + Query OK, 1 row affected (0.00 sec) + +创建 Persons 表 + + mysql> use test_repl; + + CREATE TABLE Persons ( + PersonID int, + LastName varchar(255), + FirstName varchar(255), + Address varchar(255), + City varchar(255) + ); + +输出如下: + + mysql> MariaDB [test_repl]> CREATE TABLE Persons ( + -> PersonID int, + -> LastName varchar(255), + -> FirstName varchar(255), + -> Address varchar(255), + -> City varchar(255) + -> ); + Query OK, 0 rows affected (0.01 sec) + +插入一些数据 + + mysql> INSERT INTO Persons VALUES (1, "LastName1", "FirstName1", "Address1", "City1"); + mysql> INSERT INTO Persons VALUES (2, "LastName2", "FirstName2", "Address2", "City2"); + mysql> INSERT INTO Persons VALUES (3, "LastName3", "FirstName3", "Address3", "City3"); + mysql> INSERT INTO Persons VALUES (4, "LastName4", "FirstName4", "Address4", "City4"); + mysql> INSERT INTO Persons VALUES (5, "LastName5", "FirstName5", "Address5", "City5"); + +输出如下: + + Query OK, 5 row affected (0.00 sec) + +检查数据 + + mysql> select * from Persons; + +输出如下: + + +----------+-----------+------------+----------+-------+ + | PersonID | LastName | FirstName | Address | City | + +----------+-----------+------------+----------+-------+ + | 1 | LastName1 | FirstName1 | Address1 | City1 | + | 1 | LastName1 | FirstName1 | Address1 | City1 | + | 2 | LastName2 | FirstName2 | Address2 | City2 | + | 3 | LastName3 | FirstName3 | Address3 | City3 | + | 4 | LastName4 | FirstName4 | Address4 | City4 | + | 5 | LastName5 | FirstName5 | Address5 | City5 | + +----------+-----------+------------+----------+-------+ + +### 配置 MariaDB 复制 ### + +你需要在主节点服务器上编辑 my.cnf文件来启用二进制日志以及设置服务器id。我会使用vi文本编辑器,但你可以使用任何你喜欢的,例如nano,joe。 + + sudo vi /etc/my.cnf + +将下面的一些行写到[mysqld]部分。 + + + log-basename=master + log-bin + binlog-format=row + server_id=1 + +输出如下: + +![mariadb 配置主节点](http://blog.linoxide.com/wp-content/uploads/2015/04/mariadb-config.png) + +然后重启 MariaDB: + + sudo service mariadb restart + +登录到 MariaDB 并查看二进制日志文件: + +sudo mysql -u root -pq test_repl + +mysql> SHOW MASTER STATUS; + +输出如下: + + +--------------------+----------+--------------+------------------+ + | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | + +--------------------+----------+--------------+------------------+ + | mariadb-bin.000002 | 3913 | | | + +--------------------+----------+--------------+------------------+ + +**记住** : "File" 和 "Position" 的值。在从节点中你需要使用这些值 + +创建用来复制的用户 + + mysql> GRANT REPLICATION SLAVE ON *.* TO replication_user IDENTIFIED BY 'bigs3cret' WITH GRANT OPTION; + mysql> flush privileges; + +输出如下: + + Query OK, 0 rows affected (0.00 sec) + Query OK, 0 rows affected (0.00 sec) + +在数据库中检查用户 + + mysql> select * from mysql.user WHERE user="replication_user"\G; + +输出如下: + + mysql> select * from mysql.user WHERE user="replication_user"\G; + *************************** 1. row *************************** + Host: % + User: replication_user + Password: *2AF30E7AEE9BF3AF584FB19653881D2D072FA49C + Select_priv: N + ..... + +从主节点创建 DB dump (将要被复制的所有数据的快照) + + mysqldump -uroot -pSOME_ROOT_PASSWORD test_repl > full-dump.sql + +其中: + + SOME_ROOT_PASSWORD - 你设置的root用户的密码 + test_repl - 将要复制的数据库的名称; + +你需要在从节点中恢复 mysql dump (full-dump.sql)。重复需要这个。 + +### 从节点配置 ### + +所有这些命令需要在从节点中进行。 + +假设我们已经更新/升级了包括有最新的MariaDB服务器的 CentOS 7.x,而且你可以用root账号登陆到MariaDB服务器(这在这篇文章的第一部分已经介绍过) + +登录到Maria 数据库控制台并创建数据库 + + mysql -u root -pSOME_ROOT_PASSWORD; + mysql> create database test_repl; + mysql> exit; + +在从节点恢复主节点的数据 + + mysql -u root -pSOME_ROOT_PASSWORD test_repl < full-dump.sql + +其中: + +full-dump.sql - 你在测试服务器中创建的DB Dump。 + +登录到Maria 数据库并启用复制 + + mysql> CHANGE MASTER TO + MASTER_HOST='82.196.5.39', + MASTER_USER='replication_user', + MASTER_PASSWORD='bigs3cret', + MASTER_PORT=3306, + MASTER_LOG_FILE='mariadb-bin.000002', + MASTER_LOG_POS=3913, + MASTER_CONNECT_RETRY=10; + +![mariadb 启用复制](http://blog.linoxide.com/wp-content/uploads/2015/04/setup-replication.png) + +其中: + + MASTER_HOST - 主节点服务器的IP + MASTER_USER - 主节点服务器中的复制用户 + MASTER_PASSWORD - 复制用户密码 + MASTER_PORT - 主节点中的mysql端口 + MASTER_LOG_FILE - 主节点中的二进制日志文件名称 + MASTER_LOG_POS - 主节点中的二进制日志文件位置 + +开启从节点模式 + + mysql> slave start; + +输出如下: + + Query OK, 0 rows affected (0.00 sec) + +检查从节点状态 + + mysql> show slave status\G; + +输出如下: + + *************************** 1. row *************************** + Slave_IO_State: Waiting for master to send event + Master_Host: 82.196.5.39 + Master_User: replication_user + Master_Port: 3306 + Connect_Retry: 10 + Master_Log_File: mariadb-bin.000002 + Read_Master_Log_Pos: 4175 + Relay_Log_File: mariadb-relay-bin.000002 + Relay_Log_Pos: 793 + Relay_Master_Log_File: mariadb-bin.000002 + Slave_IO_Running: Yes + Slave_SQL_Running: Yes + Replicate_Do_DB: + Replicate_Ignore_DB: + Replicate_Do_Table: + Replicate_Ignore_Table: + Replicate_Wild_Do_Table: + Replicate_Wild_Ignore_Table: + Last_Errno: 0 + Last_Error: + Skip_Counter: 0 + Exec_Master_Log_Pos: 4175 + Relay_Log_Space: 1089 + Until_Condition: None + Until_Log_File: + Until_Log_Pos: 0 + Master_SSL_Allowed: No + Master_SSL_CA_File: + Master_SSL_CA_Path: + Master_SSL_Cert: + Master_SSL_Cipher: + Master_SSL_Key: + Seconds_Behind_Master: 0 + Master_SSL_Verify_Server_Cert: No + Last_IO_Errno: 0 + Last_IO_Error: + Last_SQL_Errno: 0 + Last_SQL_Error: + Replicate_Ignore_Server_Ids: + Master_Server_Id: 1 + 1 row in set (0.00 sec) + +到这里所有步骤都应该没问题,也不应该出现错误。 + +### 测试复制 ### + +在主节点服务器中添加一些条目到数据库 + + mysql -u root -pSOME_ROOT_PASSWORD test_repl + + mysql> INSERT INTO Persons VALUES (6, "LastName6", "FirstName6", "Address6", "City6"); + mysql> INSERT INTO Persons VALUES (7, "LastName7", "FirstName7", "Address7", "City7"); + mysql> INSERT INTO Persons VALUES (8, "LastName8", "FirstName8", "Address8", "City8"); + +到从节点服务器中查看复制数据 + + mysql -u root -pSOME_ROOT_PASSWORD test_repl + + mysql> select * from Persons; + + +----------+-----------+------------+----------+-------+ + | PersonID | LastName | FirstName | Address | City | + +----------+-----------+------------+----------+-------+ + ................... + | 6 | LastName6 | FirstName6 | Address6 | City6 | + | 7 | LastName7 | FirstName7 | Address7 | City7 | + | 8 | LastName8 | FirstName8 | Address8 | City8 | + +----------+-----------+------------+----------+-------+ + +你可以看到数据已经被复制到从节点。这意味着复制能正常工作。希望你能喜欢这篇文章。如果你有任何问题请告诉我们。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/configure-mariadb-replication-centos-linux/ + +作者:[Bobbin Zachariah][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bobbin/ \ No newline at end of file diff --git a/published/201505/20150417 sshuttle--A transparent proxy-based VPN using ssh.md b/published/201505/20150417 sshuttle--A transparent proxy-based VPN using ssh.md new file mode 100644 index 0000000000..953fd343b8 --- /dev/null +++ b/published/201505/20150417 sshuttle--A transparent proxy-based VPN using ssh.md @@ -0,0 +1,92 @@ +sshuttle:一个使用ssh的基于VPN的透明代理 +================================================================================ +sshuttle 允许你通过 ssh 创建一条从你电脑连接到任何远程服务器的 VPN 连接,只要你的服务器支持 python2.3 或则更高的版本。你必须有本机的 root 权限,但是你可以在服务端有普通账户即可。 + +你可以在一台机器上同时运行多次 sshuttle 来连接到不同的服务器上,这样你就可以同时使用多个 VPN, sshuttle可以转发你子网中所有流量到VPN中。 + +### 在Ubuntu中安装sshuttle ### + +在终端中输入下面的命令 + + sudo apt-get install sshuttle + +### 使用 sshuttle ### + +#### sshuttle 语法 #### + + sshuttle [options...] [-r [username@]sshserver[:port]] [subnets] + +#### 选项细节 #### + +-r, —remote=[username@]sshserver[:port] + +远程主机名和可选的用户名,用于连接远程服务器的ssh端口号。比如example.com、testuser@example.com、testuser@example.com:2222或者example.com:2244。 + +#### sshuttle 例子 #### + +在机器中使用下面的命令: + + sudo sshuttle -r username@sshserver 0.0.0.0/0 -vv + +当开始后,sshuttle会创建一个ssh会话到由-r指定的服务器。如果-r被丢了,它会在本地运行客户端和服务端,这个有时会在测试时有用。 + +连接到远程服务器后,sshuttle会上传它的(python)源码到远程服务器并执行。所以,你就不需要在远程服务器上安装sshuttle,并且客户端和服务器端间不会存在sshuttle版本冲突。 + +#### 手册中的更多例子 #### + +代理所有的本地连接用于本地测试,没有使用ssh: + + $ sudo sshuttle -v 0/0 + + Starting sshuttle proxy. + Listening on (‘0.0.0.0′, 12300). + [local sudo] Password: + firewall manager ready. + c : connecting to server... + s: available routes: + s: 192.168.42.0/24 + c : connected. + firewall manager: starting transproxy. + c : Accept: ‘192.168.42.106':50035 -> ‘192.168.42.121':139. + c : Accept: ‘192.168.42.121':47523 -> ‘77.141.99.22':443. + ...etc... + ^C + firewall manager: undoing changes. + KeyboardInterrupt + c : Keyboard interrupt: exiting. + c : SW#8:192.168.42.121:47523: deleting + c : SW#6:192.168.42.106:50035: deleting + +测试到远程服务器上的连接,自动猜测主机名和子网: + + $ sudo sshuttle -vNHr example.org + + Starting sshuttle proxy. + Listening on (‘0.0.0.0′, 12300). + firewall manager ready. + c : connecting to server... + s: available routes: + s: 77.141.99.0/24 + c : connected. + c : seed_hosts: [] + firewall manager: starting transproxy. + hostwatch: Found: testbox1: 1.2.3.4 + hostwatch: Found: mytest2: 5.6.7.8 + hostwatch: Found: domaincontroller: 99.1.2.3 + c : Accept: ‘192.168.42.121':60554 -> ‘77.141.99.22':22. + ^C + firewall manager: undoing changes. + c : Keyboard interrupt: exiting. + c : SW#6:192.168.42.121:60554: deleting + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/sshuttle-a-transparent-proxy-based-vpn-using-ssh.html + +作者:[ruchi][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix diff --git a/published/201505/20150420 7 Interesting Linux 'sort' Command Examples--Part 2.md b/published/201505/20150420 7 Interesting Linux 'sort' Command Examples--Part 2.md new file mode 100644 index 0000000000..476274b495 --- /dev/null +++ b/published/201505/20150420 7 Interesting Linux 'sort' Command Examples--Part 2.md @@ -0,0 +1,134 @@ +Linux 的 'sort'命令的七个有趣实例(二) +================================================================================ + +在[上一篇文章][1]里,我们已经探讨了关于sort命令的多个例子,如果你错过了这篇文章,可以点击下面的链接进行阅读。今天的这篇文章作为上一篇文章的继续,将讨论关于sort命令的剩余用法,与上一篇一起作为Linux ‘sort’命令的完整指南。 + +- [Linux 的 ‘sort’命令的14个有用的范例(一)][1] + +在我们继续深入之前,先创建一个文本文档‘month.txt’,并且将上一次给出的数据填进去。 + + $ echo -e "mar\ndec\noct\nsep\nfeb\naug" > month.txt + $ cat month.txt + +![Populate Content](http://www.tecmint.com/wp-content/uploads/2015/04/Populate-Content.gif) + +15、 通过使用’M‘选项,对’month.txt‘文件按照月份顺序进行排序。 + + $ sort -M month.txt + +**注意**:‘sort’命令需要至少3个字符来确认月份名称。 + +![Sort File Content by Month in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-by-Month.gif) + +16、 把数据整理成方便人们阅读的形式,比如1K、2M、3G、2T,这里面的K、G、M、T代表千、兆、吉、梯。 +(LCTT 译注:此处命令有误,ls 命令应该增加 -h 参数,径改之) + + $ ls -lh /home/$USER | sort -h -k5 + +![Sort Content Human Readable Format](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-Human-Readable-Format.gif) + +17、 在上一篇文章中,我们在例子4中创建了一个名为‘sorted.txt’的文件,在例子6中创建了一个‘lsl.txt’。‘sorted.txt'已经排好序了而’lsl.txt‘还没有。让我们使用sort命令来检查两个文件是否已经排好序。 + + $ sort -c sorted.txt + +![Check File is Sorted](http://www.tecmint.com/wp-content/uploads/2015/04/Check-File-is-Sorted.gif) + +如果它返回0,则表示文件已经排好序。 + + $ sort -c lsl.txt + +![Check File Sorted Status](http://www.tecmint.com/wp-content/uploads/2015/04/Check-File-Sorted-Status.gif) + +报告无序。存在矛盾…… + +18、 如果文字之间的分隔符是空格,sort命令自动地将空格后的东西当做一个新文字单元,如果分隔符不是空格呢? + +考虑这样一个文本文件,里面的内容可以由除了空格之外的任何符号分隔,比如‘|’,‘\’,‘+’,‘.’等…… + +创建一个分隔符为+的文本文件。使用‘cat‘命令查看文件内容。 + + $ echo -e "21+linux+server+production\n11+debian+RedHat+CentOS\n131+Apache+Mysql+PHP\n7+Shell Scripting+python+perl\n111+postfix+exim+sendmail" > delimiter.txt + +---------- + + $ cat delimiter.txt + +![Check File Content by Delimiter](http://www.tecmint.com/wp-content/uploads/2015/04/Check-File-Content.gif) + +现在基于由数字组成的第一个域来进行排序。 + + $ sort -t '+' -nk1 delimiter.txt + +![Sort File By Fields](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-File-By-Fields.gif) + +然后再基于非数字的第四个域排序。 + +![Sort Content By Non Numeric](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-By-Non-Numeric.gif) + +如果分隔符是制表符,你需要在’+‘的位置上用$’\t’代替,如上例所示。 + +19、 对主用户目录下使用‘ls -l’命令得到的结果基于第五列(‘文件大小’)进行一个乱序排列。 + + $ ls -l /home/avi/ | sort -k5 -R + +![Sort Content by Column in Random Order](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Content-by-Column1.gif) + +每一次你运行上面的脚本,你得到结果可能都不一样,因为结果是随机生成的。 + +正如我在上一篇文章中提到的规则2所说——sort命令会将以小写字母开始的行排在大写字母开始的行前面。看一下上一篇文章的例3,字符串‘laptop’在‘LAPTOP’前出现。 + +20、 如何覆盖默认的排序优先权?在这之前我们需要先将环境变量LC_ALL的值设置为C。在命令行提示栏中运行下面的代码。 + + $ export LC_ALL=C + +然后以非默认优先权的方式对‘tecmint.txt’文件重新排序。 + + $ sort tecmint.txt + +![Override Sorting Preferences](http://www.tecmint.com/wp-content/uploads/2015/04/Override-Sorting-Preferences.gif) + +*覆盖排序优先权* + +不要忘记与example 3中得到的输出结果做比较,并且你可以使用‘-f’,又叫‘-ignore-case’(忽略大小写)的选项来获取更有序的输出。 + + $ sort -f tecmint.txt + +![Compare Sorting Preferences](http://www.tecmint.com/wp-content/uploads/2015/04/Compare-Sorting-Preferences.gif) + +21、 给两个输入文件进行‘sort‘,然后把它们连接成一行! + +我们创建两个文本文档’file1.txt‘以及’file2.txt‘,并用数据填充,如下所示,并用’cat‘命令查看文件的内容。 + + $ echo -e “5 Reliable\n2 Fast\n3 Secure\n1 open-source\n4 customizable” > file1.txt + $ cat file1.txt + +![Populate Content with Numbers](http://www.tecmint.com/wp-content/uploads/2015/04/Populate-Content-with-Number.gif) + +用如下数据填充’file2.txt‘。 + + $ echo -e “3 RedHat\n1 Debian\n5 Ubuntu\n2 Kali\n4 Fedora” > file2.txt + $ cat file2.txt + +![Populate File with Data](http://www.tecmint.com/wp-content/uploads/2015/04/Populate-File-with-Data.gif) + +现在我们对两个文件进行排序并连接。 + + $ join <(sort -n file1.txt) <(sort file2.txt) + +![Sort Join Two Files](http://www.tecmint.com/wp-content/uploads/2015/04/Sort-Join-Two-Files.gif) + + +我所要讲的全部内容就在这里了,希望与各位保持联系,也希望各位经常来逛逛。有反馈就在下面评论吧。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-sort-command-examples/ + +作者:[Avishek Kumar][a] +译者:[DongShuaike](https://github.com/DongShuaike) +校对:[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/sort-command-linux/ diff --git a/published/201505/20150423 uperTuxKart 0.9 Released--The Best Racing Game on Linux Just Got Even Better.md b/published/201505/20150423 uperTuxKart 0.9 Released--The Best Racing Game on Linux Just Got Even Better.md new file mode 100644 index 0000000000..70355325b6 --- /dev/null +++ b/published/201505/20150423 uperTuxKart 0.9 Released--The Best Racing Game on Linux Just Got Even Better.md @@ -0,0 +1,35 @@ +SuperTuxKart 0.9 已发行 —— Linux 中最好的竞速类游戏越来越棒了! +================================================================================ +**热门竞速类游戏 SuperTuxKart 的新版本已经[打包发行][1]登陆下载服务器** + +![Super Tux Kart 0.9 Release Poster](http://1.bp.blogspot.com/-eGXvJu3UVwc/VTVhICZVEtI/AAAAAAAAAf0/iP2bkWDNf_c/s1600/poster-cropped.jpg) + +*Super Tux Kart 0.9 发行海报* + +SuperTuxKart 0.9 相较前一版本做了巨大的升级,内部运行着刚出炉的新引擎(有个炫酷的名字叫‘Antarctica(南极洲)’),目的是要呈现更加炫酷的图形环境,从阴影到场景的纵深,外加卡丁车更好的物理效果。 + +突出的图形表现也增加了对显卡的要求。SuperTuxKart 开发人员给玩家的建议是,要有图像处理能力比得上(或者,想要完美的话,要超过) Intel HD Graphics 3000, NVIDIA GeForce 8600 或 AMD Radeon HD 3650 的显卡。 + +### 其他改变 ### + +SuperTuxKart 0.9 中与图像的改善同样吸引人眼球的是一对**全新赛道**,新的卡丁车,新的在线账户可以记录和分享**全新推出的成就系统**里赢得的徽章,以及大量的改装和涂装的微调。 + +点击播放下面的官方发行视频,看看基于调色器的 STK 0.9 所散发的光辉吧。(youtube 视频:https://www.youtube.com/0FEwDH7XU9Q ) + +Ubuntu 用户可以从项目网站上下载新发行版已编译的二进制文件。 + +- [下载 SuperTuxKart 0.9][2] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/04/supertuxkart-0-9-released + +作者:[Joey-Elijah Sneddon][a] +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://supertuxkart.blogspot.co.uk/2015/04/supertuxkart-09-released.html +[2]:http://supertuxkart.sourceforge.net/Downloads diff --git a/published/201505/20150429 Docker 1.6 Released--How to Upgrade on Fedora or CentOS.md b/published/201505/20150429 Docker 1.6 Released--How to Upgrade on Fedora or CentOS.md new file mode 100644 index 0000000000..6b6141211f --- /dev/null +++ b/published/201505/20150429 Docker 1.6 Released--How to Upgrade on Fedora or CentOS.md @@ -0,0 +1,167 @@ +如何在Fedora / CentOS上面升级Docker 1.6 +============================================================================= +Docker,一个流行的将软件打包的开源容器平台,已经有了新的1.6版,增加了许多新的特性。该版本主要更新了Docker Registry、Engine、 Swarm、 Compose 和 Machine等方面。这次发布旨在提升性能、改善开发者和系统管理员的体验。让我们来快速看看有哪些新特性吧。 + +**Docker Registry (2.0)**是一项推送Docker镜像用于存储和分享的服务,因为面临加载下的体验问题而经历了架构的改变。它仍然向后兼容。Docker Registry的编写语言现在从Python改为Google的Go语言了,以提升性能。与Docker Engine 1.6结合后,拉取镜像的能力更快了。早先的镜像是队列式输送的,而现在是并行的啦。 + +**Docker Engine (1.6)**相比之前的版本有很大的提高。目前支持容器与镜像的标签。通过标签,你可以附加用户自定义的元数据到镜像和容器上,而镜像和容器反过来可以被其他工具使用。标签对正在运行的应用是不可见的,可以用来加速搜索容器和镜像。 + +Windows版本的Docker客户端可以连接到远程的运行在linux上的Docker Engine。 + +Docker目前支持日志驱动API,这允许我们发送容器日志给系统如Syslog,或者第三方。这将会使得系统管理员受益。 + +**Swarm (0.2)**是一个Docker集群工具,可以将一个Docker主机池转换为一个虚拟主机。在新特性里,容器甚至被放在了可用的节点上。通过添加更多的Docker命令,努力支持完整的Docker API。将来,使用第三方驱动来集群会成为可能。 + +**Compose (1.2)** 是一个Docker里定义和运行复杂应用的工具, 也得到了升级。在新版本里,可以创建多个子文件,而不是用一个没有结构的文件描述一个多容器应用。 + +通过**Machine (0.2)**,我们可以很容易地在本地计算机、云和数据中心上搭建Docker主机。新的发布版本为开发者提供了一个相对干净地驱动界面来编写驱动。Machine集中控制供给,而不是每个独立的驱动。增加了新的命令,可以用来生成主机的TLS证书,以提高安全性。 + +### 在Fedora / CentOS 上的升级指导 ### + +在这一部分里,我们将会学习如何在Fedora和CentOS上升级已有的docker到最新版本。请注意,目前的Docker仅运行在64位的架构上,Fedora和CentOS都源于RedHat,命令的使用是差不多相同的,除了在Fedora20和CentOS6.5里Docker包被叫做“docker-io”。 + +如果你系统之前没有安装Docker,使用下面命令安装: + + "yum install docker-io" – on Fedora20 / CentOS6.5 + + "yum install docker" - on Fedora21 / CentOS7 + +在升级之前,备份一下docker镜像和容器卷是个不错的主意。 + +参考[“将文件系统打成 tar 包”][1]与[“卷备份、恢复或迁移”][2],获取更多信息。 + +目前,测试系统安装了Docker1.5。样例输出显示是来自一个Fedora20的系统。 + +验证当前系统安装的Docker版本 + + [root@TestNode1 ~]#sudo docker -v + + Docker version 1.5.0, build a8a31ef/1.5.0 + +如果Docker正在运行,先停掉。 + + [root@TestNode1 ~]# sudo systemctl stop docker + +使用yum update升级到最新版,但是写这篇文章的时候,仓库并不是最新版本(1.6),因此你需要使用二进制的升级方法。 + + [root@TestNode1 ~]#sudo yum -y update docker-io + + No packages marked for update + + [root@TestNode1 ~]#sudo wget https://get.docker.com/builds/Linux/x86_64/docker-latest -O /usr/bin/docker + + --2015-04-19 13:40:48-- https://get.docker.com/builds/Linux/x86_64/docker-latest + + Resolving get.docker.com (get.docker.com)... 162.242.195.82 + + Connecting to get.docker.com (get.docker.com)|162.242.195.82|:443... connected. + + HTTP request sent, awaiting response... 200 OK + + Length: 15443598 (15M) [binary/octet-stream] + + Saving to: /usr/bin/docker + + 100%[======================================>] 15,443,598 8.72MB/s in 1.7s + + 2015-04-19 13:40:50 (8.72 MB/s) - /usr/bin/docker saved + +检查更新后的版本 + + [root@TestNode1 ~]#sudo docker -v + + Docker version 1.6.0, build 4749651 + +重启docker服务 + + [root@TestNode1 ~]# sudo systemctl start docker + +确认Docker在运行 + + [root@TestNode1 ~]# docker images + + REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE + + fedora latest 834629358fe2 3 months ago 241.3 MB + + [root@TestNode1 ~]# docker run fedora /bin/echo Hello World + + Hello World + +CentOS安装时需要**注意**,在CentOS上安装完Docker后,当你试图启动Docker服务的时候,你可能会得到错误的信息,如下所示: + + docker.service - Docker Application Container Engine + + Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled) + + Active: failed (Result: exit-code) since Mon 2015-04-20 03:24:24 EDT; 6h ago + + Docs: http://docs.docker.com + + Process: 21069 ExecStart=/usr/bin/docker -d $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY (code=exited, status=127) + + Main PID: 21069 (code=exited, status=127) + + Apr 20 03:24:24 centos7 systemd[1]: Starting Docker Application Container E..... + + Apr 20 03:24:24 centos7 docker[21069]: time="2015-04-20T03:24:24-04:00" lev...)" + + Apr 20 03:24:24 centos7 docker[21069]: time="2015-04-20T03:24:24-04:00" lev...)" + + Apr 20 03:24:24 centos7 docker[21069]: /usr/bin/docker: relocation error: /...ce + + Apr 20 03:24:24 centos7 systemd[1]: docker.service: main process exited, co.../a + + Apr 20 03:24:24 centos7 systemd[1]: Failed to start Docker Application Cont...e. + + Apr 20 03:24:24 centos7 systemd[1]: Unit docker.service entered failed state. + +这是一个已知的bug([https://bugzilla.redhat.com/show_bug.cgi?id=1207839][3]),需要将设备映射升级到最新。 + + [root@centos7 ~]# rpm -qa device-mapper + + device-mapper-1.02.84-14.el7.x86_64 + + [root@centos7 ~]# yum update device-mapper + + [root@centos7 ~]# rpm -qa device-mapper + + device-mapper-1.02.93-3.el7.x86_64 + + [root@centos7 ~]# systemctl start docker + +### 总结 ### + +尽管docker技术出现时间不长,但很快就变得非常流行了。它使得开发者的生活变得轻松,运维团队可以快速独立地创建和部署应用。通过该公司的发布,Docker的快速更新,产品质量的提升,满足用户需求,未来对于Docker来说一片光明。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/docker-1-6-features-upgrade-fedora-centos/ + +作者:[B N Poornima][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/bnpoornima/ +[1]:http://docs.docker.com/reference/commandline/cli/#export +[2]:http://docs.docker.com/userguide/dockervolumes/#backup-restore-or-migrate-data-volumes +[3]:https://bugzilla.redhat.com/show_bug.cgi?id=1207839 +[4]: +[5]: +[6]: +[7]: +[8]: +[9]: +[10]: +[11]: +[12]: +[13]: +[14]: +[15]: +[16]: +[17]: +[18]: +[19]: +[20]: diff --git a/published/201505/20150429 Synfig Studio 1.0--Open Source Animation Gets Serious.md b/published/201505/20150429 Synfig Studio 1.0--Open Source Animation Gets Serious.md new file mode 100644 index 0000000000..a216674d9b --- /dev/null +++ b/published/201505/20150429 Synfig Studio 1.0--Open Source Animation Gets Serious.md @@ -0,0 +1,38 @@ +Synfig Studio 1.0:开源动画动真格的了 +================================================================================ +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/04/synfig-free-animations-750x467.jpg) + +**现在可以下载 Synfig Studio 这个自由、开源的2D动画软件的全新版本了。 ** + +在这个跨平台的软件首次发行一年之后,Synfig Studio 1.0 带着一套全新改进过的功能,实现它所承诺的“创造电影级的动画的工业级解决方案”。 + +在众多功能之上的是一个改进过的用户界面,据项目开发者说那是个用起来‘更简单’、‘更直观’的界面。客户端添加了新的**单窗口模式**,让界面更整洁,而且**使用了最新的 GTK3 库重制**。 + +在功能方面有几个值得注意的变化,包括新加的全功能骨骼系统。 + +这套**关节和转轴的‘骨骼’构架**非常适合2D剪纸动画,再配上这个版本新加的复杂的变形控制系统或是 Synfig 受欢迎的‘关键帧自动插入’(即:帧到帧之间的变形)应该会变得非常有效率的。(youtube视频 https://www.youtube.com/M8zW1qCq8ng ) + +新的无损剪切工具,摩擦力效果和对逐帧位图动画的支持,可能会有助于释放开源动画师们的创造力,更别说新加的用于同步动画的时间线和声音的声效层! + +### 下载 Synfig Studio 1.0 ### + +Synfig Studio 并不是任何人都能用的工具套件,这最新发行版的最新一批改进应该能吸引一些动画制作者试一试这个软件。 + +如果你想看看开源动画制作软件是什么样的,你可以通过下面的链接直接从工程的 Sourceforge 页下载一个适用于 Ubuntu 的最新版本的安装器。 + +- [下载 Synfig 1.0 (64bit) .deb 安装器][1] +- [下载 Synfig 1.0 (32bit) .deb 安装器][2] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/04/synfig-studio-new-release-features + +作者:[Joey-Elijah Sneddon][a] +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://plus.google.com/117485690627814051450/?rel=author +[1]:http://sourceforge.net/projects/synfig/files/releases/1.0/linux/synfigstudio_1.0_amd64.deb/download +[2]:http://sourceforge.net/projects/synfig/files/releases/1.0/linux/synfigstudio_1.0_x86.deb/download diff --git a/published/201505/20150429 web caching basics terminology http headers and caching strategies.md b/published/201505/20150429 web caching basics terminology http headers and caching strategies.md new file mode 100644 index 0000000000..52e4e4e01f --- /dev/null +++ b/published/201505/20150429 web caching basics terminology http headers and caching strategies.md @@ -0,0 +1,181 @@ +Web缓存基础:术语、HTTP报头和缓存策略 +===================================================================== + +### 简介 + +对于您的站点的访问者来说,智能化的内容缓存是提高用户体验最有效的方式之一。缓存,或者对之前的请求的临时存储,是HTTP协议实现中最核心的内容分发策略之一。分发路径中的组件均可以缓存内容来加速后续的请求,这受控于对该内容所声明的缓存策略。 + +在这份指南中,我们将讨论一些Web内容缓存的基本概念。这主要包括如何选择缓存策略以保证互联网范围内的缓存能够正确的处理您的内容。我们将谈一谈缓存带来的好处、副作用以及不同的策略能带来的性能和灵活性的最大结合。 + +###什么是缓存(caching)? + +缓存(caching)是一个描述存储可重用资源以便加快后续请求的行为的术语。有许多不同类型的缓存,每种都有其自身的特点,应用程序缓存和内存缓存由于其对特定回复的加速,都很常用。 + +这份指南的主要讲述的Web缓存是一种不同类型的缓存。Web缓存是HTTP协议的一个核心特性,它能最小化网络流量,并且提升用户所感知的整个系统响应速度。内容从服务器到浏览器的传输过程中,每个层面都可以找到缓存的身影。 + +Web缓存根据特定的规则缓存相应HTTP请求的响应。对于缓存内容的后续请求便可以直接由缓存满足而不是重新发送请求到Web服务器。 + +###好处 + +有效的缓存技术不仅可以帮助用户,还可以帮助内容的提供者。缓存对内容分发带来的好处有: + +- **减少网络开销**:内容可以在从内容提供者到内容消费者网络路径之间的许多不同的地方被缓存。当内容在距离内容消费者更近的地方被缓存时,由于缓存的存在,请求将不会消耗额外的网络资源。 +- **加快响应速度**:由于并不是必须通过整个网络往返,缓存可以使内容的获得变得更快。缓存放在距用户更近的地方,例如浏览器缓存,使得内容的获取几乎是瞬时的。 +- **在同样的硬件上提高速度**:对于保存原始内容的服务器来说,更多的性能可以通过允许激进的缓存策略从硬件上压榨出来。内容拥有者们可以利用分发路径上某个强大的服务器来应对特定内容负载的冲击。 +- **网络中断时内容依旧可用**:使用某种策略,缓存可以保证在原始服务器变得不可用时,相应的内容对用户依旧可用。 + +###术语 + +在面对缓存时,您可能对一些经常遇到的术语可能不太熟悉。一些常见的术语如下: + +- **原始服务器**:原始服务器是内容的原始存放地点。如果您是Web服务器管理员,它就是您所管理的机器。它负责为任何不能从缓存中得到的内容进行回复,并且负责设置所有内容的缓存策略。 +- **缓存命中率**:一个缓存的有效性依照缓存的命中率进行度量。它是可以从缓存中得到数据的请求数与所有请求数的比率。缓存命中率高意味着有很高比例的数据可以从缓存中获得。这通常是大多数管理员想要的结果。 +- **新鲜度**:新鲜度用来描述一个缓存中的项目是否依旧适合返回给客户端。缓存中的内容只有在由缓存策略指定的新鲜期内才会被返回。 +- **过期内容**:缓存中根据缓存策略的新鲜期设置已过期的内容。过期的内容被标记为“陈旧”。通常,过期内容不能用于回复客户端的请求。必须重新从原始服务器请求新的内容或者至少验证缓存的内容是否仍然准确。 +- **校验**:缓存中的过期内容可以验证是否有效以便刷新过期时间。验证过程包括联系原始服务器以检查缓存的数据是否依旧代表了最近的版本。 +- **失效**:失效是依据过期日期从缓存中移除内容的过程。当内容在原始服务器上已被改变时就必须这样做,缓存中过期的内容会导致客户端发生问题。 + +还有许多其他的缓存术语,不过上面的这些应该能帮助您开始。 + +###什么能被缓存? + +某些特定的内容比其他内容更容易被缓存。对大多数站点来说,一些适合缓存的内容如下: + +- Logo和商标图像 +- 普通的不变化的图像(例如,导航图标) +- CSS样式表 +- 普通的Javascript文件 +- 可下载的内容 +- 媒体文件 + +这些文件更倾向于不经常改变,所以长时间的对它们进行缓存能获得好处。 + +一些项目在缓存中必须加以注意: + +- HTML页面 +- 会替换改变的图像 +- 经常修改的Javascript和CSS文件 +- 需要有认证后的cookies才能访问的内容 + +一些内容从来不应该被缓存: + +- 与敏感信息相关的资源(银行数据,等) +- 用户相关且经常更改的数据 + +除上面的通用规则外,通常您需要指定一些规则以便于更好地缓存不同种类的内容。例如,如果登录的用户都看到的是同样的网站视图,就应该在任何地方缓存这个页面。如果登录的用户会在一段时间内看到站点中用户特定的视图,您应该让用户的浏览器缓存该数据而不应让任何中介节点缓存该视图。 + +###Web内容缓存的位置 + +Web内容会在整个分发路径中的许多不同的位置被缓存: + +- **浏览器缓存**:Web浏览器自身会维护一个小型缓存。典型地,浏览器使用一种策略指示缓存最重要的内容。这可能是用户相关的内容或可能会再次请求且下载代价较高。 +- **中间缓存代理**:任何在客户端和您的基础架构之间的服务器都可以按期望缓存一些内容。这些缓存可能由ISP(网络服务提供者)或者其他独立组织提供。 +- **反向缓存**:您的服务器基础架构可以为后端的服务实现自己的缓存。如果实现了缓存,那么便可以在处理请求的位置返回相应的内容而不用每次请求都使用后端服务。 + +上面的这些位置通常都可以根据它们自身的缓存策略和内容源的缓存策略缓存一些相应的内容。 + +###缓存头部 + +缓存策略依赖于两个不同的因素。所缓存的实体本身需要决定是否应该缓存可接受的内容。它可以只缓存部分可以缓存的内容,但不能缓存超过限制的内容。 + +缓存行为主要由缓存策略决定,而缓存策略由内容拥有者设置。这些策略主要通过特定的HTTP头部来清晰地表达。 + +经过几个不同HTTP协议的变化,出现了一些不同的针对缓存方面的头部,它们的复杂度各不相同。下面列出了那些你也许应该注意的: + +- **`Expires`**:尽管使用范围相当有限,但`Expires`头部是非常简洁明了的。通常它设置一个未来的时间,内容会在此时间过期。这时,任何对同样内容的请求都应该回到原始服务器处。这个头部或许仅仅最适合回退模式(fall back)。 +- **`Cache-Control`**:这是`Expires`的一个更加现代化的替换物。它已被很好的支持,且拥有更加灵活的实现。在大多数案例中,它比`Expires`更好,但同时设置两者的值也无妨。稍后我们将讨论您可以设置的`Cache-Control`的详细选项。 +- **`ETag`**:`ETag`用于缓存验证。源服务器可以在首次服务一个内容时为该内容提供一个独特的`ETag`。当一个缓存需要验证这个内容是否即将过期,他会将相应的`ETag`发送回服务器。源服务器或者告诉缓存内容是一致的,或者发送更新后的内容(带着新的`ETag`)。 +- **`Last-Modified`**:这个头部指明了相应的内容最后一次被修改的时间。它可能会作为保证内容新鲜度的验证策略的一部分被使用。 +- **`Content-Length`**:尽管并没有在缓存中明确涉及,`Content-Length`头部在设置缓存策略时很重要。某些软件如果不提前获知内容的大小以留出足够空间,则会拒绝缓存该内容。 +- **`Vary`**:缓存系统通常使用请求的主机和路径作为存储该资源的键。当判断一个请求是否是请求同样内容时,`Vary`头部可以被用来提醒缓存系统需要注意另一个附加头部。它通常被用来告诉缓存系统同样注意`Accept-Encoding`头部,以便缓存系统能够区分压缩和未压缩的内容。 + +### Vary头部的隐语 + +`Vary`头部提供给您存储同一个内容的不同版本的能力,代价是降低了缓存的容量。 + +在使用`Accept-Encoding`时,设置`Vary`头部允许明确区分压缩和未压缩的内容。这在服务某些不能处理压缩数据的浏览器时很重要,它可以保证基本的可用性。`Vary`的一个典型的值是`Accept-Encoding`,它只有两到三个可选的值。 + +一开始看上去`User-Agent`这样的头部可以用于区分移动浏览器和桌面浏览器,以便您的站点提供差异化的服务。但`User-Agent`字符串是非标准的,结果将会造成在中间缓存中保存同一内容的许多不同版本的缓存,这会导致缓存命中率的降低。`Vary`头部应该谨慎使用,尤其是您不具备在您控制的中间缓存中使请求标准化的能力(也许可以,比如您可以控制CDN的话)。 + +###缓存控制标志怎样影响缓存 + +上面我们提到了`Cache-Control`头部如何被用与现代缓存策略标准。能够通过这个头部设定许多不同的缓存指令,多个不同的指令通过逗号分隔。 + +一些您可以使用的指示内容缓存策略的`Cache-Control`的选项如下: + +- **`no-cache`**:这个指令指示所有缓存的内容在新的请求到达时必须先重新验证,再发送给客户端。这条指令实际将内容立刻标记为过期的,但允许通过验证手段重新验证以避免重新下载整个内容。 +- **`no-store`**:这条指令指示缓存的内容不能以任何方式被缓存。它适合在回复敏感信息时设置。 +- **`public`**:它将内容标记为公有的,这意味着它能被浏览器和其他任何中间节点缓存。通常,对于使用了HTTP验证的请求,其回复被默认标记为`private`。`public`标记将会覆盖这个设置。 +- **`private`**:它将内容标记为私有的。私有数据可以被用户的浏览器缓存,但*不能*被任何中间节点缓存。它通常用于用户相关的数据。 +- **`max-age`**:这个设置指示了缓存内容的最大生存期,它在最大生存期后必须在源服务器处被验证或被重新下载。在现代浏览器中这个选项大体上取代了`Expires`头部,浏览器也将其作为决定内容的新鲜度的基础。这个选项的值以秒为单位表示,最大可以表示一年的新鲜期(31536000秒)。 +- **`s-maxage`**:这个选项非常类似于`max-age`,它指明了内容能够被缓存的时间。区别是这个选项只在中间节点的缓存中有效。结合这两个选项可以构建更加灵活的缓存策略。 +- **`must-revalidate`**:它指明了由`max-age`、`s-maxage`或`Expires`头部指明的新鲜度信息必须被严格的遵守。它避免了缓存的数据在网络中断等类似的场景中被使用。 +- **`proxy-revalidate`**:它和上面的选项有着一样的作用,但只应用于中间的代理节点。在这种情况下,用户的浏览器可以在网络中断时使用过期内容,但中间缓存内容不能用于此目的。 +- **`no-transform`**:这个选项告诉缓存在任何情况下都不能因为性能的原因修改接收到的内容。这意味着,缓存不允许压缩接收到的内容(没有从原始服务器处接收过压缩版本的该内容)并发送。 + +这些选项能够以不同的方式结合以获得不同的缓存行为。一些互斥的值如下: + +- `no-cache`,`no-store`以及由其他前面未提到的选项指明的常用的缓存行为 +- `public`和`private` + +如果`no-store`和`no-cache`都被设置,那么`no-store`会取代`no-cache`。对于非授权的请求的回复,`public`是隐含的设置。对于授权的请求的回复,`private`选项是隐含的。他们可以通过在`Cache-Control`头部中指明相应的相反的选项以覆盖。 + +###开发一种缓存策略 + +在理想情况下,任何内容都可以被尽可能缓存,而您的服务器只需要偶尔的提供一些验证内容即可。但这在现实中很少发生,因此您应该尝试设置一些明智的缓存策略,以在长期缓存和站点改变的需求间达到平衡。 + +### 常见问题 + +在许多情况中,由于内容被产生的方式(如根据每个用户动态的产生)或者内容的特性(例如银行的敏感数据),这些内容不应该被缓存。另一些许多管理员在设置缓存时可能面对的问题是外部缓存的数据未过期,但新版本的数据已经产生。 + +这些都是经常遇到的问题,它们会影响缓存的性能和您提供的数据的准确性。然而,我们可以通过开发提前预见这些问题的缓存策略来缓解这些问题。 + +### 一般性建议 + +尽管您的实际情况会指导您选择的缓存策略,但是下面的建议能帮助您获得一些合理的决定。 + +在您担心使用哪一个特定的头部之前,有一些特定的步骤可以帮助您提高您的缓存命中率。一些建议如下: + +- **为图像、CSS和共享的内容建立特定的文件夹**:将内容放到特定的文件夹内使得您可以方便的从您的站点中的任何页面引用这些内容。 +- **使用同样的URL来表示同样的内容**:由于缓存使用内容请求中的主机名和路径作为键,因此应保证您的所有页面中的该内容的引用方式相同,前一个建议能让这点更加容易做到。 +- **尽可能使用CSS图像拼接**:对于像图标和导航等内容,使用CSS图像拼接能够减少渲染您页面所需要的请求往返,并且允许对拼接缓存很长一段时间。 +- **尽可能将主机脚本和外部资源本地化**:如果您使用Javascript脚本和其他外部资源,如果上游没有提供合适的缓存头部,那么您应考虑将这些内容放在您自己的服务器上。您应该注意上游的任何更新,以便更新本地的拷贝。 +- **对缓存内容收集文件摘要**:静态的内容比如CSS和Javascript文件等通常比较适合收集文件摘要。这意味着为文件名增加一个独特的标志符(通常是这个文件的哈希值)可以在文件修改后绕开缓存保证新的内容被重新获取。有很多工具可以帮助您创建文件摘要并且修改HTML文档中的引用。 + +对于不同的文件正确地选择不同的头部这件事,下面的内容可以作为一般性的参考: + +- **允许所有的缓存存储一般内容**:静态内容以及非用户相关的内容应该在分发链的所有节点被缓存。这使得中间节点可以将该内容回复给多个用户。 +- **允许浏览器缓存用户相关的内容**:对于每个用户的数据,通常在用户自己的浏览器中缓存是可以被接受且有益的。缓存在用户自身的浏览器能够使得用户在接下来的浏览中能够瞬时读取,但这些内容不适合在任何中间代理节点缓存。 +- **将时间敏感的内容作为特例**:如果您的数据是时间敏感的,那么相对上面两条参考,应该将这些数据作为特例,以保证过期的数据不会在关键的情况下被使用。例如,您的站点有一个购物车,它应该立刻反应购物车里面的物品。依据内容的特点,可以在`Cache-Control`头部中使用`no-cache`或`no-store`选项。 +- **总是提供验证器**:验证器使得过期的内容可以无需重新下载而得到刷新。设置`ETag`和`Last-Modified`头部将允许缓存向原始服务器验证内容,并在内容未修改时刷新该内容新鲜度以减少负载。 +- **对于支持的内容设置长的新鲜期**:为了更加有效的利用缓存,一些作为支持性的内容应该被设置较长的新鲜期。这通常比较适合图像和CSS等由用户请求用来渲染HTML页面的内容。和文件摘要一起,设置延长的新鲜期将允许缓存长时间的存储这些资源。如果资源发生改变,修改的文件摘要将会使缓存的数据无效并触发对新的内容的下载。那时,新的支持的内容会继续被缓存。 +- **对父内容设置短的新鲜期**:为了使得前面的模式正常工作,容器类的内容应该相应的设置短的新鲜期,或者设置不全部缓存。这通常是在其他协助内容中使用的HTML页面。这个HTML页面将会被频繁的下载,使得它能快速的响应改变。支持性的内容因此可以被尽量缓存。 + +关键之处便在于达到平衡,一方面可以尽量的进行缓存,另一方面为未来保留当改变发生时从而改变整个内容的机会。您的站点应该同时具有: + +- 尽量缓存的内容 +- 拥有短的新鲜期的缓存内容,可以被重新验证 +- 完全不被缓存的内容 + +这样做的目的便是将内容尽可能的移动到第一个分类(尽量缓存)中的同时,维持可以接受的缓存命中率。 + +结论 +---- + +花时间确保您的站点使用了合适的缓存策略将对您的站点产生重要的影响。缓存使得您可以在保证服务同样内容的同时减少带宽的使用。您的服务器因此可以靠同样的硬件处理更多的流量。或许更重要的是,客户们能在您的网站中获得更快的体验,这会使得他们更愿意频繁的访问您的站点。尽管有效的Web缓存并不是银弹,但设置合适的缓存策略会使您以最小的代价获得可观的收获。 + +--- + +via: https://www.digitalocean.com/community/tutorials/web-caching-basics-terminology-http-headers-and-caching-strategies + +作者: [Justin Ellingwood](https://www.digitalocean.com/community/users/jellingwood) +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[wxy](https://github.com/wxy) +推荐:[royaso](https://github.com/royaso) + + + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + + + diff --git a/published/201505/20150504 How To Install Visual Studio Code On Ubuntu.md b/published/201505/20150504 How To Install Visual Studio Code On Ubuntu.md new file mode 100644 index 0000000000..b3bb071dc5 --- /dev/null +++ b/published/201505/20150504 How To Install Visual Studio Code On Ubuntu.md @@ -0,0 +1,63 @@ +在Ubuntu中安装Visual Studio Code +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Install-Visual-Studio-Code-in-Ubuntu.jpeg) + +微软令人意外地[发布了Visual Studio Code][1],并支持主要的桌面平台,当然包括linux。如果你是一名需要在ubuntu工作的web开发人员,你可以**非常轻松的安装Visual Studio Code**。 + +我将要使用[Ubuntu Make][2]来安装Visual Studio Code。Ubuntu Make,就是以前的Ubuntu开发者工具中心,是一个命令行工具,帮助用户快速安装各种开发工具、语言和IDE。也可以使用Ubuntu Make轻松[安装Android Studio][3] 和其他IDE,如Eclipse。本文将展示**如何在Ubuntu中使用Ubuntu Make安装Visual Studio Code**。(译注:也可以直接去微软官网下载安装包) + +### 安装微软Visual Studio Code ### + +开始之前,首先需要安装Ubuntu Make。虽然Ubuntu Make存在Ubuntu15.04官方库中,**但是需要Ubuntu Make 0.7以上版本才能安装Visual Studio**。所以,需要通过官方PPA更新到最新的Ubuntu Make。此PPA支持Ubuntu 14.04, 14.10 和 15.04。 + +注意,**仅支持64位版本**。 + +打开终端,使用下列命令,通过官方PPA来安装Ubuntu Make: + + sudo add-apt-repository ppa:ubuntu-desktop/ubuntu-make + sudo apt-get update + sudo apt-get install ubuntu-make + +安装Ubuntu Make完后,接着使用下列命令安装Visual Studio Code: + + umake web visual-studio-code + +安装过程中,将会询问安装路径,如下图: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Visual_Studio_Code_Ubuntu_1.jpeg) + +在抛出一堆要求和条件后,它会询问你是否确认安装Visual Studio Code。输入‘a’来确定: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Visual_Studio_Code_Ubuntu_2.jpeg) + +确定之后,安装程序会开始下载并安装。安装完成后,你可以发现Visual Studio Code 图标已经出现在了Unity启动器上。点击图标开始运行!下图是Ubuntu 15.04 Unity的截图: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Visual_Studio_Code_Ubuntu.jpeg) + +### 卸载Visual Studio Code### + +卸载Visual Studio Code,同样使用Ubuntu Make命令。如下: + + umake web visual-studio-code --remove + +如果你不打算使用Ubuntu Make,也可以通过微软官方下载安装文件。 + +- [下载Visual Studio Code Linux版][4] + +怎样!是不是超级简单就可以安装Visual Studio Code,这都归功于Ubuntu Make。我希望这篇文章能帮助到你。如果您有任何问题或建议,欢迎给我留言。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-visual-studio-code-ubuntu/ + +作者:[Abhishek][a] +译者:[Vic020/VicYu](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:https://linux.cn/article-5376-1.html +[2]:https://wiki.ubuntu.com/ubuntu-make +[3]:http://itsfoss.com/install-android-studio-ubuntu-linux/ +[4]:https://code.visualstudio.com/Download diff --git a/published/201505/20150505 Bodhi Linux Introduces Moksha Desktop.md b/published/201505/20150505 Bodhi Linux Introduces Moksha Desktop.md new file mode 100644 index 0000000000..dcb724e7b1 --- /dev/null +++ b/published/201505/20150505 Bodhi Linux Introduces Moksha Desktop.md @@ -0,0 +1,40 @@ +Bodhi Linux 将引入 Moksha 桌面 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Bodhi_Linux.jpg) + +基于Ubuntu的轻量级Linux发行版[Bodhi Linux][1]致力于构建其自家的桌面环境,这个全新桌面环境被称之为Moksha(梵文意为‘完全自由’)。Moksha将替换其原来的[Enlightenment桌面环境][2]。 + +### 为何用Moksha替换Englightenment? ### + +Bodhi Linux的Jeff Hoogland最近[表示][3]了他对新版Enlightenment的不满。直到E17,Enlightenment都十分稳定,并且能满足轻量级Linux的部署需求。而E18则到处都充满了问题,Bodhi Linux只好弃之不用了。 + +虽然最新的[Bodhi Linux 3.0发行版][4]仍然使用了E19作为其桌面(除传统模式外,这意味着,对于旧的硬件,仍然会使用E17),Jeff对E19也十分不满。他说道: + +> 除了性能问题外,对于我个人而言,E19并没有给我带来与E17下相同的工作流程,因为它移除了很多E17的特性。鉴于此,我不得不将我所有的3台Bodhi计算机桌面改成E17——这3台机器都是我高端的了。这不由得让我想到,我们还有多少现存的Bodhi用户也怀着和我同样的感受,所以,我[在我们的用户论坛上开启一个与此相关的讨论][5]。 + +### Moksha是E17桌面的延续 ### + +Moksha将会是Bodhi所热衷的E17桌面的延续。Jeff进一步提到: + +> 我们将从整合所有Bodhi修改开始。多年来我们一直都只是给源代码打补丁,并修复桌面所带有的问题。如果该工作完成,我们将开始移植一些E18和E19引入的更为有用的特性,最后,我们将引入一些我们认为会改善最终用户体验的东西。 + +### Moksha何时发布? ### + +下一个Bodhi更新将会是Bodhi 3.1.0,就在今年八月。这个新版本将为所有其默认安装镜像带来Moksha。让我们拭目以待,看看Moksha是否是一个好的决定。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/bodhi-linux-introduces-moksha-desktop/ + +作者:[Abhishek][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://www.bodhilinux.com/ +[2]:https://www.enlightenment.org/ +[3]:http://www.bodhilinux.com/2015/04/28/introducing-the-moksha-desktop/ +[4]:http://itsfoss.com/bodhi-linux-3/ +[5]:http://forums.bodhilinux.com/index.php?/topic/12322-e17-vs-e19-which-are-you-using-and-why/ diff --git a/published/201505/20150506 How to Securely Store Passwords and Api Keys Using Vault.md b/published/201505/20150506 How to Securely Store Passwords and Api Keys Using Vault.md new file mode 100644 index 0000000000..e2073d0b18 --- /dev/null +++ b/published/201505/20150506 How to Securely Store Passwords and Api Keys Using Vault.md @@ -0,0 +1,164 @@ +如何使用Vault安全的存储密码和API密钥 +======================================================================= +Vault是用来安全的获取秘密信息的工具,它可以保存密码、API密钥、证书等信息。Vault提供了一个统一的接口来访问秘密信息,其具有健壮的访问控制机制和丰富的事件日志。 + +对关键信息的授权访问是一个困难的问题,尤其是当有许多用户角色,并且用户请求不同的关键信息时,例如用不同权限登录数据库的登录配置,用于外部服务的API密钥,SOA通信的证书等。当保密信息由不同的平台进行管理,并使用一些自定义的配置时,情况变得更糟,因此,安全的存储、管理审计日志几乎是不可能的。但Vault为这种复杂情况提供了一个解决方案。 + +### 突出特点 ### + +**数据加密**:Vault能够在不存储数据的情况下对数据进行加密、解密。开发者们便可以存储加密后的数据而无需开发自己的加密技术,Vault还允许安全团队自定义安全参数。 + +**安全密码存储**:Vault在将秘密信息(API密钥、密码、证书)存储到持久化存储之前对数据进行加密。因此,如果有人偶尔拿到了存储的数据,这也没有任何意义,除非加密后的信息能被解密。 + +**动态密码**:Vault可以随时为AWS、SQL数据库等类似的系统产生密码。比如,如果应用需要访问AWS S3 桶,它向Vault请求AWS密钥对,Vault将给出带有租期的所需秘密信息。一旦租用期过期,这个秘密信息就不再存储。 + +**租赁和更新**:Vault给出的秘密信息带有租期,一旦租用期过期,它便立刻收回秘密信息,如果应用仍需要该秘密信息,则可以通过API更新租用期。 + +**撤销**:在租用期到期之前,Vault可以撤销一个秘密信息或者一个秘密信息树。 + +### 安装Vault ### + +有两种方式来安装使用Vault。 + +**1. 预编译的Vault二进制** 能用于所有的Linux发行版,下载地址如下,下载之后,解压并将它放在系统PATH路径下,以方便调用。 + +- [下载预编译的二进制 Vault (32-bit)][1] +- [下载预编译的二进制 Vault (64-bit)][2] +- [下载预编译的二进制 Vault (ARM)][3] + +![wget binary](http://blog.linoxide.com/wp-content/uploads/2015/04/wget-binary.png) + +*下载相应的预编译的Vault二进制版本。* + +![vault](http://blog.linoxide.com/wp-content/uploads/2015/04/unzip.png) + +*解压下载到本地的二进制版本。* + +祝贺你!您现在可以使用Vault了。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/04/vault.png) + +**2. 从源代码编译**是另一种在系统中安装Vault的方式。在安装Vault之前需要安装GO和GIT。 + +在 **Redhat系统中安装GO** 使用下面的指令: + + sudo yum install go + +在 **Debin系统中安装GO** 使用下面的指令: + + sudo apt-get install golang + +或者 + + sudo add-apt-repository ppa:gophers/go + + sudo apt-get update + + sudo apt-get install golang-stable + +在 **Redhat系统中安装GIT** 使用下面的命令: + + sudo yum install git + +在 **Debian系统中安装GIT** 使用下面的命令: + + sudo apt-get install git + +一旦GO和GIT都已被安装好,我们便可以开始从源码编译安装Vault。 + +> 将下列的Vault仓库拷贝至GOPATH + + https://github.com/hashicorp/vault + +> 测试下面的文件是否存在,如果它不存在,那么Vault没有被克隆到合适的路径。 + + $GOPATH/src/github.com/hashicorp/vault/main.go + +> 执行下面的指令来编译Vault,并将二进制文件放到系统bin目录下。 + + make dev + +![path](http://blog.linoxide.com/wp-content/uploads/2015/04/installation4.png) + +### 一份Vault入门教程 ### + +我们已经编制了一份Vault的官方交互式教程,并带有它在SSH上的输出信息。 + +**概述** + +这份教程包括下列步骤: + +- 初始化并启封您的Vault +- 在Vault中对您的请求授权 +- 读写秘密信息 +- 密封您的Vault + +#### **初始化您的Vault** + +首先,我们需要为您初始化一个Vault的工作实例。在初始化过程中,您可以配置Vault的密封行为。简单起见,现在使用一个启封密钥来初始化Vault,命令如下: + + vault init -key-shares=1 -key-threshold=1 + +您会注意到Vault在这里输出了几个密钥。不要清除您的终端,这些密钥在后面的步骤中会使用到。 + +![Initializing SSH](http://blog.linoxide.com/wp-content/uploads/2015/04/Initializing-SSH.png) + +#### **启封您的Vault** + +当一个Vault服务器启动时,它是密封的状态。在这种状态下,Vault被配置为知道物理存储在哪里及如何存取它,但不知道如何对其进行解密。Vault使用加密密钥来加密数据。这个密钥由"主密钥"加密,主密钥不保存。解密主密钥需要入口密钥。在这个例子中,我们使用了一个入口密钥来解密这个主密钥。 + + vault unseal + +![Unsealing SSH](http://blog.linoxide.com/wp-content/uploads/2015/04/Unsealing-SSH.png) + +####**为您的请求授权** + +在执行任何操作之前,连接的客户端必须是被授权的。授权的过程是检验一个人或者机器是否如其所申明的那样具有正确的身份。这个身份用在向Vault发送请求时。为简单起见,我们将使用在步骤2中生成的root令牌,这个信息可以回滚终端屏幕看到。使用一个客户端令牌进行授权: + + vault auth + +![Authorize SSH](http://blog.linoxide.com/wp-content/uploads/2015/04/Authorize-SSH.png) + +####**读写保密信息** + +现在Vault已经被设置妥当,我们可以开始读写默认挂载的秘密后端里面的秘密信息了。写在Vault中的秘密信息首先被加密,然后被写入后端存储中。后端存储机制绝不会看到未加密的信息,并且也没有在Vault之外解密的需要。 + + vault write secret/hello value=world + +当然,您接下来便可以读这个保密信息了: + + vault read secret/hello + +![RW_SSH](http://blog.linoxide.com/wp-content/uploads/2015/04/RW_SSH.png) + +####**密封您的Vault** + +还有一个用I来密封Vault的API。它将丢掉现在的加密密钥并需要另一个启封过程来恢复它。密封仅需要一个拥有root权限的操作者。这是一种罕见的"打破玻璃过程"的典型部分。 + +这种方式中,如果检测到一个入侵,Vault数据将会立刻被锁住,以便最小化损失。如果不能访问到主密钥碎片的话,就不能再次获取数据。 + + vault seal + +![Seal Vault SSH](http://blog.linoxide.com/wp-content/uploads/2015/04/Seal-Vault-SSH.png) + +这便是入门教程的结尾。 + +### 总结 ### + +Vault是一个非常有用的应用,它提供了一个可靠且安全的存储关键信息的方式。另外,它在存储前加密关键信息、审计日志维护、以租期的方式获取秘密信息,且一旦租用期过期它将立刻收回秘密信息。Vault是平台无关的,并且可以免费下载和安装。要发掘Vault的更多信息,请访问其[官方网站][4]。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/secure-secret-store-vault/ + +作者:[Aun Raza][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://linoxide.com/author/arunrz/ +[1]:https://dl.bintray.com/mitchellh/vault/vault_0.1.0_linux_386.zip +[2]:https://dl.bintray.com/mitchellh/vault/vault_0.1.0_linux_amd64.zip +[3]:https://dl.bintray.com/mitchellh/vault/vault_0.1.0_linux_arm.zip +[4]:https://vaultproject.io/ diff --git a/published/201505/20150506 Linux FAQs with Answers--How to configure a Linux bridge with Network Manager on Ubuntu.md b/published/201505/20150506 Linux FAQs with Answers--How to configure a Linux bridge with Network Manager on Ubuntu.md new file mode 100644 index 0000000000..b1ff96e30b --- /dev/null +++ b/published/201505/20150506 Linux FAQs with Answers--How to configure a Linux bridge with Network Manager on Ubuntu.md @@ -0,0 +1,86 @@ +Linux 有问必答:如何在Ubuntu上配置网桥 +=============================================================================== +> **Question**: 我需要在我的Ubuntu主机上建立一个Linux网桥,共享一个网卡给其他一些虚拟主机或在主机上创建的容器。我目前正在Ubuntu上使用网络管理器(Network Manager),所以最好>能使用网络管理器来配置一个网桥。我该怎么做? + +网桥是一个硬件装备,用来将两个或多个数据链路层(OSI七层模型中第二层)互联,以使得不同网段上的网络设备可以互相访问。当你想要互联一个主机里的多个虚拟机器或者以太接口时,就需要在Linux主机里有一个类似桥接的概念。这里使用的是一种软网桥。 + +有很多的方法来配置一个Linux网桥。举个例子,在一个无外接显示/键盘的服务器环境里,你可以使用[brct][1]手动地配置一个网桥。而在桌面环境下,在网络管理器里也支持网桥设置。那就让我们测试一下如何用网络管理器配置一个网桥吧。 + +### 要求 ### + +为了避免[任何问题][2],建议你的网络管理器版本为0.9.9或者更高,它用在 Ubuntu 15.04或者更新的版本。 + + $ apt-cache show network-manager | grep Version + +---------- + + Version: 0.9.10.0-4ubuntu15.1 + Version: 0.9.10.0-4ubuntu15 + +### 创建一个网桥 ### + +使用网络管理器创建网桥最简单的方式就是通过nm-connection-editor。这款GUI(图形用户界面)的工具允许你傻瓜式地配置一个网桥。 + +首先,启动nm-connection-editor。 + + $ nm-connection-editor + +该编辑器的窗口会显示给你一个列表,列出目前配置好的网络连接。点击右上角的“添加”按钮,创建一个网桥。 + +![](https://farm9.staticflickr.com/8781/17139502730_c3ca920f7f.jpg) + +接下来,选择“Bridge”(网桥)作为连接类型。 + +![](https://farm9.staticflickr.com/8873/17301102406_4f75133391_z.jpg) + +现在,开始配置网桥,包括它的名字和所桥接的连接。如果没有创建过其他网桥,那么默认的网桥接口会被命名为bridge0。 + +回顾一下,创建网桥的目的是为了通过网桥共享你的以太网卡接口,所以你需要添加以太网卡接口到网桥。在图形界面添加一个新的“桥接的连接”可以实现上述目的。点击“Add”按钮。 + +![](https://farm9.staticflickr.com/8876/17327069755_52f1d81f37_z.jpg) + +选择“以太网”作为连接类型。 + +![](https://farm9.staticflickr.com/8832/17326664591_632a9001da_z.jpg) + +在“设备的 MAC 地址”区域,选择你想要从属于网桥的接口。本例中,假设该接口是eth0。 + +![](https://farm9.staticflickr.com/8842/17140820559_07a661f30c_z.jpg) + +点击“常规”标签,并且选中两个复选框,分别是“当其可用时自动连接到该网络”和“所有用户都可以连接到该网络”。 + +![](https://farm8.staticflickr.com/7776/17325199982_801290e172_z.jpg) + +切换到“IPv4 设置”标签,为网桥配置DHCP或者是静态IP地址。注意,你应该为从属的以太网卡接口eth0使用相同的IPv4设定。本例中,我们假设eth0是用过DHCP配置的。因此,此处选择“自动(DHCP)”。如果eth0被指定了一个静态IP地址,那么你也应该指定相同的IP地址给网桥。 + +![](https://farm8.staticflickr.com/7737/17140820469_99955cf916_z.jpg) + +最后,保存网桥的设置。 + +现在,你会看见一个新增的网桥连接被创建在“网络连接”窗口里。因为已经从属与网桥,以前配置好的有线连接 eth0 就不再需要了,所以去删除原来的有线连接吧。 + +![](https://farm9.staticflickr.com/8700/17140820439_272a6d5c4e.jpg) + +这时候,网桥连接会被自动激活。从指定给eth0的IP地址被网桥接管起,你将会暂时丢失一下连接。当IP地址赋给了网桥,你将会通过网桥连接回你的以太网卡接口。你可以通过“Network”设置确认一下。 + +![](https://farm8.staticflickr.com/7742/17325199902_9ceb67ddc1_c.jpg) + +同时,检查可用的接口。提醒一下,网桥接口必须已经取代了任何你的以太网卡接口拥有的IP地址。 + +![](https://farm8.staticflickr.com/7717/17327069605_6143f1bd6a_b.jpg) + +就这么多了,现在,网桥已经可以用了。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/configure-linux-bridge-network-manager-ubuntu.html + +作者:[Dan Nanni][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/how-to-configure-linux-bridge-interface.html +[2]:https://bugs.launchpad.net/ubuntu/+source/network-manager/+bug/1273201 diff --git a/published/201505/20150506 Linux FAQs with Answers--How to install autossh on Linux.md b/published/201505/20150506 Linux FAQs with Answers--How to install autossh on Linux.md new file mode 100644 index 0000000000..3fa2cf8a86 --- /dev/null +++ b/published/201505/20150506 Linux FAQs with Answers--How to install autossh on Linux.md @@ -0,0 +1,76 @@ +Linux有问必答:如何安装autossh +================================================================================ +> **提问**: 我打算在linux上安装autossh,我应该怎么做呢? + +[autossh][1] 是一款开源工具,可以帮助管理SSH会话、自动重连和停止转发流量。autossh会假定目标主机已经设定[无密码SSH登陆][2],以便autossh可以重连断开的SSH会话而不用用户操作。 + +只要你建立[反向SSH隧道][3]或者[挂载基于SSH的远程文件夹][4],autossh迟早会派上用场。基本上只要需要维持SSH会话,autossh肯定是有用的。 + +![](https://farm8.staticflickr.com/7786/17150854870_63966e78bc_c.jpg) + +下面有许多linux发行版autossh的安装方法。 + +### Debian 或 Ubuntu 系统 ### + +autossh已经加入基于Debian系统的基础库,所以可以很方便的安装。 + + $ sudo apt-get install autossh + +### Fedora 系统 ### + +Fedora库同样包含autossh包,使用yum安装。 + + $ sudo yum install autossh + +### CentOS 或 RHEL 系统 ### + +CentOS/RHEL 6 或早期版本, 需要开启第三库[Repoforge库][5], 然后才能使用yum安装. + + $ sudo yum install autossh + +CentOS/RHEL 7以后,autossh 已经不在Repoforge库中. 你需要从源码编译安装(例子在下面)。 + +### Arch Linux 系统 ### + + $ sudo pacman -S autossh + +### Debian 或 Ubuntu 系统中从源码编译安装### + +如果你想要使用最新版本的autossh,你可以自己编译源码安装 + + $ sudo apt-get install gcc make + $ wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz + $ tar -xf autossh-1.4e.tgz + $ cd autossh-1.4e + $ ./configure + $ make + $ sudo make install + +### CentOS, Fedora 或 RHEL 系统中从源码编译安装### + +在CentOS/RHEL 7以后,autossh不在是预编译包。所以你不得不从源码编译安装。 + + $ sudo yum install wget gcc make + $ wget http://www.harding.motd.ca/autossh/autossh-1.4e.tgz + $ tar -xf autossh-1.4e.tgz + $ cd autossh-1.4e + $ ./configure + $ make + $ sudo make install + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-autossh-linux.html + +作者:[Dan Nanni][a] +译者:[Vic020/VicYu](http://vicyu.net) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://www.harding.motd.ca/autossh/ +[2]:https://linux.cn/article-5444-1.html +[3]:http://xmodulo.com/access-linux-server-behind-nat-reverse-ssh-tunnel.html +[4]:http://xmodulo.com/how-to-mount-remote-directory-over-ssh-on-linux.html +[5]:http://xmodulo.com/how-to-set-up-rpmforge-repoforge-repository-on-centos.html diff --git a/published/201505/20150507 Command Line Tool to Monitor Linux Containers Performance.md b/published/201505/20150507 Command Line Tool to Monitor Linux Containers Performance.md new file mode 100644 index 0000000000..161e030c11 --- /dev/null +++ b/published/201505/20150507 Command Line Tool to Monitor Linux Containers Performance.md @@ -0,0 +1,185 @@ +监控 Linux 容器性能的命令行神器 +================================================================================ +ctop是一个新的基于命令行的工具,它可用于在容器层级监控进程。容器通过利用控制器组(cgroup)的资源管理功能,提供了操作系统层级的虚拟化环境。该工具从cgroup收集与内存、CPU、块输入输出的相关数据,以及拥有者、开机时间等元数据,并以人性化的格式呈现给用户,这样就可以快速对系统健康状况进行评估。基于所获得的数据,它可以尝试推测下层的容器技术。ctop也有助于在低内存环境中检测出谁在消耗大量的内存。 + +### 功能 ### + +ctop的一些功能如下: + +- 收集CPU、内存和块输入输出的度量值 +- 收集与拥有者、容器技术和任务统计相关的信息 +- 通过任意栏对信息排序 +- 以树状视图显示信息 +- 折叠/展开cgroup树 +- 选择并跟踪cgroup/容器 +- 选择显示数据刷新的时间窗口 +- 暂停刷新数据 +- 检测基于systemd、Docker和LXC的容器 +- 基于Docker和LXC的容器的高级特性 + - 打开/连接shell以进行深度诊断 + - 停止/杀死容器类型 + +### 安装 ### + +**ctop**是由Python写成的,因此,除了需要Python 2.6或其更高版本外(带有内建的光标支持),别无其它外部依赖。推荐使用Python的pip进行安装,如果还没有安装pip,请先安装,然后使用pip安装ctop。 + +*注意:本文样例来自Ubuntu(14.10)系统* + + $ sudo apt-get install python-pip + +使用pip安装ctop: + + poornima@poornima-Lenovo:~$ sudo pip install ctop + + [sudo] password for poornima: + + Downloading/unpacking ctop + + Downloading ctop-0.4.0.tar.gz + + Running setup.py (path:/tmp/pip_build_root/ctop/setup.py) egg_info for package ctop + + Installing collected packages: ctop + + Running setup.py install for ctop + + changing mode of build/scripts-2.7/ctop from 644 to 755 + + changing mode of /usr/local/bin/ctop to 755 + + Successfully installed ctop + + Cleaning up... + +如果不选择使用pip安装,你也可以使用wget直接从github安装: + + poornima@poornima-Lenovo:~$ wget https://raw.githubusercontent.com/yadutaf/ctop/master/cgroup_top.py -O ctop + + --2015-04-29 19:32:53-- https://raw.githubusercontent.com/yadutaf/ctop/master/cgroup_top.py + + Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 199.27.78.133 + + Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|199.27.78.133|:443... connected. + + HTTP request sent, awaiting response... 200 OK Length: 27314 (27K) [text/plain] + + Saving to: ctop + + 100%[======================================>] 27,314 --.-K/s in 0s + + 2015-04-29 19:32:59 (61.0 MB/s) - ctop saved [27314/27314] + +---------- + + poornima@poornima-Lenovo:~$ chmod +x ctop + +如果cgroup-bin包没有安装,你可能会碰到一个错误消息,你可以通过安装需要的包来解决。 + + poornima@poornima-Lenovo:~$ ./ctop + + [ERROR] Failed to locate cgroup mountpoints. + + poornima@poornima-Lenovo:~$ sudo apt-get install cgroup-bin + +下面是ctop的输出样例: + +![ctop screen](http://blog.linoxide.com/wp-content/uploads/2015/05/ctop.png) + +*ctop屏幕* + +### 用法选项 ### + + ctop [--tree] [--refresh=] [--columns=] [--sort-col=] [--follow=] [--fold=, ...] ctop (-h | --help) + +当你进入ctop屏幕,可使用上(↑)和下(↓)箭头键在容器间导航。点击某个容器就选定了该容器,按q或Ctrl+C退出该容器。 + +现在,让我们来看看上面列出的那一堆选项究竟是怎么用的吧。 + +**-h / --help - 显示帮助信息** + + poornima@poornima-Lenovo:~$ ctop -h + Usage: ctop [options] + + Options: + -h, --help show this help message and exit + --tree show tree view by default + --refresh=REFRESH Refresh display every + --follow=FOLLOW Follow cgroup path + --columns=COLUMNS List of optional columns to display. Always includes + 'name' + --sort-col=SORT_COL Select column to sort by initially. Can be changed + dynamically. + + +**--tree - 显示容器的树形视图** + +默认情况下,会显示列表视图 + +当你进入ctop窗口,你可以使用F5按钮在树状/列表视图间切换。 + +**--fold= - 在树形视图中折叠名为 \ 的 cgroup 路径** + +该选项需要与 --tree 选项组合使用。 + +例子: ctop --tree --fold=/user.slice + +![Output of 'ctop --fold'](http://blog.linoxide.com/wp-content/uploads/2015/05/ctop-fold.png) + +*'ctop --fold'的输出* + +在ctop窗口中,使用+/-键来展开或折叠子cgroup。 + +注意:在写本文时,pip仓库中还没有最新版的ctop,还不支持命令行的‘--fold’选项 + +**--follow= - 跟踪/高亮 cgroup 路径** + +例子: ctop --follow=/user.slice/user-1000.slice + +正如你在下面屏幕中所见到的那样,带有“/user.slice/user-1000.slice”路径的cgroup被高亮显示,这让用户易于跟踪,就算显示位置变了也一样。 + +![Output of 'ctop --follow'](http://blog.linoxide.com/wp-content/uploads/2015/05/ctop-follow.png) + +*'ctop --follow'的输出* + +你也可以使用‘f’按钮来让高亮的行跟踪选定的容器。默认情况下,跟踪是关闭的。 + +**--refresh= - 按指定频率刷新显示,默认1秒** + +这对于按每用户需求来显示改变刷新率时很有用。使用‘p’按钮可以暂停刷新并选择文本。 + +**--columns= - 限定只显示选定的列。'name' 需要是第一个字段,其后跟着其它字段。默认情况下,字段包括:owner, processes,memory, cpu-sys, cpu-user, blkio, cpu-time** + +例子: ctop --columns=name,owner,type,memory + +![Output of 'ctop --column'](http://blog.linoxide.com/wp-content/uploads/2015/05/ctop-column.png) + +*'ctop --column'的输出* + +**-sort-col= - 按指定的列排序。默认使用 cpu-user 排序** + +例子: ctop --sort-col=blkio + +如果有Docker和LXC支持的额外容器,跟踪选项也是可用的: + + press 'a' - 接驳到终端输出 + + press 'e' - 打开容器中的一个 shell + + press 's' - 停止容器 (SIGTERM) + + press 'k' - 杀死容器 (SIGKILL) + +目前 Jean-Tiare Le Bigot 还在积极开发 [ctop][1] 中,希望我们能在该工具中见到像本地 top 命令一样的特性 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/monitor-linux-containers-performance/ + +作者:[B N Poornima][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/bnpoornima/ +[1]:https://github.com/yadutaf/ctop diff --git a/published/201505/20150511 OpenSSL command line Root and Intermediate CA including OCSP, CRL and revocation.md b/published/201505/20150511 OpenSSL command line Root and Intermediate CA including OCSP, CRL and revocation.md new file mode 100644 index 0000000000..9bd388f67c --- /dev/null +++ b/published/201505/20150511 OpenSSL command line Root and Intermediate CA including OCSP, CRL and revocation.md @@ -0,0 +1,406 @@ +建立你自己的 CA 服务:OpenSSL 命令行 CA 操作快速指南 +================================================================================ + +这些是关于使用 OpenSSL 生成证书授权(CA)、中间证书授权和末端证书的速记随笔,内容包括 OCSP、CRL 和 CA 颁发者信息,以及指定颁发和有效期限等。 + +我们将建立我们自己的根 CA,我们将使用根 CA 来生成一个中间 CA 的例子,我们将使用中间 CA 来签署末端用户证书。 + +### 根 CA ### + +创建根 CA 授权目录并切换到该目录: + + mkdir ~/SSLCA/root/ + cd ~/SSLCA/root/ + +为我们的根 CA 生成一个8192位长的 SHA-256 RSA 密钥: + + openssl genrsa -aes256 -out rootca.key 8192 + +样例输出: + + Generating RSA private key, 8192 bit long modulus + .........++ + ....................................................................................................................++ + e is 65537 (0x10001) + +如果你想要用密码保护该密钥,请添加 `-aes256` 选项。 + +创建自签名根 CA 证书 `ca.crt`;你需要为你的根 CA 提供一个身份: + + openssl req -sha256 -new -x509 -days 1826 -key rootca.key -out rootca.crt + +样例输出: + + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:NL + State or Province Name (full name) [Some-State]:Zuid Holland + Locality Name (eg, city) []:Rotterdam + Organization Name (eg, company) [Internet Widgits Pty Ltd]:Sparkling Network + Organizational Unit Name (eg, section) []:Sparkling CA + Common Name (e.g. server FQDN or YOUR name) []:Sparkling Root CA + Email Address []: + +创建一个存储 CA 序列的文件: + + touch certindex + echo 1000 > certserial + echo 1000 > crlnumber + +放置 CA 配置文件,该文件持有 CRL 和 OCSP 末端的存根。 + + # vim ca.conf + [ ca ] + default_ca = myca + + [ crl_ext ] + issuerAltName=issuer:copy + authorityKeyIdentifier=keyid:always + + [ myca ] + dir = ./ + new_certs_dir = $dir + unique_subject = no + certificate = $dir/rootca.crt + database = $dir/certindex + private_key = $dir/rootca.key + serial = $dir/certserial + default_days = 730 + default_md = sha1 + policy = myca_policy + x509_extensions = myca_extensions + crlnumber = $dir/crlnumber + default_crl_days = 730 + + [ myca_policy ] + commonName = supplied + stateOrProvinceName = supplied + countryName = optional + emailAddress = optional + organizationName = supplied + organizationalUnitName = optional + + [ myca_extensions ] + basicConstraints = critical,CA:TRUE + keyUsage = critical,any + subjectKeyIdentifier = hash + authorityKeyIdentifier = keyid:always,issuer + keyUsage = digitalSignature,keyEncipherment,cRLSign,keyCertSign + extendedKeyUsage = serverAuth + crlDistributionPoints = @crl_section + subjectAltName = @alt_names + authorityInfoAccess = @ocsp_section + + [ v3_ca ] + basicConstraints = critical,CA:TRUE,pathlen:0 + keyUsage = critical,any + subjectKeyIdentifier = hash + authorityKeyIdentifier = keyid:always,issuer + keyUsage = digitalSignature,keyEncipherment,cRLSign,keyCertSign + extendedKeyUsage = serverAuth + crlDistributionPoints = @crl_section + subjectAltName = @alt_names + authorityInfoAccess = @ocsp_section + + [alt_names] + DNS.0 = Sparkling Intermidiate CA 1 + DNS.1 = Sparkling CA Intermidiate 1 + + [crl_section] + URI.0 = http://pki.sparklingca.com/SparklingRoot.crl + URI.1 = http://pki.backup.com/SparklingRoot.crl + + [ocsp_section] + caIssuers;URI.0 = http://pki.sparklingca.com/SparklingRoot.crt + caIssuers;URI.1 = http://pki.backup.com/SparklingRoot.crt + OCSP;URI.0 = http://pki.sparklingca.com/ocsp/ + OCSP;URI.1 = http://pki.backup.com/ocsp/ + +如果你需要设置某个特定的证书生效/过期日期,请添加以下内容到`[myca]`: + + # format: YYYYMMDDHHMMSS + default_enddate = 20191222035911 + default_startdate = 20181222035911 + +### 创建中间 CA### + +生成中间 CA (名为 intermediate1)的私钥: + + openssl genrsa -out intermediate1.key 4096 + +生成中间 CA 的 CSR: + + openssl req -new -sha256 -key intermediate1.key -out intermediate1.csr + +样例输出: + + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:NL + State or Province Name (full name) [Some-State]:Zuid Holland + Locality Name (eg, city) []:Rotterdam + Organization Name (eg, company) [Internet Widgits Pty Ltd]:Sparkling Network + Organizational Unit Name (eg, section) []:Sparkling CA + Common Name (e.g. server FQDN or YOUR name) []:Sparkling Intermediate CA + Email Address []: + + Please enter the following 'extra' attributes + to be sent with your certificate request + A challenge password []: + An optional company name []: + +确保中间 CA 的主体(CN)和根 CA 不同。 + +用根 CA 签署 中间 CA 的 CSR: + + openssl ca -batch -config ca.conf -notext -in intermediate1.csr -out intermediate1.crt + +样例输出: + + Using configuration from ca.conf + Check that the request matches the signature + Signature ok + The Subject's Distinguished Name is as follows + countryName :PRINTABLE:'NL' + stateOrProvinceName :ASN.1 12:'Zuid Holland' + localityName :ASN.1 12:'Rotterdam' + organizationName :ASN.1 12:'Sparkling Network' + organizationalUnitName:ASN.1 12:'Sparkling CA' + commonName :ASN.1 12:'Sparkling Intermediate CA' + Certificate is to be certified until Mar 30 15:07:43 2017 GMT (730 days) + + Write out database with 1 new entries + Data Base Updated + +生成 CRL(同时采用 PEM 和 DER 格式): + + openssl ca -config ca.conf -gencrl -keyfile rootca.key -cert rootca.crt -out rootca.crl.pem + + openssl crl -inform PEM -in rootca.crl.pem -outform DER -out rootca.crl + +每次使用该 CA 签署证书后,请生成 CRL。 + +如果你需要撤销该中间证书: + + openssl ca -config ca.conf -revoke intermediate1.crt -keyfile rootca.key -cert rootca.crt + +### 配置中间 CA ### + +为该中间 CA 创建一个新文件夹,然后进入该文件夹: + + mkdir ~/SSLCA/intermediate1/ + cd ~/SSLCA/intermediate1/ + +从根 CA 拷贝中间证书和密钥: + + cp ~/SSLCA/root/intermediate1.key ./ + cp ~/SSLCA/root/intermediate1.crt ./ + +创建索引文件: + + touch certindex + echo 1000 > certserial + echo 1000 > crlnumber + +创建一个新的 `ca.conf` 文件: + + # vim ca.conf + [ ca ] + default_ca = myca + + [ crl_ext ] + issuerAltName=issuer:copy + authorityKeyIdentifier=keyid:always + + [ myca ] + dir = ./ + new_certs_dir = $dir + unique_subject = no + certificate = $dir/intermediate1.crt + database = $dir/certindex + private_key = $dir/intermediate1.key + serial = $dir/certserial + default_days = 365 + default_md = sha1 + policy = myca_policy + x509_extensions = myca_extensions + crlnumber = $dir/crlnumber + default_crl_days = 365 + + [ myca_policy ] + commonName = supplied + stateOrProvinceName = supplied + countryName = optional + emailAddress = optional + organizationName = supplied + organizationalUnitName = optional + + [ myca_extensions ] + basicConstraints = critical,CA:FALSE + keyUsage = critical,any + subjectKeyIdentifier = hash + authorityKeyIdentifier = keyid:always,issuer + keyUsage = digitalSignature,keyEncipherment + extendedKeyUsage = serverAuth + crlDistributionPoints = @crl_section + subjectAltName = @alt_names + authorityInfoAccess = @ocsp_section + + [alt_names] + DNS.0 = example.com + DNS.1 = example.org + + [crl_section] + URI.0 = http://pki.sparklingca.com/SparklingIntermidiate1.crl + URI.1 = http://pki.backup.com/SparklingIntermidiate1.crl + + [ocsp_section] + caIssuers;URI.0 = http://pki.sparklingca.com/SparklingIntermediate1.crt + caIssuers;URI.1 = http://pki.backup.com/SparklingIntermediate1.crt + OCSP;URI.0 = http://pki.sparklingca.com/ocsp/ + OCSP;URI.1 = http://pki.backup.com/ocsp/ + +修改 `[alt_names]` 部分,添加你需要的主体备选名。如果你不需要主体备选名,请移除该部分包括`subjectAltName = @alt_names`的行。 + +如果你需要设置一个指定的生效/到期日期,请添加以下内容到 `[myca]`: + + # format: YYYYMMDDHHMMSS + default_enddate = 20191222035911 + default_startdate = 20181222035911 + +生成一个空白 CRL(同时以 PEM 和 DER 格式): + + openssl ca -config ca.conf -gencrl -keyfile rootca.key -cert rootca.crt -out rootca.crl.pem + + openssl crl -inform PEM -in rootca.crl.pem -outform DER -out rootca.crl + +### 生成末端用户证书 ### + +我们使用这个新的中间 CA 来生成一个末端用户证书,请重复以下操作来使用该 CA 为每个用户签署。 + + mkdir enduser-certs + +生成末端用户的私钥: + + openssl genrsa -out enduser-certs/enduser-example.com.key 4096 + +生成末端用户的 CSR: + + openssl req -new -sha256 -key enduser-certs/enduser-example.com.key -out enduser-certs/enduser-example.com.csr + +样例输出: + + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [AU]:NL + State or Province Name (full name) [Some-State]:Noord Holland + Locality Name (eg, city) []:Amsterdam + Organization Name (eg, company) [Internet Widgits Pty Ltd]:Example Inc + Organizational Unit Name (eg, section) []:IT Dept + Common Name (e.g. server FQDN or YOUR name) []:example.com + Email Address []: + + Please enter the following 'extra' attributes + to be sent with your certificate request + A challenge password []: + An optional company name []: + +使用中间 CA 签署末端用户的 CSR: + + openssl ca -batch -config ca.conf -notext -in enduser-certs/enduser-example.com.csr -out enduser-certs/enduser-example.com.crt + +样例输出: + + Using configuration from ca.conf + Check that the request matches the signature + Signature ok + The Subject's Distinguished Name is as follows + countryName :PRINTABLE:'NL' + stateOrProvinceName :ASN.1 12:'Noord Holland' + localityName :ASN.1 12:'Amsterdam' + organizationName :ASN.1 12:'Example Inc' + organizationalUnitName:ASN.1 12:'IT Dept' + commonName :ASN.1 12:'example.com' + Certificate is to be certified until Mar 30 15:18:26 2016 GMT (365 days) + + Write out database with 1 new entries + Data Base Updated + +生成 CRL(同时以 PEM 和 DER 格式): + + openssl ca -config ca.conf -gencrl -keyfile intermediate1.key -cert intermediate1.crt -out intermediate1.crl.pem + + openssl crl -inform PEM -in intermediate1.crl.pem -outform DER -out intermediate1.crl + +每次你使用该 CA 签署证书后,都需要生成 CRL。 + +如果你需要撤销该末端用户证书: + + openssl ca -config ca.conf -revoke enduser-certs/enduser-example.com.crt -keyfile intermediate1.key -cert intermediate1.crt + +样例输出: + + Using configuration from ca.conf + Revoking Certificate 1000. + Data Base Updated + +通过连接根证书和中间证书来创建证书链文件。 + + cat ../root/rootca.crt intermediate1.crt > enduser-certs/enduser-example.com.chain + +发送以下文件给末端用户: + + enduser-example.com.crt + enduser-example.com.key + enduser-example.com.chain + +你也可以让末端用户提供他们自己的 CSR,而只发送给他们这个 .crt 文件。不要把它从服务器删除,否则你就不能撤销了。 + +### 校验证书 ### + +你可以对证书链使用以下命令来验证末端用户证书: + + openssl verify -CAfile enduser-certs/enduser-example.com.chain enduser-certs/enduser-example.com.crt + enduser-certs/enduser-example.com.crt: OK + +你也可以针对 CRL 来验证。首先,将 PEM 格式的 CRL 和证书链相连接: + + cat ../root/rootca.crt intermediate1.crt intermediate1.crl.pem > enduser-certs/enduser-example.com.crl.chain + +验证证书: + + openssl verify -crl_check -CAfile enduser-certs/enduser-example.com.crl.chain enduser-certs/enduser-example.com.crt + +没有撤销时的输出: + + enduser-certs/enduser-example.com.crt: OK + +撤销后的输出如下: + + enduser-certs/enduser-example.com.crt: CN = example.com, ST = Noord Holland, C = NL, O = Example Inc, OU = IT Dept + error 23 at 0 depth lookup:certificate revoked + +-------------------------------------------------------------------------------- + +via: https://raymii.org/s/tutorials/OpenSSL_command_line_Root_and_Intermediate_CA_including_OCSP_CRL%20and_revocation.html + +作者:Remy van Elst +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/201505/20150512 Guake 0.7.0 Released--A Drop-Down Terminal for Gnome Desktops.md b/published/201505/20150512 Guake 0.7.0 Released--A Drop-Down Terminal for Gnome Desktops.md new file mode 100644 index 0000000000..421bc00a0b --- /dev/null +++ b/published/201505/20150512 Guake 0.7.0 Released--A Drop-Down Terminal for Gnome Desktops.md @@ -0,0 +1,121 @@ +一个用于Gnome桌面的下拉式终端: Guake 0.7.0 发布 +================================================================================ +Linux的命令行是最好、最强大的东西,它使新手着迷,并为老手和极客的提供极其强大的功能。那些在服务器和生产环境下工作的人早已认识到了这个事实。有趣的是,Linux终端是Linus Torvald在1991年写内核时实现的第一批功能之一。 + +终端是个强大的工具,由于它没有什么可调整的部分,所以十分可靠。终端介于控制台环境和GUI环境之间。终端自身作为一个GUI程序,运行在桌面环境下。有许多终端是适用于特定的桌面环境的,其它的则是通用的。Terminator, Konsole, Gnome-Terminal, Terminology, XFCE terminal, xterm都是些常用的终端模拟器。 + +您可以从下面的链接中获得一份使用最广泛的终端模拟器的列表。 + +- [20 Useful Terminals for Linux][1] + +前几日上网时,我偶遇了名为‘Guake’的终端程序,它是用于gnome的终端模拟器。尽管这并不是我第一次听到Guake。实际上,我在大约一年前便知道了这个应用程序,但不知怎么搞的,我那时没有写写Guake,再后来我便渐渐忘掉了Guake,直到我再一次听到Guake。所以,最终,这篇文章诞生了。我将给你讲讲Guake的功能,在Debian、Ubuntu、Fedora上的安装过程以及一些测试。 + +#### 什么是Guake? #### + +Guake是应用于Gnome环境的下拉式终端。主要由Python编写,使用了一些C,它以GPL2+许可证发布,适用于Linux以及类似的系统。Guake的灵感来源于电脑游戏Quake(雷神之锤)中的终端,Quake的终端能通过按下特定按键(默认为F12)从屏幕上滑下来,并在按下同样的键后滑上去。 + +值得注意的是,Guake并不是第一个这样的应用。Yakuake(Yet Another Kuake)是一个运行于KDE的终端模拟器,Tilda是一个用GTK+写成的终端模拟器。它们的灵感都来自于雷神之锤那上下滑动的终端。 + +#### Guake的功能 #### + +- 轻量级 +- 简单而优雅 +- 功能众多 +- 强大 +- 美观 +- 将终端平滑地集成于GUI中 +- 在按下预定义的键后出现/消失 +- 支持热键、标签、透明化背景,这使得它适合所有Gnome用户 +- 可配置各种方面 +- 包括许多颜色的调色板 +- 设定透明度的快捷方式 +- 通过Guake配置,可在启动时运行一个脚本 +- 可以在多个显示器上运行 + +Guake 0.7.0最近发布,它带来了一些修正以及上面提到的一些功能。完整的版本历史和源代码包可以在[这里][2]找到。 + +### 在Linux中安装Guake终端 ### + +如果您对从源码编译Guake感兴趣,您可以从上面的链接处下载Guake,并在安装前进行编译。 + +然而Guake可以在许多的发行版中通过添加额外的仓库来安装。这里,我们将在Debian、Ubuntu、Linux Mint和Fedora下安装Guake。 + +首先从仓库获取最新的软件包列表,并从默认的仓库安装Guake,如下所示: + + ---------------- 在 Debian, Ubuntu 和 Linux Mint 上 ---------------- + $ sudo apt-get update + $ apt-get install guake + +---------- + + ---------------- 在 Fedora 19 及其以后版本 ---------------- + # yum update + # yum install guake + +安装后,可以从另一个终端中启动Guake: + + $ guake + +在启动它后,便可以在Gnome桌面中使用F12(默认配置)来拉下、收回终端。 + +看起来非常漂亮,尤其是透明背景。滑下来...滑上去...滑下来...滑上去...执行命令,打开另一个标签,执行命令,滑上去...滑下来...(作者已沉迷其中) + +![Guake Terminal in Action](http://www.tecmint.com/wp-content/uploads/2015/05/Guake.png) + +*Guake实战* + +如果您的壁纸或活动窗口的颜色和Guake的颜色有些不搭。您可以改变您的壁纸,减少透明度或者改变Guake的颜色。 + +下一步便是进入Guake的配置,根据每个人的需求修改设置。可以通过应用菜单或者下面的命令来运行Guake的配置。 + + $ guake --preferences + +![Guake Terminal Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Properties.png) + +*Guake终端配置* + +设置滚动 + +![Guake Scrolling Settings](http://www.tecmint.com/wp-content/uploads/2015/05/Guake-Scrolling.png) + +*Guake滚动配置* + +外观设置 - 在这里您可以修改文字颜色和背景色以及透明度。 + +![Appearance Properties](http://www.tecmint.com/wp-content/uploads/2015/05/Appearance-Properties.png) + +*外观设置* + +键盘快捷键 - 在这里您可以修改Guake显示的开关快捷键。 + +![Keyboard Shortcuts](http://www.tecmint.com/wp-content/uploads/2015/05/Keyboard-Shortcuts.png) + +*键盘快捷键* + +兼容性设置 - 基本上不必设置它。 + +![Compatibility Setting](http://www.tecmint.com/wp-content/uploads/2015/05/Compatibility-Setting.png) + +*兼容性设置* + +### 结论 ### + +这个项目即不是太年轻也不是太古老,因此它已经达到了一定的成熟度,足够可靠,可以开箱即用。像我这样需要在GUI和终端间频繁切换的人来说,Guake是一个福利。我不需要管理一个多余的窗口,频繁的打开和关闭,使用tab在大量打开的应用程序中寻找终端或切换到不同的工作区来管理终端,现在我需要的只有F12。 + +我认为对任何同时使用GUI和终端的Linux用户来说,Guake都是必须的工具。同样的,我会向任何想要在系统中结合使用GUI和终端的人推荐它,因为它既平滑又没有任何障碍。 + +上面就是我要说的全部了。如果在安装和使用时有任何问题,请告诉我,我们会帮助您。也请您告诉我您使用Guake的经验。在下面的评论区反馈您宝贵的经验。点赞和分享以帮助我们宣传。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-guake-terminal-ubuntu-mint-fedora/ + +作者:[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/linux-terminal-emulators/ +[2]:https://github.com/Guake/guake/releases/tag/0.7.0 diff --git a/published/201505/20150515 New to Linux 5 Apps You Didn't Know You Were Missing.md b/published/201505/20150515 New to Linux 5 Apps You Didn't Know You Were Missing.md new file mode 100644 index 0000000000..1d34cda0f4 --- /dev/null +++ b/published/201505/20150515 New to Linux 5 Apps You Didn't Know You Were Missing.md @@ -0,0 +1,105 @@ +初来乍到Linux? 你需要知道的5款好应用 +================================================================================ +![](http://cdn.makeuseof.com/wp-content/uploads/2015/05/linux-apps-840x420.jpg?92a7a3) + +当你刚刚迈入linux的世界时,你会立马动身开始使用那些知名的浏览器、云客户端、音乐播放器、邮件客户端,也许还有图形编辑器,对吗?可是,你却错过了几个非常重要的生产工具。这里将介绍给你5个应该安装的不容错过的应用。 + +### [Synergy][1] ### + +Synergy 简直就是多桌面用户的福音。这是一个开源软件,它可以让你用一个鼠标和键盘跨越几台电脑、显示器和操作系统。在桌面之间切换鼠标和键盘非常简单,你只要把鼠标从一个桌面的边缘移向另一个桌面即可。 + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/multiple-monitors-640x431.jpg?92a7a3) + +当你第一次打开 Synergy,它会引导你完成设置。你的主桌面就是你将与其它桌面共享输入设备的那个。将主桌面设为服务端,将其它桌面设置为客户端。 + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/synergy-setup-wizard-640x480.jpg?92a7a3) + +Synergy 在互连的各个桌面间维持同一张粘贴板。它也将锁屏功能融合到了一起,例如,你可以跳过锁屏一次登录到所有桌面。你可以在 **Edit 菜单的 Setting** 下调整更多的设置,比如设置密码或者将 Synergy 设置成开机自启动。 + +(LCTT 译注:这是个[自由而开源][15]的好软件,但是如果你从它的网站下载,由于商业支持的缘故,是需要付费的;当然你可以自己[下载源代码并编译][15]。) + +### [BasKet Note Pads][2] ### + +从某种意义上来讲,用 BasKet Note Pads,就像把你的大脑刻画进计算机里一样。它把我们不经意间的想法记录下来,然后任由我们去把它们组织起来。你可以在各种任务中用到 BasKet Note Pads,比如记录笔记、制作脑图、记录代办事项、保存链接、管理你的发现、或者追踪项目数据。 + +在 BasKet Note Pads 中,每个放到一个区域的主要的想法或项目被称作一个篮子(basket)。你可以进一步拆分,成一个或多个子篮或者兄弟篮。篮子进一步分成笔记,这些零零碎碎的笔记组成了一个项目。你可以自由组织它们,给它们打标签,和筛选它们。 + +该应用的双面板结构的左侧以树形结构显示了你创建的所有篮子。 + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/basket-note-pads-640x480.jpg?92a7a3) + +BasKet Note Pads 第一次用起来可能有点复杂,但是如果你经常用它的话,你会觉得相当顺手。当你暂时不用它时,它会退出到系统托盘,方便你下次快速打开它。 + +如果在 Linux 上想要一个[更简单的笔记本替代品][3]?可以试试[Springseed][4]。 + +### [Caffeine(咖啡因)][5]### + +你怎样确保你的电脑不会在放一部[精彩的电影][6]中途突然休眠呢?Caffeine 会帮助你解决这个问题。当然,你并不需要为你的电脑泡一杯咖啡。你只需要安装一个轻量级的指示器 —— Caffeine。只要当前你是全屏模式,它就会禁用你的屏幕保护程序、锁屏程序,让你的电脑不会因为没有在任务中而进入睡眠模式。 + +[点击下载][7]安装最新版本的 Caffeine。如果你想以[PPA的方式][8]安装,使用如下命令: + + $ sudo add-apt-repository ppa:caffeine-developers/ppa + $ sudo apt-get update + $ sudo apt-get install caffeine + +如果你的Ubuntu版本是14.10或者15.04(或者其它衍生版本),你还需要安装下面的依赖包: + + $ sudo apt-get install libappindicator3-1 gir1.2-appindicator3-0.1 + +完成安装以后,将**Caffeine指示器**设置成开机自启动,这样可以使指示器显示在系统托盘里。你可以右键点击托盘图标打开应用的关联菜单,来开启或关闭Caffeine, + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/caffeine-indicator-640x480.jpg?92a7a3) + +### Easystroke ### + +Easystroke 是一个将[鼠标潜力][9]开发出来的应用。通过一系列的设置,用鼠标、触摸屏、手写笔的手势来完成敲击键盘、执行命令和滚动屏幕等通用操作。在 Easystroke 里能够设置的手势相当多,而且当你看到应用的界面时,你会发现应用的引导非常清晰。 + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/easystroke-record-640x480.jpg?92a7a3) + +选择一个你喜欢的鼠标键开始设置手势。如果你喜欢,你还可以设置辅助功能键。通过Perferences>Behavior>Gesture Button 来设置。现在到**Action**选项卡里面,把你最常用的动作记录成手势吧。 + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/easytroke-actions-640x480.jpg?92a7a3) + +在 Preferences 和 Advanced 选项卡中,你可以做一些其它的调整,比如将 EasyStroke 设置成自动启动,在系统托盘中显示图标,改变滚动速度。 + +### Guake ### + +我把我最喜欢的应用放在最后。Guake 是根据第一人称射击视屏游戏 [Quake][10] 模仿而来的下拉式命令行终端。不管你是否在[学习命令行终端][11],或者是有一定的基础,Guake 都可以将终端变得更加方便。你可以一键将它呼出,也可以一键将它隐藏。 + +就像下面这张图,当打开时,Guake 的界面会覆盖在当前的屏幕上。你可以在终端中右键点击,调出 Preference 来改变 Guake 的界面,滚动方式,快捷键等等。 + +![](http://cdn.makeuseof.com/wp-content/uploads/2015/04/guake-terminal-640x480.jpg?92a7a3) + +如果[你的桌面][12]是 KDE,你可以选择一个类似的工具——[Yakuake][13]. + +### 写下你最喜欢的Linux新发现!### + +还有更多[超级实用的 Linux 应用][14]等待被发现。放心,我们将一直关注,并把它们带到你们的生活中。 + +哪一个应用是你最喜欢研究的呢?哪一个是你觉得必不可少的呢?在评论里告诉给我们吧。 + +-------------------------------------------------------------------------------- + +via: http://www.makeuseof.com/tag/new-linux-5-apps-didnt-know-missing/ + +作者:[Akshata][a] +译者:[sevenot](https://github.com/sevenot) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.makeuseof.com/tag/author/akshata/ +[1]:http://synergy-project.org/ +[2]:http://basket.kde.org/ +[3]:http://www.makeuseof.com/tag/try-these-3-beautiful-note-taking-apps-that-work-offline/ +[4]:http://getspringseed.com/ +[5]:https://launchpad.net/caffeine +[6]:http://www.makeuseof.com/tag/popular-apps-movies-according-google/ +[7]:http://ppa.launchpad.net/caffeine-developers/ppa/ubuntu/pool/main/c/caffeine/ +[8]:http://www.makeuseof.com/tag/ubuntu-ppa-technology-explained/ +[9]:http://www.makeuseof.com/tag/4-astounding-linux-mouse-hacks/ +[10]:http://en.wikipedia.org/wiki/Quake_%28video_game%29 +[11]:http://www.makeuseof.com/tag/4-ways-teach-terminal-commands-linux-si/ +[12]:http://www.makeuseof.com/tag/10-top-linux-desktop-environments-available/ +[13]:https://yakuake.kde.org/ +[14]:http://www.makeuseof.com/tag/linux-treasures-x-sublime-native-linux-apps-will-make-want-switch/ diff --git a/published/201505/20150518 Linux FAQs with Answers--How to block specific user agents on nginx web server.md b/published/201505/20150518 Linux FAQs with Answers--How to block specific user agents on nginx web server.md new file mode 100644 index 0000000000..16bc2060fb --- /dev/null +++ b/published/201505/20150518 Linux FAQs with Answers--How to block specific user agents on nginx web server.md @@ -0,0 +1,115 @@ +Linux有问必答:nginx网络服务器上如何阻止特定用户代理(UA) +================================================================================ +> **问题**: 我注意到有一些机器人经常访问我的nginx驱动的网站,并且进行一些攻击性的扫描,导致消耗掉了我的网络服务器的大量资源。我一直尝试着通过用户代理符串来阻挡这些机器人。我怎样才能在nginx网络服务器上阻挡掉特定的用户代理呢? + +现代互联网滋生了大量各种各样的恶意机器人和网络爬虫,比如像恶意软件机器人、垃圾邮件程序或内容刮刀,这些恶意工具一直偷偷摸摸地扫描你的网站,干些诸如检测潜在网站漏洞、收获电子邮件地址,或者只是从你的网站偷取内容。大多数机器人能够通过它们的“用户代理”签名字符串来识别。 + +作为第一道防线,你可以尝试通过将这些机器人的用户代理字符串添加入robots.txt文件来阻止这些恶意软件机器人访问你的网站。但是,很不幸的是,该操作只针对那些“行为良好”的机器人,这些机器人被设计遵循robots.txt的规范。许多恶意软件机器人可以很容易地忽略掉robots.txt,然后随意扫描你的网站。 + +另一个用以阻挡特定机器人的途径,就是配置你的网络服务器,通过特定的用户代理字符串拒绝要求提供内容的请求。本文就是说明如何**在nginx网络服务器上阻挡特定的用户代理**。 + +### 在Nginx中将特定用户代理列入黑名单 ### + +要配置用户代理阻挡列表,请打开你的网站的nginx配置文件,找到`server`定义部分。该文件可能会放在不同的地方,这取决于你的nginx配置或Linux版本(如,`/etc/nginx/nginx.conf`,`/etc/nginx/sites-enabled/`,`/usr/local/nginx/conf/nginx.conf`,`/etc/nginx/conf.d/`)。 + + server { + listen 80 default_server; + server_name xmodulo.com; + root /usr/share/nginx/html; + + .... + } + +在打开该配置文件并找到 `server` 部分后,添加以下 if 声明到该部分内的某个地方。 + + server { + listen 80 default_server; + server_name xmodulo.com; + root /usr/share/nginx/html; + + # 大小写敏感的匹配 + if ($http_user_agent ~ (Antivirx|Arian) { + return 403; + } + + #大小写无关的匹配 + if ($http_user_agent ~* (netcrawl|npbot|malicious)) { + return 403; + } + + .... + } + +如你所想,这些 if 声明使用正则表达式匹配了任意不良用户字符串,并向匹配的对象返回403 HTTP状态码。 +`$http_user_agent`是HTTP请求中的一个包含有用户代理字符串的变量。‘~’操作符针对用户代理字符串进行大小写敏感匹配,而‘~*’操作符则进行大小写无关匹配。‘|’操作符是逻辑或,因此,你可以在 if 声明中放入众多的用户代理关键字,然后将它们全部阻挡掉。 + +在修改配置文件后,你必须重新加载nginx以激活阻挡: + + $ sudo /path/to/nginx -s reload + +你可以通过使用带有 “--user-agent” 选项的 wget 测试用户代理阻挡。 + + $ wget --user-agent "malicious bot" http:// + +![](https://farm6.staticflickr.com/5333/17434036358_ef139a6b59_b.jpg) + +### 管理Nginx中的用户代理黑名单 ### + +目前为止,我已经展示了在nginx中如何阻挡一些用户代理的HTTP请求。如果你有许多不同类型的网络爬虫机器人要阻挡,又该怎么办呢? + +由于用户代理黑名单会增长得很大,所以将它们放在nginx的server部分不是个好点子。取而代之的是,你可以创建一个独立的文件,在该文件中列出所有被阻挡的用户代理。例如,让我们创建/etc/nginx/useragent.rules,并定义以下面的格式定义所有被阻挡的用户代理的图谱。 + + $ sudo vi /etc/nginx/useragent.rules + +---------- + + map $http_user_agent $badagent { + default 0; + ~*malicious 1; + ~*backdoor 1; + ~*netcrawler 1; + ~Antivirx 1; + ~Arian 1; + ~webbandit 1; + } + +与先前的配置类似,‘~*’将匹配以大小写不敏感的方式匹配关键字,而‘~’将使用大小写敏感的正则表达式匹配关键字。“default 0”行所表达的意思是,任何其它文件中未被列出的用户代理将被允许。 + +接下来,打开你的网站的nginx配置文件,找到里面包含 http 的部分,然后添加以下行到 http 部分某个位置。 + + http { + ..... + include /etc/nginx/useragent.rules + } + +注意,该 include 声明必须出现在 server 部分之前(这就是为什么我们将它添加到了 http 部分里)。 + +现在,打开nginx配置定义你的服务器的部分,添加以下 if 声明: + + server { + .... + + if ($badagent) { + return 403; + } + + .... + } + +最后,重新加载nginx。 + + $ sudo /path/to/nginx -s reload + +现在,任何包含有`/etc/nginx/useragent.rules`中列出的关键字的用户代理将被nginx自动禁止。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/block-specific-user-agents-nginx-web-server.html + +作者:[Dan Nanni][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/201505/20150518 Linux FAQs with Answers--How to fix 'fatal error--security or pam_modules.h--No such file or directory'.md b/published/201505/20150518 Linux FAQs with Answers--How to fix 'fatal error--security or pam_modules.h--No such file or directory'.md new file mode 100644 index 0000000000..6ede2366a8 --- /dev/null +++ b/published/201505/20150518 Linux FAQs with Answers--How to fix 'fatal error--security or pam_modules.h--No such file or directory'.md @@ -0,0 +1,33 @@ +如何修复 “fatal error: security/pam_modules.h: No such file or directory” +================================================================================ +> **问题**: 我尝试在 [某某 Linux 发行版] 上编译程序,但是出现下面的编译错误: +> +> "pam_otpw.c:27:34: fatal error: security/pam_modules.h: No such file or directory" +> +> 我怎样才能修复这个错误? + +缺失的头文件 'security/pam_modules.h' 是 libpam 开发版的一部分,一个 PAM(Pluggable Authentication Modules:插入式验证模块)库。因此要修复这个错误,你需要安装 libpam 开发包,如下所示。 + +对于 Debian、 Ubuntu 或者 Linux Mint: + + $ sudo apt-get install libpam0g-dev + +对与 CentOS、 Fedora 或者 RHEL: + + $ sudo yum install gcc pam-devel + +现在验证缺失的头文件是否安装到了 /usr/include/security。 + +![](https://farm8.staticflickr.com/7751/16819069693_fa961f0d40_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/fatal-error-security-pam-modules.html + +作者:[Dan Nanni][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni \ No newline at end of file diff --git a/published/201505/20150521 Microsoft Open-Sources The Windows Communication Foundation.md b/published/201505/20150521 Microsoft Open-Sources The Windows Communication Foundation.md new file mode 100644 index 0000000000..bf071f9c5d --- /dev/null +++ b/published/201505/20150521 Microsoft Open-Sources The Windows Communication Foundation.md @@ -0,0 +1,26 @@ +微软开源了WCF框架 +================================================================================ +微软于今日(2015/5/20)宣布了针对 .NET Core 重大开源:WCF(Windows Communication Foundation)。 + +如[MSDN][1]中的描述:“WCF是一个构建面向服务应用的框架。使用WCF,你可以从一个服务终端给另一个发送异步消息。服务终端可以是托管在IIS中连续可用的服务的一部分,也可以是托管在某个程序上的服务。服务终端可以是请求服务端数据的客户端。消息可以是一个字符或者XML,也可以是复杂的二进制流。” + +它的[代码放在GitHub][2],“包含了Window桌面中完整WCF框架的一部分,它支持已经可用于构建Window Store上的WCF应用的库。这些主要是基于客户端,方便移动设备和中间层服务器使用WCF进行通信。” + +更多的关于微软开源 WCF 的细节查看[dotNETFoundation.org blog][3]的公告。 + +WCF听上去有点像Linux中用于进程/服务之间的进程间通讯的D-BUS。 + +-------------------------------------------------------------------------------- + +via: http://www.phoronix.com/scan.php?page=news_item&px=Microsoft-Open-Source-WCF + +作者:[Michael Larabel][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.michaellarabel.com/ +[1]:https://msdn.microsoft.com/en-us/library/ms731082%28v=vs.110%29.aspx +[2]:https://github.com/dotnet/wcf +[3]:http://www.dotnetfoundation.org/blog/wcf-is-open-source \ No newline at end of file diff --git a/published/201505/20150527 Ubuntu Community Council Asks the Kubuntu Project Leader to Step Down.md b/published/201505/20150527 Ubuntu Community Council Asks the Kubuntu Project Leader to Step Down.md new file mode 100644 index 0000000000..a47014fc9b --- /dev/null +++ b/published/201505/20150527 Ubuntu Community Council Asks the Kubuntu Project Leader to Step Down.md @@ -0,0 +1,33 @@ +Ubuntu 社区委员会要求 Kubuntu 项目领导人下台 +================================================================================ +> 而Jonathan Riddell拒绝从Kubuntu领导人位置退出 + +![](http://i1-news.softpedia-static.com/images/news2/Ubuntu-Community-Council-Asks-the-Kubuntu-Project-Leader-to-Step-Down-482384-2.jpg) + +**这一切刚刚发生。一名Debian开发者以及Kubuntu委员会成员 Scott Kitterman 决定公开一些电子邮件,邮件披露了Ubuntu 社区委员会成员要求 Jonathan Riddell 从 Kubuntu 项目领导人位置退出的过程。** + +Jonathan Riddell 是 KDE 以及 Kubuntu 的一名开发者,多年来也是 Ubuntu 社区的一名重要成员。从 Scott Kitterman [今天曝光的社区邮件往来][1]中来看,Jonathan Riddell 被指责对 Ubuntu 以及 Kubuntu 社区的一些成员咄咄逼人和挑衅。 + +长话短说,经过多轮邮件往来之后,Ubuntu 社区委员会的最终决定是让 Jonathan Riddell 退出他在 Ubuntu 以及Kubuntu 社区的领导人位置至少12个月,但仍可以像其他成员一样参与讨论。这个决定同时也得到了 Canonical 和Ubuntu 的创始人 Mark Shuttleworth 的支持。 + +“很遗憾写下了讨论这个我们觉得对 Ubuntu 社区有着消极影响的问题的邮件。长期以来,Jonathan Riddell 变得越来越难以交往。Jonathan 提出了有效的问题及关注,但当收到他不赞同的答案时,他的反应就不那么让人愉快了。”在 Ubuntu 社区委员会发出的第一封认为 Jonathan Riddell 行为“不友好”的邮件中这么写道。 + +### Jonathan Riddell拒绝从Kubuntu领导人位置退出 ### + +从今天 Scott Kitterman 披露邮件往来,并决定在博客上写第二篇博文来看,表明了他想从他在 Ubuntu 和 Kubuntu 的位置退出,这表明 Jonathan Riddell 可能拒绝从 Kubuntu 领导人位置退出。 + +正如预料之中,Kubuntu 社区委员会的成员们支持 Jonathan Riddell,并且回击了 Ubuntu 社区委员会罢免 Kubuntu 项目领导人的决定。“我要感谢所有在 Kubuntu 委员会投票再次肯定我的 Kubuntu 成员。”,Jonathan Riddell 在[他的博客][2]上写道,“希望 Kubuntu 能够继续走下去,我也计划和我深爱的社区伙伴们一起为 15.10 发布而努力。” + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/Ubuntu-Community-Council-Asks-the-Kubuntu-Project-Leader-to-Step-Down-482384.shtml + +作者:[Marius Nestor][a] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor +[1]:https://skitterman.wordpress.com/ +[2]:http://jriddell.org/ diff --git a/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--4.md b/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--4.md new file mode 100644 index 0000000000..b6d7ae7f10 --- /dev/null +++ b/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--4.md @@ -0,0 +1,190 @@ +安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(四) +================================================================================ +### 17. 安装 Webmin ### + +Webmin 是基于 Web 的 Linux 配置工具。它像一个中央系统,用于配置各种系统设置,比如用户、磁盘分配、服务以及 HTTP 服务器、Apache、MySQL 等的配置。 + + # wget http://prdownloads.sourceforge.net/webadmin/webmin-1.740-1.noarch.rpm + # rpm -ivh webmin-*.rpm + +![在 CentOS 7 上安装 Webmin](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Webmin.jpeg) + +*安装 Webmin* + +安装完 webmin 后,你会在终端上得到一个消息,提示你用 root 密码在端口 10000 登录你的主机 (http://ip-address:10000)。 如果运行的是无接口的服务器你可以转发端口然后从有接口的服务器上访问它。(LCTT 译注:无接口[headless]服务器指没有访问接口或界面的服务器,在此次场景,指的是是出于内网的服务器,可采用外网/路由器映射来访问该端口) + +### 18. 启用第三方库 ### + +添加不受信任的库并不是一个好主意,尤其是在生产环境中,这可能导致致命的问题。但仅作为例子在这里我们会添加一些社区证实可信任的库,以安装第三方工具和软件包。 + +为企业版 Linux(EPEL)库添加额外的软件包。 + + # yum install epel-release + +添加社区企业版 Linux (Community Enterprise Linux)库: + + # rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm + +![安装 Epel 库](http://www.tecmint.com/wp-content/uploads/2015/04/install-epel-repo.jpeg) + +*安装 Epel 库* + +**注意!** 添加第三方库的时候尤其需要注意。 + +### 19. 安装 7-zip 工具 ### + +在最小化安装 CentOS 时你并没有获得类似 unzip 或者 untar 的工具。我们可以选择根据需要来安装每个工具,或一个能处理所有格式的工具。7-zip 就是一个能压缩和解压所有已知类型文件的工具。 + + # yum install p7zip + +![安装 7zip 工具](http://www.tecmint.com/wp-content/uploads/2015/04/Install-7zip-tool.jpeg) + +*安装 7zip 工具* + +**注意**: 该软件包从 Fedora EPEL 7 的库中下载和安装。 + +### 20. 安装 NTFS-3G 驱动 ### + +NTFS-3G,一个很小但非常有用的 NTFS 驱动,在大部分类 UNIX 发行版上都可用。它对于挂载和访问 Windows NTFS 文件系统很有用。尽管也有其它可用的替代品,比如 Tuxera,但 NTFS-3G 是使用最广泛的。 + + # yum install ntfs-3g + +![在 CentOS 上安装 NTFS-3G](http://www.tecmint.com/wp-content/uploads/2015/04/Install-NTFS-3G.jpeg) + +*安装 NTFS-3G 用于挂载 Windows 分区* + +ntfs-3g 安装完成之后,你可以使用以下命令挂载 Windows NTFS 分区(我的 Windows 分区是 /dev/sda5)。 + + # mount -ro ntfs-3g /dev/sda5 /mnt + # cd /mnt + # ls -l + +### 21. 安装 Vsftpd FTP 服务器 ### + +VSFTPD 表示 Very Secure File Transfer Protocol Daemon,是用于类 UNIX 系统的 FTP 服务器。它是现今最高效和安全的 FTP 服务器之一。 + + # yum install vsftpd + +![在 CentOS 7 上安装 Vsftpd](http://www.tecmint.com/wp-content/uploads/2015/04/Install-FTP.jpeg) + +*安装 Vsftpd FTP* + +编辑配置文件 ‘/etc/vsftpd/vsftpd.conf’ 用于保护 vsftpd。 + + # vi /etc/vsftpd/vsftpd.conf + +编辑一些值并使其它行保留原样,除非你知道自己在做什么。 + + anonymous_enable=NO + local_enable=YES + write_enable=YES + chroot_local_user=YES + +你也可以更改端口号,记得让 vsftpd 端口通过防火墙。 + + # firewall-cmd --add-port=21/tcp + # firewall-cmd --reload + +下一步重启 vsftpd 并启用开机自动启动。 + + # systemctl restart vsftpd + # systemctl enable vsftpd + +### 22. 安装和配置 sudo ### + +sudo 通常被称为 super do 或者 suitable user do,是一个类 UNIX 操作系统中用其它用户的安全权限执行程序的软件。让我们来看看怎样配置 sudo。 + + # visudo + +这会打开 /etc/sudoers 并进行编辑 + +![sudoers 文件](http://www.tecmint.com/wp-content/uploads/2015/04/sudoers-File.jpeg) + +*sudoers 文件* + +1. 给一个已经创建好的用户(比如 tecmint)赋予所有权限(等同于 root)。 + + tecmint ALL=(ALL) ALL + +2. 如果给一个已经创建好的用户(比如 tecmint)赋予除了重启和关闭服务器以外的所有权限(等同于 root)。 + + 首先,再一次打开文件并编辑如下内容: + + cmnd_Alias nopermit = /sbin/shutdown, /sbin/reboot + + 然后,用逻辑操作符(!)添加该别名。 + + tecmint ALL=(ALL) ALL,!nopermit + +3. 如果准许一个组(比如 debian)运行一些 root 权限命令,比如(增加或删除用户)。 + + cmnd_Alias permit = /usr/sbin/useradd, /usr/sbin/userdel + + 然后,给组 debian 增加权限。 + + debian ALL=(ALL) permit + +### 23. 安装并启用 SELinux ### + +SELinux 表示 Security-Enhanced Linux,是内核级别的安全模块。 + + # yum install selinux-policy + +![在 CentOS 7 上安装 SElinux](http://www.tecmint.com/wp-content/uploads/2015/04/Install-SElinux.jpeg) + +*安装 SElinux 策略* + +查看 SELinux 当前模式。 + + # getenforce + +![查看 SELinux 模式](http://www.tecmint.com/wp-content/uploads/2015/04/Check-SELinux-Mode.jpeg) + +*查看 SELinux 模式* + +输出是 Enforcing,意味着 SELinux 策略已经生效。 + +如果需要调试,可以临时设置 selinux 模式为允许。不需要重启。 + + # setenforce 0 + +调试完了之后再次设置 selinux 为强制模式,无需重启。 + + # setenforce 1 + +(LCTT 译注:在生产环境中,SELinux 固然会提升安全,但是也确实会给应用部署和运行带来不少麻烦。具体是否部署,需要根据情况而定。) + +### 24. 安装 Rootkit Hunter ### + +Rootkit Hunter,简写为 RKhunter,是在 Linux 系统中扫描 rootkits 和其它可能有害攻击的程序。 + + # yum install rkhunter + +![安装 Rootkit Hunter](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Rootkit-Hunter.jpeg) + +*安装 Rootkit Hunter* + +在 Linux 中,从脚本文件以计划作业的形式运行 rkhunter 或者手动扫描有害攻击。 + + # rkhunter --check + +![扫描 rootkits](http://www.tecmint.com/wp-content/uploads/2015/04/Scan-for-rootkits.png) + +*扫描 rootkits* + +![RootKit 扫描结果](http://www.tecmint.com/wp-content/uploads/2015/04/RootKit-Results.png) + +*RootKit 扫描结果* + + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/4/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ \ No newline at end of file diff --git a/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--5.md b/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--5.md new file mode 100644 index 0000000000..446d6c663d --- /dev/null +++ b/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--5.md @@ -0,0 +1,140 @@ +安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(五) +================================================================================ +### 25. 安装 Linux Malware Detect (LMD) ### + +Linux Malware Detect (LMD) 是 GNU GPLv2 协议下发布的开源 Linux 恶意程序扫描器,它是特别为面临威胁的主机环境所设计的。LMD 完整的安装、配置以及使用方法可以查看: + +- [安装 LMD 并和 ClamAV 一起使用作为反病毒引擎][1] + +### 26. 用 Speedtest-cli 测试服务器带宽 ### + +speedtest-cli 是用 python 写的用于测试网络下载和上传带宽的工具。关于 speedtest-cli 工具的完整安装和使用请阅读我们的文章[用命令行查看 Linux 服务器带宽][2] + +### 27. 配置 Cron 任务 ### + +这是最广泛使用的软件工具之一。它是一个任务调度器,比如,现在安排一个以后可以自动运行的作业。它用于未处理记录的日志和维护,以及其它日常工作,比如常规备份。所有的调度都写在文件 /etc/crontab 中。 + +crontab 文件包含下面的 6 个域: + + 分 时 日期 月份 星期 命令 + (0-59) (0-23) (1-31) (1/jan-12/dec) (0-6/sun-sat) Command/script + +![Crontab 域](http://www.tecmint.com/wp-content/uploads/2015/04/Crontab-Fields.jpeg) + +*Crontab 域* + +要在每天 04:30 运行一个 cron 任务(比如运行 /home/$USER/script.sh)。 + + 分 时 日期 月份 星期 命令 + 30 4 * * * speedtest-cli + +就把下面的条目增加到 crontab 文件 ‘/etc/crontab/’。 + + 30 4 * * * /home/$user/script.sh + +把上面一行增加到 crontab 之后,它会在每天的 04:30 am 自动运行,输出取决于脚本文件的内容。另外脚本也可以用命令代替。关于更多 cron 任务的例子,可以阅读[Linux 上的 11 个 Cron 任务例子][3] + +### 28. 安装 Owncloud ### + +Owncloud 是一个基于 HTTP 的数据同步、文件共享和远程文件存储应用。更多关于安装 owncloud 的内容,你可以阅读这篇文章:[在 Linux 上创建个人/私有云存储][4] + +### 29. 启用 Virtualbox 虚拟化 ### + +虚拟化是创建虚拟操作系统、硬件和网络的过程,是当今最热门的技术之一。我们会详细地讨论如何安装和配置虚拟化。 + +我们的最小化 CentOS 服务器是一个无用户界面服务器(LCTT 译注:无用户界面[headless]服务器指没有监视器和鼠标键盘等外设的服务器)。我们通过安装下面的软件包,让它可以托管虚拟机,虚拟机可通过 HTTP 访问。 + + # yum groupinstall 'Development Tools' SDL kernel-devel kernel-headers dkms + +![安装开发工具](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Development-Tool.jpeg) + +*安装开发工具* + +更改工作目录到 ‘/etc/yum.repos.d/’ 并下载 VirtualBox 库。 + + # wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc + +安装刚下载的密钥。 + + # rpm --import oracle_vbox.asc + +升级并安装 VirtualBox。 + + # yum update && yum install virtualbox-4.3 + +下一步,下载和安装 VirtualBox 扩展包。 + + # wget http://download.virtualbox.org/virtualbox/4.3.12/Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack + # VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.3.12-93733.vbox-extpack + +![安装 VirtualBox 扩展包](http://www.tecmint.com/wp-content/uploads/2015/04/Install-Virtualbox-Extension-Pack.jpeg) + +*安装 VirtualBox 扩展包* + +![正在安装 VirtualBox 扩展包](http://www.tecmint.com/wp-content/uploads/2015/04/Installing-Virtualbox-Extension-Pack.jpeg) + +*正在安装 VirtualBox 扩展包* + +添加用户 ‘vbox’ 用于管理 VirtualBox 并把它添加到组 vboxusers 中。 + + # adduser vbox + # passwd vobx + # usermod -G vboxusers vbox + +安装 HTTPD 服务器。 + + # yum install httpd + +安装 PHP (支持 soap 扩展)。 + + # yum install php php-devel php-common php-soap php-gd + +下载 phpVirtualBox(一个 PHP 写的开源的 VirtualBox 用户界面)。 + + # wget http://sourceforge.net/projects/phpvirtualbox/files/phpvirtualbox-4.3-1.zip + +解压 zip 文件并把解压后的文件夹复制到 HTTP 工作目录。 + + # unzip phpvirtualbox-4.*.zip + # cp phpvirtualbox-4.3-1 -R /var/www/html + +下一步,重命名文件 /var/www/html/phpvirtualbox/config.php-example 为 var/www/html/phpvirtualbox/config.php。 + + # mv config.php.example config.php + +打开配置文件并添加我们上一步创建的 ‘username ’ 和 ‘password’。 + + # vi config.php + +最后,重启 VirtualBox 和 HTTP 服务器。 + + # service vbox-service restart + # service httpd restart + +转发端口并从一个有用户界面的服务器上访问它。 + + http://192.168.0.15/phpvirtualbox-4.3-1/ + +![登录 PHP Virtualbox](http://www.tecmint.com/wp-content/uploads/2015/04/PHP-Virtualbox-Login.png) + +*登录 PHP Virtualbox* + +![PHP Virtualbox 面板](http://www.tecmint.com/wp-content/uploads/2015/04/PHP-Virtualbox.png) + +*PHP Virtualbox 面板* + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/things-to-do-after-minimal-rhel-centos-7-installation/5/ + +作者:[Avishek Kumar][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[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-5156-1.html +[2]:https://linux.cn/article-3796-1.html +[3]:http://www.tecmint.com/11-cron-scheduling-task-examples-in-linux/ +[4]:https://linux.cn/article-2494-1.html \ No newline at end of file diff --git a/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--6.md b/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--6.md new file mode 100644 index 0000000000..c2c00c95a6 --- /dev/null +++ b/published/201505/30 Things to Do After Minimal RHEL or CentOS 7 Installation--6.md @@ -0,0 +1,86 @@ +安装完最小化 RHEL/CentOS 7 后需要做的 30 件事情(六) +================================================================================ +### 30. 用密码保护 GRUB ### + +用密码保护你的 boot 引导程序这样你就可以在启动时获得额外的安全保障。同时你也可以在实物层面获得保护。通过在引导时给 GRUB 加锁防止任何无授权访问来保护你的服务器。 + +首先备份两个文件,这样如果有任何错误出现,你可以有回滚的选择。备份 ‘/etc/grub2/grub.cfg’ 为 ‘/etc/grub2/grub.cfg.old’。 + + # cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.old + +同样,备份 ‘/etc/grub.d/10\_linux’ 为 ‘/etc/grub.d/10\_linux.old’。 + + # cp /etc/grub.d/10_linux /etc/grub.d/10_linux.old + +打开文件 ‘/etc/grub.d/10\_linux’ 并在文件末尾添加下列行。 + + cat <”和流索引)文件: + + [root@localhost ~]# blablabla 1> output.txt + -bash: blablabla: command not found + +在本例中,我们试着重定向流1(**stdout**)到名为output.txt的文件。让我们来看对该文件内容所做的事情吧,使用cat命令可以做这事: + + [root@localhost ~]# cat output.txt + [root@localhost ~]# + +看起来似乎是空的。好吧,现在让我们来重定向流2(**stderr**): + + [root@localhost ~]# blablabla 2> error.txt + [root@localhost ~]# + +好吧,我们看到牢骚话没了。让我们检查一下那个文件: + + [root@localhost ~]# cat error.txt + -bash: blablabla: command not found + [root@localhost ~]# + +果然如此!我们看到,所有牢骚话都被记录到errors.txt文件里头去了。 + +有时候,命令会同时产生**stdout**和**stderr**。要重定向它们到不同的文件,我们可以使用以下语句: + + command 1>out.txt 2>err.txt + +要缩短一点语句,我们可以忽略“1”,因为默认情况下**stdout**会被重定向: + + command >out.txt 2>err.txt + +好吧,让我们试试做些“坏事”。让我们用rm命令把file1和folder1给删了吧: + + [root@localhost ~]# rm -vf folder1 file1 > out.txt 2>err.txt + +现在来检查以下输出文件: + + [root@localhost ~]# cat out.txt + removed `file1' + [root@localhost ~]# cat err.txt + 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(上面已经解释过了),而该流会被重定向到同一个文件。让我们看这个实例: + + [root@localhost ~]# rm -fv folder2 file2 >out_err.txt 2>&1 + [root@localhost ~]# cat out_err.txt + rm: cannot remove `folder2': Is a directory + removed `file2' + [root@localhost ~]# + +看着这些组合的输出,我们可以将其说明为:首先,**rm**命令试着将folder2删除,而它不会成功,因为linux要求**-r**键来允许**rm**命令删除文件夹,而第二个file2会被删除。通过为**rm**提供**-v**(详情)键,我们让rm命令告诉我们每个被删除的文件或文件夹。 + +这些就是你需要知道的,关于重定向的几乎所有内容了。我是说几乎,因为还有一个更为重要的重定向工具,它称之为“管道”。通过使用|(管道)符号,我们通常重定向**stdout**流。 + +比如说,我们有这样一个文本文件: + + [root@localhost ~]# cat text_file.txt + This line does not contain H e l l o word + This lilne contains Hello + This also containd Hello + This one no due to HELLO all capital + Hello bash world! + +而我们需要找到其中某些带有“Hello”的行,Linux中有个**grep**命令可以完成该工作: + + [root@localhost ~]# grep Hello text_file.txt + This lilne contains Hello + This also containd Hello + Hello bash world! + [root@localhost ~]# + +当我们有个文件,想要在里头搜索的时候,这用起来很不错。当如果我们需要在另一个命令的输出中查找某些东西,这又该怎么办呢?是的,当然,我们可以重定向输出到文件,然后再在文件里头查找: + + [root@localhost ~]# fdisk -l>fdisk.out + [root@localhost ~]# grep "Disk /dev" fdisk.out + Disk /dev/sda: 8589 MB, 8589934592 bytes + Disk /dev/mapper/VolGroup-lv_root: 7205 MB, 7205814272 bytes + Disk /dev/mapper/VolGroup-lv_swap: 855 MB, 855638016 bytes + [root@localhost ~]# + +如果你打算grep一些双引号引起来带有空格的内容呢! + +注意:fdisk命令显示关于Linux操作系统磁盘驱动器的信息。 + +就像我们看到的,这种方式很不方便,因为我们不一会儿就把临时文件空间给搞乱了。要完成该任务,我们可以使用管道。它们允许我们重定向一个命令的**stdout**到另一个命令的**stdin**流: + + [root@localhost ~]# fdisk -l | grep "Disk /dev" + Disk /dev/sda: 8589 MB, 8589934592 bytes + Disk /dev/mapper/VolGroup-lv_root: 7205 MB, 7205814272 bytes + Disk /dev/mapper/VolGroup-lv_swap: 855 MB, 855638016 bytes + [root@localhost ~]# + +如你所见,我们不需要任何临时文件就获得了相同的结果。我们把**fdisk stdout**重定向到了**grep stdin**。 + +**注意** : 管道重定向总是从左至右的。 + +还有几个其它重定向,但是我们将把它们放在后面讲。 + +### 在shell中显示自定义信息 ### + +正如我们所知道的,通常,与shell的交流以及shell内的交流是以对话的方式进行的。因此,让我们创建一些真正的脚本吧,这些脚本也会和我们讲话。这会让你学到一些简单的命令,并对脚本的概念有一个更好的理解。 + +假设我们是某个公司的总服务台经理,我们想要创建某个shell脚本来注册呼叫信息:电话号码、用户名以及问题的简要描述。我们打算把这些信息存储到普通文本文件data.txt中,以便今后统计。脚本它自己就是以对话的方式工作,这会让总服务台的工作人员的小日子过得轻松点。那么,首先我们需要显示提问。对于显示信息,我们可以用echo和printf命令。这两个都是用来显示信息的,但是printf更为强大,因为我们可以通过它很好地格式化输出,我们可以让它右对齐、左对齐或者为信息留出专门的空间。让我们从一个简单的例子开始吧。要创建文件,请使用你惯用的文本编辑器(kate,nano,vi,……),然后创建名为note.sh的文件,里面写入这些命令: + + echo "Phone number ?" + +### 如何运行/执行脚本? ### + +在保存文件后,我们可以使用bash命令来运行,把我们的文件作为它的参数: + + [root@localhost ~]# bash note.sh + Phone number ? + +实际上,这样来执行脚本是很不方便的。如果不使用**bash**命令作为前缀来执行,会更舒服一些。要让脚本可执行,我们可以使用**chmod**命令: + + [root@localhost ~]# ls -la note.sh + -rw-r--r--. 1 root root 22 Apr 23 20:52 note.sh + [root@localhost ~]# chmod +x note.sh + [root@localhost ~]# ls -la note.sh + -rwxr-xr-x. 1 root root 22 Apr 23 20:52 note.sh + [root@localhost ~]# + +![set permission script file](http://blog.linoxide.com/wp-content/uploads/2015/04/Capture.png) + +**注意** : ls命令显示了当前文件夹内的文件。通过添加-la键,它会显示更多文件信息。 + +如我们所见,在**chmod**命令执行前,脚本只有读(r)和写(w)权限。在执行**chmod +x**后,它就获得了执行(x)权限。(关于权限的更多细节,我会在下一篇文章中讲述。)现在,我们只需这么来运行: + + [root@localhost ~]# ./note.sh + Phone number ? + +在脚本名前,我添加了 ./ 组合。.(点)在unix世界中意味着当前位置(当前文件夹),/(斜线)是文件夹分隔符。(在Windows系统中,我们使用反斜线 \ 表示同样功能)所以,这整个组合的意思是说:“从当前文件夹执行note.sh脚本”。我想,如果我用完整路径来运行这个脚本的话,你会更加清楚一些: + + [root@localhost ~]# /root/note.sh + Phone number ? + [root@localhost ~]# + +它也能工作。 + +如果所有linux用户都有相同的默认shell,那就万事OK。如果我们只是执行该脚本,默认的用户shell就会用于解析脚本内容并运行命令。不同的shell的语法、内部命令等等有着一丁点不同,所以,为了保证我们的脚本会使用**bash**,我们应该添加**#!/bin/bash**到文件首行。这样,默认的用户shell将调用**/bin/bash**,而只有在那时候,脚本中的命令才会被执行: + + [root@localhost ~]# cat note.sh + #!/bin/bash + echo "Phone number ?" + +直到现在,我们才100%确信**bash**会用来解析我们的脚本内容。让我们继续。 + +### 读取输入 ### + +在显示信息后,脚本会等待用户回答。有个**read**命令用来接收用户的回答: + + #!/bin/bash + echo "Phone number ?" + read phone + +在执行后,脚本会等待用户输入,直到用户按[ENTER]键结束输入: + + [root@localhost ~]# ./note.sh + Phone number ? + 12345 <--- 这儿是我输入的内容 + [root@localhost ~]# + +你输入的所有东西都会被存储到变量**phone**中,要显示变量的值,我们同样可以使用**echo**命令: + + [root@localhost ~]# cat note.sh + #!/bin/bash + echo "Phone number ?" + read phone + echo "You have entered $phone as a phone number" + [root@localhost ~]# ./note.sh + Phone number ? + 123456 + You have entered 123456 as a phone number + [root@localhost ~]# + +在**bash** shell中,一般我们使用**$**(美元)符号来表明这是一个变量,除了读入到变量和其它为数不多的时候才不用这个$(将在今后说明)。 + +好了,现在我们准备添加剩下的问题了: + + #!/bin/bash + echo "Phone number?" + read phone + echo "Name?" + read name + echo "Issue?" + read issue + [root@localhost ~]# ./note.sh + Phone number? + 123 + Name? + Jim + Issue? + script is not working. + [root@localhost ~]# + +### 使用流重定向 ### + +太完美了!剩下来就是重定向所有东西到文件data.txt了。作为字段分隔符,我们将使用/(斜线)符号。 + +**注意** : 你可以选择任何你认为是最好的分隔符,但是确保文件内容不会包含这些符号在内,否则它会导致在文本行中产生额外字段。 + +别忘了使用“>>”来代替“>”,因为我们想要将输出内容附加到文件末! + + [root@localhost ~]# tail -2 note.sh + read issue + echo "$phone/$name/$issue">>data.txt + [root@localhost ~]# ./note.sh + Phone number? + 987 + Name? + Jimmy + Issue? + Keybord issue. + [root@localhost ~]# cat data.txt + 987/Jimmy/Keybord issue. + [root@localhost ~]# + +**注意** : **tail**命令显示了文件的最后的**n**行。 + +搞定。让我们再来运行一次看看: + + [root@localhost ~]# ./note.sh + Phone number? + 556 + Name? + Janine + Issue? + Mouse was broken. + [root@localhost ~]# cat data.txt + 987/Jimmy/Keybord issue. + 556/Janine/Mouse was broken. + [root@localhost ~]# + +我们的文件在增长,让我们在每行前面加个日期吧,这对于今后摆弄这些统计数据时会很有用。要实现这功能,我们可以使用date命令,并指定某种格式,因为我不喜欢默认格式: + + [root@localhost ~]# date + Thu Apr 23 21:33:14 EEST 2015 <---- date命令的默认输出 + [root@localhost ~]# date "+%Y.%m.%d %H:%M:%S" + 2015.04.23 21:33:18 <---- 格式化后的输出 + +有几种方式可以读取命令的输出到变量,在这种简单的情况下,我们将使用`(是反引号,不是单引号,和波浪号~在同一个键位): + + [root@localhost ~]# cat note.sh + #!/bin/bash + now=`date "+%Y.%m.%d %H:%M:%S"` + echo "Phone number?" + read phone + echo "Name?" + read name + echo "Issue?" + read issue + echo "$now/$phone/$name/$issue">>data.txt + [root@localhost ~]# ./note.sh + Phone number? + 123 + Name? + Jim + Issue? + Script hanging. + [root@localhost ~]# cat data.txt + 2015.04.23 21:38:56/123/Jim/Script hanging. + [root@localhost ~]# + +嗯…… 我们的脚本看起来有点丑啊,让我们来美化一下。如果你要手动读取**read**命令,你会发现read命令也可以显示一些信息。要实现该功能,我们应该使用-p键加上信息: + + [root@localhost ~]# cat note.sh + #!/bin/bash + now=`date "+%Y.%m.%d %H:%M:%S"` + read -p "Phone number: " phone + read -p "Name: " name + read -p "Issue: " issue + echo "$now/$phone/$name/$issue">>data.txt + +你可以直接从控制台查找到各个命令的大量有趣的信息,只需输入:**man read, man echo, man date, man ……** + +同意吗?它看上去是舒服多了! + + [root@localhost ~]# ./note.sh + Phone number: 321 + Name: Susane + Issue: Mouse was stolen + [root@localhost ~]# cat data.txt + 2015.04.23 21:38:56/123/Jim/Script hanging. + 2015.04.23 21:43:50/321/Susane/Mouse was stolen + [root@localhost ~]# + +光标在消息的后面(不是在新的一行中),这有点意思。(LCTT 译注:如果用 echo 命令输出显示的话,可以用 -n 参数来避免换行。) + +### 循环 ### + +是时候来改进我们的脚本了。如果用户一整天都在接电话,如果每次都要去运行,这岂不是很麻烦?让我们让这些活动都永无止境地循环去吧: + + [root@localhost ~]# cat note.sh + #!/bin/bash + while true + do + read -p "Phone number: " phone + now=`date "+%Y.%m.%d %H:%M:%S"` + read -p "Name: " name + read -p "Issue: " issue + echo "$now/$phone/$name/$issue">>data.txt + done + +我已经交换了**read phone**和**now=`date`**行的位置。这是因为我想要在输入电话号码后再获得时间。如果我把它放在循环的首行,那么循环一次后,变量 now 就会在数据存储到文件中后马上获得时间。而这并不好,因为下一次呼叫可能在20分钟后,甚至更晚。 + + [root@localhost ~]# ./note.sh + Phone number: 123 + Name: Jim + Issue: Script still not works. + Phone number: 777 + Name: Daniel + Issue: I broke my monitor + Phone number: ^C + [root@localhost ~]# cat data.txt + 2015.04.23 21:38:56/123/Jim/Script hanging. + 2015.04.23 21:43:50/321/Susane/Mouse was stolen + 2015.04.23 21:47:55/123/Jim/Script still not works. + 2015.04.23 21:48:16/777/Daniel/I broke my monitor + [root@localhost ~]# + +注意: 要从无限循环中退出,你可以按[Ctrl]+[C]键。Shell会显示\^表示Ctrl键。 + +### 使用管道重定向 ### + +让我们添加更多功能到我们的“弗兰肯斯坦(Frankenstein)”,我想要脚本在每次呼叫后显示某个统计数据。比如说,我想要查看各个号码呼叫了我几次。对于这个,我们应该cat文件data.txt: + + [root@localhost ~]# cat data.txt + 2015.04.23 21:38:56/123/Jim/Script hanging. + 2015.04.23 21:43:50/321/Susane/Mouse was stolen + 2015.04.23 21:47:55/123/Jim/Script still not works. + 2015.04.23 21:48:16/777/Daniel/I broke my monitor + 2015.04.23 22:02:14/123/Jimmy/New script also not working!!! + [root@localhost ~]# + +现在,所有输出我们都可以重定向到**cut**命令,让**cut**来把每行切成一块一块(我们使用分隔符“/”),然后打印第二个字段: + + [root@localhost ~]# cat data.txt | cut -d"/" -f2 + 123 + 321 + 123 + 777 + 123 + [root@localhost ~]# + +现在,我们可以把这个输出重定向打另外一个命令**sort**: + + [root@localhost ~]# cat data.txt | cut -d"/" -f2|sort + 123 + 123 + 123 + 321 + 777 + [root@localhost ~]# + +然后只留下唯一的行。要统计唯一条目,只需添加**-c**键到**uniq**命令: + + [root@localhost ~]# cat data.txt | cut -d"/" -f2 | sort | uniq -c + 3 123 + 1 321 + 1 777 + [root@localhost ~]# + +只要把这个添加到我们的循环的最后: + + #!/bin/bash + while true + do + read -p "Phone number: " phone + now=`date "+%Y.%m.%d %H:%M:%S"` + read -p "Name: " name + read -p "Issue: " issue + echo "$now/$phone/$name/$issue">>data.txt + echo "===== We got calls from =====" + cat data.txt | cut -d"/" -f2 | sort | uniq -c + echo "--------------------------------" + done + +运行: + + [root@localhost ~]# ./note.sh + Phone number: 454 + Name: Malini + Issue: Windows license expired. + ===== We got calls from ===== + 3 123 + 1 321 + 1 454 + 1 777 + -------------------------------- + Phone number: ^C + +![running script](http://blog.linoxide.com/wp-content/uploads/2015/04/Capture11.png) + +当前场景贯穿了几个熟知的步骤: + +- 显示消息 +- 获取用户输入 +- 存储值到文件 +- 处理存储的数据 + +但是,如果用户有点责任心,他有时候需要输入数据,有时候需要统计,或者可能要在存储的数据中查找一些东西呢?对于这些事情,我们需要使用switches/cases,并知道怎样来很好地格式化输出。这对于在shell中“画”表格的时候很有用。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-shell-script/guide-start-learning-shell-scripting-scratch/ + +作者:[Petras Liumparas][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/petrasl/ diff --git a/published/20150506 How to Setup OpenERP (Odoo) on CentOS 7.x.md b/published/20150506 How to Setup OpenERP (Odoo) on CentOS 7.x.md new file mode 100644 index 0000000000..0035432ecb --- /dev/null +++ b/published/20150506 How to Setup OpenERP (Odoo) on CentOS 7.x.md @@ -0,0 +1,112 @@ +如何在CentOS 7.x中安装OpenERP(Odoo) +================================================================================ +各位好,这篇教程关于的是如何在CentOS 7中安装Odoo(就是我们所知的OpenERP)。你是不是在考虑为你的业务安装一个不错的ERP(企业资源规划)软件?那么OpenERP就是你寻找的最好的程序,因为它是一款为你的商务提供杰出特性的自由开源软件。 + +[OpenERP][1]是一款自由开源的传统的OpenERP(企业资源规划),它包含了开源CRM、网站构建、电子商务、项目管理、计费账务、POS、人力资源、市场、生产、采购管理以及其它模块用于提高效率及销售。Odoo中的应用可以作为独立程序使用,它们也可以无缝集成到一起,因此你可以在安装几个程序来得到一个全功能的开源ERP。 + +因此,下面是在你的CentOS上安装OpenERP的步骤。 + +### 1. 安装 PostgreSQL ### + +首先,首先我们需要更新CentOS 7的软件包来确保是最新的包,补丁和安全更新。要更新我们的系统,我们要在shell下运行下面的命令。 + + # yum clean all + # yum update + +现在我们要安装PostgreSQL,因为OpenERP使用PostgreSQL作为它的数据库。要安装它,我们需要运行下面的命令。 + + # yum install postgresql postgresql-server postgresql-libs + +![Installing postgresql](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-postgresql.png) + +安装完成后,我们需要用下面的命令初始化数据库。 + + # postgresql-setup initdb + +![Intializating postgresql](http://blog.linoxide.com/wp-content/uploads/2015/03/intializating-postgresql.png) + +我们接着设置PostgreSQL来使它每次开机启动。 + + # systemctl enable postgresql + # systemctl start postgresql + +因为我们还没有为用户“postgresql”设置密码,我们现在设置。 + + # su - postgres + $ psql + postgres=# \password postgres + postgres=# \q + # exit + +![setting password postgres](http://blog.linoxide.com/wp-content/uploads/2015/03/setting-password-postgres.png) + +### 2. 设置Odoo仓库 ### + +在初始化数据库初始化完成后,我们要添加 EPEL(企业版Linux的额外包)到我们的CentOS中。Odoo(或者OpenERP)依赖的Python运行时环境以及其他包没有包含在标准仓库中。这样我们要为企业版Linux添加额外的包仓库支持来解决Odoo所需要的依赖。要安装完成,我们需要运行下面的命令。 + + # yum install epel-release + +![Installing EPEL Release](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-epel-release.png) + +现在,安装EPEL后,我们现在使用yum-config-manager添加Odoo(OpenERP)的仓库。 + + # yum install yum-utils + + # yum-config-manager --add-repo=https://nightly.odoo.com/8.0/nightly/rpm/odoo.repo + +![Adding OpenERP (Odoo) Repo](http://blog.linoxide.com/wp-content/uploads/2015/03/added-odoo-repo.png) + +### 3. 安装Odoo 8 (OpenERP) ### + +在CentOS 7中添加Odoo 8(OpenERP)的仓库后。我们使用下面的命令来安装Odoo 8(OpenERP)。 + + # yum install -y odoo + +上面的命令会安装odoo以及必须的依赖的包。 + +![Installing odoo or OpenERP](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-odoo.png) + +现在我们使用下面的命令在每次启动后启动Odoo服务。 + + # systemctl enable odoo + # systemctl start odoo + +![Starting Odoo](http://blog.linoxide.com/wp-content/uploads/2015/03/starting-odoo.png) + +### 4. 打开防火墙 ### + +因为Odoo使用8069端口,我们需要在防火墙中允许远程访问。我们使用下面的命令来在防火墙中允许8069端口访问。 + + # firewall-cmd --zone=public --add-port=8069/tcp --permanent + # firewall-cmd --reload + +![Allowing firewall Port](http://blog.linoxide.com/wp-content/uploads/2015/03/allowing-firewall-port.png) + +**注意:默认情况下只有本地才允许连接数据库。如果我们要允许PostgreSQL的远程访问,我们需要在pg_hba.conf添加下面图片中一行** + + # nano /var/lib/pgsql/data/pg_hba.conf + +![Allowing Remote Access pgsql](http://blog.linoxide.com/wp-content/uploads/2015/03/allowing-remote-access-pgsql.png) + +### 5. Web接口 ### + +我们已经在CentOS 7中安装了最新的Odoo 8(OpenERP),我们可以在浏览器中输入`http://ip-address:8069`来访问Odoo。 接着,我们要做的第一件事就是创建一个新的数据库和新的密码。注意,主密码默认是‘admin’。接着,我们可以在面板中输入用户名和密码。 + +![Odoo Panel](http://blog.linoxide.com/wp-content/uploads/2015/03/odoo-panel.png) + +### 总结 ### + +Odoo 8(OpenERP)是世界上最好的开源ERP程序。OpenERP是由许多模块组成的针对商务和公司的完整ERP程序,我们已经把它安装好了。因此,如果你有任何问题、建议、反馈请在下面的评论栏写下。谢谢你!享受OpenERP(Odoo 8)吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/setup-openerp-odoo-centos-7/ + +作者:[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/ +[1]:https://www.odoo.com/ diff --git a/published/20150506 Linux FAQs with Answers--How to disable entering password for default keyring to unlock on Ubuntu desktop.md b/published/20150506 Linux FAQs with Answers--How to disable entering password for default keyring to unlock on Ubuntu desktop.md new file mode 100644 index 0000000000..fb67d3dd34 --- /dev/null +++ b/published/20150506 Linux FAQs with Answers--How to disable entering password for default keyring to unlock on Ubuntu desktop.md @@ -0,0 +1,55 @@ +Linux有问必答:Ubuntu桌面上如何禁用默认的密钥环解锁提示 +================================================================================ +>**问题**:当我启动我的Ubuntu桌面时,出现了一个弹出对话框,要求我输入密码来解锁默认的密钥环。我怎样才能禁用这个“解锁默认密钥环”弹出窗口,并自动解锁我的密钥环? + +密钥环是一个以加密方式存储你的登录信息的本地数据库。各种桌面应用(如浏览器、电子邮件客户端)使用密钥环来安全地存储并管理你的登录凭证、机密、密码、证书或密钥。对于那些需要检索存储在密钥环中的信息的应用程序,需要解锁该密钥环。 + +Ubuntu桌面所使用的GNOME密钥环被整合到了桌面登录中,该密钥环会在你验证进入桌面后自动解锁。但是,如果你设置了自动登录桌面或者是从休眠中唤醒,你默认的密钥环仍然可能“被锁定”的。在这种情况下,你会碰到这一提示: + +>“输入密码来解锁密钥环‘默认密钥环’。某个应用想要访问密钥环‘默认密钥环’,但它被锁定了。” +> +![](https://farm9.staticflickr.com/8787/16716456754_309c39513c_o.png) + +如果你想要避免在每次弹出对话框出现时输入密码来解锁默认密钥环,那么你可以这样做。 + +在做之前,请先了解禁用密码提示后可能出现的结果。通过自动解锁默认密钥环,你可以让任何使用你桌面的人无需知道你的密码而能获取你的密钥环(以及存储在密钥环中的任何信息)。 + +### 禁用默认密钥环解锁密码 ### + +打开Dash,然后输入“password”来启动“密码和密钥”应用。 + +![](https://farm8.staticflickr.com/7709/17312949416_ed9c4fbe2d_b.jpg) + +或者,使用seahorse命令从命令行启动图形界面。 + + $ seahorse + +在左侧面板中,右击“默认密钥环”,并选择“修改密码”。 + +![](https://farm8.staticflickr.com/7740/17159959750_ba5b675b00_b.jpg) + +输入你的当前登录密码。 + +![](https://farm8.staticflickr.com/7775/17347551135_ce09260818_b.jpg) + +在设置“默认”密钥环新密码的密码框中留空。 + +![](https://farm8.staticflickr.com/7669/17345663222_c9334c738b_c.jpg) + +在询问是否不加密存储密码对话框中点击“继续”。 + +![](https://farm8.staticflickr.com/7761/17152692309_ce3891a0d9_c.jpg) + +搞定。从今往后,那个该死的解锁密钥环提示对话框再也不会来烦你了。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/disable-entering-password-unlock-default-keyring.html + +作者:[Dan Nanni][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/published/20150511 Open Source History--Why Did Linux Succeed.md b/published/20150511 Open Source History--Why Did Linux Succeed.md new file mode 100644 index 0000000000..76b6d03ebe --- /dev/null +++ b/published/20150511 Open Source History--Why Did Linux Succeed.md @@ -0,0 +1,73 @@ +开源旧事:Linux为什么能成功? +================================================================================ +> Linux,这个始于1991年由Linus Torvalds开发的类Unix操作系统内核已经成为开源世界的中心,人们不禁追问为什么Linux成功了,而包括GNU HURD和BSD在内的那么多相似的项目却失败了? + +![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/05/linux.jpg) + +自由软件和开源世界的发展史中最令人不解的问题之一是为什么Linux取得了如此辉煌的成功,然而其它同样尝试打造自由开源、类Unix操作系统内核的项目却没能那么成功?这个问题难以回答,但我总结了一些原因,在下面与大家分享。 + +不过,首先得明确:当我谈论Linux是一个巨大的成功时所表达的含义。我这样说是相对于其它类Unix操作系统内核的,后者中一些是开源的,一些不是,而且它们繁荣发展的时期是Linux诞生的时期。[GNU][1]的HURD,一个发起于[1991年5月][1]的Free(自由)的内核,便是其中之一。其它的包括现在大部分人都没听说过的Unix,比如由加州大学伯克利分校开发出来的BSD的各种各样Unix衍生版,由微软主导的Unix系统Xenix,包括Minix在内的学术版本Unix,和在AT&T赞助下开发的最初的Unix。在更早的数十年内,它对于学术界和商业界的计算发展至关重要,但到19世纪90年代就已经几乎已经消失在人们的视野里。 + +#### 相关阅读 #### + +- [开源旧事:黑客文化和黑客伦理的起源追踪][3] +- [Unix和个人计算机:重新诠释Linux起源][4] + +此外,得说明的是,我这里说的是内核,而不是完整的操作系统。在很大程度上,Linux内核的成功归功于GNU整个项目。GNU这个项目产生了一套至关重要的工具,包括编译器、调试器和BASH shell的实现,这些对于构建一个类Unix操作系统是必需的。但是GNU的开发者们从没开发出一个HURD内核的可行版本(尽管他们仍在[不懈努力中][5])。相反,Linux呈现出来的则是一个将GNU各个部分紧密连接在一起的内核,尽管这超出了GNU的初衷。 + +因此,值得人们去追问为什么Linux,一个由Linus Torvalds这个芬兰的无名程序员于1991年——和HURD同一年——发起的内核,能够经受考验并发展壮大?在当时的大环境下,很多拥有强力商业支持的、由当时炙手可热的黑客领头的类Unix内核都没能够发展起来。为了说明这个问题,我找到了一些和这个问题相关的解释。为此我研究了自由软件和开源世界的发展史,和不同解释的优缺点。 + +### Linux采用去中心化的开发方式 ### + +这个观点来源于Eric S. Raymond的文章,“[大教堂与市集][6]”和其相关资料。这些资料验证了一种情形:当大量的贡献者以一种去中心化的组织结构持续不断地协同合作时,软件开发的效率最佳。Linux的开发证明了这一点,与之相反的是,比如,GNU HURD采用了一种相对更集中化的方法来管理代码开发。其结果如同Raymond所言,显然在十年的时间里都没能成功构建出一个完整的操作系统。 + +在一定程度上,这个解释有道理,但仍有一些明显的不足。举例来说,Torvalds在指导Linux代码开发过程中毫无争议地承担起一个更加有权威的角色,他可以决定接受或拒绝代码,这一点并非Raymond和其他人所想的那样。其次,这个观点不能解释除了没能开发出一个可行的系统内核外GNU仍然成功地生产出那么多优秀的软件。如果只有去中心化的开发方式才能很好地指导开源软件世界里的项目,那么GNU所有的编程工作都应该是徒劳无功的,但事实并非如此。 + +### Linux是实用型的,而GNU是空想型的 ### + +个人而言,我觉得这个说法是最引人注目的,即Linux之所发展得如此迅速是因为它的创建者是一个实用主义者,他起初只是想写一个内核,使其能够在他家里的电脑上运行一个裁剪过的Unix操作系统,而不是成为以改变世界为目标的自由软件的一部分,而后者正是GNU项目的一贯目标。 + +然而,这个解释仍然有一些不能完全让人信服的地方。特别是,尽管Torvalds本人信奉实用主义的原则,但无论以前还是现在,并非所有参与到他的项目中的成员都和他一样信奉这一原则。尽管如此,Linux仍然取得了成功。 + +而且,如果实用主义是Linux持续发展的关键,那么就要再问一遍:为什么GNU除了没能开发出一个内核外还是成功地开发出这么多有用的工具?如果拥有某一种对软件的坚定政治信仰是追求成功的项目路上的绊脚石,那么GNU早应该是一个彻头彻尾的失败者,而不会是一个开发了那么多如今依然为IT世界提供坚实基础的优秀软件包的开拓者。 + +最后(但并不是最不重要),许多诞生于19世纪80年代末期和90年代初期的Unix变体,尤其是一些BSD分支,都是实用主义的产物。它们的开发者们致力于开发出可以自由分享而不是受到高昂商业证书限制的Unix变体,但他们对于编程或者共享代码并非完全局限于意识形态。Torvalds同样如此,因此很难说Linux和成功和其它Unix项目的失败是意识形态在作怪。 + +### 操作系统设计 ### + +当谈到Linux的成功时,不可忽视的是Linux和其它Unix变体之间的诸多技术差异。Richard Stallman,GNU项目的创始人,在一封给我的电子邮件中解释了为什么HURD的开发进度频频滞后:“GNU Hurd确实不是一次实用上的成功。部分原因是它的基本设计使它像是一个研究项目。(我之所以选择这样的设计,是考虑到这是快速实现一个可用内核的捷径。)” + +就Torvalds独自编写出Linux的所有代码这点而言,Linux也有别于其它Unix变体。当他在1991年8月[第一次发布Linux][7]时他的一个初衷就是拥有一个属于他自己的Unix,而不用别人的代码。这点特性使得Linux区别于同时期的大部分Unix变体,后者一般是从AT&T Unix或伯克利的BSD中衍生出基础代码。 + +我并不是一个计算机科学家,所以我没有资格去评判是否Linux代码就优于其他Unix代码,以此来解释Linux的成功。虽然这并不能解释Linux和其它Unix内核在文化和人员上的不同,但这个观点对我来说解释得通,因为似乎在理解Linux成功这一点上操作系统设计比代码更加重要。 + +### Linux背后的社区提供了有力支持 ### + +Stallman也写到Linux成功的“主要原因”是“Torvalds使Linux成为一个自由软件,所以相比Hurd有更多来自社区的支持涌入Linux的发展中。”但这对于Linux的成长轨迹并非是一个完美的解释,因为它不能说明为什么自由软件的开发者们追随了Torvalds而不是HURD或其它某个Unix,但它仍然点明了这种变化是Linux盛行的很大一部分原因。 + +对于自由软件社区决定支持Linux有一个更全面的理由可以用来解释为什么开发者们这么做。起初,Linux只是一个默默无闻的小项目,以任何标准来衡量,它比同时期其它的一些尝试创建一个更加自由的Unix,比如NET BSD和386/BSD,都要显得微不足道。同样,最初并不清楚Linux和自由软件运动的目标是否一致。创建伊始,Torvalds只是在一份防止Linux不被商业使用的证书下发布了Linux。至于后来他为了保护源代码的开放性转向使用GNU的通用公开证书则是后话了。 + +所以,这些就是我所找到的Linux作为一个开源操作系统之所以取得成功的解释,可以肯定Linux的成就在某些方面(但比如桌面版的Linux从未成为它的支持者希望成为的样子)已经是可以衡量的成功。总之,Linux业已与其它任何类Unix操作系统不同的方式成为了计算机世界的基石。也许源于BSD的苹果公司的OS X和iOS系统也很接近这一点,但它们没有在其它方面像Linux影响互联网一样扮演着如此重要的中心角色。 + +对于为什么Linux能成为现在的样子,或者为什么它在Unix世界的竞争对手们几乎全部变得默默无闻的问题,你有其它的想法吗?如果有,我很乐意听到你的想法。(诚然,BSD的变体如今仍有一批追随者,而一些商用的Unix对于[Red Hat][8](RHT)为[他们的用户提供支持][9]来说也仍然十分重要。但这些Unix中没有一个能够像Linux一样几乎征服了从Web服务器到智能手机的每一个领域。) + +-------------------------------------------------------------------------------- + +via: http://thevarguy.com/open-source-application-software-companies/050415/open-source-history-why-did-linux-succeed + +作者:[Christopher Tozzi][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://thevarguy.com/author/christopher-tozzi +[1]:http://gnu.org/ +[2]:http://www.gnu.org/software/hurd/history/hurd-announce +[3]:http://thevarguy.com/open-source-application-software-companies/042915/open-source-history-tracing-origins-hacker-culture-and-ha +[4]:http://thevarguy.com/open-source-application-software-companies/042715/unix-and-personal-computers-reinterpreting-origins-linux +[5]:http://thevarguy.com/open-source-application-software-companies/042015/30-years-hurd-lives-gnu-updates-open-source- +[6]:http://www.catb.org/esr/writings/cathedral-bazaar/cathedral-bazaar/ +[7]:https://groups.google.com/forum/#!topic/comp.os.minix/dlNtH7RRrGA[1-25] +[8]:http://www.redhat.com/ +[9]:http://thevarguy.com/open-source-application-software-companies/032614/red-hat-grants-certification-award-unix-linux-migration-a \ No newline at end of file diff --git a/published/20150512 How To Run Docker Client Inside Windows OS.md b/published/20150512 How To Run Docker Client Inside Windows OS.md new file mode 100644 index 0000000000..050ed636f3 --- /dev/null +++ b/published/20150512 How To Run Docker Client Inside Windows OS.md @@ -0,0 +1,110 @@ +如何在 Windows 操作系统中运行 Docker 客户端 +================================================================================ + +大家好,今天我们来了解一下 Windows 操作系统中的 Docker 以及在其中安装 Docker Windows 客户端的知识。Docker 引擎使用 Linux 特有的内核特性,因此不能通过 Windows 内核运行,所以,(在 Windows 上)Docker 引擎创建了一个小的虚拟系统运行 Linux 并利用它的资源和内核。这样,Windows Docker 客户端就可以用这个虚拟的 Docker 引擎来构建、运行以及管理 Docker 容器。有个叫 Boot2Docker 的团队开发了一个同名的应用程序,它创建了一个虚拟机来运行基于[Tiny Core Linux][1]特制的小型 Linux,来在 Windows 上运行 [Docker][2] 容器。它完全运行在内存中,需要大约 27M 内存并能在 5秒 (因人而异) 内启动。因此,在用于 Windows 的 Docker 引擎被开发出来之前,我们在 Windows 机器里只能运行 Linux 容器。 + +下面是安装 Docker 客户端并在上面运行容器的简单步骤。 + +### 1. 下载 Boot2Docker ### + +在我们开始安装之前,我们需要 Boot2Docker 的可执行文件。可以从 [它的 Github][3] 下载最新版本的 Boot2Docker。在这篇指南中,我们从网站中下载版本 v1.6.1。我们从那网页中用我们喜欢的浏览器或者下载管理器下载了名为 [docker-install.exe][4] 的文件。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/downloading-boot2docker-installer.png) + +### 2. 安装 Boot2Docker ### + +现在我们运行安装文件,它会安装 Window Docker 客户端、用于 Windows 的 Git(MSYS-git)、VirtualBox、Boot2Docker Linux ISO 以及 Boot2Docker 管理工具,这些对于开箱即用地运行全功能的 Docker 引擎都至关重要。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/boot2docker-installer.png) + +### 3. 运行 Boot2Docker ### + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/boot2docker-start-icon-e1431322598697.png) + +安装完成必要的组件之后,我们从桌面上的“Boot2Docker Start”快捷方式启动 Boot2Docker。它会要求你输入以后用于验证的 SSH 密钥。然后会启动一个配置好的用于管理在虚拟机中运行的 Docker 的 unix shell。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/starting-boot2docker.png) + +为了检查是否正确配置,运行下面的 docker version 命令。 + + docker version + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-version.png) + +### 4. 运行 Docker ### + +由于 **Boot2Docker Start** 自动启动了一个已经正确设置好环境变量的 shell,我们可以马上开始使用 Docker。**请注意,如果我们要将 Boot2Docker 作为一个远程 Docker 守护进程,那么不要在 docker 命令之前加 sudo。** + +现在,让我们来试试 **hello-world** 例子镜像,它会下载 hello-world 镜像,运行并输出 "Hello from Docker" 信息。 + + $ docker run hello-world + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/running-hello-world.png) + +### 5. 使用命令提示符(CMD) 运行 Docker### + +现在,如果你想开始用命令提示符使用 Docker,你可以打开命令提示符(CMD.exe)。由于 Boot2Docker 要求 ssh.exe 在 PATH 中,我们需要在命令提示符中输入以下命令使得 %PATH% 环境变量中包括 Git 安装目录下的 bin 文件夹。 + + set PATH=%PATH%;"c:\Program Files (x86)\Git\bin" + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-in-cmd.png) + +运行上面的命令之后,我们可以在命令提示符中运行 **boot2docker start** 启动 Boot2Docker 虚拟机。 + + boot2docker start + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-cmd-variables.png) + +**注意**: 如果你看到 machine does no exist 的错误信息,就运行 **boot2docker init** 命令。 + +然后复制上图中控制台标出命令到 cmd.exe 中为控制台窗口设置环境变量,然后我们就可以像平常一样运行 docker 容器了。 + +### 6. 使用 PowerShell 运行 Docker ### + +为了能在 PowerShell 中运行 Docker,我们需要启动一个 PowerShell 窗口并添加 ssh.exe 到 PATH 变量。 + + $Env:Path = "${Env:Path};c:\Program Files (x86)\Git\bin" + +运行完上面的命令,我们还需要运行 + + boot2docker start + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-in-powershell.png) + +这会打印用于设置环境变量连接到虚拟机内部运行的 Docker 的 PowerShell 命令。我们只需要在 PowerShell 中运行这些命令就可以和平常一样运行 docker 容器。 + +### 7. 用 PUTTY 登录 ### + +Boot2Docker 会在%USERPROFILE%\.ssh 目录生成和使用用于登录的公共和私有密钥,我们也需要使用这个文件夹中的私有密钥。私有密钥需要转换为 PuTTY 的格式。我们可以通过 puttygen.exe 实现。 + +我们需要打开 puttygen.exe 并从 %USERPROFILE%\.ssh\id_boot2docker 中导入("File"->"Load" 菜单)私钥,然后点击 "Save Private Key"。然后用保存的文件通过 PuTTY 用 docker@127.0.0.1:2022 登录。 + +### 8. Boot2Docker 选项 ### + +Boot2Docker 管理工具提供了一些命令,如下所示。 + + $ boot2docker + + Usage: boot2docker.exe [] {help|init|up|ssh|save|down|poweroff|reset|restart|config|status|info|ip|shellinit|delete|download|upgrade|version} [] + +### 总结 ### + +通过 Docker Windows 客户端使用 Docker 很有趣。Boot2Docker 管理工具是一个能使任何 Docker 容器能像在 Linux 主机上平滑运行的很棒的应用程序。如果你更仔细的话,你会发现 boot2docker 默认用户的用户名是 docker,密码是 tcuser。最新版本的 boot2docker 设置了一个 host-only 的网络适配器提供访问容器的端口。一般来说是 192.168.59.103,但可以通过 VirtualBox 的 DHCP 实现改变。 + +如果你有任何问题、建议、反馈,请在下面的评论框中写下来然后我们可以改进或者更新我们的内容。非常感谢!Enjoy:-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/run-docker-client-inside-windows-os/ + +作者:[Arun Pyasi][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://tinycorelinux.net/ +[2]:https://www.docker.io/ +[3]:https://github.com/boot2docker/windows-installer/releases/latest +[4]:https://github.com/boot2docker/windows-installer/releases/download/v1.6.1/docker-install.exe \ No newline at end of file diff --git a/published/20150512 Linux FAQs with Answers--How to view torrent file content on Linux.md b/published/20150512 Linux FAQs with Answers--How to view torrent file content on Linux.md new file mode 100644 index 0000000000..8f2a9c2ecd --- /dev/null +++ b/published/20150512 Linux FAQs with Answers--How to view torrent file content on Linux.md @@ -0,0 +1,63 @@ +Linux有问必答:Linux上如何查看种子文件的内容 +================================================================================ +> **问题**: 我从网站上下载了一个torrent(种子)文件。Linux上有没有工具让我查看torrent文件的内容?例如,我想知道torrent里面都包含什么文件。 + +torrent文件(也就是扩展名为**.torrent**的文件)是BitTorrent元数据文件,里面存储了BitTorrent客户端用来从BitTorrent点对点网络下载共享文件的信息(如,追踪器URL、文件列表、大小、校验和、创建日期等)。在单个torrent文件里面,可以列出一个或多个文件用于共享。 + +torrent文件内容由BEncode编码为BitTorrent数据序列化格式,因此,要查看torrent文件的内容,你需要相应的解码器。 + +事实上,任何图形化的BitTorrent客户端(如Transmission或uTorrent)都带有BEncode解码器,所以,你可以用它们直接打开来查看torrent文件的内容。然而,如果你不想要使用BitTorrent客户端来检查torrent文件,你可以试试这个命令行torrent查看器,它叫[dumptorrent][1]。 + +**dumptorrent**命令可以使用内建的BEncode解码器打印出torrent文件的详细信息(如,文件名、大小、跟踪器URL、创建日期、信息散列等等)。 + +### 安装DumpTorrent到Linux ### + +要安装dumptorrent到Linux,你可以从源代码来构建它。 + +在Debian、Ubuntu或Linux Mint上: + + $ sudo apt-get install gcc make + $ wget http://downloads.sourceforge.net/project/dumptorrent/dumptorrent/1.2/dumptorrent-1.2.tar.gz + $ tar -xvf dumptorrent-1.2.tar.gz + $ cd dumptorrent-1.2 + $ make + $ sudo cp dumptorrent /usr/local/bin + +在CentOS、Fedora或RHEL上: + + $ sudo yum install gcc make + $ wget http://downloads.sourceforge.net/project/dumptorrent/dumptorrent/1.2/dumptorrent-1.2.tar.gz + $ tar -xvf dumptorrent-1.2.tar.gz + $ cd dumptorrent-1.2 + $ make + $ sudo cp dumptorrent /usr/local/bin + +确保你的搜索路径 PATH 中[包含][2]了/usr/local/bin。 + +### 查看torrent的内容 ### + +要检查torrent的内容,只需要运行dumptorrent,并将torrent文件作为参数执行。这会打印出torrent的概要,包括文件名、大小和跟踪器URL。 + + $ dumptorrent + +![](https://farm8.staticflickr.com/7729/16816455904_b051e29972_b.jpg) + +要查看torrent的完整内容,请添加“-v”选项。它会打印更多关于torrent的详细信息,包括信息散列、片长度、创建日期、创建者,以及完整的声明列表。 + + $ dumptorrent -v + +![](https://farm6.staticflickr.com/5331/17438628461_1f6675bd77_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/view-torrent-file-content-linux.html + +作者:[Dan Nanni][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://dumptorrent.sourceforge.net/ +[2]:http://ask.xmodulo.com/change-path-environment-variable-linux.html diff --git a/published/20150521 Will Ubuntu Linux Hit 200 Million Users This Year.md b/published/20150521 Will Ubuntu Linux Hit 200 Million Users This Year.md new file mode 100644 index 0000000000..e06a6e98bb --- /dev/null +++ b/published/20150521 Will Ubuntu Linux Hit 200 Million Users This Year.md @@ -0,0 +1,38 @@ +Ubuntu会在今年达到2亿用户么? +================================================================================ +距离Mark Shuttleworth表达他的目标“在4年内Ubuntu的用户达到2亿”已经过去了四年零两周。尽管Ubuntu的用户数量在过去的四年中一直在上升,但这个目标目前并未实现,并且看起来不会在今年年底实现。 + +那是2011年5月在[UDS 布达佩斯][1],Shuttleworth表示Ubuntu将在4年内达到2亿用户。 + +![](http://www.phoronix.net/image.php?id=uds_budapest&image=budapest_phoronix_03_show&w=1920) + +上一次我听到Ubuntu有“1千万”用户,但是并没有任何可靠的报道表明Ubuntu的用户数接近2亿。来自Valve最近的统计表明相比于Windows和OS X的用户[使用Linux的游戏用户的比重少于1%][2]。大多数基于Web计量和其他统计方式的数据倾向于表明Linux的用户总数只占很少的部分。 + +撇开桌面版不谈,Ubuntu在过去的四年来至少在云和服务器部署方面得到了大量的占有率,并且被证明是Red Hat Enterprise的有力竞争者。Ubuntu还证明了它对基于ARM的硬件十分友好。当Mark在四年前提出他的目标时,他可能考虑到Ubuntu Phone/Touch会比目前的状况更好。可是Ubuntu Phone/Touch目前仅仅在欧洲和[中国][3]可用,并且[Ubuntu Touch软件依旧在成熟的路上][4],[仍需要大量的关键应用程序方面的工作][5]等。 + +![](http://www.phoronix.net/image.php?id=0x2015&image=shuttleworth_200_million_show&w=1920) + +距离Canonical宣布[Ubuntu不久将登陆5%的PC][6]也已过去了3年。5%的目标是全球的PC装机量,但哪怕再过3年,我依旧很难相信这个目标会实现。至少在美国和欧洲,我仍难以在实体店看到Ubuntu作为预装的系统,主要的网络零售商/OEM厂商仍倾向于在特定的PC型号中提供Linux,比如Chrome OS、Android设备。 + +另一个由开源社区提出的高傲地、落空的目标便是[GNOME将在2010年占有全球桌面市场10%的份额][7]。五年了,没有任何迹象表明他们接近了那10%的里程碑。 + +在今天,您认为Ubuntu用户有多少呢?在未来的几年里,Ubuntu(或者Linux)的用户会有多大增长呢?通过评论来与我们分享您的想法吧。 + +-------------------------------------------------------------------------------- + +via: http://www.phoronix.com/scan.php?page=news_item&px=2015-200-Million-Goal-Retro + +作者:[Michael Larabel][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.michaellarabel.com/ +[1]:http://www.phoronix.com/vr.php?view=16002 +[2]:http://www.phoronix.com/scan.php?page=news_item&px=Steam-April-2015-1-Drop +[3]:http://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-MX4-In-China +[4]:http://www.phoronix.com/scan.php?page=news_item&px=Ubuntu-Calculator-Reboot +[5]:http://www.phoronix.com/scan.php?page=news_item&px=MTgzOTM +[6]:http://www.phoronix.com/scan.php?page=news_item&px=MTA5ODM +[7]:https://www.phoronix.com/scan.php?page=news_item&px=Nzg1Mw \ No newline at end of file diff --git a/published/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md b/published/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md new file mode 100644 index 0000000000..952b673c41 --- /dev/null +++ b/published/20150604 Ubuntu's Juju Now Supports systemd and Google Cloud Platform.md @@ -0,0 +1,29 @@ +Ubuntu下的Juju现在支持systemd和Google Cloud Platform了 +================================================================================ +> Juju已经更新到1.23.3了 + +**Cononical旗下的Ubuntu认证公共云总监Udi Nachmany宣布了juju新版本的发布,一个开源的、解决方案驱动的Ubuntu下的协同工具。** + +根据[声明][1]和官方[发布公告][2],Juju 1.23.3是一个主要版本,它打包了那些你想要在云上扩展和管理的包,而不需太多操作。 + +Juju 1.23.3显著的功能是包含了对GCE的支持,支持systemd初始化系统,支持Ubuntu 15.04(Vivid Vervet),新的好玩的功能和对受限网络的代理支持。 + +另外,juju的发布带来了一个新的样式恢复、新的消息、新的块和实验性地支持Service Leader Elections,还有Ubuntu MAS和AWS上的LXC容器和KVM实例。 + +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) + +-------------------------------------------------------------------------------- + +via: http://linux.softpedia.com/blog/Ubuntu-s-Juju-Now-Supports-systemd-and-Google-Cloud-Platform-483279.shtml + +作者:[Marius Nestor][a] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor +[1]:http://insights.ubuntu.com/2015/06/03/juju-support-for-google-cloud-platform/ +[2]:https://jujucharms.com/docs/devel/reference-release-notes diff --git a/sources/news/20141219 Google Cloud offers streamlined Ubuntu for Docker use.md b/sources/news/20141219 Google Cloud offers streamlined Ubuntu for Docker use.md deleted file mode 100644 index c63c4a78f2..0000000000 --- a/sources/news/20141219 Google Cloud offers streamlined Ubuntu for Docker use.md +++ /dev/null @@ -1,43 +0,0 @@ -Google Cloud offers streamlined Ubuntu for Docker use -================================================================================ -> Ubuntu Core provides a minimal Lightweight Linux environment for running containers - -Google has adopted for use in its cloud a streamlined version of the Canonical Ubuntu Linux distribution tweaked to run Docker and other containers. - -Ubuntu Core was designed to provide only the essential components for running Linux workloads in the cloud. An [early preview edition][1] of it, which Canonical calls "Snappy," was released last week. The new edition jettisoned many of the libraries and programs usually found in general use Linux distributions that were unnecessary for cloud use. - -[ [Get started with Docker][2] using this step-by-step guide to the red-hot open source framework. | Get the latest insight on the tech news that matters from [InfoWorld's Tech Watch blog][3]. ] - -The Google Compute Engine (GCE) [joins Microsoft Azure][4] in supporting the fresh distribution. - -According to Canonical, Ubuntu Core should provide users with an easy way to deploy Docker, an [increasingly lightweight virtualization container][4] that allows users to quickly spin up workloads and easily move them around, even across different cloud providers. - -Google has been an ardent supporter of Docker and container-based virtualization itself. In June, the company [released as open source its software for managing containers][5], called Kubernetes. - -The design of Ubuntu Core is similar to another Linux distribution, CoreOS, [first released a year ago][7]. - -Developed in part by two ex-Rackspace engineers, [CoreOS][8] is a lightweight Linux distribution designed to work in clustered, highly scalable environments favored by companies that do much or all of their business on the Web. - -CoreOS was quickly adopted by many cloud providers, including Microsoft Azure, Amazon Web Services, DigitalOcean and Google Compute Engine. - -Like CoreOS, Ubuntu Core offers an expedited process for updating components, reducing the amount of time that an administrator would need to manually manage them. -如同Coreos一样,Ubuntu内核提供了一个快速引擎来更新组件 --------------------------------------------------------------------------------- - -via: http://www.infoworld.com/article/2860401/cloud-computing/google-cloud-offers-streamlined-ubuntu-for-docker-use.html - -作者:[Joab Jackson][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/Joab-Jackson/ -[1]:http://www.ubuntu.com/cloud/tools/snappy -[2]:http://www.infoworld.com/article/2607941/linux/how-to--get-started-with-docker.html -[3]:http://www.infoworld.com/blog/infoworld-tech-watch/ -[4]:http://www.ubuntu.com/cloud/tools/snappy -[5]:http://www.itworld.com/article/2695383/open-source-tools/docker-all-geared-up-for-the-enterprise.html -[6]:http://www.itworld.com/article/2695501/cloud-computing/google-unleashes-docker-management-tools.html -[7]:http://www.itworld.com/article/2696116/open-source-tools/coreos-linux-does-away-with-the-upgrade-cycle.html -[8]:https://coreos.com/using-coreos/ diff --git a/sources/news/20150130 LibreOffice 4.4 Released as the Most Beautiful LibreOffice Ever.md b/sources/news/20150130 LibreOffice 4.4 Released as the Most Beautiful LibreOffice Ever.md deleted file mode 100644 index 3718ee58a6..0000000000 --- a/sources/news/20150130 LibreOffice 4.4 Released as the Most Beautiful LibreOffice Ever.md +++ /dev/null @@ -1,38 +0,0 @@ -LibreOffice 4.4 Released as the Most Beautiful LibreOffice Ever ----- -*The developer has made a lot of UI improvements* - -![LibreOffice 4.4](http://i1-news.softpedia-static.com/images/news2/LibreOffice-4-4-Releases-As-the-Most-Beautiful-LibreOffice-Ever-471575-2.jpg) - -The Document Foundation has just announced that a new major update has been released for LibreOffice and it brings important UI improvements, enough for them to call this the most beautiful version ever. - -The Document Foundation doesn't usually make the UI the main focus of an update, but now the developers are saying that this is the most beautiful release made so far and that says a lot. Fortunately, this version is not just about interface fixes and there are plenty of other major improvements that should really provide a very good reason to get LibreOffice 4.4. - -LibreOffice has been gaining quite a lot of fans and users, and the past couple of years have been very successful. The office suite is implemented by default in most of the important Linux distributions out there and it was adopted by numerous administrations and companies across the world. LibreOffice is proving to be a difficult adversary for Microsoft's Office and each new version makes it even better. -LibreOffice 4.4 brings a lot of new features - -If we move aside all the improvements made to the interface, we're still left with a ton of fixes and changes. The Document Foundation takes its job very seriously and all upgrades really improve the users' experience tremendously. - -"LibreOffice 4.4 has got a lot of UX and design love, and in my opinion is the most beautiful ever. We have completed the dialog conversion, redesigned menu bars, context menus, toolbars, status bars and rulers to make them much more useful. The Sifr monochrome icon theme is extended and now the default on OS X. We also developed a new Color Selector, improved the Sidebar to integrate more smoothly with menus, and reworked many user interface details to follow today’s UX trends," [says Jan "Kendy" Holesovsky](1), a member of the Membership Committee and the leader of the design team. - -Some of the other improvements include much better support for OOXML file formats, the source code has been "groomed" and cleaned after a Coverity Scan analysis, digital signatures for exported PDF files, improved import filters for Microsoft Visio, Microsoft Publisher and AbiWord files, and Microsoft Works spreadsheets, and much more. - -For now, the PPA doesn't have the latest version, but that should change soon. For the time being, you can download the [LibreOffice 4.4](2) source packages from Softpedia, if you want to compile them yourself. - --------------------------------------------------------------------------------- - -via:http://news.softpedia.com/news/LibreOffice-4-4-Releases-As-the-Most-Beautiful-LibreOffice-Ever-471575.shtml - -本文发布时间:29 Jan 2015, 14:16 GMT - -作者:[Silviu Stahie][a] - -译者:[译者ID](https://github.com/译者ID) - -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/silviu-stahie -[1]:http://blog.documentfoundation.org/2015/01/29/libreoffice-4-4-the-most-beautiful-libreoffice-ever/ -[2]:http://linux.softpedia.com/get/Office/Office-Suites/LibreOffice-60713.shtml \ No newline at end of file diff --git a/sources/news/20150130 OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10.md b/sources/news/20150130 OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10.md deleted file mode 100644 index 552f98e3f2..0000000000 --- a/sources/news/20150130 OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10.md +++ /dev/null @@ -1,33 +0,0 @@ -OpenJDK 7 Vulnerabilities Closed in Ubuntu 14.04 and Ubuntu 14.10 ----- -*Users have been advised to upgrade as soon as possible* - -##Canonical published details about a new OpenJDK 7 version has been pushed to the Ubuntu 14.04 LTS and Ubuntu 14.10 repositories. This update fixes a number of problems and various vulnerabilities. - -The Ubuntu maintainers have upgraded the OpenJDK packages in the repositories and numerous fixes have been implemented. This is an important update and it covers a few libraries. - -"Several vulnerabilities were discovered in the OpenJDK JRE related to information disclosure, data integrity and availability. An attacker could -exploit these to cause a denial of service or expose sensitive data over the network,” reads the security notice. - -Also, "a vulnerability was discovered in the OpenJDK JRE related to information disclosure and integrity. An attacker could exploit this to -expose sensitive data over the network." - -These are just a couple of the vulnerabilities identified and corrected by the developer and implemented by the maintainers/., and for a more detailed description of the problems, you can see Canonical's security notification. Users have been advised to upgrade their systems as soon as possible. - -The flaws can be fixed if you upgrade your system to the latest openjdk-7-related packages specific to each distribution. To apply the patch, users will have to run the Update Manager application. In general, a standard system update will make all the necessary changes. All Java-related applications will have to be restarted. - --------------------------------------------------------------------------------- - -via:http://linux.softpedia.com/blog/OpenJDK-7-Vulnerabilities-Closed-in-Ubuntu-14-04-and-Ubuntu-14-10-471605.shtml - -本文发布时间:29 Jan 2015, 16:53 GMT - -作者:[Silviu Stahie][a] - -译者:[译者ID](https://github.com/译者ID) - -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/silviu-stahie \ No newline at end of file diff --git a/sources/news/20150131 WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux.md b/sources/news/20150131 WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux.md deleted file mode 100644 index 3d132079a4..0000000000 --- a/sources/news/20150131 WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux.md +++ /dev/null @@ -1,49 +0,0 @@ -WordPress Can Be Used to Leverage Critical Ghost Flaw in Linux ------ -*Users are advised to apply available patches immediately* - -![WordPress validating pingback’s post URL](http://i1-news.softpedia-static.com/images/news2/WordPress-Can-Be-Used-to-Leverage-Critical-Ghost-Flaw-in-Linux-471730-2.jpg) - -**The vulnerability revealed this week by security researchers at Qualys, who dubbed it [Ghost](1), could be taken advantage of through WordPress or other PHP applications to compromise web servers.** - -The glitch is a buffer overflow that can be triggered by an attacker to gain command execution privileges on a Linux machine. It is present in the glibc’s “__nss_hostname_digits_dots()” function that can be used by the “gethostbyname()” function. - -##PHP applications can be used to exploit the glitch - -Marc-Alexandre Montpas at Sucuri says that the problem is significant because these functions are used in plenty of software and server-level mechanism. - -“An example of where this could be a big issue is within WordPress itself: it uses a function named wp_http_validate_url() to validate every pingback’s post URL,” which is carried out through the “gethostbyname()” function wrapper used by PHP applications, he writes in a blog post on Wednesday. - -An attacker could use this method to introduce a malicious URL designed to trigger the vulnerability on the server side and thus obtain access to the machine. - -In fact, security researchers at Trustwave created [proof-of-concept](2) code that would cause the buffer overflow using the pingback feature in WordPress. - -##Multiple Linux distributions are affected - -Ghost is present in glibc versions up to 2.17, which was made available in May 21, 2013. The latest version of glibc is 2.20, available since September 2014. - -However, at that time it was not promoted as a security fix and was not included in many Linux distributions, those offering long-term support (LTS) in particular. - -Among the impacted operating systems are Debian 7 (wheezy), Red Hat Enterprise Linux 6 and 7, CentOS 6 and 7, Ubuntu 12.04. Luckily, Linux vendors have started to distribute updates with the fix that mitigates the risk. Users are advised to waste no time downloading and applying them. - -In order to demonstrate the flaw, Qualys has created an exploit that allowed them remote code execution through the Exim email server. The security company said that it would not release the exploit until the glitch reached its half-life, meaning that the number of the affected systems has been reduced by 50%. - -Vulnerable application in Linux are clockdiff, ping and arping (under certain conditions), procmail, pppd, and Exim mail server. - --------------------------------------------------------------------------------- - -via:http://news.softpedia.com/news/WordPress-Can-Be-Used-to-Leverage-Critical-Ghost-Flaw-in-Linux-471730.shtml - -本文发布时间:30 Jan 2015, 17:36 GMT - -作者:[Ionut Ilascu][a] - -译者:[译者ID](https://github.com/译者ID) - -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/ionut-ilascu -[1]:http://news.softpedia.com/news/Linux-Systems-Affected-by-14-year-old-Vulnerability-in-Core-Component-471428.shtml -[2]:http://blog.spiderlabs.com/2015/01/ghost-gethostbyname-heap-overflow-in-glibc-cve-2015-0235.html diff --git a/sources/news/20150202 The Pirate Bay Is Now Back Online.md b/sources/news/20150202 The Pirate Bay Is Now Back Online.md deleted file mode 100644 index acde800ad8..0000000000 --- a/sources/news/20150202 The Pirate Bay Is Now Back Online.md +++ /dev/null @@ -1,38 +0,0 @@ -The Pirate Bay Is Now Back Online ------- -*The website was closed for about seven weeks* -![The Pirate Bay](http://i1-news.softpedia-static.com/images/news2/The-Pirate-Bay-Is-Now-Back-Online-471802-2.jpg) -##After being [raided](1) by the police almost two months ago, (in)famous torrent website The Pirate Bay is now back online. Those who thought the website will never return will be either disappointed or happy given that The Pirate Bay seems to live once again. - -In order to celebrate its coming back, The Pirate Bay admins have posted a Phoenix bird on the front page, which signifies the fact that the website can't be killed only damaged. - -About two weeks after The Pirate Bay was raided the domain miraculously came back to life. Soon after a countdown appeared on the temporary homepage of The Pirate Bay indicating that the website is almost ready for a comeback. - -The countdown hinted to February 1, as the possible date for The Pirate Bay's comeback, but it looks like those who manage the website manage to pull it out one day earlier. - -Beginning today, those who have accounts on The Pirate Bay can start downloading the torrents they want. Other than the Phoenix on the front page there are no other messages that might point to the resurrection The Pirate Bay except for the fact that it's now operational. - -Admins of the website said a few weeks ago they will find ways to manage and optimize The Pirate Bay, so that there will be minimal chances for the website to be closed once again. Let's see how it lasts this time. - -##Another version of The Pirate Bay may be launched soon - -In related news, one of the members of the original staff was dissatisfied with the decisions made by the majority regarding some of the changes made in the way admins interact with the website. - -He told [Torrentfreak](2) earlier this week that he, along with a few others, will open his version of The Pirate Bay, which they claim will be the "real" one. - ------- -via:http://news.softpedia.com/news/The-Pirate-Bay-Is-Now-Back-Online-471802.shtml - -本文发布时间:31 Jan 2015, 22:49 GMT - -作者:[Cosmin Vasile][a] - -译者:[译者ID](https://github.com/译者ID) - -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/cosmin-vasile -[1]:http://news.softpedia.com/news/The-Pirate-Bay-Is-Down-December-9-2014-466987.shtml -[2]:http://torrentfreak.com/pirate-bay-back-online-150131/ \ No newline at end of file diff --git a/sources/news/20150205 Debian Forked over systemd--Birth of Devuan GNU or Linux Distribution.md b/sources/news/20150205 Debian Forked over systemd--Birth of Devuan GNU or Linux Distribution.md deleted file mode 100644 index 89299a55d5..0000000000 --- a/sources/news/20150205 Debian Forked over systemd--Birth of Devuan GNU or Linux Distribution.md +++ /dev/null @@ -1,98 +0,0 @@ -Debian Forked over systemd: Birth of Devuan GNU/Linux Distribution -================================================================================ -Debian GNU/Linux distribution is one of the oldest Linux distribution that is currently in working state. init used to be the default central management and configuration platform for Linux operating system before systemd emerged. Systemd from the date of its release has been very much controversial. - -Sooner or later it has replaced init on most of the Linux distribution. Debian remained no exception and Debian 8 codename JESSIE will be having systemd by default. The Debian adaptation of systemd in replacement of init caused polarization. This led to forking of Debian and hence Devuan GNU/Linux distribution born. - -Devuan project started with the primary goal to put back nit and remove controversial systemd. A lot of Linux Distribution are based on Debian or a derivative of Debian and one does not simply fork Debian. Debian will always attract developers. - -### What Devuan is all About? ### - -Devuan in Italian (pronounced Devone in English) suggests “Don’t panic and keep forking Debian”, for Init-Freedom lovers. Developers see Devuan as the beginning of a process which aims at base distribution and is able to protect the freedom of developers and community. - -![Devuan Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Devuan-Linux.jpg) - -Debian Forked over systemd: Birth of Devuan Linux - -Devuan project priority includes – interoperability, diversity and backward compatibility. It will derive its own installer and repos from Debian and modify where ever required. If everything works smooth by the mid of 2015 users can switch to Devuan from Debian 7 and start using devuan repos. - -The process of switching will fairly remain as simple as upgrading a Debian installation. The project will be as minimal as possible and completely in accordance of UNIX philosophy – “Doing one thing and doing it well”. The targeted users of Devuan will be System Admins, Developers and users having experience of Debian. - -The project started by italian developers has raised a fund of 4.5k€ (EUR) in the year 2014. They have moved distro infrastructure from GitHub to GitLab, progress on Loginkit (systemd Logind replaced), discussing Logo and other important aspects useful in long run. - -A few of the Logos are in discussion now are shown in the picture. - -![Devuan Logo Proposals](http://www.tecmint.com/wp-content/uploads/2015/02/Devuan-Logos.jpeg) - -Devuan Logo Proposals - -Have a look at them here at: [http://without-systemd.org/wiki/index.php/Category:Logo][1] - -The unrest over systemd that gave birth to Devuan is good or bad? Lets have a look. - -### Is Devuan fork a good thing? ### - -Well! difficult to answer that forking such a huge distro is really going to be of any good. A (group of) developer(s) who initially were working with Debian got unsatisfied with systemd and forked it. - -Now the actual number of developers working on Debian/Systemd decreased which is going to affect the productivity of both the projects. Now the same number of developers are working on two different projects. - -What you think would be the fate of Devuan as well as Debian project? Won’t it hinder the progress of either distro and Linux in the long run? - -Please give your [comments][2] about Devuan project. - -注:如果可以在发布文章的时候发布一个调查,就把下面这段发成一个调查,如果不行,就直接嵌入js代码 - - - -Do you think systemd for Debian is - -Good -Bad -Don't Know -Don't Care -Other: - -VoteView ResultsPolldaddy.com - - -**Do you really feel that Debian with systemd will have a bad fate as depicted below** - -![Strip SystmeD](http://www.tecmint.com/wp-content/uploads/2015/02/Strip-SystmeD.jpg) - -Strip SystmeD - -Time to wait for Devuan 1.0 and lets see what it could contain. - -### Conclusion ### - -All the major Linux Distributions Like Fedora, RedHat, openSUSE, SUSE Enterprise, Arch, Megia have already switched to Systemd, Ubuntu and Debian are in the way to replace init with systemd. Only Gentoo and Slack till date have shown no interest in systemd but who knows someday even Gentoo and slack too started moving in the same direction. - -The reputation of Debian as a Linux Distro is something very few have reached the mark. It is blessed by some hundreds of developers and millions of users. The actual question is what percentage of users and developers were not comfortable with systemd. If the percentage is really high then what led debian to switch to systemd. Had it moved against the wishes of its users and developers. If this is the case the chance of success of devuan is pretty fair. Well how many developers put long hours of code punching for the project. - -Hope the fate of this project will not be something like those distros which once was started with high degree of passion and enthusiasm and later the developers got uninterested. - -Post Script : Linus Torvalds do not mind systemd that much. - -**If you need Devuan, then join and support it now!** - -Development : [https://git.devuan.org][3] -Donations : [https://devuan.org/donate.html][4] -Discussions : [https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng][5] -Devuan Developers : onelove@devuan.org - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/debian-forked-over-systemd-birth-of-devuan-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://without-systemd.org/wiki/index.php/Category:Logo -[2]:http://www.tecmint.com/debian-forked-over-systemd-birth-of-devuan-linux/#comments -[3]:https://git.devuan.org/ -[4]:https://devuan.org/donate.html -[5]:https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng \ No newline at end of file diff --git a/sources/news/20150207 BQ and Canonical Officially Launch Aquaris E4.5 Ubuntu Edition, the First Ubuntu Phone.md b/sources/news/20150207 BQ and Canonical Officially Launch Aquaris E4.5 Ubuntu Edition, the First Ubuntu Phone.md deleted file mode 100644 index 02b147abd9..0000000000 --- a/sources/news/20150207 BQ and Canonical Officially Launch Aquaris E4.5 Ubuntu Edition, the First Ubuntu Phone.md +++ /dev/null @@ -1,45 +0,0 @@ -BQ and Canonical Officially Launch Aquaris E4.5 Ubuntu Edition, the First Ubuntu Phone ------- -*Everything you need to know about Aquaris E4.5* - -##BQ and Canonical have officially announced the new Aquaris E4.5 Ubuntu Edition and the fact that the phone will be available in the coming weeks through a series of flash sales. - -Information about the imminent launch of BQ Ubuntu phone has been around for some time and now it the two companies seem to have decided to make it official. This is the first device powered by Ubuntu Touch and a lot of people will be paying very close attention to what is happening in the mobile world. - -Ubuntu Touch is the latest operating system from Canonical and it's a brand new experience that aims to be very different from what users can find right now on the market, and that includes systems like Jola or Firefox OS. The OS has been in the works for more than two years and it's a system designed to work on all kind of devices, across the hardware spectrum. - -##Who is BQ and why has Canonical chosen them? - -When Mark Shuttleworth announced the two partners for the launch of Ubuntu Touch, BQ and Meizu, most of the people watching asked the same question. Who? BQ is not a very big company, but it's a young company and it has already started to penetrate the European market with some interesting devices. In many ways, they are doing the same thing companies like Meizu or Xiaomi are trying and succeeded in China: to offer devices that are interesting and different from what everyone else is doing. - -Many Ubuntu fans have questioned Canonical’s decision of choosing small companies and not big ones, but they are trying to do the same thing as the just-mentioned hardware makers. They want to offer an operating system radically different from what everyone else is doing. It's easy to understand why the goals of Canonical and BQ are actually one and the same. - -##What is Ubuntu Touch? - -The new operating system developed by Canonical embraces the fact that people are now swiping a lot more than they are tapping. Smartphones are no longer something new and everyone can understand how to swipe and get things done on a phone. Ubuntu devs have taken this to a whole new level. The operating system has no buttons, with the exception of the regular power and volume buttons. Everything is done with swiped gestures, from all sides of the screen. - -Also, Ubuntu Touch brings a new concept to the market, that of scopes. There is no longer a home screen, just scopes defined by the user to expand the experience. For example, you can have a Music scope that aggregates all your music sources on a single screen. It's a different way of looking at your smartphone, but this is built for people who crave a new experience. Don't worry, regular apps still exist, but they are differently integrated. - -![Aquaris E4.5 Ubuntu Edition start screen](http://i1-news.softpedia-static.com/images/news2/BQ-and-Canonical-Officially-Launch-Aquaris-E4-5-Ubuntu-Edition-472397-5.jpg) - -"As any kind of content can be presented via Scopes - they provide developers an easy path for their creations to be integral to the device experience. It is simple to create new Scopes via an easy to use UI toolkit with much lower development and maintenance costs than traditional apps. Canonical and BQ have worked with a host of partners to ensure that there is a wealth of interesting, relevant and dynamic content available at launch, with more content partners to follow," said Cristian Parrino, VP Mobile at Canonical. - -##BQ’s Aquaris E4.5 Ubuntu Edition hardware specs - -First of all, it's important to know that Aquaris E4.5 Ubuntu Edition is a dual-sim phone and it comes unlocked so that everyone can use it with their network. It boasts a MediaTek Quad-Core Cortex A7 processor running at up to 1.3 GHz, a 4.5-inch screen, 1GB RAM, rear camera with high-quality BSI sensors, Largan lens, and autofocus with dual flash(8MP), and front camera with 5MP. - -It's also worth mentioning that several operators in Europe, including 3 Sweden, amena.com, giffgaff, and Portugal Telecom have decided to provide SIM bundles at purchase. The price is €169.90 ($191). - -So, are you ready to buy the Aquaris E4.5 Ubuntu Edition? - --------------------------------------------------------------------------------- - -via: http://news.softpedia.com/news/BQ-and-Canonical-Officially-Launch-Aquaris-E4-5-Ubuntu-Edition-472397.shtml - -作者:[Silviu Stahie][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://news.softpedia.com/editors/browse/silviu-stahie \ No newline at end of file diff --git a/sources/share/20140804 Group Test--Linux Text Editors.md b/sources/share/20140804 Group Test--Linux Text Editors.md deleted file mode 100644 index b1f2846a0e..0000000000 --- a/sources/share/20140804 Group Test--Linux Text Editors.md +++ /dev/null @@ -1,318 +0,0 @@ -Group Test: Linux Text Editors -================================================================================ -> Mayank Sharma tests five supercharged text editors that can crunch more than just words. - -If you’ve been using Linux long, you know that whether you want to edit an app’s configuration file, hack together a shell script, or write/review bits of code, the likes of LibreOffice just won’t cut it. Although the words mean almost the same thing, you don’t need a word processor for these tasks; you need a text editor. - -In this group test we’ll be looking at five humble text editors that are more than capable of heavy-lifting texting duties. They can highlight syntax and auto-indent code just as effortlessly as they can spellcheck documents. You can use them to record macros and manage code snippets just as easily as you can copy/paste plain text. - -Some simple text editors even exceed their design goals thanks to plugins that infuse them with capabilities to rival text-centric apps from other genres. They can take on the duties of a source code editor and even an Integrated Development Environment. - -Two of most popular and powerful plain text editors are Emacs and Vim. However, we didn’t include them in this group test for a couple of reasons. Firstly, if you are using either, congratulations: you don’t need to switch. Secondly, both of these have a steep learning curve, especially to the GUI-oriented desktop generation who have access to alternatives that are much more inviting. - -### The contenders: ### - -#### Gedit #### - -- URL:http://projects.gnome.org/gedit/ -- Version: 3.10 -- Licence: GPL -- Is Gnome’s default text editor up to the challenge? - -#### Kate #### - -- URL: www.kate-editor.org -- Version: 3.11 -- Licence: LGPL/GPL -- Will Kate challenge fate? - -#### Sublime Text #### - -- URL: www.sublimetext.com -- Version: 2.0.2 -- Licence: Proprietary -- Proprietary software in the land of free with the heart of gold. - -#### UltraEdit #### - -- URL: www.ultraedit.com -- Version: 4.1.0.4 -- Licence: Proprietary -- Does it do enough to justify its price? - -#### jEdit #### - -- URL: www.jedit.org -- Version: 5.1.0 -- Licence: GPL -- Will the Java-based editor spoil the party for the rest? - -![There’s a fine balance between stuffing an app with features and exposing all of them to the user. Geddit keeps most of its features hidden.](http://www.linuxvoice.com/wp-content/uploads/2014/07/gedit-web.png) -There’s a fine balance between stuffing an app with features and exposing all of them to the user. Geddit keeps most of its features hidden. - -### The crucial criteria ### - -All the tools, except Gedit and jEdit, were installed on Fedora and Ubuntu via their recommended installation method. The former already shipped with the default Gnome desktop and the latter stubbornly refused to install on Fedora. Since these are relatively simple apps, they have no esoteric dependencies, the only exception being jEdit, which requires Oracle Java. - -Thanks to the continued efforts of both Gnome and KDE, all editors look great and function properly irrespective of the desktop environment they are running on. That not only rules it out as an evaluation criterion, it also means that you are no longer bound by the tools that ship with your favourite desktop environment. - -In addition to their geekier functionality, we also tested all our candidates for general-purpose text editing. However, they are not designed to mimic all the functionality of a modern-day word processor and weren’t evaluated as such. - -![Kate can double up as a versatile can capable integrated development environment (IDE).](http://www.linuxvoice.com/wp-content/uploads/2014/08/kate-web.png) - -Kate can double up as a versatile can capable integrated development environment (IDE). - -### Programming language support ### - -UltraEdit does syntax highlighting, can fold code and has project management capabilities. There’s also a function list, which is supposed to list all the functions in the source file, but it didn’t work for any of our test code files. UltraEdit also supports HTML5, and has a HTML toolbar with which you can add commonly-used HTML tags. - -Even Gnome’s default text editor, Gedit, has several code-oriented features such as bracket matching, automatic indentation, and will also highlight syntax for various programming languages including C, C++, Java, HTML, XML, Python, Perl, and many others. - -If you’re looking for more programming assistance, look at Sublime and Kate. Sublime supports several programming languages and (as well as the popular ones) is able to highlight syntax for C#, D, Dylan, Erlang, Groovy, Haskell, Lisp, Lua, MATLAB, OCaml, R, and even SQL. If that isn’t enough for you, you can download add-ons to support even more languages. - -Furthermore, its syntax highlighting ability offers several customisable options. The app will also match braces, to ensure they are all properly rounded off, and the auto-complete function in Sublime works with variables created by the user. - -Just like Komodo IDE, sublime also displays a scrollable preview of the full source code, which is really handy for navigating long code files and lets you jump between different parts of the file. - -One of the best features of Sublime is its ability to run code for certain languages like C++, Python, Ruby, etc from within the editor itself, assuming of course you have the compiler and other build system tools installed on your computer. This helps save time and eliminates the need to switch out to the command line. - -You can also enable the build system in Kate with plugins. Furthermore, you can add a simple front-end to the GDB debugger. Kate will work with Git, Subversion and Mercurial version control systems, and also provides some functionality for project management. - -It does all this in addition to highlighting syntax for over 180 languages, along with other assistance like bracket matching, auto-completion and auto-indentation. It also supports code folding and can even collapse functions within a program. - -The only disappointment is jEdit, which bills itself as a programmer’s text editor, but it struggled with other basic functions such as code folding and wouldn’t even suggest or complete functions. - -**Verdict:** - -- Gedit:3/5 -- Kate:5/5 -- Sublime:5/5 -- UltraEdit3/5 -- jEdit:1/5 - -![If you don’t like Sublime’s Charcoal appearance, you can choose one of the other 22 themes included with ti.](http://www.linuxvoice.com/wp-content/uploads/2014/08/sublime-web.png) - -If you don’t like Sublime’s Charcoal appearance, you can choose one of the other 22 themes included with ti. - -### Keyboard control ### - -Users of an advanced text editor expect to control and operate it exclusively via the keyboard. Furthermore, some apps even allow their users to further customise the key bindings for the shortcuts. - -You can easily work with Gedit using its extensive keyboard shortcut keys. There are keys for working with and editing files as well as invoke tools for common tasks such as spellchecking a document. You can access a list of default shortcut keys from within the app, but there’s no graphical way to customise them. Similarly, to customise the keybindings in Sublime, you need to make modifications in its XML keymap files. Sublime has been criticised for its lack of a graphical interface to define keyboard shortcuts, but long-term users have defended the current file-based mechanism, which gives them more control. - -UltraEdit is proud of its “everything is customisable” motto, which it extend to keyboard shortcuts. You can define custom hotkeys for navigating the menus and also define your own multi-key key-mappings for accessing its plethora of functions. - -In addition to its fully customisable keyboard shortcuts, jEdit also has pre-defined keymaps for Emacs. Kate is equally impressive in this respect. It has an easily accessible window to customise the key bindings. You can change the default keys, as well as define alternate ones. Furthermore, Kate also has a Vi mode which will let users operate Kate using Vi keys. - -**Verdict:** - -- Gedit:2/5 -- Kate:5/5 -- Sublime:3/5 -- UltraEdit:4/5 -- jEdit:5/5 - -### Snippets and macros ### - -Macros help you cut down the time spent on editing and organising data by automating repetitive steps, while Snippets of code extend a similar functionality to programmers by creating reusable chunks of source code. Both have the ability to save you time. - -The vanilla Gedit installation doesn’t have either of these functionalities, but you can enable them via separate plugins. While the Snippets plugin ships with Gedit, you’ll have to manually download and install the macro plugin (it’s called gedit-macropy and is hosted on GitHub) before you can enable it from within Gedit. - -Kate takes the same plugins route to enable the snippets feature. Once added, the plugin also adds a repository of snippets for PHP, Bash and Java. You can display the list of snippets in the sidebar for easier access. Right-click on a snippet to edit its contents as well as its shortcut key combination. However, very surprisingly, it doesn’t support macros – despite repeated hails from users since 2002! - -jEdit too has a plugin for enabling snippets. But it can record macros from user actions and you can also write them in the BeanShell scripting language (BeanShell supports scripted objects as simple method closures like those in Perl and JavaScript). jEdit also has a plugin that will download several macros from jEdit’s website. - -Sublime ships with inbuilt ability to create both snippets and macros, and ships with several snippets of frequently used functions for most popular programming languages. - -Snippets in UltraEdit are called Smart Templates and just like with Sublime you can insert them based upon the kind of source file you’re editing. To complement the Macro recording function, UltraEdit also has an integrated javascript-based scripting language to automate tasks. You can also download user-submitted macros and scripts from the editor’s website. - -**Verdict:** - -- Gedit:3/5 -- Kate:1/5 -- Sublime:5/5 -- UltraEdit:5/5 -- jEdit:5/5 - -![UltraEdit’s UI is highly configurable — you can customise the layout of the toolbars and menus just as easily as you can change many other aspects.](http://www.linuxvoice.com/wp-content/uploads/2014/08/ultraedit-web.png) - -UltraEdit’s UI is highly configurable — you can customise the layout of the toolbars and menus just as easily as you can change many other aspects. - -### Ease of use ### - -Unlike a bare-bones text editor, the text editors in this feature are brimming with features to accommodate a wide range of users — from document writers to programmers. Instead of stripping features from the apps, their developers are looking for avenues to add more functionality. - -Although at first glance most apps in this group test have a very similar layout, upon closer inspection, you’ll notice several usability differences. We have a weak spot for apps that expose their functionality and features by making judicious use of the user interface, instead of just overwhelming the user. - -### Gedit: 4/5 ### - -Gedit wears a very vanilla look. It has an easy interface with minimal menus and buttons. This is a two-edged sword though, as some users might fail to realise its true potential. - -The app can open multiple files in tabs that can be rearranged and moved between windows. Users can optionally enable panels on the side and bottom for displaying a file browser and the output of a tool enabled by a plugin. The app will detect when an open file is modified by another application and offers to reload that file. - -The UI has been given a major overhaul in the latest version of the app yet to make its way into Gnome. However it isn’t yet stable, and while it maintains all features, several plugins that interact with the menu will need to be updated. - -### Kate: 5/5 ### - -Although a major part of its user interface resembles Gedit, Kate tucks in tabs at either side and its menus are much fuller. The app is approachable and invites users to explore other features. - -Kate can transparently open and save files over all protocols supported by KDE’s KIO including HTTP, FTP, SSH, SMB and WebDAV. You can use the app to work with multiple files at the same time. But unlike the traditional horizontal tab switching bar in most app, Kate has tabs on either side of the screen. The left sidebar will display an index of open files. Programmers who need to see different parts of the same file at the same time will also appreciate its ability to split the interface horizontally as well as vertically. - -### Sublime: 5/5 ### - -Sublime lets you view up to four files at the same time in various arrangements. There’s also a full-screen distraction free mode that just displays the file and the menu, for when you’re in the zone. - -The editor also has a minimap on the right, which is useful for navigating long files. The app ships with several snippets for popular functions in several programming languages, which makes it very usable for developers. Another neat editing feature, whether you are working with text documents or code, is the ability to swap and shuffle selections. - -### UltraEdit: 3/5 ### - -UltraEdit’s interface is loaded with several toolbars at the top and bottom of the interface. Along with the tabs to switch between documents, panes on either side and the gutter area, these leave little room for the editor window. - -Web developers working with HTML files have lots of assistance at their fingertips. You can also access remote files via FTP and SFTP. Advanced features such as recording a macro and comparing files are also easily accessible. - -Using the app’s Preferences window you can tweak various aspects of the app, including the colour scheme and other features like syntax highlighting. - -### jEdit: 3/5 ### - -In terms of usability, one of the first red-flags was jEdit’s inability to install on RPM-based distros. Navigating the editor takes some getting used to, since its menus aren’t in the same order as in other popular apps and some have names that won’t be familiar to the average desktop user. However, the app include detailed inbuilt help, which will help ease the learning curve. - -jEdit highlights the current line you are on and enables you to split windows in multiple viewing modes. You can easily install and manage plugins from within the app, and in addition to full macros, jEdit also lets you record quick temporary ones. - -![Thanks to its Java underpinnings, jEdit doesn’t really feel at home on any desktop environment](http://www.linuxvoice.com/wp-content/uploads/2014/08/jedit-web.png) - -Thanks to its Java underpinnings, jEdit doesn’t really feel at home on any desktop environment - -### Availability and support ### - -There are several similarities between Gedit and Kate. Both apps take advantage of their respective parent project, Gnome and KDE, and are bundled with several mainstream distros. Yet both projects are cross-platform and have Windows and Mac OS X ports as well as native Linux versions. - -Gedit is hosted on Gnome’s web infrastructure and has a brief user guide, information about the various plugins, and the usual channels of getting in touch including a mailing list and IRC channel. You’ll also find usage information on the websites of other Gnome-based distros such as Ubuntu. Similarly, Kate gets the benefit of KDE’s resources and hosts detailed user information as well as a mailing list and IRC channel. You can access their respective user guides offline from within the app as well. - -UltraEdit is also available for Windows and Mac OS X besides Linux, and has detailed user guides on getting started, though there’s none included within the app. To assist users, UltraEdit hosts a database of frequently asked questions, a bunch of power tips that have detailed information about several specific features, and users can engage with one another other on forum boards. Additionally, paid users can also seek support from the developers via email. - -Sublime supports the same number of platforms, however you don’t need to buy a separate licence for each platform. The developer keeps users abreast with ongoing development via a blog and also participates actively in the hosted forums. The highlight of the project’s support infrastructure is the freely available detailed tutorial and video course. Sublime is lovely. - -Because it’s written in Java, jEdit is available on several platforms. On its website you’ll find a detailed user guide and links to documentation of some plugins. However, there are no avenues for users to engage with other users or the developer. - -**Verdict:** - -- Gedit: 4/5 -- Kate: 4/5 -- Sublime: 5/5 -- UltraEdit: 3/5 -- jEdit: 2/5 - -### Add-on and plugins ### - -Different users have different requirements, and a single lightweight app can only do as much. This is where plugins come into the picture. The apps rely on these small pluggable widgets to extend their feature set and be of use to even more number of users. - -The one exception is UltraEdit. The app has no third-party plugins, but its developers do point out that third-party tools such as HtmlTidy are already installed with UltraEdit. - -Gedit ships with a number of plugins installed, and you can download more with the gedit-plugins package. The project’s website also points to several third-party plugins based on their compatibility with the Gedit versions. - -Three useful plugins for programmers are Code Comment, Terminal Plugin, which adds a terminal in the bottom panel, and the Session Saver. The Session Saver is really useful when you’re working on a project with multiple files. You can open all the files in tabs, save your session and when you restore it with a single click it’ll open all the files in the same tab order as you saved them. - -Similarly, you can extend Kate by adding plugins using its built-in plugin manager. In addition to the impressive projects plugins, some others that will be of use to developers include an embedded terminal, ability to compile and debug code and execute SQL queries on databases. - -Plugins for Sublime are written in Python, and the text editor includes a tool called Package Control, which is a little bit like apt-get in that it enables the user to find, install, upgrade and remove plugin packages. With plugins, you can bring the Git version control to Sublime, as well as the JSLint tool to improve JavaScript. The Sublime Linter plugin is a must have for coders and will point out any errors in your code. - -jEdit boasts the most impressive plugin infrastructure. The app has over 200 plugins, which can be browsed in the dedicated site of their own. The website lists plugins under various categories such as File Management, Version Control, Text, etc. You’ll find lots of plugins housed under each category. - -Some of the best plugins are the Android plugin, which provides utilities to work on Android projects; the TomcatSwitch plugin, using which you can create and control an external Jakarta Tomcat server process; and the Vimulator plugin, for Vi-like capabilities. You can install these plugins using jEdit’s using its plugin manager. - -**Verdict** - -- Gedit: 3/5 -- Kate: 4/5 -- Sublime: 4/5 -- UltraEdit: 1/5 -- jEdit: 5/5 - -### Plain ol’ text editing ### - -Despite all their powerful extra-curricular activities that might even displace full-blown apps across several genres, there will be times when you just need to use these text editing behemoths to read, write, or edit plain and simple text. While you can use all of them to enter text, we are evaluating them for access to common text-editing conveniences. - -Gedit which is Gnome’s default text editor, supports an undo and redo mechanism as well as search and replace. It can spellcheck documents in multiple languages and can also access and edit remote files using Gnome GVFS libraries. - -You can spellcheck documents with Kate as well, which also lets you perform a Google search on any highlighted text. It’s also got a line modification system which visually alerts users of lines which have modified and unsaved changes in a file. In addition, it enables users to set bookmarks within a file to ease navigation of lengthy documents. - -Sublime has a wide selection of editing commands, such as indenting text and formatting paragraphs. Its auto-save feature helps prevent users from losing their work. Advanced users will appreciate the regex-based recursive find and replace feature, as well as the ability to select multiple non-contiguous spans of text and act on them collectively. - -UltraEdit also enables the use of regular expressions for its search and replace feature and can edit remote files via FTP. One unique feature of jEdit is its support for an unlimited number of clipboard which it calls registers. You can copy snippets of text to these registers which are available across editing sessions. - -**Verdict:** - -- Gedit: 4/5 -- Kate: 5/5 -- Sublime: 5/5 -- UltraEdit: 4/5 -- jEdit: 4/5 - -### Our verdict ### - -All the editors in this feature are good enough to replace your existing text editor for editing text files and tweaking configuration files. In fact, chances are they’ll even double up as your IDE. These apps are chock full of bells and whistles, and their developers aren’t thinking of stripping features, but adding more and more and more. - -At the tail end of this test we have jEdit. Not only does it insist on using the proprietary Oracle Java Runtime Environment, it failed to install on our Fedora machine, and the developer doesn’t actively engage with its users. - -UltraEdit does little better. This commercial proprietary tool focuses on web developers, and doesn’t offer anything to non-developer power users that makes it worth recommending over free software alternatives. - -On the third podium position we have Gedit. There’s nothing inherently wrong with Gnome’s default editor, but despite all its positive aspects, it’s simply outclassed by Sublime and Kate. Out of the box, Kate is a more versatile editor than Gedit, and outscores Gnome’s default editor even after taking their respective plugin systems into consideration. - -Both Sublime and Kate are equally good. They performed equally well in most of our tests. Whatever ground it lost to Sublime for not supporting macros, it gained for its keyboard friendliness and its ease of use in defining custom keybindings. - -Kate’s success can be drawn from the fact that it offers the maximum number of features with minimal learning curve. Just fire it up and use it as a simple text editor, or easily edit configuration file with syntax highlighting, or even use it to collaborate and work on a complex programming project thanks to its project management capabilities. - -We aren’t pitching Kate to replace a full-blown integrated development environment such as [insert your favourite specialised tool here]. But it’s an ideal all-rounder and a perfect stepping stone to a specialised tool. - -Kate is designed for moments when you need something that’s quick to respond, doesn’t overwhelm you with its interface and is just as useful as something that might otherwise be overkill. - -### 1st Kate ### - -- Licence LGPL/GPL Version 3.11 -- www.kate-editor.org -- The ultimate mild-mannered text editor with super powers. -- Kate is one of the best apps to come out of the KDE project. - -### 2nd Sublime Text ### - -- Licence Proprietary Version 2.0.2 -- www.sublimetext.com -- A professionally done text editor that’s worth every penny – easy to use, full of features and it looks great. - -### 3rd Gedit ### - -- Licence GPL Version 3.10 -- http://projects.gnome.org/gedit -- Gets it done from Gnome. It’s a wonderful text editor and does an admirable job, but the competition here is too great. - -### 4th UltraEdit ### - -- Licence Proprietary Version 4.1.0.4 -- www.ultraedit.com -- Focuses on bundling conveniences for web developers without offering anything special for general users. - -### 5th jEdit ### - -- Licence GPL Version 5.1.0 -- www.jedit.org -- A lack of support, lack of working on Fedora and a lack of looking nice relegate jEdit to the bottom slot. - -### You may also wish to try… ### - -The default text editor that ships with your distro will also be able to assist you with some advanced tasks. There’s KDE’s KWrite and Raspbian’s Nano, for instance. KWrite inherits some of Kate’s features thanks to KDE’s katepart component, and Nano has sprung back into limelight thanks to its availability for Raspberry Pi. - -If you wish to follow the steps of Linux gurus, you could always try the revered text editors Emacs and Vim. First time users who want to get a taste for the power of Vim might want to consider gVim, which exposes Vim’s power via a graphical interface. - -Besides jEdit and Kate, there are other editors that mimic the usability of veteran advanced editors like Emacs and Vim, such as the JED editor and Joe’s Own Editor, both of which have an emulation mode for Emacs. On the other hand, if you are looking for lightweight code editors check out Bluefish and Geany. They exist to fill the niche between text editors and full-fledged integrated development platforms. - --------------------------------------------------------------------------------- - -via: http://www.linuxvoice.com/text-editors/ - -作者:[Ben Everard][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.linuxvoice.com/author/ben_everard/ \ No newline at end of file diff --git a/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md b/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md index 42b2700b49..b54a7b158f 100644 --- a/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md +++ b/sources/share/20141013 Compact Text Editors Great for Remote Editing and Much More.md @@ -1,4 +1,5 @@ -(translating by runningwater) +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. @@ -217,4 +218,4 @@ via: http://www.linuxlinks.com/article/20141011073917230/TextEditors.html [2]:http://www.vim.org/ [3]:http://ne.di.unimi.it/ [4]:http://www.gnu.org/software/zile/ -[5]:http://nano-editor.org/ \ No newline at end of file +[5]:http://nano-editor.org/ diff --git a/sources/share/20141106 Exaile 3.4.1 Overview--A Feature-Complete GNOME Music Player.md b/sources/share/20141106 Exaile 3.4.1 Overview--A Feature-Complete GNOME Music Player.md deleted file mode 100644 index cd650fca22..0000000000 --- a/sources/share/20141106 Exaile 3.4.1 Overview--A Feature-Complete GNOME Music Player.md +++ /dev/null @@ -1,75 +0,0 @@ -Exaile 3.4.1 Overview – A Feature-Complete GNOME Music Player -================================================================================ -**Exaile** has been a bit quiet in the past two years with maybe only one or two stable releases, but nevertheless, it’s one of the full-featured music players for GNOME which are on par with applications like [Rhythmbox][1] or [Banshee][2] in terms of features. However, over the past two months a new stable release, 3.4, has been put out under the slogan “We’re not dead yet”, as well as an incremental 3.4.1 release, which shipped on November 1. To be honest, Exaile has so many features that I could go on writing a lot more than an article to cover them all, so let’s have a look at some of the most notable ones. - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile02.jpg) - -[Exaile][3] is a GTK2-based music player written in Python which fits well into GNOME, has an interface which pretty much resembles the one of the old Amarok 1.4 or actual Clementine, and ships with some great features. The interface is composed mainly of two panels, both with support for tabs. The left panel provides access to the collection, Internet radio, smart and custom playlists, file browser, podcasts, Group Tagger and lyrics while the main area of the window is taken by the playlists (with multiple, tabbed playlist support) and control buttons. - -Exaile’s interface is very similar to the one of Clementine or Amarok 1.4 and the tabs on the left can be shown or hidden: - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile04.jpg) - -Version 3.4 shipped with a big number of major new features and changes while 3.4.1 was a small bug fix release. The major new features in 3.4 include new plugins like Icecast, Lyricsmania, Playlist Analyzer, Soma.fm, a new, simpler plugin API. Changes were done to the user interface and the general behavior as well, with the possibility to show playlists in multiple panels, close left panels, better BPM UI integration. - -The first time it starts you can add music folders to the collection – you can also choose to add directories and enable or disable monitoring or scanning them at start-up: - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile01.jpg) - -Exaile’s features are practically countless. You can organize your music in a collection, listen to podcasts, set song ratings, edit tags, view file properties, queue tracks, view lyrics and covers, sort the playlist by a huge number of criteria, change playback behavior or appearance style. - -Equalizer, cover manager and listening to Internet radio: - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile05.jpg) - -Local album covers are detected automatically and can be shown in full size, with the possibility to zoom in or out: - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile03.jpg) - -The preferences window allows to configure various aspects of Exaile, including enable or disable plugins, appearance, system tray integration, or playback. The appearance settings will allow you to change the tabs placement, show/hide the tab bar, enable or disable transparency, or disable the start-up splash screen. - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_preferences_01.jpg) - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_preferences_02.jpg) - -The system tray integration offers a menu to quickly play/pause songs, set a song rating or change the way the playlist handles playback (shuffle, repeat or dynamic). - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_tray.jpg) - -![](http://www.tuxarena.com/wp-content/uploads/2014/11/exaile_tray.jpg) - -The countless features in Exaile I believe make it the perfect choice as a music player, especially for GNOME users. Any user should be satisfied with the wealth of options and the highly configurable approach. - -### Install Exaile 3.4.1 in Ubuntu 14.04 and 14.10 ### - -Compiling and installing from source should be pretty straightforward. First, get the dependencies: - - sudo apt-get build-dep exaile - sudo apt-get install python-gst0.10 - -Download the source tarball from the [downloads page][4] (direct link [here][5]), then uncompress it: - - tar -xf exaile-3.4.1.tar.gz - -Change the working directory to exaile-3.4.1 and issue the following commands: - - make - sudo make install - -The binary will be installed as **/usr/local/bin/exaile**. - --------------------------------------------------------------------------------- - -via: http://www.tuxarena.com/2014/11/exaile-3-4-1-overview-a-feature-complete-gnome-music-player/ - -作者:Craciun Dan -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:https://wiki.gnome.org/Apps/Rhythmbox -[2]:http://banshee.fm/ -[3]:http://www.exaile.org/ -[4]:http://www.exaile.org/download/ -[5]:https://github.com/exaile-dev/exaile/archive/3.4.1.tar.gz \ No newline at end of file diff --git a/sources/share/20141127 11 Useful Utilities To Supercharge Your Ubuntu Experience.md b/sources/share/20141127 11 Useful Utilities To Supercharge Your Ubuntu Experience.md deleted file mode 100644 index e947762b7c..0000000000 --- a/sources/share/20141127 11 Useful Utilities To Supercharge Your Ubuntu Experience.md +++ /dev/null @@ -1,154 +0,0 @@ -11 Useful Utilities To Supercharge Your Ubuntu Experience -================================================================================ -**Whether you’re a relative novice or a seasoned pro, we all want to get the most from our operating system. Ubuntu, like most modern OSes, has more to offer than what is presented at first blush.** - -From tweaking and refining the look, behaviour and performance of the Unity desktop to performing system maintenance, there are a huge array of useful utilities and apps that can help **tune Ubuntu to meet your needs in no time**. - -Caveat time: Ubuntu has always shipped with ‘sane defaults’ — options that just work — out of the box. These defaults are well suited for the majority of people. They’re tested, accepted and recommended. - -But one size doesn’t fit all. For the tinkerers and experimenters among us the default experience is a starting point from which to tailor. - -So, without any more waffle, here is a set of 11 nifty utilities to help you supercharge your Ubuntu experience. - -### Unity Tweak Tool ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/unity-tweak-tool.jpg) - -I’ll kick off this list with the big one: **Unity Tweak** Tool. The kitchen sink of customisation, Unity Tweak Tool offers a comprehensive set of system tweaks tuned for Ubuntu and the Unity desktop. - -It’s stuffed full of switches, toggles and control, letting you configure everything from the way Unity looks to the way it behaves. Use it to **quickly and easily change the GTK theme and icon set**, set up hot corners, adjust launcher size, add or remove workspaces, and — notably — enable Unity’s elusive ‘minimise on click’ feature. - -Free and readily available from the Software Center, Unity Tweak Tool is one well worth keeping in your back pocket. - -### Unity Privacy Indicator ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/indicator-privacy-in-ubuntu.jpg) - -Privacy. A big, big issue and rightly so. But the topic is often shaded rather than binary; you may be happy to let some data or habits, say apps you frequently open, be logged locally, but not be ok with the searches you make in the Dash being ferried to a third-party server (however anonymous that data may be). - -[Privacy Indicator][1] is a useful tool to help you stay abreast of what files, folders and services are being accessed, logged and recce’d on the Ubuntu desktop. - -With a quick click on the ‘eye’ icon added to the desktop panel you can: - -- Toggle Online Search Results, Zeitgeist, HUD Logging & GeoIP -- Quick access to clean Zeitgeist, F2, Recent Files, etc. -- Options to show/hide desktop icons and name in the panel - -The latter two options may seem a little misplaced in this app but have less obvious privacy implications for those who take screenshots or screen share. - -- [Download Indicator Privacy (.deb)][2] - -### Unity Folders ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/09/unity-folders.jpg) - -**Android, iOS, OS X, Chrome OS, and GNOME Shell have app folders, and so can Unity with a nifty third-party app. ** - -“Unity Folders” allows you to organise apps on the Unity Launcher into handy folders — think ‘games’, ‘office’, ‘social‘, etc. You get quick access to your favourite apps without needing to open the Dash, which may suit your workflow. - -Each ‘folder’ is, actually, an application that opens up and positions itself near the origin point. But the overall effect is one that looks like an OS X style stack or an Android folder popover. - -Folder icons can be customised or auto-generated based on the applications tucked up inside. Existing folders can be edited, rearranged, rename and re-other stuff, too. - -- Create as many folders as you like -- Choose custom or auto-generated folder icon -- 3 folder layouts to choose from -- Set custom icons for apps added to folders -- Edit existing folders - -- Unity Folders Website - -### Caffeine ### - -A staple for many of us, and not just in our drinks, Caffeine offers a fast, silent way to stop your screensaver or lock-screen kicking in. The degree of usefulness will depend on your circumstances (read: quirks of your system), and though it’s not quite as user friendly as it once was, it’s still worth [checking out][3]. - -### System Monitor Indicator ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/multiload-indicator-in-ubuntu.jpg) - -If you’re a stat hound who likes to keep tabs on apps, processes and hardware status, Linux makes it easy. From Conky Configs to Terminal Commands — there’s no shortage of ways to monitor your CPU usage, network traffic or GPU temperature. - -But by far my favourite is System **Monitor Indicator** – also known as indicator-multiload — available from the Ubuntu Software Center. It has a host of configuration options, too. - -- [Click to Install ‘System Load Indicator’ on Ubuntu][4] - -### Power Saving Tools for Linux Laptops ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2012/08/front.jpg) - -**TLP** - -Linux distributions don’t have the best reputation when it comes to power efficiency on portable devices. - -If your own Linux laptop can barely get you from the sofa to the kitchen before needing a recharge, there are some tools you can try. - -TLP is one of the most popular automated background tool promising to prolong battery life of laptops running Linux. It does this by adjusting the settings and behaviour of system processes and hardware, such as enabling Wi-Fi power saving mode, runtime power management of PCI bus devices, and processor frequency scaling. - -It’s available to [install on Ubuntu 14.04 LTS and later using the dedicated TLP PPA][5] and comes with a ‘catch-all’ config to get you started. The more advanced users among you can dive in and manually adjust the settings to suit your own hardware, something that a [thorough guide on the TLP wiki][6] makes easy. - -**Laptop Mode Tools** - -If TLP sounds a little too complex — and there’s no shame if it does — there’s a simpler alternative: **Laptop Mode Tools**. This package is available to install from the Ubuntu Software Center and keeps the tweaks made to a set of sane defaults (Wi-Fi, Bluetooth, etc.). - -Laptop Mode Tools cannot be installed at the same time as TLP. - -- [Laptop Mode Tools in Ubuntu Software Center][7] - -### Intel Graphics Installer ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/04/intelgraphicsdriverinstaller.png) - -The Intel Graphics Installer tool is a must-have for those running Intel graphics hardware who want the best performance they can get. It makes finding and installing the latest Intel GPU drivers a painless, fuss-free affair — no PPAs or Terminal kung foo needed. - -- [Download Intel Graphics Installer for Linux 0.7][8] - -### Hardware Stats ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/02/Screen-Shot-2014-02-10-at-21.05.37.png) - -If you plan on upgrading your PC or replacing a worn-out part you’ll need to get some specific hardware details, such as RAM type, CPU socket set or what PCI slots are available. - -**I-Nex** makes unearthing this, and host of other detailed system stats, easy. Use it to find your motherboard model number, RAM stepping, S.M.A.R.T. status and…well, pretty much anything else you can think of! - -- [Learn More About I-Nex on Launchpad][9] - -### Disk Space Visualizer ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/disk-usage-visualizer-for-ubuntu.jpg) - -In this age of 1TB hard drives we might not need to be as prudent with disk space as we once were. But for those of using a smallish SSD, running multiple partitions or working in a virtual machine with a fixed-size virtual disk, there’ll be times when freeing up a bit of extra space is required. - -GNOME Disks, installed in Ubuntu by default, makes finding the biggest space-gobbling culprits easy. Ideal for locating hidden logs, caches, and media files. - -### BleachBit (Cruft Cleaner) ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/bleachbit.jpg) - -Windows users will be familiar with applications like CCleaner, which scan for and clean out junk files, empty folders, bloated caches, and obsolete packages. For a a similarly quick and effortless click n’ clean solution on Ubuntu try **BleachBit**. - -It is a powerful tool, so do pay attention to what you’re cleaning. Don’t aimlessly check every box; not everything that it can clean needs to be. Play it smart; when in doubt, leave it out. - -- [Install BleachBit from Ubuntu Software Center][10] - -Got a favourite system utility of your own? Let others know about it in the comments. --------------------------------------------------------------------------------- - -via: http://www.omgubuntu.co.uk/2014/11/useful-tools-for-ubuntu-do-you-use-them - -作者:[Joey-Elijah Sneddon][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/117485690627814051450/?rel=author -[1]:http://www.florian-diesch.de/software/indicator-privacy/index.html -[2]:http://www.florian-diesch.de/software/indicator-privacy/dist/indicator-privacy_0.04-1_all.deb -[3]:http://www.omgubuntu.co.uk/2014/05/stop-ubuntu-sleeping-caffeine -[4]:apt://indicator-mulitload -[5]:https://launchpad.net/~linrunner/+archive/ubuntu/tlp/+packages -[6]:http://linrunner.de/en/tlp/docs/tlp-configuration.html -[7]:https://apps.ubuntu.com/cat/applications/laptop-mode-tools/ -[8]:https://01.org/linuxgraphics/downloads/2014/intelr-graphics-installer-linux-1.0.7 -[9]:https://launchpad.net/i-nex -[10]:https://apps.ubuntu.com/cat/applications/bleachbit/ diff --git a/sources/share/20141204 Intense Gameplay--Try these 13 Roguelike games.md b/sources/share/20141204 Intense Gameplay--Try these 13 Roguelike games.md deleted file mode 100644 index 14ce0991d0..0000000000 --- a/sources/share/20141204 Intense Gameplay--Try these 13 Roguelike games.md +++ /dev/null @@ -1,404 +0,0 @@ -Intense Gameplay? Try these 13 Roguelike games -================================================================================ -Roguelike is a sub-genre of role-playing games. It literally means "a game like Rogue". Rogue is a dungeon crawling video game first released in 1980, standing out for being fiendishly addictive. Its goal was to retrieve the Amulet of Yendor, hidden deep in the 26th level, and ascend back to the top. - -There is no exact definition of a roguelike, but this type of game typically has the following characteristics: - -- High fantasy narrative background -- Procedural level generation. Most of the game world is generated by the game for every new gameplay session. This is meant to encourage replayability -- Turn-based dungeon exploration and combat -- Tile-based graphics that are randomly generated -- Random conflict outcomes -- Permanent death death works realistically, once you're gone, you're gone -- High difficulty - -This article compiles a good selection of roguelike games available for Linux. If you enjoy intense, addictive gameplay, try these 13 games. Don't be put off by the primitive graphics, you'll soon forget the visuals once you get immersed. All of them are available to download without charge, and almost all are released under an open source license. - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/DungeonCrawlStoneSoup.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-Dungeon1.png) - -Dungeon Crawl Stone Soup is an open-source, single-player, role-playing roguelike game of exploration and treasure-hunting in dungeons filled with dangerous and unfriendly monsters in a quest to rescue the mystifyingly fabulous Orb of Zot. - -Dungeon Crawl Stone Soup is a continuation of Linley's Dungeon Crawl. It is openly developed and invites participation from the Crawl community. - -Dungeon Crawl has superb, deep tactical gameplay, innovative magic and religion systems, and a grand variety of monsters to fight. Crawl is also one of the hardest roguelikes to beat. When you finally beat the game and write your victory post on rec.games.roguelike.misc, you know you have achieved something. - -Features include: - -- Well-rounded, deep tactically rich roguelike -- Hand-drawn maps -- Numerous portal vaults -- Slick interface -- Innovative magic and religion systems -- Wide range of Gods, Characters, Items, and Smart Monsters - -- Website: [crawl.develz.org][1] -- Developer: Stone Soup devteam -- License: Crawl General Public License -- Version Number: 0.15.2 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/DwarfFortress.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-DwarfFortress.png) - -Dwarf Fortress is a single-player fantasy game, similar to NetHack. You can control a dwarven outpost or an adventurer in a randomly generated, persistent world. - -The game features three modes of play (Dwarf Fortress, Adventurer and Legends modes), a distinct, randomly-generated world (complete with terrain, wildlife and legends), gruesome combat mechanics and vicious schools of carp. - -Features include: - - -- The world persists as long as you like, over many games, recording historical events and tracking changes -- Command your dwarves as they search for wealth in the mountain - - Craft treasures and furniture from many materials and improve these objects with precious metals, jewels and more - - Defend yourself against attacks from hostile civilizations, the wilderness and the depths - - Support the nobility as they make demands of your populace - - Keep your dwarves happy and read their thoughts as they work and relax - - Z coordinate allows you to dig out fortresses with multiple levels. Build towers or conquer the depths - - Build floodgates to divert water for farming or to drown your adversaries -- Play an adventurer and explore, quest for glory or seek vengeance - - Meet adversaries from previous games - - Recruit people in towns to come with you on your journey - - Explore without cumbersome plot restrictions - - Seamlessly wander the world -up to 197376 x 197376 squares total -or travel more rapidly on the region map - - Accept quests from the town and civilization leaders - - Retire and meet your old characters. Bring them along on an adventure with a new character or reactivate them and play directly - - Z coordinate allows you to move seamlessly between dungeon levels and scale structures fighting adversaries above and below -- The combat model uses skills, body parts, wrestling, charging and dodging between squares, bleeding, pain, nausea, and much more -- A dynamic weather model tracks wind, humidity and air masses to create fronts, clouds, rain storms and blizzards -- Over two hundred rock and mineral types are incorporated into the world, placed in their proper geological environments -- Add new creatures, weapons, plants, metals and other objects via modifiable text files -- Extended ASCII character set rendered in 16 colors (including black) as well as 8 background colors (including black) - -- Website: [www.bay12games.com/dwarves/][2] -- Developer: Tarn Adams -- License: Freeware -- Version Number: 0.40.19 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/ADOM.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-ADOM.png) - -Ancient Domains of Mystery (ADOM) is a rogue-like game which has been in development since 1994. - -It is a single-user game featuring the exploration of a dungeon complex. You control a fictional character described by race, class, attributes, skills, and equipment. This fictional character is trying to achieve a specific goal (see below) and succeed in a difficult quest. To fulfill the quest, you have to explore previously undiscovered tunnels and dungeons, fight hideous monsters, uncover long forgotten secrets, and find treasures of all kind. - -During the game, you explore dungeon levels which are randomly generated each game. You might also encounter certain special levels, which present a particular challenge or are built around a certain theme. - -Features include: - -- Huge game world with hundreds of locations such as towns, randomized dungeons, elemental temples, graveyards, ancient ruins, towers and other secrets -- Loads of races (dwarves, drakelings, mist elves, hurthlings, orcs, trolls, ratlings and many others) and even more classes (fighters, elementalists, assassins, chaos knights, duelists and much more) allowing for infinite play styles -- Hundreds of monsters and items, many with enhanced random features -- A corruption system forcing you to balance lust for power with fear of damnation -- Spells, prayers, mindcraft, alchemy, crafting and more -- Dozens of quests and branching story lines -- Numerous wildly different endings that might alter reality itself - -- Website: [www.adom.de][3] -- Developer: Thomas Biskup -- License: Postcardware -- Version Number: 1.20 Prelease 20 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/ToME.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-ToME.png) - -Tales of Maj’Eyal (ToME) is a free, open source roguelike RPG, featuring tactical turn-based combat and advanced character building. It is written as a module that runs in T-Engine 4.0. - -This is the Age of Ascendancy, after over ten thousand years of strife, pain and chaos the known world is at last at relative peace. The Spellblaze last effects are now tamed, the land slowly heals itself and the civilisations rebuild themselves after the Age of Pyre. - -Features include: - -- Suitable for gamers without any rogueline experience -- Supports both graphical tiles and ASCII mode -- Over 40 abilities available on some characters -- Talent system -- Combat engine -- Online persistent stat/achievement tracking -- IRC chat client -- Expandable and moddable -- Atmospheric music -- Unlock new races, classes, starting points, playmodes and features - -- Website: [te4.org][4] -- Developer: ToME Development Team -- License: GNU GPL v3.0 -- Version Number: 1.2.5 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/CataclysmDarkDaysAhead1.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Cataclysm.png) - -Cataclysm is an open source post-apocalyptic roguelike, set in the countryside of fictional New England after a devastating plague of monsters and zombies. It is a continuation of Whale's original Cataclysm, which expands it with numerous new creatures, buildings, gameplay mechanics and many other features. - -While some have described it as a "zombie game", there's far more to Cataclysm than that. Struggle to survive in a harsh, persistent, procedurally generated world. Scavenge the remnants of a dead civilization for for food, equipment, or, if you're lucky, a vehicle with a full tank of gas to get you the hell out of Dodge. Fight to defeat or escape from a wide variety of powerful monstrosities, from zombies to giant insects to killer robots and things far stranger and deadlier, and against the others like yourself, that want what you have... - -Cataclysm is very different from most roguelikes in many ways. Rather than being set in a vertical, linear dungeon, it is set in an unbounded, 3D world. This means that exploration plays a much bigger role than in most roguelikes, and the game is much less linear. As the map is so huge, it is actually completely persistant between games. If you die, and start a new character, your new game will be set in the same game world as your last. Like in many roguelikes, you will be able to loot the dead bodies of previous characters; unlike most roguelikes, you will also be able to retrace their steps completely, and any dramatic changes made to the world will persist into your next game. - -Features include: - - -- Detailed character creation, with a plethora of traits to choose -- Defense mode, a coffeebreak mode with fast-paced combat -- Bionics; Similar to the magic system in many games -- Mutations, both positive and negative -- Unbounded, fully randomized world map that is persistent between characters -- Item crafting - - New recipes may be acquired by honing your knowledge through practice or learning from books -- Realistic fire, smoke, and other dynamic map effects -- A day/night cycle with the need to sleep. Use caffeine to stay awake longer if you must but be aware this is not healthy -- Over 300 item types, including a multitude of real-world guns, drugs, and tools - - Many drugs are addictive, and will require continuous use to avoid withdrawal effects. -- Ability to board doors and windows, construct traps and fortify your home base to prevent a rude awakening by a zombie -- Ability to construct your own wooden constructions, including walls and a roof -- Ability to drive around in vehicles found in the post-apocalyptic landscape - - These can be modified to your needs, or you could even build one from scratch -- A temperature system, being too cold or too hot is quite hazardous -- Preliminary tile support -- WorldGen options, and versatile editing methods -- -- Website: [en.cataclysmdda.com][5] -- Authors: Kevin Granade and others -- License: Creative Commons Attribution-ShareAlike 3.0 Unported License -- Version Number: 0.B - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/GoblinHack1.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-GoblinHack.png) - -Goblin Hack is an open source roguelike OpenGL-based smooth-scrolling ASCII graphics game. The game is inspired by the likes of NetHack, but faster with fewer keys. - -Goblin Hack has a simple interface that appears to appeal to players of all ages, and fires their imagination in today's world of over-rendered games. - -Players can choose one of several classes before being thrown into the first floor of a randomized, ongoing dungeon. - -Features include: - -- Impressive graphics (compared with many other roguelike games) -- Simple interface -- Choose one of several classes before being thrown into the first floor of a randomized, ongoing dungeon -- Manually save the game - -- Website: [goblinhack.sourceforge.net][6], [github.com/goblinhack/goblinhack][7] -- Authors: Neil McGill -- License: GNU GPL v2 -- Version Number: 1.19 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/SLASH%27EM.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-SlashEM.png) - -Super Lotsa Added Stuff Hack - Extended Magic (SLASH'EM) is a role-playing game where you control a single character. SLASH'EM is a variant of NetHack. It also has an interface and gameplay similar to Rogue, ADOM, Anghand and NetHack. You control the actions through the keyboard and view the world from an overhead perspective. - -The problem: The Amulet of Yendor has been stolen. Not only that but it appears that the Wizard of Yendor (not a nice person), who took the amulet, is hiding in the Dungeons of Doom (not a friendly place). - -Features include: - -- Offers extra features, monsters, and items -- Novel features inlude the Monk class and Sokoban levels -- The main dungeon is much larger than in NetHack - -- Website: [www.slashem.org][8] -- Developer: The Slash'EM development team -- License: MIT License, NetHack General Public License -- Version Number: 0.0.7E7F3 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/NetHack.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-NetHack.jpg) - -NetHack is a wonderfully silly, yet quite addictive Dungeons and Dragons-style adventure game. The "net" element references that its development has been coordinated through the Internet. The "hack" element refers to a genre of role-playing games known as hack and slash for their focus on combat. - -In NetHack you play the part of a fierce fighter, wizard, or any of many other classes, fighting your way down to retrieve the Amulet of Yendor (try saying THAT one backwards!) for your god. On the way, you might encounter a quantum mechanic or two, or perhaps a microscopic space fleet, or -- if you're REALLY lucky -- the Ravenous Bugblatter Beast of Traal. - -Features include: - -- 45-50 levels, most of which are randomly generated -- Variety of items: weapons, armour, scrolls, potions, rings, gems, and an assortment of tools such as keys and lamps -- Blessings and curses -- Permadeath: expired characters cannot be revived without having made backup copies of the actual save files -- Interfaces: - - Console - - Graphical, using X, Qt toolkit or GNOME libraries - -- Website: [www.nethack.org][9] -- Developer: The NetHack DevTeam -- License: NetHack General Public License -- Version Number: 3.4.3 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/AsciiSector.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-AsciiSector.png) - -Ascii Sector is a free space combat/exploration/trading game which is based on the classic computer game Wing Commander: Privateer released by Origin Systems in 1993. - -In Ascii Sector, you start with a simple spaceship and can then accept missions or trade goods to earn enough money to upgrade your ship or buy a new one. You can engage in deadly fights both in space, on the ground and on board spaceships, and using the Ascii Sector scripting language, you can create your own quests for the game or have fun with other players' quests. - -Features include: - -- Uses the ANSI character set for the graphics -- Real depth to the gameplay -- Offers a wide variety of bases, missions, commodities and ships -- Ships include: Broadsword, Centurion, Demon, Dralthi, Drayman, Galaxy, Gladius, Gothri, Kamekh, Nexus, Orion, Paradign, Stileto, Talon, Tarsus, and Ulysses -- Four quadrants: Alizarin, Crimson, Mauve, and Viridian -- Downloadable quests -- Scripting of quests -- Ascii Sector quest language, create your own stories in the Ascii Sector universe -- NPCs on planets can be attacked and robbed -- Persistent fleets that can move around, change control of systems, engage enemy fleets, head back for repairs and rebuilds -- Ships whose systems have been disabled can be boarded -- Download high quality music files - -- Website: [www.asciisector.net][10] -- Developer: Christian Knudsen -- License: Freeware -- Version Number: 0.7.1.4 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/Angband.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Angband.png) - -Angband is a free, single-player graphical dungeon exploration game that uses ASCII characters where you take the role of an adventurer, exploring a deep dungeon, fighting monsters, and acquiring the best weaponry you can, in preparation for a final battle with Morgoth, the Lord of Darkness. It has been in development since the 1990s. - -Angband is along the lines of Rogue and NetHack. It is derived from the games Moria and Umoria, which were in turn based on Rogue. It is often described as a "roguelike" game because the look and feel of the game is still quite similar to Rogue. Many of these new creatures and objects are drawn from the writings of J.R.R Tolkien, although some of the monsters come straight from classical mythology, Dungeons & Dragons, Rolemaster, or the minds of the orginal Angband coders. - -Features include: - -- 100 level dungeon -- New levels are randomly generated -- Choose to be a human, half-elf, elf, hobbit, gnome, dwarf, half-orc, half-troll, dunadan, high-elf, or kobold -- Artifacts -- Spellcasting -- Monsters -- Monster pits -- Monster nests - -- Website: [rephial.org][11] -- Developer: Angband Development Team -- License: GNU GPL v2 -- Version Number: 3.5.0 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/UnNetHack1.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-UnNetHack.png) - -UnNetHack is a fork of NetHack. NetHack was first released in 1987, and is considered by many gamers to be one of the best gaming experiences the computing world offers. - -Features include: - - -- Adds a number of enhancements to NetHack such as additional monsters, more levels, a few new objects, additional dangers, more challenging gameplay, and most importantly more entertainment than vanilla NetHack -- Tutorial to help new players get started - -- Website: [sourceforge.net/apps/trac/unnethack][12] -- Authors: Patric Mueller -- License: Nethack General Public License -- Version Number: 5.1.0 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/HydraSlayer.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-HydraSlayer.png) - -Hydra Slayer is an open source Roguelike game focused on slaying Hydras. It is inspired by Greek mythology, Dungeon Crawl, MathRL seven day roguelike, and some mathematical puzzles about brave heroes slaying many headed beasts. - -Features include: - -- Unique gameplay mechanics -- A theme which mixes Greek mythology and mathematics -- Traditional roguelike ASCII graphics, or tiles/3D display -- 5 player character races with very distinct tactics, strengths and weaknesses -- 28 enemy types: - - 10 basic types of elemental hydras (each of them has two special variations) - - 8 types of special enemies - - Harmless mushrooms for strategic advantage -- 28 types of equipment (not counting material and size/power variations) -- 15 weapon materials -- 18 types of non-equipment items -- 3 game geometries to choose -- 8 level topologies (including the Mobius strip and Klein bottle) -- 11 level generators -- 2 endings - -- Website: [www.roguetemple.com/z/hydra][13] -- Developer: Zeno Rogue -- License: GNU GPL v2 -- Version Number: 16.1 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/Brogue1.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Brogue.png) - -Brogue is an open source Roguelike game for Mac OS X, Windows, Linux, iOS and Android. - -Brogue is a direct descendant of Rogue, a dungeon crawling video game first developed by Michael Toy and Glenn Wichman around 1980. Unlike other popular modern roguelikes, Brogue favors simplicity over complexity, while trying to ensure that the interactions between components are interesting and varied. - -The goal of the game is to travel to the 26th subterranean floor of the dungeon, retrieve the Amulet of Yendor and return with it to the surface. For the truly skillful who desire further challenge, depths below 26 contain three lumenstones each, items which confer an increased score upon victory. - -Brogue is a challenging game, but still great fun to play. Try not to be disheartened by the difficulty of the game; with some application, Brogue will become very addictive. - -Features include: - -- Favors simplicity over complexity -- User-friendly features -- Compared with Rogue, Brogue has a more sophisticated level generation -- XP and levelling system removed -- Traps, protecting items -- Additional monster types and magical items - -- Website: [sites.google.com/site/broguegame][14] -- Authors: Brian Walker -- License: GNU Affero GPL -- Version Number: 1.7.3 - --------------------------------------------------------------------------------- - -via: http://www.linuxlinks.com/article/201412031524381/RoguelikeGames.html - -作者:Frazer Kline -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://crawl.develz.org/ -[2]:http://www.bay12games.com/dwarves/index.html -[3]:http://www.adom.de/ -[4]:http://te4.org/ -[5]:http://en.cataclysmdda.com/ -[6]:http://goblinhack.sourceforge.net/ -[7]:https://github.com/goblinhack/goblinhack -[8]:http://www.slashem.org/ -[9]:http://www.nethack.org/ -[10]:http://www.asciisector.net/ -[11]:http://rephial.org/ -[12]:http://sourceforge.net/apps/trac/unnethack/ -[13]:http://www.roguetemple.com/z/hydra/ -[14]:https://sites.google.com/site/broguegame/ \ No newline at end of file diff --git a/sources/share/20150114 What is a good IDE for C or C++ on Linux.md b/sources/share/20150114 What is a good IDE for C or C++ on Linux.md deleted file mode 100644 index 9560ce6ee1..0000000000 --- a/sources/share/20150114 What is a good IDE for C or C++ on Linux.md +++ /dev/null @@ -1,83 +0,0 @@ -What is a good IDE for C/C++ on Linux -================================================================================ -"A real coder doesn't use an IDE, a real coder uses [insert a text editor name here] with such and such plugins." We all heard that somewhere. Yet, as much as one can agree with that statement, an IDE remains quite useful. An IDE is easy to set up and use out of the box. Hence there is no better way to start coding a project from scratch. So for this post, let me present you with my list of good IDEs for C/C++ on Linux. Why is C/C++ specifically? Because C is my favorite language, and we need to start somewhere. Also note that there are in general a lot of ways to code in C, so in order to trim down the list, I only selected "real out-of-the-box IDE", not text editors like Gedit or Vim pumped with [plugins][1]. Not that this alternative is bad in any way, just that the list will go on forever if I include text editors. - -### 1. Code::Blocks ### - -![](https://farm8.staticflickr.com/7520/16089880989_10173db27b_c.jpg) - -Starting all out with my personal favorite, [Code::Blocks][2] is a simple and fast IDE for C/C++ exclusively. Like any respectable IDE, it integrates syntax highlighting, bookmarking, word completion, project management, and a debugger. Where it shines is via its simple plugin system which adds indispensable tools like Valgrind and CppCheck, and less indispensable like a Tetris mini-game. But my reason for liking it particularly is for its coherent set of handy shortcuts, and the large number of options that never feel too overwhelming. - -### 2. Eclipse ### - -![](https://farm8.staticflickr.com/7522/16276001255_66235a0a69_c.jpg) - -I know that I said only "real out-of-the-box IDE" and not a text editor pumped with plugins, but [Eclipse][3] is a "real out-of-the-box IDE." It's just that Eclipse needs a little [plugin][4] (or a variant) to code in C. So I technically did not contradict myself. And it would have been impossible to make an IDE list without mentioning the behemoth that is Eclipse. Like it or not, Eclipse remains a great tool to code in Java. And thanks to the [CDT Project][5], it is possible to program in C/C++ too. You will benefit from all the power of Eclipse and its traditional features like word completion, code outline, code generator, and advanced refactoring. What it lacks in my opinion is the lightness of Code::Blocks. It is still very heavy and takes time to load. But if your machine can take it, or if you are a hardcore Eclipse fan, it is a very safe option. - -### 3. Geany ### - -![](https://farm9.staticflickr.com/8573/16088461968_c6a6c9e49a_c.jpg) - -With a lot less features but a lot more flexibility, [Geany][6] is at the opposite of Eclipse. But what it lacks (like a debugger for example), Geany makes it up with nice little features: a space for note taking, creation from template, code outline, customizable shortcuts, and plugins management. Geany is still closer to an extensive text editor than an IDE here. However I keep it in the list for its lightness and its well designed interface. - -### 4. MonoDevelop ### - -![](https://farm8.staticflickr.com/7515/16275175052_61487480ce_c.jpg) - -Another monster to add to the list, [MonoDevelop][7] has a very unique feel derived from its look and interface. I personally love its project management and its integrated version control system. The plugin system is also pretty amazing. But for some reason, all the options and the support for all kind of programming languages make it feel a bit overwhelming to me. It remains a great tool that I used many times in the past, but just not my number one when dealing with "simplistic" C. - -### 5. Anjuta ### - -![](https://farm8.staticflickr.com/7514/16088462018_7ee6e5b433_c.jpg) - -With a very strong "GNOME feeling" attached to it, [Anjuta][8]'s appearance is a hit or miss. I tend to see it as an advanced version of Geany with a debugger included, but the interface is actually a lot more elaborate. I do enjoy the tab system to switch between the project, folders, and code outline view. I would have liked maybe a bit more shortcuts to move around in a file. However, it is a good tool, and offers outstanding compilation and build options, which can support the most specific needs. - -### 6. Komodo Edit ### - -![](https://farm8.staticflickr.com/7502/16088462028_81d1114c84_c.jpg) - -I was not very familiar with [Komodo Edit][9], but after trying it a few days, it surprised me with many many good things. First, the tab-based navigation is always appreciable. Then the fancy looking code outline reminds me a lot of Sublime Text. Furthermore, the macro system and the file comparator make Komodo Edit very practical. Its plugin library makes it almost perfect. "Almost" because I do not find the shortcuts as nice as in other IDEs. Also, I would enjoy more specific C/C++ tools, and this is typically the flaw of general IDEs. Yet, very enjoyable software. - -### 7. NetBeans ### - -![](https://farm8.staticflickr.com/7569/16089881229_98beb0fce3_c.jpg) - -Just like Eclipse, impossible to avoid this beast. With navigation via tabs, project management, code outline, change history tracking, and a plethora of tools, [NetBeans][10] might be the most complete IDE out there. I could list for half a page all of its amazing features. But that will tip you off too easily about its main disadvantage, it might be too big. As great as it is, I prefer plugin based software because I doubt that anyone will need both Git and Mercurial integration for the same project. Call me crazy. But if you have the patience to master all of its options, you will be pretty much become the master of IDEs everywhere. - -### 8. KDevelop ### - -![](https://farm8.staticflickr.com/7519/15653583824_e412f2ab1f_c.jpg) - -For all KDE fans out there, [KDevelop][11] might be the answer to your prayers. With a lot of configuration options, KDevelop is yours if you manage to seize it. Call me superficial but I never really got past the interface. But it's too bad for me as the editor itself packs quite a punch with a lot of navigation options and customizable shortcuts. The debugger is also very advanced and will take a bit of practice to master. However, this patience will be rewarded with this very flexible IDE's full power. And it gets special credits for its amazing embedded documentation. - -### 9. CodeLite ### - -![](https://farm9.staticflickr.com/8594/16250066446_b5f654e63f_c.jpg) - -Finally, last for not least, [CodeLite][12] shows that you can take a traditional formula and still get something with its own feeling attached to it. If the interface really reminded me of Code::Blocks and Anjuta at first, I was just blown away by the extensive plugin library. Whether you want to diff a file, insert a copyright block, define an abbreviation, or push your work on Git, there is a plugin for you. If I had to nitpick, I would say that it lacks a few navigation shortcuts for my taste, but that's really it. - -To conclude, I hope that this list had you discover new IDEs for coding in your favorite language. While Code::Blocks remains my favorite, it has some serious challengers. Also we are far from covering all the ways to code in C/C++ using an IDE on Linux. So if you have another one to propose, let us know in the comments. Also if you would like me to cover IDEs for a different language next, also let us know in the comment section. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/good-ide-for-c-cpp-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://xmodulo.com/turn-vim-full-fledged-ide.html -[2]:http://www.codeblocks.org/ -[3]:https://eclipse.org/ -[4]:http://xmodulo.com/how-to-set-up-c-cpp-development-environment-in-eclipse.html -[5]:https://eclipse.org/cdt/ -[6]:http://www.geany.org/ -[7]:http://www.monodevelop.com/ -[8]:http://anjuta.org/ -[9]:http://komodoide.com/komodo-edit/ -[10]:https://netbeans.org/ -[11]:https://www.kdevelop.org/ -[12]:http://codelite.org/ \ No newline at end of file diff --git a/sources/share/20150119 Cutegram--A Better Telegram Client For GNU or Linux.md b/sources/share/20150119 Cutegram--A Better Telegram Client For GNU or Linux.md deleted file mode 100644 index 7a051be4fc..0000000000 --- a/sources/share/20150119 Cutegram--A Better Telegram Client For GNU or Linux.md +++ /dev/null @@ -1,76 +0,0 @@ -Cutegram: A Better Telegram Client For GNU/Linux -================================================================================ -No need for a introduction to **Telegram**, right? Telegram is a popular free Instant messenger application that can be used to chat with your friends all over the world. Unlike Whatsapp, Telegram is free forever, no ads, no subscription fees. And, the Telegram client is open source too. Telegram is available for many different platforms, including Linux, Android, iOS, Windows Phone, Windows, and Mac OS X. The messages which are sending using telegram are highly encrypted and self-destructive. It is very secure, and there is no limit on the size of your media and chats. - -You can install and use Telegram desktop on your Debian/Ubuntu systems as mentioned in [our previous tutorial][1]. However, a new telegram client called **Cutegram** is available now to make your chat experience more fun and easy. - -### What is Cutegram? ### - -Cutegram is a free and opensource telegram clients for GNU/Linux focusing on user friendly, compatibility with Linux desktop environments and easy to use. Cutegram using Qt5, QML, libqtelegram, libappindication, AsemanQtTools technologies and Faenza icons and Twitter emojies graphic sets. It’s free and released under GPLv3 license. - -### Install Cutegram ### - -Head over to the Cutegram homepage and download the latest version of your distribution’s choice. As I use Ubuntu 64 bit, I downloaded the .deb file. - - wget http://aseman.co/downloads/cutegram/cutegram_1.0.2-1-amd64.deb - -Now, Install Cutegram as shown below. - - sudo apt-get install gdebi - sudo gdebi cutegram_1.0.2-1-amd64.deb - -For other distributions, run the following commands. - -**64bit:** - - wget http://aseman.co/downloads/cutegram/cutegram-1.0.2-linux-x64-installer.run - -**32 bit:** - - wget http://aseman.co/downloads/cutegram/cutegram-1.0.2-linux-installer.run - -Set executable permission: - - chmod + cutegram-1.0.2-linux*.run - -And, install it as shown below. - - sudo ./cutegram-1.0.2-linux*.run - -### Usage ### - -Launch Cutegram either from Menu or Unity dash. From the login screen, select your country, and enter your mobile number, finally click **Login**. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Cutegram_005.png) - -A code will be sent to your mobile number. Enter the code and click **Sign in**. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Cutegram_002.png) - -There you go. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Cutegram_003.png) - -Start Chatting! - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Cutegram_004.png) - -And, you can set a profile picture, start new chat/group chat, or secret chat from using the buttons on the left pane. - -Stay happy! Cheers!! - -For more details, check the [Cutegram website][2]. - --------------------------------------------------------------------------------- - -via: http://www.unixmen.com/cutegram-better-telegram-client-gnulinux/ - -作者:[SK][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.unixmen.com/author/sk/ -[1]:http://www.unixmen.com/install-telegram-desktop-via-ppa/ -[2]:http://aseman.co/en/products/cutegram/ \ No newline at end of file diff --git a/sources/share/20150126 CD Audio Grabbers--Graphical Based.md b/sources/share/20150126 CD Audio Grabbers--Graphical Based.md deleted file mode 100644 index 5dcfa26cca..0000000000 --- a/sources/share/20150126 CD Audio Grabbers--Graphical Based.md +++ /dev/null @@ -1,128 +0,0 @@ -CD Audio Grabbers - Graphical Based -================================================================================ -CD audio grabbers are designed to extract ("rip") the raw digital audio (in a format commonly called CDDA) from a compact disc to a file or other output. This type of software enables a user to encode the digital audio into a variety of formats, and download and upload disc info from freedb, an internet compact disc database. - -Is copying CDs legal? Under US copyright law, converting an original CD to digital files for personal use has been cited as qualifying as 'fair use'. However, US copyright law does not explicitly allow or forbid making copies of a personally-owned audio CD, and case law has not yet established what specific scenarios are permitted as fair use. The copyright position is much clearer in the UK. From 2014 it become legal for UK citizens to make copies of CDs, MP3s, DVD, Blu-rays and e-books. This only applies if the individual owns the physical media being ripped, and the copy is made only for their own private use. For other countries in the European Union, member nations can allow a private copy exception too. - -If you are not sure what the position is for the country you live in, please check your local copyright law to make sure that you are on the right side of the law before using the software featured in this two page article. - -To some extent, it may seem a bit of a chore to rip CDs. Streaming services like Spotify and Google Play Music offer access to a huge library of music in a convenient form, and without having to rip your CD collection. However, if you already have a large CD collection, it is still desirable to be able to convert your CDs to enjoy on mobile devices like smartphones, tablets, and portable MP3 players. - -This two page article highlights my favorite audio CD grabbers. I pick the best four graphical audio grabbers, and the best four console audio grabbers. All of the utilities are released under an open source license. - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/freac.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-freac.png) - -fre:ac is an open source audio converter and CD ripper that supports a wide range of popular formats and encoders. The utility currently converts between MP3, MP4/M4A, WMA, Ogg Vorbis, FLAC, AAC, WAV and Bonk formats. It comes with several different presents for the LAME encoder. - -#### Features include: #### - -- Easy to learn and use -- Converter for MP3, MP4/M4A, WMA, Ogg Vorbis, FLAC, AAC, WAV and Bonk formats -- Integrated CD ripper with CDDB/freedb title database support -- Multi-core optimized encoders to speed up conversions on modern PCs -- Full Unicode support for tags and file names -- Easy to learn and use, still offers expert options when you need them -- Joblists -- Can use Winamp 2 input plugins -- Multilingual user interface available in 41 languages - -- Website: [freac.org][1] -- Developer: Robert Kausch -- License: GNU GPL v2 -- Version Number: 20141005 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/Audex.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-Audex.png) - -Audex is an easy to use open source audio CD ripping application. Whilst it is in a fairly early stage of development, this KDE desktop tool is stable, slick and simple to use. - -The assistant is able to create profiles for LAME, OGG Vorbis (oggenc), FLAC, FAAC (AAC/MP4) and RIFF WAVE. Beyond the assistant you can define your own profile, which means, that Audex works together with commmand line encoders in general. - -#### Features include: #### - -- Extract with CDDA Paranoia -- Extract and encode run parallel -- Filename editing with local and remote CDDB/FreeDB database -- Submit new entries to CDDB/FreeDB database -- Metadata correction tools like capitalize etc -- Multi-profile extraction (with one commandline-encoder per profile) -- Fetch covers from the internet and store them in the database -- Create playlists, cover and template-based-info files in target directory -- Create extraction and encoding protocols -- Transfer files to a FTP-server -- Internationalization support - -- Website: [kde.maniatek.com/audex][2] -- Developer: Marco Nelles -- License: GNU GPL v3 -- Version Number: 0.79 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/SoundJuicer.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-SoundJuicer.png) - -Sound Juicer is a lean CD ripper using GTK+ and GStreamer. It extracts audio from CDs and converts it into audio files. Sound Juicer can also play audio tracks directly from the CD, offering a preview before ripping. - -It supports any audio codec supported by a GStreamer plugin, including MP3, Ogg Vorbis, FLAC, and uncompressed PCM formats. - -It is an established part of the GNOME desktop environment. - -#### Features include: #### - -- Automatic track tagging via CDDB -- Encoding to ogg / vorbis, FLAC and raw WAV -- Easy to configure encoding path -- Multiple genres -- Internationalization support - -- Website: [burtonini.com][3] -- Developer: Ross Burton -- License: GNU GPL v2 -- Version Number: 3.14 - ----------- - -![](http://www.linuxlinks.com/portal/content2/png/ripperX.png) - -![](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-ripperX.png) - -ripperX is an open source graphical interface for ripping CD audio tracks and encoding them to Ogg, MP2, MP3, or FLAC formats. It's goal is to be easy to use, requiring only a few mouse clicks to convert an entire album. It supports CDDB lookups for album and track information. - -It uses cdparanoia to convert (i.e. "rip") CD audio tracks to WAV files, and then calls the Vorbis/Ogg encoder oggenc to convert the WAV to an OGG file. It can also call flac to perform lossless compression on the WAV file, resulting in a FLAC file. - -#### Features include: #### - -- Very simple to use -- Rip audio CD tracks into WAV, MP3, OGG, or FLAC files -- Supports CDDB lookups -- Supports ID3v2 tags -- Pause the ripping process - -- Website: [sourceforge.net/projects/ripperx][4] -- Developer: Marc André Tanner -- License: MIT/X Consortium License -- Version Number: 2.8.0 - --------------------------------------------------------------------------------- - -via: http://www.linuxlinks.com/article/20150125043738417/AudioGrabbersGraphical.html - -作者:Frazer Kline -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://www.freac.org/ -[2]:http://kde.maniatek.com/audex/ -[3]:http://burtonini.com/blog/computers/sound-juicer -[4]:http://sourceforge.net/projects/ripperx/ \ No newline at end of file diff --git a/sources/share/20150128 Meet Vivaldi--A New Web Browser Built for Power Users.md b/sources/share/20150128 Meet Vivaldi--A New Web Browser Built for Power Users.md deleted file mode 100644 index c55a5fabe7..0000000000 --- a/sources/share/20150128 Meet Vivaldi--A New Web Browser Built for Power Users.md +++ /dev/null @@ -1,60 +0,0 @@ -Meet Vivaldi — A New Web Browser Built for Power Users -================================================================================ -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/Screen-Shot-2015-01-27-at-17.36.jpg) - -**A brand new web browser has arrived this week that aims to meet the needs of power users — and it’s already available for Linux.** - -Vivaldi is the name of this new browser and it has been launched as a tech preview (read: a beta without the responsibility) for 64-bit Linux machines, Windows and Mac. It is built — shock — on the tried-and-tested open-source frameworks of Chromium, Blink and Google’s open-source V8 JavaScript engine (among other projects). - -Does the world really want another browser? Vivaldi, the brain child of former Opera Software CEO Jon von Tetzchner, is less concerned about want and more about need. - -Vivaldi is being built with the sort of features that keyboard preferring tab addicts need. It is not being pitched at users who find Firefox perplexing or whose sole criticism of Chrome is that it moved the bookmarks button. - -That’s not tacky marketing spiel either. Despite the ‘technical preview’ badge it comes with, Vivaldi is already packed with features that demonstrate its power user slant. - -Plenty of folks feel left behind and underserved by the simplified, paired back offerings other software companies are producing. Vivaldi, even at this early juncture, looks well placed to succeed in winning them over. - -### Vivaldi Features ### - -A few of Vivaldi’s key features already present include: - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/quick.jpg) - -**Quick Commands** (Ctrl + Q) is an in-app HUD that lets you quickly filter through settings, options and features, be it opening a bookmark or hiding the status bar, using your keyboard. No clicks needed. - -**Tab Stacks** let you clean up your workspace by grouping separate tabs into one, and then using a keyboard command or the tab preview picker to switch between them. - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/tab-stacks.jpg) - -A collapsible **side panel** that houses extra features (just like old Opera) including a (not yet working) mail client, contacts, bookmarks browser and note taking section that lets you take and annotate screenshots. - -A bunch of other features are on offer too, including customizable keyboard shortcuts, a tabs bar that can be set on any edge of the browser (or hidden entirely), privacy options and a speed dial with folders. - -### Opera Mark II ### - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/vivaldi-settings-in-ubuntu-750x434.jpg) - -It’s not a leap to see Vivaldi as the true successor to Opera post-Presto (Opera’s old, proprietary rendering engine). Opera (which also pushed out a minor new update today) has split out many of its “power user” features as it chases a lighter, more manageable set of features. - -Vivaldi wants to pick up the baggage Opera has been so keen to offload. And while that might not help it grab marketshare it will see it grab the attention of power users, many of whom will no doubt already be using Linux. - -### Download ### - -Interested in taking it for a spin? You can. Vivaldi is available to download for Windows, Mac and 64-bit Linux distributions. On the latter you have a choice of Debian or RPM installer. - -Bear in mind that it’s not finished and that more features (including extensions, sync and more) are planned for future builds. - -- [Download Vivaldi Tech Preview for Linux][1] - --------------------------------------------------------------------------------- - -via: http://www.omgubuntu.co.uk/2015/01/vivaldi-web-browser-linux-download-power-users - -作者:[Joey-Elijah Sneddon][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/117485690627814051450/?rel=author -[1]:https://vivaldi.com/#Download \ No newline at end of file diff --git a/sources/share/20150407 10 Truly Amusing Easter Eggs in Linux.md b/sources/share/20150407 10 Truly Amusing Easter Eggs in Linux.md new file mode 100644 index 0000000000..3ab7f47b79 --- /dev/null +++ b/sources/share/20150407 10 Truly Amusing Easter Eggs in Linux.md @@ -0,0 +1,154 @@ +10 Truly Amusing Easter Eggs in Linux +================================================================================ +![](http://en.wikipedia.org/wiki/File:Adventure_Easteregg.PNG) +The programmer working on Adventure slipped a secret feature into the game. Instead of getting upset about it, Atari decided to give these sorts of “secret features” a name -- “Easter Eggs” because… you know… you hunt for them. Image credit: Wikipedia. + +Back in 1979, a video game was being developed for the Atari 2600 -- [Adventure][1]. + +The programmer working on Adventure slipped a secret feature into the game which, when the user moved an “invisible square” to a particular wall, allowed entry into a “secret room”. That room contained a simple phrase: “Created by [Warren Robinett][2]”. + +Atari had a policy against putting author credits in their games, so this intrepid programmer put his John Hancock on the game by being, well, sneaky. Atari only found out about the “secret room” after Warren Robinett had left the company. Instead of getting upset about it, Atari decided to give these sorts of “secret features” a name -- “Easter Eggs” because… you know… you hunt for them -- and declared that they would be putting more of these “Easter Eggs” in future games. + +This wasn’t the first such “hidden feature” built into a piece of software (that distinction goes to an operating system for the [PDP-10][3] from 1966, but this was the first time it was given a name. And it was the first time it really grabbed the attention of most computer users and gamers. + +Linux (and Linux related software) has not been left out. Some truly amusing Easter Eggs have been created for our beloved operating system over the years. Here are some of my personal favorites -- with how to achieve them. + +You’ll notice, rather quickly, that most of these are experienced via a terminal. That’s on purpose. Because terminals are cool. [I should also take this moment to say that if you try to run an application I list, and you do not have it installed, it will not work. You should install it first. Because… computers.] + +### Arch : Pac-Man in pacman ### + +We’re going to start with one just for the [Arch Linux][4] fans out there. You can add a [Pac-Man][5]-esque character to your progress bars in “[pacman][6]” (the Arch package manager). Why this isn’t enabled by default is beyond me. + +To do this you’ll want to edit “/etc/pacman.conf” in your favorite text editor. Under the “# Misc options” section, remove the “#” in front of “Color” and add the line “ILoveCandy”. Because Pac-Man loves candy. + +That’s it! Next time you fire up a terminal and run pacman, you’ll help the little yellow guy get some lunch (or at least some candy). + +### GNU Emacs : Tetris and such ### + +![emacs Tetris](http://www.linux.com/images/stories/41373/emacsTetris.jpg) +I don’t like emacs. Not even a little bit. But it does play Tetris. + +I have a confession to make: I don’t like [emacs][7]. Not even a little bit. + +Some things fill my heart with gladness. Some things take away all my sadness. Some things ease my troubles. That’s [not what emacs does][8]. + +But it does play Tetris. And that’s not nothing. Here’s how: + +Step 1) Launch emacs. (When in doubt, type “emacs”.) + +Step 2) Hit Escape then X on your keyboard. + +Step 3) Type “tetris” and hit Enter. + +Bored of Tetris? Try “pong”, “snake” and a whole host of other little games (and novelties). Take a look in “/usr/share/emacs/*/lisp/play” for the full list. + +### Animals Saying Things ### + +The Linux world has a long and glorious history of animals saying things in a terminal. Here are the ones that are the most important to know by heart. + +On a Debian-based distro? Try typing “apt-get moo". + +![apt-get moo](http://www.linux.com/images/stories/41373/AptGetMoo.jpg) +apt-get moo + +Simple, sure. But it’s a talking cow. So we like it. Then try “aptitude moo”. It will inform you that “There are no Easter Eggs in this program”. + +If there’s one thing you should know about [aptitude][9], it’s that it’s a dirty, filthy liar. If aptitude were wearing pants, the fire could be seen from space. Add a “-v” option to that same command. Keep adding more v’s until you force aptitude to come clean. + +![](http://www.linux.com/images/stories/41373/AptitudeMoo.jpg) +I think we can all agree, that this is probably the most important feature in aptitude. + +I think we can all agree, that this is probably the most important feature in aptitude. But what if you want to put your own words into the mouth of a cow? That’s where “cowsay” comes in. + +And, don’t let the name “cowsay” fool you. You can put words into so much more than just a cow. Like an elephant, Calvin, Beavis and even the Ghostbusters logo. Just do a “cowsay -l” from the terminal to get a complete list of options. + +![](http://www.linux.com/images/stories/41373/cowsay.jpg) +You can put words into so much more than just a cow. + +Want to get really tricky? You can pipe the output of other applications into cowsay. Try “fortune | cowsay”. Lots of fun can be had. + +### Sudo Insult Me Please ### + +Raise your hand if you’ve always wanted your computer to insult you when you do something wrong. Hell. I know I have. Try this: + +Type “sudo visudo” to open the “sudoers” file. In the top of that file you’ll likely see a few lines that start with “Defaults”. At the bottom of that list add “Defaults insults” and save the file. + +Now, whenever you mistype your sudo password, your system will lob insults at you. Confidence boosting phrases such as “Listen, burrito brains, I don’t have time to listen to this trash.”, “Are you on drugs?” and “You’re mind just hasn’t been the same since the electro-shocks, has it?”. + +This one has the side-effect of being a rather fun thing to set on a co-worker's computer. + +### Firefox is cheeky ### + +Here’s one that isn’t done from the Terminal! Huzzah! + +Open up Firefox. In the URL bar type “about:about”. That will give you a list of all of the “about” pages in Firefox. Nothing too fancy there, right? + +Now try “about:mozilla” and you’ll be greeted with a quote from the “[Book of Mozilla][10]” -- the holy book of web browsing. One of my other favorites, “about:robots”, is also quite excellent. + +![](http://www.linux.com/images/stories/41373/About-Mozilla550.jpg) +The “Book of Mozilla” -- the holy book of web browsing. + +### Carefully Crafted Calendar Concoctions ### + +Tired of the boring old [Gregorian Calendar][11]? Ready to mix things up a little bit? Try typing “ddate”. This will print the current date on the [Discordian Calendar][12]. You will be greeted by something that looks like this: + +“Today is Sweetmorn, the 18th day of Discord in the YOLD 3181” + +I hear what you’re saying, “But, this isn’t an Easter Egg!” Shush. I’ll call it an Easter Egg if I want to. + +### Instant l33t Hacker Mode ### + +Want to feel like you’re a super-hacker from a movie? Try setting nmap into “[Script Kiddie][13]” mode (by adding “-oS”) and all of the output will be rendered in the most 3l33t [h@x0r-y way][14] possible. + +Example: “nmap -oS - google.com” + +Do it. You know you want to. Angelina Jolie would be [super impressed][15]. + +### The lolcat Rainbow ### + +Having awesome Easter Eggs and goodies in your Linux terminal is fine and dandy… but what if you want it to have a little more… pizazz? Enter: lolcat. Take the text output of any program and pipe it through lolcat to super-duper-rainbow-ize it. + +![](http://www.linux.com/images/stories/41373/lolcat.jpg) +Take the text output of any program and pipe it through lolcat to super-duper-rainbow-ize it. + +### Cursor Chasing Critter ### + +![oneko cat](http://www.linux.com/images/stories/41373/onekocat.jpg) +“Oneko” -- the Linux port of the classic “Neko”. + +“Oneko” -- the Linux port of the classic “[Neko][16]”. +And that brings us to “oneko” -- the Linux port of the classic “Neko”. Basically a little cat that chases your cursor around the screen. + +While this may not qualify as an “Easter Egg” in the strictest sense of the word, it’s still fun. And it feels Easter Egg-y. + +You can also use different options (such as “oneko -dog”) to use a little dog instead of a cat and a few other tweaks and options. Lots of possibilities for annoying co-workers with this one. + +There you have it! A list of my favorite Linux Easter Eggs (and things of that ilk). Feel free to add your own favorite in the comments section below. Because this is the Internet. And you can do that sort of thing. + +-------------------------------------------------------------------------------- + +via: http://www.linux.com/news/software/applications/820944-10-truly-amusing-linux-easter-eggs- + +作者:[Bryan Lunduke][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linux.com/community/forums/person/56734 +[1]:http://en.wikipedia.org/wiki/Adventure_(Atari_2600) +[2]:http://en.wikipedia.org/wiki/Warren_Robinett +[3]:http://en.wikipedia.org/wiki/PDP-10 +[4]:http://en.wikipedia.org/wiki/Arch_Linux +[5]:http://en.wikipedia.org/wiki/Pac-Man +[6]:http://www.linux.com/news/software/applications/820944-10-truly-amusing-linux-easter-eggs-#Pacman +[7]:http://en.wikipedia.org/wiki/GNU_Emacs +[8]:https://www.youtube.com/watch?v=AQ4NAZPi2js +[9]:https://wiki.debian.org/Aptitude +[10]:http://en.wikipedia.org/wiki/The_Book_of_Mozilla +[11]:http://en.wikipedia.org/wiki/Gregorian_calendar +[12]:http://en.wikipedia.org/wiki/Discordian_calendar +[13]:http://nmap.org/book/output-formats-script-kiddie.html +[14]:http://nmap.org/book/output-formats-script-kiddie.html +[15]:https://www.youtube.com/watch?v=Ql1uLyuWra8 +[16]:http://en.wikipedia.org/wiki/Neko_%28computer_program%29 diff --git a/sources/share/20150527 3 Open Source Python Shells.md b/sources/share/20150527 3 Open Source Python Shells.md new file mode 100644 index 0000000000..c510096670 --- /dev/null +++ b/sources/share/20150527 3 Open Source Python Shells.md @@ -0,0 +1,99 @@ +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/ \ No newline at end of file diff --git a/sources/share/20150527 Animated Wallpaper Adds Live Backgrounds To Linux Distros.md b/sources/share/20150527 Animated Wallpaper Adds Live Backgrounds To Linux Distros.md new file mode 100644 index 0000000000..92eff36326 --- /dev/null +++ b/sources/share/20150527 Animated Wallpaper Adds Live Backgrounds To Linux Distros.md @@ -0,0 +1,113 @@ +Animated Wallpaper Adds Live Backgrounds To Linux Distros +================================================================================ +**We know a lot of you love having a stylish Ubuntu desktop to show off.** + +![Live Wallpaper](http://i.imgur.com/9JIUw5p.gif) + +Live Wallpaper + +And as Linux makes it so easy to create a stunning workspace with a minimal effort, that’s understandable! + +Today, we’re highlighting — [re-highlighting][2] for those of you with long memories — a free, open-source tool that can add extra bling your OS screenshots and screencasts. + +It’s called **Live Wallpaper** and (as you can probably guess) it will replace the standard static desktop background with an animated alternative powered by OpenGL. + +And the best bit: it can be installed in Ubuntu very easily. + +### Animated Wallpaper Themes ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/animated-wallpaper-ubuntu-750x383.jpg) + +Live Wallpaper is not the only app of this type, but it is one of the the best. + +It comes with a number of different themes out of the box. + +These range from the subtle (‘noise’) to frenetic (‘nexus’), and caters to everything in between. There’s even the obligatory clock wallpaper inspired by the welcome screen of the Ubuntu Phone: + +- Circles — Clock inspired by Ubuntu Phone with ‘evolving circle’ aura +- Galaxy — Spinning galaxy that can be resized/repositioned +- Gradient Clock — A polar clock overlaid on basic gradient +- Nexus — Brightly colored particles fire across screen +- Noise — A bokeh design similar to the iOS dynamic wallpaper +- Photoslide — Grid of photos from folder (default ~/Photos) animate in/out + +Live Wallpaper is **fully open-source** so there’s nothing to stop imaginative artists with the know-how (and patience) from creating some slick themes of their own. + +### Settings & Features ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/live-wallpaper-gui-settings.jpg) + +Each theme can be configured or customised in some way, though certain themes have more options than others. + +For example, in Nexus (pictured above) you can change the number and colour of the the pulse particles, their size, and their frequency. + +The preferences app also provides a set of **general options** that will apply to all themes. These include: + +- Setting live wallpaper to run on log-in +- Setting a custom background that the animation sits on +- Adjusting the FPS (including option to show FPS on screen) +- Specifying the multi-monitor behaviour + +With so many options available it should be easy to create a background set up that suits you. + +### Drawbacks ### + +#### No Desktop Icons #### + +You can’t add, open or edit files or folders on the desktop while Live Wallpaper is ‘On’. + +The Preferences app does list an option that will, supposedly, let you do this. It may work on really older releases but in our testing, on Ubuntu 14.10, it does nothing. + +One workaround that seems to work for some users of the app on Ubuntu is setting a .png image as the custom background. It doesn’t have to be a transparent .png, simply a .png. + +#### Resource Usage #### + +Animated wallpapers use more system resources than standard background images. + +We’re not talking about 50% load at all times —at least not with this app in our testing— but those on low-power devices and laptops will want to use apps like this cautiously. Use a [system monitoring tool][2] to keep an eye on CPU and GPU load. + +#### Quitting the app #### + +The biggest “bug” for me is the absolute lack of “quit” option. + +Sure, the animated wallpaper can be turned off from the Indicator Applet and the Preferences tool but quitting the app entirely, quitting the indicator applet? Nope. To do that I have to use the ‘pkill livewallpaper’ command in the Terminal. + +### How to Install Live Wallpaper in Ubuntu 14.04 LTS + ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/terminal-command-750x146.jpg) + +To install Live Wallpaper in Ubuntu 14.04 LTS and above you will first need to add the official PPA for the app to your Software Sources. + +The quickest way to do this is using the Terminal: + + sudo add-apt-repository ppa:fyrmir/livewallpaper-daily + + sudo apt-get update && sudo apt-get install livewallpaper + +You should also install the indicator applet, which lets you quickly and easily turn on/off the animated wallpaper and switch theme from the menu area, and the GUI settings tool so that you can configure each theme based on your tastes. + + sudo apt-get install livewallpaper-config livewallpaper-indicator + +When everything has installed you will be able to launch the app and its preferences tool from the Unity Dash. + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/live-wallpaper-app-launcher.png) + +Annoyingly, the Indicator Applet won’t automatically open after you install it. It does add itself to the start up list, so a quick log out > log in will get it to show. + +### Summary ### + +If you fancy breathing life into a dull desktop, give it a spin — and let us know what you think of it and what animated wallpapers you’d love to see added! + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/05/animated-wallpaper-adds-live-backgrounds-to-linux-distros + +作者:[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]:http://www.omgubuntu.co.uk/2012/11/live-wallpaper-for-ubuntu +[2]:http://www.omgubuntu.co.uk/2011/11/5-system-monitoring-tools-for-ubuntu \ No newline at end of file diff --git a/sources/share/20150604 12 Globally Recognized Linux Certifications.md b/sources/share/20150604 12 Globally Recognized Linux Certifications.md new file mode 100644 index 0000000000..4ec185770b --- /dev/null +++ b/sources/share/20150604 12 Globally Recognized Linux Certifications.md @@ -0,0 +1,173 @@ +translating wi-cuckoo +12 Globally Recognized Linux Certifications +================================================================================ +Hi everyone, today we'll learn about some of the very precious globally recognized Linux Certifications. Linux Certifications are the certification programme hosted by different Linux Professional Institutes across the globe. Linux Certifications allows Linux Professionals to get easily enrolled with the Linux related jobs in servers, companies, etc. Linux Certifications enables how much a person is expertise in that respective field of Linux. There are pretty many Linux Professional Institutes providing different Linux Certifications. But there are some few well recognized Linux Certification Programmes running across the globe which are at high priority while getting a job in companies where we need to manage servers, virtualizations, installations, configurations, application support and other stuffs with Linux Operating System. With the increment of servers running Linux Operating System throughout the globe, the demand of Linux Professional are increasing. For better authenticated and authorized Linux Professional, better and renowned Certifications are always at higher priority by the companies across the globe. + +Here are some globally recognized Linux Certifications that we'll discuss about. + +### 1. CompTIA Linux+ ### + +CompTIA Linux+ is a Linux Certification programme hosted by LPI "Linux Professional Institute" providing knowledge all over the world. It provides knowledge on Linux which enables to produce a bunch of Linux related Professional jobs like Linux Administrators, Junior Network Administrators, Systems Administrators, Linux Database Administrators and Web Administrators. If anyone is aware of installing and maintaining Linux Operating System, this course will help to meet the certification requirements and prepare for the exam by providing with a broad awareness of Linux operating systems. The main objective of CompTIA Linux+ Certification by LPI is to provide the certificate holders enough knowledge on a critical knowledge of installation, operation, administration and troubleshooting devices. We can earn three industry-recognized certifications for the cost, time, and effort of one, by completing the CompTIA Linux+ powered by LPI certification, we can automatically receive the **LPI LPIC-1** and the **SUSE Certified Linux Administrator (CLA)** certifications. + +- **Certification Codes** : LX0-103 and LX0-104 (launches March 30, 2015) OR LX0-101 and LX0-102 +- Number of questions: 60 questions per exam +- Type of Questions: Multiple choice +- Length of test period: 90 minutes +- Prerequisites: A+, Network+ and at least 12 months of Linux administration experience +- Passing score: 500 (on a scale of 200-800) +- Languages: English. Coming soon on German, Portuguese (Brazilian), Traditional Chinese, Spanish. +- Validity: Valid till 3 Years after certified. + +**Note**: Exams from different series cannot be combined. If you start with LX0-101, you MUST take LX0-102 to complete your certification. The same applies for the LX0-103 and LX0-104 series. The LX0-103 and LX0-104 series is an update to the LX0-101 and LX0-102 series. + +### 2. LPIC ### + +LPIC stands for Linux Professional Institute Certification which is a Linux certification programme by Linux Professional Institute. It is a multi level certification program which requires passing of a number (usually two) certification exams for each level. There are three levels of certification which includes Junior Level Certification **LPIC-1**, Advanced Level Certification **LPIC-2** and Senior Level Certification **LPIC-3**. The first two certification aims on **Linux System Administration** whereas the final certification aims on several specialties including Virtualization and Security. To become **LPIC-3** certified, a candidate with an active **LPIC-1** and **LPIC-2** certification must pass at least one of 300 Mixed Environment, 303 Security and 304 Virtualization and High Availability. LPIC-1 certification is designed in such a way that the certification holder will be able to install, maintain, configure tasks running Linux with command line interface with basic networking where as LPIC-2 certification validates candidate to administer small to medium–sized mixed networks. LPIC-3 certification is designed for enterprise-level Linux professional and represents the highest level of professional, distribution-neutral Linux certification within the industry. + +- **Certification Codes** : LPIC-1 (101 and 102), LPIC-2 (201 and 202) and LPIC-3 (300, 303 or 304) +- Type of Questions: 60 Multiple choice questions +- Length of Test Period: 90 minutes +- Prerequisites: None, Linux Essentials is recommended +- Passing Score: 500 (on a scale of 200-800) +- Languages: LPIC-1: English, German, Italian, Portuguese (Brazilian), Spanish (Modern), Chinese (Simplified), Chinese (Traditional), Japanese +- LPIC-2: English, German, Portuguese (Brazilian), Japanese +- LPIC-3: English, Japanese +- Validity: Valid till 5 years of Retirement. + +### 3. Oracle Linux OCA ### + +Oracle Certified Associate (OCA) is designed for the individuals who are interested for a strong foundation of knowledge to implement and administer the Oracle Linux Operating System. This certification expertise individuals on the Oracle Linux distribution that's fully optimized for Oracle products and for running on Oracle's engineered systems including Oracle Exadata Database Machine, Oracle Exalytics In-Memory Machine, Oracle Exalogic Elastic Cloud, and Oracle Database Appliance. Oracle Linux's Unbreakable Enterprise Kernel delivers extreme performance, advanced scalability and reliability for enterprise applications. The OCA certification covers objectives such as managing local disk devices, managing file systems, installing and removing Solaris packages and patches, performing system boot procedures and system processes. It is initial step in achievement of flagship of OCP credential. This certification was formerly known as Sun Certified Solaris Associate (SCSAS). + +- **Certification Codes** : OCA +- Type of Questions: 75 Multiple choice questions +- Length of Test Period: 120 minutes +- Prerequisites: None +- Passing Score: 64% +- Validity: Never Expires + +### 4. Oracle Linux OCP ### + +Oracle Certified Professional (OCP) is the certification provided by Oracle Corporation for Oracle Linux which covers more advanced knowledge and skills of an Oracle Linux Administrator. It covers knowledge such as configuring network interfaces, managing swap configurations, crash dumps, managing applications, databases and core files. OCP certification is benchmark of technical expertise and professional skill needed for developing, implementing, and managing applications, middleware and databases widely in enterprise. Job opportunities for Oracle Linux OCP are increased depending on job market and economy. It is designed such a way that the certificate holder has the ability to perform security administration, prepare Oracle Linux system for Oracle database, troubleshoot problems and perform corrective action, install software packages, installing and configuring kernel modules, maintain swap space, perform User and Group administration, creating file systems, configuring logical volume manager (LVM), file sharing services and more. + +- **Certification Codes** : OCP +- Type of Questions: 60 to 80 Multiple choice questions +- Length of Test Period: 120 minutes +- Prerequisites: Oracle Linux OCA +- Passing Score: 64% +- Validity: Never Expires + +### 5. RHCSA ### + +RHCSA is a certification programme by Red Hat Incorporation as Red Hat Certified System Administrator. RHCSAs are the person who has the skill, and ability to perform core system administrations in the renowned Red Hat Linux environments. It is an initial entry-level certification programme that focuses on actual competencies at system administration, including installation and configuration of a Red Hat Linux system and attaching it to a live network running network services. A Red Hat Certified System Administrator (RHCSA) is able to understand and use essential tools for handling files, directories, command-line environments, and documentation, operate running systems, including booting into different run levels, identifying processes, starting and stopping virtual machines, and controlling services, configure local storage using partitions and logical volumes, create and configure file systems and file system attributes, such as permissions, encryption, access control lists, and network file systemsm, deploy, configure, and maintain systems, including software installation, update, and core services, manage users and groups, including use of a centralized directory for authentication, security, including basic firewall and SELinux configuration. One should be RHCSA certified to gain RHCE and other certifications. + +- **Certification Codes** : RHCSA +- Course Codes: RH124, RH134 and RH199 +- Exam Codes: EX200 +- Length of Test Period: 21-22 hours depending on the elective course choosen. +- Prerequisites: None. Better if has some fundamental knowledge of Linux. +- Passing Score: 210 out of 300 points (70%) +- Validity: 3 years + +### 6. RHCE ### + +RHCE, also known as Red Hat Certified Engineer is a mid to advanced level certification programme for Red Hat Certified System Administrator (RHCSA) who wants to acquire additional skills and knowledge required of a senior system administrator responsible for Red Hat Enterprise Linux. RHCE has the ability, knowledge and skills of configuring static routes, packet filtering, and network address translation, setting kernel runtime parameters, configuring an Internet Small Computer System Interface (iSCSI) initiator, producing and delivering reports on system utilization, using shell scripting to automate system maintenance tasks, configuring system logging, including remote logging, system to provide networking services including HTTP/HTTPS, File Transfer Protocol (FTP), network file system (NFS), server message block (SMB), Simple Mail Transfer Protocol (SMTP), secure shell (SSH) and Network Time Protocol (NTP) and more. RHCSAs who wish to earn a more senior-level credential and who have completed System Administration I, II, and II, or who have completed the RHCE Rapid Track Course is recommended to go for RHCE certification. + +- **Certification Codes** : RHCE +- Course Codes: RH124, RH134, RH254 and RH199 +- Exam Codes: EX200 and EX300 +- Length of Test Period: 21-22 hours depending on the elective course choosen. +- Prerequisites: A RHCSA credential +- Passing Score: 210 out of 300 (70%) +- Validity: 3 years + +### 7. RHCA ### + +RHCA stands for Red Hat Certified Architect which is a certification programme by Red Hat Incorporation. It focuses on actual competencies at system administration, including installation and configuration of a Red Hat Linux system and attaching it to a live network running network services. RHCA is the highest level of certification of all the Red Hat Certifications. Candidates are required to choose the concentration they wish to focus on or can choose any combination of eligible Red Hat certifications to create a custom concentration of their own. There are three main concentration Datacenter, Cloud and Application Platform. RHCA with the concentration of Datacenter has the skills and ability to work, manage a datacenter whereas with the concentration of Cloud has the ability create, configure and manage private, hybrid clouds, cloud application platforms, flexible storage solutions using Red Hat Enterprise Linux Platform. RHCA with the concentration of Application Platform includes skills like installing, configuring and managing Red Hat JBoss Enterprise Application Platform and applications, cloud application platforms and hybrid cloud environments with OpenShift Enterprise by Red Hat and federating data from multiple sources using Red Hat JBoss Data Virtualization. + +- **Certification Codes** : RHCA +- Course Codes: CL210,CL220,CL280, RH236, RH318,RH401,RH413, RH436,RH442,JB248 and JB450 +- Exam Codes: EX333, EX401, EX423 or EX318, EX436 and EX442 +- Length of Test Period: 21-22 hours depending on the elective course choosen. +- Prerequisites: Active RHCE credential +- Passing Score: 210 out of 300 (70%) +- Validity: 3 years + +### 8. SUSE CLA ### + +SUSE Certified Linux Administrator (SUSE CLA) is a initialcertification by SUSE which focuses on daily administration tasks in SUSE Linux Enterprise Server environments. To gain SUSE CLA certification, it is not necessary to perform the course work, one has to pass the examination to get certified. SUSE CLA are capable and has skills to use Linux Desktop, locate and use help resources, manage Linux File System, work with the Linux Shell and Command Line, install SLE 11 SP22, manage system installation, hardware, backup and recovery, administer Linux with YaST, linux processes and services, storage, configure network, remote access, monitor SLE 11 SP2, automate tasks and manage user access and security. We can gain dual certificates of SUSE CLA and LPIC-1 and CompTIA Linux powered by LPI as SUSE, Linux Professional Institute and CompTIA have teamed up to offer you the chance to earn three Linux certifications. + +- **Certification Codes** : SUSE CLA +- Course Codes: 3115, 3116 +- Exam Codes: 050-720, 050-710 +- Type of Questions: multiple choice exams +- Length of Test Period: 90 minutes +- Prerequisites: None +- Passing Score: 512 + +### 9. SUSE CLP ### + +SUSE Certified Linux Professional (CLP) is a certification programme for the one who is interested to gain more seniority and professionalism in SUSE Linux Enterprise Servers. SUSE CLP is the next step after receiving the SUSE CLA certificate. One should pass the examination and should have certification of CLA to gain the certification of CLP thought the candidate has passed the examination of CLP. SUSE CLP certified person has the skills and ability of installing and configuring SUSE Linux Enterprise Server 11 systems, maintaining the file system, managing softwarepackages, processes, printing, configuring fundamental network services, samba, web servers, using IPv6 and creating and running bash shell scripts. + +- **Certification Codes** : SUSE CLP +- Course Codes: 3115, 3116 and 3117 +- Exam Codes: 050-721, 050-697 +- Type of Test: hands on +- Length of Test Period: 180 minute practicum +- Prerequisites: SUSE CLA Certified + +### 10. SUSE CLE ### + +SUSE Certified Linux Engineer (CLE) is an engineer level advanced certification for those candidates who have passed the examination of CLE. To acquire a CLE certificate, one should gain the certificates of SUSE CLA and SUSE CLP. The candidate gaining the CLE certification has the skills of architecting complex SUSE Linux Enterprise Server environments. CLE certified person has the skill to configure fundamental networking services, manage printing, configure and use Open LDAP, samba, web servers, IPv6, perform Health Check and Performance Tuning, create and execute Shell Scripts, deploy SUSE Linux Enterprise, virtualization with Xen and more. + +- **Certification Codes** : SUSE CLE +- Course Codes: 3107 +- Exam Codes: 050-723 +- Type of Test: hands on +- Length of Test Period: 120 minute practicum +- Prerequisites: SUSE CLP 10 or 11 Certified + +### 11. LFCS ### + +Linux Foundation Certified System Admin (LFCS) certified candidates possesses knowledge on the use of Linux and using Linux with the terminal environment. LFCS is a certification programme by Linux Foundation for system administrators and engineers working with the Linux operating system. The Linux Foundation collaborated with industry experts and the Linux kernel community to identify the core domains and the critical skills, knowledge and abilities applicable for the certification. LFCS certified candidates has the skills, knowledge and ability of editing and manipulating text files on the command line, managing and troubleshooting File Systems and Storage, assembling partitions as LVM devices, configuring SWAP partitions, managing networked filesystems, managing user accounts, permissions and ownerships, maintaining security, creating and executing bash shell scripts, installing, upgrading, removing software packages and more. + +- **Certification Codes** : LFCS +- Course Codes: LFS201, LFS220 (Optional) +- Exam Codes: LFCS exam +- Length of Test Period: 2 hours +- Prerequisites: None. +- Passing Score: 74% +- Languages: English +- Validity: 2 years + +### 12. LFCE ### + +Linux Foundation Certified Engineer (LFCE), a certification for Linux Engineers by Linux Foundation. LFCE certified candidates possesses a wider range of skills on Linux than LFCS. It is a engineer-level advanced certification programme. The LFCE certified candidates possesses skills and abilities of Network Administraton like configuring network services, configuring packet filtering, monitor network performance, IP traffics, configuring filesystems and file services, network filesystems, install, update packages from the repositories, managing network security, configuring iptables, http services, proxy servers, email servers and many more. It is believed that LFCE is pretty difficult to pass and study than LFCS as its advanced engineering level certification programme. + +- **Certification Codes** : LFCE +- Course Codes: LFS230 +- Exam Codes: LFCE exam +- Length of Test Period: 2 hours +- Prerequisites: LFCS certified. +- Passing Score: 72% +- Languages: English +- Validity: 2 years + +### Facts we found (This is only our views) ### + +Recent surveys conducted on different top recruitment agency, says 80% of linux job profile preferred Redhat certification. If you are a student / newbie and want to learn linux then we prefer Linux Foundation Certifications as its getting much popular or CompTIA Linux would be also a choice. If you already know oracle or suse or working on their products then would prefer oracle / suse linux or if you working in an company these certification might enhance your career growth :-) + +### Conclusion ### + +There are thousands of big companies in this world running servers and mainframes running Linux Operating System, to handle, configure and work on those servers there is always a need of highly qualified and certified Linux Technical/Professional. These globally recognized Linux certificates has a big role of someones career in Linux. The companies around the world running Linux and wanting Linux Engineers, System Administrators and ethusiasts chooses one who has gained certificates and has good score in the related field of Linux. Globally recognized certifications are highly essential for excellence in the profession and career in Linux, so preparing best for the examination and getting the certification is a good choice for building career in Linux. If you have any questions, comments, feedback please do write on the comment box below and let us know what stuffs needs to be added or improved. Thank You! :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/12-globally-recognized-linux-certifications/ + +作者:[Arun Pyasi][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ diff --git a/sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md b/sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md new file mode 100644 index 0000000000..28b0a76083 --- /dev/null +++ b/sources/share/20150604 Read about The Document Foundation achievements in 2014--download the Annual Report.md @@ -0,0 +1,34 @@ +sevenot translating +Read about The Document Foundation achievements in 2014: download the Annual Report! +================================================================================ +![](https://documentfoundation.files.wordpress.com/2015/06/tdf-report.jpg) + +TDF ReportThe Document Foundation (TDF) is proud to announce its 2014 Annual Report, which can be downloaded from the following link: [http://tdf.io/report2014][1] (3.2 MB PDF). The version with HD images can be downloaded from [http://tdf.io/report2014hq][2] (15.9 MB PDF). + +TDF Annual Report starts with a Review of 2014, with highlights about TDF and LibreOffice, and a summary of financials and budget. + +Community, Projects & Events covers the LibreOffice Conference 2014 in Bern, Certification, Website and QA, Hackfests in Brussels, Gran Canaria, Paris, Boston and Tolouse, Native-Language Projects, Infrastructure, Documentation, Marketing and Design. + +Software, Development & Code reports about the activities of the Engineering Steering Committee, LibreOffice Development, the Document Liberation Project and LibreOffice on Android. + +The last section focuses on People, starting with Top Contributors, followed by TDF Staff, the Board of Directors and the Membership Committee, the Board of Trustees, or the body of TDF Members, and the Advisory Board. + +TDF 2014 Annual Report has been edited by Sophie Gautier, Alexander Werner, Christian Lohmaier, Florian Effenberger, Italo Vignoli and Robinson Tryon, and designed by Barak Paz, with the help of the fantastic LibreOffice community. + +To allow the widest distribution of the document, this is released with a CC BY 3.0 DE License, unless otherwise noted, to TDF Members and free software advocates worldwide. + +[The German version of TDF Annual Report is available from [http://tdf.io/bericht2014][3]]. + +-------------------------------------------------------------------------------- + +via: http://blog.documentfoundation.org/2015/06/03/read-about-the-document-foundation-achievements-in-2014-download-the-annual-report/ + +作者:italovignoli +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[1]:https://wiki.documentfoundation.org/File:TDF2014AnnualReport.pdf +[2]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportHQ.pdf +[3]:https://wiki.documentfoundation.org/File:TDF2014AnnualReportDE.pdf \ No newline at end of file diff --git a/sources/talk/20140818 Upstream and Downstream--why packaging takes time.md b/sources/talk/20140818 Upstream and Downstream--why packaging takes time.md deleted file mode 100644 index fc1c708b14..0000000000 --- a/sources/talk/20140818 Upstream and Downstream--why packaging takes time.md +++ /dev/null @@ -1,97 +0,0 @@ -Upstream and Downstream: why packaging takes time -================================================================================ -Here in the KDE office in Barcelona some people spend their time on purely upstream KDE projects and some of us are primarily interested in making distros work which mean our users can get all the stuff we make. I've been asked why we don't just automate the packaging and go and do more productive things. One view of making on a distro like Kubuntu is that its just a way to package up the hard work done by others to take all the credit. I don't deny that, but there's quite a lot to the packaging of all that hard work, for a start there's a lot of it these days. - -"KDE" used to be released once every nine months or less frequently. But yesterday I released the [first bugfix update to Plasma][1], to make that happen I spent some time on Thursday with David making the [first update to Frameworks 5][2]. But Plasma 5 is still a work in progress for us distros, let's not forget about [KDE SC 4.13.3][3] which Philip has done his usual spectacular job of updating in the 14.04 LTS archive or [KDE SC 4.14 betas][4] which Scarlett has been packaging for utopic and backporting to 14.04 LTS. KDE SC used to be 20 tars, now it's 169 and over 50 langauge packs. - -### Patches ### - -If we were packaging it without any automation as used to be done it would take an age but of course we do automate the repetative tasks, the [KDE SC 4.13.97 status][5] page shows all the packages and highlights obvious problems. But with 169 tars even running the automated script takes a while, then you have to fix any patches that no longer apply. We have [policies][6] to disuade having patches, any patches should be upstream in KDE or on their way upstream, but sometimes it's unavoidable that we have some to maintain which often need small changes for each upstream release. - -### Symbols ### - -Much of what we package are libraries and if one small bit changes in the library, any applications which use that library will crash. This is ABI and the rules for [binary compatibility][7] in C++ are nuts. Not infrequently someone in KDE will alter a library ABI without realising. So we maintain symbol files to list all the symbols, these can often feel like more trouble than they're worth because they need updated when a new version of GCC produces different symbols or when symbols disappear and on investigation they turn out to be marked private and nobody will be using them anyway, but if you miss a change and apps start crashing as nearly happened in KDE PIM last week then people get grumpy. - -### Copyright ### - -Debian, and so Ubuntu, documents the copyright licence of every files in every package. This is a very slow and tedious job but it's important that it's done both upstream and downstream because it you don't people won't want to use your software in a commercial setting and at worst you could end up in court. So I maintain the [licensing policy][8] and not infrequently have to fix bits which are incorrectly or unclearly licenced and answer questions such as today I was reviewing whether a kcm in frameworks had to be LGPL licenced for Eike. We write a copyright file for every package and again this can feel like more trouble than its worth, there's no easy way to automate it but by some readings of the licence texts it's necessary to comply with them and it's just good practice. It also means that if someone starts making claims like requiring licencing for already distributed binary packages I'm in an informed position to correct such nonsense. - -### Descriptions ### - -When we were packaging KDE Frameworks from scratch we had to find a descirption of each Framework. Despite policies for metadata some were quite underdescribed so we had to go and search for a sensible descirption for them. Infact not infrequently we'll need to use a new library which doesn't even have a sensible paragraph describing what it does. We need to be able to make a package show something of a human face. - -### Multiarch ### - -A recent addition to the world of .deb packaging is [MultiArch][9] which allows i386 packages to be installed on amd64 computers as well as some even more obscure combinations (powerpc on ppcel64 anyone?). This lets you run Skype on your amd64 computer without messy cludges like the ia32-libs package. However it needs quite a lot of attention from packagers of libraries marking which packages are multiarch, which depend on other multiarch or arch independent packages and even after packaging KDE Frameworks I'm not entirely comfortable with doing it. - -### Splitting up Packages ### - -We spend lots of time splitting up packages. When say Calligra gets released it's all in one big tar but you don't want all of it on your system because you just want to write a letter in Calligra Words and Krita has lots of image and other data files which take up lots of space you don't care for. So for each new release we have to work out which of the installed files go into which .deb package. It takes time and even worse occationally we can get it wrong but if you don't want heaps of stuff on your computer you don't need then it needs to be done. It's also needed for library upgrades, if there's a new version of libfoo and not all the programs have been ported to it then you can install libfoo1 and libfoo2 on the same system without problems. That's not possible with distros which don't split up packages. - -One messy side effect of this is that when a file moves from one .deb to another .deb made by the same sources, maybe Debian chose to split it another way and we want to follow them, then it needs a Breaks/Replaces/Conflicts added. This is a pretty messy part of .deb packaging, you need to specify which version it Breaks/Replaces/Conflicts and depending on the type of move you need to specify some combination of these three fields but even experienced packages seem to be unclear on which. And then if a backport (with files in original places) is released which has a newer version than the version you specify in the Breaks/Replaces/Conflicts it just refuses to install and stops half way through installing until a new upload is made which updates the Breaks/Replaces/Conflicts version in the packaging. I'd be interested in how this is solved in the RPM world. - -### Debian Merges ### - -Ubuntu is forked from Debian and to piggy back on their work (and add our own bugs while taking the credit) we merge in Debian's packaging at the start of each cycle. This is fiddly work involving going through the diff (and for patches that's often a diff of a diff) and changelog to work out why each alternation was made. Then we merge them together, it takes time and it's error prone but it's what allows Ubuntu to be one of the most up to date distros around even while much of the work gone into maintaining universe packages not part of some flavour has slowed down. - -### Stable Release Updates ### - -You have Kubuntu 14.04 LTS but you want more? You want bugfixes too? Oh but you want them without the possibility of regressions? Ubuntu has quite strict definition of what's allowed in after an Ubuntu release is made, this is because once upon a time someone uploaded a fix for X which had the side effect of breaking X on half the installs out there. So for any updates to get into the archive they can only be for certain packages with a track record of making bug fix releases without sneaking in new features or breaking bits. They need to be tested, have some time passed to allow for wider testing, be tested again using the versions compiled in Launchpad and then released. KDE makes bugfix releases of KDE SC every month and we update them in the latest stable and LTS releases as [4.13.3 was this week][10]. But it's not a process you can rush and will take a couple of weeks usually. That 4.13.3 update was even later then usual because we were busy with Plasma 5 and whatnot. And it's not perfect, a bug in Baloo did get through with 4.13.2. But it would be even worse if we did rush it. - -### Backports ### - -Ah but you want new features too? We don't allow in new features into the normal updates because they will have more chance of having regressions. That's why we make backports, either in the kubuntu-ppa/backports archive or in the ubuntu backports archive. This involves running the package through another automation script to change whever needs changed for the backport then compiling it all, testing it and releasing it. Maintaining and running that backport script is quite faffy so sending your thanks is always appreciated. - -We have an allowance to upload new bugfix (micro releases) of KDE SC to the ubuntu archive because KDE SC has a good track record of fixing things and not breaking them. When we come to wanting to update Plasma we'll need to argue for another allowance. One controvertial issue in KDE Frameworks is that there's no bugfix releases, only monthly releases with new features. These are unlikely to get into the Ubuntu archive, we can try to argue the case that with automated tests and other processes the quality is high enough, but it'll be a hard sell. - -### Crack of the Day ### - -Project Neon provides packages of daily builds of parts of KDE from Git. And there's weekly ISOs that are made from this too. These guys rock. The packages are monolithic and install in /opt to be able to live alongside your normal KDE software. - -### Co-installability ### - -You should be able to run KDELibs 4 software on a Plasma 5 desktop. I spent quite a bit of time ensuring this is possible by having no overlapping files in kdelibs/kde-runtime and kde frameworks and some parts of Plasma. This wasn't done primarily for Kubuntu, many of the files could have been split out into .deb packages that could be shared between KDELibs 4 and Plasma 5, but other disros which just installs packages in a monolithic style benefitted. Some projects like Baloo didn't ensure they were co-installable, fine for Kubuntu as we can separate the libraries that need to be coinstalled from the binaries, but other distros won't be so happy. - -### Automated Testing ### - -Increasingly KDE software comes with its own test suite. Test suites are something that has been late coming to free software (and maybe software in general) but now it's here we can have higher confidence that the software is bug free. We run these test suites as part of the package compilation process and not infrequently find that the test suite doesn't run, I've been told that it's not expected for packagers to use it in the past. And of course tests fail. - -### Obscure Architectures ### - -In Ubuntu we have some obscure architectures. 64-bit Arm is likely to be a useful platform in the years to come. I'm not sure why we care about 64-bit powerpc, I can only assume someone has paid Canonical to care about it. Not infrequently we find software compiles fine on normal PCs but breaks on these obscure platforms and we need to debug why they is. This can be a slow process on ARM which takes an age to do anything, or very slow where I don't even have access to a machine to test on, but it's all part of being part of a distro with many use-cases. - -### Future Changes ### - -At Kubuntu we've never shared infrstructure with Debian despite having 99% the same packaging. This is because Ubuntu to an extent defines itself as being the technical awesomeness of Debian with smoother processes. But for some time Debian has used git while we've used the slower bzr (it was an early plan to make Ubuntu take over the world of distributed revision control with Bzr but then Git came along and turned out to be much faster even if harder to get your head around) and they've also moved to team maintainership so at last we're planning [shared repositories][11]. That'll mean many changes in our scripts but should remove much of the headache of merges each cycle. - -There's also a proposal to [move our packaging to daily builds][12] so we won't have to spend a lot of time updating packaging at every release. I'm skeptical if the hassle of the infrastructure for this plus fixing packaging problems as they occur each day will be less work than doing it for each release but it's worth a try. - -### ISO Testing ### - -Every 6 months we make an Ubuntu release (which includes all the flavours of which Ubuntu [Unity] is the flagship and Kubuntu is the most handsome) and there's alphas and betas before that which all need to be tested to ensure they actually install and run. Some of the pain of this has reduced since we've done away with the alternative (text debian-installer) images but we're nowhere near where Ubuntu [Unity] or OpenSUSE is with OpenQA where there are automated installs running all the time in various setups and some magic detects problems. I'd love to have this set up. - -I'd welcome comments on how any workflow here can be improved or how it compares to other distributions. It takes time but in Kubuntu we have a good track record of contributing fixes upstream and we all are part of KDE as well as Kubuntu. As well as the tasks I list above about checking copyright or co-installability I do Plasma releases currently, I just saw Harald do a Phonon release and Scott's just applied for a KDE account for fixes to PyKDE. And as ever we welcome more people to join us, we're in #kubuntu-devel where free hugs can be found, and we're having a whole day of Kubuntu love at Akademy. - --------------------------------------------------------------------------------- - -via: https://blogs.kde.org/2014/08/13/upstream-and-downstream-why-packaging-takes-time - -作者:[Jonathan Riddell][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://blogs.kde.org/users/jriddell -[1]:https://dot.kde.org/2014/08/12/first-bugfix-update-plasma-5 -[2]:https://dot.kde.org/2014/08/07/kde-frameworks-5.1 -[3]:http://www.kubuntu.org/news/kde-sc-4.13.3 -[4]:https://dot.kde.org/2014/07/18/kde-ships-july-updates-and-second-beta-applications-and-platform-414 -[5]:http://qa.kubuntu.co.uk/ninjas-status/build_status_4.13.97_utopic.html -[6]:https://community.kde.org/Kubuntu/Policies -[7]:https://techbase.kde.org/Policies/Binary_Compatibility_Issues_With_C++ -[8]:https://techbase.kde.org/Policies/Licensing_Policy -[9]:https://help.ubuntu.com/community/MultiArch -[10]:http://www.kubuntu.org/news/kde-sc-4.13.3 -[11]:http://lists.alioth.debian.org/pipermail/pkg-kde-talk/2014-August/001934.html -[12]:https://lists.ubuntu.com/archives/kubuntu-devel/2014-August/008651.html \ No newline at end of file diff --git a/sources/talk/20141211 Open source all over the world.md b/sources/talk/20141211 Open source all over the world.md index 175d870cb7..bd306edd5a 100644 --- a/sources/talk/20141211 Open source all over the world.md +++ b/sources/talk/20141211 Open source all over the world.md @@ -1,6 +1,3 @@ -////translating by yupmoon - - Open source all over the world ================================================================================ ![](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/BUS_OpenSourceExperience_520x292_cm.png) diff --git a/sources/talk/20141217 Docker and the Integrated Open Source Company.md b/sources/talk/20141217 Docker and the Integrated Open Source Company.md deleted file mode 100644 index 5a98324135..0000000000 --- a/sources/talk/20141217 Docker and the Integrated Open Source Company.md +++ /dev/null @@ -1,81 +0,0 @@ -Docker and the Integrated Open Source Company -================================================================================ -It’s been a long time since an open source project has gotten as much buzz and attention as Docker. The easiest way to explain the concept is, well, to look at the logo of the eponymous1 company that created and manages the project: - -![](http://2yj23r14cytosbxol4cavq337g.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/docker.png) - -The reference in the logo is to shipping containers, one of the most important inventions of the 20th century. Actually, the word “invention” is not quite right: the idea of putting bulk goods into consistently-sized boxes goes back at least a few hundred years.[2][1] What changed the world was the standardization of containers by a trucking magnate named Malcom McLean and Keith Tantlinger, his head engineer. Tantlinger developed much of the technology undergirding the intermodal container, especially its corner casting and Twistlock mechanism that allowed the containers to be stacked on ships, transported by trucks, and moved by crane. More importantly, Tantlinger convinced McLean to release the patented design for anyone to copy without license, knowing that the technology would only be valuable if it were deployed in every port and on every transport ship in the world. Tantlinger, to put it in software terms, open-sourced the design. - -Shipping containers really are a perfect metaphor for what Docker is building: standardized containers for applications. - - -- Just as the idea of a container wasn’t invented by Tantlinger, Docker is building on a concept that has been around for quite a while. Companies like Oracle, HP, and IBM have used containers for many years, and Google especially has a very similar implementation to Docker that they use for internal projects. Docker, though, by being open source and [community-centric][2], offers the promise of standardization -- It doesn’t matter what is inside of a shipping container; the container itself will fit on any ship, truck, or crane in the world. Similarly, it doesn’t matter what app (and associated files, frameworks, dependencies, etc.) is inside of a docker container; the container will run on any Linux distribution and, more importantly, just about every cloud provider including AWS, Azure, Google Cloud Platform, Rackspace, etc. -- When you move abroad, you can literally have a container brought to your house, stick in your belongings, and then have the entire thing moved to a truck to a crane to a ship to your new country. Similarly, containers allow developers to build and test an application on their local machine and have confidence that the application will behave the exact same way when it is pushed out to a server. Because everything is self-contained, the developer does not need to worry about there being different frameworks, versions, and other dependencies in the various places the application might be run - -The implications of this are far-reaching: not only do containers make it easier to manage the lifecycle of an application, they also (theoretically) commoditize cloud services through the age-old hope of “write once run anywhere.” More importantly, at least for now, docker containers offer the potential of being far more efficient than virtual machines. Relative to a container, using virtual machines is like using a car transport ship to move cargo: each unique entity on the ship is self-powered, which means a lot of wasted resources (those car engines aren’t very useful while crossing the ocean). Similarly, each virtual machine has to deal with the overhead of its own OS; containers, on the other hand, all share the same OS resulting in huge efficiency gains.[3][4] - -In short, Docker is a really big deal from a technical perspective. What excites me, though, is that the company is also innovating when it comes to their business model. - ----------- - -The problem with monetizing open source is self-evident: if the software is freely available, what exactly is worth paying for? And, unlike media, you can’t exactly stick an advertisement next to some code! - -For many years the default answer has been to “be like Red Hat.” Red Hat is the creator and maintainer of the Red Hat Enterprise Linux (RHEL) distribution, which, like all Linux distributions, is freely available.[4][5] Red Hat, however, makes money by offering support, training, a certification program, etc. for enterprises looking to use their software. It is very much a traditional enterprise model – make money on support! – just minus the up-front license fees. - -This sort of business is certainly still viable; Hortonworks is [set to IPO][3] with a similar model based on Hadoop, albeit at a much lower valuation than it received during its last VC round. That doesn’t surprise me: I don’t think this is a particularly great model from a business perspective. - -To understand why it’s useful to think about there being three distinct parts of any company that is based on open source: the open source project itself, any value-added software built on top of that project, and the actual means of making money: - -![](http://2yj23r14cytosbxol4cavq337g.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/opensourcepaper.jpg) - -*There are three parts of an open source business: the project itself, the value-added software on top of that project, and the means of monetization* - -The problem with the “Red Hat” model is the complete separation of all three of these parts: Red Hat doesn’t control the core project (Linux), and their value-added software (RHEL) is free, leaving their money-making support program to stand alone. To the company’s credit they have pulled this model off, but I think a big reason is because utilizing Linux was so much more of a challenge back in the 90s.[5][11] I highly doubt Red Hat could successfully build a similar business from scratch today. - -![](http://2yj23r14cytosbxol4cavq337g.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/redhatpaper.jpg) - -*The three parts of Red Hat’s business are separate and more difficult for the company to control and monetize* - -GitHub, the repository hosting service, is exploring what is to my mind a more compelling model. GitHub’s value-added software is a hosting service based on Git, an open-source project designed by Linux creator Linus Torvalds. Crucially, GitHub is seeking to monetize that hosting service directly, both through a SaaS model and through an on-premise enterprise offering[6][6]. This means that, in comparison to Red Hat, there is one less place to disintermediate GitHub: you can’t get their value-added software (for private projects – public is free) unless you’re willing to pay. - -![](http://2yj23r14cytosbxol4cavq337g.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/githubpaper.jpg) - -*While GitHub does not control Git, their value-added software and means of monetization are unified, making the latter much easier and more sustainable* - -Docker takes the GitHub model a step further: the company controls everything from the open source project itself to the value-added software (DockerHub) built on top of that, and, just last week, [announced a monetization model][7] that is very similar to GitHub’s enterprise offering. Presuming Docker continues its present momentum and finds success with this enterprise offering, they have the potential to be a fully integrated open source software company: project, value-added software, and monetization all rolled into one. - -![](http://2yj23r14cytosbxol4cavq337g.wpengine.netdna-cdn.com/wp-content/uploads/2014/12/dockerpaper.jpg) - -*Docker controls all the parts of their business: they are a fully integrated open source company.* - -This is exciting, and, to be honest, a little scary. What is exciting is that very few movements have had such a profound effect as open source software, and not just on the tech industry. Open source products are responsible for end user products like this blog; more importantly, open source technologies have enabled exponentially more startups to get off the ground with minimal investment, vastly accelerating the rate of innovation and iteration in tech.[7][8] The ongoing challenge for any open source project, though, is funding, and Docker’s business model is a potentially sustainable solution not just for Docker but for future open source technologies. - -That said, if Docker is successful, over the long run commercial incentives will steer the Docker open source project in a way that benefits Docker the company, which may not be what is best for the community broadly. That is what is scary about this: might open source in the long run be subtly corrupted by this business model? The makers of CoreOS, a stripped-down Linux distribution that is a perfect complement for Docker, [argued that was the case][9] last week: - -> We thought Docker would become a simple unit that we can all agree on. Unfortunately, a simple re-usable component is not how things are playing out. Docker now is building tools for launching cloud servers, systems for clustering, and a wide range of functions: building images, running images, uploading, downloading, and eventually even overlay networking, all compiled into one monolithic binary running primarily as root on your server. The standard container manifesto was removed. We should stop talking about Docker containers, and start talking about the Docker Platform. It is not becoming the simple composable building block we had envisioned. - -This, I suppose, is the beauty of open source: if you disagree, fork, which is essentially what CoreOS did, launching their own “Rocket” container.[8][10] It also shows that Docker’s business model – and any business model that contains open source – will never be completely defensible: there will always be a disintermediation point. I suspect, though, that Rocket will fail and Docker’s momentum will continue: the logic of there being one true container is inexorable, and Docker has already built up quite a bit of infrastructure and – just maybe – a business model to make it sustainable. - --------------------------------------------------------------------------------- - -via: http://stratechery.com/2014/docker-integrated-open-source-company/ - -作者:[Ben Thompson][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://stratechery.com/category/about/ -[1]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:1:1300 -[2]:https://github.com/docker/docker -[3]:http://blogs.wsj.com/digits/2014/12/01/ipo-bound-hortonworks-drops-out-of-billion-dollar-startup-club/ -[4]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:2:1300 -[5]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:3:1300 -[6]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:5:1300 -[7]:http://blog.docker.com/2014/12/docker-announces-docker-hub-enterprise/ -[8]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:6:1300 -[9]:https://coreos.com/blog/rocket/ -[10]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:7:1300 -[11]:http://stratechery.com/2014/docker-integrated-open-source-company/#fn:4:1300 \ No newline at end of file diff --git a/sources/talk/20141219 2015 will be the year Linux takes over the enterprise and other predictions.md b/sources/talk/20141219 2015 will be the year Linux takes over the enterprise and other predictions.md index 4718480b82..0d2b26cc98 100644 --- a/sources/talk/20141219 2015 will be the year Linux takes over the enterprise and other predictions.md +++ b/sources/talk/20141219 2015 will be the year Linux takes over the enterprise and other predictions.md @@ -1,5 +1,3 @@ -translating by barney-ro - 2015 will be the year Linux takes over the enterprise (and other predictions) ================================================================================ > Jack Wallen removes his rose-colored glasses and peers into the crystal ball to predict what 2015 has in store for Linux. diff --git a/sources/talk/20141224 The Curious Case of the Disappearing Distros.md b/sources/talk/20141224 The Curious Case of the Disappearing Distros.md index 5efa2f4d1f..b9fc7875d7 100644 --- a/sources/talk/20141224 The Curious Case of the Disappearing Distros.md +++ b/sources/talk/20141224 The Curious Case of the Disappearing Distros.md @@ -117,4 +117,4 @@ via: http://www.linuxinsider.com/story/The-Curious-Case-of-the-Disappearing-Dist [5]:http://ledgersmbdev.blogspot.com/ [6]:http://www.ledgersmb.org/ [7]:http://www.novell.com/linux -[8]:http://www.redhat.com/ \ No newline at end of file +[8]:http://www.redhat.com/ diff --git a/sources/talk/20150112 Linus Tells Wired Leap Second Irrelevant.md b/sources/talk/20150112 Linus Tells Wired Leap Second Irrelevant.md deleted file mode 100644 index ee1516c474..0000000000 --- a/sources/talk/20150112 Linus Tells Wired Leap Second Irrelevant.md +++ /dev/null @@ -1,29 +0,0 @@ -Linus Tells Wired Leap Second Irrelevant -================================================================================ -![](https://farm4.staticflickr.com/3852/14863156322_a354770b14_o.jpg) - -Two larger publications today featured Linux and the effect of the upcoming leap second. The Register today said that the leap second effects of the past are no longer an issue. Coincidentally, Wired talked to Linus Torvalds about the same issue today as well. - -**Linus Torvalds** spoke with Wired's Robert McMillan about the approaching leap second due to be added in June. The Register said the last leap second in 2012 took out Mozilla, StumbleUpon, Yelp, FourSquare, Reddit and LinkedIn as well as several major airlines and travel reservation services that ran Linux. Torvalds told Wired today that the kernel is patched and he doesn't expect too many issues this time around. [He said][1], "Just take the leap second as an excuse to have a small nonsensical party for your closest friends. Wear silly hats, get a banner printed, and get silly drunk. That’s exactly how relevant it should be to most people." - -**However**, The Register said not everyone agrees with Torvalds' sentiments. They quote Daily Mail saying, "The year 2015 will have an extra second — which could wreak havoc on the infrastructure powering the Internet," then remind us of the Y2K scare that ended up being a non-event. The Register's Gavin [Clarke concluded][2]: - -> No reason the Penguins were caught sans pants. - -> Now they've gone belt and braces. - -The take-away is: move along, nothing to see here. - --------------------------------------------------------------------------------- - -via: http://ostatic.com/blog/linus-tells-wired-leap-second-irrelevant - -作者:[Susan Linton][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://ostatic.com/member/susan-linton -[1]:http://www.wired.com/2015/01/torvalds_leapsecond/ -[2]:http://www.theregister.co.uk/2015/01/09/leap_second_bug_linux_hysteria/ \ No newline at end of file diff --git a/sources/talk/20150119 Linus Torvalds responds to Ars about diversity niceness in open source.md b/sources/talk/20150119 Linus Torvalds responds to Ars about diversity niceness in open source.md deleted file mode 100644 index b98e27eacf..0000000000 --- a/sources/talk/20150119 Linus Torvalds responds to Ars about diversity niceness in open source.md +++ /dev/null @@ -1,44 +0,0 @@ -Linus Torvalds responds to Ars about diversity, niceness in open source -================================================================================ -> Acknowledges diversity factors, says "we're different in so many other ways." - -![See, sometimes Linus isn't flicking people off.](http://cdn.arstechnica.net/wp-content/uploads/2013/09/linus-torvalds.jpg) -See, sometimes Linus isn't flicking people off. - -Athanasios Kasampalis - -On Thursday, Linux legend Linus Torvalds sent a lengthy statement to Ars Technica responding to [statements he made in Auckland, New Zealand earlier that day about diversity and "niceness"][2] in the open source sector. - -"What I wanted to say [at the keynote]—and clearly must have done very badly—is that one of the great things about open source is exactly the fact that different people are so different," Torvalds wrote via e-mail. "I think people sometimes look at it as being just 'programmers,' which is not true. It's about all the people who are more oriented toward commercial things, too. It's about all those people who are interested in legal issues—and the social ones, too!" - -Torvalds spoke to what he thought was a larger concept of "diversity" than what has been mentioned a lot in recent stories on the topic, including economic disparity, language, and culture (even between neighboring European countries). "There's a lot of talk about gender and sexual preferences and race, but we're different in so many other ways, too," he wrote. - -"'Open source' as a term and as a movement hasn't been about 'you have to be a believer,'" Torvalds added. "It's not a religion. It's not an 'us vs them' thing. We've been able to work with all those 'evil commercial interests' and companies who also do proprietary software. And I think that was one of the things that the Linux community (and others—don't get me wrong, it's not unique to us) did and does well." - -Torvalds also talked about progress since the GPL vs. BSD "flame wars" from the '80s and early '90s, saying that the open source movement brought more technology and less "ideology" to the sector. "Which is not to say that a lot of people aren't around because they believe it's the 'ethical' thing to do (I do myself too)," Torvalds added, "but you don't have to believe that, and you can just do it because it's the most fun, or the most efficient way to do technology development." - -### “This ‘you have to be nice’ seems very popular in the US” ### - -He then sent a second e-mail to Ars about the topic of "niceness" that came up during the keynote. He said that his return to his Auckland hotel was delayed by "like three hours" because of hallway conversations about this very topic. - -"I don't know where you happen to be based, but this 'you have to be nice' seems to be very popular in the US," Torvalds continued, calling the concept an "ideology." - -"The same way we have developers and marketing people and legal people who speak different languages, I think we can have some developers who are used to—and prefer—a more confrontational style, and still **also** have people who don't," he wrote. - -He lambasted the "brainstorming" model of having a criticism-free bubble to bounce ideas off of. "Maybe it works for some people, but I happen to simply not believe in it," he said. "I'd rather be really confrontational, and bad ideas should be [taken] down aggressively. Even good ideas need to be vigorously defended." - -"Maybe it's just because I like arguing," Torvalds added. "I'm just not a huge believer in politeness and sensitivity being preferable over bluntly letting people know your feelings. But I also understand that other people are driven away by cursing and crass language when it all gets a bit too carried away." To that point, Torvalds said that the open source movement might simply need more "people who are good at mediating," as opposed to asking developers to calm their own tone or attitude. - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/business/2015/01/linus-torvalds-responds-to-ars-about-diversity-niceness-in-open-source/ - -作者:[Sam Machkovech][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://arstechnica.com/author/samred/ -[1]:https://secure.flickr.com/photos/12693492@N04/1338136415/in/photolist-33fikv-3jXFce-3ALpLy-4m6Shj-4pADUg-4pHwcW-4rNTR7-4GMhKc-4HM2qp-4JSHKa-4PomQo-4SKxMo-58LBYf-5iVNX6-5tXbB8-5xi67A-5A8rRc-5C8fAT-5Ccxjw-5EcYvx-5UoNTc-5UoVJK-5Uti6q-5UuiX2-5UuE2B-5UyEJu-5UyHMf-5UyJ2G-5UFbXP-5UFg8Z-5UFhwV-5UKDkG-5UKDP9-5UTHGv-5XM2s2-5YFmLu-65N31L-6pSwh7-6trmfx-6H2uZP-6JVV4V-71qkot-71BBbk-72vuYo-73j9yB-79aQ2a-79bfqe-79EKPH-79EXvD-79PuG5-7a4BxF -[2]:http://arstechnica.com/business/2015/01/linus-torvalds-on-why-he-isnt-nice-i-dont-care-about-you/ \ No newline at end of file diff --git a/sources/talk/20150119 Ubuntu 15.04 Finally Lets You Set Menus ToAlways Show.md b/sources/talk/20150119 Ubuntu 15.04 Finally Lets You Set Menus ToAlways Show.md deleted file mode 100644 index 346937d2b9..0000000000 --- a/sources/talk/20150119 Ubuntu 15.04 Finally Lets You Set Menus ToAlways Show.md +++ /dev/null @@ -1,41 +0,0 @@ -Ubuntu 15.04 Finally Lets You Set Menus To ‘Always Show’ -================================================================================ -**If you hate the way that Unity’s global menus fade out of view after you mouse away, Ubuntu 15.04 has a little extra to win you around.** - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/02/locally-integrated-menus-in-ubuntu.png) - -The latest build of Unity for Ubuntu 15.04, currently sitting in the ‘proposed’ channel, offers an option to **make app menus visible in Ubuntu**. - -No fading, no timeout, no missing menus. - -The drawback for now is that it can currently only be enabled through a dconf switch and not a regular user-facing option. - -I’d hope (if not expect) that an option to set the feature is added to the Ubuntu System Settings > Appearance section as development continues. - -Right now, if you’re on Ubuntu 15.04 and have the “Proposed” update channel enabled, you should find this switch waiting in **com > canonical > unity >** ‘always show menus’. - -### Better Late Than Never? ### - -Developers plan to backport the option to Ubuntu 14.04 LTS in the next SRU (assuming nothing unexpected crops up during testing). - -Locally Integrated Menus (LIM) debuted in Ubuntu 14.04 LTS to much appreciation, being widely seen as the best compromise between those who liked the simplicity of the “hidden” approach and those who disliked the mouse and trackpad aerobics using it required. - -While locally integrated menus brought us half way to silencing the criticisms levelled at this aspect of Unity, the default “fade in/fade out” behaviour left an itch unscratched. - -The past few releases of Ubuntu has seen proactive addressing of concerns and issues experienced by its earlier UX decisions. After several years on the ‘to do’ list [we finally got Locally Integrated Menus last year][1], as well as an unsupported [option to minimise and restore apps to the Unity Launcher][2] by clicking on their icon. - -A year on from that we finally get an option to make application menus always show, no matter where our mouse is. Better late than never, right? - --------------------------------------------------------------------------------- - -via: http://www.omgubuntu.co.uk/2015/01/ubuntu-15-04-always-show-menu-bar-option - -作者:[Joey-Elijah Sneddon][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/117485690627814051450/?rel=author -[1]:http://www.omgubuntu.co.uk/2014/02/locally-integrated-menus-ubuntu-14-04 -[2]:http://www.omgubuntu.co.uk/2014/03/minimize-click-launcher-option-ubuntu-14-04 \ No newline at end of file diff --git a/sources/talk/20150122 How are C data types “supported directly by most computers”.md b/sources/talk/20150122 How are C data types “supported directly by most computers”.md deleted file mode 100644 index 0b57189252..0000000000 --- a/sources/talk/20150122 How are C data types “supported directly by most computers”.md +++ /dev/null @@ -1,53 +0,0 @@ -How are C data types “supported directly by most computers”? ---------- - -#Q: - -I am reading K&R's *The C Programming Language*” and came across this statement [Introduction, p. 3]: - ->Because the data types and control structures provided by C are supported directly by most computers, the run-time library required to implement self-contained programs is tiny. - -What does the bolded statement mean? Is there an example of a data type or a control structure that isn't supported directly by a computer? - -#A: - -Yes, there are data types not directly supported. - -On many embedded systems, there is no hardware floating point unit. So, when you write code like this: - -```C -float x = 1.0f, y = 2.0f; -return x + y; -``` - -It gets translated into something like this: - -```C -unsigned x = 0x3f800000, y = 0x40000000; -return _float_add(x, y); -``` - -Then the compiler or standard library has to supply an implementation of `_float_add()`, which takes up memory on your embedded system. If you're counting bytes on a really tiny system, this can add up. - -Another common example is 64-bit integers (`long long` in the C standard since 1999), which are not directly supported by 32-bit systems. Old SPARC systems didn't support integer multiplication, so multiplication had to be supplied by the runtime. There are other examples. - -##Other languages - -By comparison, other languages have more complicated primitives. - -For example, a Lisp symbol requires a lot of runtime support, just like tables in Lua, strings in Python, arrays in Fortran, et cetera. The equivalent types in C are usually either not part of the standard library at all (no standard symbols or tables) or they are much simpler and don't require much runtime support (arrays in C are basically just pointers, nul-terminated strings are almost as simple). - -##Control structures - -A notable control structure missing from C is exception handling. Nonlocal exit is limited to `setjmp()` and `longjmp()`, which just save and restore certain parts of processor state. By comparison, the C++ runtime has to walk the stack and call destructors and exception handlers. - ----- -via:[stackoverflow](http://stackoverflow.com/questions/27977522/how-are-c-data-types-supported-directly-by-most-computers/27977605#27977605) - -作者:[Dietrich Epp][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://stackoverflow.com/users/82294/dietrich-epp \ No newline at end of file diff --git a/sources/talk/20150122 Top 10 FOSS legal developments of 2014.md b/sources/talk/20150122 Top 10 FOSS legal developments of 2014.md deleted file mode 100644 index a97e4910c6..0000000000 --- a/sources/talk/20150122 Top 10 FOSS legal developments of 2014.md +++ /dev/null @@ -1,72 +0,0 @@ -Top 10 FOSS legal developments of 2014 -================================================================================ -![](http://opensource.com/sites/default/files/styles/image-full-size/public/images/law/LAW_PatentSpotlight_520x292_cm.png.png?itok=N-O9b4FW) - -Image by : opensource.com - -The year 2014 continued the trend of the increasing importance of legal issues for the FOSS community. Continuing [the tradition of looking back][1] over the top ten legal developments in FOSS, my selection of the top ten issues for 2014 is as follows: - -### 1. Courts interpret General Public License version 2 (GPLv2) ### - -The GPLv2 continues to be the most widely used and most important license for free and open source software. Black Duck Software estimates that 16 billion lines of code are licensed under the GPLv2. Despite its importance, the GPLv2 has been the subject of very few court decisions, and virtually all of the most important terms of the GPLv2 have not been interpreted by courts. This lack of court decisions is about to change due to the five interrelated cases arising from an attempt by Versata Software, Inc. (Versata) to terminate its software license to Ameriprise Financial, Inc. Versata’s product included software licensed by Ximpleware, Inc. (Ximpleware) under the GPLv2, but Versata had not complied with the terms of the GPLv2. Ximpleware sued Versata and eight of its customers for both copyright and patent infringement. (For a more detailed description of the facts [read this article][2].) This dispute is important because Ximpleware is the first commercial enforcer of the GPLv2 in which the courts are likely to issue decisions and Ximpleware is seeking monetary damages rather than compliance. - -### 2. GPL guides ### - -Two of the most important organizations enforcing the GPL family of licenses recently provided [guidance on compliance][3]: On October 31, the Software Freedom Law Center published the second version of their Practical Guide to GPL Compliance. Several days later, the Software Conservancy and the Free Software Foundation published the first version of their guide, the Copyleft, and the GNU General Public License: [A Comprehensive Tutorial and Guide][4]. These guides are required reading for anyone managing FOSS. - -### 3. EU Commission (EC) to revise FOSS policy ### - -Governments are one of the most important users of software but have had a mixed record in using and contributing to FOSS (free and open source software). The EC recently announced that it intends to remove the barriers that may hinder code contributions to FOSS projects. In particular, the EC wants to clarify legal aspects, including intellectual property rights, copyright, and which author or authors to name when submitting code to the upstream repositories. Pierre Damas, Head of Sector at the Directorate General for IT, [hopes that such clarification][5] will motivate many of the EC’s software developers and functionaries to promote the use of FOSS at the EC. - -### 4. Validation of FOSS business model by Hortonworks IPO ### - -Hortonworks provides services and support for the Hadoop data analysis software managed by the Apache Software Foundation. Hortonworks is one of three venture backed companies based on the Hadoop software. Hortonworks went public this fall and immediately rose 65% in share price, valuing the company at over $1 billion. The market for Hadoop products, software, and services is projected to reach $50.2 billion in 2020, up from $1.5 billion in 2012. - -### 5. Core Infrastructure Initiative ### - -The Linux Foundation put together [a consortium of companies][6] to support the many smaller open source projects that are critical to software ecosystem, such as OpenSSL. This effort was a response to the Heartbleed problem with OpenSSL in 2013, which I described in last year’s summary. This consortium is a great example of the ability of the FOSS community to come together to solve community problems. - -### 6. Linux SCO case terminated again ### - -The lawsuit by Santa Cruz Operations, Inc. (SCO) against IBM claiming that Linux includes Unix code was once a potentially major challenge to FOSS. Despite losing its suit against Novell, the bankruptcy court allowed SCO to continue its suit against IBM. I thought this case [had been concluded in 2008][7], but Judge Nuffer appears to have put the case to rest on December 15, 2014. He dismissed the case against IBM based on the decisions in the Novell case (although SCO could still appeal once again): - -*It is further ORDERED that, with respect to all remaining claims and counterclaims, SCO is bound by, and may not here re-litigate, the rulings in the Novell Judgment that Novell (not SCO) owns the copyrights to the pre-1996 UNIX source code, and that Novell waived SCO’s contract claims against IBM for alleged breaches of the licensing agreements pursuant to which IBM licensed such source code.* - -### 7. FOSS trademark issues ### - -The use of trademarks in FOSS projects continues to raise issues. This year brought the settlement of the dispute over the “Python” mark between the Python Software Foundation and Veber, a small hosting company in the UK. Veber had decided to use "Python" in branding certain of its products and services. In addition, the OpenStack Foundation is working through the application of trademarks to the OpenStack project through its [DefCore committee][8]. - -### 8. Use of FOSS by commercial companies expands ### - -We have discussed in the past how many large companies are using FOSS as an explicit strategy to build their software. Jim Zemlin, Executive Director of the Linux Foundation, has described this strategic use of FOSS as external “research and development.” His conclusions are supported by Gartner who noted that “the top tech companies are still spending tens of billions of dollars on software research and development, the smart ones are leveraging open source for 80 percent of the code and spending their money on the remaining 20 percent, which represents their program’s ‘special sauce.’” The scope of this trend was emphasized by Microsoft’s announcement that it was “open sourcing” the .NET software framework (this software is used by millions of developers to build and operate websites and other large online applications). - -### 9. Rockstar Consortium threat evaporates ### - -The Rockstar Consortium was formed by Microsoft, Blackberry, Ericsson, Sony, and Apple to exploit the 6,000 patents from Nortel Networks. The Rockstar Consortium sued Google for infringement of the Android operating system. This litigation was aimed at fundamental functions of the Android operating system and could have had a significant effect on the Android ecosystem. The Rockstar Consortium settled its litigation with Google this year, but then sold 4,000 of its patents to RPX, the patent defense firm (financed by a number of companies as well as RPX). The remaining patents were distributed to the members of the Rockstar Consortium. - -### 10. Android litigation ### - -The litigation surrounding Android continued this year, with significant developments in the patent litigation between Apple Computer, Inc. (Apple) and Samsung Electronics, Inc. (Samsung) and the copyright litigation over the Java APIs between Oracle Corporation (Oracle) and Google, Inc. (Google). Apple and Samsung have agreed to end patent disputes in nine countries, but they will continue the litigation in the US. As I stated last year, the Rockstar Consortium was a wild card in this dispute. However, the Rockstar Consortium settled its litigation with Google this year and sold off its patents, so it will no longer be a risk to the Android ecosystem. - -The copyright litigation regarding the copyrightability of the Java APIs was brought back to life by the Court of Appeals for the Federal Circuit (CAFC) decision which overturned [the District Court decision][9]. The District Court had found that Google was not liable for copyright infringement for its admitted copying of the Java APIs: the court found that the Java APIs were either not copyrightable or their use by Google was protected by various defenses to copyright. The CAFC overturned both the decision and the analysis and remanded the case to the District Court for a review of the fair use defense raised by Google. Subsequently, Google filed an appeal to the Supreme Court. The impact of a finding that Google was liable for copyright infringement in this case would have a dramatic effect on Android and, depending on the reasoning, would have a ripple effect across the interpretation of the scope of the “copyleft” terms of the GPL family of licenses which use APIs. - --------------------------------------------------------------------------------- - -via: http://opensource.com/law/15/1/top-foss-legal-developments-2014 - -作者:[Mark Radcliffe][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://opensource.com/users/mradcliffe -[1]:http://lawandlifesiliconvalley.com/blog/?p=853 -[2]:http://opensource.com/law/14/12/gplv2-court-decisions-versata -[3]:http://www.softwarefreedom.org/resources/ -[4]:http://www.copyleft.org/guide/ -[5]:https://joinup.ec.europa.eu/community/osor/news/european-commission-update-its-open-source-policy -[6]:http://www.linuxfoundation.org/programs/core-infrastructure-initiative -[7]:http://lawandlifesiliconvalley.com/blog/?m=200812 -[8]:https://wiki.openstack.org/wiki/Governance/CoreDefinition -[9]:http://law.justia.com/cases/federal/appellate-courts/cafc/13-1021/13-1021-2014-05-09.html \ No newline at end of file diff --git a/sources/talk/20150122 Top 10 open source projects of 2014.md b/sources/talk/20150122 Top 10 open source projects of 2014.md deleted file mode 100644 index edc81938d6..0000000000 --- a/sources/talk/20150122 Top 10 open source projects of 2014.md +++ /dev/null @@ -1,126 +0,0 @@ -Top 10 open source projects of 2014 -================================================================================ -![](http://opensource.com/sites/default/files/styles/image-full-size/public/images/life/top10_projects_lead.jpg?itok=tMZo2sYi) - -Image credits : [CC0 Public Domain][1], modifications by Jen Wike Huger - -Every year we collect the best of the best open source projects covered on Opensource.com. [Last year's list of 10 projects][2] guided people working and interested in tech throughout 2014. Now, we're setting you up for 2015 with a brand new list of accomplished open source projects. - -Some faces are new. Some have been around and just keep rocking it. Let's dive in! - -## Top 10 open source projects in 2014 ## - -### Docker ### - -[application container platform][3] - -"In the same way that power management and virtualisation has allowed us to get maximum engineering benefit from our server utilisation, the problem of how to really solve first world problems in virtualisation has remained prevalent. Docker's open sourcing in 2013 can really align itself with these pivotal moments in the evolution of open source—providing the extensible building blocks allowing us as engineers and architects to extend distributed platforms like never before." —Richard Morrell, [Senior software engineer Petazzoni on the breathtaking growth of Docker][4]. - -**Interview**: VP of Services for Docker talks to Jodi Biddle in [Why is Docker the new craze in virtualization and cloud computing?][5] "I think it's the lightweight nature of Docker combined with the workflow. It's fast, easy to use and a developer-centric DevOps-ish tool. Its mission is basically: make it easy to package and ship code." —James Turnbull. - -### Kubernetes ### - -[orchestration system for containers][6] - -"One of the projects you're starting to hear a lot about in the orchestration space is [Kubernetes][7], which came out of Google's internal container work. It aims to provide features such as high availability and replication, service discovery, and service aggregation." —Gordon Haff, [Open source accelerating the pace of software][8]. - -### Taiga ### - -[project management platform][9] - -"It’s almost always the case that the project management tool doesn’t reflect the actual project scenario. One solution to this is using a tool that is intuitive and fits alongside the developer's normal workflow. Additionally, a tool that is quick to update and attracts users to use it. [Taiga][10] is an open source project management tool that aims to solve the basic problem of software usability." —Nitish Tiwari, [Taiga, a new open source project management tool with focus on usability][11]. - -### Apache Mesos ### - -[cluster manager][12] - -"[Apache Mesos][13] is a cluster manager that provides efficient resource isolation and sharing across distributed applications or frameworks. It sits between the application layer and the operating system and makes it easier to deploy and manage applications in large-scale clustered environments more efficiently. It can run many applications on a dynamically shared pool of nodes. Prominent users of Mesos include Twitter, Airbnb, MediaCrossing, Xogito and Categorize. —Sachin P Bappalige, [Open source datacenter computing with Apache Mesos][14]. - -Interview: Head of Open Source at Twitter talks to Jason Hibbets in [Scale like Twitter with Apache Mesos][15]. "As of today, Twitter has over 270 million active users which produces 500+ million tweets a day, up to 150k+ tweets per second, and more than 100TB+ of compressed data per day. Architecturally, Twitter is mostly composed of services, mostly written in the open source project [Finagle][16], representing the core nouns of the platform such as the user service, timeline service, and so on. Mesos allows theses services to scale to tens of thousands of bare-metal machines and leverage a shared pool of servers across data centers." —Chris Aniszczyk - -### OpenStack ### - -[cloud computing platform][17] - -"As OpenStack continues to mature and slowly make its way into production environments, the focus on the user is continuing to grow. And so, to better meet the needs of users, the community is working hard to get users to meet the next step of engagement by highlighting those users who are change agents both in their organization and within the OpenStack community at large: the superusers." —Jason Baker, [What is an OpenStack superuser][18]? - -**Interview**: Infrastructure manager at CERN talks to Jason Hibbets in [How OpenStack powers the research at CERN][19]. "At CERN, the European Organization for Nuclear Research physicists and engineers are probing the fundamental structure of the universe. In order to do this, we use some of the world's largest and most complex scientific instruments such as the Large Hadron Collider, a 27 KM ring 100m underground on the border between France and Switzerland. OpenStack provides the infrastructure cloud which is used to provide much of the compute resources for this processing." —Tim Bell. - -### Ansible ### - -[IT automation tool][20] - -"A lot of what I want to do is enable people to not only have more free time for beer, but to have more free time for their own projects, their own ideas, and to do new an interesting things." —[Michael DeHaan, Making your IT infrastructure boring with Ansible][21]. - -**Interview**: CTO of Ansible talks to Jen Krieger in [Behind the scenes with CTO Michael DeHaan of Ansible][22]. "I like to quote Star Trek 2 a lot. We definitely optimize for 'the needs of the many'. I know Spock dies after he says that, but he does get to come back." —Michael DeHaan - -### ownCloud ### - -[cloud storage tool][23] - -"I was looking for an easy way how to have all my online storage services, such as Google Drive and Dropbox, integrated with my Linux desktop without using some nasty hack, and I finally have a solution that works. I'm here to share it with you. This is not rocket science really, all I did was a little bit of documentation reading, and a couple of clicks." —Jiri Folta, [Using ownCloud to integrate Dropbox, Google Drive, and more in Gnome][24]. - -**Listed**: Top 5 open source alternatives: "ownCloud does most everything that the proprietary names do and it keeps control of your information in your hands." —Scott Nesbitt, [Five open source alternatives to popular web apps][25]. - -### Apache Hadoop ### - -[framework for big data][26] - -"Apache Hadoop is an open source software framework for storage and large scale processing of data-sets on clusters of commodity hardware. Hadoop is an Apache top-level project being built and used by a global community of contributors and users. It is licensed under the Apache License 2.0." —Sachin P Bappalige, [An introduction to Apache Hadoop for big data][27]. - -### Drupal ### - -[content management system (CMS)][28] - -"When it was released in 2011, Drupal 7 was the most accessible open source content management system (CMS) available. I expect that this will be true until the release of Drupal 8. Web accessibility requires constant vigilance and will be something that will always need attention in any piece of software striving to meet the Web Content Accessibility Guidelines (WCAG) 2.0 guidelines." —Mike Gifford, [Drupal 8's accessibility advantage][29]. - -### OpenDaylight ### - -[foundation for software defined networking][30] - -"We are seeing more and more that the networking functions traditionally done in the datacenter by dedicated, almost exclusively proprietary hardware and software combinations, are now being defined through software. Leading that charge within the open source community has been the [OpenDaylight Project][31], a collaborative project through the [Linux Foundation][32] working to define the needs which software defined networking may fill and coordinating the efforts of individuals and companies worldwide to create an open source solution to software defined networking (SDN)." —Jason Baker, [Define your network in software with OpenDaylight][33]. - --------------------------------------------------------------------------------- - -via: http://opensource.com/business/14/12/top-10-open-source-projects-2014 - -作者:[Jen Wike Huger][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://opensource.com/users/jen-wike -[1]:http://pixabay.com/en/lightbulb-lamp-light-hotspot-336193/ -[2]:http://opensource.com/life/13/12/top-open-source-projects-2013 -[3]:https://www.docker.com/ -[4]:http://opensource.com/business/14/7/interview-jerome-petazzoni-docker -[5]:https://opensource.com/business/14/7/why-docker-new-craze-virtualization-and-cloud-computing -[6]:http://kubernetes.io/ -[7]:https://cloud.google.com/compute/docs/containers -[8]:http://opensource.com/business/14/11/open-source-accelerating-pace-software -[9]:https://taiga.io/ -[10]:https://github.com/taigaio -[11]:https://opensource.com/business/14/10/taiga-open-source-project-management-tool -[12]:http://mesos.apache.org/ -[13]:http://mesos.apache.org/ -[14]:https://opensource.com/business/14/9/open-source-datacenter-computing-apache-mesos -[15]:https://opensource.com/business/14/8/interview-chris-aniszczyk-twitter-apache-mesos -[16]:https://twitter.github.io/finagle/ -[17]:http://www.openstack.org/ -[18]:https://opensource.com/business/14/5/what-is-openstack-superuser -[19]:https://opensource.com/business/14/10/interview-tim-bell-cern-it-operating-systems -[20]:http://www.ansible.com/home -[21]:https://opensource.com/business/14/12/ansible-it-infrastructure -[22]:https://opensource.com/business/14/10/interview-michael-dehaan-ansible -[23]:http://owncloud.org/ -[24]:https://opensource.com/life/14/12/using-owncloud-integrate-dropbox-google-drive-gnome -[25]:https://opensource.com/life/14/10/five-open-source-alternatives-popular-web-apps -[26]:http://hadoop.apache.org/ -[27]:http://opensource.com/life/14/8/intro-apache-hadoop-big-data -[28]:https://www.drupal.org/ -[29]:http://opensource.com/business/14/5/new-release-drupal-8-accessibility-advantage -[30]:http://www.opendaylight.org/ -[31]:http://www.opendaylight.org/ -[32]:http://www.linuxfoundation.org/ -[33]:http://opensource.com/business/14/5/defining-your-network-software-opendaylight diff --git a/sources/talk/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md b/sources/talk/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md deleted file mode 100644 index 25a2dc6daf..0000000000 --- a/sources/talk/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md +++ /dev/null @@ -1,43 +0,0 @@ -Why does C++ promote an int to a float when a float cannot represent all int values? ---------- - -#Q: - -Say I have the following: - -```C -int i = 23; -float f = 3.14; -if (i == f) // do something -``` - -The i will be promoted to a float and the two float numbers will be compared, but can a float represent all int values? Why not promote both the int and the float to a double? - -#A: - -When `int` is promoted to `unsigned` in the integral promotions, negative values are also lost (which leads to such fun as `0u < -1` being true). - -Like most mechanisms in C (that are inherited in C++), the usual arithmetic conversions should be understood in terms of hardware operations. The makers of C were very familiar with the assembly language of the machines with which they worked, and they wrote C to make immediate sense to themselves and people like themselves when writing things that would until then have been written in assembly (such as the UNIX kernel). - -Now, processors, as a rule, do not have mixed-type instructions (add float to double, compare int to float, etc.) because it would be a huge waste of real estate on the wafer -- you'd have to implement as many times more opcodes as you want to support different types. That you only have instructions for "add int to int," "compare float to float", "multiply unsigned with unsigned" etc. makes the usual arithmetic conversions necessary in the first place -- they are a mapping of two types to the instruction family that makes most sense to use with them. - -From the point of view of someone who's used to writing low-level machine code, if you have mixed types, the assembler instructions you're most likely to consider in the general case are those that require the least conversions. This is particularly the case with floating points, where conversions are runtime-expensive, and particularly back in the early 1970s, when C was developed, computers were slow, and when floating point calculations were done in software. This shows in the usual arithmetic conversions -- only one operand is ever converted (with the single exception of `long/unsigned int`, where the `long` may be converted to `unsigned long`, which does not require anything to be done on most machines. Perhaps not on any where the exception applies). - -So, the usual arithmetic conversions are written to do what an assembly coder would do most of the time: you have two types that don't fit, convert one to the other so that it does. This is what you'd do in assembler code unless you had a specific reason to do otherwise, and to people who are used to writing assembler code and do have a specific reason to force a different conversion, explicitly requesting that conversion is natural. After all, you can simply write - -```C -if((double) i < (double) f) -``` - -It is interesting to note in this context, by the way, that `unsigned` is higher in the hierarchy than `int`, so that comparing `int` with `unsigned` will end in an unsigned comparison (hence the `0u < -1` bit from the beginning). I suspect this to be an indicator that people in olden times considered `unsigned` less as a restriction on `int` than as an extension of its value range: We don't need the sign right now, so let's use the extra bit for a larger value range. You'd use it if you had reason to expect that an `int` would overflow -- a much bigger worry in a world of 16-bit ints. - ----- -via:[stackoverflow](http://stackoverflow.com/questions/28010565/why-does-c-promote-an-int-to-a-float-when-a-float-cannot-represent-all-int-val/28011249#28011249) - -作者:[wintermute][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://stackoverflow.com/users/4301306/wintermute \ No newline at end of file diff --git a/sources/talk/20150127 Windows 10 versus Linux.md b/sources/talk/20150127 Windows 10 versus Linux.md deleted file mode 100644 index e2cdfc14c1..0000000000 --- a/sources/talk/20150127 Windows 10 versus Linux.md +++ /dev/null @@ -1,31 +0,0 @@ -Windows 10 versus Linux -================================================================================ -![](https://farm4.staticflickr.com/3852/14863156322_e4edbae70e_t.jpg) - -Windows 10 seemed to dominate the headlines today, even in many Linux circles. Leading the pack is Brian Fagioli at betanews.com saying Windows 10 is ringing the death knell for Linux desktops. Microsoft announced today that Windows 10 will be free for loyal Windows users and Steven J. Vaughan-Nichols said it's the newest Open Source company. Then Matt Hartley compares Windows 10 to Ubuntu and Jesse Smith reviews Windows 10 from a Linux user's perspective. - -**Windows 10** was the talk around water coolers today with Microsoft's [announcement][1] that it would be free for Windows 7 and up users. Here in Linuxland, that didn't go unnoticed. Brian Fagioli at betanews.com, a self-proclaimed Linux fan, said today, "Windows 10 closes the door entirely. The year of the Linux desktop will never happen. Rest in peace." [Fagioli explained][2] that Microsoft listened to user complaints and not only addressed them but improved way beyond that. He said Linux missed the boat by failing to capitalize on the Windows 8 unpopularity and ultimate failure. Then he concluded that we on the fringe must accept our "shattered dreams" thanks to Windows 10. - -**H**owever, Jesse Smith, of Distrowatch.com fame, said Microsoft isn't making it easy to find the download, but it is possible and he did it. The installer was simple enough except for the partitioner, which was quite limited and almost scary. After finally getting into Windows 10, Smith said the layout was "sparce" without a lot of the distractions folks hated about 7. The menu is back and the start screen is gone. A new package manager looks a lot like Ubuntu's and Android's according to Smith, but requires an online Microsoft account to use. [Smith concludes][3] in part, "Windows 10 feels like a beta for an early version of Android, a consumer operating system that is designed to be on-line all the time. It does not feel like an operating system I would use to get work done." - -**S**mith's [full article][4] compares Windows 10 to Linux quite a bit, but Matt Hartley today posted an actual Windows 10 vs Linux report. [He said][5] both installers were straightforward and easy Windows still doesn't dual boot easily and Windows provides encryption by default but Ubuntu offers it as an option. At the desktop Hartley said Windows 10 "is struggling to let go of its Windows 8 roots." He thought the Windows Store looks more polished than Ubuntu's but didn't really like the "tile everything" approach to newly installed apps. In conclusion, Hartley said, "The first issue is that it's going to be a free upgrade for a lot of Windows users. This means the barrier to entry and upgrade is largely removed. Second, it seems this time Microsoft has really buckled down on listening to what their users want." - -**S**teven J. Vaughan-Nichols today said that Microsoft is the newest Open Source company; not because it's going to be releasing Windows 10 as a free upgrade but because Microsoft is changing itself from a software company to a software as a service company. And, according to Vaughan-Nichols, Microsoft needs Open Source to do it. They've been working on it for years beginning with Novell/SUSE. Not only that, they've been releasing software as Open Source as well (whatever the motives). [Vaughan-Nichols concluded][6], "Most people won't see it, but Microsoft -- yes Microsoft -- has become an open-source company." - --------------------------------------------------------------------------------- - -via: http://ostatic.com/blog/windows-10-versus-linux - -作者:[Susan Linton][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://ostatic.com/member/susan-linton -[1]:https://news.google.com/news/section?q=microsoft+windows+10+free&ie=UTF-8&oe=UTF-8 -[2]:http://betanews.com/2015/01/25/windows-10-is-the-final-nail-in-the-coffin-for-the-linux-desktop/ -[3]:http://blowingupbits.com/2015/01/an-outsiders-perspective-on-windows-10-preview/ -[4]:http://blowingupbits.com/2015/01/an-outsiders-perspective-on-windows-10-preview/ -[5]:http://www.datamation.com/open-source/windows-vs-linux-the-2015-version-1.html -[6]:http://www.zdnet.com/article/microsoft-the-open-source-company/ \ No newline at end of file diff --git a/sources/talk/20150203 9 Best IDEs and Code Editors for JavaScript Users.md b/sources/talk/20150203 9 Best IDEs and Code Editors for JavaScript Users.md deleted file mode 100644 index 83f5f11293..0000000000 --- a/sources/talk/20150203 9 Best IDEs and Code Editors for JavaScript Users.md +++ /dev/null @@ -1,82 +0,0 @@ -9 Best IDEs and Code Editors for JavaScript Users -================================================================================ -Web designing and developing is one of the trending sectors in the recent times, where more and more peoples started to search for their career opportunities. But, Getting the right opportunity as a web developer or graphic designer is not just a piece of cake for everyone, It certainly requires a strong mind presence as well as right skills to find the find the right job. There are a lot of websites available today which can help you to get the right job description according to your knowledge. But still if you want to achieve something in this sector you must have some excellent skills like working with different platforms, IDEs and various other tools too. - -Talking about the different platforms and IDEs used for various languages for different purposes, gone is the time when we learn just one IDE and get the optimum solutions for our web design projects easily. Today we are living in the modern lifestyle where competition is getting more and more tough on every single day. Same is the case with the IDEs, IDE is basically a powerful client application for creating and deploying applications. Today we are going to share some best javascript IDE for web designers and developers. - -Please visit this list of best code editors for javascript user and share your thought with us. - -### 1) [Spket][1] ### - -**Spket IDE** is powerful toolkit for JavaScript and XML development. The powerful editor for JavaScript, XUL/XBL and Yahoo! Widget development. The JavaScript editor provides features like code completion, syntax highlighting and content outline that helps developers productively create efficient JavaScript code. - -![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/spket-e1422674329554.png) - -### 2) [Ixedit][2] ### - -IxEdit is a JavaScript-based interaction design tool for the web. With IxEdit, designers can practice DOM-scripting without coding to change, add, move, or transform elements dynamically on your web pages. - -![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/ixedit.png) - -### 3) [Komodo Edit][3] ### - -Komode is free and powerful code editor for Javascript and other programming languages. - -![](http://i2.wp.com/devzum.com/wp-content/uploads/2015/01/komodo-edit-e1422674596277.png) - -### 4) [EpicEditor][4] ### - -EpicEditor is an embeddable JavaScript Markdown editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it. - -![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/epiceditor-e1422674732281.png) - -### 5) [codepress][5] ### - -CodePress is web-based source code editor with syntax highlighting written in JavaScript that colors text in real time while it’s being typed in the browser. - -![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/codepres-e1422674893706.png) - -### 6) [ACe][6] ### - -Ace is an embeddable code editor written in JavaScript. It matches the features and performance of native editors such as Sublime, Vim and TextMate. It can be easily embedded in any web page and JavaScript application. - -![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/ace-e1422675089912.png) - -### 7) [scripted][7] ### - -Scripted is a fast and lightweight code editor with an initial focus on JavaScript editing. Scripted is a browser based editor and the editor itself is served from a locally running Node.js server instance. - -![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/scripted-e1422675188408.png) - -### 8) [Netbeans][8] ### - -This is another more impressive and useful code editors for javascript and other programming languages. - -![](http://i1.wp.com/devzum.com/wp-content/uploads/2015/01/code_editing1-e1422675506226.png) - -### 9) [Webstorm][9] ### - -This is the smartest ID for javascript. WebStorm is a lightweight yet powerful IDE, perfectly equipped for complex client-side development and server-side development with Node.js. - -![](http://i0.wp.com/devzum.com/wp-content/uploads/2015/01/webstorm.png) - --------------------------------------------------------------------------------- - -via: http://devzum.com/2015/01/31/9-best-ides-and-code-editors-for-javascript-users/ - -作者:[vikas][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://devzum.com/author/vikas/ -[1]:http://spket.com/ -[2]:http://www.ixedit.com/ -[3]:http://komodoide.com/komodo-edit/ -[4]:http://oscargodson.github.io/EpicEditor/ -[5]:http://codepress.sourceforge.net/ -[6]:http://ace.c9.io/#nav=about -[7]:https://github.com/scripted-editor/scripted -[8]:https://netbeans.org/ -[9]:http://www.jetbrains.com/webstorm/ \ No newline at end of file diff --git a/sources/talk/20150205 GHOST--Another Security Bug Hits Linux, But is it That Bad.md b/sources/talk/20150205 GHOST--Another Security Bug Hits Linux, But is it That Bad.md deleted file mode 100644 index 90923c1aae..0000000000 --- a/sources/talk/20150205 GHOST--Another Security Bug Hits Linux, But is it That Bad.md +++ /dev/null @@ -1,34 +0,0 @@ -GHOST: Another Security Bug Hits Linux, But is it That Bad? -================================================================================ -> GHOST, a newly announced security vulnerability that affects Linux servers and other systems that use the open source glibc library, is not as dangerous to data privacy as the Shellshock or Heartbleed bugs. - -![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/01/ghost-costume.jpg) - -Heartbleed is not even a year behind us, and the open source world has been hit with another major security vulnerability in the form of [GHOST][1], which involves holes in the Linux glibc library. This time, though, the actual danger may not live up to the hype. - -The GHOST vulnerability, which was announced last week by security researchers at [Qualys][2], resides in the gethostbyname*() functions of the glibc library. glibc is one of the core building blocks of most Linux systems, and gethostbyname*(), which resolves domain names into IP addresses, is widely used in open source applications. - -Attackers can exploit the GHOST security hole to create a buffer overflow, making it possible to execute any kind of code they want and do all sorts of nasty things. - -All of the above suggests that GHOST is bad news indeed. Fortunately for the open source community, however, the actual risk appears small. As TrendMicro [points out][3], the bug that makes the exploit possible has been fixed in glibc since May 2013, meaning that any Linux servers or PCs running more recent versions of the software are safe from attack. - -In addition, gethostbyname*() has been superseded by newer glibc functions that can better handle modern networking environments. Those include ones that use the IPv6 protocol, which gethostbyname*() doesn't support. As a result, newer applications often don't use the gethostbyname*() functions, and are not at risk. - -And perhaps most importantly, there's currently no known way of executing GHOST attacks through the Web. That greatly reduces opportunities for using this vulnerability to steal the data of unsuspecting users or otherwise wreak havoc. - -All in all, then, GHOST doesn't seem like a vulnerability that will prove as serious as Heartbleed or Shellshock, two other recent security problems that affected widely used open source software. - --------------------------------------------------------------------------------- - -via: http://thevarguy.com/open-source-application-software-companies/020415/ghost-another-security-bug-hits-linux-it-bad - -作者:[Christopher Tozzi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://thevarguy.com/author/christopher-tozzi -[1]:https://community.qualys.com/blogs/laws-of-vulnerabilities/2015/01/27/the-ghost-vulnerability -[2]:http://qualys.com/ -[3]:http://blog.trendmicro.com/trendlabs-security-intelligence/not-so-spooky-linux-ghost-vulnerability/ \ No newline at end of file diff --git a/sources/talk/20150205 LinuxQuestions Survey Results Surface Top Open Source Projects.md b/sources/talk/20150205 LinuxQuestions Survey Results Surface Top Open Source Projects.md deleted file mode 100644 index c591faafcd..0000000000 --- a/sources/talk/20150205 LinuxQuestions Survey Results Surface Top Open Source Projects.md +++ /dev/null @@ -1,32 +0,0 @@ -LinuxQuestions Survey Results Surface Top Open Source Projects -================================================================================ -![](http://farm5.static.flickr.com/4099/4777335328_3cc363c419_m.jpg) - -Many people in the Linux community look forward to the always highly detailed and reliable results of the annual surveys from LinuxQuestions.org. As [Susan covered in detail in this post][1], this year's [results][2], focused on what readers at the site deem to be the best open source projects, are now available. Most of the people at LinuxQuestions are expert-level users who are on the site to answer questions from newer Linux users. - -In addition to the summary results that Susan provided in her post, below you'll find a graphical snapshot of what the experts took note of on the open source front. - -You can get a very nice graphical summary of the findings from the LinuxQuestions survey [here][3]. Here is a snapshot of the site's determination of the best Linux distributions, where Mint and Slackware fare quite well: - -![](http://i1311.photobucket.com/albums/s669/webworkerdaily/lin_zps9ogvyrty.png) - -And below is a snapshot of the site's determination of the best cloud projects. Notably, the LinuxQuestions crowd gives very high praise to ownCloud. Definiitely check into the full results of the survey at the site, see [Susan's summary][4] of winners, and check out all the good graphics [here][5]. - -![](http://i1311.photobucket.com/albums/s669/webworkerdaily/lin2_zps9nxf7yyi.png) - --------------------------------------------------------------------------------- - -via: http://ostatic.com/blog/linuxquestions-survey-results-surface-top-open-source-projects - -作者:[Sam Dean][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://ostatic.com/member/samdean -[1]:http://ostatic.com/blog/lq-members-choice-award-winners-announced -[2]:http://www.linuxquestions.org/questions/linux-news-59/2014-linuxquestions-org-members-choice-award-winners-4175532948/ -[3]:http://www.linuxquestions.org/questions/2014mca.php -[4]:http://ostatic.com/blog/lq-members-choice-award-winners-announced -[5]:http://www.linuxquestions.org/questions/2014mca.php \ No newline at end of file diff --git a/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md new file mode 100644 index 0000000000..6333fea9a7 --- /dev/null +++ b/sources/talk/20150304 ​No reboot patching comes to Linux 4.0.md @@ -0,0 +1,58 @@ +​No reboot patching comes to Linux 4.0 +================================================================================ +> **Summary**:With the new Linux 4.0 kernel, you'll need to reboot Linux less often than ever. + +With [Linux 4.0][1], you may never need to reboot your operating system again. + +![Using Linux means never having to reboot. -- SUSE ](http://zdnet4.cbsistatic.com/hub/i/r/2015/03/02/5e766833-454b-45b5-a8f7-a55d21e9d26a/resize/270x270/4d0774552c342a1507784ef802619b71/livepatching.jpg) +Using Linux means never having to reboot. -- SUSE + +One reason to love Linux on your servers or in your data-center is that you so seldom needed to reboot it. True, critical patches require a reboot, but you could go months without rebooting. Now, with the latest changes to the Linux kernel you may be able to go years between reboots. + +This is actually a feature that was available in Linux in 2009 thanks to a program called [Ksplice][2]. This program compares the original and patched kernels and then uses a customized kernel module to patch the new code into the running kernel. Each Ksplice-enabled kernel comes with a special set of flags for each function that will be patched. The [Ksplice process][3] then watches for a moment when the code for the function being patched isn't in use, and ta-da, the patch is made and your server runs on. + +[Oracle acquired Ksplice][4] in 2011, and kept it just for its own [Oracle Linux][5], a [Red Hat Enterprise Linux (RHEL)][6] clone, and as a RHEL subscription service. That left all the other enterprise and server Linux back where they started. + +Then [KernelCare released a service that could provide bootless patches][7] for most enterprise Linux distros. This program use proprietary software and is only available as a service with a monthly fee. That was a long way from satisfying many Linux system administrators. + +So, [Red Hat][8] and [SUSE][9] both started working on their own purely open-source means of giving Linux the ability to keep running even while critical patches were being installed. Red Hat's program was named [kpatch][10], while SUSE' is named [kGraft][11]. + +The two companies took different approaches. Kpatch issues a stop_machine() command. After that it looks at the stack of existing processes using [ftrace][12] and, if the patch can be made safely, it redirects the running code to the patched functions and then removes the now outdated code. + +Kgraft also uses ftrace, but it works on the thread level. When an old function is called it makes sure the thread reaches a point that it can switch to the new function. + +While the end result is the same, the operating system keeps running while patches are made, there are significant differences in performance. Kpatch takes from one to forty milliseconds, while kGraft might take several minutes but there's never even a millisecond of down time. + +At the Linux Plumbers Conference in October 2014, the two groups got together and started work on a way to [patch Linux without rebooting that combines the best of both programs][13]. Essentially, what they ended up doing was putting both kpatch and kGraft in the 4.0 Linux kernel. + +Jiri Kosina, a SUSE software engineer and Linux kernel developer, explained, that live-patching in the Linux kernel will "provides a basic infrastructure for function "live patching" (i.e. code redirection), including API [application programming interface] for kernel modules containing the actual patches, and API/ABI [application binary interface] for userspace to be able to operate on the patches. This is "relatively simple and minimalistic, as it's making use of existing kernel infrastructure (namely ftrace) as much as possible. It's also self-contained, in a sense that it doesn't hook itself in any other kernel subsystem (it doesn't even touch any other code)." + +The release candidate for Linux 4.0 is now out. Kosina stated that "It's now implemented for x86 only as a reference architecture, but support for powerpc, s390 and arm is already in the works." And, indeed, the source code for these architectures is already in the [Live Patching Git code][14]. + +Simply having the code in there is just the start. Your Linux distribution will have to support it with patches that can make use of it. With both Red Hat and SUSE behind it, live patching will soon be the default in all serious business Linux distributions. + +-------------------------------------------------------------------------------- + +via: http://www.zdnet.com/article/no-reboot-patching-comes-to-linux-4-0/#ftag=RSSbaffb68 + +作者:[Steven J. Vaughan-Nichols][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.zdnet.com/meet-the-team/us/sjvn/ +[1]:http://www.zdnet.com/article/linux-kernel-turns-over-release-odometer-to-4-0/ +[2]:http://www.computerworld.com/article/2466389/open-source-tools/never-reboot-again-with-linux-and-ksplice.html +[3]:http://www.ksplice.com/ +[4]:http://www.zdnet.com/article/oracle-acquires-zero-downtime-linux-upgrade-software/ +[5]:http://www.oracle.com/us/technologies/linux/overview/index.html +[6]:http://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[7]:http://www.zdnet.com/article/kernelcare-new-no-reboot-linux-patching-system/ +[8]:http://www.redhat.com/ +[9]:http://www.suse.com/ +[10]:http://rhelblog.redhat.com/2014/02/26/kpatch/ +[11]:http://www.zdnet.com/article/suse-gets-live-patching/ +[12]:http://elinux.org/Ftrace +[13]:http://linuxplumbersconf.org/2014/wp-content/uploads/2014/10/LPC2014_LivePatching.txt +[14]:https://kernel.googlesource.com/pub/scm/linux/kernel/git/jikos/livepatching/+/9ec0de0ee0c9f0ffe4f72da9158194121cc22807 \ No newline at end of file diff --git a/sources/talk/20150309 Comparative Introduction To FreeBSD For Linux Users.md b/sources/talk/20150309 Comparative Introduction To FreeBSD For Linux Users.md new file mode 100644 index 0000000000..d29a75cb69 --- /dev/null +++ b/sources/talk/20150309 Comparative Introduction To FreeBSD For Linux Users.md @@ -0,0 +1,98 @@ +Comparative Introduction To FreeBSD For Linux Users +================================================================================ +![](https://1102047360.rsc.cdn77.org/wp-content/uploads/2015/03/FreeBSD-790x494.jpg) + +### Introduction ### + +BSD was originally derived from UNIX and currently, there are various number of Unix-like operating systems descended from the BSD. While, FreeBSD is the most widely used open source Berkeley Software Distribution (BSD distribution). As it is implicitly said it is a free and open source Unix-like-operating system and a public server platform. FreeBSD source code is generally released under a permissive BSD license. It is true that it has similarities with Linux but we cannot deny that they differs in other points. + +The remainder of this article is organized as follows: the description of FreeBSD will be treated in our first section. The similarities between FreeBSD and Linux will be briefly described in the second section. While their differences will be discussed in the third section. And a comparison of their features will be summarized in our last section. + +### FreeBSD description ### + +#### History #### + +- The first version of FreeBSD was released in 1993, while its first CD-ROM distributed was FreeBSD1.0 on December 1993. Then, FreeBSD 2.1.0 was released in 1995 which gained the satisfaction of all users. Actually, many IT companies use FreeBSD and are satisfied where we can list those companies: IBM, Nokia, NetApp and Juniper Networks. + +#### License #### + +- Concerning its license, FreeBSD is released under various source licenses. Its newest code called Kernel is released under the two-clause BSD license, offering the possibility to use and redistribute FreeBSD with absolute freedom. Other codes are released three- and four-clause BSD license and some others are released under GPL and CDDL. + +#### Users #### + +- One of the important feature of FreeBSD, we can mention the various categories of its users. In fact, it is possible to use FreeBSD as a mail server, web server, FTP server and as a router due to the significant set of server-related software accompanied with it. Furthermore, ARM, PowerPC and MIPS are supported by FreeBSD so it is possible to use x86 and s86-64. + +### FreeBSD and Linux similarities ### + +FreeBSD and Linux are two free and open source systems. Indeed, their users can easily check and modify the source code with an absolute freedom. To add, FreeBSD and Linux, both of them are derived from Unix.-like because they have a kernel, internals, and libraries programmed using algorithms derived from historic AT&T Unix. While FreeBSD’s roots are similar to Unix systems, Linux is released as a free Unix-like option. Various tools and applications can be found either in FreeBSD or in Linux in fact, they almost share the same functionality. + +Furthermore, FreeBSD can run big number of Linux applications. It has a Linux compatibility layer that can be installed. This Linux compatibility layer can be installed while compiling FreeBSD with AAC Compact Linux or downloading compiled FreeBSD systems with a Linux compatibility program such as: aac_linux.ko. Which is not the same case with Linux, Linux cannot run FreeBSD software. + +At the end, we can mention that both of them have the same goal but have also some differences which we will outline in the next section. + +### FreeBSD and Linux differences ### + +Currently, no criteria of choice between FreeBSD and Linux is clear for most users. Since, they share almost the same applications. Those two operating systems are as mentioned previously UNIX-like. + +In this section, we will list the most important differences of those two systems. + +#### License #### + +- The first difference point between those two compared systems consist on their license. To start by Linux license, it is released under the GPL license which offers the possibility to view, distribute and change the source code with an absolute freedom. The GPL license helps users to prevent the distribution of binary-only source. Which is the case with FreeBSD, which is licensed under BSD license. This kind of license is more restrictive and easily allows the distribution of binary-only source. The BSD license is more permissive that the GPL since no derivative work is required to maintain the licensing terms. Means any user can use, distribute and modify the code without need to have the previous version of code before changing made. They only need to have the original license of BSD. +- Depending on the needs of each user, a selection can be made between those two types of license. Starting by BSD license which is more preferred by many users due to its special features. In fact, this license gives the possibility to sell each software licensed under it and retain the source code. Passing now to the GPL license, which requires some care of each user has a software released under it. +- To be able to choose between those two software, it is required to understand the licensing of both of them to more understand the methodology used in their development, to distinguish between their features and know which one will fit user’s need. + +#### Control #### + +- Since FreeBSD and Linux are released under two different type of license, the Linux Torvalds control the Linux kernel which is not the same case with FreeBSD which is not controlled. Personally, I prefer to use FreeBSD instead of Linux since it is an absolute free software, no control permission exists. But it is not enough there is other differences between Linux and FreeBSD, help you to choose between both of them. As an advice don’t choose one of them, follow us and then give us your choice. + +#### Operating system #### + +- Linux concentrates only on the kernel system which is not the case with FreeBSD while the whole operating system is maintained. The kernel and a set of software, some of them are developed by the FreeBSD team, are maintained as one unit. Indeed, the FreeBSD developers have the possibility to manage the essential operating systems remotely and efficiently. +- With Linux, there is some difficulties while managing a system. Since, the different components maintained will be from different sources so the Linux developers need to assemble them into groups having the same functionality. +- FreeBSD and Linux both of them give the possibility to have a big set of optional software and distributions but they differ on the way they are managed. With FreeBSD, they are managed together while with Linux they will be maintained separately. + +#### Hardware support #### + +- Concerning the hardware support, Linux is better than FreeBSD. It doesn’t mean that FreeBSD hasn’t the capability to support hardware as Linux. They differ just on the manner. It depends on your need as usual. So if you are searching for the newest solution, the FreeBSD will fit your needs but if you are looking for greatest graphs, it is better to use Linux. + +#### FreeBSD origin Vs Linux origin #### + +- The origin of each system is also another point of distinction between both of them. As I said previously Linux is an alternative of the operating system Unix, written by Linus Trovalds and assisted by a special group of hackers across the Net. Linux has all the needed features in a modern Unix, such as virtual memory, shared libraries, demand loading, proper memory management and many others. It is released under the General Public License. +- FreeBSD also shared many important features of its Unix heritage. FreeBSD as a type of the Berkeley Software Distribution, the distribution of the Unix developed at the University of California. The most important reason under developing BSD is to replace the AT&T operating system by an open source alternative giving the user the ability to use BSD without carry about the obtaining of the AT&T license. +- The problem of licensing, is the most important worry of developers. They try to offer the maximum open source clone of Unix. Which influences the choice of users regarding the degree of open source of each system as FreeBSD gives more freedom than Linux regarding its use since it is released under BSD license. + +#### Supported Package #### + +- From the user’s perspective, another difference between our two compared systems, is their availability and support of the packaged software and source installed software. The Linux distributions provide just the pre-compiled binary packages which is not the same case with FreeBSD, which has the pre-built packages and the build system for the compilation and installation through their available open source. Due to its ports, FreeBSD gives you the possibility to choose between the default making of pre-compiled packages and your ability to customize your software while it is compiled. +- Those ports enable you to build all the software available with FreeBSD. Furthermore, there is an hierarchy of organization all of them due to the directories /usr/ports where you can find the location of the source files and some documentation about the way to use FreeBSD correctly. +- The ports as mentioned give the possibility produce the packages version of software. Instead of having just the pre-compiled packages using Linux, FreeBSD gives you the possibility to have the source-built and the pre-packages software. You can manage your system using the two installation methods. + +#### FreeBSD Vs Linux common Tools #### + +- A huge number of common tools are available while using FreeBSD and are fully own made by the FreeBSD team. In contrast, the Linux tools are from the GNU that is why there is some control during their usage. +- The fact that FreeBSD is released under BSD license is so beneficial and useful. Since, you have the ability to maintain the core operating system, control the development of these applications. Same of those tools are similar to BSD and Unix tools from where they were derived which is not the same case with GNU suite, which want to just make them less backwards compatible. + +#### The Standard Shell #### + +- The tcsh shell is used by default with FreeBSD. Which is an evaluated version fo csh. Since, the FreeBSD is released under the BSD license, it is not recommended to use the bash shell which is a GNU component. The only difference between bash and tcsh shell consists on the scripting feature which can’t be made by tcsh. Indeed, the sh shell is more recommended for the FreeBSD use since it is more reliable and prevents some issues of scripting can be occurred using the tcsh or csh shell. + +#### A More Stratified Filesystem #### + +- As it was mentioned previously, base operating system and optional components can be easily distinguished using the FreeBSD system. Which causes some specification of their organization. In Linux, /bin, /sbin, /usr/bin, or usr/sbin are the directories for executable systems. With FreeBSD it is not the case. There are some additional specifications concerning their organization. The base system are putted in one of the directories mentioned above while the ports and packages are placed in /usr/local/bin or /usr/local/sbin. This methodology helps to recognize and distinguish between an application considered as a base system or a port. + +### Conclusion ### + +FreeBSD and Linux those two free and open source systems, share various similarities but they also differ in several points. The list giving above isn’t given to say that one of them is better than the other. In fact, FreeBSD and Linux, each one of them has its features and specifications that make it a special regarding the other. And you what is your opinion? Have you already used one on them or both? If yes what is your feedback and if no after reading our description what do you think? Sound off and give us and the fellow readers your opinion. + +-------------------------------------------------------------------------------- + +via: https://www.unixmen.com/comparative-introduction-freebsd-linux-users/ + +作者:[anismaj][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.unixmen.com/author/anis/ \ No newline at end of file diff --git a/sources/talk/20150320 Revealed--The best and worst of Docker.md b/sources/talk/20150320 Revealed--The best and worst of Docker.md new file mode 100644 index 0000000000..1e188d6cba --- /dev/null +++ b/sources/talk/20150320 Revealed--The best and worst of Docker.md @@ -0,0 +1,66 @@ +Revealed: The best and worst of Docker +================================================================================ +![](http://images.techhive.com/images/article/2015/01/best_worst_places_to_work-100564193-primary.idge.jpg) +Credit: [Shutterstock][1] + +> Docker experts talk about the good, the bad, and the ugly of the ubiquitous application container system + +No question about it: Docker's app container system has made its mark and become a staple in many IT environments. With its accelerating adoption, it's bound to stick around for a good long time. + +But there's no end to the debate about what Docker's best for, where it falls short, or how to most sensibly move it forward without alienating its existing users or damaging its utility. Here, we've turned to a few of the folks who have made Docker their business to get their takes on Docker's good, bad, and ugly sides. + +### The good ### + +One hardly expects Steve Francia, chief of operations of the Docker open source project, to speak of Docker in anything less than glowing terms. When asked by email about Docker's best attributes, he didn't disappoint: "I think the best thing about Docker is that it enables people, enables developers, enables users to very easily run an application anywhere," he said. "It's almost like the Holy Grail of development in that you can run an application on your desktop, and the exact same application without any changes can run on the server. That's never been done before." + +Alexis Richardson of [Weaveworks][2], a virtual networking product, praised Docker for enabling simplicity. "Docker offers immense potential to radically simplify and speed up how software gets built," he replied in an email. "This is why it has delivered record-breaking initial mind share and traction." + +Bob Quillin, CEO of [StackEngine][3], which makes Docker management and automation solutions, noted in an email that Docker (the company) has done a fine job of maintaining Docker's (the product) appeal to its audience. "Docker has been best at delivering strong developer support and focused investment in its product," he wrote. "Clearly, they know they have to keep the momentum, and they are doing that by putting intense effort into product functionality." He also mentioned that Docker's commitment to open source has accelerated adoption by "[allowing] people to build around their features as they are being built." + +Though containerization itself isn't new, as Rob Markovich of IT monitoring-service makers [Moogsoft][4] pointed out, Docker's implementation makes it new. "Docker is considered a next-generation virtualization technology given its more modern, lightweight form [of containerization]," he wrote in an email. "[It] brings an opportunity for an order-of-magnitude leap forward for software development teams seeking to deploy code faster." + +### The bad ### + +What's less appealing about Docker boils down to two issues: the complexity of using the product, and the direction of the company behind it. + +Samir Ghosh, CEO of enterprise PaaS outfit [WaveMaker][5], gave Docker a thumbs-up for simplifying the complex scripting typically needed for continuous delivery. That said, he added, "That doesn't mean Docker is simple. Implementing Docker is complicated. There are a lot of supporting technologies needed for things like container management, orchestration, app stack packaging, intercontainer networking, data snapshots, and so on." + +Ghosh noted the ones who feel the most of that pain are enterprises that want to leverage Docker for continuous delivery, but "it's even more complicated for enterprises that have diverse workloads, various app stacks, heterogenous infrastructures, and limited resources, not to mention unique IT needs for visibility, control and security." + +Complexity also becomes an issue in troubleshooting and analysis, and Markovich cited the fact that Docker provides application abstraction as the reason why. "It is nearly impossible to relate problems with application performance running on Docker to the performance of the underlying infrastructure domains," he said in an email. "IT teams are going to need visibility -- a new class of monitoring and analysis tools that can correlate across and relate how everything is working up and down the Docker stack, from the applications down to the private or public infrastructure." + +Quillin is most concerned about Docker's direction vis-à-vis its partner community: "Where will Docker make money, and where will their partners? If [Docker] wants to be the next VMware, it will need to take a page out of VMware's playbook in how to build and support a thriving partner ecosystem. + +"Additionally, to drive broader adoption, especially in the enterprise, Docker needs to start acting like a market leader by releasing more fully formed capabilities that organizations can count on, versus announcements of features with 'some assembly required,' that don't exist yet, or that require you to 'submit a pull request' to fix it yourself." + +Francia pointed to Docker's rapid ascent for creating its own difficulties. "[Docker] caught on so quickly that there's definitely places that we're focused on to add some features that a lot of users are looking forward to." + +One such feature, he noted, was having a GUI. "Right now to use Docker," he said, "you have to be comfortable with the command line. There's no visual interface to using Docker. Right now it's all command line-based. And we know if we want to really be as successful as we think we can be, we need to be more approachable and a lot of people when they see a command line, it's a bit intimidating for a lot of users." + +### The future ### + +In that last respect, Docker recently started to make advances. Last week it [bought the startup Kitematic][6], whose product gave Docker a convenient GUI on Mac OS X (and will eventually do the same for Windows). Another acqui-hire, [SocketPlane][7], is being spun in to work on Docker's networking. + +What remains to be seen is whether Docker's proposed solutions to its problems will be adopted, or whether another party -- say, [Red Hat][8] -- will provide a more immediately useful solution for enterprise customers who can't wait around for the chips to stop falling. + +"Good technology is hard and takes time to build," said Richardson. "The big risk is that expectations spin wildly out of control and customers are disappointed." + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2896895/application-virtualization/best-and-worst-about-docker.html + +作者:[Serdar Yegulalp][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/Serdar-Yegulalp/ +[1]:http://shutterstock.com/ +[2]:http://weave.works/ +[3]:http://stackengine.com/ +[4]:http://www.moogsoft.com/ +[5]:http://www.wavemaker.com/ +[6]:http://www.infoworld.com/article/2896099/application-virtualization/dockers-new-acquisition-does-containers-on-the-desktop.html +[7]:http://www.infoworld.com/article/2892916/application-virtualization/docker-snaps-up-socketplane-to-fix-networking-flaws.html +[8]:http://www.infoworld.com/article/2895804/application-virtualization/red-hat-wants-to-do-for-containers-what-its-done-for-linux.html \ No newline at end of file diff --git a/sources/talk/20150410 10 Top Distributions in Demand to Get Your Dream Job.md b/sources/talk/20150410 10 Top Distributions in Demand to Get Your Dream Job.md new file mode 100644 index 0000000000..0e3e611ea4 --- /dev/null +++ b/sources/talk/20150410 10 Top Distributions in Demand to Get Your Dream Job.md @@ -0,0 +1,149 @@ +10 Top Distributions in Demand to Get Your Dream Job +================================================================================ +We are coming up with a series of five articles which aims at making you aware of the top skills which will help you in getting yours dream job. In this competitive world you can not rely on one skill. You need to have balanced set of skills. There is no measure of a balanced skill set except a few conventions and statistics which changes from time-to-time. + +The below article and remaining to follow is the result of close study of job boards, posting and requirements of various IT Companies across the globe of last three months. The statistics keeps on changing as the demand and market changes. We will try our best to update the list when there is any major changes. +The Five articles of this series are… + +- 10 Distributions in Demand to Get Your Dream Job +- [10 Famous IT Skills in Demand That Will Get You Hired][1] +- 10 Programming Skills That Will Help You to Get Dream Job +- 10 IT Networking Protocols Skills to Land Your Dream Job +- 10 Professional Certifications in Demand That Will Get You Hired + +### 1. Windows ### + +The operating System developed by Microsoft not only dominates the PC market but it is also the most sought OS skill from job perspective irrespective of all the odds and criticism that follows. It has shown a growth in demand which equals to 0.1% in the last quarter. + +Latest Stable Release : Windows 8.1 + +### 2. Red Hat Enterprise Linux ### + +Red Hat Enterprise Linux is a commercial Linux Distribution developed by Red Hat Inc. It is one of the Most widely used Linux distribution specially in corporates and production. It comes at number two having a overall growth in demand which equals to 17% in the last quarter. + +Latest Stable Release : RedHat Enterprise Linux 7.1 + +### 3. Solaris ### + +The UNIX Operating System developed by Sun Microsystems and now owned by Oracle Inc. comes at number three. It has shown a growth in demand which equals to 14% in the last quarter. + +Latest Stable Release : Oracle Solaris 10 1/13 + +### 4. AIX ### + +Advanced Interactive eXecutive is a Proprietary Unix Operating System by IBM stands at number four. It has shown a growth in demand which equals to 11% in the last quarter. + +Latest Stable Release : AIX 7 + +### 5. Android ### + +One of the most widely used open source operating system designed specially for mobile, tablet computers and wearable gadgets is now owned by Google Inc. comes at number five. It has shown a growth in demand which equals to 4% in the last quarter. + +Latest Stable Release : Android 5.1 aka Lollipop + +### 6. CentOS ### + +Community Enterprise Operating System is a Linux distribution derived from RedHat Enterprise Linux. It comes at sixth position in the list. Market has shown a growth in demand which is nearly 22% for CentOS, in the last quarter. + +Latest Stable Release : CentOS 7 + +### 7. Ubuntu ### + +The Linux Operating System designed for Humans and designed by Canonicals Ltd. Ubuntu comes at position seventh. It has shown a growth in demand which equals to 11% in the last quarter. +Latest Stable Release : + +- Ubuntu 14.10 (9 months security and maintenance update). +- Ubuntu 14.04.2 LTS + +### 8. Suse ### + +Suse is a Linux operating System owned by Novell. The Linux distribution is famous for YaST configuration tool. It comes at position eight. It has shown a growth in demand which equals to 8% in the last quarter. + +Latest Stable Release : 13.2 + +### 9. Debian ### + +The very famous Linux Operating System, mother of 100’s of Distro and closest to GNU comes at number nine. It has shown a decline in demand which is nearly 9% in the last quarter. + +Latest Stable Release : Debian 7.8 + +### 10. HP-UX ### + +The Proprietary UNIX Operating System designed by Hewlett-Packard comes at number ten. It has shown a decline in the last quarter by 5%. + +Latest Stable Release : 11i v3 Update 13 + +注:表格数据--不需要翻译--开始 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
1Windows0.1% +
2RedHat17% +
3Solaris14% +
4AIX11% +
5Android4% +
6CentOS22% +
7Ubuntu11% +
8Suse8% +
9Debian9% -
10HP-UX5% -
+注:表格数据--不需要翻译--结束 + +That’s all for now. I’ll be coming up with the next article of this series very soon. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in the comments below. Like and share us and help us get spread. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/top-distributions-in-demand-to-get-your-dream-job/ + +作者:[Avishek Kumar][a] +译者:[weychen](https://github.com/weychen) +校对:[校对者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/top-distributions-in-demand-to-get-your-dream-job/www.tecmint.com/famous-it-skills-in-demand-that-will-get-you-hired/ diff --git a/sources/talk/The history of Android/13 - The history of Android.md b/sources/talk/The history of Android/13 - The history of Android.md deleted file mode 100644 index 31f5cd7eb4..0000000000 --- a/sources/talk/The history of Android/13 - The history of Android.md +++ /dev/null @@ -1,104 +0,0 @@ -【translating】The history of Android -================================================================================ -![](http://cdn.arstechnica.net/wp-content/uploads/2014/03/ready-fight.png) - -### Android 2.1, update 1—the start of an endless war ### - -Google was a major launch partner for the first iPhone—the company provided Google Maps, Search, and YouTube for Apple’s mobile operating system. At the time, Google CEO Eric Schmidt was a member of Apple’s board of directors. In fact, during the original iPhone presentation, [Schmidt was the first person on stage][] after Steve Jobs, and he joked that the two companies were so close they could merge into “AppleGoo." - -While Google was developing Android, the relationship between the two companies slowly became contentious. Still, Google largely kept Apple happy by keeping key iPhone features, like pinch zoom, out of Android. The Nexus One, though, was the first slate-style Android flagship without a keyboard, which gave the device the same form factor as the iPhone. Combined with the newer software and Google branding, this was the last straw for Apple. According to Walter Isaacson’s biography on Steve Jobs, after seeing the Nexus One in January 2010, the Apple CEO was furious, saying "I will spend my last dying breath if I need to, and I will spend every penny of Apple's $40 billion in the bank, to right this wrong... I'm going to destroy Android, because it's a stolen product. I'm willing to go thermonuclear war on this." - -All of this happened behind closed doors, only coming out years after the Nexus One was released. The public first caught wind of this growing rift between Google and Apple when, a month after the release of Android 2.1, an update shipped for the Nexus One called “[2.1 update 1.][2]" The updated added one feature, something iOS long held over the head of Android: pinch-zoom. - -While Android supported multi-touch APIs since version 2.0, the default operating system apps stayed clear of this useful feature at the behest of Jobs. After reconciliation meetings over the Nexus One failed, there was no longer a reason to keep pinch zoom out of Android. Google pushed all their chips into the middle of the table, hit the update button, and was finally “all-in" with Android. - -With pinch zoom enabled in Google Maps, the Browser, and the Gallery, the Google-Apple smartphone war was on. In the coming years, the two companies would become bitter enemies. A month after the pinch zoom update, Apple went on the warpath, suing everyone and everything that used Android. HTC, Motorola, and Samsung were all brought to court, and some of them are still in court. Schmidt resigned from Apple’s board of directors. Google Maps and YouTube were kicked off of the iPhone, and Apple even started a rival mapping service. Today, the two players that were almost "AppleGoo" compete in smartphones, tablets, laptops, movies, TV shows, music, books, apps, e-mail, productivity software, browsers, personal assistants, cloud storage, mobile advertising, instant messaging, mapping, and set-top-boxes... and soon the two will be competing in car computers, wearables, mobile payments, and living room gaming. - -### Android 2.2 Froyo—faster and Flash-ier ### - -[Android 2.2][3] came out four months after the release of 2.1, in May 2010. Froyo featured major under-the-hood improvements for Android, all made in the name of speed. The biggest addition was just-in-time (JIT) compilation. JIT automatically converted java bytecode into native code at runtime, which led to drastic performance improvements across the board. - -The Browser got a performance boost, too, thanks to the integration of the V8 javascript engine from Chrome. This was the first of many features the Android browser would borrow from Chrome, and eventually the stock browser would be completely replaced by a mobile version of Chrome. Until that day came, though, the Android team needed to ship a browser. Pulling in Chrome parts was an easy way to upgrade. - -While Google was focusing on making its platform faster, Apple was making its platform bigger. Google's rival released the 10-inch iPad a month earlier, ushering in the modern era of tablets. While some large Froyo and Gingerbread tablets were released, Google's official response—Android 3.0 Honeycomb and the Motorola Xoom—would not arrive for nine months. - -![Froyo added a two-icon dock at the bottom and universal search.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/22-2.png) -Froyo added a two-icon dock at the bottom and universal search. -Photo by Ron Amadeo - -The biggest change on the Froyo homescreen was the new dock at the bottom, which filled the previously empty space to the left and right of the app drawer with phone and browser icons. Both of these icons were custom-designed white versions of the stock icons, and they were not user-configurable. - -The default layout removed all the icons, and it only stuck the new tips widget on the screen, which directed you to click on the launcher icon to access your apps. The Google Search widget gained a Google logo which doubled as a button. Tapping it would open the search interface and allow you to restrict a search by Web, apps, or contacts. - -![The downloads page showing the “update all" button, the Flash app, a flash-powered site where anything is possible, and the “move to SD" button. ](http://cdn.arstechnica.net/wp-content/uploads/2014/03/small-market-2.jpg) -The downloads page showing the “update all" button, the Flash app, a flash-powered site where anything is possible, and the “move to SD" button. -Photo by [Ryan Paul][4] - -Some of the best additions to Froyo were more download controls for the Android Market. There was now an “Update all" button pinned to the bottom of the Downloads page. Google also added an automatic updating feature, which would automatically install apps as long as the permissions hadn't changed; automatic updating was off by default, though. - -The second picture shows Adobe Flash Player, which was exclusive to Froyo. The app plugged in to the browser and allowed for a “full Web" experience. In 2010, this meant pages heavy with Flash navigation and video. Flash was one of Android's big differentiators compared to the iPhone. Steve Jobs started a holy war against Flash, declaring it an obsolete, buggy piece of software, and Apple would not allow it on iOS. So Android picked up the Flash ball and ran with it, giving users the option of having a semi-workable implementation on Android. - -At the time, Flash could bring even a desktop computer to its knees, so keeping it on all the time on a mobile phone delivered terrible performance. To fix this, Flash on Android's browser could be set to "on-demand"—Flash content would not load until users clicked on the Flash placeholder icon. Flash support would last on Android until 4.1, when Adobe gave up and killed the project. Ultimately Flash never really worked well on Android. The lack of Flash on the iPhone, the most popular mobile device, pushed the Internet to eventually dump the platform. - -The last picture shows the newly added ability to move apps to the SD card, which, in an era when phones came with 512MB of internal storage, was sorely needed. - -![The car app and camera app. The camera could now rotate.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/22carcam-2.png) -The car app and camera app. The camera could now rotate. -Photo by Ron Amadeo - -The camera app was finally updated to support portrait mode. The camera settings were moved out of the drawer and into a semi-transparent strip of buttons next to the shutter button and other controls. This new design seemed to take a lot of inspiration from the Cooliris Gallery app, with transparent, springy speech bubble popups. It was quite strange to see the high-tech Cooliris-style UI design grafted on to the leather-bound camera app—the aesthetics didn't match at all. - -![The semi-broken Facebook app is a good example of the common 2x3 navigation page. Google Goggles was included but also broken.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/facebook.png) -The semi-broken Facebook app is a good example of the common 2x3 navigation page. Google Goggles was included but also broken. -Photo by Ron Amadeo - -Unlike the Facebook client included in Android 2.0 and 2.1, the 2.2 version still sort of works and can sign in to Facebook's servers. The Facebook app is a good example of Google's design guidelines for apps at the time, which suggested having a navigational page consisting of a 3x2 grid of icons as the main page of an app. - -This was Google's first standardized attempt at getting navigational elements out of the menu button and onto the screen, where users could find them. This design was usable, but it added an extra roadblock between launching an app and using an app. Google would later realize that when users launch an app, it was a better idea to show them content instead of an interstitial navigational screen. In Facebook for instance, opening to the news feed would be much more appropriate. And later app designs would relegate navigation to a second-tier location—first as tabs at the top of the screen, and later Google would settle on the "Navigation Drawer," a slide-out panel containing all the locations in an app. - -Also packed in with Froyo was Google Goggles, a visual search app which would try to identify the subject of a picture. It was useful for identifying works of art, landmarks, and barcodes, but not much else. These first two setup screens, along with the camera interface, are all that work in the app anymore. Today, you can't actually complete a search with a client this old. There wasn't much to see anyway; it was a camera interface that returned a search results page. - -![The Twitter app, which was an animation-filled collaboration between Google and Twitter.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/twitters-2.png) -The Twitter app, which was an animation-filled collaboration between Google and Twitter. -Photo by Ron Amadeo - -Froyo included the first Android Twitter app, which was actually a collaboration between Google and Twitter. At the time, a Twitter app was one of the big holes in Android's app lineup. Developers favored the iPhone, and with Apple's head start and stringent design requirements, the App Store's app selection was far superior to Android's. But Google needed a Twitter app, so it teamed up with the company to get the first version out the door. - -This represented Google's newer design language, which meant it had an interstitial navigation page and a "tech-demo" approach to animations. The Twitter app was even more heavy-handed with animation effects than the Cooliris Gallery—everything moved all the time. The clouds at the top and bottom of every page continually scrolled at varying speeds, and the Twitter bird at the bottom flapped its wings and moved its head left and right. - -The Twitter app actually featured an early precursor to the Action Bar, a persistent strip of top-aligned controls that was introduced in Android 3.0 . Along the top of every screen was a blue bar containing the Twitter logo and buttons like search, refresh, and compose tweet. The big difference between this and the later action bars was that the Twitter/Google design lacks an "Up" button in the top right corner, and it actually uses an entire second bar to show your current location within the app. In the second picture above, you can see a whole bar dedicated to the location label "Tweets" (and, of course, the continuously scrolling clouds). The Twitter logo in the second bar acted as another navigational element, sometimes showing additional drill down areas within the current section and sometimes showing the entire top-level shortcut group. - -The 2.3 Tweet stream didn't look much different from what it does today, save for the hidden action buttons (reply, retweet, etc), which were all under the right-aligned arrow buttons. They popped up in a speech bubble menu that looked just like the navigational popup. The faux-action bar was doing serious work on the create tweet page. It housed the twitter logo, remaining character count, and buttons to attach a picture, take a picture, and a contact mention button. - -The Twitter app even came with a pair of home screen widgets. The big one took up eight slots and gave you a compose bar, update button, one tweet, and left and right arrows to view more tweets. The little one showed a tweet and reply button. Tapping on the compose bar on the large widget immediately launched the main "Create Tweet," rendering the "update" button worthless. - -![Google Talk and the new USB dialog.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/talkusb.png) -Google Talk and the new USB dialog. -Photo by Ron Amadeo - -Elsewhere, Google Talk (and the unpictured SMS app) changed from a dark theme to a light theme, which made both of them look a lot closer to the current, modern apps. The USB storage screen that popped up when you plugged into a computer changed from a simple dialog box to a full screen interface. Instead of a text-only design, the screen now had a mutant Android/USB-stick hybrid. - -While Android 2.2 didn’t feature much in the way of user-facing features, a major UI overhaul was coming in the next two versions. Before all the UI work, though, Google wanted to revamp the core of Android. Android 2.2 accomplished that. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/13/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://www.youtube.com/watch?v=9hUIxyE2Ns8#t=3016 -[2]:http://arstechnica.com/gadgets/2010/02/googles-nexus-one-gets-multitouch/ -[3]:http://arstechnica.com/information-technology/2010/07/android-22-froyo/ -[4]:http://arstechnica.com/information-technology/2010/07/android-22-froyo/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo diff --git a/sources/talk/The history of Android/14 - The history of Android.md b/sources/talk/The history of Android/14 - The history of Android.md deleted file mode 100644 index 3377527026..0000000000 --- a/sources/talk/The history of Android/14 - The history of Android.md +++ /dev/null @@ -1,84 +0,0 @@ -alim0x translating - -The history of Android -================================================================================ -### Voice Actions—a supercomputer in your pocket ### - -In August 2010, a new feature “[Voice Actions][1]" launched in the Android Market as part of the Voice Search app. Voice Actions allowed users to issue voice commands to their phone, and Android would try to interpret them and do something smart. Something like "Navigate to [address]" would fire up Google Maps and start turn-by-turn navigation to your stated destination. You could also send texts or e-mails, make a call, open a Website, get directions, or view a location on a map—all just by speaking. - -注:youtube视频地址 - - -Voice Actions was the culmination of a new app design philosophy for Google. Voice Actions was the most advanced voice control software for its time, and the secret was that Google wasn’t doing any computing on the device. In general, voice recognition was very CPU intensive. In fact, many voice recognition programs still have a “speed versus accuracy" setting, where users can choose how long they are willing to wait for the voice recognition algorithms to work—more CPU power means better accuracy. - -Google’s innovation was not bothering to do the voice recognition computing on the phone’s limited processor. When a command was spoken, the user’s voice was packaged up and shipped out over the Internet to Google’s cloud servers. There, Google’s farm of supercomputers pored over the message, interpreted it, and shipped it back to the phone. It was a long journey, but the Internet was finally fast enough to accomplish something like this in a second or two. - -Many people throw the phrase “cloud computing" around to mean “anything that is stored on a server," but this was actual cloud computing. Google was doing hardcore compute operations in the cloud, and because it is throwing a ridiculous amount of CPU power at the problem, the only limit to the voice recognition accuracy is the algorithms themselves. The software didn't need to be individually “trained" by each user, because everyone who used Voice Actions was training it all the time. Using the power of the Internet, Android put a supercomputer in your pocket, and, compared to existing solutions, moving the voice recognition workload from a pocket-sized computer to a room-sized computer greatly increased accuracy. - -Voice recognition had been a project of Google’s for some time, and it all started with an 800 number. [1-800-GOOG-411][1] was a free phone information service that Google launched in April 2007. It worked just like 411 information services had for years—users could call the number and ask for a phone book lookup—but Google offered it for free. No humans were involved in the lookup process, the 411 service was powered by voice recognition and a text-to-speech engine. Voice Actions was only possible after three years of the public teaching Google how to hear. - -Voice recognition was a great example of Google’s extremely long-term thinking—the company wasn't afraid to invest in a project that wouldn’t become a commercial product for several years. Today, voice recognition powers products all across Google. It’s used for voice input in the Google Search app, Android’s voice typing, and on Google.com. It’s also the primary input interface for Google Glass and [Android Wear][2]. - -The company even uses it beyond input. Google's voice recognition technology is used to transcribe YouTube videos, which powers automatic closed captioning for the hearing impaired. The transcription is even indexed by Google, so you can search for words that were said in the video. Voice is the future of many products, and this long-term planning has led Google to be one of the few major tech companies with an in-house voice recognition service. Most other voice recognition products, like Apple’s Siri and Samsung devices, are forced to use—and pay a license fee for—voice recognition from Nuance. - -With the computer hearing system up and running, Google is applying this strategy to computer vision next. That's why things like Google Goggles, Google Image Search, and [Project Tango][3] exist. Just like the days of GOOG-411, these projects are in the early stages. When [Google's robot division][4] gets off the ground with a real robot, it will need to see and hear, and Google's computer vision and hearing projects will likely give the company a head start. - -![The Nexus S, the first Nexus phone made by Samsung.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/NS500.png) -The Nexus S, the first Nexus phone made by Samsung. - -### Android 2.3 Gingerbread—the first major UI overhaul ### - -Gingerbread was released in December 2010, a whopping seven months after the release of 2.2. The wait was worth it, though, as Android 2.3 changed just about every screen in the OS. It was the first major overhaul since the initial formation of Android in version 0.9. 2.3 would kick off a series of continual revamps in an attempt to turn Android from an ugly duckling into something that was capable of holding its own—aesthetically—against the iPhone. - -And speaking of Apple, six months earlier, the company released the iPhone 4 and iOS 4, which added multitasking and Facetime video chat. Microsoft was finally back in the game, too. The company jumped into the modern smartphone era with the launch of Windows Phone 7 in November 2010. - -Android 2.3 focused a lot on the interface design, but with no direction or design documents, many apps ended up getting a new bespoke theme. Some apps went with a flatter, darker theme, some used a gradient-filled, bubbly dark theme, and others went with a high-contrast white and green look. While it wasn't cohesive, Gingerbread accomplished the goal of modernizing nearly every part of the OS. It was a good thing, too, because the next phone version of Android wouldn’t arrive until nearly a year later. - -Gingerbread’s launch device was the Nexus S, Google’s second flagship device and the first Nexus manufactured by Samsung. While today we are used to new CPU models every year, back then that wasn't the case. The Nexus S had a 1GHz Cortex A8 processor, just like the Nexus One. The GPU was slightly faster, and that was it in the speed department. It was a little bigger than the Nexus One, with a 4-inch, 800×480 AMOLED display. - -Spec wise, the Nexus S might seem like a tame upgrade, but it was actually home to a lot of firsts for Android. The Nexus S was Google’s first flagship to shun a MicroSD slot, shipping with 16GB on-board memory. The Nexus One had only 512MB of storage, but it had a MicroSD slot. Removing the SD slot simplified storage management for users—there was just one pool now—but hurt expandability for power users. It was also Google's first phone to have NFC, a special chip in the back of the phone that could transfer information when touched to another NFC chip. For now, the Nexus S could only read NFC tags—it couldn't send data. - -Thanks to some upgrades in Gingerbread, the Nexus S was one of the first Android phones to ship without a hardware D-Pad or trackball. The Nexus S was now down to just the power, volume, and the four navigation buttons. The Nexus S was also a precursor to the [crazy curved-screen phones][6] of today, as Samsung outfitted the Nexus S with a piece of slightly curved glass. - -![Gingerbread changed the status bar and wallpaper, and it added a bunch of new icons.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/appdrawershop.png) -Gingerbread changed the status bar and wallpaper, and it added a bunch of new icons. -Photo by Ron Amadeo - -An upgraded "Nexus" live wallpaper was released as an exclusive addition to the Nexus S. It was basically the same idea as the Nexus One version, with its animated streaks of light. On the Nexus S, the "grid" design was removed and replaced with a wavy blue/gray background. The dock at the bottom was given square corners and colored icons. - -![The new notification panel and menu.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png) -The new notification panel and menu. -Photo by Ron Amadeo - -The status bar was finally overhauled from the version that first debuted in 0.9. The bar was changed from a white gradient to flat black, and all the icons were redrawn in gray and green. Just about everything looked crisper and more modern thanks to the sharp-angled icon design and higher resolution. The strangest decisions were probably the removal of the time period from the status bar clock and the confusing shade of gray that was used for the signal bars. Despite gray being used for many status bar icons, and there being four gray bars in the above screenshot, Android was actually indicating no cellular signal. Green bars would indicate a signal, gray bars indicated “empty" signal slots. - -The green status bar icons in Gingerbread also doubled as a status indicator of network connectivity. If you had a working connection to Google's servers, the icons would be green, if there was no connection to Google, the icons turned white. This let you easily identify the connectivity status of your connection while you were out and about. - -The notification panel was changed from the aging Android 1.5 design. Again, we saw a UI piece that changed from a light theme to a dark theme, getting a dark gray header, black background, and black-on-gray text. - -The menu was darkened too, changing from a white background to a black one with a slight transparency. The contrast between the menu icons and the background wasn’t as strong as it should be, because the gray icons are the same color as they were on the white background. Requiring a color change would mean every developer would have to make new icons, so Google went with the preexisting gray color on black. This was a change at the system level, so this new menu would show up in every app. - ----------- - -![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) - -[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work. - -[@RonAmadeo][t] - --------------------------------------------------------------------------------- - -via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/14/ - -译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://arstechnica.com/gadgets/2010/08/google-beefs-up-voice-search-mobile-sync/ -[2]:http://arstechnica.com/business/2007/04/google-rolls-out-free-411-service/ -[3]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ -[4]:http://arstechnica.com/gadgets/2014/02/googles-project-tango-is-a-smartphone-with-kinect-style-computer-vision/ -[5]:http://arstechnica.com/gadgets/2013/12/google-robots-former-android-chief-will-lead-google-robotics-division/ -[6]:http://arstechnica.com/gadgets/2013/12/lg-g-flex-review-form-over-even-basic-function/ -[a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo diff --git a/sources/talk/The history of Android/15 - The history of Android.md b/sources/talk/The history of Android/15 - The history of Android.md index 078e106d1c..9ca4176245 100644 --- a/sources/talk/The history of Android/15 - The history of Android.md +++ b/sources/talk/The history of Android/15 - The history of Android.md @@ -1,3 +1,5 @@ +alim0x translating + The history of Android ================================================================================ ![Gingerbread's new keyboard, text selection UI, overscroll effect, and new checkboxes.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/3kb-high-over-check.png) @@ -83,4 +85,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://arstechnica.com/author/ronamadeo -[t]:https://twitter.com/RonAmadeo \ No newline at end of file +[t]:https://twitter.com/RonAmadeo diff --git a/sources/tech/20141114 How To Use Emoji Anywhere With Twitter's Open Source Library.md b/sources/tech/20141114 How To Use Emoji Anywhere With Twitter's Open Source Library.md deleted file mode 100644 index e043210cf6..0000000000 --- a/sources/tech/20141114 How To Use Emoji Anywhere With Twitter's Open Source Library.md +++ /dev/null @@ -1,91 +0,0 @@ -How To Use Emoji Anywhere With Twitter's Open Source Library -================================================================================ -> Embed them in webpages and other projects via GitHub. - -![](http://a3.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2OTIyNTI3MjcxNTU1.png) - -Emoji, tiny characters from Japan that convey emotions through images, have already conquered the world of cellphone text messaging. - -Now, you can post them everywhere else in the virtual world, too. Twitter has just [open-sourced][1] its emoji library so you can use them for your own websites, apps, and projects. - -This will require a little bit of heavy lifting. Unicode has recognized and even standardized the emoji alphabet, but emoji still [aren’t fully compliant with all Web browsers][2], meaning they'll show up as “tofu,” or blank boxes, most of the time. When Twitter wanted to make emoji available, the social network teamed up with a company called [Icon Factory][3] to render browser imitations of the text message symbols. As a result, Twitter says there’s been lots of demand for access to its emoji. - -Now, you can clone Twitter’s entire library on [GitHub][4] to use in your development projects. Here’s how to do that, and how to make emoji easier to use after you do. - -### Obtain Unicode Support For Emoji ### - -Unicode is an international encoding standard that assigns a string of characters to any symbol, letter, or digit people want to use online. In other words, it’s the missing link between how you read text on a computer, and how the computer reads text. For example, while you are looking at an empty space between these words, the computer sees “&mbsp.” - -Unicode even has its own [primitive emoji][5] that can be read in the browser without any effort on your part. For example while you see a ♥, your computer is decoding the string “2665.” - -To use Twitter’s emoji library in most cases, you simply need to add a script inside the section of your HTML page: - - - -This grants your project access to the JavaScript library that contains the hundreds of emoji that work on Twitter. However, creating a document with simply this script isn’t going to make emoji appear on your site. You also need to actually insert some emoji! - -In the section, paste a few of the emoji strings you can find in Twitter’s [preview.html source code][6]. I used 🎹 and 🏁 without really knowing how they'd appear in the browser window. Yeah, you’ll have to just paste and guess. You can already see the problem we're going to fix in section two. - -However, through some trial and error, you can turn a raw HTML file that looks like this— - -![](http://a4.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODQyNTMzNTQ1OTk0.png) - -—into a webpage that looks something like this: - -![](http://a1.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODExNjYzNDU1NTA2.png) - -### Convert Emoji Into Readable Language ### - -Twitter’s solution is all well and good for making a site or app emoji compliant. But if you want to be able to easily insert your favorite emoji at will via HTML, you’re going to need an easier solution than memorizing all those Unicode strings. - -That’s where programmer Elle Kasai’s [Twemoji Awesome][7] styles come in. - -By adding Elle’s open-source stylesheet to any webpage, you can use English words to understand which emoji you’re inserting. So if you want a heart emoji to show up, you can simply type this : - - - -In order to do this, let’s download Elle’s project with the “Download ZIP” button on GitHub. - -Next, let’s make a new folder on the desktop. Inside this folder, we’ll put emoji.html—the raw HTML file I showed you before, and also Elle’s [twemoji-awesome.css][8]. - -We’ll need the HTML file to acknowledge the CSS file, so in the section of the html page you’ll want to add a link from the css file: - - - -Once you put this in, you can delete Twitter's script from before. Elle's styles each link to the Unicode string for the relevant emoji, so you no longer have to. - -Now, go down to the body section and add a few emoji. I used , , and . - -You'll end up with something like this: - -![](http://a2.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODcyMDYxNDU2MzU0.png) - -Save and view your creation in the browser: - -![](http://a1.files.readwrite.com/image/upload/c_fit,w_620/MTI1OTA2ODExOTMxODkwOTYy.png) - -Ta-da! Not only have you gotten a basic webpage to support emoji in the browser, you’ve also made it easy to do. Feel free to check out this tutorial on [my GitHub][9] for actual files you can clone instead of screenshots. - -Lead image via [Get Emoji][10]; screenshots by Lauren Orsini - --------------------------------------------------------------------------------- - -via: http://readwrite.com/2014/11/12/how-to-use-emoji-in-the-browser-window - -作者:[Lauren Orsini][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://readwrite.com/author/lauren-orsini -[1]:https://blog.twitter.com/2014/open-sourcing-twitter-emoji-for-everyone -[2]:http://www.unicode.org/reports/tr51/full-emoji-list.html -[3]:https://twitter.com/iconfactory -[4]:https://github.com/twitter/twemoji -[5]:http://www.unicode.org/reports/tr51/full-emoji-list.html -[6]:https://github.com/twitter/twemoji/blob/gh-pages/preview.html -[7]:http://ellekasai.github.io/twemoji-awesome/ -[8]:https://github.com/ellekasai/twemoji-awesome/blob/gh-pages/twemoji-awesome.css -[9]:https://github.com/laurenorsini/Emoji-Everywhere -[10]:http://getemoji.com/ diff --git a/sources/tech/20141203 Undelete Files on Linux Systems.md b/sources/tech/20141203 Undelete Files on Linux Systems.md deleted file mode 100644 index d0fa7f6a98..0000000000 --- a/sources/tech/20141203 Undelete Files on Linux Systems.md +++ /dev/null @@ -1,118 +0,0 @@ -Undelete Files on Linux Systems -================================================================================ -Often times, a computer user will delete a needed file accidentally and not have an easy way to regain or recreate the file. Thankfully, files can be undeleted. When a user deletes a file, it is not gone, only hidden for some time. Here is how it all works. On a filesystem, the system has what is called a file allocation list. This list keeps track of what files are where on the storage unit (hard-drive, MicroSD card, flash-drive, etc.). When a file is deleted, the filesystem will perform one of two tasks on the allocation table. The file's entry on the file allocation table marked as "free space" or the file's entry on the list is erased and then the space is marked as free. Now, if a file needs to be placed on the storage unit, the operating system will put the file in the space marked as empty. After the new file is written to the "empty space", the deleted file is now gone forever. When a deleted file is to be recovered, the user must not manipulate any files because if the "empty space" is used, then the file can never be retrieved. - -### How do undelete programs work? ### - -The majority of filesystems only mark the space as empty. With these filesystems, the undelete program looks at the file allocation list and copies the deleted file to another storage unit. If the files were copied to the same storage unit, then the user could lose other deleted files that are needed. - -Rarely do filesystems erase the allocation table entry. If a filesystem does, this is how an undelete program undeletes the file. The program searches the storage unit for file headers. All files have a specific string of code that is at the very beginning of the file. This is called a magic number. For example, the magic number of a compiled JAVA class is the hex number "CAFEBABE". So, an undelete program would find "CAFEBABE" and copy that file to another storage unit. Some undelete programs can look for a specific file type. The user may want a PDF, so the program searches for the hex magic number "25504446" which is the ASCII code for "%PDF". Other undelete programs search for all magic numbers. Then, the user can select which deleted files to recover. - -If a part of the file has been written over, then the whole file will be corrupted. The file can usually be recovered, but the contents will be useless. For instance, recovering a corrupted JPEG file will be pointless because the image viewer will not be able to generate an image from the file. So, the user has the file, but the file is useless. - -### Device Locations: ### - -Before we continue, here is some information that will aid in directing the undelete utilities to the correct storage unit. All devices are in the /dev/ folder. The name of each device (not the name that the admin gave each partition or device) that is given by the system follows a predictable scheme. The second partition on the first SATA hard-drive would be sda2. The first letter indicates the storage type, in this case SATA, but an "s" could also mean SCSI, FireWire, or USB. The second letter "d" means disk. The third letter indicates the device number, so an "a" would be the first SATA and a "b" would be the second. The number displays the partition. To name the whole device with all partitions type the letters without the number. For this example that would be sda. Other possible letters "h" as the first letter. This means PATA hard-drive (IDE). As some examples of this scheme, a user has a computer with one SATA hard-drive (sda). The drive has four partitions - sda1, sda2, sda3, and sda4. The user deletes the third one, but sda4 remains sda4 until sda4 is reformatted. The user then plugs in a usb memory card (sdb) with one partition - sdb1. The user then adds a IDE hard-drive with one partition - hda1. Next, the user adds a SCSI hard-drive - sdc1. Then, the user removes the USB memory card (sdb). Now, the SCSI remains sdc, but if the SCSI is removed and added back, it will be sdb. Even though other storage device existed, the IDE drive will have the "a" because it is the first IDE drive. IDE devices are numbered separately from SCSI, SATA, FireWire, and USB devices. - -### Recovery: ### - -Each undelete program has different abilities, features, and support for various filesystems. Below are some instructions for using TestDisk to recover files on a set of filesystems. - -**FAT16, FAT32, exFAT (FAT64), NTFS, and ext2/3/4:** - -TestDisk is an open-source, free program that works on Linux, *BSD, SunOS, Mac OS X, DOS, and Windows. TestDisk can be found here: [http://www.cgsecurity.org/wiki/TestDisk][1]. TestDisk can also be installed by typing "sudo apt-get install testdisk". TestDisk has many abilities, but this article is concerned with undeleting files. - -Open TestDisk in a terminal using root privileges by typing “sudo testdisk”. - -Now, the TestDisk command-line application will execute. The terminal appearance will change. TestDisk asks the user if it can keep logs. This is entirely up to the user. If the user is recovering files from the system storage, then do not keep a log. The choices are "Create", "Append", and "No Log". If the user wants a log, it is kept in that user's home folder. - -![](http://www.linux.org/attachments/screen1-jpg.342/) - -In the following screen, the storage devices are listed using the /dev/* method. For my system, the system's storage unit is /dev/sda. This means that my storage unit is a SATA hard-drive (sd) and it is the first hard-drive (a). The size of each storage unit is displayed in Gigabytes. Use the up and down arrows to select a storage device and hit enter. - -![](http://www.linux.org/attachments/screen2-jpg.343/) - -The next screen displays a list of partition table (also called partition map) types. Just as there is the file allocation table for files, there is a table for the partitions. Partitions are dividers on a storage device. For instance, on almost all Linux systems there is at least two partitions - EXT3/4 and Swap. Each partition table will be briefly described. TestDisk does not support all partition tables, so this is not a complete list. - -![](http://www.linux.org/attachments/screen3-jpg.344/) - -- **Intel** - This partition table is very common on Windows systems and many Linux systems. This table is also know as MBR. -- **EFI GPT** - This is usually used with Linux systems. This partition map is most recommended for Linux because the concept of logical/extended partitions does not apply to GPT (GUID Partition Table) tables. This means that a Linux user can multiboot many forms of Linux with one Linux OS on each partition. There are other advantages to using GPT, but that is beyond this article. -- **Humax** - Humax maps are used with device made by the South Korean company Humax. -- **Mac** - The Apple Partition Map (APM) is used by Apple devices. -- **None** - Some devices do not have a partition table. For instance, many Subor game consoles do not use a partition map. If a user tried to undelete a file on these devices thinking that the partition map was one of the other choices, the user will be confused by the fact that TestDisk does not find any filesystem or files. -- **Sun** - The Sun partition table is used by Sun systems. -- **Xbox** - The Xbox uses the Xbox partition map for its storage devices. - -If a user selects "Xbox" even though their system uses GPT, TestDisk will not be able to find a partition or filesystem. If it does, then it will guess incorrectly. (The image below displays the output when the incorrect partition type) - -![](http://www.linux.org/attachments/xbox-jpg.350/) - -Once the user picks the correct choice for their device, on the next screen, select "Advanced". - -![](http://www.linux.org/attachments/screen4-jpg.345/) - -Now, the user should see a list of all of their filesystems/partitions on the storage unit. If the user had chosen the wrong partition map, then here is where they will know if they made the incorrect selection. If there are no errors, highlight the partition that contains the deleted file by placing the text-based cursor on it. Use the left and right arrows to highlight "List" on the bottom of the terminal. Now, hit enter. - -![](http://www.linux.org/attachments/screen5-jpg.346/) - -A new screen is displayed with a list of files and folders. The whitish files are current files that are not deleted. The red files have been deleted. On the far right column is the files' names. The next column over to the left is the creation date of the file. One column over to the left again is the files' sizes in bytes. To the far left is a column with dashes, "d"s, "r"s, "w"s, and "x"s. These are the file permissions. A "d" indicates that the item is a directory. The rest of the permission syntax is irrelevant to this article. The item on the top of the file list titled "." means the current directory. The second object titled ".." means go up one directory, so a user can move up a directory by selecting this line. For an example, I will go into the directory "Xaiml_Dataset". The folder is nearly full of deleted files. I will undelete "computers.xaiml" by pressing "c" on the keyboard. I am now asked to select a destination directory. Of course, I will put it on another partition. I am in my home folder, and I press "c". It does not matter what folder is highlighted. The current folder is the destination directory. Now, I am back to the list of files. At the top of the screen is a message that says "Copy Done!". In my home folder is a folder called "Xaiml_Dataset", and inside is the Xaiml file. If I press "c" on more deleted files, they will be placed in the new folder without a****g me for a destination. - -![](http://www.linux.org/attachments/screen6-jpg.347/) - -![](http://www.linux.org/attachments/screen7-jpg.348/) - -![](http://www.linux.org/attachments/screen8-jpg.349/) - -When finished press "q" repeatedly until the normal terminal is seen. The folder "Xaiml_Dataset" can only be accessed by the root. To fix this, use root privileges to change the folder permissions and the contained files. After that, the files have been recovered and accessible to the user. - -### ReiserFS: ### - -To undelete a file from a ReiserFS filesystem, make a backup of all of the files on the partition because this method can cause the file to be lost if something goes wrong. Next, execute the following command where DEVICE is the device in the form sda2. Some files will be put in the lost+found directory and other will remain where they were before deletion. - - reiserfsck --rebuild-tree --scan-whole-partition /dev/DEVICE - -### Recover Deleted File that is Open in a Program: ### - -Assume a user accidentally deletes a file that a program has open. The file of the hard-drive was deleted, but the program is using a copy of the file that is on the RAM. Thankfully, there are two easy solutions. - -If the program has save capabilities like a text editor, the user can resave the file. Thus, the file editor will write the file to the hard-drive. - -Assume that this is an MP3 file in a music player. The music player cannot save the MP3 file. This task requires a little more time than the previous situation. Unfortunately, this method does not work on all systems and applications. To begin, type the following command. - - lsof -c smplayer | grep mp3 - -This command LiSts all of the Open Files used by Smplayer. This list is piped (given) to grep which searches for mp3. The output looks like the following. - - smplayer 10037 collier mp3 169r 8,1 676376 1704294 /usr/bin/smplayer - -Now, type the following command to recover the file directly from the RAM (on Linux systems, /proc/ is the RAM) and copy it to a folder of choice. The "cp" is the copy command. The 10037 number comes from the process number given in the output. The 169 is the file descriptor shown in the output. The "~/Music/" is the destination directory. Lastly, "music.mp3" is the file name that the user wants for the file. - - cp /proc/10037/fd/169 ~/Music/music.mp3 - -### Real Deletion: ### - -To make for sure that a file can never be recovered, use a command that "wipes" the hard-drive. Wiping the hard-drive means writing meaningless data to the disk. For example, many wiping programs write zeros, random letters, or random data to the hard-drive. No space is taken up or lost. The wiping program just overwrites the "empty space". If the storage unit is ever full of files with no free space remaining, then all of the previously deleted files will be gone. - -The purpose of wiping hard-drives is to make sure that private data is never seen. For illustration, a company may order new computers. The manager decides to sell the old computers. However, there is concern that the new owners may view company secrets or customer information like credit card numbers and addresses. Thankfully, a computer technician in the company can wipe the hard-drives before selling the old computers. - -To install secure-delete, a wiping program, type "sudo apt-get install secure-delete". This installs a set of four commands that make sure that deleted files are never recovered. - -- srm - permanently delete a file. Usage: srm -f ./secret_file.txt -- sfill - wipe the free space. Usage: sfill -f /mount/point/of/partition -- sswap - wipe swap space. Usage: sswap -f /dev/SWAP_DEVICE - -If computers were to truly delete a file selected for deletion, then more time would be required to perform the task. It is quick and easy to mark some space as free, but to make the file gone forever requires time. Wiping a storage unit, for instance, takes a few hours to complete (depending on storage size). Overall, the current system works well because even when a user empties the recycle bin, they still have another chance to change their mind. - --------------------------------------------------------------------------------- - -via: http://www.linux.org/threads/undelete-files-on-linux-systems.4316/ - -作者:[DevynCJohnson][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.linux.org/members/devyncjohnson.4843/ -[1]:http://www.cgsecurity.org/wiki/TestDisk \ No newline at end of file diff --git a/sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md b/sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md deleted file mode 100644 index e55c028ecd..0000000000 --- a/sources/tech/20141205 How to configure a syslog server with rsyslog on Linux.md +++ /dev/null @@ -1,156 +0,0 @@ -translating by coloka... - -How to configure a syslog server with rsyslog on Linux -================================================================================ -A syslog server represents a central log monitoring point on a network, to which all kinds of devices including Linux or Windows servers, routers, switches or any other hosts can send their logs over network. By setting up a syslog server, you can filter and consolidate logs from different hosts and devices into a single location, so that you can view and archive important log messages more easily. - -On most Linux distributions, **rsyslog** is the standard syslog daemon that comes pre-installed. Configured in a client/server architecture, **rsyslog** can play both roles; as a syslog server **rsyslog** can gather logs from other devices, and as a syslog client, **rsyslog** can transmit its internal logs to a remote syslog server. - -In this tutorial, we cover how to configure a centralized syslog server using **rsyslog** on Linux. Before we go into the details, it is instructive to go over syslog standard first. - -### Basic of Syslog Standard ### - -When logs are collected with syslog mechanism, three important things must be taken into consideration: - -- **Facility level**: what type of processes to monitor -- **Severity (priority) level**: what type of log messages to collect -- **Destination**: where to send or record log messages - -Let's take a look at how the configuration is defined in more detail. - -The facility levels define a way to categorize internal system processes. Some of the common standard facilities in Linux are: - -- **auth**: messages related to authentication (login) -- **cron**: messages related to scheduled processes or applications -- **daemon**: messages related to daemons (internal servers) -- **kernel**: messages related to the kernel -- **mail**: messages related to internal mail servers -- **syslog**: messages related to the syslog daemon itself -- **lpr**: messages related to print servers -- **local0 - local7**: messages defined by user (local7 is usually used by Cisco and Windows servers) - -The severity (priority) levels are standardized, and defined by using standard abbreviation and an assigned number with number 7 being the highest level of all. These levels are: - -- emerg: Emergency - 0 -- alert: Alerts - 1 -- crit: Critical - 2 -- err: Errors - 3 -- warn: Warnings - 4 -- notice: Notification - 5 -- info: Information - 6 -- debug: Debugging - 7 - -Finally, the destination statement enforces a syslog client to perform one of three following tasks: (1) save log messages on a local file, (2) route them to a remote syslog server over TCP/UDP, or (3) send them to stdout such as a console. - -In rsyslog, syslog configuration is structured based on the following schema. - - [facility-level].[severity-level] [destination] - -### Configure Rsyslog on Linux ### - -Now that we understand syslog, it's time to configure a Linux server as a central syslog server using rsyslog. We will also see how to configure a Windows based system as a syslog client to send internal logs to the syslog server. - -#### Step One: Initial System Requirements #### - -To set up a Linux host as a central log server, we need to create a separate /var partition, and allocate a large enough disk size or create a LVM special volume group. That way, the syslog server will be able to sustain the exponential growth of collected logs over time. - -#### Step Two: Enable Rsyslog Daemon #### - -rsyslog daemon comes pre-installed on modern Linux distributions, but is not enabled by default. To enable rsyslog daemon to receive external messages, edit its configuration file located in /etc/rsyslog.conf. - -Once the file is opened for editing, search and uncomment the below two lines by removing the # sign from the beginning of lines. - - $ModLoad imudp - $UDPServerRun 514 - -This will enable rsyslog daemon to receive log messages on UDP port 514. UDP is way faster than TCP, but does not provide reliability on data flow the same way as TCP does. If you need to reliable delivery, you can enable TCP by uncommenting the following lines. - - $ModLoad imtcp - $InputTCPServerRun 514 - -Note that both TCP and UDP can be set on the server simultaneously to listen on TCP/UDP connections. - -#### Step Three: Create a Template for Log Receipt #### - -In the next step we need to create a template for remote messages, and tell rsyslog daemon how to record messages received from other client machines. - -Open /etc/rsyslog.conf with a text editor, and append the following template before the GLOBAL DIRECTIVES block: - - $template RemoteLogs,"/var/log/%HOSTNAME%/%PROGRAMNAME%.log" * - *.* ?RemoteLogs - & ~ - -This template needs a little explanation. The $template RemoteLogs directive ("RemoteLogs" string can be changed to any other descriptive name) forces rsyslog daemon to write log messages to separate local log files in /var/log/, where log file names are defined based on the hostname of the remote sending machine as well as the remote application that generated the logs. The second line ("*.* ?RemoteLogs") implies that we apply RemoteLogs template to all received logs. - -The "& ~" sign represents a redirect rule, and is used to tell rsyslog daemon to stop processing log messages further, and not write them locally. If this redirection is not used, all the remote messages would be also written on local log files besides the log files described above, which means they would practically be written twice. Another consequence of using this rule is that the syslog server's own log messages would only be written to dedicated files named after machine's hostname. - -If you want, you can direct log messages with a specific facility or severity level to this new template using the following schema. - - [facility-level].[severity-level] ?RemoteLogs - -For example: - -Direct all internal authentication messages of all priority levels to RemoteLogs template: - - authpriv.* ?RemoteLogs - -Direct informational messages generated by all system processes, except mail, authentication and cron messages to RemoteLogs template: - - *.info,mail.none,authpriv.none,cron.none ?RemoteLogs - -If we want all received messages from remote clients written to a single file named after their IP address, you can use the following template. We assign a new name "IpTemplate" to this template. - - $template IpTemplate,"/var/log/%FROMHOST-IP%.log" - *.* ?IpTemplate - & ~ - -After we have enabled rsyslog daemon and edited its configuration file, we need to restart the daemon. - -On Debian, Ubuntu or CentOS/RHEL 6: - - $ sudo service rsyslog restart - -On Fedora or CentOS/RHEL 7: - - $ sudo systemctl restart rsyslog - -We can verify that rsyslog daemon is functional by using netstat command. - - $ sudo netstat -tulpn | grep rsyslog - -The output should look like the following in case rsyslog daemon listens on UDP port. - - udp 0 0 0.0.0.0:514 0.0.0.0:* 551/rsyslogd - udp6 0 0 :::514 :::* 551/rsyslogd - -If rsyslog daemon is set up to listen on TCP connections, the output should look like this. - - tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN 1891/rsyslogd - tcp6 0 0 :::514 :::* LISTEN 1891/rsyslogd - -#### Send Windows Logs to a Remote Rsyslog Server #### - -To forward a Windows based client's log messages to our rsyslog server, we need a Windows syslog agent. While there are a multitude of syslog agents that can run on Windows, we can use [Datagram SyslogAgent][1], which is a freeware program. - -After downloading and installing the syslog agent, we need to configure it to run as a service. Specify the protocol though which it will send data, the IP address and port of a remote rsyslog server, and what type of event logs should be transmitted as follows. - -![](https://farm8.staticflickr.com/7509/15305930594_27b7f4440a_o.jpg) - -After we have set up all the configurations, we can start the service and watch the log files on the central rsyslog server using tailf command line utility. - -### Conclusion ### - -By creating a central rsyslog server that can collect log files of local or remote hosts, we can get a better idea on what is going on internally in their systems, and can debug their problems more easily should any of them become unresponsive or crash. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/configure-syslog-server-linux.html - -作者:[Caezsar M][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/caezsar -[1]:http://www.syslogserver.com/download.html \ No newline at end of file diff --git a/sources/tech/20141219 What is good audio editing software on Linux.md b/sources/tech/20141219 What is good audio editing software on Linux.md index d9228b4eda..ccc6a0883b 100644 --- a/sources/tech/20141219 What is good audio editing software on Linux.md +++ b/sources/tech/20141219 What is good audio editing software on Linux.md @@ -1,8 +1,7 @@ -Translating by ly0 - -Linux下一些蛮不错的音频编辑软件 +What is good audio editing software on Linux ================================================================================ -无论你是一个业余的音乐家或者仅仅是一个上课撸教授音的学,你总是需要和录音打交道。如果你有很长的时间仅仅用Mac干这种事情,那么可以和这个过程说拜拜了,现在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 ### diff --git a/sources/tech/20141226 Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM.md b/sources/tech/20141226 Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM.md deleted file mode 100644 index 651952ec1d..0000000000 --- a/sources/tech/20141226 Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM.md +++ /dev/null @@ -1,265 +0,0 @@ -Real-World WordPress Benchmarks with PHP5.5 PHP5.6 PHP-NG and HHVM -================================================================================ -**TL;DR In a local, Vagrant-based environment HHVM lost, probably due to a bug; it’s still investigated with the help of the HHVM guys! However on a DigitalOcean 4GB box it beat even the latest build of PHP-NG!** - -![](https://kinsta.com/wp-content/uploads/2014/07/phphhvm.jpg) - -**Update: Please take a look at the results at the end of the article! They reflect the power of HHVM better (after the JIT warmup), for some reason we cannot get these results with all setups though. - -The tests below were done in a Vagrant/VVV environment, the results are still interesting, it might be a bug in HHVM or the Vagrant setup that’s preventing it from kicking into high speed, we’re investigating the issue with the HHVM guys.** - -If you remember we [wrote an article a good couple of months ago][1] when WordPress 3.9 came out that HHVM was fully supported beginning with that release, and we were all happy about it. The initial benchmark results showed HHVM to be far more superior than the Zend engine that’s currently powering all PHP builds. Then the problems came: - -- HHVM can only be run as one user, which means less security (in shared environments) -- HHVM does not restart itself after it crashes, and unfortunately it still does that quite often -- HHVM uses a lot of memory right from the start, and yes, it per-request memory usage will be lower once you scale compared to PHP-FPM - -Obviously you have to compromise based on your (or rather your sites’) needs but is it worth it? How much of a performance gain can you expect by switching to HHVM? - -At Kinsta we really like to test everything new and generally optimize everything to provide the best environment to our clients. Today I finally took the time to set up a test environment and do some tests to compare a couple of different builds with a fresh out of the box WordPress install and one that has a bunch of content added plus runs WooCommerce! To measure the script running time I simply added the - - - -line before the /body tag of the footer.php’s. - -**Note: -Previously this section contained benchmarks made with Vagrant/Virtualbox/Ubuntu14.04 however for some reason HHVM was really underperforming, probably due to a bug or a limitation of the virtualized environment. We feel that these test results do not reflect the reality so we re-run the tests on a cloud server and consider these valid.** - -Here are the exact setup details of the environment: - -- DigitalOcean 4GB droplet (2 CPU cores, 4GB RAM) -- Ubuntu 14.04, MariaDB10 -- Test site: Munditia Theme with Demo Content Imported, WooCommerce 2.1.12 & WordPress 3.9.1 -- PHP 5.5.9, PHP 5.5.15, PHP 5.6.0 RC2, PHP-NG (20140718-git-6cc487d) and HHVM 3.2.0 (version says PHP 5.6.99-hhvm) - -**Without further ado, these were my test results, the lower the better, values in seconds:** - -### DigitalOcean 4GB droplet ### - -Seconds, 10 runs, lower the better. - -这里有一个canvas的数据,发布的时候需要截一个图 - -It looks like that PHP-NG achieves its peak performance after the first run! HHVM needs a couple more reloads, but their performance seems to be almost equal! I can’t wait until PHP-NG is merged into the master! :) - -Hits in a minute, higher the better. - -这里有一个canvas的数据,发布的时候需要截一个图 - -**PHP 5.5.15 OpCache Disabled** - -- Transactions: **236 hits** -- Availability: 100.00 % -- Elapsed time: 59.03 secs -- Data transferred: 2.40 MB -- Response time: 2.47 secs -- Transaction rate: 4.00 trans/sec -- Throughput: 0.04 MB/sec -- Concurrency: 9.87 -- Successful transactions: 236 -- Failed transactions: 0 -- Longest transaction: 4.44 -- Shortest transaction: 0.48 - -**PHP 5.5.15 OpCache Enabled** - -- Transactions: **441 hits** -- Availability: 100.00 % -- Elapsed time: 59.55 secs -- Data transferred: 4.48 MB -- Response time: 1.34 secs -- Transaction rate: 7.41 trans/sec -- Throughput: 0.08 MB/sec -- Concurrency: 9.91 -- Successful transactions: 441 -- Failed transactions: 0 -- Longest transaction: 2.19 -- Shortest transaction: 0.64 - -**PHP 5.6 RC2 OpCache Disabled** - -- Transactions: **207 hits** -- Availability: 100.00 % -- Elapsed time: 59.87 secs -- Data transferred: 2.10 MB -- Response time: 2.80 secs -- Transaction rate: 3.46 trans/sec -- Throughput: 0.04 MB/sec -- Concurrency: 9.68 -- Successful transactions: 207 -- Failed transactions: 0 -- Longest transaction: 3.65 -- Shortest transaction: 0.54 - -**PHP 5.6 RC2 OpCache Enabled** - -- Transactions: **412 hits** -- Availability: 100.00 % -- Elapsed time: 59.03 secs -- Data transferred: 4.18 MB -- Response time: 1.42 secs -- Transaction rate: 6.98 trans/sec -- Throughput: 0.07 MB/sec -- Concurrency: 9.88 -- Successful transactions: 412 -- Failed transactions: 0 -- Longest transaction: 1.93 -- Shortest transaction: 0.34 - -**HHVM 3.2.0 (version says PHP 5.6.99-hhvm)** - -- Transactions: **955 hits** -- Availability: 100.00 % -- Elapsed time: 59.69 secs -- Data transferred: 9.18 MB -- Response time: 0.62 secs -- Transaction rate: 16.00 trans/sec -- Throughput: 0.15 MB/sec -- Concurrency: 9.94 -- Successful transactions: 955 -- Failed transactions: 0 -- Longest transaction: 0.85 -- Shortest transaction: 0.23 - -**PHP-NG OpCache Enabled (built: Jul 29 2014 )** - -- Transactions: **849 hits** -- Availability: 100.00 % -- Elapsed time: 59.88 secs -- Data transferred: 8.63 MB -- Response time: 0.70 secs -- Transaction rate: 14.18 trans/sec -- Throughput: 0.14 MB/sec -- Concurrency: 9.94 -- Successful transactions: 849 -- Failed transactions: 0 -- Longest transaction: 1.06 -- Shortest transaction: 0.13 - ----------- - -**Note: -These are the previous test results, they’re faulty. I left them here for future reference but please do NOT consider these values a truthful representation!** - -Here are the exact setup details of the environment: - -- Apple MacBook Pro mid-2011 (Intel Core i7 2 GHz 4 cores, 4GB RAM, 256GB Ocz Vertex 3 MI) -- Current Varying Vagrant Vagrants build with Ubuntu 14.04, nginx 1.6.x, mysql 5.5.x, etc. -- Test site 1: WordPress 3.9.1 bare minimum -- Test site 2: Munditia Theme with Demo Content Imported, WooCommerce 2.1.12 & WordPress 3.9.1 -- PHP 5.5.9, PHP 5.5.15, PHP 5.6.0 RC2, PHP-NG (20140718-git-6cc487d) and HHVM 3.2.0 (version says PHP 5.6.99-hhvm) - -**Default Theme, Default WordPress 3.9.1, PHP 5.5.9-1ubuntu4.3 (with OpCache 7.0.3)** - -**Faulty results. Please read the note above!** Seconds, 10 runs, lower the better. - -这里有一个canvas的数据,发布的时候需要截一个图 - -### Munditia Theme with Demo Content Imported, WooCommerce 2.1.12 & WordPress 3.9.1 (OpCache Disabled) ### - -**Faulty results. Please read the note above**! Seconds, 10 runs, lower the better. - -这里有一个canvas的数据,发布的时候需要截一个图 - -### Munditia Theme with Demo Content Imported, WooCommerce 2.1.12 & WordPress 3.9.1 (OpCache Enabled) ### - -**Faulty results. Please read the note above!** Seconds, 10 runs, lower the better. - -这里有一个canvas的数据,发布的时候需要截一个图 - -**Siege -parameters: 10 concurrent users for 1 minute: siege -c 10 -b -t 1M** - -**Faulty results. Please read the note above!** Hits in a minute, higher the better. - -这里有一个canvas的数据,发布的时候需要截一个图 - -**PHP5.5 OpCache Disabled (PHP 5.5.15-1+deb.sury.org~trusty+1)Faulty results. Please read the note above!** - -- Transactions: 35 hits -- Availability: 100.00 % -- Elapsed time: 59.04 secs -- Data transferred: 2.03 MB -- Response time: 14.56 secs -- Transaction rate: 0.59 trans/sec -- Throughput: 0.03 MB/sec -- Concurrency: 8.63 -- Successful transactions: 35 -- Failed transactions: 0 -- Longest transaction: 18.73 -- Shortest transaction: 5.80 - -**HHVM 3.2.0 (version says PHP 5.6.99-hhvm)Faulty results. Please read the note above!** - -- Transactions: 44 hits -- Availability: 100.00 % -- Elapsed time: 59.53 secs -- Data transferred: 0.42 MB -- Response time: 12.00 secs -- Transaction rate: 0.74 trans/sec -- Throughput: 0.01 MB/sec -- Concurrency: 8.87 -- Successful transactions: 44 -- Failed transactions: 0 -- Longest transaction: 13.40 -- Shortest transaction: 2.65 - -**PHP5.5 OpCache Enabled (PHP 5.5.15-1+deb.sury.org~trusty+1 with OpCache 7.0.4-dev)Faulty results. Please read the note above!** - -- Transactions: 100 hits -- Availability: 100.00 % -- Elapsed time: 59.30 secs -- Data transferred: 5.81 MB -- Response time: 5.69 secs -- Transaction rate: 1.69 trans/sec -- Throughput: 0.10 MB/sec -- Concurrency: 9.60 -- Successful transactions: 100 -- Failed transactions: 0 -- Longest transaction: 7.25 -- Shortest transaction: 2.82 - -**PHP5.6 OpCache Enabled (PHP 5.6.0RC2 with OpCache 7.0.4-dev)Faulty results. Please read the note above!** - -- Transactions: 103 hits -- Availability: 100.00 % -- Elapsed time: 59.99 secs -- Data transferred: 5.98 MB -- Response time: 5.51 secs -- Transaction rate: 1.72 trans/sec -- Throughput: 0.10 MB/sec -- Concurrency: 9.45 -- Successful transactions: 103 -- Failed transactions: 0 -- Longest transaction: 6.87 -- Shortest transaction: 2.52 - -**PHP-NG OpCache Enabled (20140718-git-6cc487d)Faulty results. Please read the note above!** - -- Transactions: 124 hits -- Availability: 100.00 % -- Elapsed time: 59.32 secs -- Data transferred: 7.19 MB -- Response time: 4.58 secs -- Transaction rate: 2.09 trans/sec -- Throughput: 0.12 MB/sec -- Concurrency: 9.57 -- Successful transactions: 124 -- Failed transactions: 0 -- Longest transaction: 6.86 -- Shortest transaction: 2.24 - -**What do you think about this test? Did I miss something? What would you like to see in the next benchmarking article? Please leave your comment below!** - --------------------------------------------------------------------------------- - -via: https://kinsta.com/blog/real-world-wordpress-benchmarks-with-php5-5-php5-6-php-ng-and-hhvm/ - -作者:[Mark Gavalda][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://kinsta.com/blog/author/kinstadmin/ -[1]:https://kinsta.com/blog/hhvm-and-wordpress/ \ No newline at end of file diff --git a/sources/tech/20141229 4 Steps to Setup Local Repository in Ubuntu using APT-mirror.md b/sources/tech/20141229 4 Steps to Setup Local Repository in Ubuntu using APT-mirror.md deleted file mode 100644 index 121f496d6a..0000000000 --- a/sources/tech/20141229 4 Steps to Setup Local Repository in Ubuntu using APT-mirror.md +++ /dev/null @@ -1,126 +0,0 @@ -ideas4u is translating! -4 Steps to Setup Local Repository in Ubuntu using APT-mirror -================================================================================ -Today we will show you how to setup a local repository in your Ubuntu PC or Ubuntu Server straight from the official Ubuntu repository. There are a lot benefit of creating a local repository in your computer if you have a lot of computers to install software, security updates and fixes often in all systems, then having a local Ubuntu repository is an efficient way. Because all required packages are downloaded over the fast LAN connection from your local server, so that it will save your Internet bandwidth and reduces the annual cost of Internet.. - -You can setup a local repository of Ubuntu in your local PC or server using many tools, but we'll featuring about APT-Mirror in this tutorial. Here, we'll be mirroring packages from the default mirror to our Local Server or PC and we'll need at least **120 GB** or more free space in your local or external hard drive. It can be configured through a **HTTP** or **FTP** server to share its software packages with local system clients. - -We'll need to install Apache Web Server and APT-Mirror to get our stuffs working out of the box. Here are the steps below to configure a working local repository: - -### 1. Installing Required Packages ### - -First of all, we are going to pull whole packages from the public repository of Ubuntu package server and save them in our local Ubuntu server hard disk. - -We'll first install a web server to host our local repository. We'll install Apache web server but you can install any web server you wish, web server are necessary for the http protocol. You can additionally install FTP servers like proftpd, vsftpd,etc if you need to configure for ftp protocols and Rsync for rsync protocols. - - $ sudo apt-get install apache2 - -And then we'll need to install apt-mirror: - - $ sudo apt-get install apt-mirror - -![apt-mirror-installation](http://blog.linoxide.com/wp-content/uploads/2014/12/apt-mirror-install.png) - -**Note: As I have already mentioned that we'll need at least 120 GBs free space to get all the packages mirrored or download.** - -### 2. Configuring APT-Mirror ### - -Now create a directory on your harddisk to save all packages. For example, let us create a directory called “/linoxide”. We are going to save all packages in this directory: - - $ sudo mkdir /linoxide - -![repo-dir](http://blog.linoxide.com/wp-content/uploads/2014/12/mkdir-linoxide.png) - -Now, open the file **/etc/apt/mirror.list** file - - $ sudo nano /etc/apt/mirror.list - -![apt-mirror-edit](http://blog.linoxide.com/wp-content/uploads/2014/12/edit-mirror-list-300x7.png) - -Copy the below lines of configuration to mirror.list and edit as your requirements. - - ############# config ################## - # - set base_path /linoxide - # - # set mirror_path $base_path/mirror - # set skel_path $base_path/skel - # set var_path $base_path/var - # set cleanscript $var_path/clean.sh - # set defaultarch - # set postmirror_script $var_path/postmirror.sh - # set run_postmirror 0 - set nthreads 20 - set _tilde 0 - # - ############# end config ############## - - deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse - deb http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse - deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse - #deb http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse - #deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse - - deb-src http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse - deb-src http://archive.ubuntu.com/ubuntu trusty-security main restricted universe multiverse - deb-src http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse - #deb-src http://archive.ubuntu.com/ubuntu trusty-proposed main restricted universe multiverse - #deb-src http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse - - clean http://archive.ubuntu.com/ubuntu - -![mirror-list-config](http://blog.linoxide.com/wp-content/uploads/2014/12/mirror-list-config.png) - -**Note: You can replace the above official mirror server url by the nearest one, you can get your nearest server by visiting the page [Ubuntu Mirror Server][1]. If you are not in hurry and can wait for the mirroring, you can go with the default official one.** - -Here, we are going to mirror package repository of the latest and greatest LTS release of Ubuntu ie. Ubuntu 14.04 LTS (Trusty Tahr) so, we have configured trusty. If you need to mirror of Saucy or other version of Ubuntu, please edit it as its codename. - -Now, we'll have to run apt-mirror which will now get/mirror all the packages in the repository. - - sudo apt-mirror - -It will take time to download all the packages from the Ubuntu Server which depends upon the connection speed and performance with respect to you and the mirror server. I have interrupted the download as I have already done that... - -![downloading-packages](http://blog.linoxide.com/wp-content/uploads/2014/12/downloading-index.png) - -### 3.Configuring Web Server ### - -To be able to access the repo from other computers you need a webserver. You can also do it via ftp but I choose to use a webserver as I mentioned in above step 1. So, we are now gonna configure Apache Server: - -We will create a symlink from our local repo's directory to a directory ubuntu in the hosting directory of Apache ie /var/www/ubuntu - - $ sudo ln -s /linoxide /var/www/ubuntu - $ sudo service apache2 start - -![symlinks-apache2](http://blog.linoxide.com/wp-content/uploads/2014/12/symblink-apache2.png) - -The above command will allow us to browse our Mirrored Repo from our localhost ie http://127.0.0.1 by default. - -### 4. Configuring Client Side ### - -Finally, we need to add repository source in other computers which will fetch the packages and repository from our computer. To do that, we'll need to edit /etc/apt/sources.list and add the following lines. - - $ sudo nano /etc/apt/sources.list - -Add this line in /etc/apt/sources.list and save. - - deb http://192.168.0.100/ubuntu/ trusty main restricted universe - -**Note: here 192.168.0.100 is the LAN IP address of our server computer, you need to replace that with yours.** - - $ sudo apt-get update - -Finally, we are done. Now you can install the required packages using sudo apt-get install packagename from your local Ubuntu repository with high speed download and with low bandwidth. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/ubuntu-how-to/setup-local-repository-ubuntu/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:https://launchpad.net/ubuntu/+archivemirrors diff --git a/sources/tech/20150104 How to set up a cross-platform backup server on Linux with BackupPC.md b/sources/tech/20150104 How to set up a cross-platform backup server on Linux with BackupPC.md deleted file mode 100644 index 48df08fa3b..0000000000 --- a/sources/tech/20150104 How to set up a cross-platform backup server on Linux with BackupPC.md +++ /dev/null @@ -1,134 +0,0 @@ -How to set up a cross-platform backup server on Linux with BackupPC -================================================================================ -Just in case you haven't been able to tell from my earlier posts on [backupninja][1] and [backup-manager][2], I am a big backup fan. When it comes to backup, I'd rather have too much than not enough, because if the need arises, you will be grateful that you took the time and effort to generate extra copies of your important data. - -In this post, I will introduce you to [BackupPC][3], a cross-platform backup server software which can perform pull backup of Linux, Windows and MacOS client hosts over network. BackupPC adds a number of features that make managing backups an almost fun thing to do. - -### Features of BackupPC ### - -BackupPC comes with a robust web interface that allows you to collect and manage backups of other remote client hosts in a centralized fashion. Using the web interface, you can examine logs and configuration files, start/cancel/schedule backups of other remote hosts, and visualize current status of backup tasks. You can also browse through archived files and restore individual files or entire jobs from backup archives very easily. To restore individual single files, you can download them from any previous backup directly from the web interface. As if this weren't enough, no special client-side software is needed for client hosts. On Windows clients, the native SMB protocol is used, whereas on *nix clients, you will use `rsync` or tar over SSH, RSH or NFS. - -### Installing BackupPC ### - -On Debian, Ubuntu and their derivatives, run the following command. - - # aptitude install backuppc - -On Fedora, use `yum` command. Note the case sensitive package name. - -On CentOS/RHEL 6, first enable [EPEL repository][4]. On CentOS/RHEL 7, enable [Nux Dextop][5] repository instead. Then go ahead with `yum` command: - - # yum install BackupPC - -As usual, both package management systems will take care of dependency resolution automatically. In addition, as part of the installation process, you may be asked to configure, or reconfigure the web server that will be used for the graphical user interface. The following screenshot is from a Debian system: - -![](https://farm8.staticflickr.com/7573/16163781711_6218b620ef_c.jpg) - -Select your choice by pressing the space bar, and then move to Ok with the tab key and hit ENTER. - -You will then be presented with the following screen informing you that an administrative user account 'backuppc', along with its corresponding password (which can be changed later if desired), has been created to manage BackupPC. Note that both a HTTP user account and a regular Linux account of the same name 'backuppc' will be created with an identical password. The former is needed to access BackupPC's protected web interface, while the latter is needed to perform backup using rsync over SSH. - -![](https://farm8.staticflickr.com/7579/15979622809_25e734658d_c.jpg) - -You can change the default password for the HTTP user 'backuppc' with the following command: - - # htpasswd /path/to/hash/file backuppc - -As for a regular 'backuppc' [Linux][6] user account, use passwd command to change its default password. - - # passwd backuppc - -Note that the installation process creates the web and the program's configuration files automatically. - -### Launching BackupPC and Configuring Backups ### - -To start, open a browser window and point to http:///backuppc/. When prompted, enter the default HTTP user credentials that were supplied to you earlier. If the authentication succeeds, you will be taken to the main page of the web interface. - -![](https://farm9.staticflickr.com/8601/15543330314_f6fdaa235e_z.jpg) - -Most likely the first thing that you will want to do is add a new client host to back up. Go to "Edit Hosts" in the Task pane. We will add two client hosts: - -- Host #1: CentOS 7 [IP 192.168.0.17] -- Host #2: Windows 7 [IP 192.168.0.103] - -We will back up the CentOS host using rsync over SSH and the Windows host using SMB. Prior to performing the backup, we need to set up [key-based authentication][7] to our CentOS host and a shared folder in our Windows machine. - -Here are the instructions for setting up key-based authentication for a remote CentOS host. We create the 'backuppc' user's RSA key pair, and transfer its public key to the root account of the CentOS host. - - # usermod -s /bin/bash backuppc - # su - backuppc - # ssh-keygen -t rsa - # ssh-copy-id root@192.168.0.17 - -When prompted, type yes and enter root's password for 192.168.0.17. - -![](https://farm8.staticflickr.com/7496/16164929932_8fc817125d_b.jpg) - -You will need root access for a remote CentOS host to grant write access to all its file system in case of restoring a backup of files or directories owned by root. - -Once the CentOS and Windows hosts are ready, add them to BackupPC using the web interface: - -![](https://farm9.staticflickr.com/8586/15979622709_76c2dcf68c_z.jpg) - -The next step consists of modifying each host's backup settings: - -![](https://farm8.staticflickr.com/7461/16163781611_765c147f9f_z.jpg) - -The following image shows the configuration for the backup of the Windows machine: - -![](https://farm8.staticflickr.com/7480/16139884676_bddfafed75_z.jpg) - -And the following screenshot shows the settings for the backup of the CentOS box: - -![](https://farm8.staticflickr.com/7557/16139884666_34ff8fd858_z.jpg) - -### Starting a Backup ### - -To start each backup, go to each host's settings, and then click "Start Full Backup": - -![](https://farm8.staticflickr.com/7536/15978247428_458c023f4c.jpg) - -At any time, you can view the status of the process by clicking on the host's home as shown in the image above. If it fails for some reason, a link to a page with the error message(s) will appear in the host menu as well. When a backup completes successfully, a directory with the host's name or IP address is created under /var/lib/backuppc/pc in the server: - -![](https://farm8.staticflickr.com/7549/16165680115_196ee42a49_z.jpg) - -Feel free to browse those directories for the files from the command line, but there is an easier way to look for those files and restore them. - -### Restoring Backup ### - -To view the files that have been saved, go to "Browse backups" under each host's main menu. You can visualize the directories and files at a glance, and select those that you want to restore. Alternatively, you can click on files to open them with the default program, or right click and choose Save link as to download it to the machine where you're working at the time: - -![](https://farm8.staticflickr.com/7506/16165680105_bd5883e0da_c.jpg) - -If you want, you can download a zip or tar file containing the backup's contents: - -![](https://farm8.staticflickr.com/7507/15978247398_18e81667cd_z.jpg) - -or just restore the file(s): - -![](https://farm8.staticflickr.com/7545/15545911003_2aca8a36fc_z.jpg) - -### Conclusion ### - -There is a saying that goes, "the simpler, the better", and that is just what BackupPC has to offer. In BackupPC, you will not only find a backup tool but also a very versatile interface to manage your backups of several operating systems without needing any client-side application. I believe that's more than reason enough for you to give it at least a try. - -Feel free to leave your comments and questions, if you have any, using the form below. I am always happy to hear what readers have to say! - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/backuppc-cross-platform-backup-server-linux.html - -作者:[Gabriel Cánepa][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/gabriel -[1]:http://xmodulo.com/backup-debian-system-backupninja.html -[2]:http://xmodulo.com/linux-backup-manager.html -[3]:http://backuppc.sourceforge.net/ -[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html -[5]:http://ask.xmodulo.com/enable-nux-dextop-repository-centos-rhel.html -[6]:http://xmodulo.com/recommend/linuxguide -[7]:http://xmodulo.com/how-to-enable-ssh-login-without.html \ No newline at end of file diff --git a/sources/tech/20150108 Interface (NICs) Bonding in Linux using nmcli.md b/sources/tech/20150108 Interface (NICs) Bonding in Linux using nmcli.md deleted file mode 100644 index fa02f19ce6..0000000000 --- a/sources/tech/20150108 Interface (NICs) Bonding in Linux using nmcli.md +++ /dev/null @@ -1,136 +0,0 @@ -Interface (NICs) Bonding in Linux using nmcli -================================================================================ -Today, we'll learn how to perform Interface (NICs) bonding in our CentOS 7.x using nmcli (Network Manager Command Line Interface). - -NICs (Interfaces) bonding is a method for linking **NICs** together logically to allow fail-over or higher throughput. One of the ways to increase the network availability of a server is by using multiple network interfaces. The Linux bonding driver provides a method for aggregating multiple network interfaces into a single logical bonded interface. It is a new implementation that does not affect the older bonding driver in linux kernel; it offers an alternate implementation. - -**NIC bonding is done to provide two main benefits for us:** - -1. **High bandwidth** -1. **Redundancy/resilience** - -Now lets configure NICs bonding in CentOS 7. We'll need to decide which interfaces that we would like to configure a Team interface. - -run **ip link** command to check the available interface in the system. - - $ ip link - -![ip link](http://blog.linoxide.com/wp-content/uploads/2015/01/ip-link.png) - -Here we are using **eno16777736** and **eno33554960** NICs to create a team interface in **activebackup** mode. - -Use **nmcli** command to create a connection for the network team interface,with the following syntax. - - # nmcli con add type team con-name CNAME ifname INAME [config JSON] - -Where **CNAME** will be the name used to refer the connection ,**INAME** will be the interface name and **JSON** (JavaScript Object Notation) specifies the runner to be used.**JSON** has the following syntax: - - '{"runner":{"name":"METHOD"}}' - -where **METHOD** is one of the following: **broadcast, activebackup, roundrobin, loadbalance** or **lacp**. - -### 1. Creating Team Interface ### - -Now let us create the team interface. here is the command we used to create the team interface. - - # nmcli con add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}' - -![nmcli con create](http://blog.linoxide.com/wp-content/uploads/2015/01/nmcli-con-create.png) - -run **# nmcli con show** command to verify the team configuration. - - # nmcli con show - -![Show Teamed Interace](http://blog.linoxide.com/wp-content/uploads/2015/01/show-team-interface.png) - -### 2. Adding Slave Devices ### - -Now lets add the slave devices to the master team0. here is the syntax for adding the slave devices. - - # nmcli con add type team-slave con-name CNAME ifname INAME master TEAM - -Here we are adding **eno16777736** and **eno33554960** as slave devices for **team0** interface. - - # nmcli con add type team-slave con-name team0-port1 ifname eno16777736 master team0 - - # nmcli con add type team-slave con-name team0-port2 ifname eno33554960 master team0 - -![adding slave devices to team](http://blog.linoxide.com/wp-content/uploads/2015/01/adding-to-team.png) - -Verify the connection configuration using **#nmcli con show** again. now we could see the slave configuration. - - #nmcli con show - -![show slave config](http://blog.linoxide.com/wp-content/uploads/2015/01/show-slave-config.png) - -### 3. Assigning IP Address ### - -All the above command will create the required configuration files under **/etc/sysconfig/network-scripts/**. - -Lets assign an IP address to this team0 interface and enable the connection now. Here is the command to perform the IP assignment. - - # nmcli con mod team0 ipv4.addresses "192.168.1.24/24 192.168.1.1" - # nmcli con mod team0 ipv4.method manual - # nmcli con up team0 - -![ip assignment](http://blog.linoxide.com/wp-content/uploads/2015/01/ip-assignment.png) - -### 4. Verifying the Bonding ### - -Verify the IP address information in **#ip add show team0** command. - - #ip add show team0 - -![verfiy ip address](http://blog.linoxide.com/wp-content/uploads/2015/01/verfiy-ip-adress.png) - -Now lets check the **activebackup** configuration functionality using the **teamdctl** command. - - # teamdctl team0 state - -![teamdctl active backup check](http://blog.linoxide.com/wp-content/uploads/2015/01/teamdctl-activebackup-check.png) - -Now lets disconnect the active port and check the state again. to confirm whether the active backup configuration is working as expected. - - # nmcli dev dis eno33554960 - -![disconnect activeport](http://blog.linoxide.com/wp-content/uploads/2015/01/disconnect-activeport.png) - -disconnected the active port and now check the state again using **#teamdctl team0 state**. - - # teamdctl team0 state - -![teamdctl check activeport disconnect](http://blog.linoxide.com/wp-content/uploads/2015/01/teamdctl-check-activeport-disconnect.png) - -Yes its working cool !! we will connect the disconnected connection back to team0 using the following command. - - #nmcli dev con eno33554960 - -![nmcli dev connect disconected](http://blog.linoxide.com/wp-content/uploads/2015/01/nmcli-dev-connect-disconected.png) - -We have one more command called **teamnl** let us show some options with **teamnl** command. - -to check the ports in team0 run the following command. - - # teamnl team0 ports - -![teamnl check ports](http://blog.linoxide.com/wp-content/uploads/2015/01/teamnl-check-ports.png) - -Display currently active port of **team0**. - - # teamnl team0 getoption activeport - -![display active port team0](http://blog.linoxide.com/wp-content/uploads/2015/01/display-active-port-team0.png) - -Hurray, we have successfully configured NICs bonding :-) Please share feedback if any. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-command/interface-nics-bonding-linux/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/sources/tech/20150112 What are useful command-line network monitors on Linux.md b/sources/tech/20150112 What are useful command-line network monitors on Linux.md deleted file mode 100644 index f17e45cbf4..0000000000 --- a/sources/tech/20150112 What are useful command-line network monitors on Linux.md +++ /dev/null @@ -1,135 +0,0 @@ -What are useful command-line network monitors on Linux -================================================================================ -Network monitoring is a critical IT function for businesses of all sizes. The goal of network monitoring can vary. For example, the monitoring activity can be part of long-term network provisioning, security protection, performance troubleshooting, network usage accounting, and so on. Depending on its goal, network monitoring is done in many different ways, such as performing packet-level sniffing, collecting flow-level statistics, actively injecting probes into the network, parsing server logs, etc. - -While there are many dedicated network monitoring systems capable of 24/7/365 monitoring, you can also leverage command-line network monitors in certain situations, where a dedicated monitor is an overkill. If you are a system admin, you are expected to have hands-on experience with some of well known CLI network monitors. Here is a list of **popular and useful command-line network monitors on Linux**. - -### Packet-Level Sniffing ### - -In this category, monitoring tools capture individual packets on the wire, dissect their content, and display decoded packet content or packet-level statistics. These tools conduct network monitoring from the lowest level, and as such, can possibly do the most fine-grained monitoring at the cost of network I/O and analysis efforts. - -1. **dhcpdump**: a comman-line DHCP traffic sniffer capturing DHCP request/response traffic, and displays dissected DHCP protocol messages in a human-friendly format. It is useful when you are troubleshooting DHCP related issues. - -2. **[dsniff][1]**: a collection of command-line based sniffing, spoofing and hijacking tools designed for network auditing and penetration testing. They can sniff various information such as passwords, NSF traffic, email messages, website URLs, and so on. - -3. **[httpry][2]**: an HTTP packet sniffer which captures and decode HTTP requests and response packets, and display them in a human-readable format. - -4. **IPTraf**: a console-based network statistics viewer. It displays packet-level, connection-level, interface-level, protocol-level packet/byte counters in real-time. Packet capturing can be controlled by protocol filters, and its operation is full menu-driven. - -![](https://farm8.staticflickr.com/7519/16055246118_8ea182b413_c.jpg) - -5. **[mysql-sniffer][3]**: a packet sniffer which captures and decodes packets associated with MySQL queries. It displays the most frequent or all queries in a human-readable format. - -6. **[ngrep][4]**: grep over network packets. It can capture live packets, and match (filtered) packets against regular expressions or hexadecimal expressions. It is useful for detecting and storing any anomalous traffic, or for sniffing particular patterns of information from live traffic. - -7. **[p0f][5]**: a passive fingerprinting tool which, based on packet sniffing, reliably identifies operating systems, NAT or proxy settings, network link types and various other properites associated with an active TCP connection. - -8. **pktstat**: a command-line tool which analyzes live packets to display connection-level bandwidth usages as well as descriptive information of protocols involved (e.g., HTTP GET/POST, FTP, X11). - -![](https://farm8.staticflickr.com/7477/16048970999_be60f74952_b.jpg) - -9. **Snort**: an intrusion detection and prevention tool which can detect/prevent a variety of backdoor, botnets, phishing, spyware attacks from live traffic based on rule-driven protocol analysis and content matching. - -10. **tcpdump**: a command-line packet sniffer which is capable of capturing nework packets on the wire based on filter expressions, dissect the packets, and dump the packet content for packet-level analysis. It is widely used for any kinds of networking related troubleshooting, network application debugging, or [security][6] monitoring. - -11. **tshark**: a command-line packet sniffing tool that comes with Wireshark GUI program. It can capture and decode live packets on the wire, and show decoded packet content in a human-friendly fashion. - -### Flow-/Process-/Interface-Level Monitoring ### - -In this category, network monitoring is done by classifying network traffic into flows, associated processes or interfaces, and collecting per-flow, per-process or per-interface statistics. Source of information can be libpcap packet capture library or sysfs kernel virtual filesystem. Monitoring overhead of these tools is low, but packet-level inspection capabilities are missing. - -12. **bmon**: a console-based bandwidth monitoring tool which shows various per-interface information, including not-only aggregate/average RX/TX statistics, but also a historical view of bandwidth usage. - -![](https://farm9.staticflickr.com/8580/16234265932_87f20c5d17_b.jpg) - -13. **[iftop][7]**: a bandwidth usage monitoring tool that can shows bandwidth usage for individual network connections in real time. It comes with ncurses-based interface to visualize bandwidth usage of all connections in a sorted order. It is useful for monitoring which connections are consuming the most bandwidth. - -14. **nethogs**: a process monitoring tool which offers a real-time view of upload/download bandwidth usage of individual processes or programs in an ncurses-based interface. This is useful for detecting bandwidth hogging processes. - -15. **netstat**: a command-line tool that shows various statistics and properties of the networking stack, such as open TCP/UDP connections, network interface RX/TX statistics, routing tables, protocol/socket statistics. It is useful when you diagnose performance and resource usage related problems of the networking stack. - -16. **[speedometer][8]**: a console-based traffic monitor which visualizes the historical trend of an interface's RX/TX bandwidth usage with ncurses-drawn bar charts. - -![](https://farm8.staticflickr.com/7485/16048971069_31dd573a4f_c.jpg) - -17. **[sysdig][9]**: a comprehensive system-level debugging tool with a unified interface for investigating different Linux subsystems. Its network monitoring module is capable of monitoring, either online or offline, various per-process/per-host networking statistics such as bandwidth usage, number of connections/requests, etc. - -18. **tcptrack**: a TCP connection monitoring tool which displays information of active TCP connections, including source/destination IP addresses/ports, TCP state, and bandwidth usage. - -![](https://farm8.staticflickr.com/7507/16047703080_5fdda2e811_b.jpg) - -19. **vnStat**: a command-line traffic monitor which maintains a historical view of RX/TX bandwidh usage (e.g., current, daily, monthly) on a per-interface basis. Running as a background daemon, it collects and stores interface statistics on bandwidth rate and total bytes transferred. - -### Active Network Monitoring ### - -Unlike passive monitoring tools presented so far, tools in this category perform network monitoring by actively "injecting" probes into the network and collecting corresponding responses. Monitoring targets include routing path, available bandwidth, loss rates, delay, jitter, system settings or vulnerabilities, and so on. - -20. **[dnsyo][10]**: a DNS monitoring tool which can conduct DNS lookup from open resolvers scattered across more than 1,500 different networks. It is useful when you check DNS propagation or troubleshoot DNS configuration. - -21. **[iperf][11]**: a TCP/UDP bandwidth measurement utility which can measure maximum available bandwidth between two end points. It measures available bandwidth by having two hosts pump out TCP/UDP probe traffic between them either unidirectionally or bi-directionally. It is useful when you test the network capacity, or tune the parameters of network stack. A variant called [netperf][12] exists with more features and better statistics. - -22. **[netcat][13]/socat**: versatile network debugging tools capable of reading from, writing to, or listen on TCP/UDP sockets. They are often used alongside with other programs or scripts for backend network transfer or port listening. - -23. **nmap**: a command-line port scanning and network discovery utility. It relies on a number of TCP/UDP based scanning techniques to detect open ports, live hosts, or existing operating systems on the local network. It is useful when you audit local hosts for vulnerabilities or build a host map for maintenance purpose. [zmap][14] is an alernative scanning tool with Internet-wide scanning capability. - -24. ping: a network testing tool which works by exchaning ICMP echo and reply packets with a remote host. It is useful when you measure round-trip-time (RTT) delay and loss rate of a routing path, as well as test the status or firewall rules of a remote system. Variations of ping exist with fancier interface (e.g., [noping][15]), multi-protocol support (e.g., [hping][16]) or parallel probing capability (e.g., [fping][17]). - -![](https://farm8.staticflickr.com/7466/15612665344_a4bb665a5b_c.jpg) - -25. **[sprobe][18]**: a command-line tool that heuristically infers the bottleneck bandwidth between a local host and any arbitrary remote IP address. It uses TCP three-way handshake tricks to estimate the bottleneck bandwidth. It is useful when troubleshooting wide-area network performance and routing related problems. - -26. **traceroute**: a network discovery tool which reveals a layer-3 routing/forwarding path from a local host to a remote host. It works by sending TTL-limited probe packets and collecting ICMP responses from intermediate routers. It is useful when troubleshooting slow network connections or routing related problems. Variations of traceroute exist with better RTT statistics (e.g., [mtr][19]). - -### Application Log Parsing ### - -In this category, network monitoring is targeted at a specific server application (e.g., web server or database server). Network traffic generated or consumed by a server application is monitored by analyzing its log file. Unlike network-level monitors presented in earlier categories, tools in this category can analyze and monitor network traffic from application-level. - -27. **[GoAccess][20]**: a console-based interactive viewer for Apache and Nginx web server traffic. Based on access log analysis, it presents a real-time statistics of a number of metrics including daily visits, top requests, client operating systems, client locations, client browsers, in a scrollable view. - -![](https://farm8.staticflickr.com/7518/16209185266_da6c5c56eb_c.jpg) - -28. **[mtop][21]**: a command-line MySQL/MariaDB server moniter which visualizes the most expensive queries and current database server load. It is useful when you optimize MySQL server performance and tune server configurations. - -![](https://farm8.staticflickr.com/7472/16047570248_bc996795f2_c.jpg) - -29. **[ngxtop][22]**: a traffic monitoring tool for Nginx and Apache web server, which visualizes web server traffic in a top-like interface. It works by parsing a web server's access log file and collecting traffic statistics for individual destinations or requests. - -### Conclusion ### - -In this article, I presented a wide variety of command-line network monitoring tools, ranging from the lowest packet-level monitors to the highest application-level network monitors. Knowing which tool does what is one thing, and choosing which tool to use is another, as any single tool cannot be a universal solution for your every need. A good system admin should be able to decide which tool is right for the circumstance at hand. Hopefully the list helps with that. - -You are always welcome to improve the list with your comment! - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/useful-command-line-network-monitors-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]:http://www.monkey.org/~dugsong/dsniff/ -[2]:http://xmodulo.com/monitor-http-traffic-command-line-linux.html -[3]:https://github.com/zorkian/mysql-sniffer -[4]:http://ngrep.sourceforge.net/ -[5]:http://lcamtuf.coredump.cx/p0f3/ -[6]:http://xmodulo.com/recommend/firewallbook -[7]:http://xmodulo.com/how-to-install-iftop-on-linux.html -[8]:https://excess.org/speedometer/ -[9]:http://xmodulo.com/monitor-troubleshoot-linux-server-sysdig.html -[10]:http://xmodulo.com/check-dns-propagation-linux.html -[11]:https://iperf.fr/ -[12]:http://www.netperf.org/netperf/ -[13]:http://xmodulo.com/useful-netcat-examples-linux.html -[14]:https://zmap.io/ -[15]:http://noping.cc/ -[16]:http://www.hping.org/ -[17]:http://fping.org/ -[18]:http://sprobe.cs.washington.edu/ -[19]:http://xmodulo.com/better-alternatives-basic-command-line-utilities.html#mtr_link -[20]:http://goaccess.io/ -[21]:http://mtop.sourceforge.net/ -[22]:http://xmodulo.com/monitor-nginx-web-server-command-line-real-time.html \ No newline at end of file diff --git a/sources/tech/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md b/sources/tech/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md deleted file mode 100644 index 540789d367..0000000000 --- a/sources/tech/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md +++ /dev/null @@ -1,147 +0,0 @@ -[bazz2222222] -How to Configure Chroot Environment in Ubuntu 14.04 -================================================================================ -There are many instances when you may wish to isolate certain applications, user, or environments within a Linux system. Different operating systems have different methods of achieving isolation, and in Linux, a classic way is through a `chroot` environment. - -In this guide, we'll show you step wise on how to setup an isolated environment using chroot in order to create a barrier between your regular operating system and a contained environment. This is mainly useful for testing purposes. We will teach you the steps on an **Ubuntu 14.04** VPS instance. - -Most system administrators will benefit from knowing how to accomplish a quick and easy chroot environment and it is a valuable skill to have. - -### The chroot environment ### - -A chroot environment is an operating system call that will change the root location temporarily to a new folder. Typically, the operating system's conception of the root directory is the actual root located at "/". However, with `chroot`, you can specify another directory to serve as the top-level directory for the duration of a chroot. - -Any applications that are run from within the `chroot` will be unable to see the rest of the operating system in principle. - -#### Advantages of Chroot Environment #### - -> - Test applications without the risk of compromising the entire host system. -> -> - From the security point of view, whatever happens in the chroot environment won't affect the host system (not even under root user). -> -> - A different operating system running in the same hardware. - -For instance, it allows you to build, install, and test software in an environment that is separated from your normal operating system. It could also be used as a method of **running 32-bit applications in a 64-bit environment**. - -But while chroot environments will certainly make additional work for an unprivileged user, they should be considered a hardening feature instead of a security feature, meaning that they attempt to reduce the number of attack vectors instead of creating a full solution. If you need full isolation, consider a more complete solution, such as Linux containers, Docker, vservers, etc. - -### Debootstrap and Schroot ### - -The necessary packages to setup the chroot environment are **debootstrap** and **schroot**, which are available in the ubuntu repository. The schroot command is used to setup the chroot environment. - -**Debootstrap** allows you to install a new fresh copy of any Debian (or debian-based) system from a repository in a directory with all the basic commands and binaries needed to run a basic instance of the operating system. - -The **schroot** allows access to chroots for normal users using the same mechanism, but with permissions checking and allowing additional automated setup of the chroot environment, such as mounting additional filesystems and other configuration tasks. - -These are the steps to implement this functionality in Ubuntu 14.04 LTS: - -### 1. Installing the Packages ### - -Firstly, We're gonna install debootstrap and schroot in our host Ubuntu 14.04 LTS. - - $ sudo apt-get install debootstrap - $ sudo apt-get install schroot - -### 2. Configuring Schroot ### - -Now that we have the appropriate tools, we just need to specify a directory that we want to use as our chroot environment. We will create a directory called linoxide in our root directory to setup chroot there: - - sudo mkdir /linoxide - -We have to configure schroot to suit our needs in the configuration file .we will modify the schroot configuration file with the information we require to get configured. - - sudo nano /etc/schroot/schroot.conf - -We are on an Ubuntu 14.04 LTS (Trusty Tahr) system currently, but let's say that we want to test out some packages available on Ubuntu 13.10, code named "Saucy Salamander". We can do that by creating an entry that looks like this: - - [saucy] - description=Ubuntu Saucy - location=/linoxide - priority=3 - users=arun - root-groups=root - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/schroot-config.png) - -Modify the values of the configuration parameters in the above example to fit your system: - -### 3. Installing 32 bit Ubuntu with debootstrap ### - -Debootstrap downloads and installs a minimal operating system inside your **chroot environment**. You can install any debian-based distro of your choice, as long as you have a repository available. - -Above, we placed the chroot environment under the directory **/linoxide** and this is the root directory of the chroot environment. So we'll need to run debootstrap inside that directory which we have already created: - - cd /linoxide - sudo debootstrap --variant=buildd --arch amd64 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/ - sudo chroot /linoxide /debootstrap/debootstrap --second-stage - -You can replace amd64 in --arch as i386 or other bit OS you wanna setup available in the repository. You can replace the mirror http://archive.ubuntu.com/ubuntu/ above as the one closest, you can get the closest one from the official [Ubuntu Mirror Page][1]. - -**Note: You will need to add --foreign above 3rd line command if you choose to setup i386 bit OS choot in your 64 bit Host Ubuntu as:** - - sudo debootstrap --variant=buildd --foreign --arch i386 saucy /linoxide/ http://archive.ubuntu.com/ubuntu/ - -It takes some time (depending on your bandwidth) to download, install and configure the complete system. It takes about 500 MBs for a minimal installation. - -### 4. Finallizing the chroot environment ### - -After the system is installed, we'll need to do some final configurations to make sure the system functions correctly. First, we'll want to make sure our host `fstab` is aware of some pseudo-systems in our guest. - - sudo nano /etc/fstab - -Add the below lines like these to the bottom of your fstab: - - proc /linoxide/proc proc defaults 0 0 - sysfs /linoxide/sys sysfs defaults 0 0 - -Save and close the file. - -Now, we're going to need to mount these filesystems within our guest: - - $ sudo mount proc /linoxide/proc -t proc - $sudo mount sysfs /linoxide/sys -t sysfs - -We'll also want to copy our /etc/hosts file so that we will have access to the correct network information: - - $ sudo cp /etc/hosts /linoxide/etc/hosts - -Finally, You can list the available chroot environments using the schroot command. - - $ schroot -l - -We can enter the chroot environment through a command like this: - - $ sudo chroot /linoxide/ /bin/bash - -You can test the chroot environment by checking the version of distributions installed. - - # lsb_release -a - # uname -a - -To finish this tutorial, in order to run a graphic application from the chroot, you have to export the DISPLAY environment variable. - - $ DISPLAY=:0.0 ./apps - -Here, we have successfully installed Chrooted Ubuntu 13.10(Saucy Salamander) in your host Ubuntu 14.04 LTS (Trusty Tahr). - -You can exit chroot environment successfully by running the commands below: - - # exit - -Afterwards, we need to unmount our proc and sys filesystems: - - $ sudo umount /test/proc - $ sudo umount /test/sys - --------------------------------------------------------------------------------- - -via: http://linoxide.com/ubuntu-how-to/configure-chroot-environment-ubuntu-14-04/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:https://launchpad.net/ubuntu/+archivemirrors diff --git a/sources/tech/20150115 Get back your privacy and control.md b/sources/tech/20150115 Get back your privacy and control.md deleted file mode 100644 index 915e3b073e..0000000000 --- a/sources/tech/20150115 Get back your privacy and control.md +++ /dev/null @@ -1,1114 +0,0 @@ -zpl1025 -Get back your privacy and control over your data in just a few hours: build your own cloud for you and your friends -================================================================================ -40'000+ searches over 8 years! That's my Google Search history. How about yours? (you can find out for yourself [here][1]) With so many data points across such a long time, Google has a very precise idea of what you've been interested in, what's been on your mind, what you are worried about, and how that all changed over the years since you first got that Google account. - -### Some of the most personal pieces of your identity are stored on servers around the world beyond your control ### - -Let's say you've been a Gmail user between 2006 and 2013 like me, meaning you received 30'000+ emails and wrote about 5000 emails over that 7 year period. Some of the emails you sent or received are very personal, maybe so personal that you probably wouldn't like even some family members or close friends to go through them systematically. Maybe you also drafted a few emails that you never sent because you changed your mind at the last minute. But even if you never sent them, these emails are still stored somewhere on a server. As a result, it's fair to say that Google servers know more about your personal life than your closest friends or your family. - -Statistically, it's a safe bet to consider that you've got a smartphone. You can barely use the phone without using the contacts app which stores your contacts in Google Contact on Google servers by default. So not only does Google know about your emails, but also about your offline contacts: who you like to call, who calls you, whom you text, and what you text them about. You don't have to take my word for it, you can verify for yourself by taking a look at the permissions you gave apps such as the Google Play Service to read the list of people that called you and the SMS you got. Do you also use the calendar app that comes with your phone? Unless you explicitly opted out while setting up your calendar, this means that Google knows precisely what you're up to, at every time of the day, day after day, year after year. The same applies if you chose an iPhone over an Android phone, except Apple gets to know about your correspondance, contacts and schedule instead of Google. - -Do you also take great care to keep the contacts in your directory up-to-date, updating your friend's, colleagues's and and family's email addresses and phone numbers when they move to a new job or change carrier? That gives Google an extraordinarily accurate, up-to-date picture of your social network. And you love the GPS of your smartphone which you use a lot together with Google Maps. This means Google not only knows what you do from your calendar but also where you are, where you live, where you work. And by correlating GPS location data across users, Google can also tell with whom you may socializing with right now. - -### Your daily habit of handing out your most personal information will impact your life in a way that no one can even forsee ### - -To summarize, if you are an average internet user, Google has up-to-date, in-depth information about your interests, worries, passions, questions, over almost 10 years. It has a collection of some of your most personal messages (emails, SMS), an hour-by-hour detail of your daily activities and location, and a high-quality picture of your social network. Such an intimate knowledge of you likely goes beyond what your closest friends, family, or your sweetheart know of you. - -It wouldn't come to mind to give this mass of deeply personal information to complete strangers, for instance by putting it all on a USB key and leaving it on a table in a random cafe with a note saying 'Personal data of Olivier Martin, use as you please'. Who knows who might find it and what they would do with it? Yet, we have no problem handing in core pieces of your identity to strangers at IT companies with a strong interest in our data (that's how they make their bread) and [world-class experts in data analysis][2], perhaps just because it happens by default without us thinking about it when we hit that green 'Accept' button. - -With so much high-quality information, over the years, Google may well get to know you better than you can ever hope to know yourself: heck, crawling through my digital past right now, I can't remember having written half of the emails I sent five years ago. I am surprised and pleased to rediscover my interest in marxism back in 2005 and my joining [ATTAC][3] (an organization which strives to limit speculation and improve social justice by taxing financial transactions) the next year. And god knows why I was so much into dancing shoes back in 2007. These is pretty harmless information (you wouldn't have expected me to reveal something embarassing here, would you? ;-). But by connecting the dots between high-quality data over different aspects of your life (what, when, with whom, where, ...) over such time spans, one may extrapolate predictive statements about you. For instance, from the shopping habits of a 17-year-old girl, supermarkets can tell that she is pregnant before her dad even hears about it ([true story][4]). Who knows what will become possible with high-quality data the like Google has, which goes well beyond shopping habits? By connecting the dots, maybe one can predict how your tastes or political views will change in the coming years. Today, [companies you have never heard of claim to have 500 data points about you][5], including religion, sexual orientation and political views. Speaking of politics, what if you decide to go into politics in 10 years from now? Your life may change, your views too, and you may even forget, but Google won't. Will you have to worry that your opponent is in touch with someone who has access to your data at Google and can dig up something embarassing on you from those bottomless wells of personal data you gave away over the years? How long until Google or Facebook get hacked [just like Sony was recently hacked][6] and all your personal data end up in the public sphere forever? - -One of the reason most of us have entrusted our personal data to these companies is that they provide their services for free. But how free is it really? The value of the average Google account varies depending on the method used to estimate it: [1000 USD/year][7] accounts for the amount of time you invest in writing emails, while the value of your account for the advertisement industry is somewhere between [220 USD/year][8] and [500 USD/year][9]. So the service is not exactly free: you pay for it through advertisement and the yet unknown uses that our data may find in the future. - -I've been writing about Google mostly because that's the company I've entrusted most of my digital identify to so far and hence the one I know best. But I may well have written Apple or Facebook. These companies truly changed the world with their fantastic advances in design, engineering and services we love(d) to use, every day. But it doesn't mean we should stack up all our most personal data in their servers and entrust them with our digital lives: the potential for harm is just too large. - -### Claim back your privacy and that of people you care for in just 5h ### - -It does not have to be this way. You can live in the 21st century, have a smartphone, use email and GPS on daily basis, and still retain your privacy. All you need to do is get back control over your personal data: emails, calendar, contacts, files, etc.. The [Prism-Break.org][10] website lists software that help controlling the fate of your personal data. Beyond these options, the safest and most powerful way to get back control over your personal data is to host your cloud yourself, by building your own server. But you may just not have the time and energy to research how exactly to do that and make it work smoothly. - -That's where the present article fits in. In just 5 hours, we will set up a server to host your emails, contacts, calendars and files for you, your friends and your family. The server is designed to act as a hub or cloud for your personal data, so that you always retain full control over it. The data will automatically be synchronized between your PC/laptop, your phone and your tablet. Essentially, **we will set up a system that replaces Gmail, Google Drive / Dropbox, Google Contacts, Google Calendar and Picasa**. - -Just doing this for yourself will already be a big step. But then, a significant fraction of your personal information will still leak out and end up on some servers in the silicon valley, just because so many of the people you interact with every day use Gmail and have smartphones. So it's a good idea to have some of the people you are closest to join the adventure. - -We will build a system that - -- **supports an arbitrary number of domains and users**. This makes it easy to share your server with family and friends, so that they get control over their personal data too and can share the cost of the server with you. The people sharing your server can use their own domain name or share yours. -- **lets you send and receive your emails from any network** upon successfully logging in onto the server. This way, you can send your emails from any of your email addresses, from any device (PC, phone, tablet), and any network (at home, at work, from a public network, ...) -- **encrypts network traffic** when sending and receiving emails so people you don't trust won't fish out your password and won't be able to read your private emails. -- **offers state-of-the-art antispam**, combining black lists of known spammers, automatic greylisting, and adaptative spam filtering. Re-training the adaptative spam filter if an email is misclassified is simply done by moving spam in or out of the Junk/Spam folder. Also, the server will contribute to community-based spam fighting efforts. -- **requires just a few minutes of maintenance once in a while**, basically to install security updates and briefly check the server logs. Adding a new email address boils down to adding one record to a database. Apart from that, you can just forget about it and live your life. I set up the system described in this article 14 months ago and the thing has just been running smoothly since then. So I completely forgot about it, until I recently smiled at the thought that casually pressing the 'Check email' button of my phone caused electrons to travel all the way to Iceland (where my server sits) and back. - -To go through this article, you'll need a minimum of technical capabilities. If you know what is the difference between SMTP and IMAP, what is a DNS, and have a basic understanding of TCP/IP, you know enough to follow through. You will also need a basic working knowledge of Unix (working with files from the command line, basic system administration). And you'll need a total of 5 hours of time to set it up. - -Here's an overview what we will do: - -- [Get a Virtual Private Server, a domain name, and set them up][11] -- [Set up postfix and dovecot to send and receive email][12] -- [Prevent SPAM from reaching your INBOX][13] -- [Make sure the emails you send get through spam filters][14] -- [Host calendars, contacts, files with Owncloud and set up webmail][15] -- [Sync your devices to the cloud][16] - -### This article was inspired by and builds upon previous work ### - -This article draws heavily from two other articles, namely [Xavier Claude][17]'s and [Drew Crawford][18]'s introduction to email self-hosting. - -The article includes all the features of Xavier's and Draw's articles, except from three features that Drew had and which I didn't need, namely push support for email (I like to check email only when I decide to, otherwise I get distracted all the time), fulltext search in email (which I don't have a use for), and storing emails in an encrypted form (my emails and data are not critical to the point that I have to encrypt them locally on the server). If you need any of these features, feel free to just add them by following to the respective section of Drew's article, which is compatible with the present one. - -Compared to Xavier's and Drew's work, the present article improves on several aspects: - -- it fixes bugs and typos based on my experience with Drew's article and the numerous comments on his original article. I also went through the present article, setting up the server from scratch several times to replicate it and make sure it would work right out of the box. -- low maintenance: compared to Xavier's work, the present article adds support for multiple email domains on the server. It does so by requiring the minimum amount of server maintenance possible: basically, to add a domain or a user, just add one row to a mysql table and that's it (no need to add sieve scripts, ...). -- I added webmail. -- I added a section on setting up a cloud, to host not just your emails but also your files, your addressbook / contacts (emails, phone numbers, birthdays, ...), calendars and pictures for use across your devices. - -### Get a Virtual Private Server, a domain name, and set them up ### - -Let's start by setting the basic infrastructure: our virtual private server and our domain name. - -I've had an excellent experience with the Virtual Private Servers (VPS) of [1984.is][19] and [Linode][20]. In this article, we will use **Debian Wheezy**, for which both 1984 and Linode provide ready-made images to deploy on your VPS. I like 1984 because the servers are hosted in Iceland which run exclusively on renewable energy (geothermical and hydropower) and hence does not contribute to the climate change, unlike [the coal power plants on which most US-based datacenters currently run on][21]. Also, they put emphasis on [civil liberties, transparency, freedom][22] and [Free Software][23]. - -It could be a good idea to start a file to store the various passwords we will need to set on the server (user accounts, mail accounts, cloud accounts, database accounts). It's definitely a good idea to encrypt this file (maybe with [GnuPG][24]), so that it won't be too easy to attack your server even if the computer you use to set up your server gets stolen or compromised. - -For registering a domain name, I've been using the services of [gandi][25] for over 10 years now, also with satisfaction. For this article, we will set up a zone with the name **jhausse.net**. We then add a host named **cloud.jhausse.net** to it, set the MX record to that host. While you're at it, set short Time To Lives (TTL) to your records like 300 seconds so that you'll be able to make changes to your zone and test the result rapidly while you're setting up the server. - -Finally, set the PTR record (reverse DNS) so that the IP address of the host maps back to its name. If you don't understand the previous sentence, read [this article][26] to get the background. If you use Linode, you can set the PTR record in the control panel in the Remote Access section. With 1984, contact the tech support who will help you with it. - -On the server, we will start by adding a non-privledged user, so that we don't end up working as root all the time. Also, to log in as root will require an extra layer of security. - - adduser roudy - -Then, in **/etc/ssh/sshd_config**, we set - - PermitRootLogin no - -and reload the ssh server - - service ssh reload - -Then, we'll need to change the hostname of the server. Edit **/etc/hostname** so that it has just a single line with your hostname, in our case - - cloud - -Then, edit the ssh server's public key files **/etc/ssh/ssh_host_rsa_key.pub, /etc/ssh/ssh_host_dsa_key.pub, /etc/ssh/ssh_host_ecdsa_key.pub** so that the end of the file reflects your hostname, or instance **root@cloud**. Then restart the system to make sure the hostname is fixed wherever is should be - - reboot - -We will update the system and remove services we don't need to reduce the risk of remote attacks. - - apt-get update - apt-get dist-upgrade - service exim4 stop - apt-get remove exim4 rpcbind - apt-get autoremove - apt-get install vim - -I like to use vim for editing config files remotely. For this, it helps to automatically turn on syntax highlighting. We do so by adding - - syn on - -to **~/.vimrc**. - -### Set up postfix and dovecot to send and receive email ### - - apt-get install postfix postfix-mysql dovecot-core dovecot-imapd dovecot-mysql mysql-server dovecot-lmtpd postgrey - -In the [Postfix][27] configuration menu, we select **Internet Site**, and set the system mail name to **jhausse.net**. - -We will now set up a database to store the list of domains hosted on our server, the list of users for each of these domains (together with their password), and a list of mail aliases (to forward email from a given address to another one). - - mysqladmin -p create mailserver - mysql -p mailserver - mysql> GRANT SELECT ON mailserver.* TO 'mailuser'@'localhost' IDENTIFIED BY 'mailuserpass'; - mysql> FLUSH PRIVILEGES; - mysql> CREATE TABLE `virtual_domains` ( - `id` int(11) NOT NULL auto_increment, - `name` varchar(50) NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - mysql> CREATE TABLE `virtual_users` ( - `id` int(11) NOT NULL auto_increment, - `domain_id` int(11) NOT NULL, - `password` varchar(106) NOT NULL, - `email` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `email` (`email`), - FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - mysql> CREATE TABLE `virtual_aliases` ( - `id` int(11) NOT NULL auto_increment, - `domain_id` int(11) NOT NULL, - `source` varchar(100) NOT NULL, - `destination` varchar(100) NOT NULL, - PRIMARY KEY (`id`), - FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE - ) ENGINE=InnoDB DEFAULT CHARSET=utf8; - -We will host the **jhausse.net** domain. If there are other domains you'd like to host, you can also add them. We also set up a postmaster address for each domain, which forwards to **roudy@jhausse.net**. - - mysql> INSERT INTO virtual_domains (`name`) VALUES ('jhausse.net'); - mysql> INSERT INTO virtual_domains (`name`) VALUES ('otherdomain.net'); - mysql> INSERT INTO virtual_aliases (`domain_id`, `source`, `destination`) VALUES ('1', 'postmaster', 'roudy@jhausse.net'); - mysql> INSERT INTO virtual_aliases (`domain_id`, `source`, `destination`) VALUES ('2', 'postmaster', 'roudy@jhausse.net'); - -We now add a locally hosted email account **roudy@jhausse.net**. First, we generate a password hash for it: - - doveadm pw -s SHA512-CRYPT - -and then add the hash to the database - - mysql> INSERT INTO `mailserver`.`virtual_users` (`domain_id`, `password`, `email`) VALUES ('1', '$6$YOURPASSWORDHASH', 'roudy@jhausse.net'); - -Now that our list of domains, aliases and users are in place, we will set up postfix (SMTP server, for outgoing mail). Replace the contents of **/etc/postfix/main.cf** with the following: - - myhostname = cloud.jhausse.net - myorigin = /etc/mailname - mydestination = localhost.localdomain, localhost - mynetworks_style = host - - # We disable relaying in the general case - smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination - # Requirements on servers that contact us: we verify the client is not a - # known spammer (reject_rbl_client) and use a graylist mechanism - # (postgrey) to help reducing spam (check_policy_service) - smtpd_client_restrictions = permit_mynetworks, reject_rbl_client zen.spamhaus.org, check_policy_service inet:127.0.0.1:10023 - disable_vrfy_command = yes - inet_interfaces = all - smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU) - biff = no - append_dot_mydomain = no - readme_directory = no - - # TLS parameters - smtpd_tls_cert_file=/etc/ssl/certs/cloud.crt - smtpd_tls_key_file=/etc/ssl/private/cloud.key - smtpd_use_tls=yes - smtpd_tls_auth_only = yes - smtp_tls_security_level=may - smtp_tls_loglevel = 1 - smtpd_tls_loglevel = 1 - smtpd_tls_received_header = yes - smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache - smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache - - # Delivery - alias_maps = hash:/etc/aliases - alias_database = hash:/etc/aliases - message_size_limit = 50000000 - recipient_delimiter = + - - # The next lines are useful to set up a backup MX for myfriendsdomain.org - # relay_domains = myfriendsdomain.org - # relay_recipient_maps = - - # Virtual domains - virtual_transport = lmtp:unix:private/dovecot-lmtp - virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf - virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf - virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf - local_recipient_maps = $virtual_mailbox_maps - -Now we need to teach postfix to figure out which domains we would like him to accept emails for using the database we just set up. Create a new file **/etc/postfix/mysql-virtual-mailbox-domains.cf** and add the following: - - user = mailuser - password = mailuserpass - hosts = 127.0.0.1 - dbname = mailserver - query = SELECT 1 FROM virtual_domains WHERE name='%s' - -We teach postfix to find out whether a given email account exists by creating **/etc/postfix/mysql-virtual-mailbox-maps.cf** with the following content - - user = mailuser - password = mailuserpass - hosts = 127.0.0.1 - dbname = mailserver - query = SELECT 1 FROM virtual_users WHERE email='%s' - -Finally, postfix will use **/etc/postfix/mysql-virtual-alias-maps.cf** to look up mail aliases - - user = mailuser - password = mailuserpass - hosts = 127.0.0.1 - dbname = mailserver - query = SELECT virtual_aliases.destination as destination FROM virtual_aliases, virtual_domains WHERE virtual_aliases.source='%u' AND virtual_aliases.domain_id = virtual_domains.id AND virtual_domains.name='%d' - -With all this in place, it is now time to test if postfix can query our database properly. We can do this using **postmap**: - - postmap -q jhausse.net mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf - postmap -q roudy@jhausse.net mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf - postmap -q postmaster@jhausse.net mysql:/etc/postfix/mysql-virtual-alias-maps.cf - postmap -q bob@jhausse.net mysql:/etc/postfix/mysql-virtual-alias-maps.cf - -If you set up everything properly, the first two queries should return 1, the third query should return **roudy@jhausse.net** and the last one should return nothing at all. - -Now, let's set up dovecot (the IMAP server, to fetch incoming mail on the server from our devices). Edit **/etc/dovecot/dovecot.conf** to set the following parameters: - - # Enable installed protocol - # !include_try /usr/share/dovecot/protocols.d/*.protocol - protocols = imap lmtp - -which will only enable imap (to let us fetch emails) and lmtp (which postfix will use to pass incoming emails to dovecot). Edit **/etc/dovecot/conf.d/10-mail.conf** to set the following parameters: - - mail_location = maildir:/var/mail/%d/%n - [...] - mail_privileged_group = mail - [...] - first_valid_uid = 0 - -which will store emails in /var/mail/domainname/username. Note that these settings are spread at different locations in the file, and are sometimes already there for us to set: we just need to comment them out. The other settings which are already in the file, you can leave as is. We will have to do the same to update settings in many more files in the remaining of this article. In **/etc/dovecot/conf.d/10-auth.conf**, set the parameters: - - disable_plaintext_auth = yes - auth_mechanisms = plain - #!include auth-system.conf.ext - !include auth-sql.conf.ext - -In **/etc/dovecot/conf.d/auth-sql.conf.ext**, set the following parameters: - - passdb { - driver = sql - args = /etc/dovecot/dovecot-sql.conf.ext - } - userdb { - driver = static - args = uid=mail gid=mail home=/var/mail/%d/%n - } - -where we just taught dovecot that users have their emails in /var/mail/domainname/username and to look up passwords from the database we just created. Now we still need to teach dovecot how exactly to use the database. To do so, put the following into **/etc/dovecot/dovecot-sql.conf.ext**: - - driver = mysql - connect = host=localhost dbname=mailserver user=mailuser password=mailuserpass - default_pass_scheme = SHA512-CRYPT - password_query = SELECT email as user, password FROM virtual_users WHERE email='%u'; - -We now fix permissions on config files - - chown -R mail:dovecot /etc/dovecot - chmod -R o-rwx /etc/dovecot - -Almost there! We just need to edit a couple files more. In **/etc/dovecot/conf.d/10-master.conf**, set the following parameters: - - service imap-login { - inet_listener imap { - #port = 143 - port = 0 - } - inet_listener imaps { - port = 993 - ssl = yes - } - } - - service pop3-login { - inet_listener pop3 { - #port = 110 - port = 0 - } - inet_listener pop3s { - #port = 995 - #ssl = yes - port = 0 - } - } - - service lmtp { - unix_listener /var/spool/postfix/private/dovecot-lmtp { - mode = 0666 - group = postfix - user = postfix - } - user = mail - } - - service auth { - unix_listener auth-userdb { - mode = 0600 - user = mail - #group = - } - - # Postfix smtp-auth - unix_listener /var/spool/postfix/private/auth { - mode = 0666 - user = postfix - group = postfix - } - - # Auth process is run as this user. - #user = $default_internal_user - user = dovecot - } - - service auth-worker { - user = mail - } - -Note that we set ports for all services but imaps to 0, which effectively disables them. Then, in **/etc/dovecot/conf.d/15-lda.conf**, specify an email address for the postmaster: - - postmaster_address = postmaster@jhausse.net - -Last but not least, we need to generate a pair of public and private key for the server, which we will use both in dovecot and postfix: - - openssl req -new -newkey rsa:4096 -x509 -days 365 -nodes -out "/etc/ssl/certs/cloud.crt" -keyout "/etc/ssl/private/cloud.key" - -Make sure that you specify your the Fully Qualified Domain Name (FQDN) of the server, in our case: - - Common Name (e.g. server FQDN or YOUR name) []:cloud.jhausse.net - -If you don't, our clients may complain that the server name in the SSL certificate does not match the name of the server they are connecting to. We tell dovecot to use these keys by setting the following parameters in **/etc/dovecot/conf.d/10-ssl.conf**: - - ssl = required - ssl_cert = : Relay access denied - -That's good: had the server accepted the mail, it would have meant that we set up postfix as an open relay for all the spammers of the world and beyhond to use. Instead of the 'Relay access denied' message, you may instead get the message - - 554 5.7.1 Service unavailable; Client host [87.68.61.119] blocked using zen.spamhaus.org; http://www.spamhaus.org/query/bl?ip=87.68.61.119 - -This means that you are trying to contact the server from an IP address that is considered as a spammer's address. I got this message while trying to connect to the server through my regular Internet Service Provider (ISP). To fix this issue, you can try to connect from another host, maybe another server you have access to through SSH. Alternatively, you can reconfigure Postfix's **main.cf** not to use Spamhaus's RBL, reload postfix, and verify that the above test works. In both cases, it's important that you find a solution that works for you because we'll test other things in a minute. If you chose to reconfigure Postfix not to use RBLs, don't forget to put the RBLs back in and to reload postfix after finishing the article to avoid getting more spam than necessary. - -Now let's try to send a valid email by SMTP on port 25, which regular mail servers use to talk to each other: - - openssl s_client -connect cloud.jhausse.net:25 -starttls smtp - EHLO cloud.jhausse.net - MAIL FROM:youremail@domain.com - rcpt to:roudy@jhausse.net - -to which the server should respond - - Client host rejected: Greylisted, see http://postgrey.schweikert.ch/help/jhausse.net.html - -which shows that [postgrey][28] is working as it should. What postgrey does it to reject emails with a temporary error if the sender has never been seen before. The technical rules of email require email servers to try to deliver the email again. After five minutes, postgrey will accept the email. Legit email servers around the world will try repeatidly to redeliver the email to us, but most spammers won't. So, wait for 5 minutes, try to send the email again using the command above, and verify that postfix now accepts the email. - -Afterwards, we'll check that we can fetch the two emails that we just sent ourselves by talking IMAP to dovecot: - - openssl s_client -crlf -connect cloud.jhausse.net:993 - 1 login roudy@jhausse.net "mypassword" - 2 LIST "" "*" - 3 SELECT INBOX - 4 UID fetch 1:1 (UID RFC822.SIZE FLAGS BODY.PEEK[]) - 5 LOGOUT - -where you should replace mypassword with the password you set for this email account. If that works, we basically have a functional email server which can receive our incoming emails, and from which we get retreive these emails from our devices (PC/laptop, tablets, phones, ...). But we can't give it our emails to send unless we send them from the server itself. We'll now allow postfix to forward our emails, but only upon successful authentification, that is after it could make sure that the email comes from someone who has a valid account on the server. To do so, we'll open a special, SSL-only, SASL-authentified email submission service. Set the following parameters in **/etc/postfix/master.cf**: - - submission inet n - - - - smtpd - -o syslog_name=postfix/submission - -o smtpd_tls_security_level=encrypt - -o smtpd_sasl_auth_enable=yes - -o smtpd_client_restrictions=permit_sasl_authenticated,reject - -o smtpd_sasl_type=dovecot - -o smtpd_sasl_path=private/auth - -o smtpd_sasl_security_options=noanonymous - -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject_non_fqdn_recipient,reject_unauth_destination - -and reload postfix - - service postfix reload - -Now, let's try to use this service from a different machine than than the server, to verify postfix will now relay our emails and nobody else's: - - openssl s_client -connect cloud.jhausse.net:587 -starttls smtp - EHLO cloud.jhausse.net - -Notice the '250-AUTH PLAIN' capabilities advertized by server, which doesn't appear when we connect to port 25. - - MAIL FROM:asdf@jkl.net - rcpt to:bob@gmail.com - 554 5.7.1 : Relay access denied - QUIT - -That's good, postfix won't relay our emails if he doesn't know us. So let's authentify ourselves first. To do so, we first need to generate an authentification string: - - echo -ne '\000roudy@jhausse.net\000mypassword'|base64 - -and let's try to send emails through the server again: - - openssl s_client -connect cloud.jhausse.net:587 -starttls smtp - EHLO cloud.jhausse.net - AUTH PLAIN DGplYW5AMTk4NGNsb3VQLm5ldAA4bmFmNGNvNG5jOA== - MAIL FROM:asdf@jkl.net - rcpt to:bob@gmail.com - -which postfix should now accept. To complete the test, let's verify that our virtual aliases work by sending an email to postmaster@jhausse.net and making sure it goes to roudy@jhausse.net: - - telnet cloud.jhausse.net 25 - EHLO cloud.jhausse.net - MAIL FROM:youremail@domain.com - rcpt to:postmaster@jhausse.net - data - Subject: Virtual alias test - - Dear postmaster, - Long time no hear! I hope your MX is working smoothly and securely. - Yours sincerely, Roudy - . - QUIT - -Let's check the mail made it all the way to the right inbox: - - openssl s_client -crlf -connect cloud.jhausse.net:993 - 1 login roudy@jhausse.net "mypassword" - 2 LIST "" "*" - 3 SELECT INBOX - * 2 EXISTS - * 2 RECENT - 4 LOGOUT - -At this point, we have a functional email server, both for incoming and outgoing mails. We can set up our devices to use it. - -PS: did you remember to [try sending an email to an account hosted by the server through port 25][29] again, to verify that you are not longer blocked by postgrey? - -### Prevent SPAM from reaching your INBOX ### - -For the sake of SPAM filtering, we already have Realtime BlackLists (RBLs) and greylisting (postgrey) in place. We'll now take our spam fighting capabilities up a notch by adding adaptative spam filtering. This means we'll add artificial intelligence to our email server, so that it can learn from experience what is spam and what is not. We will use [dspam][30] for that. - - apt-get install dspam dovecot-antispam postfix-pcre dovecot-sieve - -dovecot-antispam is a package that allows dovecot to retrain the spam filter if we find an email that is misclassified by dspam. Basically, all we need to do is to move emails in or out of the Junk/Spam folder. dovecot-antispam will then take care of calling dspam to retrain the filter. As for postfix-pcre and dovecot-sieve, we will use them respectively to pass incoming emails through the spam filter and to automatically move spam to the user's Junk/Spam folder. - -In **/etc/dspam/dspam.conf**, set the following parameters to these values: - - TrustedDeliveryAgent "/usr/sbin/sendmail" - UntrustedDeliveryAgent "/usr/lib/dovecot/deliver -d %u" - Tokenizer osb - IgnoreHeader X-Spam-Status - IgnoreHeader X-Spam-Scanned - IgnoreHeader X-Virus-Scanner-Result - IgnoreHeader X-Virus-Scanned - IgnoreHeader X-DKIM - IgnoreHeader DKIM-Signature - IgnoreHeader DomainKey-Signature - IgnoreHeader X-Google-Dkim-Signature - ParseToHeaders on - ChangeModeOnParse off - ChangeUserOnParse full - ServerPID /var/run/dspam/dspam.pid - ServerDomainSocketPath "/var/run/dspam/dspam.sock" - ClientHost /var/run/dspam/dspam.sock - -Then, in **/etc/dspam/default.prefs**, change the following parameters to: - - spamAction=deliver # { quarantine | tag | deliver } -> default:quarantine - signatureLocation=headers # { message | headers } -> default:message - showFactors=on - -Now we need to connect dspam to postfix and dovecot by adding these two lines at the end of **/etc/postfix/master.cf**: - - dspam unix - n n - 10 pipe - flags=Ru user=dspam argv=/usr/bin/dspam --deliver=innocent,spam --user $recipient -i -f $sender -- $recipient - dovecot unix - n n - - pipe - flags=DRhu user=mail:mail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient} - -Now we will tell postfix to filter every new email that gets submitted to the server on port 25 (normal SMTP traffic) through dspam, except if the email is submitted from the server itself (permit_mynetworks). Note that the emails we submit to postfix with SASL authentication won't be filtered through dspam either, as we set up a separate submission service for those in the previous section. Edit **/etc/postfix/main.cf** to change the **smtpd_client_restrictions** to the following: - - smtpd_client_restrictions = permit_mynetworks, reject_rbl_client zen.spamhaus.org, check_policy_service inet:127.0.0.1:10023, check_client_access pcre:/etc/postfix/dspam_filter_access - -At the end of the file, also also add: - - # For DSPAM, only scan one mail at a time - dspam_destination_recipient_limit = 1 - -We now need to specify the filter we defined. Basically, we will tell postfix to send all emails (/./) to dspam through a unix socket. Create a new file **/etc/postfix/dspam_filter_access** and put the following line into it: - - /./ FILTER dspam:unix:/run/dspam/dspam.sock - -That's it for the postfix part. Now let's set up dovecot for spam filtering. In **/etc/dovecot/conf.d/20-imap.conf**, edit the **imap mail_plugins** plugins parameter such that: - - mail_plugins = $mail_plugins antispam - -and add a section for lmtp: - - protocol lmtp { - # Space separated list of plugins to load (default is global mail_plugins). - mail_plugins = $mail_plugins sieve - } - -We now configure the dovecot-antispam plugin. Edit **/etc/dovecot/conf.d/90-plugin.conf** to add the following content to the plugin section: - - plugin { - ... - # Antispam (DSPAM) - antispam_backend = dspam - antispam_allow_append_to_spam = YES - antispam_spam = Junk;Spam - antispam_trash = Trash;trash - antispam_signature = X-DSPAM-Signature - antispam_signature_missing = error - antispam_dspam_binary = /usr/bin/dspam - antispam_dspam_args = --user;%u;--deliver=;--source=error - antispam_dspam_spam = --class=spam - antispam_dspam_notspam = --class=innocent - antispam_dspam_result_header = X-DSPAM-Result - } - -and in **/etc/dovecot/conf.d/90-sieve.conf**, specify a default sieve script which will apply to all users of the server: - - sieve_default = /etc/dovecot/default.sieve - -What is sieve and why do we need a default script for all users? Sieve lets us automatize tasks on the IMAP server. In our case, we won't all emails identified as spam to be put in the Junk folder instead of in the Inbox. We would like this to be the default behavior for all users on the server; that's why we just set this script as default script. Let's create this script now, by creating a new file **/etc/dovecot/default.sieve** with the following content: - - require ["regex", "fileinto", "imap4flags"]; - # Catch mail tagged as Spam, except Spam retrained and delivered to the mailbox - if allof (header :regex "X-DSPAM-Result" "^(Spam|Virus|Bl[ao]cklisted)$", - not header :contains "X-DSPAM-Reclassified" "Innocent") { - # Mark as read - # setflag "\\Seen"; - # Move into the Junk folder - fileinto "Junk"; - # Stop processing here - stop; - } - -Now we need to compile this script so that dovecot can run it. We also need to give it appropriate permissions. - - cd /etc/dovecot - sievec . - chown mail.dovecot default.siev* - chmod 0640 default.sieve - chmod 0750 default.svbin - -Finally, we need to fix permissions on two postfix config files that dspam needs to read from: - - chmod 0644 /etc/postfix/dynamicmaps.cf /etc/postfix/main.cf - -That's it! Let's restart dovecot and postfix - - service dovecot restart - service postfix restart - -and test the antispam, by contacting the server from a remote host (e.g. the computer we are using to set the server): - - openssl s_client -connect cloud.jhausse.net:25 -starttls smtp - EHLO cloud.jhausse.net - MAIL FROM:youremail@domain.com - rcpt to:roudy@jhausse.net - DATA - Subject: DSPAM test - - Hi Roudy, how'd you like to eat some ham tonight? Yours, J - . - QUIT - -Let's check if the mail arrived: - - openssl s_client -crlf -connect cloud.jhausse.net:993 - 1 login roudy@jhausse.net "mypassword" - 2 LIST "" "*" - 3 SELECT INBOX - 4 UID fetch 3:3 (UID RFC822.SIZE FLAGS BODY.PEEK[]) - -Which should return something the email with a collection of flag set by SPAM which look like this: - - X-DSPAM-Result: Innocent - X-DSPAM-Processed: Sun Oct 5 16:25:48 2014 - X-DSPAM-Confidence: 1.0000 - X-DSPAM-Probability: 0.0023 - X-DSPAM-Signature: 5431710c178911166011737 - X-DSPAM-Factors: 27, - Received*Postfix+with, 0.40000, - Received*with+#+id, 0.40000, - like+#+#+#+ham, 0.40000, - some+#+tonight, 0.40000, - Received*certificate+requested, 0.40000, - Received*client+certificate, 0.40000, - Received*for+roudy, 0.40000, - Received*Sun+#+#+#+16, 0.40000, - Received*Sun+#+Oct, 0.40000, - Received*roudy+#+#+#+Oct, 0.40000, - eat+some, 0.40000, - Received*5+#+#+16, 0.40000, - Received*cloud.jhausse.net+#+#+#+id, 0.40000, - Roudy+#+#+#+to, 0.40000, - Received*Oct+#+16, 0.40000, - to+#+#+ham, 0.40000, - Received*No+#+#+requested, 0.40000, - Received*jhausse.net+#+#+Oct, 0.40000, - Received*256+256, 0.40000, - like+#+#+some, 0.40000, - Received*ESMTPS+id, 0.40000, - how'd+#+#+to, 0.40000, - tonight+Yours, 0.40000, - Received*with+cipher, 0.40000 - 5 LOGOUT - -Good! You now have adaptive spam filtering set up for the users of your server. Of course, each user will need to train the filter in the first few weeks. To train a message as spam, just move it to a folder called "Spam" or "Junk" using any of your devices (PC, tablet, phone). Otherwise it'll be trained as ham. - -### Make sure the emails you send get through spam filters ### - -Our goal in this section will be to make our mail server appear as clean as possible to the world and to make it harder for spammers to send emails in our name. As a side-effect, this will help us get our emails through the spam filters of other mail servers. - -#### Sender Policy Framework #### - -Sender Policy Framework (SPF) is a record that your add to your zone which declares which mail servers on the whole internet can send emails for your domain name. Setting it up is very easy, use the SPF wizard at [microsoft.com][31] to generate your SPF record, and then add it to your zone as a TXT record. It will look like this: - - jhausse.net. 300 IN TXT v=spf1 mx mx:cloud.jhausse.net -all - -#### Reverse PTR #### - -We discussed this point [earlier][32] in this article, it's a good idea that you set up the reverse DNS for your server correctly, so that doing a reverse lookup on the IP address of your server returns the actual name of your server. - -#### OpenDKIM #### - -When we activate [OpenDKIM][33], postfix will sign every outgoing email using a cryptographic key. We will then deposit that key in our zone, on the DNS. That way, every mail server in the world will be able to verify if the email actually came from us, or if it was forged by a spammer. Let's install opendkim: - - apt-get install opendkim opendkim-tools - -And set it up by editing **/etc/opendkim.conf** so that it looks like this: - - ## - ## opendkim.conf -- configuration file for OpenDKIM filter - ## - Canonicalization relaxed/relaxed - ExternalIgnoreList refile:/etc/opendkim/TrustedHosts - InternalHosts refile:/etc/opendkim/TrustedHosts - KeyTable refile:/etc/opendkim/KeyTable - LogWhy Yes - MinimumKeyBits 1024 - Mode sv - PidFile /var/run/opendkim/opendkim.pid - SigningTable refile:/etc/opendkim/SigningTable - Socket inet:8891@localhost - Syslog Yes - SyslogSuccess Yes - TemporaryDirectory /var/tmp - UMask 022 - UserID opendkim:opendkim - -We'll need a couple of additional files which we will store in **/etc/opendkim**: - - mkdir -pv /etc/opendkim/ - cd /etc/opendkim/ - -Let's create a new file **/etc/opendkim/TrustedHosts** with the following content - - 127.0.0.1 - -and a new file called **/etc/opendkim/KeyTable** with the following content - - cloudkey jhausse.net:mail:/etc/opendkim/mail.private - -This tells OpenDKIM that we want to use an encryption key named 'cloudkey' whose contents can be found in /etc/opendkim/mail.private. We will create another file named **/etc/opendkim/SigningTable** and add the following line: - - *@jhausse.net cloudkey - -which tells OpenDKIM that every emails of the jhausse.net domain should be signed using the key 'cloudkey'. If we have other domains which we want to sign, we can add them here too. - -The next step is to generate that key and fix permissions on OpenDKIM's config files. - - opendkim-genkey -r -s mail [-t] - chown -Rv opendkim:opendkim /etc/opendkim - chmod 0600 /etc/opendkim/* - chmod 0700 /etc/opendkim - -At first, it's a good idea to use the -t which will signal to other mail servers that you are just in testing mode, and that they shouldn't discard emails based on your OpenDKIM signature (yet). You can get your OpenDKIM key from the mail.txt file: - - cat mail.txt - -and then add it to your zone file as TXT record, which should look like this - - mail._domainkey.cloud1984.net. 300 IN TXT v=DKIM1; k=rsa; p=MIGfMA0GCSqG... - -Finally, we need to tell postfix to sign outgoing emails. At the end of /etc/postfix/main.cf, add: - - # Now for OpenDKIM: we'll sign all outgoing emails - smtpd_milters = inet:127.0.0.1:8891 - non_smtpd_milters = $smtpd_milters - milter_default_action = accept - -And reload the corresponding services - - service postfix reload - service opendkim restart - -Now let's test if our OpenDKIM public key can be found and matches the private key: - - opendkim-testkey -d jhausse.net -s mail -k mail.private -vvv - -which should return - - opendkim-testkey: key OK - -For this, you may need to wait a bit until the name server has reloaded the zone (on Linode, this happens every 15min). You can use **dig** to check if the zone was reloaded yet. - -If this works, let's test if other servers can validate our OpenDKIM signatures and SPF record. To do this, we can use [Brandon Checkett's email test][34]. To send an email to a test address given to us on [Brandon's webpage][34], we can run the following command on the server - - mail -s CloudCheck ihAdmTBmUH@www.brandonchecketts.com - -On Brandon's webpage, you should then see **result = pass** in the 'DKIM Signature' section, and **Result: pass** in the 'SPF Information' section. If our emails pass this test, just regenerate an OpenDKIM key without the -t switch, upload the new key to the zone file, and retest to still if it still passes the tests. If so, congrats! You just successfully set up OpenDKIM and SPF on your server! - -### Host calendars, contacts, files with Owncloud and set up a webmail with Roundcube ### - -Now that we have a top-notch email server, let's add to it the possibility to store your contacts, calendars, and files in the cloud. These are services that the [Owncloud][35] provides out of the box. While we're at it, we'll also set up a webmail, so you can check email even if you're travelling without electronics, or in case your phone and laptop run out of battery. - -Installing Owncloud is straighforward and is well described [here][36]. On Debian, it boils down to adding the owncloud repository to your apt sources, downloading owncloud's release key and adding it to your apt keyring, and then installing owncloud itself using apt-get: - - echo 'deb http://download.opensuse.org/repositories/isv:/ownCloud:/community/Debian_7.0/ /' >> /etc/apt/sources.list.d/owncloud.list - wget http://download.opensuse.org/repositories/isv:ownCloud:community/Debian_6.0/Release.key - apt-key add - < Release.key - apt-get update - apt-get install apache2 owncloud roundcube - -When prompted for it, choose **dbconfig** and then say you want **roundcube** to use **mysql**. Then, provide the mysql root password and set a good password for the roundcube mysql user. Then, edit the roundcube config file **/etc/roundcube/main.inc.php** so that logging in on roundcube will default to using your IMAP server: - - $rcmail_config['default_host'] = 'ssl://localhost'; - $rcmail_config['default_port'] = 993; - -Now we will set up the apache2 webserver with SSL so that we can talk to Owncloud and Roundcube using encryption for our passwords and data. Let's turn on Apache's ssl module: - - a2enmod ssl - -and edit **/etc/apache2/ports.conf** to set the following parameters: - -NameVirtualHost *:80 -Listen 80 -ServerName www.jhausse.net - - - # If you add NameVirtualHost *:443 here, you will also have to change - # the VirtualHost statement in /etc/apache2/sites-available/default-ssl - # to - # Server Name Indication for SSL named virtual hosts is currently not - # supported by MSIE on Windows XP. - NameVirtualHost *:443 - Listen 443 - - - - Listen 443 - - -We'll set up a default website for encrypted connections to the webserver as **https://www.jhausse.net** under **/var/www**. Edit **/etc/apache2/sites-available/default-ssl**: - - - ServerAdmin webmaster@localhost - - DocumentRoot /var/www - ServerName www.jhausse.net - [...] - - Deny from all - - [...] - SSLCertificateFile /etc/ssl/certs/cloud.crt - SSLCertificateKeyFile /etc/ssl/private/cloud.key - [...] - - -and let's also set up a website for unencrypted connections to **http://www.jhausse.net** under **/var/www**. Edit **/etc/apache2/sites-available/default**: - - - DocumentRoot /var/www - ServerName www.jhausse.net - [...] - - Deny from all - - - -That way, we can serve pages for www.jhausse.net by putting them in /var/www. The 'Deny from all' directive prevents access to Owncloud through www.jhausse.net: we will set it up to access it through **https://cloud.jhausse.net** instead. - -We will now set up the webmail (roundcube) so that it will be accessed through **https://webmail.jhausse.net**. Edit **/etc/apache2/sites-available/roundcube** to have the following content: - - - - ServerAdmin webmaster@localhost - - DocumentRoot /var/lib/roundcube - # The host name under which you'd like to access the webmail - ServerName webmail.jhausse.net - - Options FollowSymLinks - AllowOverride None - - - ErrorLog ${APACHE_LOG_DIR}/error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - LogLevel warn - - CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined - - # SSL Engine Switch: - # Enable/Disable SSL for this virtual host. - SSLEngine on - - # do not allow unsecured connections - # SSLRequireSSL - SSLCipherSuite HIGH:MEDIUM - - # A self-signed (snakeoil) certificate can be created by installing - # the ssl-cert package. See - # /usr/share/doc/apache2.2-common/README.Debian.gz for more info. - # If both key and certificate are stored in the same file, only the - # SSLCertificateFile directive is needed. - SSLCertificateFile /etc/ssl/certs/cloud.crt - SSLCertificateKeyFile /etc/ssl/private/cloud.key - - # Those aliases do not work properly with several hosts on your apache server - # Uncomment them to use it or adapt them to your configuration - Alias /program/js/tiny_mce/ /usr/share/tinymce/www/ - - # Access to tinymce files - - Options Indexes MultiViews FollowSymLinks - AllowOverride None - Order allow,deny - allow from all - - - - Options +FollowSymLinks - # This is needed to parse /var/lib/roundcube/.htaccess. See its - # content before setting AllowOverride to None. - AllowOverride All - order allow,deny - allow from all - - - # Protecting basic directories: - - Options -FollowSymLinks - AllowOverride None - - - - Options -FollowSymLinks - AllowOverride None - Order allow,deny - Deny from all - - - - Options -FollowSymLinks - AllowOverride None - Order allow,deny - Deny from all - - - - SSLOptions +StdEnvVars - - - SSLOptions +StdEnvVars - - # SSL Protocol Adjustments: - # The safe and default but still SSL/TLS standard compliant shutdown - # approach is that mod_ssl sends the close notify alert but doesn't wait for - # the close notify alert from client. When you need a different shutdown - # approach you can use one of the following variables: - # o ssl-unclean-shutdown: - # This forces an unclean shutdown when the connection is closed, i.e. no - # SSL close notify alert is send or allowed to received. This violates - # the SSL/TLS standard but is needed for some brain-dead browsers. Use - # this when you receive I/O errors because of the standard approach where - # mod_ssl sends the close notify alert. - # o ssl-accurate-shutdown: - # This forces an accurate shutdown when the connection is closed, i.e. a - # SSL close notify alert is send and mod_ssl waits for the close notify - # alert of the client. This is 100% SSL/TLS standard compliant, but in - # practice often causes hanging connections with brain-dead browsers. Use - # this only for browsers where you know that their SSL implementation - # works correctly. - # Notice: Most problems of broken clients are also related to the HTTP - # keep-alive facility, so you usually additionally want to disable - # keep-alive for those clients, too. Use variable "nokeepalive" for this. - # Similarly, one has to force some clients to use HTTP/1.0 to workaround - # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and - # "force-response-1.0" for this. - BrowserMatch "MSIE [2-6]" \ - nokeepalive ssl-unclean-shutdown \ - downgrade-1.0 force-response-1.0 - # MSIE 7 and newer should be able to use keepalive - BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown - - - -and declare the server in your DNS, for instance: - - webmail.jhausse.net. 300 IN CNAME cloud.jhausse.net. - -Now let's enable these three websites - - a2ensite default default-ssl roundcube - service apache2 restart - -and the webmail, accessible under **https://webmail.jhausse.net**, should basically work. Log in using the full email (e.g. roudy@jhausse.net) and the password you set in mailserver DB at the beginning of this article. The first time you connect, the browser will warn you that the certificate was not signed by a certification authority. That's fine, just add an exception. - -Last but not least, we will create a virtual host for owncloud by putting the following content in **/etc/apache2/sites-available/owncloud**: - - - - ServerAdmin webmaster@localhost - - DocumentRoot /var/www/owncloud - ServerName cloud.jhausse.net - - Options FollowSymLinks - AllowOverride None - - - Options Indexes FollowSymLinks MultiViews - AllowOverride All - Order allow,deny - allow from all - - - ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ - - AllowOverride None - Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch - Order allow,deny - Allow from all - - - ErrorLog ${APACHE_LOG_DIR}/error.log - - # Possible values include: debug, info, notice, warn, error, crit, - # alert, emerg. - LogLevel warn - - CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined - - # SSL Engine Switch: - # Enable/Disable SSL for this virtual host. - SSLEngine on - - # do not allow unsecured connections - # SSLRequireSSL - SSLCipherSuite HIGH:MEDIUM - SSLCertificateFile /etc/ssl/certs/cloud.crt - SSLCertificateKeyFile /etc/ssl/private/cloud.key - - - SSLOptions +StdEnvVars - - - SSLOptions +StdEnvVars - - - BrowserMatch "MSIE [2-6]" \ - nokeepalive ssl-unclean-shutdown \ - downgrade-1.0 force-response-1.0 - # MSIE 7 and newer should be able to use keepalive - BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown - - - -and activate owncloud by running - - a2ensite owncloud - service apache2 reload - -Then go ahead an configure owncloud by connecting to **https://cloud.jhausse.net/** in a web browswer. - -That's it! Now you've got your own Google Drive, Calendar, Contacts, Dropbox, and Gmail! Enjoy your freshly recovered privacy! :-) - -### Sync your devices to the cloud ### - -To sync your emails, you can just use your favorite email client: the standard email program on Android or iOS, [k9mail][37], or Thunderbird on your PC. Or you can also use the webmail we set up. - -How to sync your calendar and contacts with the cloud is described in the doc of owncloud. On Android, I'm using the CalDAV-Sync and CardDAV-Sync apps which act as bridges between the Android calendar and contacts apps of the phone and the owncloud server. - -For files, there is an Android app called Owncloud to access your files from your phone and automatically upload pictures and videos you take to your cloud. Accessing your files on the your Mac/PC is easy and [well described in the Owncloud documentation][38]. - -### Last tips ### - -During the first few weeks, it's a good idea to monitor **/var/log/syslog** and **/var/log/mail.log** on a daily basis and make sure everything everything is running smoothly. It's important to do so before you invite others (friends, family, ...) to be hosted on your server; you might loose their trust in self-hosting for good if they trust you with their data and the server suddently becomes unavailable. - -To add another email user, just add a row to the **virtual_users** table of the **mailserver** DB. - -To add a domain, just add a row to the **virtual_domains** table. Then update **/etc/opendkim/SigningTable** to get outgoing emails signed, upload the OpenDKIM key to the zone, and reload OpenDKIM. - -Owncloud has its own user DB which can be managed by logging in in Owncloud as administrator. - -Finally, it's important to think in advance of a solution in case your server becomes temporarily unavailable. For instance, where would your mails go until your server returns? One solution would be to find a friend who can act as your backup MX, while you act as his backup MX (see the **relay_domains** and **relay_recipient_maps** setting in Postfix's **main.cf** file). Similarly, what if your server is compromised and a malicious individual erases all your files there? For that, it's important to think of a regular backup system. Linode offers backups as an option. On 1984.is, I set up a basic but sufficient automatic backup system using on crontabs and scp. - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/ - -作者:[Roudy Jhausse ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:aboutlinux@free.fr -[1]:https://history.google.com/history/ -[2]:http://research.google.com/workatgoogle.html -[3]:http://www.attac.org/ -[4]:http://www.nytimes.com/2012/02/19/magazine/shopping-habits.html?pagewanted=all -[5]:http://vimeo.com/ondemand/termsandconditions -[6]:http://www.techtimes.com/articles/21670/20141208/sony-pictures-hack-nightmare-week-celebs-data-leak-and-threatening-emails-to-employees.htm -[7]:http://blog.backupify.com/2012/07/25/what-is-my-gmail-account-really-worth/ -[8]:http://adage.com/article/digital/worth-facebook-google/293042/ -[9]:http://vimeo.com/ondemand/termsandconditions -[10]:https://prism-break.org/en/ -[11]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#VPS -[12]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#mail -[13]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#dspam -[14]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#SPF -[15]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#owncloud -[16]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#sync -[17]:http://linuxfr.org/news/heberger-son-courriel -[18]:http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/ -[19]:http://www.1984.is/ -[20]:http://www.linode.com/ -[21]:http://www.greenpeace.org/international/Global/international/publications/climate/2012/iCoal/HowCleanisYourCloud.pdf -[22]:http://www.1984.is/about/ -[23]:http://www.fsf.org/ -[24]:https://www.gnupg.org/ -[25]:http://www.gandi.net/ -[26]:http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html -[27]:http://www.postfix.org/ -[28]:http://postgrey.schweikert.ch/ -[29]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#testPort25 -[30]:http://dspam.sourceforge.net/ -[31]:http://www.microsoft.com/mscorp/safety/content/technologies/senderid/wizard/ -[32]:https://www.howtoforge.com/tutorial/build-your-own-cloud-on-debian-wheezy/#PTR -[33]:http://opendkim.org/opendkim-README -[34]:http://www.brandonchecketts.com/emailtest.php -[35]:http://owncloud.org/ -[36]:http://owncloud.org/install/ -[37]:https://code.google.com/p/k9mail/ -[38]:http://doc.owncloud.org/server/7.0/user_manual/files/files.html diff --git a/sources/tech/20150119 How to Install Cherokee Lightweight Web Server on Ubuntu 14.04.md b/sources/tech/20150119 How to Install Cherokee Lightweight Web Server on Ubuntu 14.04.md deleted file mode 100644 index 1e2ba90d6e..0000000000 --- a/sources/tech/20150119 How to Install Cherokee Lightweight Web Server on Ubuntu 14.04.md +++ /dev/null @@ -1,87 +0,0 @@ -How to Install Cherokee Lightweight Web Server on Ubuntu 14.04 -================================================================================ -**Cherokee** is an free and open source high performance, lightweight, full-featured web server and running on major platform (Linux, Mac OS X, Solaris, and BSD). It is compatible with TLS/SSL,FastCGI, SCGI, PHP, uWSGI, SSI, CGI, LDAP, HTTP proxying, video streaming, content caching, traffic shaping, virtual hosts, Apache compatible log files, and load balancing. - -Today we'll explains how to install and configure the Light Weight Cherokeeweb server on Ubuntu Server edition 14.04 LTS (Trusty) and should also work with 12.04, 12.10 and 13. 04, just skip the modification of source list. - -Step by step install and configure the Cherokee web server on Ubuntu Server edition - -### 1. Updating Ubuntu Package Index ### - -First, Login into Ubuntu Server and make sure your ubuntu server update, run the following commands one by one, and install any available updates: - - sudo apt-get update - - sudo apt-get upgrade - -### 2. Adding PPA ### - -Add the PPA cherokee webserver. by running the following commands - - sudo add-apt-repository ppa:cherokee-webserver - - sudo apt-get update - -Now, only for servers running Ubuntu 14.04 LTS (Trusty) follow this step below - - cd /etc/apt/sources.list.d - - nano cherokee-webserver-ppa-trusty.list - - replace: - - deb http://ppa.launchpad.net/cherokee-webserver/ppa/ubuntu trusty main - - to: - - deb http://ppa.launchpad.net/cherokee-webserver/ppa/ubuntu saucy main - -**then again run:** - - sudo apt-get update - -### 3. Installing Cherokee Web Server using apt-get ### - -Enter the following command to install the Cherokee web server including Module SSL - - sudo apt-get install cherokee cherokee-admin cherokee-doc libcherokee-mod-libssl libcherokee-mod-streaming libcherokee-mod-rrd - -### 4. Configuring Cherokee ### - - sudo service cherokee start - -The best part about using its Web Server is being able to manage all of its configurations through a simple to use web interface. This interface, known as cherokee-admin, is the recommended means of administering cherokee web server through web browser. Start cherokee-admin by running the following command: - - sudo cherokee-admin - -**Note: The cherokee-admin will display the administration user name, One-time Password and administration web interface.** - -**Note down your One-Time password. You will need this when you login to its admin web interface.** - -By default, cherokee-admin can only accessed from localhost. If you need to access the admin for other network address using the parameter ‘**-b**’. If you doesn’t mention any ip address, it will automatically listen to all network interfaces. Then you can connect to cherokee-admin from other network address. - - sudo cherokee-admin -b - -If you need to access its admin from specific network address - - sudo cherokee-admin -b 192.168.1.102 - -### 5. Browse your Cherokee Admin Panel ### - -Now you can access the administration panel from you favorite browser by typing http://hostname_or_IP:9090/ for me its http://127.0.0.1:9090/, it will appear on your browser like this: - -![cherokee-admin-panel](http://blog.linoxide.com/wp-content/uploads/2014/12/cherokee-admin.png) - -Hurray, we have successfully installed and configured Cherokee Web Server in our Ubuntu Server. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/ubuntu-how-to/install-cherokee-lightweight-web-server-ubuntu-14-04/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/sources/tech/20150119 How to Remember and Restore Running Applications on Next Logon.md b/sources/tech/20150119 How to Remember and Restore Running Applications on Next Logon.md deleted file mode 100644 index 457d6788e2..0000000000 --- a/sources/tech/20150119 How to Remember and Restore Running Applications on Next Logon.md +++ /dev/null @@ -1,97 +0,0 @@ -How to Remember and Restore Running Applications on Next Logon -================================================================================ -You have made some apps running in your Ubuntu and don't want to stop the process, just managed your windows and opened your stuffs needed to work. Then, something else demands your attention or you have battery low in your machine and you have to shut down. No worries. You can have Ubuntu remember all your running applications and restore them the next time you log in. - -Now, to make our Ubuntu remember the applications you have running in our current session and restore them the next time our log in, We will use the dconf-editor. This tool replaces the gconf-editor available in previous versions of Ubuntu but is not available by default. To install the dconf-editor, you need to run sudo apt-get install dconf-editor. - - $ sudo apt-get install dconf-tools - -Once the dconf-editor is installed, you can open dconf-editor from Application Menu. Or you can run it from terminal or run command (alt+f2): - - $ dconf-editor - -In the “dconf Editor” window, click the right arrow next to “org” in the left pane to expand that branch of the tree. - -![Dconf Editor Apps, org](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor-clicking-org-300x146.png) - -Under “org”, click the right arrow next to “gnome.” - -![dconf editor clicking gnome](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor-clicking-gnome.png) - -Under “gnome,” click “gnome-session”. In the right pane, select the “auto-save-session” check box to turn on the option. - -![dconf-editor selecting auto save session](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor_selecting_auto_save_session.png) - -After you check or tick it, close the “Dconf Editor” by clicking the close button (X) in the upper-left corner of the window which is by default. - -![dconf-editor closing dconf editor](http://blog.linoxide.com/wp-content/uploads/2015/01/dconf-editor_closing_dconf_editor.png) - -The next time you log out and log back in, all of your running applications will be restored. - -Hurray, we have successfully configured our Ubuntu 14.04 LTS "Trusty" to remember automatically running applications from our last session. - -Now, on this same tutorial, we'll gonna also learn **how to enable hibernation in our Ubuntu 14.04 LTS**: - -Before getting started, press Ctrl+ALt+T on your keyboard to open the terminal. When it opens, run: - - sudo pm-hibernate - -After your computer turns off, switch it back on. Did your open applications re-open? If hibernate doesn’t work, check if your swap partition is at least as large as your available RAM. - -You can check your Swap Area Partition Size from System Monitor, you can get it from the App Menu or run command in terminal. - - $ gnome-system-monitor - -### Enable Hibernate in System Tray Menu: ### - -The indicator-session was updated to use logind instead of upower. Hibernate is disabled by default in both upower and logind. - -To re-enable hibernate, run the commands below one by one to edit the config file: - - sudo -i - - cd /var/lib/polkit-1/localauthority/50-local.d/ - - gedit com.ubuntu.enable-hibernate.pkla - -**Tips: if the config file does not work for you, try another one by changing /var/lib to /etc in the code.** - -Copy and paste below lines into the file and save it. - - [Re-enable hibernate by default in upower] - Identity=unix-user:* - Action=org.freedesktop.upower.hibernate - ResultActive=yes - - [Re-enable hibernate by default in logind] - Identity=unix-user:* - Action=org.freedesktop.login1.hibernate - ResultActive=yes - -Restart your computer and done. - -### Hibernate your laptop when lid is closed: ### - -1.Edit “/etc/systemd/logind.conf” via command: - - $ sudo nano /etc/systemd/logind.conf - -2. Change the line **#HandleLidSwitch=suspend to HandleLidSwitch=hibernate** and save the file. - -3. Run command below or just restart your computer to apply changes: - - $ sudo restart systemd-logind - -That’s it. Enjoy! Now, we have both dconf and hibernation on :) Now, your Ubuntu will completely remember your opened apps and stuffs. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/ubuntu-how-to/remember-running-applications-ubuntu/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ \ No newline at end of file diff --git a/sources/tech/20150119 Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen.md b/sources/tech/20150119 Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen.md deleted file mode 100644 index 1aac09e11a..0000000000 --- a/sources/tech/20150119 Unity Greeter Badges Brings Missing Session Icons to Ubuntu Login Screen.md +++ /dev/null @@ -1,58 +0,0 @@ -‘Unity Greeter Badges’ Brings Missing Session Icons to Ubuntu Login Screen -================================================================================ -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/unity-greeter-badges-750x321.jpg) - -**A new package available in Ubuntu 15.04 solves a petty gripe I have with the Unity Greeter: the lack of branded icons for alternative desktop sessions like Cinnamon.** - -I know it’s a minor quibble; it’s a visual paper cut with minimal impact for most. But the inconsistency niggles me because Ubuntu ships with icons for a number of sessions, including Unity, GNOME and KDE. Other DEs, including some of its own flavors like Xubuntu, default to showing a plain white dot in the session switcher list and the main user pod. - -The inconsistency these dots create jars, even if it is only for a fleeting moment, not just in design. It’s in usability too. Branded glyphs are helpful in letting us know what session we’re about to log in to. - -For instance, can you tell what session this is? - -![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/what-session-is-this-750x247.jpg) - -Budgie? Maybe MATE? Could be Cinnamon…I’d have to click on it and check first. - -It doesn’t have to be this way. The Unity Greeter is built such that the developers of desktop environments can ship badges that appear in the Greeter (and some do). But in many cases, like MATE whose packages are imported from upstream Debian, the inclination to carry an “Ubuntu-specific patch” is either not desirable or not possible. - -### A Solution Is Badged ### - -Experienced Debian maintainer [Doug Torrance][1] has a solution to fix this usability paper cut. Rather than rely on desktop makers themselves to add branded badges to their packages, and rather than burden Ubuntu with the responsibility of maintaining it, Torrance has created a separate ‘unity-greeter-badges’ package to house them. - -In assuming responsibility for providing the session glyphs directly, this package ensure that new and old window managers, session and desktops alike are catered for. - -Among the 30 or so desktop environments it bundles new session badges for are: - -- Xubuntu -- Cinnamon -- MATE -- Cairo-Dock -- Xmonad -- Awesome -- OpenBox -- Pantheon - -The best part is that ‘**Unity-Greeter-Badges**’ has been accepted into Ubuntu 15.04. That means Torrance’s package will be available to install directly, no PPAs or downloads needed. In not being part of a core package like the Unity Greeter it can be updated with newer icons in a more efficient and timely manner. - -If you’re running Ubuntu 15.04 you will find the package available to install from the Software Center in the coming days. - -Don’t want to wait until 15.04? Torrance has made .deb installers for Ubuntu 14.04 LTS and Ubuntu 14.10 users. - -- [Download unity-greeter-badges for Ubuntu 14.04][2] -- [Download unity-greeter-badges for Ubuntu 14.10][3] - --------------------------------------------------------------------------------- - -via: http://www.omgubuntu.co.uk/2015/01/unity-greeter-badges-brings-missing-session-icons-ubuntu-login-screen - -作者:[Joey-Elijah Sneddon][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://plus.google.com/117485690627814051450/?rel=author -[1]:https://launchpad.net/~profzoom -[2]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.04.1_all.deb -[3]:https://launchpad.net/~profzoom/+archive/ubuntu/misc/+files/unity-greeter-badges_0.1-0ubuntu1%7E201412111501%7Eubuntu14.10.1_all.deb \ No newline at end of file diff --git a/sources/tech/20150121 How to Monitor Network Usage with nload in Linux.md b/sources/tech/20150121 How to Monitor Network Usage with nload in Linux.md deleted file mode 100644 index afbfa4eab6..0000000000 --- a/sources/tech/20150121 How to Monitor Network Usage with nload in Linux.md +++ /dev/null @@ -1,206 +0,0 @@ -How to Monitor Network Usage with nload in Linux -================================================================================ -nload is a free linux utility that can help the linux user or sysadmin to monitor network traffic and bandwidth usage in real time by providing two simple graphs: one per incoming traffic and one for outgoing traffic. - -I really like to use **nload** to display information on my screen about the current download speed, the total incoming traffic, and the average download speed. The graphs reported by nload tool are very easy to interpret and what is the most important thing they are very helpful. - -According to the manual pages it monitors all network devices by default, but you can easily specify the device you want to monitor and also switch between different network devices using the arrow keys. There are many options avaliable such as -t to determine refresh interval of the display in milliseconds (the default value of interval is 500), -m to show multiple devices at the same time(traffic graphs are not shown when this option is used), -u to set the type of unit used for the display of traffic numbers and many others that we are going to explore and practise in this tutorial. - -### How to install nload on your linux machine ### - -**Ubuntu** and **Fedora** users can easily install nload from the default repositories. - -Install nload on Ubuntu by using the following command. - - sudo apt-get install nload - -Install nload on Fedora by using the following command. - - sudo yum install nload - -What about **CentOS** users? Just type the following command on your machine and you will get nload installed. - - sudo yum install nload - -The following command will help you to install nload on OpenBSD systems. - - sudo pkg_add -i nload - -A very effective way to install software on linux machine is to compile by source as you can download and install the latest version which usually means better performance, cool features and less bugs. - -### How to install nload from source ### - -The first thing you need to do before installing nload from source you need to download it and to do this I like to use the wget uility which is available by default on many linux machines. This free utility helps linux users to download files from the web in a non-interactive way and has support for the following protocols. - -- HTTP -- HTTPS -- FTP - -Change directory to **/tmp** by using the following command. - - cd /tmp - -Now type the following command in your terminal to download the latest version of nload on your linux machine. - - wget http://www.roland-riegel.de/nload/nload-0.7.4.tar.gz - -If you don't like to use the linux wget utility you can easily download it from the [official][1] source by just a mouse click. - -The download will finish in no time as it is a small software. The next step is to untar the file you downloaded with the help of the **tar** utility. - -The tar archiving utility can be used to store and extract files from a tape or disk archive. There are many options available in this tool but we need the followings to perform our operation: - -1. **-x** to extract files from an archive -1. **-v** to run in verbose mode -1. **-f** to specify the files - -For example: - - tar xvf example.tar - -Now that you learned how to use the tar utility I am very sure you know how to untar .tar archives from the commandline. - - tar xvf nload-0.7.4.tar.gz - -Then use the cd command to change directory to nload*. - - cd nload* - -It looks like this on my system. - - oltjano@baby:/tmp/nload-0.7.4$ - -Now run the command - - ./configure - -to to configure the package for your system. - - ./configure - -Alot of stuff is going to be displayed on your screen. The following screenshot demonstrates how it is going to look like. - -![configuring packages for nload](http://blog.linoxide.com/wp-content/uploads/2015/01/nload1.png) - -Then compile the nload with the following command. - - make - -![compiling nload](http://blog.linoxide.com/wp-content/uploads/2015/01/nload2.png) - -And finally install nload on your linux machine with the following command. - - sudo make install - -![installing nload from source](http://blog.linoxide.com/wp-content/uploads/2015/01/nload3.png) - -Now that the installation of nload is finished it is time for you to learn how to use it. - -### How to use nload ### - -I like to explore so type the following command on your terminal. - - nload - -What do you see? - -I get the following. - -![running nload](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.png) - -As you can see from the above screenshot I get information on: - -### Incoming Traffic ### - -#### Current download speed #### - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.1.png) - -#### Average download speed #### - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.2.png) - -#### Minimum download speed #### - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.3.png) - -#### Maximum download speed #### - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.4.png) - -#### Total incoming traffic in bytes by default #### - -![](http://blog.linoxide.com/wp-content/uploads/2015/01/nload4.5.png) - -### Outgoing Traffic ### - -The same goes for outgoing traffic. - -#### Some useful options of nload #### - -Use the option - - -u - -to set set the type of unit used for the display of traffic numbers. - -The following command will help you to use the MBit/s unit. - - nload -u m - -The following screenshot shows the result of the above command. - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload5.png) - -Try the following command and see the results. - - nload -u g - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload6.png) - -There is also the option **-U**. According to the manual pages it is same as the option -u but only for an amount of data. I tested this option and to be honest it very helpful when you want to check the total amount of traffic be it incoming or outgoing. - - nload -U G - -![nload running on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload7.png) - -As you can see from the above screenshot the command **nload -U G** helps to display the total amount of data (incoming or outgoing) in Gbyte. - -Another useful option I like to use with nload is the option **-t**. This option is used to refresh interval of display in milliseconds which is 500 by default. - -I like to experiment a little by using the following command. - - nload -t 130 - -So what the above command does is that it sets the display to refresh every 130 milliseconds. It is recommended to no specify refresh intervals shorter than about 100 milliseconds as nload will generate reports with mistakes during the calculations. - -Another option is **-a**. It is used when you want to set the length in seconds of the time window for average calculation which is 300 seconds by default. - -What if you want to monitor a specific network device? It is very easy to do that, just specify the device or the list of devices you want to monitor like shown below. - - nload wlan0 - -![nload monitoring wlan0 on linux](http://blog.linoxide.com/wp-content/uploads/2015/01/nload8.png) - -The following syntax can help to monitor specific multiple devices. - - nload [options] device1 device2 devicen - -For example use the following command to monitor eth0 and wlan0. - - nload wlan0 eth0 - -And if you run the command nload without any option it will monitor all auto-detected devices, you can display graphs for each one of them by using the right and left arrow keys. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/monitoring-2/monitor-network-usage-nload/ - -作者:[Oltjano Terpollari][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/oltjano/ -[1]:http://www.roland-riegel.de/nload/nload-0.7.4.tar.gz \ No newline at end of file diff --git a/sources/tech/20150121 How to apply image effects to pictures on Raspberry Pi.md b/sources/tech/20150121 How to apply image effects to pictures on Raspberry Pi.md deleted file mode 100644 index 920f542832..0000000000 --- a/sources/tech/20150121 How to apply image effects to pictures on Raspberry Pi.md +++ /dev/null @@ -1,69 +0,0 @@ -How to apply image effects to pictures on Raspberry Pi -================================================================================ -Like a common pocket camera which has a built-in function to add various effects on captured photos, [Raspberry Pi camera board][1] ("raspi cam") can actually do the same. With the help of raspistill camera control options, we can add the image effects function like we have in a pocket camera. - -There are [three comman-line applications][2] which can be utilized for [taking videos or pictures][3] with raspi cam, and one of them is the raspistill application. The raspistill tool offers various camera control options such as sharpness, contrast, brightness, saturation, ISO, exposure, automatic white balance (AWB), image effects. - -In this article I will show how to apply exposure, AWB, and other image effects with raspistill while capturing pictures using raspi cam. To automate the process, I wrote a simple Python script which takes pictures and automatically applies a series of image effects to the pictures. The raspi cam documentation describes available types of the exposure, AWB, and image effects. In total, the raspi cam offers 16 types of image effects, 12 types of exposure, and 10 types of AWB values. - -The simple Python script looks like the following. - - #!/usb/bin/python - import os - import time - import subprocess - list_ex=['auto','night'] - list_awb=['auto','cloud',flash'] - list_ifx=['blur','cartoon','colourswap','emboss','film','gpen','hatch','negative','oilpaint','posterise','sketch','solarise','watercolour'] - x=0 - for ex in list_ex: - for awb in list_awb: - for ifx in list_ifx: - x=x+1 - filename='img_'+ex+'_'+awb+'_'+ifx+'.jpg' - cmd='raspistill -o '+filename+' -n -t 1000 -ex '+ex+' -awb '+awb+' -ifx '+ifx+' -w 640 -h 480' - pid=subprocess.call(cmd,shell=True) - print "["+str(x)+"]-"+ex+"_"+awb+"_"+ifx+".jpg" - time.sleep(0.25) - print "End of image capture" - -The Python script operates as follows. First, create three array/list variable for the exposure, AWB and image effects. In the example, we use 2 types of exposure, 3 types of AWB, and 13 types of image effects values. Then make nested loops for applying the value of the three variables that we have. Inside the nested loop, execute the raspistill application. We specify (1) the output filename; (2) exposure value; (3) AWB value; (4) image effect value; (5) the time to take a photo, which is set to 1 second; and (6) the size of the photo, which is set to 640x480px. This Python script will create 78 different versions of a captured photo with a combination of 2 types of exposure, 3 types of AWB, and 13 types of image effects. - -To execute the Python script, simply type: - - $ python name_of_this_script.py - -Here is the first round of the sample result. - -![](https://farm8.staticflickr.com/7483/16134215939_c93291158a_c.jpg) - -### Bonus ### - -For those who are more interested, there is another way to access and control the raspi cam besides raspistill. [Picamera][4] a pure Python interface which provides APIs for accessing and controlling raspi cam, so that one can build a complex program for utilizing raspi cam according to their needs. If you are skilled at Python, picamera is a good feature-complete interface for implementing your raspi cam project. The picamera interface is included by default in the recent image of Raspbian. If your [Raspberry Pi][5] operating system is not new or not Raspbian, you can install it on your system as follows. - -First, install pip on your system by following [this guideline][6]. - -Then, install picamera as follows. - - $ sudo pip install picamera - -Refer to the [official documentation][7] on how to use picamera. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/apply-image-effects-pictures-raspberrypi.html - -作者:[Kristophorus Hadiono][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/kristophorus -[1]:http://xmodulo.com/go/picam -[2]:http://www.raspberrypi.org/documentation/usage/camera/raspicam/ -[3]:http://xmodulo.com/install-raspberry-pi-camera-board.html -[4]:https://pypi.python.org/pypi/picamera -[5]:http://xmodulo.com/go/raspberrypi -[6]:http://ask.xmodulo.com/install-pip-linux.html -[7]:http://picamera.readthedocs.org/ \ No newline at end of file diff --git a/sources/tech/20150122 Linux FAQs with Answers--How to use yum to download a RPM package without installing it.md b/sources/tech/20150122 Linux FAQs with Answers--How to use yum to download a RPM package without installing it.md deleted file mode 100644 index f1663888c8..0000000000 --- a/sources/tech/20150122 Linux FAQs with Answers--How to use yum to download a RPM package without installing it.md +++ /dev/null @@ -1,56 +0,0 @@ -Linux FAQs with Answers--How to use yum to download a RPM package without installing it -================================================================================ -> **Question**: I want to download a RPM package from Red Hat's standard repositories. Can I use yum command to download a RPM package without installing it? - -yum is the default package manager for Red Hat based systems, such as CentOS, Fedora or RHEL. Using yum, you can install or update a RPM package while resolving its package dependencies automatically. What if you want to download a RPM package without installing it on the system? For example, you may want to archive some RPM packages for later use or to install them on another machine. - -Here is how to download a RPM package from yum repositories. - -### Method One: Yum ### - -The yum command itself can be used to download a RPM package. The standard yum command offers '--downloadonly' option for this purpose. - - $ sudo yum install --downloadonly - -By default, a downloaded RPM package will be saved in: - - /var/cache/yum/x86_64/[centos/fedora-version]/[repository]/packages - -In the above, [repository] is the name of the repository (e.g., base, fedora, updates) from which the package is downloaded. - -If you want to download a package to a specific directory (e.g., /tmp): - - $ sudo yum install --downloadonly --downloaddir=/tmp - -Note that if a package to download has any unmet dependencies, yum will download all dependent packages as well. None of them will be installed. - -One important thing is that on CentOS/RHEL 6 or earlier, you will need to install a separate yum plugin (called yum-plugin-downloadonly) to be able to use '--downloadonly' command option: - - $ sudo yum install yum-plugin-downloadonly - -Without this plugin, you will get the following error with yum: - - Command line error: no such option: --downloadonly - -![](https://farm9.staticflickr.com/8627/15571201803_38390aae75_c.jpg) - -### Method Two: Yumdownloader ### - -Another method to download a RPM package is via a dedicated package downloader tool called yumdownloader. This tool is part of yum-utils package which contains a suite of helper tools for yum package manager. - - $ sudo yum install yum-utils - -To download a RPM package: - - $ sudo yumdownloader - -The downloaded package will be saved in the current directory. You need to use root privilege because yumdownloader will update package index files during downloading. Unlike yum command above, none of the dependent package(s) will be downloaded. - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/yum-download-rpm-package.html - -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/sources/tech/20150123 How to make a file immutable on Linux.md b/sources/tech/20150123 How to make a file immutable on Linux.md deleted file mode 100644 index 7d46d1de68..0000000000 --- a/sources/tech/20150123 How to make a file immutable on Linux.md +++ /dev/null @@ -1,74 +0,0 @@ -Translating by Medusar - -How to make a file immutable on Linux -================================================================================ -Suppose you want to write-protect some important files on Linux, so that they cannot be deleted or tampered with by accident or otherwise. In other cases, you may want to prevent certain configuration files from being overwritten automatically by software. While changing their ownership or permission bits on the files by using chown or chmod is one way to deal with this situation, this is not a perfect solution as it cannot prevent any action done with root privilege. That is when chattr comes in handy. - -chattr is a Linux command which allows one to set or unset attributes on a file, which are separate from the standard (read, write, execute) file permission. A related command is lsattr which shows which attributes are set on a file. While file attributes managed by chattr and lsattr are originally supported by EXT file systems (EXT2/3/4) only, this feature is now available on many other native Linux file systems such as XFS, Btrfs, ReiserFS, etc. - -In this tutorial, I am going to demonstrate how to use chattr to make files immutable on Linux. - -chattr and lsattr commands are a part of e2fsprogs package which comes pre-installed on all modern Linux distributions. - -Basic syntax of chattr is as follows. - - $ chattr [-RVf] [operator][attribute(s)] files... - -The operator can be '+' (which adds selected attributes to attribute list), '-' (which removes selected attributes from attribute list), or '=' (which forces selected attributes only). - -Some of available attributes are the following. - -- **a**: can be opened in append mode only. -- **A**: do not update atime (file access time). -- **c**: automatically compressed when written to disk. -- **C**: turn off copy-on-write. -- **i**: set immutable. -- **s**: securely deleted with automatic zeroing. - -### Immutable Attribute ### - -To make a file immutable, you can add "immutable" attribute to the file as follows. For example, to write-protect /etc/passwd file: - - $ sudo chattr +i /etc/passwd - -Note that you must use root privilege to set or unset "immutable" attribute on a file. Now verify that "immutable" attribute is added to the file successfully. - - $ lsattr /etc/passwd - -Once the file is set immutable, this file is impervious to change for any user. Even the root cannot modify, remove, overwrite, move or rename the file. You will need to unset the immutable attribute before you can tamper with the file again. - -To unset the immutable attribute, use the following command: - - $ sudo chattr -i /etc/passwd - -![](https://farm9.staticflickr.com/8613/16152651317_076a65cf50_b.jpg) - -If you want to make a whole directory (e.g., /etc) including all its content immutable at once recursively, use "-R" option: - - $ sudo chattr -R +i /etc - -### Append Only Attribute ### - -Another useful attribute is "append-only" attribute which forces a file to grow only. You cannot overwrite or delete a file with "append-only" attribute set. This attribute can be useful when you want to prevent a log file from being cleared by accident. - -Similar to immutable attribute, you can turn a file into "append-only" mode by: - - $ sudo chattr +a /var/log/syslog - -Note that when you copy an immutable or append-only file to another file, those attributes will not be preserved on the newly created file. - -### Conclusion ### - -In this tutorial, I showed how to use chattr and lsattr commands to manage additional file attributes to prevent (accidental or otherwise) file tampering. Beware that you cannot rely on chattr as a security measure as one can easily undo immutability. One possible way to address this limitation is to restrict the availability of chattr command itself, or drop kernel capability CAP_LINUX_IMMUTABLE. For more details on chattr and available attributes, refer to its man page. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/make-file-immutable-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 diff --git a/sources/tech/20150126 Improve system performance by moving your log files to RAM Using Ramlog.md b/sources/tech/20150126 Improve system performance by moving your log files to RAM Using Ramlog.md deleted file mode 100644 index db03257941..0000000000 --- a/sources/tech/20150126 Improve system performance by moving your log files to RAM Using Ramlog.md +++ /dev/null @@ -1,112 +0,0 @@ -Improve system performance by moving your log files to RAM Using Ramlog -================================================================================ -Ramlog act as a system daemon. On startup it creates ramdisk, it copies files from /var/log into ramdisk and mounts ramdisk as /var/log. All logs after that will be updated on ramdisk. Logs on harddrive are kept in folder /var/log.hdd which is updated when ramlog is restarted or stopped. On shutdown it saves log files back to harddisk so logs are consistent. Ramlog 2.x is using tmpfs by default, ramfs and kernel ramdisk are suppored as well. Program rsync is used for log synchronization. - -Note: Logs not saved to harddrive are lost in case of power outage or kernel panic. - -Install ramlog if you have enough of free memory and you want to keep your logs on ramdisk. It is good for notebook users, for systems with UPS or for systems running from flash -- to save some write cycles. - -How it works and what it does: - -1.Ramlog starts among the first daemons (it depends on other daemons you have installed). - -2.Directory /var/log.hdd is created and hardlinked to /var/log. - -3.In case tmpfs (default) or ramfs is used, it is mounted over /var/log - -If kernel ramdisk is used, ramdisk created in /dev/ram9 and it is mounted to /var/log, by default ramlog takes all ramdisk memory specified by kernel argument "ramdisk_size". - -5.All other daemons are started and all logs are updated in ramdisk. Logrotate works on ramdisk as well. - -6.In case ramlog is restarted (by default it is one time per day), directory /var/log.hdd is synchronized with /var/log using rsync. Frequency of the automatic log saves can be controller via cron, by default, the ramlog file is placed into /etc/cron.daily - -7.On shutdown ramlog shuts among the last daemons. - -8. During ramlog stop phase files from /var/log.hdd are synchronized with /var/log -Then /var/log is unmounted, /var/log.hdd is unmounted as well and empty directory /var/log.hdd is deleted. - -**Note:- This article is for advanced users only** - -### Install Ramlog in Ubuntu ### - -First you need to download the .deb package from [here][1] using the following command - - wget http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb - -Now you should be having ramlog_2.0.0_all.deb package install this package using the following command - - sudo dpkg -i ramlog_2.0.0_all.deb - -This will complete the installation now you need to run the following commands - - sudo update-rc.d ramlog start 2 2 3 4 5 . stop 99 0 1 6 . - -#Now update sysklogd in init levels, so it is stopped properly before ramlog is stopped: - - sudo update-rc.d -f sysklogd remove - - sudo update-rc.d sysklogd start 10 2 3 4 5 . stop 90 0 1 6 . - -Now you need to restart your system - - sudo reboot - -After rebooting you need to run ‘ramlog getlogsize' to determine the size of your actual /var/log.Add about 40% to that number to ensure your ramdisk has sufficient size -- this will be the ramdisk size - -Edit your boot manager config file such as /etc/grub.conf, /boot/grub/menu.lst or /etc/lilo.conf and add update the actual kernel by adding kernel paramter ‘ramdisk_size=xxx' where xxx is calculated ramdisk size - -### Configuring Ramlog ### - -Ramlog configuration file is located in /etc/default/ramlog on deb based systems and you can set there below variables: - -Variable (with default value): - -Description: - - RAMDISKTYPE=0 - # Values: - # 0 -- tmpfs (can be swapped) -- default - # 1 -- ramfs (no max size in older kernels, - # cannot be swapped, not SELinux friendly) - # 2 -- old kernel ramdisk - TMPFS_RAMFS_SIZE= - #Maximum size of memory to be used by tmpfs or ramfs. - # The value can be percentage of total RAM or size in megabytes -- for example: - # TMPFS_RAMFS_SIZE=40% - # TMPFS_RAMFS_SIZE=100m - # Empty value means default tmpfs/ramfs size which is 50% of total RAM. - # For more options please check ‘man mount', section ‘Mount options for tmpfs' - # (btw -- ramfs supports size limit in newer kernels - # as well despite man says there are no mount options) - # It has only effect if RAMDISKTYPE=0 or 1 - KERNEL_RAMDISK_SIZE=MAX - #Kernel ramdisk size in kilobytes or MAX to use entire ramdisk. - #It has only effect if RAMDISKTYPE=2 - LOGGING=1 - # 0=off, 1=on Logs can be found in /var/log/ramdisk - LOGNAME=ramlog - # name of the ramlog log file (makes sense if LOGGING=1) - VERBOSE=1 - # 0=off, 1=on (if 1, teststartstop puts detials - # to the logs and it is called after start or stop fails) - -### How to uninstall Ubuntu ### - -Open the terminal and run the following command - - sudo dpkg -P ramlog - -Note: If ramlog was running before you uninstalled it, you should reboot your box to finish uninstallation procedure. - --------------------------------------------------------------------------------- - -via: http://www.ubuntugeek.com/improve-system-performance-by-moving-your-log-files-to-ram-using-ramlog.html - -作者:[ruchi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.ubuntugeek.com/author/ubuntufix -[1]:http://www.tremende.com/ramlog/download/ramlog_2.0.0_all.deb \ No newline at end of file diff --git a/sources/tech/20150126 Installing Cisco Packet tracer in Linux.md b/sources/tech/20150126 Installing Cisco Packet tracer in Linux.md deleted file mode 100644 index edac7a7490..0000000000 --- a/sources/tech/20150126 Installing Cisco Packet tracer in Linux.md +++ /dev/null @@ -1,197 +0,0 @@ -Installing Cisco Packet tracer in Linux -================================================================================ -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Main_picture.png) - -### What is Cisco Packet tracer ? ### - -**Cisco Packet tracer** is a powerful network simulator tool which used to trained while we do some Cisco certifications. It provide us good Interface view for every router’s, and networking devices which with many options same as using the physical machines we can use unlimited devices in a network. We can create multiple network in single project to get trained like a professionals. packet tracer will provide us with simulated application layer protocols such as **HTTP**, **DNS**, Routing with **RIP**, **OSPF**, **EIGRP** etc. - -Now it has been released including **ASA 5505 firewall** with command line configurations. Packet tracer available commonly for Windows, but not for Linux distributions. Here we can download and get install Cisco package tracer. - -#### Newly released version of Cisco packet tracer: #### - -The next Cisco Packet Tracer version will be Cisco Packet Tracer 6.2 currently it’s under development. - -### My Environment Setup: ### - -**Hostname** : desktop1.unixmen.com - -**IP address** : 192.168.0.167 - -**Operating system** : Ubuntu 14.04 LTS Desktop - - # hostname - - # ifconfig | grep inet - - # lsb_release -a - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_001.png) - -### Step 1: First we need to download the Cisco Packet tracer. ### - -To download Packet Tracer from official website we need to have a token, sign into Cisco NetSpace and select CCNA > Cisco Packet Tracer from the Offerings menu to start the download. If we don’t have a token you can get from below link which i have uploaded in Dropbox. - -Official Website: [https://www.netacad.com/][1] - -Many of them don’t have a token to download packet tracer. For that i have uploaded it in dropbox you can get packet tracer from below URL. - -[Download Cisco Packet Tracer 6.1.1][2] - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_002.png) - -### Step 2: Install Java: ### - -To get install packet tracer we need to have install Java, To get install java we can use the default or add the PPA repository and update the package cache to get install java. - -Install the default jre using - - # sudo apt-get install default-jre - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_003.png) - -(or) - -Use the below step to get install Java Run-time and set the Environment. - -Download Java from official website : [Download Java][3] - - # tar -zxvf jre-8u31-linux-x64.tar.gz - - # sudo mkdir -p /usr/lib/jvm - - # sudo mv -v jre1.8.0_31 /usr/lib/jvm/ - - # cd /usr/lib/jvm/ - - # sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jre1.8.0_31/bin/java" 1 - - # sudo update-alternatives --set "java" "/usr/lib/jvm/jre1.8.0_31/bin/java" - -Set the environment for java by editing the profile file and add the location. While we adding in profile file java will available for every user’s in our machine. - - # sudo vi /etc/profile - -Add the following entries to the bottom of your /etc/profile file: - - export JAVA_HOME=/usr/lib/jvm/jre1.8.0_31 - export PATH=$PATH:/usr/java/jre1.8.0_31/bin - -Run the below command to activate java path immediately. - - # . /etc/profile - -Check for the Java version and Environment: - - # echo $JAVA_HOME - - # java -version - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_004.png) - -### Step 3: Enable 32bit architecture support: ### - -For Packet tracer we need some of 32bit packages. To get install 32bit packages we need to install some of dependencies using below commands. - - # sudo dpkg --add-architecture i386 - # sudo apt-get update - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_005.png) - - # sudo apt-get install libc6:i386 - - # sudo apt-get install lib32z1 lib32ncurses5 lib32bz2-1.0 - - # sudo apt-get install libnss3-1d:i386 libqt4-qt3support:i386 libssl1.0.0:i386 libqtwebkit4:i386 libqt4-scripttools:i386 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_006.png) - -### Step 4: Extract and install the package: ### - -Extract the downloaded package using tar command. - - # mv Cisco\ Packet\ Tracer\ 6.1.1\ Linux.tar.gz\?dl\=0 Cisco_Packet_tracer.tar.gz - - # tar -zxvf Cisco_Packet_tracer.tar.gz - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_007.png) - -Navigate to the extracted directory - - # cd PacketTracer611Student - -Now it’s time to start the installation , Installation is very simple and just take few seconds. - - # sudo ./install - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_008.png) - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_009.png) - -To working with Package tracer we need to set the environment for that Cisco have provided the environment script, We need to run the script using root user to set the environment variable. - - # sudo ./set_ptenv.sh - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_010.png) - -That’s it for installation step’s. next we need to create a Desktop Icon for Packet tracer. - -Create the Desktop Icon by creating desktop file under. - - # sudo su - - # cd /usr/share/applications - - # sudo vim packettracer.desktop - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_011.png) - -Append the Below content to the file using vim editor or your favourite one. - - [Desktop Entry] - Name= Packettracer - Comment=Networking - GenericName=Cisco Packettracer - Exec=/opt/packettracer/packettracer - Icon=/usr/share/icons/packettracer.jpeg - StartupNotify=true - Terminal=false - Type=Application - -Save and quit using wq! - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_012.png) - -### Step 5: Run the packet tracer ### - - # sudo packettracer - -That’s it we have successfully installed the packet tracer in Linux, These above steps are suitable for every debian based Linux distributions. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_013.png) - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/pkt_014.png) - -### Resources ### - -Home page:[Netacad][4] - -### Conclusion: ### - -Here we have seen how to install packet tracer in Linux distribution, Hope you have find a way to get install your favorite Simulator in Linux. - --------------------------------------------------------------------------------- - -via: http://www.unixmen.com/installing-cisco-packet-tracer-linux/ - -作者:[babin][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.unixmen.com/author/babin/ -[1]:https://www.netacad.com/ -[2]:https://www.dropbox.com/s/5evz8gyqqvq3o3v/Cisco%20Packet%20Tracer%206.1.1%20Linux.tar.gz?dl=0 -[3]:http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html -[4]:https://www.netacad.com/ \ No newline at end of file diff --git a/sources/tech/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md b/sources/tech/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md deleted file mode 100644 index f39d53a47d..0000000000 --- a/sources/tech/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md +++ /dev/null @@ -1,66 +0,0 @@ -Ping -- Translating - -iptraf: A TCP/UDP Network Monitoring Utility -================================================================================ -[iptraf][1] is an ncurses-based IP LAN monitor that generates various network statistics including TCP info, UDP counts, ICMP and OSPF information, Ethernet load info, node stats, IP checksum errors, and others. - -Its ncurses-based user interface also saves users from remembering command line switches. - -### Features ### - -- An IP traffic monitor that shows information on the IP traffic passing over your network. Includes TCP flag information, packet and byte counts, ICMP details, OSPF packet types. -- General and detailed interface statistics showing IP, TCP, UDP, ICMP, non-IP and other IP packet counts, IP checksum errors, interface activity, packet size counts. -- A TCP and UDP service monitor showing counts of incoming and outgoing packets for common TCP and UDP application ports -- A LAN statistics module that discovers active hosts and shows statistics showing the data activity on them -- TCP, UDP, and other protocol display filters, allowing you to view only traffic you’re interested in. -- Logging -- Supports Ethernet, FDDI, ISDN, SLIP, PPP, and loopback interface types. -- Utilizes the built-in raw socket interface of the Linux kernel, allowing it to be used over a wide range of supported network cards. -- Full-screen, menu-driven operation. - -To install - -### Ubuntu and it’s derivatives ### - - sudo apt-get install iptraf - -### Arch Linux and Its derivatives ### - - sudo pacman -S iptra - -### Fedora and its derivatives ### - - sudo yum install iptraf - -### Usage ### - -If the **iptraf** command is issued without any command-line options, the program comes up in interactive mode, with the various facilities accessed through the main menu. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/iptraf_1.png) - -Menu for easy navigation. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/iptraf_2.png) - -Selecting interfaces to monitor. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/iptraf_3.png) - -Traffic from interface **ppp0** - -![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/iptraf_4.png) - -Enjoy! - --------------------------------------------------------------------------------- - -via: http://www.unixmen.com/iptraf-tcpudp-network-monitoring-utility/ - -作者:[Enock Seth Nyamador][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.unixmen.com/author/seth/ -[1]:http://iptraf.seul.org/about.html diff --git a/sources/tech/20150128 Docker-1 Moving to Docker.md b/sources/tech/20150128 Docker-1 Moving to Docker.md deleted file mode 100644 index 1c1d4b78cc..0000000000 --- a/sources/tech/20150128 Docker-1 Moving to Docker.md +++ /dev/null @@ -1,82 +0,0 @@ -Translating by mtunique -Moving to Docker -================================================================================ -![](http://cocoahunter.com/content/images/2015/01/docker1.jpeg) - -[TL;DR] This is the first post in a series of 3 on how my company moved its infrastructure from PaaS to Docker based deployment. If you want, you can skip the intro (this post) and head directly to the technical topics (links at the bottom of the page). - ----------- - -In the last month I've been strggling with devops. This is my very personal story and experience in trying to streamline a deployment process of a Raila app with Docker. - -When I started my company – [Touchware][1] – in 2012 I was a lone developer. Things were small, uncomplicated, they didn't require a lot of maintenance, nor they needed to scale all that much. During the course of last year though, we grew quite a lot (we are now a team of 10 people) and our server-side applications and API grew both in terms of scope and scale. - -### Step 1 - Heroku ### - -We still are a very small team and we need to make things going and run as smoothly as possible. When we looked for possible solutions, we decided to stick with something that would have removed from our shoulders the burden of managing hardware. Since we develop mainly Rails based applications and Heroku has a great support for RoR and various kind of DBs and cached (Postgres / Mongo / Redis etc.), the smartest choice seemed to be going with [Heroku][2]. And that's what we did. - -Heroku has a great support and great documentation and deploying apps is just so snappy! Only problem is, when you start growing, you need to have piles of cash around to pay the bills. Not the best deal, really. - -### Step 2 - Dokku ### - -In a rush to try and cut the costs, we decided to try with Dokku. [Dokku][3], quoting the Github repo is a - -> Docker powered mini-Heroku in around 100 lines of Bash - -We launched some instances on [DigitalOcean][4] with Dokku pre-installed and we gave it spin. Dokku is very much like Heroku, but when you have complex applications for whom you need to twear params, or where you need certain dependencies, it's just not gonna work out. We had an app where we needed to apply multiple transformations on images and we couldn't find a way to install the correct version of imagemagick into the dokku-based Docker container that was hosting our Rails app. We still have a couple of very simple apps that are running on Dokku, but we had to move some of them back to Heroku. - -### Step 3 - Docker ### - -A couple of months ago, since the problem of devops and managing production apps was resurfacing, I decided to try out [Docker][5]. Docker, in simple terms, allows developers to containerize applications and to ease the deployment. Since a Docker container basically has all the dependencies it needs to run your app, if everything runs fine on your laptop, you can be sure it'll also run like a champ in production on a remote server, be it an AWS E2C instance or a VPS on DigitalOcean. - -Docker IMHO is particularly interesting for the following reasons: - -- it promotes modularization and separation of concerns: you need to start thinking about your apps in terms of logical components (load balancer: 1 container, DB: 1 container, webapp: 1 container etc.); -- it's very flexible in terms of deployment options: containers can be deployed to a wide variety of HW and can be easily redeployed to different servers / providers; -- it allows for a very fine grained tuning of your app environment: you build the images your containers runs from, so you have plenty of options for configuring your environment exactly as you would like to. - -There are howerver some downsides: - -- the learning curve is quite steep (this is probably a very personal problem, but I'm talking as a software dev and not as a skilled operations professional); -- setup is not simple, especially if you want to have a private registry / repository (more about this later). - -Following are some tips I put together during the course of the last week with the findings of someone that is new to the game. - ----------- - -In the following articles we'll see how to setup a semi-automated Docker based deployment system. - -- [Setting up a private Docker registry][6] -- [Configuring a Rails app for semi-automated deployment][7] - --------------------------------------------------------------------------------- - -via: http://cocoahunter.com/2015/01/23/docker-1/ - -作者:[Michelangelo Chasseur][a] -译者:[mtunique](https://github.com/mtunique) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://cocoahunter.com/author/michelangelo/ -[1]:http://www.touchwa.re/ -[2]:http://cocoahunter.com/2015/01/23/docker-1/www.heroku.com -[3]:https://github.com/progrium/dokku -[4]:http://cocoahunter.com/2015/01/23/docker-1/www.digitalocean.com -[5]:http://www.docker.com/ -[6]:http://cocoahunter.com/2015/01/23/docker-2/ -[7]:http://cocoahunter.com/2015/01/23/docker-3/ -[8]: -[9]: -[10]: -[11]: -[12]: -[13]: -[14]: -[15]: -[16]: -[17]: -[18]: -[19]: -[20]: diff --git a/sources/tech/20150128 Docker-2 Setting up a private Docker registry.md b/sources/tech/20150128 Docker-2 Setting up a private Docker registry.md deleted file mode 100644 index 9a9341b4b7..0000000000 --- a/sources/tech/20150128 Docker-2 Setting up a private Docker registry.md +++ /dev/null @@ -1,241 +0,0 @@ -Setting up a private Docker registry -================================================================================ -![](http://cocoahunter.com/content/images/2015/01/docker2.jpg) - -[TL;DR] This is the second post in a series of 3 on how my company moved its infrastructure from PaaS to Docker based deployment. - -- [First part][1]: where I talk about the process we went thru before approaching Docker; -- [Third pard][2]: where I show how to automate the entire process of building images and deploying a Rails app with Docker. - ----------- - -Why would ouy want ot set up a provate registry? Well, for starters, Docker Hub only allows you to have one free private repo. Other companies are beginning to offer similar services, but they are all not very cheap. In addition, if you need to deploy production ready applications built with Docker, you might not want to publish those images on the public Docker Hub. - -This is a very pragmatic approach to dealing with the intricacies of setting up a private Docker registry. For the tutorial we will be using a small 512MB instance on DigitalOcean (from now on DO). I also assume you already know the basics of Docker since I will be concentrating on some more complicated stuff. - -### Local set up ### - -First of all you need to install **boot2docker** and docker CLI. If you already have your basic Docker environment up and running, you can just skip to the next section. - -From the terminal run the following command[1][3]: - - brew install boot2docker docker - -If everything is ok[2][4], you will now be able to start the VM inside which Docker will run with the following command: - - boot2docker up - -Follow the instructions, copy and paste the export commands that boot2docker will print in the terminal. If you now run `docker ps` you should be greeted by the following line - - CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES - -Ok, Docker is ready to go. This will be enough for the moment. Let's go back to setting up the registry. - -### Creating the server ### - -Log into you DO account and create a new Droplet by selecting an image with Docker pre-installed[^n]. - -![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-18-26-14.png) - -You should receive your root credentials via email. Log into your instance and run `docker ps` to see if eveything is ok. - -### Setting up AWS S3 ### - -We are going to use Amazon Simple Storage Service (S3) as the storage layer for our registry / repository. We will need to create a bucket and user credentials to allow our docker container accessoing it. - -Login into your AWS account (if you don't have one you can set one up at [http://aws.amazon.com/][5]) and from the console select S3 (Simple Storage Service). - -![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-29-21.png) - -Click on **Create Bucket**, enter a unique name for your bucket (and write it down, we're gonna need it later), then click on **Create**. - -![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-22-50.png) - -That's it! We're done setting up the storage part. - -### Setup AWS access credentials ### - -We are now going to create a new user. Go back to your AWS console and select IAM (Identity & Access Management). - -![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-29-08.png) - -In the dashboard, on the left side of the webpage, you should click on Users. Then select **Create New Users**. - -You should be presented with the following screen: - -![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-31-42.png) - -Enter a name for your user (e.g. docker-registry) and click on Create. Write down (or download the csv file with) your Access Key and Secret Access Key that we'll need when running the Docker container. Go back to your users list and select the one you just created. - -Under the Permission section, click on Attach User Policy. In the next screen, you will be presented with multiple choices: select Custom Policy. - -![](http://cocoahunter.com/content/images/2015/01/Screenshot-2015-01-20-19-41-21.png) - -Here's the content of the custom policy: - - { - "Version": "2012-10-17", - "Statement": [ - { - "Sid": "SomeStatement", - "Effect": "Allow", - "Action": [ - "s3:*" - ], - "Resource": [ - "arn:aws:s3:::docker-registry-bucket-name/*", - "arn:aws:s3:::docker-registry-bucket-name" - ] - } - ] - } - -This will allow the user (i.e. the registry) to manage (read/write) content on the bucket (make sure to use the bucket name you previously defined when setting up AWS S3). To sum it up: when you'll be pushing Docker images from your local machine to your repository, the server will be able to upload them to S3. - -### Installing the registry ### - -Now let's head back to our DO server and SSH into it. We are going to use[^n] one of the [official Docker registry images][6]. - -Let's start our registry with the following command: - - docker run \ - -e SETTINGS_FLAVOR=s3 \ - -e AWS_BUCKET=bucket-name \ - -e STORAGE_PATH=/registry \ - -e AWS_KEY=your_aws_key \ - -e AWS_SECRET=your_aws_secret \ - -e SEARCH_BACKEND=sqlalchemy \ - -p 5000:5000 \ - --name registry \ - -d \ - registry - -Docker should pull the required fs layers from the Docker Hub and eventually start the daemonised container. - -### Testing the registry ### - -If everything worked out, you should now be able to test the registry by pinging it and by searching its content (though for the time being it's still empty). - -Our registry is very basic and it does not provide any means of authentication. Since there are no easy ways of adding authentication (at least none that I'm aware of that are easy enough to implment in order to justify the effort), I've decided that the easiest way of querying / pulling / pushing the registry is an unsecure (over HTTP) connection tunneled thru SSH. - -Opening an SSH tunnel from your local machine is straightforward: - - ssh -N -L 5000:localhost:5000 root@your_registry.com - -The command is tunnelling connections over SSH from port 5000 of the registry server (which is the one we exposed with the `docker run` command in the previous paragraph) to port 5000 on the localhost. - -If you now browse to the following address [http://localhost:5000/v1/_ping][7] you should get the following very simple response - - {} - -This just means that the registry is working correctly. You can also list the whole content of the registry by browsing to [http://localhost:5000/v1/search][8] that will get you a similar response: - - { - "num_results": 2, - "query": "", - "results": [ - { - "description": "", - "name": "username/first-repo" - }, - { - "description": "", - "name": "username/second-repo" - } - ] - } - -### Building an image ### - -Let's now try and build a very simple Docker image to test our newly installed registry. On your local machine, create a Dockerfile with the following content[^n]: - - # Base image with ruby 2.2.0 - FROM ruby:2.2.0 - - MAINTAINER Michelangelo Chasseur - -...and build it: - - docker build -t localhost:5000/username/repo-name . - -The `localhost:5000` part is especially important: the first part of the name of a Docker image will tell the `docker push` command the endpoint towards which we are trying to push our image. In our case, since we are connecting to our remote private registry via an SSH tunnel, `localhost:5000` represents exactly the reference to our registry. - -If everything works as expected, when the command returns, you should be able to list your newly created image with the `docker images` command. Run it and see it for yourself. - -### Pushing to the registry ### - -Now comes the trickier part. It took a me a while to realize what I'm about to describe, so just be patient if you don't get it the first time you read and try to follow along. I know that all this stuff will seem pretty complicated (and it would be if you didn't automate the process), but I promise in the end it will all make sense. In the next post I will show a couple of shell scripts and Rake tasks that will automate the whole process and will let you deploy a Rails to your registry app with a single easy command. - -The docker command you are running from your terminal is actually using the boot2docker VM to run the containers and do all the magic stuff. So when we run a command like `docker push some_repo` what is actually happening is that it's the boot2docker VM that is reacing out for the registry, not our localhost. - -This is an extremely important point to understand: in order to push the Docker image to the remote private registry, the SSH tunnel needs to be established from the boot2docker VM and not from your local machine. - -There are a couple of ways to go with it. I will show you the shortest one (which is not probably the easiest to understand, but it's the one that will let us automate the process with shell scripts). - -First of all though we need to sort one last thing with SSH. - -### Setting up SSH ### - -Let's add our boot2docker SSH key to our remote server (registry) known hosts. We can do so using the ssh-copy-id utility that you can install with the following command shouldn't you already have it: - - brew install ssh-copy-id - -Then run: - - ssh-copy-id -i /Users/username/.ssh/id_boot2docker root@your-registry.com - -Make sure to substitute `/Users/username/.ssh/id_boot2docker` with the correct path of your ssh key. - -This will allow us to connect via SSH to our remote registry without being prompted for the password. - -Finally let's test it out: - - boot2docker ssh "ssh -o 'StrictHostKeyChecking no' -i /Users/michelangelo/.ssh/id_boot2docker -N -L 5000:localhost:5000 root@registry.touchwa.re &" & - -To break things out a little bit: - -- `boot2docker ssh` lets you pass a command as a parameter that will be executed by the boot2docker VM; -- the final `&` indicates that we want our command to be executed in the background; -- `ssh -o 'StrictHostKeyChecking no' -i /Users/michelangelo/.ssh/id_boot2docker -N -L 5000:localhost:5000 root@registry.touchwa.re &` is the actual command our boot2docker VM will run; - - the `-o 'StrictHostKeyChecking no'` will make sure that we are not prompted with security questions; - - the `-i /Users/michelangelo/.ssh/id_boot2docker` indicates which SSH key we want our VM to use for authentication purposes (note that this should be the key you added to your remote registry in the previous step); - - finally we are opening a tunnel on mapping port 5000 to localhost:5000. - -### Pulling from another server ### - -You should now be able to push your image to the remote registry by simply issuing the following command: - - docker push localhost:5000/username/repo_name - -In the [next post][9] we'll se how to automate some of this stuff and we'll containerize a real Rails application. Stay tuned! - -P.S. Please use the comments to let me know of any inconsistencies or fallacies in my tutorial. Hope you enjoyed it! - -1. I'm also assuming you are running on OS X. -1. For a complete list of instructions to set up your docker environment and requirements, please visit [http://boot2docker.io/][10] -1. Select Image > Applications > Docker 1.4.1 on 14.04 at the time of this writing. -1. [https://github.com/docker/docker-registry/][11] -1. This is just a stub, in the next post I will show you how to bundle a Rails application into a Docker container. - --------------------------------------------------------------------------------- - -via: http://cocoahunter.com/2015/01/23/docker-2/ - -作者:[Michelangelo Chasseur][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://cocoahunter.com/author/michelangelo/ -[1]:http://cocoahunter.com/2015/01/23/docker-1/ -[2]:http://cocoahunter.com/2015/01/23/docker-3/ -[3]:http://cocoahunter.com/2015/01/23/docker-2/#fn:1 -[4]:http://cocoahunter.com/2015/01/23/docker-2/#fn:2 -[5]:http://aws.amazon.com/ -[6]:https://registry.hub.docker.com/_/registry/ -[7]:http://localhost:5000/v1/_ping -[8]:http://localhost:5000/v1/search -[9]:http://cocoahunter.com/2015/01/23/docker-3/ -[10]:http://boot2docker.io/ -[11]:https://github.com/docker/docker-registry/ \ No newline at end of file diff --git a/sources/tech/20150128 Docker-3 Automated Docker-based Rails deployments.md b/sources/tech/20150128 Docker-3 Automated Docker-based Rails deployments.md deleted file mode 100644 index f450361a68..0000000000 --- a/sources/tech/20150128 Docker-3 Automated Docker-based Rails deployments.md +++ /dev/null @@ -1,253 +0,0 @@ -Automated Docker-based Rails deployments -================================================================================ -![](http://cocoahunter.com/content/images/2015/01/docker3.jpeg) - -[TL;DR] This is the third post in a series of 3 on how my company moved its infrastructure from PaaS to Docker based deployment. - -- [First part][1]: where I talk about the process we went thru before approaching Docker; -- [Second part][2]: where I explain how setting up a private registry for in house secure deployments. - ----------- - -In this final part we will see how to automate the whole deployment process with a real world (though very basic) example. - -### Basic Rails app ### - -Let's dive into the topic right away and bootstrap a basic Rails app. For the purpose of this demonstration I'm going to use Ruby 2.2.0 and Rails 4.1.1 - -From the terminal run: - - $ rvm use 2.2.0 - $ rails new && cd docker-test - -Let's create a basic controller: - - $ rails g controller welcome index - -...and edit `routes.rb` so that the root of the project will point to our newly created welcome#index method: - - root 'welcome#index' - -Running `rails s` from the terminal and browsing to [http://localhost:3000][3] should bring you to the index page. We're not going to make anything fancier to the app, it's just a basic example to prove that when we'll build and deploy the container everything is working. - -### Setup the webserver ### - -We are going to use Unicorn as our webserver. Add `gem 'unicorn'` and `gem 'foreman'` to the Gemfile and bundle it up (run `bundle install` from the command line). - -Unicorn needs to be configured when the Rails app launches, so let's put a **unicorn.rb** file inside the **config** directory. [Here is an example][4] of a Unicorn configuration file. You can just copy & paste the content of the Gist. - -Let's also add a Procfile with the following content inside the root of the project so that we will be able to start the app with foreman: - - web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb - -If you now try to run the app with **foreman start** everything should work as expected and you should have a running app on [http://localhost:5000][5] - -### Building a Docker image ### - -Now let's build the image inside which our app is going to live. In the root of our Rails project, create a file named **Dockerfile** and paste in it the following: - - # Base image with ruby 2.2.0 - FROM ruby:2.2.0 - - # Install required libraries and dependencies - RUN apt-get update && apt-get install -qy nodejs postgresql-client sqlite3 --no-install-recommends && rm -rf /var/lib/apt/lists/* - - # Set Rails version - ENV RAILS_VERSION 4.1.1 - - # Install Rails - RUN gem install rails --version "$RAILS_VERSION" - - # Create directory from where the code will run - RUN mkdir -p /usr/src/app - WORKDIR /usr/src/app - - # Make webserver reachable to the outside world - EXPOSE 3000 - - # Set ENV variables - ENV PORT=3000 - - # Start the web app - CMD ["foreman","start"] - - # Install the necessary gems - ADD Gemfile /usr/src/app/Gemfile - ADD Gemfile.lock /usr/src/app/Gemfile.lock - RUN bundle install --without development test - - # Add rails project (from same dir as Dockerfile) to project directory - ADD ./ /usr/src/app - - # Run rake tasks - RUN RAILS_ENV=production rake db:create db:migrate - -Using the provided Dockerfile, let's try and build an image with the following command[1][7]: - - $ docker build -t localhost:5000/your_username/docker-test . - -And again, if everything worked out correctly, the last line of the long log output should read something like: - - Successfully built 82e48769506c - $ docker images - REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE - localhost:5000/your_username/docker-test latest 82e48769506c About a minute ago 884.2 MB - -Let's try and run the container! - - $ docker run -d -p 3000:3000 --name docker-test localhost:5000/your_username/docker-test - -You should be able to reach your Rails app running inside the Docker container at port 3000 of your boot2docker VM[2][8] (in my case [http://192.168.59.103:3000][6]). - -### Automating with shell scripts ### - -Since you should already know from the previous post3 how to push your newly created image to a private regisitry and deploy it on a server, let's skip this part and go straight to automating the process. - -We are going to define 3 shell scripts and finally tie it all together with rake. - -### Clean ### - -Every time we build our image and deploy we are better off always clean everything. That means the following: - -- stop (if running) and restart boot2docker; -- remove orphaned Docker images (images that are without tags and that are no longer used by your containers). - -Put the following into a **clean.sh** file in the root of your project. - - echo Restarting boot2docker... - boot2docker down - boot2docker up - - echo Exporting Docker variables... - sleep 1 - export DOCKER_HOST=tcp://192.168.59.103:2376 - export DOCKER_CERT_PATH=/Users/user/.boot2docker/certs/boot2docker-vm - export DOCKER_TLS_VERIFY=1 - - sleep 1 - echo Removing orphaned images without tags... - docker images | grep "" | awk '{print $3}' | xargs docker rmi - -Also make sure to make the script executable: - - $ chmod +x clean.sh - -### Build ### - -The build process basically consists in reproducing what we just did before (docker build). Create a **build.sh** script at the root of your project with the following content: - - docker build -t localhost:5000/your_username/docker-test . - -Make the script executable. - -### Deploy ### - -Finally, create a **deploy.sh** script with this content: - - # Open SSH connection from boot2docker to private registry - boot2docker ssh "ssh -o 'StrictHostKeyChecking no' -i /Users/username/.ssh/id_boot2docker -N -L 5000:localhost:5000 root@your-registry.com &" & - - # Wait to make sure the SSH tunnel is open before pushing... - echo Waiting 5 seconds before pushing image. - - echo 5... - sleep 1 - echo 4... - sleep 1 - echo 3... - sleep 1 - echo 2... - sleep 1 - echo 1... - sleep 1 - - # Push image onto remote registry / repo - echo Starting push! - docker push localhost:5000/username/docker-test - -If you don't understand what's going on here, please make sure you've read thoroughfully [part 2][9] of this series of posts. - -Make the script executable. - -### Tying it all together with rake ### - -Having 3 scripts would now require you to run them individually each time you decide to deploy your app: - -1. clean -1. build -1. deploy / push - -That wouldn't be much of an effort, if it weren't for the fact that developers are lazy! And lazy be it, then! - -The final step to wrap things up, is tying the 3 parts together with rake. - -To make things even simpler you can just append a bunch of lines of code to the end of the already present Rakefile in the root of your project. Open the Rakefile file - pun intended :) - and paste the following: - - namespace :docker do - desc "Remove docker container" - task :clean do - sh './clean.sh' - end - - desc "Build Docker image" - task :build => [:clean] do - sh './build.sh' - end - - desc "Deploy Docker image" - task :deploy => [:build] do - sh './deploy.sh' - end - end - -Even if you don't know rake syntax (which you should, because it's pretty awesome!), it's pretty obvious what we are doing. We have declared 3 tasks inside a namespace (docker). - -This will create the following 3 tasks: - -- rake docker:clean -- rake docker:build -- rake docker:deploy - -Deploy is dependent on build, build is dependent on clean. So every time we run from the command line - - $ rake docker:deploy - -All the script will be executed in the required order. - -### Test it ### - -To see if everything is working, you just need to make a small change in the code of your app and run - - $ rake docker:deploy - -and see the magic happening. Once the image has been uploaded (and the first time it could take quite a while), you can ssh into your production server and pull (thru an SSH tunnel) the docker image onto the server and run. It's that easy! - -Well, maybe it takes a while to get accustomed to how everything works, but once it does, it's almost (almost) as easy as deploying with Heroku. - -P.S. As always, please let me have your ideas. I'm not sure this is the best, or the fastest, or the safest way of doing devops with Docker, but it certainly worked out for us. - -- make sure to have **boot2docker** up and running. -- If you don't know your boot2docker VM address, just run `$ boot2docker ip` -- if you don't, you can read it [here][10] - --------------------------------------------------------------------------------- - -via: http://cocoahunter.com/2015/01/23/docker-3/ - -作者:[Michelangelo Chasseur][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://cocoahunter.com/author/michelangelo/ -[1]:http://cocoahunter.com/docker-1 -[2]:http://cocoahunter.com/2015/01/23/docker-2/ -[3]:http://localhost:3000/ -[4]:https://gist.github.com/chasseurmic/0dad4d692ff499761b20 -[5]:http://localhost:5000/ -[6]:http://192.168.59.103:3000/ -[7]:http://cocoahunter.com/2015/01/23/docker-3/#fn:1 -[8]:http://cocoahunter.com/2015/01/23/docker-3/#fn:2 -[9]:http://cocoahunter.com/2015/01/23/docker-2/ -[10]:http://cocoahunter.com/2015/01/23/docker-2/ \ No newline at end of file diff --git a/sources/tech/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md b/sources/tech/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md deleted file mode 100644 index 92ac657b5a..0000000000 --- a/sources/tech/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md +++ /dev/null @@ -1,79 +0,0 @@ -How to Bind Apache Tomcat to IPv4 in Centos / Redhat -================================================================================ -Hi all, today we'll learn how to bind tomcat to ipv4 in CentOS 7 Linux Distribution. - -**Apache Tomcat** is an open source web server and servlet container developed by the [Apache Software Foundation][1]. It implements the Java Servlet, JavaServer Pages (JSP), Java Unified Expression Language and Java WebSocket specifications from Sun Microsystems and provides a web server environment for Java code to run in. - -Binding Tomcat to IPv4 is necessary if we have our server not working due to the default binding of our tomcat server to IPv6. As we know IPv6 is the modern way of assigning IP address to a device and is not in complete practice these days but may come into practice in soon future. So, currently we don't need to switch our tomcat server to IPv6 due to no use and we should bind it to IPv4. - -Before thinking to bind to IPv4, we should make sure that we've got tomcat installed in our CentOS 7. Here's is a quick tutorial on [how to install tomcat 8 in CentOS 7.0 Server][2]. - -### 1. Switching to user tomcat ### - -First of all, we'll gonna switch user to **tomcat** user. We can do that by running **su - tomcat** in a shell or terminal. - - # su - tomcat - -![Switch user to tomcat](http://blog.linoxide.com/wp-content/uploads/2015/01/switch-user-tomcat.png) - -### 2. Finding Catalina.sh ### - -Now, we'll First Go to bin directory inside the directory of Apache Tomcat installation which is usually under **/usr/share/apache-tomcat-8.0.x/bin/** where x is sub version of the Apache Tomcat Release. In my case, its **/usr/share/apache-tomcat-8.0.18/bin/** as I have version 8.0.18 installed in my CentOS 7 Server. - - $ cd /usr/share/apache-tomcat-8.0.18/bin - -**Note: Please replace 8.0.18 to the version of Apache Tomcat installed in your system. ** - -Inside the bin folder, there is a script file named catalina.sh . Thats the script file which we'll gonna edit and add a line of configuration which will bind tomcat to IPv4 . You can see that file by running **ls** into a terminal or shell. - - $ ls - -![finding catalina.sh](http://blog.linoxide.com/wp-content/uploads/2015/01/finding-catalina.sh_.png) - -### 3. Configuring Catalina.sh ### - -Now, we'll add **JAVA_OPTS= "$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses"** to that scripting file catalina.sh at the end of the file as shown in the figure below. We can edit the file using our favorite text editing software like nano, vim, etc. Here, we'll gonna use nano. - - $ nano catalina.sh - -![Catalina script](http://blog.linoxide.com/wp-content/uploads/2015/01/catalina-script.png) - -Then, add to the file as shown below: - -**JAVA_OPTS= "$JAVA_OPTS -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses"** - -![configured catalina](http://blog.linoxide.com/wp-content/uploads/2015/01/configured-catalina.png) - -Now, as we've added the configuration to the file, we'll now save and exit nano. - -### 4. Restarting ### - -Now, we'll restart our tomcat server to get our configuration working. We'll need to first execute shutdown.sh and then startup.sh . - - $ ./shutdown.sh - -Now, well run execute startup.sh as: - - $ ./startup.sh - -![restarting apache tomcat server](http://blog.linoxide.com/wp-content/uploads/2015/01/restarting-tomcat-server.png) - -This will restart our tomcat server and the configuration will be loaded which will ultimately bind the server to IPv4. - -### Conclusion ### - -Hurray, finally we'have got our tomcat server bind to IPv4 running in our CentOS 7 Linux Distribution. Binding to IPv4 is easy and is necessary if your Tomcat server is bind to IPv6 which will infact will make your tomcat server not working as IPv6 is not used these days and may come into practice in coming future. 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/bind-apache-tomcat-ipv4-centos/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:http://www.apache.org/ -[2]:http://linoxide.com/linux-how-to/install-tomcat-8-centos-7/ \ No newline at end of file diff --git a/sources/tech/20150202 How to create and show a presentation from the command line on Linux.md b/sources/tech/20150202 How to create and show a presentation from the command line on Linux.md deleted file mode 100644 index d80b385544..0000000000 --- a/sources/tech/20150202 How to create and show a presentation from the command line on Linux.md +++ /dev/null @@ -1,186 +0,0 @@ -How to create and show a presentation from the command line on Linux -================================================================================ -When you prepare a talk for audience, the first thing that will probably come to your mind is shiny presentation charts filled with fancy diagrams, graphics and animation effects. Fine. No one can deny the power of visually charming presentation. However, not all presentations need to be Ted talk quality. Often times, the purpose of a presentation is to convey specific information, which can easily be done with textual messages. In such cases, your time can be better spent on gathering information and checking facts, rather than searching for good-looking graphics from Google Image. - -In the world of Linux, you can do presentation in several different ways, e.g., Impress for multimedia-rich content, [Impress.js][1] for stunning visualization, Beamer for hardcore LaTex users, and so on. If you are looking for a simple means to create and show a textual presentation, look no further. [mdp][2] can get the job done for you. - -### What is Mdp? ### - -mdp is an ncurses-based command-line presentation tool for Linux. What I like about mdp is its [markdown][3] support, which makes it easy to create slides with familiar markdown format. Naturally, it becomes painless to publish the slides in HTML format as well. Another plus is its support for UTF-8 character encoding, which comes in handy when showing non-English characters (e.g., Greek or Cyrillic alphabets). - -### Install Mdp on Linux ### - -Installation of mdp is mostly painless due to its light dependency requirement (i.e., ncursesw). - -#### Debian, Ubuntu or their derivatives #### - - $ sudo apt-get install git gcc make libncursesw5-dev - $ git clone https://github.com/visit1985/mdp.git - $ cd mdp - $ make - $ sudo make install - -#### Fedora or CentOS/RHEL #### - - $ sudo yum install git gcc make ncurses-devel - $ git clone https://github.com/visit1985/mdp.git - $ cd mdp - $ make - $ sudo make install - -#### Arch Linux #### - -On Arch Linux, you can easily install mdp from [AUR][4]. - -### Create a Presentation from the Command Line ### - -Once you installed mdp, you can easily create a presentation by using your favorite text editor. If you are familiar with markdown, it will take no time to master mdp. For those of you who are not familiar with markdown, starting with an example is the best way to learn mdp. - -Here is a 6-page sample presentation for your reference. - - %title: Sample Presentation made with mdp (Xmodulo.com) - %author: Dan Nanni - %date: 2015-01-28 - - -> This is a slide title <- - ========= - - -> mdp is a command-line based presentation tool with markdown support. <- - - *_Features_* - - * Multi-level headers - * Code block formatting - * Nested quotes - * Nested list - * Text highlight and underline - * Citation - * UTF-8 special characters - - ------------------------------------------------- - - -> # Example of nested list <- - - This is an example of multi-level headers and a nested list. - - # first-level title - - second-level - ------------ - - - *item 1* - - sub-item 1 - - sub-sub-item 1 - - sub-sub-item 2 - - sub-sub-item 3 - - sub-item 2 - - ------------------------------------------------- - - -> # Example of code block formatting <- - - This example shows how to format a code snippet. - - 1 /* Hello World program */ - 2 - 3 #include - 4 - 5 int main() - 6 { - 7 printf("Hello World"); - 8 return 0; - 9 } - - This example shows inline code: `sudo reboot` - - ------------------------------------------------- - - -> # Example of nested quotes <- - - This is an example of nested quotes. - - # three-level nested quotes - - > This is the first-level quote. - >> This is the second-level quote - >> and continues. - >>> *This is the third-level quote, and so on.* - - ------------------------------------------------- - - -> # Example of citations <- - - This example shows how to place a citation inside a presentation. - - This tutorial is published at [Xmodulo](http://xmodulo.com) - - You are welcome to connect with me at [LinkedIn](http://www.linkedin.com/in/xmodulo) - - Pretty cool, huh? - - ------------------------------------------------- - - -> # Example of UTF-8 special characters <- - - This example shows UTF-8 special characters. - - ae = ä, oe = ö, ue = ü, ss = ß - alpha = ?, beta = ?, upsilon = ?, phi = ? - Omega = ?, Delta = ?, Sigma = ? - - ??????????? - ?rectangle? - ??????????? - -### Show a Presentation from the Command Line ### - -Once you save the above code as slide.md text file, you can show the presentation by simply running: - - $ mdp slide.md - -You can navigate the presentation by pressing Enter/Space/Page-Down/Down-Arrow (next slide), Backspace/Page-Up/Up-Arrow (previous slide), Home (first slide), End (last slide), or numeric-N (N-th slide). - -The title of the presentation appears on top of each slide, and your name and page number are shown at the bottom. - -![](https://farm9.staticflickr.com/8637/16392457702_ec732d0094_c.jpg) - -This is an example of a nested list and multi-level headers. - -![](https://farm9.staticflickr.com/8567/16367397606_29be7df633_c.jpg) - -This is an example of a code snippet and inline code. - -![](https://farm9.staticflickr.com/8682/15770926144_0f982b0863_b.jpg) - -This is an example of nested quotes. - -![](https://farm9.staticflickr.com/8587/16393383115_0865c8b89b_c.jpg) - -This is an example of placing citations. - -![](https://farm8.staticflickr.com/7409/16392457712_ed36c14bc2_c.jpg) - -This is an example of UTF-8 special characters. - -![](https://farm9.staticflickr.com/8648/16205981560_7fa3debc75_c.jpg) - -### Summary ### - -In this tutorial, I showed you how to use mdp to create and show a presentation from the command line. Its markdown compatibility saves us the trouble and hassle of having to learn any new formatting, which is an advantage compared to [tpp][5], another command-line presentation tool. Due to its limitations, mdp may not qualify as your default presentation tool, but there should be definitely a use case for that. What do you think of mdp? Do you prefer something else? - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/presentation-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]:http://bartaz.github.io/impress.js/ -[2]:https://github.com/visit1985/mdp -[3]:http://daringfireball.net/projects/markdown/ -[4]:https://aur.archlinux.org/packages/mdp-git/ -[5]:http://www.ngolde.de/tpp.html \ No newline at end of file diff --git a/sources/tech/20150203 How To Install KDE Plasma 5.2 In Ubuntu 14.10.md b/sources/tech/20150203 How To Install KDE Plasma 5.2 In Ubuntu 14.10.md deleted file mode 100644 index cd1a5eb525..0000000000 --- a/sources/tech/20150203 How To Install KDE Plasma 5.2 In Ubuntu 14.10.md +++ /dev/null @@ -1,60 +0,0 @@ -How To Install KDE Plasma 5.2 In Ubuntu 14.10 -================================================================================ -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Plasma_Ubuntu_1410.jpg) - -[KDE][1] Plasma 5.2 has been [released][2] and in this post we shall see how to install KDE Plasma 5.2 in Ubuntu 14.10. - -Ubuntu’s default desktop environment Unity is beautiful and packs quite some feature. But if you ask any experienced Linux user about desktop customization, his answer will be KDE. KDE is boss when it comes to customization and its popularity can be guessed that Ubuntu has an official KDE flavor, known as [Kubuntu][3]. - -A good thing about Ubuntu (or any other Linux OS for that matter) is that it doesn’t bind you with one particular desktop environment. You can always install additional desktop environments and choose to switch between them while keeping several desktop environments at the same time. Earlier, we have seen the installation of following desktop environments: - -- [How to install Mate desktop in Ubuntu 14.04][4] -- [How to install Cinnamon in Ubuntu 14.04][5] -- [How to install Budgie desktop in Ubuntu 14.04][6] -- [How to install GNOME Shell in Ubuntu 14.04][7] - -And today we shall see how to install KDE Plasma in Ubuntu 14.10. - -### Install KDE Plasma 5.2 in Ubuntu 14.04 ### - -Before you go on installing Plasma on Ubuntu 14.10, you should know that it will download around one GB of data. So consider your network speed and data package (if any) before opting for KDE installation. The PPA we are going to use for installing Plasma is the official PPA provided by the KDE community. Use the commands below in terminal: - - sudo apt-add-repository ppa:kubuntu-ppa/next-backports - sudo apt-get update - sudo apt-get dist-upgrade - sudo apt-get install kubuntu-plasma5-desktop plasma-workspace-wallpapers - -During the installation, it will as you to choose the default display manager. I chose the default LightDM. Once installed, restart the system. At the login, click on the Ubuntu symbol beside the login field. In here, select Plasma. - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Select_Plasma_KDE_Ubuntu.jpeg) - -You’ll be logged in to KDE Plasma now. Here is a quick screenshot of how KDE Plasma 5.2 looks like in Ubuntu 14.10: - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/KDE_Plasma_Desktop.jpeg) - -### Remove KDE Plasma from Ubuntu ### - -If you want to revert the changes, use the following commands to get rid of KDE Plasma from Ubuntu 14.10. - - sudo apt-get install ppa-purge - sudo apt-get remove kubuntu-plasma5-desktop - sudo ppa-purge ppa:kubuntu-ppa/next - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/install-kde-plasma-ubuntu-1410/ - -作者:[Abhishek][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/Abhishek/ -[1]:https://www.kde.org/ -[2]:https://dot.kde.org/2015/01/27/plasma-52-beautiful-and-featureful -[3]:http://www.kubuntu.org/ -[4]:http://itsfoss.com/install-mate-desktop-ubuntu-14-04/ -[5]:http://itsfoss.com/install-cinnamon-24-ubuntu-1404/ -[6]:http://itsfoss.com/install-budgie-desktop-ubuntu-1404/ -[7]:http://itsfoss.com/how-to-install-gnome-in-ubuntu-14-04/ \ No newline at end of file diff --git a/sources/tech/20150203 Linux FAQs with Answers--How to fix 'Your profile could not be opened correctly' on Google Chrome.md b/sources/tech/20150203 Linux FAQs with Answers--How to fix 'Your profile could not be opened correctly' on Google Chrome.md deleted file mode 100644 index 8d5c4b02ca..0000000000 --- a/sources/tech/20150203 Linux FAQs with Answers--How to fix 'Your profile could not be opened correctly' on Google Chrome.md +++ /dev/null @@ -1,52 +0,0 @@ -> Vic - -Linux FAQs with Answers--How to fix “Your profile could not be opened correctly” on Google Chrome -================================================================================ -> **Question**: When I open Google Chrome web browser on my Linux box, I have several pop-up messages saying "Your profile could not be opened correctly." This error happens every time I open Google Chrome. How can I solve this error? - -When you see an error message saying "Your profile could not be opened correctly" on your Google Chrome web browser," that is because somehow your profile data on Google Chrome got corrupted. This can happen while you upgrade your Google Chrome browser manually on Linux. - -![](https://farm8.staticflickr.com/7428/16238502737_27bdda6685_o.png) - -Depending on exactly which file got corrupted, you can try one of these methods. - -### Method One ### - -Close all your Chrome browser windows/tabs. - -Go to ~/.config/google-chrome/Default, and remove/rename "Web Data" file as below. - - $ cd ~/.config/google-chrome/Default - $ rm "Web Data" - -Re-open Google Chrome browser. - -### Method Two ### - -Close all your Chrome browser windows/tabs. - -Go to ~/.config/google-chrome/"Profile 1", and rename "History" file as below. - - $ cd ~/.config/google-chrome/"Profile 1" - $ mv History History.bak - -Re-open Google Chrome browser. - -### Method Three ### - -If the problem still persists, you can remove the Default profile folder (~/.config/google-chrome/Default) altogether. Note that by doing so, you will lose all previously opened Google tabs, imported bookmarks, browsing history, sign-in data, etc. - -Before removing it, first close all your Chrome browser windows/tabs. - - $ rm -rf ~/.config/google-chrome/Default - -After restarting Google Chrome, the folder ~/.config/google-chrome/Default will automatically be re-generated. - --------------------------------------------------------------------------------- - -via: http://ask.xmodulo.com/your-profile-could-not-be-opened-correctly-google-chrome.html - -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/sources/tech/20150205 25 Linux Shell Scripting interview Questions & Answers.md b/sources/tech/20150205 25 Linux Shell Scripting interview Questions & Answers.md deleted file mode 100644 index a042cba174..0000000000 --- a/sources/tech/20150205 25 Linux Shell Scripting interview Questions & Answers.md +++ /dev/null @@ -1,377 +0,0 @@ -25 Linux Shell Scripting interview Questions & Answers -================================================================================ -### Q:1 What is Shell Script and why it is required ? ### - -Ans: A Shell Script is a text file that contains one or more commands. As a system administrator we often need to issue number of commands to accomplish the task, we can add these all commands together in a text file (Shell Script) to complete daily routine task. - -### Q:2 What is the default login shell and how to change default login shell for a specific user ? ### - -Ans: In Linux like Operating system “/bin/bash” is the default login shell which is assigned while user creation. We can change default shell using the “chsh” command . Example is shown below : - - # chsh -s - # chsh linuxtechi -s /bin/sh - -### Q:3 What are the different type of variables used in a shell Script ? ### - -Ans: In a shell script we can use two types of variables : - -- System defined variables -- User defined variables - -System defined variables are defined or created by Operating System(Linux) itself. These variables are generally defined in Capital Letters and can be viewed by “**set**” command. - -User defined variables are created or defined by system users and the values of variables can be viewed by using the command “`echo $`” - -### Q:4 How to redirect both standard output and standard error to the same location ? ### - -Ans: There two method to redirect std output and std error to the same location: - -Method:1 2>&1 (# ls /usr/share/doc > out.txt 2>&1 ) - -Method:2 &> (# ls /usr/share/doc &> out.txt ) - -### Q:5 What is the Syntax of “nested if statement” in shell scripting ? ### - -Ans : Basic Syntax is shown below : - - if [ Condition ] - then - command1 - command2 - ….. - else - if [ condition ] - then - command1 - command2 - …. - else - command1 - command2 - ….. - fi - fi - -### Q:6 What is the use of “$?” sign in shell script ? ### - -Ans:While writing a shell script , if you want to check whether previous command is executed successfully or not , then we can use “$?” with if statement to check the exit status of previous command. Basic example is shown below : - - root@localhost:~# ls /usr/bin/shar - /usr/bin/shar - root@localhost:~# echo $? - 0 - -If exit status is 0 , then command is executed successfully - - root@localhost:~# ls /usr/bin/share - - ls: cannot access /usr/bin/share: No such file or directory - root@localhost:~# echo $? - 2 - -If the exit status is other than 0, then we can say command is not executed successfully. - -### Q:7 How to compare numbers in Linux shell Scripting ? ### - -Ans: test command is used to compare numbers in if-then statement. Example is shown below : - - #!/bin/bash - x=10 - y=20 - - if [ $x -gt $y ] - then - echo “x is greater than y” - else - echo “y is greater than x” - fi - -### Q:8 What is the use of break command ? ### - -Ans: The break command is a simple way to escape out of a loop in progress. We can use the break command to exit out from any loop, including while and until loops. - -### Q:9 What is the use of continue command in shell scripting ? ### - -Ans The continue command is identical to break command except it causes the present iteration of the loop to exit, instead of the entire loop. Continue command is useful in some scenarios where error has occurred but we still want to execute the next commands of the loop. - -### Q:10 Tell me the Syntax of “Case statement” in Linux shell scripting ? ### - -Ans: The basic syntax is shown below : - - case word in - value1) - command1 - command2 - ….. - last_command - !! - value2) - command1 - command2 - …… - last_command - ;; - esac - -### Q:11 What is the basic syntax of while loop in shell scripting ? ### - -Ans: Like the for loop, the while loop repeats its block of commands a number of times. Unlike the for loop, however, the while loop iterates until its while condition is no longer true. The basic syntax is : - - while [ test_condition ] - do - commands… - done - -### Q:12 How to make a shell script executable ? ### - -Ans: Using the chmod command we can make a shell script executable. Example is shown below : - - # chmod a+x myscript.sh - -### Q:13 What is the use of “#!/bin/bash” ? ### - -Ans: #!/bin/bash is the first of a shell script , known as shebang , where # symbol is called hash and ‘!’ is called as bang. It shows that command to be executed via /bin/bash. - -### Q:14 What is the syntax of for loop in shell script ? ### - -Ans: Basic Syntax of for loop is given below : - - for variables in list_of_items - do - command1 - command2 - …. - last_command - done - -### Q:15 How to debug a shell script ? ### - -Ans: A shell script can be debug if we execute the script with ‘-x’ option ( sh -x myscript.sh). Another way to debug a shell script is by using ‘-nv’ option ( sh -nv myscript.sh). - -### Q:16 How compare the strings in shell script ? ### - -Ans: test command is used to compare the text strings. The test command compares text strings by comparing each character in each string. - -### Q:17 What are the Special Variables set by Bourne shell for command line arguments ? ### - -Ans: The following table lists the special variables set by the Bourne shell for command line arguments . - -注:表格部分 - --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Special Variables

-
-

Holds

-
-

$0

-
-

Name of the Script from the command line

-
-

$1

-
-

First Command-line argument

-
-

$2

-
-

Second Command-line argument

-
-

…..

-
-

…….

-
-

$9

-
-

Ninth Command line argument

-
-

$#

-
-

Number of Command line arguments

-
-

$*

-
-

All Command-line arguments, separated with spaces

-
- -### Q:18 How to test files in a shell script ? ### - -Ans: test command is used to perform different test on the files. Basic test are listed below : - -注:表格部分 - --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Test

-
-

Usage

-
-

-d file_name

-
-

Returns true if the file exists and is a directory

-
-

-e file_name

-
-

Returns true if the file exists

-
-

-f file_name

-
-

Returns true if the file exists and is a regular file

-
-

-r file_name

-
-

Returns true if the file exists and have read permissions

-
-

-s file_name

-
-

Returns true if the file exists and is not empty

-
-

-w file_name

-
-

Returns true if the file exists and have write permissions

-
-

-x file_name

-
-

Returns true if the file exists and have execute permissions

-
- -### Q:19 How to put comments in your shell script ? ### - -Ans: Comments are the messages to yourself and for other users that describe what a script is supposed to do and how its works.To put comments in your script, start each comment line with a hash sign (#) . Example is shown below : - - #!/bin/bash - # This is a command - echo “I am logged in as $USER” - -### Q:20 How to get input from the terminal for shell script ? ### - -Ans: ‘read’ command reads in data from the terminal (using keyboard). The read command takes in whatever the user types and places the text into the variable you name. Example is shown below : - - # vi /tmp/test.sh - - #!/bin/bash - echo ‘Please enter your name’ - read name - echo “My Name is $name” - - # ./test.sh - Please enter your name - LinuxTechi - My Name is LinuxTechi - -### Q:21 How to unset or de-assign variables ? ### - -Ans: ‘unset’ command is used to de-assign or unset a variable. Syntax is shown below : - - # unset - -### Q:22 How to perform arithmetic operation ? ### - -Ans: There are two ways to perform arithmetic operations : - -1. Using `expr` command (# expr 5 + 2 ) -2. using a dollar sign and square brackets ( `$[ operation ]` ) Example : test=$[16 + 4] ; test=$[16 + 4] - -### Q:23 Basic Syntax of do-while statement ? ### - -Ans: The do-while statement is similar to the while statement but performs the statements before checking the condition statement. The following is the format for the do-while statement: - - do - { - statements - } while (condition) - -### Q:24 How to define functions in shell scripting ? ### - -Ans: A function is simply a block of of code with a name. When we give a name to a block of code, we can then call that name in our script, and that block will be executed. Example is shown below : - - $ diskusage () { df -h ; } - -### Q:25 How to use bc (bash calculator) in a shell script ? ### - -Ans: Use the below Syntax to use bc in shell script. - - variable=`echo “options; expression” | bc` - --------------------------------------------------------------------------------- - -via: http://www.linuxtechi.com/linux-shell-scripting-interview-questions-answers/ - -作者:[Pradeep 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.linuxtechi.com/author/pradeep/ \ No newline at end of file diff --git a/sources/tech/20150205 How To Install or Configure VNC Server On CentOS 7.0.md b/sources/tech/20150205 How To Install or Configure VNC Server On CentOS 7.0.md deleted file mode 100644 index 3eaba972f8..0000000000 --- a/sources/tech/20150205 How To Install or Configure VNC Server On CentOS 7.0.md +++ /dev/null @@ -1,161 +0,0 @@ -How To Install / Configure VNC Server On CentOS 7.0 -================================================================================ -Hi there, this tutorial is all about how to install or setup [VNC][1] Server on your very CentOS 7. This tutorial also works fine in RHEL 7. In this tutorial, we'll learn what is VNC and how to install or setup [VNC Server][1] on CentOS 7 - -As we know, most of the time as a system administrator we are managing our servers over the network. It is very rare that we will need to have a physical access to any of our managed servers. In most cases all we need is to SSH remotely to do our administration tasks. In this article we will configure a GUI alternative to a remote access to our CentOS 7 server, which is VNC. VNC allows us to open a remote GUI session to our server and thus providing us with a full graphical interface accessible from any remote location. - -VNC server is a Free and Open Source Software which is designed for allowing remote access to the Desktop Environment of the server to the VNC Client whereas VNC viewer is used on remote computer to connect to the server . - -**Some Benefits of VNC server are listed below:** - - Remote GUI administration makes work easy & convenient. - Clipboard sharing between host CentOS server & VNC-client machine. - GUI tools can be installed on the host CentOS server to make the administration more powerful - Host CentOS server can be administered through any OS having the VNC-client installed. - More reliable over ssh graphics and RDP connections. - -So, now lets start our journey towards the installation of VNC Server. We need to follow the steps below to setup and to get a working VNC. - -First of all we'll need a working Desktop Environment (X-Windows), if we don't have a working GUI Desktop Environment (X Windows) running, we'll need to install it first. - -**Note: The commands below must be running under root privilege. To switch to root please execute "sudo -s" under a shell or terminal without quotes("")** - -### 1. Installing X-Windows ### - -First of all to install [X-Windows][2] we'll need to execute the below commands in a shell or terminal. It will take few minutes to install its packages. - - # yum check-update - # yum groupinstall "X Window System" - -![installing x windows](http://blog.linoxide.com/wp-content/uploads/2015/01/installing-x-windows.png) - - #yum install gnome-classic-session gnome-terminal nautilus-open-terminal control-center liberation-mono-fonts - -![install gnome classic session](http://blog.linoxide.com/wp-content/uploads/2015/01/gnome-classic-session-install.png) - - # unlink /etc/systemd/system/default.target - # ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target - -![configuring graphics](http://blog.linoxide.com/wp-content/uploads/2015/01/configuring-graphics.png) - - # reboot - -After our machine restarts, we'll get a working CentOS 7 Desktop. - -Now, we'll install VNC Server on our machine. - -### 2. Installing VNC Server Package ### - -Now, we'll install VNC Server package in our CentOS 7 machine. To install VNC Server, we'll need to execute the following command. - - # yum install tigervnc-server -y - -![vnc server](http://blog.linoxide.com/wp-content/uploads/2015/01/install-tigervnc.png) - -### 3. Configuring VNC ### - -Then, we'll need to create a configuration file under **/etc/systemd/system/** directory. We can copy the **vncserver@:1.service** file from example file from **/lib/systemd/system/vncserver@.service** - - # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service - -![copying vnc server configuration](http://blog.linoxide.com/wp-content/uploads/2015/01/copying-configuration.png) - -Now we'll open **/etc/systemd/system/vncserver@:1.service** in our favorite text editor (here, we're gonna use **nano**). Then find the below lines of text in that file and replace with your username. Here, in my case its linoxide so I am replacing with linoxide and finally looks like below. - - ExecStart=/sbin/runuser -l -c "/usr/bin/vncserver %i" - PIDFile=/home//.vnc/%H%i.pid - -TO - - ExecStart=/sbin/runuser -l linoxide -c "/usr/bin/vncserver %i" - PIDFile=/home/linoxide/.vnc/%H%i.pid - -If you are creating for root user then - - ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i" - PIDFile=/root/.vnc/%H%i.pid - -![configuring user](http://blog.linoxide.com/wp-content/uploads/2015/01/configuring-user.png) - -Now, we'll need to reload our systemd. - - # systemctl daemon-reload - -Finally, we'll create VNC password for the user . To do so, first you'll need to be sure that you have sudo access to the user, here I will login to user "linoxide" then, execute the following. To login to linoxide we'll run "**su linoxide" without quotes** . - - # su linoxide - $ sudo vncpasswd - -![setting vnc password](http://blog.linoxide.com/wp-content/uploads/2015/01/vncpassword.png) - -**Make sure that you enter passwords more than 6 characters.** - -### 4. Enabling and Starting the service ### - -To enable service at startup ( Permanent ) execute the commands shown below. - - $ sudo systemctl enable vncserver@:1.service - -Then, start the service. - - $ sudo systemctl start vncserver@:1.service - -### 5. Allowing Firewalls ### - -We'll need to allow VNC services in Firewall now. - - $ sudo firewall-cmd --permanent --add-service vnc-server - $ sudo systemctl restart firewalld.service - -![allowing firewalld](http://blog.linoxide.com/wp-content/uploads/2015/01/allowing-firewalld.png) - -Now you can able to connect VNC server using IP and Port ( Eg : ip-address:1 ) - -### 6. Connecting the machine with VNC Client ### - -Finally, we are done installing VNC Server. No, we'll wanna connect the server machine and remotely access it. For that we'll need a VNC Client installed in our computer which will only enable us to remote access the server machine. - -![remote access vncserver from vncviewer](http://blog.linoxide.com/wp-content/uploads/2015/01/vncviewer.png) - -You can use VNC client like [Tightvnc viewer][3] and [Realvnc viewer][4] to connect Server. -To connect with additional users create files with different ports, please go to step 3 to configure and add a new user and port, You'll need to create **vncserver@:2.service** and replace the username in config file and continue the steps by replacing service name for different ports. **Please make sure you logged in as that particular user for creating vnc password**. - -VNC by itself runs on port 5900. Since each user will run their own VNC server, each user will have to connect via a separate port. The addition of a number in the file name tells VNC to run that service as a sub-port of 5900. So in our case, arun's VNC service will run on port 5901 (5900 + 1) and further will run on 5900 + x. Where, x denotes the port specified when creating config file **vncserver@:x.service for the further users**. - -We'll need to know the IP Address and Port of the server to connect with the client. IP addresses are the unique identity number of the machine. Here, my IP address is 96.126.120.92 and port for this user is 1. We can get the public IP address by executing the below command in a shell or terminal of the machine where VNC Server is installed. - - # curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' - -### Conclusion ### - -Finally, we installed and configured VNC Server in the machine running CentOS 7 / RHEL 7 (Red Hat Enterprises Linux) . VNC is the most easy FOSS tool for the remote access and also a good alternative to Teamviewer Remote Access. VNC allows a user with VNC client installed to control the machine with VNC Server installed. Here are some commands listed below that are highly useful in VNC . Enjoy !! - -#### Additional Commands : #### - -- To stop VNC service . - - # systemctl stop vncserver@:1.service - -- To disable VNC service from startup. - - # systemctl disable vncserver@:1.service - -- To stop firewall. - - # systemctl stop firewalld.service - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/install-configure-vnc-server-centos-7-0/ - -作者:[Arun Pyasi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/arunp/ -[1]:http://en.wikipedia.org/wiki/Virtual_Network_Computing -[2]:http://en.wikipedia.org/wiki/X_Window_System -[3]:http://www.tightvnc.com/ -[4]:https://www.realvnc.com/ \ No newline at end of file diff --git a/sources/tech/20150205 How To Use Smartphones Like Weather Conky In Linux.md b/sources/tech/20150205 How To Use Smartphones Like Weather Conky In Linux.md deleted file mode 100644 index b5bbc69a3b..0000000000 --- a/sources/tech/20150205 How To Use Smartphones Like Weather Conky In Linux.md +++ /dev/null @@ -1,84 +0,0 @@ -How To Use Smartphones Like Weather Conky In Linux -================================================================================ -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Use_Weather_Conky_Linux.jpeg) - -Smartphones have those sleek weather widgets that blend in to the display. Thanks to Flair Weather Conky, you can get **smartphone like weather display on your Linux desktop**. We will be using a GUI tool [Conky Manager to easily manage Conky in Linux][1]. Let’s first see how to install Conky Manager in Ubuntu 14.10, 14.04, Linux Mint 17 and other Linux distributions. - -### Install Conky Manager ### - -Open a terminal and use the following commands: - - sudo add-apt-repository ppa:teejee2008/ppa - sudo apt-get update - sudo apt-get install conky-manager - -You can read this article on [how to use Conky Manager in Linux][1]. - -### Make sure curl is installed ### - -Do make sure that [curl][2] is installed. Use the following command: - - sudo apt-get install curl - -### Download Flair Weather Conky ### - -Get the Flair Weather Conky script from the link below: - -- [Download Flair Weather Conky Script][3] - -### Using Flair Weather Conky script in Conky Manager ### - -#### Step 1: #### - -Same as you install themes in Ubuntu 14.04, you should have a .conky directory in your Home folder. If you use command line, I don’t need to tell you how to find that. For beginners, go to your Home directory from File manager and press Ctrl+H to [show hidden files in Ubuntu][4]. Look for .conky folder here. If there is no such folder, make one. - -#### Step 2: #### - -In the .conky directory, extract the downloaded Flair Weather file. Do note that by default it is extracted to .conky directory itself. So go in this directory and get the Flair Weather folder out of it and paste it to actual .conky directory. - -#### Step 3: #### - -Flair Weather uses Yahoo and it doesn’t recognize your location automatically. You’ll need to manually edit it. Go to [Yahoo Weather][5] and get the location of id of your city by typing your city/pin code. You can get the location id from the URL. - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Yahoo_Weather_Location_Code.jpeg) - -#### Step 4: #### - -Open Conky Manager. It should be able to read the newly installed Conky script. There are two variants, dark and light, available. You can choose whichever you prefer. You can should see the conky displayed on the desktop as soon as you select it. - -Default location in Flair Weather is set to Melbourne. You’ll have to manually edit the conky. - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Using_Weather_Conky_Ubuntu.jpeg) - -#### Step 5: #### - -In the screenshot above, you can see the option to edit the selected conky. In the editor opened, look for location or WOEID. Change it with the location code you got in step 3. Now restart the Conky. - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Edit_Conky.jpeg) - -In the same place, if you replace C by F, the unit of temperature will be changed to Fahrenheit from Celsius. Don’t forget to restart the Conky to see the changes made. - -#### Give it a try #### - -In this article we actually learned quite few things. We saw how we can use any Conky script easily, how to edit the scripts and how to use Conky Manager for various purposes. I hope you find it useful. - -A word of caution, Ubuntu 14.10 users might see overlapped time numerals. Please make the developer ware of any such issues. - -I have already shown you the screenshot of how the Flair Weather conky looked in my system. Time for you to try this and flaunt your desktop. - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/weather-conky-linux/ - -作者:[Abhishek][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/Abhishek/ -[1]:http://itsfoss.com/conky-gui-ubuntu-1304/ -[2]:http://www.computerhope.com/unix/curl.htm -[3]:http://speedracker.deviantart.com/art/Flair-Weather-Conky-Made-for-Conky-Manager-510130311 -[4]:http://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ -[5]:https://weather.yahoo.com/ \ No newline at end of file diff --git a/sources/tech/20150205 zBackup--A versatile deduplicating backup tool.md b/sources/tech/20150205 zBackup--A versatile deduplicating backup tool.md deleted file mode 100644 index 62eee8521c..0000000000 --- a/sources/tech/20150205 zBackup--A versatile deduplicating backup tool.md +++ /dev/null @@ -1,63 +0,0 @@ -zBackup – A versatile deduplicating backup tool -================================================================================ -zbackup is a globally-deduplicating backup tool, based on the ideas found in rsync. Feed a large .tar into it, and it will store duplicate regions of it only once, then compress and optionally encrypt the result. Feed another .tar file, and it will also re-use any data found in any previous backups. This way only new changes are stored, and as long as the files are not very different, the amount of storage required is very low. Any of the backup files stored previously can be read back in full at any time. - -### zBackup Features ### - -Parallel LZMA or LZO compression of the stored data -Built-in AES encryption of the stored data -Possibility to delete old backup data -Use of a 64-bit rolling hash, keeping the amount of soft collisions to zero -Repository consists of immutable files. No existing files are ever modified -Written in C++ only with only modest library dependencies -Safe to use in production -Possibility to exchange data between repos without recompression - -### Install zBackup in ubuntu ### - -Open the terminal and run the following command - - sudo apt-get install zbackup - -### Using zBackup ### - -zbackup init initializes a backup repository for the backup files to be stored. - - zbackup init [--non-encrypted] [--password-file ~/.my_backup_password ] /my/backup/repo - -zbackup backup backups a tar file generated by tar c to the repository initialized using zbackup init - - zbackup [--password-file ~/.my_backup_password ] [--threads number_of_threads ] backup /my/backup/repo/backups/backup-`date ‘+%Y-%m-%d'` - -zbackup restore restores the backup file to a tar file. - - zbackup [--password-file ~/.my_backup_password [--cache-size cache_size_in_mb restore /my/backup/repo/backups/backup-`date ‘+%Y-%m-%d'` > /my/precious/backup-restored.tar - -### Available Options ### - -- -non-encrypted -- Do not encrypt the backup repository. -- --password-file ~/.my_backup_password -- Use the password file specified at ~/.my_backup_password to encrypt the repository and backup file, or to decrypt the backup file. -- --threads number_of_threads -- Limit the partial LZMA compression to number_of_threads needed. Recommended for 32-bit architectures. -- --cache-size cache_size_in_mb -- Use the cache size provided by cache_size_in_mb to speed up the restoration process. - -### zBackup files ### - -~/.my_backup_password Used to encrypt the repository and backup file, or to decrypt the backup file. See zbackup for further details. - -/my/backup/repo The directory used to hold the backup repository. - -/my/precious/restored-tar The tar used for restoring the backup. - -/my/backup/repo/backups/backup-`date ‘+%Y-%m-%d'` Specifies the backup file. - --------------------------------------------------------------------------------- - -via: http://www.ubuntugeek.com/zbackup-a-versatile-deduplicating-backup-tool.html - -作者:[ruchi][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.ubuntugeek.com/author/ubuntufix \ No newline at end of file diff --git a/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md b/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md new file mode 100644 index 0000000000..58a0841280 --- /dev/null +++ b/sources/tech/20150209 How to access Feedly RSS feed from the command line on Linux.md @@ -0,0 +1,106 @@ +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/ \ No newline at end of file diff --git a/sources/tech/20150209 Install OpenQRM Cloud Computing Platform In Debian.md b/sources/tech/20150209 Install OpenQRM Cloud Computing Platform In Debian.md new file mode 100644 index 0000000000..127f10affc --- /dev/null +++ b/sources/tech/20150209 Install OpenQRM Cloud Computing Platform In Debian.md @@ -0,0 +1,149 @@ +Install OpenQRM Cloud Computing Platform In Debian +================================================================================ +### Introduction ### + +**openQRM** is a web-based open source Cloud computing and datacenter management platform that integrates flexibly with existing components in enterprise data centers. + +It supports the following virtualization technologies: + +- KVM, +- XEN, +- Citrix XenServer, +- VMWare ESX, +- LXC, +- OpenVZ. + +The Hybrid Cloud Connector in openQRM supports a range of private or public cloud providers to extend your infrastructure on demand via **Amazon AWS**, **Eucalyptus** or **OpenStack**. It, also, automates provisioning, virtualization, storage and configuration management, and it takes care of high-availability. A self-service cloud portal with integrated billing system enables end-users to request new servers and application stacks on-demand. + +openQRM is available in two different flavours such as: + +- Enterprise Edition +- Community Edition + +You can view the difference between both editions [here][1]. + +### Features ### + +- Private/Hybrid Cloud Computing Platform; +- Manages physical and virtualized server systems; +- Integrates with all major open and commercial storage technologies; +- Cross-platform: Linux, Windows, OpenSolaris, and *BSD; +- Supports KVM, XEN, Citrix XenServer, VMWare ESX(i), lxc, OpenVZ and VirtualBox; +- Support for Hybrid Cloud setups using additional Amazon AWS, Eucalyptus, Ubuntu UEC cloud resources; +- Supports P2V, P2P, V2P, V2V Migrations and High-Availability; +- Integrates with the best Open Source management tools – like puppet, nagios/Icinga or collectd; +- Over 50 plugins for extended features and integration with your infrastructure; +- Self-Service Portal for end-users; +- Integrated billing system. + +### Installation ### + +Here, we will install openQRM in Ubuntu 14.04 LTS. Your server must atleast meet the following requirements. + +- 1 GB RAM; +- 100 GB Hdd; +- Optional: Virtualization enabled (VT for Intel CPUs or AMD-V for AMD CPUs) in Bios. + +First, install make package to compile openQRM source package. + + sudo apt-get update + sudo apt-get upgrade + sudo apt-get install make + +Then, run the following commands one by one to install openQRM. + +Download the latest available version [from here][2]. + + wget http://sourceforge.net/projects/openqrm/files/openQRM-Community-5.1/openqrm-community-5.1.tgz + + tar -xvzf openqrm-community-5.1.tgz + + cd openqrm-community-5.1/src/ + + sudo make + + sudo make install + + sudo make start + +During installation, you’ll be asked to update the php.ini file. + +![~-openqrm-community-5.1-src_001](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@server-openqrm-community-5.1-src_001.png) + +Enter mysql root user password. + +![~-openqrm-community-5.1-src_002](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@server-openqrm-community-5.1-src_002.png) + +Re-enter password: + +![~-openqrm-community-5.1-src_003](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@server-openqrm-community-5.1-src_003.png) + +Select the mail server configuration type. + +![~-openqrm-community-5.1-src_004](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@server-openqrm-community-5.1-src_004.png) + +If you’re not sure, select Local only. In our case, I go with **Local only** option. + +![~-openqrm-community-5.1-src_005](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@server-openqrm-community-5.1-src_005.png) + +Enter your system mail name, and finally enter the Nagios administration password. + +![~-openqrm-community-5.1-src_007](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@server-openqrm-community-5.1-src_007.png) + +The above commands will take long time depending upon your Internet connection to download all packages required to run openQRM. Be patient. + +Finally, you’ll get the openQRM configuration URL along with username and password. + +![~_002](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/sk@debian-_002.png) + +### Configuration ### + +After installing openQRM, open up your web browser and navigate to the URL: **http://ip-address/openqrm**. + +For example, in my case http://192.168.1.100/openqrm. + +The default username and password is: **openqrm/openqrm**. + +![Mozilla Firefox_003](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/Mozilla-Firefox_003.png) + +Select a network card to use for the openQRM management network. + +![openQRM Server - Mozilla Firefox_004](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/openQRM-Server-Mozilla-Firefox_004.png) + +Select a database type. In our case, I selected mysql. + +![openQRM Server - Mozilla Firefox_006](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/openQRM-Server-Mozilla-Firefox_006.png) + +Now, configure the database connection and initialize openQRM. Here, I use **openQRM** as database name, and user as **root** and debian as password for the database. Be mindful that you should enter the mysql root user password that you have created while installing openQRM. + +![openQRM Server - Mozilla Firefox_012](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/openQRM-Server-Mozilla-Firefox_012.png) + +Congratulations!! openQRM has been installed and configured. + +![openQRM Server - Mozilla Firefox_013](http://180016988.r.cdn77.net/wp-content/uploads/2015/02/openQRM-Server-Mozilla-Firefox_013.png) + +### Update openQRM ### + +To update openQRM at any time run the following command: + + cd openqrm/src/ + make update + +What we have done so far is just installed and configured openQRM in our Ubuntu server. For creating, running Virtual Machines, managing Storage, integrating additional systems and running your own private Cloud, I suggest you to read the [openQRM Administrator Guide][3]. + +That’s all now. Cheers! Happy weekend!! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-openqrm-cloud-computing-platform-debian/ + +作者:[SK][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/sk/ +[1]:http://www.openqrm-enterprise.com/products/edition-comparison.html +[2]:http://sourceforge.net/projects/openqrm/files/?source=navbar +[3]:http://www.openqrm-enterprise.com/fileadmin/Documents/Whitepaper/openQRM-Enterprise-Administrator-Guide-5.2.pdf \ No newline at end of file diff --git a/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md b/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md new file mode 100644 index 0000000000..64e872c4b7 --- /dev/null +++ b/sources/tech/20150225 How to make remote incremental backup of LUKS-encrypted disk or partition.md @@ -0,0 +1,80 @@ +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 \ No newline at end of file diff --git a/sources/tech/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md b/sources/tech/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md new file mode 100644 index 0000000000..cae05670ba --- /dev/null +++ b/sources/tech/20150225 How to set up IPv6 BGP peering and filtering in Quagga BGP router.md @@ -0,0 +1,258 @@ +How to set up IPv6 BGP peering and filtering in Quagga BGP router +================================================================================ +In the previous tutorials, we demonstrated how we can set up a [full-fledged BGP router][1] and configure [prefix filtering][2] with Quagga. In this tutorial, we are going to show you how we can set up IPv6 BGP peering and advertise IPv6 prefixes through BGP. We will also demonstrate how we can filter IPv6 prefixes advertised or received by using prefix-list and route-map features. + +### Topology ### + +For this tutorial, we will be considering the following topology. + +![](https://farm9.staticflickr.com/8599/15944659374_1c65852df2_c.jpg) + +Service providers A and B want to establish an IPv6 BGP peering between them. Their IPv6 and AS information is as follows. + +- Peering IP block: 2001:DB8:3::/64 +- Service provider A: AS 100, 2001:DB8:1::/48 +- Service provider B: AS 200, 2001:DB8:2::/48 + +### Installing Quagga on CentOS/RHEL ### + +If Quagga has not already been installed, we can install it using yum. + + # yum install quagga + +On CentOS/RHEL 7, the default SELinux policy, which prevents /usr/sbin/zebra from writing to its configuration directory, can interfere with the setup procedure we are going to describe. Thus we want to disable this policy as follows. Skip this step if you are using CentOS/RHEL 6. + + # setsebool -P zebra_write_config 1 + +### Creating Configuration Files ### + +After installation, we start the configuration process by creating the zebra/bgpd configuration files. + + # cp /usr/share/doc/quagga-XXXXX/zebra.conf.sample /etc/quagga/zebra.conf + # cp /usr/share/doc/quagga-XXXXX/bgpd.conf.sample /etc/quagga/bgpd.conf + +Next, enable auto-start of these services. + +**On CentOS/RHEL 6:** + + # service zebra start; service bgpd start + # chkconfig zebra on; chkconfig bgpd on + +**On CentOS/RHEL 7:** + + # systemctl start zebra; systemctl start bgpd + # systemctl enable zebra; systmectl enable bgpd + +Quagga provides a built-in shell called vtysh, whose interface is similar to those of major router vendors such as Cisco or Juniper. Launch vtysh command shell: + + # vtysh + +The prompt will be changed to: + + router-a# + +or + + router-b# + +In the rest of the tutorials, these prompts indicate that you are inside vtysh shell of either router. + +### Specifying Log File for Zebra ### + +Let's configure the log file for Zebra, which will be helpful for debugging. + +First, enter the global configuration mode by typing: + + router-a# configure terminal + +The prompt will be changed to: + + router-a(config)# + +Now specify log file location. Then exit the configuration mode: + + router-a(config)# log file /var/log/quagga/quagga.log + router-a(config)# exit + +Save configuration permanently by: + + router-a# write + +### Configuring Interface IP Addresses ### + +Let's now configure the IP addresses for Quagga's physical interfaces. + +First, we check the available interfaces from inside vtysh. + + router-a# show interfaces + +---------- + + Interface eth0 is up, line protocol detection is disabled + ## OUTPUT TRUNCATED ### + Interface eth1 is up, line protocol detection is disabled + ## OUTPUT TRUNCATED ## + +Now we assign necessary IPv6 addresses. + + router-a# conf terminal + router-a(config)# interface eth0 + router-a(config-if)# ipv6 address 2001:db8:3::1/64 + router-a(config-if)# interface eth1 + router-a(config-if)# ipv6 address 2001:db8:1::1/64 + +We use the same method to assign IPv6 addresses to router-B. I am summarizing the configuration below. + + router-b# show running-config + +---------- + + interface eth0 + ipv6 address 2001:db8:3::2/64 + + interface eth1 + ipv6 address 2001:db8:2::1/64 + +Since the eth0 interface of both routers are in the same subnet, i.e., 2001:DB8:3::/64, you should be able to ping from one router to another. Make sure that you can ping successfully before moving on to the next step. + + router-a# ping ipv6 2001:db8:3::2 + +---------- + + PING 2001:db8:3::2(2001:db8:3::2) 56 data bytes + 64 bytes from 2001:db8:3::2: icmp_seq=1 ttl=64 time=3.20 ms + 64 bytes from 2001:db8:3::2: icmp_seq=2 ttl=64 time=1.05 ms + +### Phase 1: IPv6 BGP Peering ### + +In this section, we will configure IPv6 BGP between the two routers. We start by specifying BGP neighbors in router-A. + + router-a# conf t + router-a(config)# router bgp 100 + router-a(config-router)# no auto-summary + router-a(config-router)# no synchronization + router-a(config-router)# neighbor 2001:DB8:3::2 remote-as 200 + +Next, we define the address family for IPv6. Within the address family section, we will define the network to be advertised, and activate the neighbors as well. + + router-a(config-router)# address-family ipv6 + router-a(config-router-af)# network 2001:DB8:1::/48 + router-a(config-router-af)# neighbor 2001:DB8:3::2 activate + +We will go through the same configuration for router-B. I'm providing the summary of the configuration. + + router-b# conf t + router-b(config)# router bgp 200 + router-b(config-router)# no auto-summary + router-b(config-router)# no synchronization + router-b(config-router)# neighbor 2001:DB8:3::1 remote-as 100 + router-b(config-router)# address-family ipv6 + router-b(config-router-af)# network 2001:DB8:2::/48 + router-b(config-router-af)# neighbor 2001:DB8:3::1 activate + +If all goes well, an IPv6 BGP session should be up between the two routers. If not already done, please make sure that necessary ports (TCP 179) are [open in your firewall][3]. + +We can check IPv6 BGP session information using the following commands. + +**For BGP summary:** + + router-a# show bgp ipv6 unicast summary + +**For BGP advertised routes:** + + router-a# show bgp ipv6 neighbors advertised-routes + +**For BGP received routes:** + + router-a# show bgp ipv6 neighbors routes + +![](https://farm8.staticflickr.com/7317/16379555088_6e29cb6884_b.jpg) + +### Phase 2: Filtering IPv6 Prefixes ### + +As we can see from the above output, the routers are advertising their full /48 IPv6 prefix. For demonstration purposes, we will consider the following requirements. + +- Router-B will advertise one /64 prefix, one /56 prefix, as well as one full /48 prefix. +- Router-A will accept any IPv6 prefix owned by service provider B, which has a netmask length between /56 and /64. + +We are going to filter the prefix as required, using prefix-list and route-map in router-A. + +![](https://farm8.staticflickr.com/7367/16381297417_6549218289_c.jpg) + +#### Modifying prefix advertisement for Router-B #### + +Currently, router-B is advertising only one /48 prefix. We will modify router-B's BGP configuration so that it advertises additional /56 and /64 prefixes as well. + + router-b# conf t + router-b(config)# router bgp 200 + router-b(config-router)# address-family ipv6 + router-b(config-router-af)# network 2001:DB8:2::/56 + router-b(config-router-af)# network 2001:DB8:2::/64 + +We will verify that all prefixes are received at router-A. + +![](https://farm9.staticflickr.com/8598/16379761980_7c083ae977_b.jpg) + +Great! As we are receiving all prefixes in router-A, we will move forward and create prefix-list and route-map entries to filter these prefixes. + +#### Creating Prefix-List #### + +As described in the [previous tutorial][4], prefix-list is a mechanism that is used to match an IP address prefix with a subnet length. Once a matched prefix is found, we can apply filtering or other actions to the matched prefix. To meet our requirements, we will go ahead and create a necessary prefix-list entry in router-A. + + router-a# conf t + router-a(config)# ipv6 prefix-list FILTER-IPV6-PRFX permit 2001:DB8:2::/56 le 64 + +The above commands will create a prefix-list entry named 'FILTER-IPV6-PRFX' which will match any prefix in the 2001:DB8:2:: pool with a netmask between 56 and 64. + +#### Creating and Applying Route-Map #### + +Now that the prefix-list entry is created, we will create a corresponding route-map rule which uses the prefix-list entry. + + router-a# conf t + router-a(config)# route-map FILTER-IPV6-RMAP permit 10 + router-a(config-route-map)# match ipv6 address prefix-list FILTER-IPV6-PRFX + +The above commands will create a route-map rule named 'FILTER-IPV6-RMAP'. This rule will permit IPv6 addresses matched by the prefix-list 'FILTER-IPV6-PRFX' that we have created earlier. + +Remember that a route-map rule is only effective when it is applied to a neighbor or an interface in a certain direction. We will apply the route-map in the BGP neighbor configuration. As the filter is meant for inbound prefixes, we apply the route-map in the inbound direction. + + router-a# conf t + router-a(config)# router bgp 100 + router-a(config-router)# address-family ipv6 + router-a(config-router-af)# neighbor 2001:DB8:3::2 route-map FILTER-IPV6-RMAP in + +Now when we check the routes received at router-A, we should see only two prefixes that are allowed. + +![](https://farm8.staticflickr.com/7337/16379762020_ec2dc39b31_c.jpg) + +**Note**: You may need to reset the BGP session for the route-map to take effect. + +All IPv6 BGP sessions can be restarted using the following command: + + router-a# clear bgp ipv6 * + +I am summarizing the configuration of both routers so you get a clear picture at a glance. + +![](https://farm9.staticflickr.com/8672/16567240165_eee4398dc8_c.jpg) + +### Summary ### + +To sum up, this tutorial focused on how to set up BGP peering and filtering using IPv6. We showed how to advertise IPv6 prefixes to a neighboring BGP router, and how to filter the prefixes advertised or received are advertised. Note that the process described in this tutorial may affect production networks of a service provider, so please use caution. + +Hope this helps. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/ipv6-bgp-peering-filtering-quagga-bgp-router.html + +作者:[Sarmed Rahman][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/sarmed +[1]:http://xmodulo.com/centos-bgp-router-quagga.html +[2]:http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html +[3]:http://ask.xmodulo.com/open-port-firewall-centos-rhel.html +[4]:http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html \ No newline at end of file diff --git a/sources/tech/20150227 Fix Minimal BASH like line editing is supported GRUB Error In Linux.md b/sources/tech/20150227 Fix Minimal BASH like line editing is supported GRUB Error In Linux.md new file mode 100644 index 0000000000..88b742d4f9 --- /dev/null +++ b/sources/tech/20150227 Fix Minimal BASH like line editing is supported GRUB Error In Linux.md @@ -0,0 +1,86 @@ +Fix Minimal BASH like line editing is supported GRUB Error In Linux +================================================================================ +The other day when I [installed Elementary OS in dual boot with Windows][1], I encountered a Grub error at the reboot time. I was presented with command line with error message: + +**Minimal BASH like line editing is supported. For the first word, TAB lists possible command completions. anywhere else TAB lists possible device or file completions.** + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_Linux_1.jpeg) + +Indeed this is not an error specific to Elementary OS. It is a common [Grub][2] error that could occur with any Linux OS be it Ubuntu, Fedora, Linux Mint etc. + +In this post we shall see **how to fix this “minimal BASH like line editing is supported” Grub error in Ubuntu** based Linux systems. + +> You can read this tutorial to fix similar and more frequent issue, [error: no such partition grub rescue in Linux][3]. + +### Prerequisites ### + +To fix this issue, you would need the followings: + +- A live USB or disk of the same OS and same version +- A working internet connection in the live session + +Once you make sure that you have the prerequisites, let’s see how to fix the black screen of death for Linux (if I can call it that ;)). + +### How to fix this “minimal BASH like line editing is supported” Grub error in Ubuntu based Linux ### + +I know that you might point out that this Grub error is not exclusive to Ubuntu or Ubuntu based Linux distributions, then why am I putting emphasis on the world Ubuntu? The reason is, here we will take an easy way out and use a tool called **Boot Repair** to fix our problem. I am not sure if this tool is available for other distributions like Fedora. Without wasting anymore time, let’s see how to solve minimal BASH like line editing is supported Grub error. + +### Step 1: Boot in lives session ### + +Plug in the live USB and boot in to the live session. + +### Step 2: Install Boot Repair ### + +Once you are in the lives session, open the terminal and use the following commands to install Boot Repair: + + sudo add-apt-repository ppa:yannubuntu/boot-repair + sudo apt-get update + sudo apt-get install boot-repair + +Note: Follow this tutorial to [fix failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs error][4], if you encounter it while running the above command. + +### Step 3: Repair boot with Boot Repair ### + +Once you installed Boot Repair, run it from the command line using the following command: + + boot-repair & + +Actually things are pretty straight forward from here. You just need to follow the instructions provided by Boot Repair tool. First, click on **Recommended repair** option in the Boot Repair. + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu.png) + +It will take couple of minutes for Boot Repair to analyze the problem with boot and Grub. Afterwards, it will provide you some commands to use in the command line. Copy the commands one by one in terminal. For me it showed me a screen like this: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_1.png) + +It will do some processes after you enter these commands: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_2.png) + +Once the process finishes, it will provide you a URL which consists of the logs of the boot repair. If your boot issue is not fixed even now, you can go to the forum or mail to the dev team and provide them the URL as a reference. Cool, isn’t it? + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Final_Ubuntu.png) + +After the boot repair finishes successfully, shutdown your computer, remove the USB and boot again. For me it booted successfully but added two additional lines in the Grub screen. Something which was not of importance to me as I was happy to see the system booting normally again. + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_Linux_2.jpeg) + +### Did it work for you? ### + +So this is how I fixed **minimal BASH like line editing is supported Grub error in Elementary OS Freya**. How about you? Did it work for you? Feel free to ask a question or drop a suggestion in the comment box below. + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/fix-minimal-bash-line-editing-supported-grub-error-linux/ + +作者:[Abhishek][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/guide-install-elementary-os-luna/ +[2]:http://www.gnu.org/software/grub/ +[3]:http://itsfoss.com/solve-error-partition-grub-rescue-ubuntu-linux/ +[4]:http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/ \ No newline at end of file diff --git a/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md new file mode 100644 index 0000000000..a0c77c21f9 --- /dev/null +++ b/sources/tech/20150316 How to Test Your Internet Speed Bidirectionally from Command Line Using 'Speedtest-CLI' Tool.md @@ -0,0 +1,132 @@ +How to Test Your Internet Speed Bidirectionally from Command Line Using ‘Speedtest-CLI’ Tool +================================================================================ +We always need to check the speed of the Internet connection at home and office. What we do for this? Go to websites like Speedtest.net and begin test. It loads JavaScript in the web browser and then select best server based upon ping and output the result. It also uses a Flash player to produce graphical results. + +What about headless server, where isn’t any web based browser and the main point is, most of the servers are headless. The another bottleneck of such web browser based speed testing is that, you can’t schedule the speed testing at regular interval. Here comes an application “Speedtest-cli” that removes such bottlenecks and let you test the speed of Internet connection from command line. + +#### What is Speedtest-cli #### + +The application is basically a script developed in Python programming Language. It measures Internet Bandwidth speed bidirectionally. It used speedtest.net infrastructure to measure the speed. Speedtest-cli is able to list server based upon physical distance, test against specific server, and gives you URL to share the result of your internet speed test. + +To install latest speedtest-cli tool in Linux systems, you must have Python 2.4-3.4 or higher version installed on the system. + +### Install speedtest-cli in Linux ### + +There are two ways to install speedtest-cli tool. The first method involves the use of `python-pip` package while the second method is to download the Python script, make it executable and run, here I will cover both ways…. + +#### Install speedtest-cli Using pythin-pip #### + +First you need to install `python-pip` package, then afterwards you can install the speedtest-cli tool using pip command as shown below. + + $ sudo apt-get install python-pip + $ sudo pip install speedtest-cli + +To upgrade speedtest-cli, at later stage, use. + + $ sudo pip install speedtest-cli --upgrade + +#### Install speedtest-cli Using Python Script #### + +First download the python script from github using wget command, unpack the downloaded file (master.zip) and extract it.. + + $ wget https://github.com/sivel/speedtest-cli/archive/master.zip + $ unzip master.zip + +After extracting the file, go to the extracted directory `speedtest-cli-master` and make the script file executable. + + $ cd speedtest-cli-master/ + $ chmod 755 speedtest_cli.py + +Next, move the executable to `/usr/bin` folder, so that you don’t need to type the full path everytime. + + $ sudo mv speedtest_cli.py /usr/bin/ + +### Testing Internet Connection Speed with speedtest-cli ### + +**1. To test Download and Upload speed of your internet connection, run the `speedtest-cli` command without any argument as shown below.** + + $ speedtest_cli.py + +![Test Download Upload Speed in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Download-Upload-Speed-in-Linux1.png) +Test Download Upload Speed in Linux + +**2. To check the speed result in bytes in place of bits.** + + $ speedtest_cli.py --bytes + +![Test Internet Speed in Bytes](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Speed-in-Bytes.png) +Test Internet Speed in Bytes + +**3. Share your bandwidth speed with your friends or family. You are provided with a link that can be used to download an image.** + +![Share Internet Speed Results](http://www.tecmint.com/wp-content/uploads/2015/03/Share-Internet-Speed-Results.png) +Share Internet Speed Results + +The following picture is a sample speed test result generated using above command. + +![Speed Test Results](http://www.tecmint.com/wp-content/uploads/2015/03/Speed-Test-Results.png) +Speed Test Results + +**4. Don’t need any additional information other than Ping, Download and upload?** + + $ speedtest_cli.py --simple + +![Test Ping Download Upload Speed](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Ping-Download-Upload-Speed1.png) +Test Ping Download Upload Speed + +**5. List the `speedtest.net` server based upon physical distance. The distance in km is mentioned.** + + $ speedtest_cli.py --list + +![Check Speedtest.net Servers](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Speedtest-Servers.png) +Check Speedtest.net Servers + +**6. The last stage generated a huge list of servers sorted on the basis of distance. How to get desired output? Say I only want to see the speedtest.net server located in Mumbai (India).** + + $ speedtest_cli.py --list | grep -i Mumbai + +![Check Nearest Server](http://www.tecmint.com/wp-content/uploads/2015/03/Check-Nearest-Server.png) +Check Nearest Server + +**7. Test connection speed against a specific server. Use Server Id generated in example 5 and example 6 in above.** + + $ speedtest_cli.py --server [server ID] + $ speedtest_cli.py --server [5060] ## Here server ID 5060 is used in the example. + +![Test Connection Against Server](http://www.tecmint.com/wp-content/uploads/2015/03/Test-Connection-Against-Server.png) +Test Connection Against Server + +**8. To check the version number and help of `speedtest-cli` tool.** + + $ speedtest_cli.py --version + +![Check SpeedCli Version](http://www.tecmint.com/wp-content/uploads/2015/03/Check-SpeedCLi-Version.png) +Check SpeedCli Version + + $ speedtest_cli.py --help + +![SpeedCli Help](http://www.tecmint.com/wp-content/uploads/2015/03/SpeedCli-Help.png) +SpeedCli Help + +**Note:** Latency reported by tool is not its goal and one should not rely on it. The relative latency values output is responsible for server selected to be tested against. CPU and Memory capacity will influence the result to certain extent. + +### Conclusion ### + +The tool is must for system administrators and developers. A simple script which runs without any issue. I must say that the application is wonderful, lightweight and do what it promises. I disliked Speedtest.net for the reason it was using flash, but speedtest-cli gave me a reason to love them. + +speedtest_cli is a third party application and should not be used to automatically record the bandwidth speed. Speedtest.net is used by millions of users and it is a good idea to [Set Your Own Speedtest Mini Server][1]. + +That’s all for now, till then stay tuned and connected to Tecmint. Don’t forget to give your valuable feedback in the comments below. Like and share us and help us get spread. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/check-internet-speed-from-command-line-in-linux/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/speedtest-mini-server-to-test-bandwidth-speed/ diff --git a/sources/tech/20150318 How to Manage and Use LVM (Logical Volume Management) in Ubuntu.md b/sources/tech/20150318 How to Manage and Use LVM (Logical Volume Management) in Ubuntu.md new file mode 100644 index 0000000000..ecfb639d54 --- /dev/null +++ b/sources/tech/20150318 How to Manage and Use LVM (Logical Volume Management) in Ubuntu.md @@ -0,0 +1,268 @@ +How to Manage and Use LVM (Logical Volume Management) in Ubuntu +================================================================================ +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/652x202xbanner-1.png.pagespeed.ic.VGSxDeVS9P.png) + +In our [previous article we told you what LVM is and what you may want to use it for][1], and today we are going to walk you through some of the key management tools of LVM so you will be confident when setting up or expanding your installation. + +As stated before, LVM is a abstraction layer between your operating system and physical hard drives. What that means is your physical hard drives and partitions are no longer tied to the hard drives and partitions they reside on. Rather, the hard drives and partitions that your operating system sees can be any number of separate hard drives pooled together or in a software RAID. + +To manage LVM there are GUI tools available but to really understand what is happening with your LVM configuration it is probably best to know what the command line tools are. This will be especially useful if you are managing LVM on a server or distribution that does not offer GUI tools. + +Most of the commands in LVM are very similar to each other. Each valid command is preceded by one of the following: + +- Physical Volume = pv +- Volume Group = vg +- Logical Volume = lv + +The physical volume commands are for adding or removing hard drives in volume groups. Volume group commands are for changing what abstracted set of physical partitions are presented to your operating in logical volumes. Logical volume commands will present the volume groups as partitions so that your operating system can use the designated space. + +### Downloadable LVM Cheat Sheet ### + +To help you understand what commands are available for each prefix we made a LVM cheat sheet. We will cover some of the commands in this article, but there is still a lot you can do that won’t be covered here. + +All commands on this list will need to be run as root because you are changing system wide settings that will affect the entire machine. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/01/lvm-cheatsheet.png) + +### How to View Current LVM Information ### + +The first thing you may need to do is check how your LVM is set up. The s and display commands work with physical volumes (pv), volume groups (vg), and logical volumes (lv) so it is a good place to start when trying to figure out the current settings. + +The display command will format the information so it’s easier to understand than the s command. For each command you will see the name and path of the pv/vg and it should also give information about free and used space. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/01/539x225xpvdisplay.png.pagespeed.ic.u2XV5LBTYa.png) + +The most important information will be the PV name and VG name. With those two pieces of information we can continue working on the LVM setup. + +### Creating a Logical Volume ### + +Logical volumes are the partitions that your operating system uses in LVM. To create a logical volume we first need to have a physical volume and volume group. Here are all of the steps necessary to create a new logical volume. + +#### Create physical volume #### + +We will start from scratch with a brand new hard drive with no partitions or information on it. Start by finding which disk you will be working with. (/dev/sda, sdb, etc.) + +> Note: Remember all of the commands will need to be run as root or by adding ‘sudo’ to the beginning of the command. + + fdisk -l + +If your hard drive has never been formatted or partitioned before you will probably see something like this in the fdisk output. This is completely fine because we are going to create the needed partitions in the next steps. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/fdisk.png.pagespeed.ce.AmAEsxm-7Q.png) + +Our new disk is located at /dev/sdb so lets use fdisk to create a new partition on the drive. + +There are a plethora of tools that can create a new partition with a GUI, [including Gparted][2], but since we have the terminal open already, we will use fdisk to create the needed partition. + +From a terminal type the following commands: + + fdisk /dev/sdb + +This will put you in a special fdisk prompt. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/627x145xfdisk00.png.pagespeed.ic.I7S8bjoXQG.png) + +Enter the commands in the order given to create a new primary partition that uses 100% of the new hard drive and is ready for LVM. If you need to change the partition size or want multiple partions I suggest using GParted or reading about fdisk on your own. + +**Warning: The following steps will format your hard drive. Make sure you don’t have any information on this hard drive before following these steps.** + +- n = create new partition +- p = creates primary partition +- 1 = makes partition the first on the disk + +Push enter twice to accept the default first cylinder and last cylinder. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/562x216xfdisk01.png.pagespeed.ic.DsSZ38kWcA.png) + +To prepare the partition to be used by LVM use the following two commands. + +- t = change partition type +- 8e = changes to LVM partition type + +Verify and write the information to the hard drive. + +- p = view partition setup so we can review before writing changes to disk +- w = write changes to disk + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/560x339xfdisk03.png.pagespeed.ic.FC8foICZsb.png) + +After those commands, the fdisk prompt should exit and you will be back to the bash prompt of your terminal. + +Enter pvcreate /dev/sdb1 to create a LVM physical volume on the partition we just created. + +You may be asking why we didn’t format the partition with a file system but don’t worry, that step comes later. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/pvcreate.png.pagespeed.ce.W7VAr-ig3t.png) + +#### Create volume Group #### + +Now that we have a partition designated and physical volume created we need to create the volume group. Luckily this only takes one command. + + vgcreate vgpool /dev/sdb1 + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/vgcreate.png.pagespeed.ce.fVLzSmPZou.png) + +Vgpool is the name of the new volume group we created. You can name it whatever you’d like but it is recommended to put vg at the front of the label so if you reference it later you will know it is a volume group. + +#### Create logical volume #### + +To create the logical volume that LVM will use: + + lvcreate -L 3G -n lvstuff vgpool + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/lvcreate.png.pagespeed.ce.vupLB-LJEW.png) + +The -L command designates the size of the logical volume, in this case 3 GB, and the -n command names the volume. Vgpool is referenced so that the lvcreate command knows what volume to get the space from. + +#### Format and Mount the Logical Volume #### + +One final step is to format the new logical volume with a file system. If you want help choosing a Linux file system, read our [how to that can help you choose the best file system for your needs][3]. + + mkfs -t ext3 /dev/vgpool/lvstuff + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/571x424xmkfs.png.pagespeed.ic.ERMan1Mz0P.png) + +Create a mount point and then mount the volume somewhere you can use it. + + mkdir /mnt/stuff + mount -t ext3 /dev/vgpool/lvstuff /mnt/stuff + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/510x69xmount.png.pagespeed.ic.k0i1tvqgcV.png) + +#### Resizing a Logical Volume #### + +One of the benefits of logical volumes is you can make your shares physically bigger or smaller without having to move everything to a bigger hard drive. Instead, you can add a new hard drive and extend your volume group on the fly. Or if you have a hard drive that isn’t used you can remove it from the volume group to shrink your logical volume. + +There are three basic tools for making physical volumes, volume groups, and logical volumes bigger or smaller. + +Note: Each of these commands will need to be preceded by pv, vg, or lv depending on what you are working with. + +- resize – can shrink or expand physical volumes and logical volumes but not volume groups +- extend – can make volume groups and logical volumes bigger but not smaller +- reduce – can make volume groups and logical volumes smaller but not bigger + +Let’s walk through an example of how to add a new hard drive to the logical volume “lvstuff” we just created. + +#### Install and Format new Hard Drive #### + +To install a new hard drive follow the steps above to create a new partition and add change it’s partition type to LVM (8e). Then use pvcreate to create a physical volume that LVM can recognize. + +#### Add New Hard Drive to Volume Group #### + +To add the new hard drive to a volume group you just need to know what your new partition is, /dev/sdc1 in our case, and the name of the volume group you want to add it to. + +This will add the new physical volume to the existing volume group. + + vgextend vgpool /dev/sdc1 + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/vgextend.png.pagespeed.ce.atRPT1yg5f.png) + +#### Extend Logical Volume #### + +To resize the logical volume we need to say how much we want to extend by size instead of by device. In our example we just added a 8 GB hard drive to our 3 GB vgpool. To make that space usable we can use lvextend or lvresize. + + lvextend -L8G /dev/vgpool/lvstuff + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/lvextend1.png.pagespeed.ce.6scXbQVUTT.png) + +While this command will work you will see that it will actually resize our logical volume to 8 GB instead of adding 8 GB to the existing volume like we wanted. To add the last 3 available gigabytes you need to use the following command. + + lvextend -L+3G /dev/vgpool/lvstuff + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/430x85xlvextend2.png.pagespeed.ic.7aBiTBrW03.png) + +Now our logical volume is 11 GB in size. + +#### Extend File System #### + +The logical volume is 11 GB but the file system on that volume is still only 3 GB. To make the file system use the entire 11 GB available you have to use the command resize2fs. Just point resize2fs to the 11 GB logical volume and it will do the magic for you. + + resize2fs /dev/vgpool/lvstuff + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/650x150xresize2fs.png.pagespeed.ic.Mx74EdMuk_.png) + +**Note: If you are using a different file system besides ext3/4 please see your file systems resize tools.** + +#### Shrink Logical Volume #### + +If you wanted to remove a hard drive from a volume group you would need to follow the above steps in reverse order and use lvreduce and vgreduce instead. + +1. resize file system (make sure to move files to a safe area of the hard drive before resizing) +1. reduce logical volume (instead of + to extend you can also use – to reduce by size) +1. remove hard drive from volume group with vgreduce + +#### Backing up a Logical Volume #### + +Snapshots is a feature that some newer advanced file systems come with but ext3/4 lacks the ability to do snapshots on the fly. One of the coolest things about LVM snapshots is your file system is never taken offline and you can have as many as you want without taking up extra hard drive space. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/652x202xbanner-2.png.pagespeed.ic.VtOUuqYX1W.png) + +When LVM takes a snapshot, a picture is taken of exactly how the logical volume looks and that picture can be used to make a copy on a different hard drive. While a copy is being made, any new information that needs to be added to the logical volume is written to the disk just like normal, but changes are tracked so that the original picture never gets destroyed. + +To create a snapshot we need to create a new logical volume with enough free space to hold any new information that will be written to the logical volume while we make a backup. If the drive is not actively being written to you can use a very small amount of storage. Once we are done with our backup we just remove the temporary logical volume and the original logical volume will continue on as normal. + +#### Create New Snapshot #### + +To create a snapshot of lvstuff use the lvcreate command like before but use the -s flag. + + lvcreate -L512M -s -n lvstuffbackup /dev/vgpool/lvstuff + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/597x68xlvcreate-snapshot.png.pagespeed.ic.Rw2ivtcpPg.png) + +Here we created a logical volume with only 512 MB because the drive isn’t being actively used. The 512 MB will store any new writes while we make our backup. + +#### Mount New Snapshot #### + +Just like before we need to create a mount point and mount the new snapshot so we can copy files from it. + + mkdir /mnt/lvstuffbackup + mount /dev/vgpool/lvstuffbackup /mnt/lvstuffbackup + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/565x68xmount-snapshot.png.pagespeed.ic.pVMkhK1o4x.png) + +#### Copy Snapshot and Delete Logical Volume #### + +All you have left to do is copy all of the files from /mnt/lvstuffbackup/ to an external hard drive or tar it up so it is all in one file. + +**Note: tar -c will create an archive and -f will say the location and file name of the archive. For help with the tar command use man tar in the terminal.** + + tar -cf /home/rothgar/Backup/lvstuff-ss /mnt/lvstuffbackup/ + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/627x67xsnapshot-backup.png.pagespeed.ic.tw-2AK_lfZ.png) + +Remember that while the backup is taking place all of the files that would be written to lvstuff are being tracked in the temporary logical volume we created earlier. Make sure you have enough free space while the backup is happening. + +Once the backup finishes, unmount the volume and remove the temporary snapshot. + + umount /mnt/lvstuffbackup + lvremove /dev/vgpool/lvstuffbackup/ + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/630x102xlvremove.png.pagespeed.ic.yBWk47X6lF.png) + +#### Deleting a Logical Volume #### + +To delete a logical volume you need to first make sure the volume is unmounted, and then you can use lvremove to delete it. You can also remove a volume group once the logical volumes have been deleted and a physical volume after the volume group is deleted. + +Here are all the commands using the volumes and groups we’ve created. + + umount /mnt/lvstuff + lvremove /dev/vgpool/lvstuff + vgremove vgpool + pvremove /dev/sdb1 /dev/sdc1 + +![](http://cdn5.howtogeek.com/wp-content/uploads/2011/02/580x185xdelete-lvm.png.pagespeed.ic.3zJTo0Zu9k.png) + +That should cover most of what you need to know to use LVM. If you’ve got some experience on the topic, be sure to share your wisdom in the comments. + +-------------------------------------------------------------------------------- + +via: http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/ + +译者:[runningwater](https://github.com/runningwater) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.howtogeek.com/howto/36568/what-is-logical-volume-management-and-how-do-you-enable-it-in-ubuntu/ +[2]:http://www.howtogeek.com/howto/17001/how-to-format-a-usb-drive-in-ubuntu-using-gparted/ +[3]:http://www.howtogeek.com/howto/33552/htg-explains-which-linux-file-system-should-you-choose/ \ No newline at end of file diff --git a/sources/tech/20150318 How to Use LVM on Ubuntu for Easy Partition Resizing and Snapshots.md b/sources/tech/20150318 How to Use LVM on Ubuntu for Easy Partition Resizing and Snapshots.md new file mode 100644 index 0000000000..883c5e3203 --- /dev/null +++ b/sources/tech/20150318 How to Use LVM on Ubuntu for Easy Partition Resizing and Snapshots.md @@ -0,0 +1,68 @@ + +How to Use LVM on Ubuntu for Easy Partition Resizing and Snapshots +================================================================================ +![](http://cdn5.howtogeek.com/wp-content/uploads/2015/03/ximg_55035707bbd74.png.pagespeed.ic.9_yebxUF1C.png) + +Ubuntu’s installer offers an easy “Use LVM” checkbox. The description says it enables Logical Volume Management so you can take snapshots and more easily resize your hard disk partitions — here’s how to do that. + +LVM is a technology that’s similar to [RAID arrays][1] or [Storage Spaces on Windows][2] in some ways. While this technology is particularly useful on servers, it can be used on desktop PCs, too. + +### Should You Use LVM With Your New Ubuntu Installation? ### + +The first question is whether you even want to use LVM with your Ubuntu installation. Ubuntu makes this easy to enable with a quick click, but this option isn’t enabled by default. As the installer says, this allows you to resize partitions, create snapshots, merge multiple disks into a single logical volume, and so on — all while the system is running. Unlike with typical partitions, you don’t have to shut down your system, boot from a live CD or USB drive, and [resize your partitions while they aren’t in use][3]. + +To be perfectly honest, the average Ubuntu desktop user probably won’t realize whether they’re using LVM or not. But, if you want to do more advanced things later, LVM can help. LVM is potentially more complex, which could cause problems if you need to recover your data later — especially if you’re not that experienced with it. There shouldn’t be a noticeable performance penalty here — LVM is implemented right down in the Linux kernel. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2015/03/ximg_55035cbada6ae.png.pagespeed.ic.cnqyiKfCvi.png) + +### Logical Volume Management Explained ### + +We’re previously [explained what LVM is][4]. In a nutshell, it provides a layer of abstraction between your physical disks and the partitions presented to your operating system. For example, your computer might have two hard drives inside it, each 1 TB in size. You’d have to have at least two partitions on these disks, and each of these partitions would be 1 TB in size. + +LVM provides a layer of abstraction over this. Instead of the traditional partition on a disk, LVM would treat the disks as two separate “physical volumes” after you initialize them. You could then create “logical volumes” based on these physical volumes. For example, you could combine those two 1 TB disks into a single 2 TB partition. Your operating system would just see a 2 TB volume, and LVM would deal with everything in the background. A group of physical volumes and logical volumes is known as a “volume group.” A typical system will just have a single volume group. + +This layer of abstraction makes it possibly to easily resize partitions, combine multiple disks into a single volume, and even take “snapshots” of a partition’s file system while it’s running, all without unmounting it. + +Note that merging multiple disks into a single volume can be a bad idea if you’re not creating backups. It’s like with RAID 0 — if you combine two 1 TB volumes into a single 2 TB volume, you could lose important data on the volume if just one of your hard disks fails. Backups are crucial if you go this route. + +### Graphical Utilities for Managing Your LVM Volumes ### + +Traditionally, [LVM volumes are managed with Linux terminal commands][5].These will work for you on Ubuntu, but there’s an easier, graphical method anyone can take advantage of. If you’re a Linux user used to using GParted or a similar partition manager, don’t bother — GParted doesn’t have support for LVM disks. + +Instead, you can use the Disks utility included along with Ubuntu for this. This utility is also known as GNOME Disk Utility, or Palimpsest. Launch it by clicking the icon on the dash, searching for Disks, and pressing Enter. Unlike GParted, the Disks utility will display your LVM partitions under “Other Devices,” so you can format them and adjust other options if you need to. This utility will also work from a live CD or USB drive, too. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2015/03/ximg_550361b3772f7.png.pagespeed.ic.nZWwLJUywR.png) + +Unfortunately, the Disks utility doesn’t include support for taking advantage of LVM’s most powerful features. There’s no options for managing your volume groups, extending partitions, or taking snapshots. You could do that from the terminal, but you don’t have to. Instead, you can open the Ubuntu Software Center, search for LVM, and install the Logical Volume Management tool. You could also just run the **sudo apt-get install system-config-lvm** command in a terminal window. After it’s installed, you can open the Logical Volume Management utility from the dash. + +This graphical configuration tool was made by Red Hat. It’s a bit dated, but it’s the only graphical way to do this stuff without resorting to terminal commands. + +Let’s say you wanted to add a new physical volume to your volume group. You’d open the tool, select the new disk under Uninitialized Entries, and click the “Initialize Entry” button. You’d then find the new physical volume under Unallocated Volumes, and you could use the “Add to existing Volume Group” button to add it to the “ubuntu-vg” volume group Ubuntu created during the installation process. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2015/03/ximg_550363106789c.png.pagespeed.ic.drVInt3Weq.png) + +The volume group view shows you a visual overview of your physical volumes and logical volumes. Here, we have two physical partitions across two separate hard drives. We have a swap partition and a root partition, just as Ubuntu sets up its partitioning scheme by default. Because we’ve added a second physical partition from another drive, there’s now a good chunk of unused space. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2015/03/ximg_550363f631c19.png.pagespeed.ic.54E_Owcq8y.png) + +To expand a logical partition into the physical space, you could select it under Logical View, click Edit Properties, and modify the size to grow the partition. You could also shrink it from here. + +![](http://cdn5.howtogeek.com/wp-content/uploads/2015/03/ximg_55036893712d3.png.pagespeed.ic.ce7y_Mt0uF.png) + +The other options in system-config-lvm allow you to set up snapshots and mirroring. You probably won’t need these features on a typical desktop, but they’re available graphically here. Remember, you can also [do all of this with terminal commands][6]. + +-------------------------------------------------------------------------------- + +via: http://www.howtogeek.com/211937/how-to-use-lvm-on-ubuntu-for-easy-partition-resizing-and-snapshots/ + +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.howtogeek.com/162676/how-to-use-multiple-disks-intelligently-an-introduction-to-raid/ +[2]:http://www.howtogeek.com/109380/how-to-use-windows-8s-storage-spaces-to-mirror-combine-drives/ +[3]:http://www.howtogeek.com/114503/how-to-resize-your-ubuntu-partitions/ +[4]:http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/ +[5]:http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/ +[6]:http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/ \ No newline at end of file diff --git a/sources/tech/20150331 How to set up remote desktop on Linux VPS using x2go.md b/sources/tech/20150331 How to set up remote desktop on Linux VPS using x2go.md new file mode 100644 index 0000000000..d89c91832e --- /dev/null +++ b/sources/tech/20150331 How to set up remote desktop on Linux VPS using x2go.md @@ -0,0 +1,137 @@ +How to set up remote desktop on Linux VPS using x2go +================================================================================ +As everything is moved to the cloud, virtualized remote desktop becomes increasingly popular in the industry as a way to enhance employee's productivity. Especially for those who need to roam constantly across multiple locations and devices, remote desktop allows them to stay connected seamlessly to their work environment. Remote desktop is attractive for employers as well, achieving increased agility and flexibility in work environments, lower IT cost due to hardware consolidation, desktop security hardening, and so on. + +In the world of Linux, of course there is no shortage of choices for settings up remote desktop environment, with many protocols (e.g., RDP, RFB, NX) and server/client implementations (e.g., [TigerVNC][1], RealVNC, FreeNX, x2go, X11vnc, TeamViewer) available. + +Standing out from the pack is [X2Go][2], an open-source (GPLv2) implementation of NX-based remote desktop server and client. In this tutorial, I am going to demonstrate **how to set up remote desktop environment for [Linux VPS][3] using X2Go**. + +### What is X2Go? ### + +The history of X2Go goes back to NoMachine's NX technology. The NX remote desktop protocol was designed to deal with low bandwidth and high latency network connections by leveraging aggressive compression and caching. Later, NX was turned into closed-source while NX libraries were made GPL-ed. This has led to open-source implementation of several NX-based remote desktop solutions, and one of them is X2Go. + +What benefits does X2Go bring to the table, compared to other solutions such as VNC? X2Go inherits all the advanced features of NX technology, so naturally it works well over slow network connections. Besides, X2Go boasts of an excellent track record of ensuring security with its built-in SSH-based encryption. No longer need to set up an SSH tunnel [manually][4]. X2Go comes with audio support out of box, which means that music playback at the remote desktop is delivered (via PulseAudio) over network, and fed into local speakers. On usability front, an application that you run on remote desktop can be seamlessly rendered as a separate window on your local desktop, giving you an illusion that the application is actually running on the local desktop. As you can see, these are some of [its powerful features][5] lacking in VNC based solutions. + +### X2GO's Desktop Environment Compatibility ### + +As with other remote desktop servers, there are [known compatibility issues][6] for X2Go server. Desktop environments like KDE3/4, Xfce, MATE and LXDE are the most friendly to X2Go server. However, your mileage may vary with other desktop managers. For example, the later versions of GNOME 3, KDE5, Unity are known to be not compatible with X2Go. If the desktop manager of your remote host is compatible with X2Go, you can follow the rest of the tutorial. + +### Install X2Go Server on Linux ### + +X2Go consists of remote desktop server and client components. Let's start with X2Go server installation. I assume that you already have an X2Go-compatible desktop manager up and running on a remote host, where we will be installing X2Go server. + +Note that X2Go server component does not have a separate service that needs to be started upon boot. You just need to make sure that SSH service is up and running. + +#### Ubuntu or Linux Mint: #### + +Configure X2Go PPA repository. X2Go PPA is available for Ubuntu 14.04 and higher. + + $ sudo add-apt-repository ppa:x2go/stable + $ sudo apt-get update + $ sudo apt-get install x2goserver x2goserver-xsession + +#### Debian (Wheezy): #### + + $ sudo apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E + $ sudo sh -c "echo deb http://packages.x2go.org/debian wheezy main > /etc/apt/sources.list.d/x2go.list" + $ sudo sh -c "echo deb-src http://packages.x2go.org/debian wheezy main >> /etc/apt/sources.list.d/x2go.list" + $ sudo apt-get update + $ sudo apt-get install x2goserver x2goserver-xsession + +#### Fedora: #### + + $ sudo yum install x2goserver x2goserver-xsession + +#### CentOS/RHEL: #### + +Enable [EPEL respository][7] first, and then run: + + $ sudo yum install x2goserver x2goserver-xsession + +### Install X2Go Client on Linux ### + +On a local host where you will be connecting to remote desktop, install X2GO client as follows. + +#### Ubuntu or Linux Mint: #### + +Configure X2Go PPA repository. X2Go PPA is available for Ubuntu 14.04 and higher. + + $ sudo add-apt-repository ppa:x2go/stable + $ sudo apt-get update + $ sudo apt-get install x2goclient + +Debian (Wheezy): + + $ sudo apt-key adv --recv-keys --keyserver keys.gnupg.net E1F958385BFE2B6E + $ sudo sh -c "echo deb http://packages.x2go.org/debian wheezy main > /etc/apt/sources.list.d/x2go.list" + $ sudo sh -c "echo deb-src http://packages.x2go.org/debian wheezy main >> /etc/apt/sources.list.d/x2go.list" + $ sudo apt-get update + $ sudo apt-get install x2goclient + +#### Fedora: #### + + $ sudo yum install x2goclient + +CentOS/RHEL: + +Enable EPEL respository first, and then run: + + $ sudo yum install x2goclient + +### Connect to Remote Desktop with X2Go Client ### + +Now it's time to connect to your remote desktop. On the local host, simply run the following command or use desktop launcher to start X2Go client. + + $ x2goclient + +Enter the remote host's IP address and SSH user name. Also, specify session type (i.e., desktop manager of a remote host). + +![](https://farm9.staticflickr.com/8730/16365755693_75f3d544e9_b.jpg) + +If you want, you can customize other things (by pressing other tabs), like connection speed, compression, screen resolution, and so on. + +![](https://farm9.staticflickr.com/8699/16984498482_665b975eca_b.jpg) + +![](https://farm9.staticflickr.com/8694/16985838755_1b7df1eb78_b.jpg) + +When you initiate a remote desktop connection, you will be asked to log in. Type your SSH login and password. + +![](https://farm9.staticflickr.com/8754/16984498432_1c8068b817_b.jpg) + +Upon successful login, you will see the remote desktop screen. + +![](https://farm9.staticflickr.com/8752/16798126858_1ab083ba80_c.jpg) + +If you want to test X2Go's seamless window feature, choose "Single application" as session type, and specify the path to an executable on the remote host. In this example, I choose Dolphin file manager on a remote KDE host. + +![](https://farm8.staticflickr.com/7584/16798393920_128c3af9c5_b.jpg) + +Once you are successfully connected, you will see a remote application window open on your local desktop, not the entire remote desktop screen. + +![](https://farm9.staticflickr.com/8742/16365755713_7b90cf65f0_c.jpg) + +### Conclusion ### + +In this tutorial, I demonstrated how to set up X2Go remote desktop on [Linux VPS][8] instance. As you can see, the whole setup process is pretty much painless (if you are using a right desktop environment). While there are some desktop-specific quirkiness, X2Go is a solid remote desktop solution which is secure, feature-rich, fast, and free. + +What feature is the most appealing to you in X2Go? Please share your thought. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/x2go-remote-desktop-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]:http://ask.xmodulo.com/centos-remote-desktop-vps.html +[2]:http://wiki.x2go.org/ +[3]:http://xmodulo.com/go/digitalocean +[4]:http://xmodulo.com/how-to-set-up-vnc-over-ssh.html +[5]:http://wiki.x2go.org/doku.php/doc:newtox2go +[6]:http://wiki.x2go.org/doku.php/doc:de-compat +[7]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html +[8]:http://xmodulo.com/go/digitalocean diff --git a/sources/tech/20150401 ZMap Documentation.md b/sources/tech/20150401 ZMap Documentation.md new file mode 100644 index 0000000000..d2aa316c1f --- /dev/null +++ b/sources/tech/20150401 ZMap Documentation.md @@ -0,0 +1,743 @@ +ZMap Documentation +================================================================================ +1. Getting Started with ZMap +1. Scanning Best Practices +1. Command Line Arguments +1. Additional Information + 1. TCP SYN Probe Module + 1. ICMP Echo Probe Module + 1. UDP Probe Module + 1. Configuration Files + 1. Verbosity + 1. Results Output + 1. Blacklisting + 1. Rate Limiting and Sampling + 1. Sending Multiple Probes +1. Extending ZMap + 1. Sample Applications + 1. Writing Probe and Output Modules + +---------- + +### Getting Started with ZMap ### + +ZMap is designed to perform comprehensive scans of the IPv4 address space or large portions of it. While ZMap is a powerful tool for researchers, please keep in mind that by running ZMap, you are potentially scanning the ENTIRE IPv4 address space at over 1.4 million packets per second. Before performing even small scans, we encourage users to contact their local network administrators and consult our list of scanning best practices. + +By default, ZMap will perform a TCP SYN scan on the specified port at the maximum rate possible. A more conservative configuration that will scan 10,000 random addresses on port 80 at a maximum 10 Mbps can be run as follows: + + $ zmap --bandwidth=10M --target-port=80 --max-targets=10000 --output-file=results.csv + +Or more concisely specified as: + + $ zmap -B 10M -p 80 -n 10000 -o results.csv + +ZMap can also be used to scan specific subnets or CIDR blocks. For example, to scan only 10.0.0.0/8 and 192.168.0.0/16 on port 80, run: + + zmap -p 80 -o results.csv 10.0.0.0/8 192.168.0.0/16 + +If the scan started successfully, ZMap will output status updates every one second similar to the following: + + 0% (1h51m left); send: 28777 562 Kp/s (560 Kp/s avg); recv: 1192 248 p/s (231 p/s avg); hits: 0.04% + 0% (1h51m left); send: 34320 554 Kp/s (559 Kp/s avg); recv: 1442 249 p/s (234 p/s avg); hits: 0.04% + 0% (1h50m left); send: 39676 535 Kp/s (555 Kp/s avg); recv: 1663 220 p/s (232 p/s avg); hits: 0.04% + 0% (1h50m left); send: 45372 570 Kp/s (557 Kp/s avg); recv: 1890 226 p/s (232 p/s avg); hits: 0.04% + +These updates provide information about the current state of the scan and are of the following form: %-complete (est time remaining); packets-sent curr-send-rate (avg-send-rate); recv: packets-recv recv-rate (avg-recv-rate); hits: hit-rate + +If you do not know the scan rate that your network can support, you may want to experiment with different scan rates or bandwidth limits to find the fastest rate that your network can support before you see decreased results. + +By default, ZMap will output the list of distinct IP addresses that responded successfully (e.g. with a SYN ACK packet) similar to the following. There are several additional formats (e.g. JSON and Redis) for outputting results as well as options for producing programmatically parsable scan statistics. As wells, additional output fields can be specified and the results can be filtered using an output filter. + + 115.237.116.119 + 23.9.117.80 + 207.118.204.141 + 217.120.143.111 + 50.195.22.82 + +We strongly encourage you to use a blacklist file, to exclude both reserved/unallocated IP space (e.g. multicast, RFC1918), as well as networks that request to be excluded from your scans. By default, ZMap will utilize a simple blacklist file containing reserved and unallocated addresses located at `/etc/zmap/blacklist.conf`. If you find yourself specifying certain settings, such as your maximum bandwidth or blacklist file every time you run ZMap, you can specify these in `/etc/zmap/zmap.conf` or use a custom configuration file. + +If you are attempting to troubleshoot scan related issues, there are several options to help debug. First, it is possible can perform a dry run scan in order to see the packets that would be sent over the network by adding the `--dryrun` flag. As well, it is possible to change the logging verbosity by setting the `--verbosity=n` flag. + +---------- + +### Scanning Best Practices ### + +We offer these suggestions for researchers conducting Internet-wide scans as guidelines for good Internet citizenship. + +- Coordinate closely with local network administrators to reduce risks and handle inquiries +- Verify that scans will not overwhelm the local network or upstream provider +- Signal the benign nature of the scans in web pages and DNS entries of the source addresses +- Clearly explain the purpose and scope of the scans in all communications +- Provide a simple means of opting out and honor requests promptly +- Conduct scans no larger or more frequent than is necessary for research objectives +- Spread scan traffic over time or source addresses when feasible + +It should go without saying that scan researchers should refrain from exploiting vulnerabilities or accessing protected resources, and should comply with any special legal requirements in their jurisdictions. + +---------- + +### Command Line Arguments ### + +#### Common Options #### + +These options are the most common options when performing a simple scan. We note that some options are dependent on the probe module or output module used (e.g. target port is not used when performing an ICMP Echo Scan). + + +**-p, --target-port=port** + +TCP port number to scan (e.g. 443) + +**-o, --output-file=name** + +Write results to this file. Use - for stdout + +**-b, --blacklist-file=path** + +File of subnets to exclude, in CIDR notation (e.g. 192.168.0.0/16), one-per line. It is recommended you use this to exclude RFC 1918 addresses, multicast, IANA reserved space, and other IANA special-purpose addresses. An example blacklist file is provided in conf/blacklist.example for this purpose. + +#### Scan Options #### + +**-n, --max-targets=n** + +Cap the number of targets to probe. This can either be a number (e.g. `-n 1000`) or a percentage (e.g. `-n 0.1%`) of the scannable address space (after excluding blacklist) + +**-N, --max-results=n** + +Exit after receiving this many results + +**-t, --max-runtime=secs** + +Cap the length of time for sending packets + +**-r, --rate=pps** + +Set the send rate in packets/sec + +**-B, --bandwidth=bps** + +Set the send rate in bits/second (supports suffixes G, M, and K (e.g. `-B 10M` for 10 mbps). This overrides the `--rate` flag. + +**-c, --cooldown-time=secs** + +How long to continue receiving after sending has completed (default=8) + +**-e, --seed=n** + +Seed used to select address permutation. Use this if you want to scan addresses in the same order for multiple ZMap runs. + +**--shards=n** + +Split the scan up into N shards/partitions among different instances of zmap (default=1). When sharding, `--seed` is required + +**--shard=n** + +Set which shard to scan (default=0). Shards are indexed in the range [0, N), where N is the total number of shards. When sharding `--seed` is required. + +**-T, --sender-threads=n** + +Threads used to send packets (default=1) + +**-P, --probes=n** + +Number of probes to send to each IP (default=1) + +**-d, --dryrun** + +Print out each packet to stdout instead of sending it (useful for debugging) + +#### Network Options #### + +**-s, --source-port=port|range** + +Source port(s) to send packets from + +**-S, --source-ip=ip|range** + +Source address(es) to send packets from. Either single IP or range (e.g. 10.0.0.1-10.0.0.9) + +**-G, --gateway-mac=addr** + +Gateway MAC address to send packets to (in case auto-detection does not work) + +**-i, --interface=name** + +Network interface to use + +#### Probe Options #### + +ZMap allows users to specify and write their own probe modules for use with ZMap. Probe modules are responsible for generating probe packets to send, and processing responses from hosts. + +**--list-probe-modules** + +List available probe modules (e.g. tcp_synscan) + +**-M, --probe-module=name** + +Select probe module (default=tcp_synscan) + +**--probe-args=args** + +Arguments to pass to probe module + +**--list-output-fields** + +List the fields the selected probe module can send to the output module + +#### Output Options #### + +ZMap allows users to specify and write their own output modules for use with ZMap. Output modules are responsible for processing the fieldsets returned by the probe module, and outputing them to the user. Users can specify output fields, and write filters over the output fields. + +**--list-output-modules** + +List available output modules (e.g. tcp_synscan) + +**-O, --output-module=name** + +Select output module (default=csv) + +**--output-args=args** + +Arguments to pass to output module + +**-f, --output-fields=fields** + +Comma-separated list of fields to output + +**--output-filter** + +Specify an output filter over the fields defined by the probe module + +#### Additional Options #### + +**-C, --config=filename** + +Read a configuration file, which can specify any other options. + +**-q, --quiet** + +Do not print status updates once per second + +**-g, --summary** + +Print configuration and summary of results at the end of the scan + +**-v, --verbosity=n** + +Level of log detail (0-5, default=3) + +**-h, --help** + +Print help and exit + +**-V, --version** + +Print version and exit + +---------- + +### Additional Information ### + +#### TCP SYN Scans #### + +When performing a TCP SYN scan, ZMap requires a single target port and supports specifying a range of source ports from which the scan will originate. + +**-p, --target-port=port** + +TCP port number to scan (e.g. 443) + +**-s, --source-port=port|range** + +Source port(s) for scan packets (e.g. 40000-50000) + +**Warning!** ZMap relies on the Linux kernel to respond to SYN/ACK packets with RST packets in order to close connections opened by the scanner. This occurs because ZMap sends packets at the Ethernet layer in order to reduce overhead otherwise incurred in the kernel from tracking open TCP connections and performing route lookups. As such, if you have a firewall rule that tracks established connections such as a netfilter rule similar to `-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT`, this will block SYN/ACK packets from reaching the kernel. This will not prevent ZMap from recording responses, but it will prevent RST packets from being sent back, ultimately using up a connection on the scanned host until your connection times out. We strongly recommend that you select a set of unused ports on your scanning host which can be allowed access in your firewall and specifying this port range when executing ZMap, with the `-s` flag (e.g. `-s '50000-60000'`). + +#### ICMP Echo Request Scans #### + +While ZMap performs TCP SYN scans by default, it also supports ICMP echo request scans in which an ICMP echo request packet is sent to each host and the type of ICMP response received in reply is denoted. An ICMP scan can be performed by selecting the icmp_echoscan scan module similar to the following: + + $ zmap --probe-module=icmp_echoscan + +#### UDP Datagram Scans #### + +ZMap additionally supports UDP probes, where it will send out an arbitrary UDP datagram to each host, and receive either UDP or ICMP Unreachable responses. ZMap supports four different methods of setting the UDP payload through the --probe-args command-line option. These are 'text' for ASCII-printable payloads, 'hex' for hexadecimal payloads set on the command-line, 'file' for payloads contained in an external file, and 'template' for payloads that require dynamic field generation. In order to obtain the UDP response, make sure that you specify 'data' as one of the fields to report with the -f option. + +The example below will send the two bytes 'ST', a PCAnwywhere 'status' request, to UDP port 5632. + + $ zmap -M udp -p 5632 --probe-args=text:ST -N 100 -f saddr,data -o - + +The example below will send the byte '0x02', a SQL Server 'client broadcast' request, to UDP port 1434. + + $ zmap -M udp -p 1434 --probe-args=hex:02 -N 100 -f saddr,data -o - + +The example below will send a NetBIOS status request to UDP port 137. This uses a payload file that is included with the ZMap distribution. + + $ zmap -M udp -p 1434 --probe-args=file:netbios_137.pkt -N 100 -f saddr,data -o - + +The example below will send a SIP 'OPTIONS' request to UDP port 5060. This uses a template file that is included with the ZMap distribution. + + $ zmap -M udp -p 1434 --probe-args=file:sip_options.tpl -N 100 -f saddr,data -o - + +UDP payload templates are still experimental. You may encounter crashes when more using more than one send thread (-T) and there is a significant decrease in performance compared to static payloads. A template is simply a payload file that contains one or more field specifiers enclosed in a ${} sequence. Some protocols, notably SIP, require the payload to reflect the source and destination of the packet. Other protocols, such as portmapper and DNS, contain fields that should be randomized per request or risk being dropped by multi-homed systems scanned by ZMap. + +The payload template below will send a SIP OPTIONS request to every destination: + + OPTIONS sip:${RAND_ALPHA=8}@${DADDR} SIP/2.0 + Via: SIP/2.0/UDP ${SADDR}:${SPORT};branch=${RAND_ALPHA=6}.${RAND_DIGIT=10};rport;alias + From: sip:${RAND_ALPHA=8}@${SADDR}:${SPORT};tag=${RAND_DIGIT=8} + To: sip:${RAND_ALPHA=8}@${DADDR} + Call-ID: ${RAND_DIGIT=10}@${SADDR} + CSeq: 1 OPTIONS + Contact: sip:${RAND_ALPHA=8}@${SADDR}:${SPORT} + Content-Length: 0 + Max-Forwards: 20 + User-Agent: ${RAND_ALPHA=8} + Accept: text/plain + +In the example above, note that line endings are \r\n and the end of this request must contain \r\n\r\n for most SIP implementations to correcly process it. A working example is included in the examples/udp-payloads directory of the ZMap source tree (sip_options.tpl). + +The following template fields are currently implemented: + + +- **SADDR**: Source IP address in dotted-quad format +- **SADDR_N**: Source IP address in network byte order +- **DADDR**: Destination IP address in dotted-quad format +- **DADDR_N**: Destination IP address in network byte order +- **SPORT**: Source port in ascii format +- **SPORT_N**: Source port in network byte order +- **DPORT**: Destination port in ascii format +- **DPORT_N**: Destination port in network byte order +- **RAND_BYTE**: Random bytes (0-255), length specified with =(length) parameter +- **RAND_DIGIT**: Random digits from 0-9, length specified with =(length) parameter +- **RAND_ALPHA**: Random mixed-case letters from A-Z, length specified with =(length) parameter +- **RAND_ALPHANUM**: Random mixed-case letters from A-Z and digits from 0-9, length specified with =(length) parameter + +### Configuration Files ### + +ZMap supports configuration files instead of requiring all options to be specified on the command-line. A configuration can be created by specifying one long-name option and the value per line such as: + + interface "eth1" + source-ip 1.1.1.4-1.1.1.8 + gateway-mac b4:23:f9:28:fa:2d # upstream gateway + cooldown-time 300 # seconds + blacklist-file /etc/zmap/blacklist.conf + output-file ~/zmap-output + quiet + summary + +ZMap can then be run with a configuration file and specifying any additional necessary parameters: + + $ zmap --config=~/.zmap.conf --target-port=443 + +### Verbosity ### + +There are several types of on-screen output that ZMap produces. By default, ZMap will print out basic progress information similar to the following every 1 second. This can be disabled by setting the `--quiet` flag. + + 0:01 12%; send: 10000 done (15.1 Kp/s avg); recv: 144 143 p/s (141 p/s avg); hits: 1.44% + +ZMap also prints out informational messages during scanner configuration such as the following, which can be controlled with the `--verbosity` argument. + + Aug 11 16:16:12.813 [INFO] zmap: started + Aug 11 16:16:12.817 [DEBUG] zmap: no interface provided. will use eth0 + Aug 11 16:17:03.971 [DEBUG] cyclic: primitive root: 3489180582 + Aug 11 16:17:03.971 [DEBUG] cyclic: starting point: 46588 + Aug 11 16:17:03.975 [DEBUG] blacklist: 3717595507 addresses allowed to be scanned + Aug 11 16:17:03.975 [DEBUG] send: will send from 1 address on 28233 source ports + Aug 11 16:17:03.975 [DEBUG] send: using bandwidth 10000000 bits/s, rate set to 14880 pkt/s + Aug 11 16:17:03.985 [DEBUG] recv: thread started + +ZMap also supports printing out a grep-able summary at the end of the scan, similar to below, which can be invoked with the `--summary` flag. + + cnf target-port 443 + cnf source-port-range-begin 32768 + cnf source-port-range-end 61000 + cnf source-addr-range-begin 1.1.1.4 + cnf source-addr-range-end 1.1.1.8 + cnf maximum-packets 4294967295 + cnf maximum-runtime 0 + cnf permutation-seed 0 + cnf cooldown-period 300 + cnf send-interface eth1 + cnf rate 45000 + env nprocessors 16 + exc send-start-time Fri Jan 18 01:47:35 2013 + exc send-end-time Sat Jan 19 00:47:07 2013 + exc recv-start-time Fri Jan 18 01:47:35 2013 + exc recv-end-time Sat Jan 19 00:52:07 2013 + exc sent 3722335150 + exc blacklisted 572632145 + exc first-scanned 1318129262 + exc hit-rate 0.874102 + exc synack-received-unique 32537000 + exc synack-received-total 36689941 + exc synack-cooldown-received-unique 193 + exc synack-cooldown-received-total 1543 + exc rst-received-unique 141901021 + exc rst-received-total 166779002 + adv source-port-secret 37952 + adv permutation-gen 4215763218 + +### Results Output ### + +ZMap can produce results in several formats through the use of **output modules**. By default, ZMap only supports **csv** output, however support for **redis** and **json** can be compiled in. The results sent to these output modules may be filtered using an **output filter**. The fields the output module writes are specified by the user. By default, ZMap will return results in csv format and if no output file is specified, ZMap will not produce specific results. It is also possible to write your own output module; see Writing Output Modules for information. + +**-o, --output-file=p** + +File to write output to + +**-O, --output-module=p** + +Invoke a custom output module + + +**-f, --output-fields=p** + +Comma-separated list of fields to output + +**--output-filter=filter** + +Specify an output filter over fields for a given probe + +**--list-output-modules** + +Lists available output modules + +**--list-output-fields** + +List available output fields for a given probe + +#### Output Fields #### + +ZMap has a variety of fields it can output beyond IP address. These fields can be viewed for a given probe module by running with the `--list-output-fields` flag. + + $ zmap --probe-module="tcp_synscan" --list-output-fields + saddr string: source IP address of response + saddr-raw int: network order integer form of source IP address + daddr string: destination IP address of response + daddr-raw int: network order integer form of destination IP address + ipid int: IP identification number of response + ttl int: time-to-live of response packet + sport int: TCP source port + dport int: TCP destination port + seqnum int: TCP sequence number + acknum int: TCP acknowledgement number + window int: TCP window + classification string: packet classification + success int: is response considered success + repeat int: is response a repeat response from host + cooldown int: Was response received during the cooldown period + timestamp-str string: timestamp of when response arrived in ISO8601 format. + timestamp-ts int: timestamp of when response arrived in seconds since Epoch + timestamp-us int: microsecond part of timestamp (e.g. microseconds since 'timestamp-ts') + +To select which fields to output, any combination of the output fields can be specified as a comma-separated list using the `--output-fields=fields` or `-f` flags. Example: + + $ zmap -p 80 -f "response,saddr,daddr,sport,seq,ack,in_cooldown,is_repeat,timestamp" -o output.csv + +#### Filtering Output #### + +Results generated by a probe module can be filtered before being passed to the output module. Filters are defined over the output fields of a probe module. Filters are written in a simple filtering language, similar to SQL, and are passed to ZMap using the **--output-filter** option. Output filters are commonly used to filter out duplicate results, or to only pass only sucessful responses to the output module. + +Filter expressions are of the form ` `. The type of `` must be either a string or unsigned integer literal, and match the type of ``. The valid operations for integer comparisons are `= !=, <, >, <=, >=`. The operations for string comparisons are =, !=. The `--list-output-fields` flag will print what fields and types are available for the selected probe module, and then exit. + +Compound filter expressions may be constructed by combining filter expressions using parenthesis to specify order of operations, the `&&` (logical AND) and `||` (logical OR) operators. + +**Examples** + +Write a filter for only successful, non-duplicate responses + + --output-filter="success = 1 && repeat = 0" + +Filter for packets that have classification RST and a TTL greater than 10, or for packets with classification SYNACK + + --output-filter="(classification = rst && ttl > 10) || classification = synack" + +#### CSV #### + +The csv module will produce a comma-separated value file of the output fields requested. For example, the following command produces the following CSV in a file called `output.csv`. + + $ zmap -p 80 -f "response,saddr,daddr,sport,seq,ack,in_cooldown,is_repeat,timestamp" -o output.csv + +---------- + + response, saddr, daddr, sport, dport, seq, ack, in_cooldown, is_repeat, timestamp + synack, 159.174.153.144, 10.0.0.9, 80, 40555, 3050964427, 3515084203, 0, 0,2013-08-15 18:55:47.681 + rst, 141.209.175.1, 10.0.0.9, 80, 40136, 0, 3272553764, 0, 0,2013-08-15 18:55:47.683 + rst, 72.36.213.231, 10.0.0.9, 80, 56642, 0, 2037447916, 0, 0,2013-08-15 18:55:47.691 + rst, 148.8.49.150, 10.0.0.9, 80, 41672, 0, 1135824975, 0, 0,2013-08-15 18:55:47.692 + rst, 50.165.166.206, 10.0.0.9, 80, 38858, 0, 535206863, 0, 0,2013-08-15 18:55:47.694 + rst, 65.55.203.135, 10.0.0.9, 80, 50008, 0, 4071709905, 0, 0,2013-08-15 18:55:47.700 + synack, 50.57.166.186, 10.0.0.9, 80, 60650, 2813653162, 993314545, 0, 0,2013-08-15 18:55:47.704 + synack, 152.75.208.114, 10.0.0.9, 80, 52498, 460383682, 4040786862, 0, 0,2013-08-15 18:55:47.707 + synack, 23.72.138.74, 10.0.0.9, 80, 33480, 810393698, 486476355, 0, 0,2013-08-15 18:55:47.710 + +#### Redis #### + +The redis output module allows addresses to be added to a Redis queue instead of being saved to file which ultimately allows ZMap to be incorporated with post processing tools. + +**Heads Up!** ZMap does not build with Redis support by default. If you are building ZMap from source, you can build with Redis support by running CMake with `-DWITH_REDIS=ON`. + +### Blacklisting and Whitelisting ### + +ZMap supports both blacklisting and whitelisting network prefixes. If ZMap is not provided with blacklist or whitelist parameters, ZMap will scan all IPv4 addresses (including local, reserved, and multicast addresses). If a blacklist file is specified, network prefixes in the blacklisted segments will not be scanned; if a whitelist file is provided, only network prefixes in the whitelist file will be scanned. A whitelist and blacklist file can be used in coordination; the blacklist has priority over the whitelist (e.g. if you have whitelisted 10.0.0.0/8 and blacklisted 10.1.0.0/16, then 10.1.0.0/16 will not be scanned). Whitelist and blacklist files can be specified on the command-line as follows: + +**-b, --blacklist-file=path** + +File of subnets to blacklist in CIDR notation, e.g. 192.168.0.0/16 + +**-w, --whitelist-file=path** + +File of subnets to limit scan to in CIDR notation, e.g. 192.168.0.0/16 + +Blacklist files should be formatted with a single network prefix in CIDR notation per line. Comments are allowed using the `#` character. Example: + + # From IANA IPv4 Special-Purpose Address Registry + # http://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml + # Updated 2013-05-22 + + 0.0.0.0/8 # RFC1122: "This host on this network" + 10.0.0.0/8 # RFC1918: Private-Use + 100.64.0.0/10 # RFC6598: Shared Address Space + 127.0.0.0/8 # RFC1122: Loopback + 169.254.0.0/16 # RFC3927: Link Local + 172.16.0.0/12 # RFC1918: Private-Use + 192.0.0.0/24 # RFC6890: IETF Protocol Assignments + 192.0.2.0/24 # RFC5737: Documentation (TEST-NET-1) + 192.88.99.0/24 # RFC3068: 6to4 Relay Anycast + 192.168.0.0/16 # RFC1918: Private-Use + 192.18.0.0/15 # RFC2544: Benchmarking + 198.51.100.0/24 # RFC5737: Documentation (TEST-NET-2) + 203.0.113.0/24 # RFC5737: Documentation (TEST-NET-3) + 240.0.0.0/4 # RFC1112: Reserved + 255.255.255.255/32 # RFC0919: Limited Broadcast + + # From IANA Multicast Address Space Registry + # http://www.iana.org/assignments/multicast-addresses/multicast-addresses.xhtml + # Updated 2013-06-25 + + 224.0.0.0/4 # RFC5771: Multicast/Reserved + +If you are looking to scan only a random portion of the internet, checkout Sampling, instead of using whitelisting and blacklisting. + +**Heads Up!** The default ZMap configuration uses the blacklist file at `/etc/zmap/blacklist.conf`, which contains locally scoped address space and reserved IP ranges. The default configuration can be changed by editing `/etc/zmap/zmap.conf`. + +### Rate Limiting and Sampling ### + +By default, ZMap will scan at the fastest rate that your network adaptor supports. In our experiences on commodity hardware, this is generally around 95-98% of the theoretical speed of gigabit Ethernet, which may be faster than your upstream provider can handle. ZMap will not automatically adjust its send-rate based on your upstream provider. You may need to manually adjust your send-rate to reduce packet drops and incorrect results. + +**-r, --rate=pps** + +Set maximum send rate in packets/sec + +**-B, --bandwidth=bps** + +Set send rate in bits/sec (supports suffixes G, M, and K). This overrides the --rate flag. + +ZMap also allows random sampling of the IPv4 address space by specifying max-targets and/or max-runtime. Because hosts are scanned in a random permutation generated per scan instantiation, limiting a scan to n hosts will perform a random sampling of n hosts. Command-line options: + +**-n, --max-targets=n** + +Cap number of targets to probe + +**-N, --max-results=n** + +Cap number of results (exit after receiving this many positive results) + +**-t, --max-runtime=s** + +Cap length of time for sending packets (in seconds) + +**-s, --seed=n** + +Seed used to select address permutation. Specify the same seed in order to scan addresses in the same order for different ZMap runs. + +For example, if you wanted to scan the same one million hosts on the Internet for multiple scans, you could set a predetermined seed and cap the number of scanned hosts similar to the following: + + zmap -p 443 -s 3 -n 1000000 -o results + +In order to determine which one million hosts were going to be scanned, you could run the scan in dry-run mode which will print out the packets that would be sent instead of performing the actual scan. + + zmap -p 443 -s 3 -n 1000000 --dryrun | grep daddr + | awk -F'daddr: ' '{print $2}' | sed 's/ |.*//;' + +### Sending Multiple Packets ### + +ZMap supports sending multiple probes to each host. Increasing this number both increases scan time and hosts reached. However, we find that the increase in scan time (~100% per additional probe) greatly outweighs the increase in hosts reached (~1% per additional probe). + +**-P, --probes=n** + +The number of unique probes to send to each IP (default=1) + +---------- + +### Sample Applications ### + +ZMap is designed for initiating contact with a large number of hosts and finding ones that respond positively. However, we realize that many users will want to perform follow-up processing, such as performing an application level handshake. For example, users who perform a TCP SYN scan on port 80 might want to perform a simple GET request and users who scan port 443 may be interested in completing a TLS handshake. + +#### Banner Grab #### + +We have included a sample application, banner-grab, with ZMap that enables users to receive messages from listening TCP servers. Banner-grab connects to the provided servers, optionally sends a message, and prints out the first message received from the server. This tool can be used to fetch banners such as HTTP server responses to specific commands, telnet login prompts, or SSH server strings. + +This example finds 1000 servers listening on port 80, and sends a simple GET request to each, storing their base-64 encoded responses in http-banners.out + + $ zmap -p 80 -N 1000 -B 10M -o - | ./banner-grab-tcp -p 80 -c 500 -d ./http-req > out + +For more details on using `banner-grab`, see the README file in `examples/banner-grab`. + +**Heads Up!** ZMap and banner-grab can have significant performance and accuracy impact on one another if run simultaneously (as in the example). Make sure not to let ZMap saturate banner-grab-tcp's concurrent connections, otherwise banner-grab will fall behind reading stdin, causing ZMap to block on writing stdout. We recommend using a slower scanning rate with ZMap, and increasing the concurrency of banner-grab-tcp to no more than 3000 (Note that > 1000 concurrent connections requires you to use `ulimit -SHn 100000` and `ulimit -HHn 100000` to increase the maximum file descriptors per process). These parameters will of course be dependent on your server performance, and hit-rate; we encourage developers to experiment with small samples before running a large scan. + +#### Forge Socket #### + +We have also included a form of banner-grab, called forge-socket, that reuses the SYN-ACK sent from the server for the connection that ultimately fetches the banner. In `banner-grab-tcp`, ZMap sends a SYN to each server, and listening servers respond with a SYN+ACK. The ZMap host's kernel receives this, and sends a RST, as no active connection is associated with that packet. The banner-grab program must then create a new TCP connection to the same server to fetch data from it. + +In forge-socket, we utilize a kernel module by the same name, that allows us to create a connection with arbitrary TCP parameters. This enables us to suppress the kernel's RST packet, and instead create a socket that will reuse the SYN+ACK's parameters, and send and receive data through this socket as we would any normally connected socket. + +To use forge-socket, you will need the forge-socket kernel module, available from [github][1]. You should git clone `git@github.com:ewust/forge_socket.git` in the ZMap root source directory, and then cd into the forge_socket directory, and run make. Install the kernel module with `insmod forge_socket.ko` as root. + +You must also tell the kernel not to send RST packets. An easy way to disable RST packets system wide is to use **iptables**. `iptables -A OUTPUT -p tcp -m tcp --tcp-flgas RST,RST RST,RST -j DROP` as root will do this, though you may also add an optional --dport X to limit this to the port (X) you are scanning. To remove this after your scan completes, you can run `iptables -D OUTPUT -p tcp -m tcp --tcp-flags RST,RST RST,RST -j DROP` as root. + +Now you should be able to build the forge-socket ZMap example program. To run it, you must use the **extended_file** ZMap output module: + + $ zmap -p 80 -N 1000 -B 10M -O extended_file -o - | \ + ./forge-socket -c 500 -d ./http-req > ./http-banners.out + +See the README in `examples/forge-socket` for more details. + +---------- + +### Writing Probe and Output Modules ### + +ZMap can be extended to support different types of scanning through **probe modules** and additional types of results **output through** output modules. Registered probe and output modules can be listed through the command-line interface: + +**--list-probe-modules** + +Lists installed probe modules + +**--list-output-modules** + +Lists installed output modules + +#### Output Modules #### + +ZMap output and post-processing can be extended by implementing and registering **output modules** with the scanner. Output modules receive a callback for every received response packet. While the default provided modules provide simple output, these modules are also capable of performing additional post-processing (e.g. tracking duplicates or outputting numbers in terms of AS instead of IP address) + +Output modules are created by defining a new output_module struct and registering it in [output_modules.c][2]: + + typedef struct output_module { + const char *name; // how is output module referenced in the CLI + unsigned update_interval; // how often is update called in seconds + + output_init_cb init; // called at scanner initialization + output_update_cb start; // called at the beginning of scanner + output_update_cb update; // called every update_interval seconds + output_update_cb close; // called at scanner termination + + output_packet_cb process_ip; // called when a response is received + + const char *helptext; // Printed when --list-output-modules is called + + } output_module_t; + +Output modules must have a name, which is how they are referenced on the command-line and generally implement `success_ip` and oftentimes `other_ip` callback. The process_ip callback is called for every response packet that is received and passed through the output filter by the current **probe module**. The response may or may not be considered a success (e.g. it could be a TCP RST). These callbacks must define functions that match the `output_packet_cb` definition: + + int (*output_packet_cb) ( + + ipaddr_n_t saddr, // IP address of scanned host in network-order + ipaddr_n_t daddr, // destination IP address in network-order + + const char* response_type, // send-module classification of packet + + int is_repeat, // {0: first response from host, 1: subsequent responses} + int in_cooldown, // {0: not in cooldown state, 1: scanner in cooldown state} + + const u_char* packet, // pointer to struct iphdr of IP packet + size_t packet_len // length of packet in bytes + ); + +An output module can also register callbacks to be executed at scanner initialization (tasks such as opening an output file), start of the scan (tasks such as documenting blacklisted addresses), during regular intervals during the scan (tasks such as progress updates), and close (tasks such as closing any open file descriptors). These callbacks are provided with complete access to the scan configuration and current state: + + int (*output_update_cb)(struct state_conf*, struct state_send*, struct state_recv*); + +which are defined in [output_modules.h][3]. An example is available at [src/output_modules/module_csv.c][4]. + +#### Probe Modules #### + +Packets are constructed using probe modules which allow abstracted packet creation and response classification. ZMap comes with two scan modules by default: `tcp_synscan` and `icmp_echoscan`. By default, ZMap uses `tcp_synscan`, which sends TCP SYN packets, and classifies responses from each host as open (received SYN+ACK) or closed (received RST). ZMap also allows developers to write their own probe modules for use with ZMap, using the following API. + +Each type of scan is implemented by developing and registering the necessary callbacks in a `send_module_t` struct: + + typedef struct probe_module { + const char *name; // how scan is invoked on command-line + size_t packet_length; // how long is probe packet (must be static size) + + const char *pcap_filter; // PCAP filter for collecting responses + size_t pcap_snaplen; // maximum number of bytes for libpcap to capture + + uint8_t port_args; // set to 1 if ZMap requires a --target-port be + // specified by the user + + probe_global_init_cb global_initialize; // called once at scanner initialization + probe_thread_init_cb thread_initialize; // called once for each thread packet buffer + probe_make_packet_cb make_packet; // called once per host to update packet + probe_validate_packet_cb validate_packet; // called once per received packet, + // return 0 if packet is invalid, + // non-zero otherwise. + + probe_print_packet_cb print_packet; // called per packet if in dry-run mode + probe_classify_packet_cb process_packet; // called by receiver to classify response + probe_close_cb close; // called at scanner termination + + fielddef_t *fields // Definitions of the fields specific to this module + int numfields // Number of fields + + } probe_module_t; + +At scanner initialization, `global_initialize` is called once and can be utilized to perform any necessary global configuration or initialization. However, `global_initialize` does not have access to the packet buffer which is thread-specific. Instead, `thread_initialize` is called at the initialization of each sender thread and is provided with access to the buffer that will be used for constructing probe packets along with global source and destination values. This callback should be used to construct the host agnostic packet structure such that only specific values (e.g. destination host and checksum) need to be be updated for each host. For example, the Ethernet header will not change between headers (minus checksum which is calculated in hardware by the NIC) and therefore can be defined ahead of time in order to reduce overhead at scan time. + +The `make_packet` callback is called for each host that is scanned to allow the **probe module** to update host specific values and is provided with IP address values, an opaque validation string, and probe number (shown below). The probe module is responsible for placing as much of the verification string into the probe, in such a way that when a valid response is returned by a server, the probe module can verify that it is present. For example, for a TCP SYN scan, the tcp_synscan probe module can use the TCP source port and sequence number to store the validation string. Response packets (SYN+ACKs) will contain the expected values in the destination port and acknowledgement number. + + int make_packet( + void *packetbuf, // packet buffer + ipaddr_n_t src_ip, // source IP in network-order + ipaddr_n_t dst_ip, // destination IP in network-order + uint32_t *validation, // validation string to place in probe + int probe_num // if sending multiple probes per host, + // this will be which probe number for this + // host we are currently sending + ); + +Scan modules must also define `pcap_filter`, `validate_packet`, and `process_packet`. Only packets that match the PCAP filter will be considered by the scanner. For example, in the case of a TCP SYN scan, we only want to investigate TCP SYN/ACK or TCP RST packets and would utilize a filter similar to `tcp && tcp[13] & 4 != 0 || tcp[13] == 18`. The `validate_packet` function will be called for every packet that fulfills this PCAP filter. If the validation returns non-zero, the `process_packet` function will be called, and will populate a fieldset using fields defined in `fields` with data from the packet. For example, the following code processes a packet for the TCP synscan probe module. + + void synscan_process_packet(const u_char *packet, uint32_t len, fieldset_t *fs) + { + struct iphdr *ip_hdr = (struct iphdr *)&packet[sizeof(struct ethhdr)]; + struct tcphdr *tcp = (struct tcphdr*)((char *)ip_hdr + + (sizeof(struct iphdr))); + + fs_add_uint64(fs, "sport", (uint64_t) ntohs(tcp->source)); + fs_add_uint64(fs, "dport", (uint64_t) ntohs(tcp->dest)); + fs_add_uint64(fs, "seqnum", (uint64_t) ntohl(tcp->seq)); + fs_add_uint64(fs, "acknum", (uint64_t) ntohl(tcp->ack_seq)); + fs_add_uint64(fs, "window", (uint64_t) ntohs(tcp->window)); + + if (tcp->rst) { // RST packet + fs_add_string(fs, "classification", (char*) "rst", 0); + fs_add_uint64(fs, "success", 0); + } else { // SYNACK packet + fs_add_string(fs, "classification", (char*) "synack", 0); + fs_add_uint64(fs, "success", 1); + } + } + +-------------------------------------------------------------------------------- + +via: https://zmap.io/documentation.html + +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:https://github.com/ewust/forge_socket/ +[2]:https://github.com/zmap/zmap/blob/v1.0.0/src/output_modules/output_modules.c +[3]:https://github.com/zmap/zmap/blob/master/src/output_modules/output_modules.h +[4]:https://github.com/zmap/zmap/blob/master/src/output_modules/module_csv.c diff --git a/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md b/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md new file mode 100644 index 0000000000..d291f34511 --- /dev/null +++ b/sources/tech/20150410 7 Command Line Tools for Browsing Websites and Downloading Files in Linux.md @@ -0,0 +1,152 @@ +7 Command Line Tools for Browsing Websites and Downloading Files in Linux +================================================================================ +In the last article, we have covered few useful tools like ‘rTorrent‘, ‘wget‘, ‘cURL‘, ‘w3m‘, and ‘Elinks‘. We got lots of response to cover few other tools of same genre, if you’ve missed the first part you can go through it.. + +- [5 Command Line Tools for Downloading Files and Browsing Websites][1] + +This article aims at making you aware of several other Linux command Line browsing and downloading applications, which will help you to browse and download files within the Linux shell. + +### 1. links ### + +Links is an open source web browser written in C programming Language. It is available for all major platforms viz., Linux, Windows, OS X and OS/2. This browser is text based as well as graphical. The text based links web browser is shipped by most of the standard Linux distributions by default. If links is not installed in your system by default you may install it from the repo. Elinks is a fork of links. + + # apt-get install links + # yum install links + +After installing links, you can browse any websites within the terminal as shown below in the screen cast.. + + # links www.tecmint.com + +Use UP and DOWN arrow keys to navigate. Right arrow Key on a link will redirect you to that link and Left arrow key will bring you back to the last page. To QUIT press q. + +Here is how it seems to access Tecmint using links tool. + +![](http://www.tecmint.com/wp-content/uploads/2015/04/links-browse-websites-terminal.gif) + +If you are interested in installing GUI of links, you may need to download latest source tarball (i.e. version 2.9) from [http://links.twibright.com/download/][2]. + +Alternatively, you may use following wget command to download and install as suggested below. + + # wget http://links.twibright.com/download/links-2.9.tar.gz + # tar -xvf links-2.9.tar.gz + # cd links-2.9 + # ./configure –enable-graphics + # make + # make install + +**Note**: You need to install packages (libpng, libjpeg, TIFF library, SVGAlib, XFree86, C Compiler and make), if not already installed to successfully compile the package. + +### 2. links2 ### + +Links2 is a graphical web browser version of Twibright Labs Links web browser. This browser has support for mouse and clicks. Designed specially for speed without any CSS support, fairly good HTML and JavaScript support with limitations. + +To install links2. + + # apt-get install links2 + # yum install links2 + +### 3. lynx ### + +A text based web browser released under GNU GPLv2 license and written in ISO C. lynx is highly configurable web browser and Savior for many SYSAdmin. It has the reputation of being the oldest web browser that is being used and still actively developed. + +To install lynx. + + # apt-get install lynx + # yum install lynx + +After installing lynx, type the following command to browse the website as shown below in the screen cast.. + + # lynx www.tecmint.com + +![](http://www.tecmint.com/wp-content/uploads/2015/04/lynx-commandline-web-browsing.gif) + +If you are interested in knowing a bit more about links and lynx web browser, you may like to visit the below link: + +- [Web Browsing with Lynx and Links Command Line Tools][3] + +### 4. youtube-dl ### + +youtube-dl is a platform independent application which can be used to download videos from youtube and a few other sites. Written primarily in python and released under GNU GPL License, the application works out of the box. (Since youtube don’t allow you to download videos, it may be illegal to use it. Check the laws before you start using this.) + +To install youtube-dl. + + # apt-get install youtube-dl + # yum install youtube-dl + +After installing, try to download files from the Youtube site, as shown in the below screen cast. + + # youtube-dl https://www.youtube.com/watch?v=ql4SEy_4xws + +![](http://www.tecmint.com/wp-content/uploads/2015/04/download-youtube-videos-from-terminal.gif) + +If you are interested in knowing more about youtube-dl you may like to visit the below link: + +- [YouTube-DL – A Command Line Youtube Video Downloader for Linux][4] + +### 5. fetch ### + +It is a command utility for unix-like operating system that is used for URL retrieval. It supports a lot of options like fetching ipv4 only address, ipv6 only address, no redirect, exit after successful file retrieval request, retry, etc. + +Fetch can be Downloaded and installed from the link below + +- [http://sourceforge.net/projects/fetch/?source=typ_redirect][5] + +But before you compile and run it, you should install HTTP Fetcher. Download HTTP Fetcher from the link below. + +- [http://sourceforge.net/projects/http-fetcher/?source=typ_redirect][6] + +### 6. Axel ### + +Axel is a command-line based download accelerator for Linux. Axel makes it possible to download a file at much faster speed through single connection request for multiple copies of files in small chunks through multiple http and ftp connections. + +To install Axel. + + # apt-get install axel + # yum install axel + +After axel installed, you may use following command to download any given file, as shown in the screen cast. + + # axel http://mirror.cse.iitk.ac.in/archlinux/iso/2015.04.01/archlinux-2015.04.01-dual.iso + +![](http://www.tecmint.com/wp-content/uploads/2015/04/download-accelarator-for-linux.gif) + +### 7. aria2 ### + +aria2 is a command-line based download utility that is lightweight and support multi-protocol (HTTP, HTTPS, FTP, BitTorrent and Metalink). It can use metalinks files to simultaneously download ISO files from more than one server. It can serve as a Bit torrent client as well. + +To install aria2. + + # apt-get install aria2 + # yum install aria2 + +Once aria2 installed, you can fire up the following command to download any given file… + + # aria2c http://cdimage.debian.org/debian-cd/7.8.0/multi-arch/iso-cd/debian-7.8.0-amd64-i386-netinst.iso + +![Aria2: Command Line Download Manager for Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Download-Files-in-Terminal.gif) +Aria2: Command Line Download Manager for Linux + +If you’re interested to know more at aria2 and their switches, read the following article. + +- [Aria2 – A Multi-Protocol Command-Line Download Manager for Linux][7] + +That’s all for now. I’ll be here again with another interesting topic you people will love to read. Till then stay tuned and connected to Tecmint. Don’t forget to provide us with your valuable feedback in the comments below. Like and share us and help us get spread. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/command-line-web-browser-download-file-in-linux/ + +作者:[Avishek Kumar][a] +译者:[wangjiezhe](https://github.com/wangjiezhe) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/linux-command-line-tools-for-downloading-files/ +[2]:http://links.twibright.com/download/ +[3]:http://www.tecmint.com/command-line-web-browsers/ +[4]:http://www.tecmint.com/install-youtube-dl-command-line-video-download-tool/ +[5]:http://sourceforge.net/projects/fetch/?source=typ_redirect +[6]:http://sourceforge.net/projects/http-fetcher/?source=typ_redirect +[7]:http://www.tecmint.com/install-aria2-a-multi-protocol-command-line-download-manager-in-rhel-centos-fedora/ diff --git a/sources/tech/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md b/sources/tech/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md new file mode 100644 index 0000000000..2a8bdb2fbd --- /dev/null +++ b/sources/tech/20150410 How to Install and Configure Multihomed ISC DHCP Server on Debian Linux.md @@ -0,0 +1,159 @@ +How to Install and Configure Multihomed ISC DHCP Server on Debian Linux +================================================================================ +Dynamic Host Control Protocol (DHCP) offers an expedited method for network administrators to provide network layer addressing to hosts on a constantly changing, or dynamic, network. One of the most common server utilities to offer DHCP functionality is ISC DHCP Server. The goal of this service is to provide hosts with the necessary network information to be able to communicate on the networks in which the host is connected. Information that is typically served by this service can include: DNS server information, network address (IP), subnet mask, default gateway information, hostname, and much more. + +This tutorial will cover ISC-DHCP-Server version 4.2.4 on a Debian 7.7 server that will manage multiple virtual local area networks (VLAN) but can very easily be applied to a single network setup as well. + +The test network that this server was setup on has traditionally relied on a Cisco router to manage the DHCP address leases. The network currently has 12 VLANs needing to be managed by one centralized server. By moving this responsibility to a dedicated server, the router can regain resources for more important tasks such as routing, access control lists, traffic inspection, and network address translation. + +The other benefit to moving DHCP to a dedicated server will, in a later guide, involve setting up Dynamic Domain Name Service (DDNS) so that new host’s host-names will be added to the DNS system when the host requests a DHCP address from the server. + +### Step 1: Installing and Configuring ISC DHCP Server ### + +1. To start the process of creating this multi-homed server, the ISC software needs to be installed via the Debian repositories using the ‘apt‘ utility. As with all tutorials, root or sudo access is assumed. Please make the appropriate modifications to the following commands. + + # apt-get install isc-dhcp-server [Installs the ISC DHCP Server software] + # dpkg --get-selections isc-dhcp-server [Confirms successful installation] + # dpkg -s isc-dhcp-server [Alternative confirmation of installation] + +![Install ISC DHCP Server in Debian](http://www.tecmint.com/wp-content/uploads/2015/04/Install-ISC-DHCP-Server.jpg) + +2. Now that the server software is confirmed installed, it is now necessary to configure the server with the network information that it will need to hand out. At the bare minimum, the administrator needs to know the following information for a basic DHCP scope: + +- The network addresses +- The subnet masks +- The range of addresses to be dynamically assigned + +Other useful information to have the server dynamically assign includes: + +- Default gateway +- DNS server IP addresses +- The Domain Name +- Host name +- Network Broadcast addresses + +These are merely a few of the many options that the ISC DHCP server can handle. To get a complete list as well as a description of each option, enter the following command after installing the package: + + # man dhcpd.conf + +3. Once the administrator has concluded all the necessary information for this server to hand out it is time to configure the DHCP server as well as the necessary pools. Before creating any pools or server configurations though, the DHCP service must be configured to listen on one of the server’s interfaces. + +On this particular server, a NIC team has been setup and DHCP will listen on the teamed interfaces which were given the name `'bond0'`. Be sure to make the appropriate changes given the server and environment in which everything is being configured. The defaults in this file are okay for this tutorial. + +![Configure ISC DHCP Network](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ISC-DHCP-Network.jpg) + +This line will instruct the DHCP service to listen for DHCP traffic on the specified interface(s). At this point, it is time to modify the main configuration file to enable the DHCP pools on the necessary networks. The main configuration file is located at /etc/dhcp/dhcpd.conf. Open the file with a text editor to begin: + + # nano /etc/dhcp/dhcpd.conf + +This file is the configuration for the DHCP server specific options as well as all of the pools/hosts one wishes to configure. The top of the file starts of with a ‘ddns-update-style‘ clause and for this tutorial it will remain set to ‘none‘ however in a future article, Dynamic DNS will be covered and ISC-DHCP-Server will be integrated with BIND9 to enable host name to IP address updates. + +4. The next section is typically the area where and administrator can configure global network settings such as the DNS domain name, default lease time for IP addresses, subnet-masks, and much more. Again to know more about all the options be sure to read the man page for the dhcpd.conf file. + + # man dhcpd.conf + +For this server install, there were a couple of global network options that were configured at the top of the configuration file so that they wouldn’t have to be implemented in every single pool created. + +![Configure ISC DDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-ISC-DDNS.png) + +Lets take a moment to explain some of these options. While they are configured globally in this example, all of them can be configured on a per pool basis as well. + +- option domain-name “comptech.local”; – All hosts that this DHCP server hosts, will be a member of the DNS domain name “comptech.local” +- option domain-name-servers 172.27.10.6; DHCP will hand out DNS server IP of 172.27.10.6 to all of the hosts on all of the networks it is configured to host. +- option subnet-mask 255.255.255.0; – The subnet mask handed out to every network will be a 255.255.255.0 or a /24 +- default-lease-time 3600; – This is the time in seconds that a lease will automatically be valid. The host can re-request the same lease if time runs out or if the host is done with the lease, they can hand the address back early. +- max-lease-time 86400; – This is the maximum amount of time in seconds a lease can be held by a host. +- ping-check true; – This is an extra test to ensure that the address the server wants to assign out isn’t in use by another host on the network already. +- ping-timeout; – This is how long in second the server will wait for a response to a ping before assuming the address isn’t in use. +- ignore client-updates; For now this option is irrelevant since DDNS has been disabled earlier in the configuration file but when DDNS is operating, this option will ignore a hosts to request to update its host-name in DNS. + +5. The next line in this file is the authoritative DHCP server line. This line means that if this server is to be the server that hands out addresses for the networks configured in this file, then uncomment the authoritative stanza. + +This server will be the only authority on all the networks it manages so the global authoritative stanza was un-commented by removing the ‘#’ in front of the keyword authoritative. + +![Enable ISC Authoritative](http://www.tecmint.com/wp-content/uploads/2015/04/ISC-authoritative.png) +Enable ISC Authoritative + +By default the server is assumed to NOT be an authority on the network. The rationale behind this is security. If someone unknowingly configures the DHCP server improperly or on a network they shouldn’t, it could cause serious connectivity issues. This line can also be used on a per network basis. This means that if the server is not the entire network’s DHCP server, the authoritative line can instead be used on a per network basis rather than in the global configuration as seen in the above screen-shot. + +6. The next step is to configure all of the DHCP pools/networks that this server will manage. For brevities sake, this guide will only walk through one of the pools configured. The administrator will need to have gathered all of the necessary network information (ie domain name, network addresses, how many addresses can be handed out, etc). + +For this pool the following information was obtained from the network administrator: network id of 172.27.60.0, subnet mask of 255.255.255.0 or a /24, the default gateway for the subnet is 172.27.60.1, and a broadcast address of 172.27.60.255. +This information is important to building the appropriate network stanza in the dhcpd.conf file. Without further ado, let’s open the configuration file again using a text editor and then add the new network to the server. This must be done with root/sudo! + + # nano /etc/dhcp/dhcpd.conf + +![Configure DHCP Pools and Networks](http://www.tecmint.com/wp-content/uploads/2015/04/ISC-network.png) +Configure DHCP Pools and Networks + +This is the sample created to hand out IP addresses to a network that is used for the creation of VMWare virtual practice servers. The first line indicates the network as well as the subnet mask for that network. Then inside the brackets are all the options that the DHCP server should provide to hosts on this network. + +The first stanza, range 172.27.60.50 172.27.60.254;, is the range of dynamically assignable addresses that the DHCP server can hand out to hosts on this network. Notice that the first 49 addresses aren’t in the pool and can be assigned statically to hosts if needed. + +The second stanza, option routers 172.27.60.1; , hands out the default gateway address for all hosts on this network. + +The last stanza, option broadcast-address 172.27.60.255;, indicates what the network’s broadcast address. This address SHOULD NOT be a part of the range stanza as the broadcast address can’t be assigned to a host. + +Some pointers, be sure to always end the option lines with a semi-colon (;) and always make sure each network created is enclosed in curly braces { }. + +7. If there are more networks to create, continue creating them with their appropriate options and then save the text file. Once all configurations have been completed, the ISC-DHCP-Server process will need to be restarted in order to apply the new changes. This can be accomplished with the following command: + + # service isc-dhcp-server restart + +This will restart the DHCP service and then the administrator can check to see if the server is ready for DHCP requests several different ways. The easiest is to simply see if the server is listening on port 67 via the [lsof command][1]: + + # lsof -i :67 + +![Check DHCP Listening Port](http://www.tecmint.com/wp-content/uploads/2015/04/lsof.png) +Check DHCP Listening Port + +This output indicates that the DHCPD (DHCP Server daemon) is running and listening on port 67. Port 67 in this output was actually converted to ‘bootps‘ due to a port number mapping for port 67 in /etc/services file. + +This is very common on most systems. At this point, the server should be ready for network connectivity and can be confirmed by connecting a machine to the network and having it request a DHCP address from the server. + +### Step 2: Testing Client Connectivity ### + +8. Most systems now-a-days are using Network Manager to maintain network connections and as such the device should be pre-configured to pull DHCP when the interface is active. + +However on machines that aren’t using Network Manager, it may be necessary to manually attempt to pull a DHCP address. The next few steps will show how to do this as well as how to see whether the server is handing out addresses. + +The ‘[ifconfig][2]‘ utility can be used to check an interface’s configuration. The machine used to test the DHCP server only has one network adapter and it is called ‘eth0‘. + + # ifconfig eth0 + +![Check Network Interface IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/No-ip.png) +Check Network Interface IP Address + +From this output, this machine currently doesn’t have an IPv4 address, great! Let’s instruct this machine to reach out to the DHCP server and request an address. This machine has the DHCP client utility known as ‘dhclient‘ installed. The DHCP client utility may very from system to system. + + # dhclient eth0 + +![Request IP Address from DHCP](http://www.tecmint.com/wp-content/uploads/2015/04/IP.png) +Request IP Address from DHCP + +Now the `'inet addr:'` field shows an IPv4 address that falls within the scope of what was configured for the 172.27.60.0 network. Also notice that the proper broadcast address was handed out as well as subnet mask for this network. + +Things are looking promising but let’s check the server to see if it was actually the place where this machine received this new IP address. To accomplish this task, the server’s system log file will be consulted. While the entire log file may contain hundreds of thousands of entries, only a few are necessary for confirming that the server is working properly. Rather than using a full text editor, this time a utility known as ‘tail‘ will be used to only show the last few lines of the log file. + + # tail /var/log/syslog + +![Check DHCP Logs](http://www.tecmint.com/wp-content/uploads/2015/04/DHCP-Log.png) +Check DHCP Logs + +Voila! The server recorded handing out an address to this host (HRTDEBXENSRV). It is a safe assumption at this point that the server is working as intended and handing out the appropriate addresses for the networks that it is an authority. At this point the DHCP server is up and running. Configure the other networks, troubleshoot, and secure as necessary. + +Enjoy the newly functioning ISC-DHCP-Server and tune in later for more Debian tutorials. In the not too distant future there will be an article on Bind9 and DDNS that will tie into this article. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-and-configure-multihomed-isc-dhcp-server-on-debian-linux/ + +作者:[Rob Turner][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/robturner/ +[1]:http://www.tecmint.com/10-lsof-command-examples-in-linux/ +[2]:http://www.tecmint.com/ifconfig-command-examples/ \ No newline at end of file diff --git a/sources/tech/20150410 How to run Ubuntu Snappy Core on Raspberry Pi 2.md b/sources/tech/20150410 How to run Ubuntu Snappy Core on Raspberry Pi 2.md new file mode 100644 index 0000000000..4b49e3acca --- /dev/null +++ b/sources/tech/20150410 How to run Ubuntu Snappy Core on Raspberry Pi 2.md @@ -0,0 +1,89 @@ +How to run Ubuntu Snappy Core on Raspberry Pi 2 +================================================================================ +The Internet of Things (IoT) is upon us. In a couple of years some of us might ask ourselves how we ever survived without it, just like we question our past without cellphones today. Canonical is a contender in this fast growing, but still wide open market. The company wants to claim their stakes in IoT just as they already did for the cloud. At the end of January, the company launched a small operating system that goes by the name of [Ubuntu Snappy Core][1] which is based on Ubuntu Core. + +Snappy, the new component in the mix, represents a package format that is derived from DEB, is a frontend to update the system that lends its idea from atomic upgrades used in CoreOS, Red Hat's Atomic and elsewhere. As soon as the Raspberry Pi 2 was marketed, Canonical released Snappy Core for that plattform. The first edition of the Raspberry Pi was not able to run Ubuntu because Ubuntu's ARM images use the ARMv7 architecture, while the first Raspberry Pis were based on ARMv6. That has changed now, and Canonical, by releasing a RPI2-Image of Snappy Core, took the opportunity to make clear that Snappy was meant for the cloud and especially for IoT. + +Snappy also runs on other platforms like Amazon EC2, Microsofts Azure, and Google's Compute Engine, and can also be virtualized with KVM, Virtualbox, or Vagrant. Canonical has embraced big players like Microsoft, Google, Docker or OpenStack and, at the same time, also included small projects from the maker scene as partners. Besides startups like Ninja Sphere and Erle Robotics, there are board manufacturers like Odroid, Banana Pro, Udoo, PCDuino and Parallella as well as Allwinner. Snappy Core will also run in routers soon to help with the poor upgrade policy that vendors perform. + +In this post, let's see how we can test Ubuntu Snappy Core on Raspberry Pi 2. + +The image for Snappy Core for the RPI2 can be downloaded from the [Raspberry Pi website][2]. Unpacked from the archive, the resulting image should be [written to an SD card][3] of at least 8 GB. Even though the OS is small, atomic upgrades and the rollback function eat up quite a bit of space. After booting up your Raspberry Pi 2 with Snappy Core, you can log into the system with the default username and password being 'ubuntu'. + +![](https://farm8.staticflickr.com/7639/16428527263_f7bdd56a0d_c.jpg) + +sudo is already configured and ready for use. For security reasons you should change the username with: + + $ sudo usermod -l + +Alternatively, you can add a new user with the command `adduser`. + +Due to the lack of a hardware clock on the RPI, that the Snappy Core image does not take account of, the image has a small bug that will throw a lot of errors when processing commands. It is easy to fix. + +To find out if the bug affects you, use the command: + + $ date + +If the output is "Thu Jan 1 01:56:44 UTC 1970", you can fix it with: + + $ sudo date --set="Sun Apr 04 17:43:26 UTC 2015" + +adapted to your actual time. + +![](https://farm9.staticflickr.com/8735/16426231744_c54d9b8877_b.jpg) + +Now you might want to check if there are any updates available. Note that the usual commands: + + $ sudo apt-get update && sudo apt-get distupgrade + +will not get you very far though, as Snappy uses its own simplified package management system which is based on dpkg. This makes sense, as Snappy will run on a lot of embedded appliances, and you want things to be as simple as possible. + +Let's dive into the engine room for a minute to understand how things work with Snappy. The SD card you run Snappy on has three partitions besides the boot partition. Two of those house a duplicated file system. Both of those parallel file systems are permanently mounted as "read only", and only one is active at any given time. The third partition holds a partial writable file system and the users persistent data. With a fresh system, the partition labeled 'system-a' holds one complete file system, called a core, leaving the parallel partition still empty. + +![](https://farm9.staticflickr.com/8758/16841251947_21f42609ce_b.jpg) + +If we run the following command now: + + $ sudo snappy update + +the system will install the update as a complete core, similar to an image, on 'system-b'. You will be asked to reboot your device afterwards to activate the new core. + +After the reboot, run the following command to check if your system is up to date and which core is active. + + $ sudo snappy versions -a + +After rolling out the update and rebooting, you should see that the core that is now active has changed. + +As we have not installed any apps yet, the following command: + + $ sudo snappy update ubuntu-core + +would have been sufficient, and is the way if you want to upgrade just the underlying OS. Should something go wrong, you can rollback by: + + $ sudo snappy rollback ubuntu-core + +which will take you back to the system's state before the update. + +![](https://farm8.staticflickr.com/7666/17022676786_5fe6804ed8_c.jpg) + +Speaking of apps, they are what makes Snappy useful. There are not that many at this point, but the IRC channel #snappy on Freenode is humming along nicely and with a lot of people involved, the Snappy App Store gets new apps added on a regular basis. You can visit the shop by pointing your browser to http://:4200, and you can install apps right from the shop and then launch them with http://webdm.local in your browser. Building apps yourself for Snappy is not all that hard, and [well documented][4]. You can also port DEB packages into the snappy format quite easily. + +![](https://farm8.staticflickr.com/7656/17022676836_968a2a7254_c.jpg) + +Ubuntu Snappy Core, due to the limited number of available apps, is not overly useful in a productive way at this point in time, although it invites us to dive into the new Snappy package format and play with atomic upgrades the Canonical way. Since it is easy to set up, this seems like a good opportunity to learn something new. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/ubuntu-snappy-core-raspberry-pi-2.html + +作者:[Ferdinand Thommes][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/ferdinand +[1]:http://www.ubuntu.com/things +[2]:http://www.raspberrypi.org/downloads/ +[3]:http://xmodulo.com/write-raspberry-pi-image-sd-card.html +[4]:https://developer.ubuntu.com/en/snappy/ \ No newline at end of file diff --git a/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md b/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md new file mode 100644 index 0000000000..b67f5aee26 --- /dev/null +++ b/sources/tech/20150504 How to access a Linux server behind NAT via reverse SSH tunnel.md @@ -0,0 +1,130 @@ +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. + +### What is Reverse SSH Tunneling? ### + +One alternative to SSH port forwarding is **reverse SSH tunneling**. The concept of reverse SSH tunneling is simple. For this, you will need another host (so-called "relay host") outside your restrictive home network, which you can connect to via SSH from where you are. You could set up a relay host using a [VPS instance][1] with a public IP address. What you do then is to set up a persistent SSH tunnel from the server in your home network to the public relay host. With that, you can connect "back" to the home server from the relay host (which is why it's called a "reverse" tunnel). As long as the relay host is reachable to you, you can connect to your home server wherever you are, or however restrictive your NAT or firewall is in your home network. + +![](https://farm8.staticflickr.com/7742/17162647378_c7d9f10de8_b.jpg) + +### Set up a Reverse SSH Tunnel on Linux ### + +Let's see how we can create and use a reverse SSH tunnel. We assume the following. We will be setting up a reverse SSH tunnel from homeserver to relayserver, so that we can SSH to homeserver via relayserver from another computer called clientcomputer. The public IP address of **relayserver** is 1.1.1.1. + +On homeserver, open an SSH connection to relayserver as follows. + + homeserver~$ ssh -fN -R 10022:localhost:22 relayserver_user@1.1.1.1 + +Here the port 10022 is any arbitrary port number you can choose. Just make sure that this port is not used by other programs on relayserver. + +The "-R 10022:localhost:22" option defines a reverse tunnel. It forwards traffic on port 10022 of relayserver to port 22 of homeserver. + +With "-fN" option, SSH will go right into the background once you successfully authenticate with an SSH server. This option is useful when you do not want to execute any command on a remote SSH server, and just want to forward ports, like in our case. + +After running the above command, you will be right back to the command prompt of homeserver. + +Log in to relayserver, and verify that 127.0.0.1:10022 is bound to sshd. If so, that means a reverse tunnel is set up correctly. + + relayserver~$ sudo netstat -nap | grep 10022 + +---------- + + tcp 0 0 127.0.0.1:10022 0.0.0.0:* LISTEN 8493/sshd + +Now from any other computer (e.g., clientcomputer), log in to relayserver. Then access homeserver as follows. + + relayserver~$ ssh -p 10022 homeserver_user@localhost + +One thing to take note is that the SSH login/password you type for localhost should be for homeserver, not for relayserver, since you are logging in to homeserver via the tunnel's local endpoint. So do not type login/password for relayserver. After successful login, you will be on homeserver. + +### Connect Directly to a NATed Server via a Reverse SSH Tunnel ### + +While the above method allows you to reach **homeserver** behind NAT, you need to log in twice: first to **relayserver**, and then to **homeserver**. This is because the end point of an SSH tunnel on relayserver is binding to loopback address (127.0.0.1). + +But in fact, there is a way to reach NATed homeserver directly with a single login to relayserver. For this, you will need to let sshd on relayserver forward a port not only from loopback address, but also from an external host. This is achieved by specifying **GatewayPorts** option in sshd running on relayserver. + +Open /etc/ssh/sshd_conf of **relayserver** and add the following line. + + relayserver~$ vi /etc/ssh/sshd_conf + +---------- + + GatewayPorts clientspecified + +Restart sshd. + +Debian-based system: + + relayserver~$ sudo /etc/init.d/ssh restart + +Red Hat-based system: + + relayserver~$ sudo systemctl restart sshd + +Now let's initiate a reverse SSH tunnel from homeserver as follows. +homeserver~$ ssh -fN -R 1.1.1.1:10022:localhost:22 relayserver_user@1.1.1.1 + +Log in to relayserver and confirm with netstat command that a reverse SSH tunnel is established successfully. + + relayserver~$ sudo netstat -nap | grep 10022 + +---------- + + tcp 0 0 1.1.1.1:10022 0.0.0.0:* LISTEN 1538/sshd: dev + +Unlike a previous case, the end point of a tunnel is now at 1.1.1.1:10022 (relayserver's public IP address), not 127.0.0.1:10022. This means that the end point of the tunnel is reachable from an external host. + +Now from any other computer (e.g., clientcomputer), type the following command to gain access to NATed homeserver. + + clientcomputer~$ ssh -p 10022 homeserver_user@1.1.1.1 + +In the above command, while 1.1.1.1 is the public IP address of relayserver, homeserver_user must be the user account associated with homeserver. This is because the real host you are logging in to is homeserver, not relayserver. The latter simply relays your SSH traffic to homeserver. + +### Set up a Persistent Reverse SSH Tunnel on Linux ### + +Now that you understand how to create a reverse SSH tunnel, let's make the tunnel "persistent", so that the tunnel is up and running all the time (regardless of temporary network congestion, SSH timeout, relay host rebooting, etc.). After all, if the tunnel is not always up, you won't be able to connect to your home server reliably. + +For a persistent tunnel, I am going to use a tool called autossh. As the name implies, this program allows you to automatically restart an SSH session should it breaks for any reason. So it is useful to keep a reverse SSH tunnel active. + +As the first step, let's set up [passwordless SSH login][2] from homeserver to relayserver. That way, autossh can restart a broken reverse SSH tunnel without user's involvement. + +Next, [install autossh][3] on homeserver where a tunnel is initiated. + +From homeserver, run autossh with the following arguments to create a persistent SSH tunnel destined to relayserver. + + homeserver~$ autossh -M 10900 -fN -o "PubkeyAuthentication=yes" -o "StrictHostKeyChecking=false" -o "PasswordAuthentication=no" -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -R 1.1.1.1:10022:localhost:22 relayserver_user@1.1.1.1 + +The "-M 10900" option specifies a monitoring port on relayserver which will be used to exchange test data to monitor an SSH session. This port should not be used by any program on relayserver. + +The "-fN" option is passed to ssh command, which will let the SSH tunnel run in the background. + +The "-o XXXX" options tell ssh to: + +- Use key authentication, not password authentication. +- Automatically accept (unknown) SSH host keys. +- Exchange keep-alive messages every 60 seconds. +- Send up to 3 keep-alive messages without receiving any response back. + +The rest of reverse SSH tunneling related options remain the same as before. + +If you want an SSH tunnel to be automatically up upon boot, you can add the above autossh command in /etc/rc.local. + +### Conclusion ### + +In this post, I talked about how you can use a reverse SSH tunnel to access a Linux server behind a restrictive firewall or NAT gateway from outside world. While I demonstrated its use case for a home network, you must be careful when applying it for corporate networks. Such a tunnel can be considered as a breach of a corporate policy, as it circumvents corporate firewalls and can expose corporate networks to outside attacks. There is a great chance it can be misused or abused. So always remember its implication before setting it up. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/access-linux-server-behind-nat-reverse-ssh-tunnel.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]:http://xmodulo.com/go/digitalocean +[2]:http://xmodulo.com/how-to-enable-ssh-login-without.html +[3]:http://ask.xmodulo.com/install-autossh-linux.html diff --git a/sources/tech/20150515 How to Install Percona Server on CentOS 7.md b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md new file mode 100644 index 0000000000..03affe787e --- /dev/null +++ b/sources/tech/20150515 How to Install Percona Server on CentOS 7.md @@ -0,0 +1,188 @@ +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/ \ No newline at end of file diff --git a/sources/tech/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md b/sources/tech/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md new file mode 100644 index 0000000000..5731cd69f4 --- /dev/null +++ b/sources/tech/20150515 Install 'Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity.md @@ -0,0 +1,181 @@ +FSSlc translating + +Install ‘Tails 1.4′ Linux Operating System to Preserve Privacy and Anonymity +================================================================================ +In this Internet world and the world of Internet we perform most of our task online be it Ticket booking, Money transfer, Studies, Business, Entertainment, Social Networking and what not. We spend a major part of our time online daily. It has been getting hard to remain anonymous with each passing day specially when backdoors are being planted by organizations like NSA (National Security Agency) who are putting their nose in between every thing that we come across online. We have least or no privacy online. All the searches are logged upon the basis of user Internet surfing activity and machine activity. + +A wonderful browser from Tor project is used by millions which help us surfing the web anonymously however it is not difficult to trace your browsing habits and hence tor alone is not the guarantee of your safety online. You may like to check Tor features and installation instructions here: + +- [Anonymous Web Browsing using Tor][1] + +There is a operating system named Tails by Tor Projects. Tails (The Amnesic Incognito Live System) is a live operating system, based on Debian Linux distribution, which mainly focused on preserving privacy and anonymity on the web while browsing internet, means all it’s outgoing connection are forced to pass through the Tor and direct (non-anonymous) requests are blocked. The system is designed to run from any boot-able media be it USB stick or DVD. + +The latest stable release of Tails OS is 1.4 which was released on May 12, 2015. Powered by open source Monolithic Linux Kernel and built on top of Debian GNU/Linux Tails aims at Personal Computer Market and includes GNOME 3 as default user Interface. + +#### Features of Tails OS 1.4 #### + +- Tails is a free operating system, free as in beer and free as in speech. +- Built on top of Debian/GNU Linux. The most widely used OS that is Universal. +- Security Focused Distribution. +- Windows 8 camouflage. +- Need not to be installed and browse Internet anonymously using Live Tails CD/DVD. +- Leave no trace on the computer, while tails is running. +- Advanced cryptographic tools used to encrypt everything that concerns viz., files, emails, etc. +- Sends and Receive traffic through tor network. +- In true sense it provides privacy for anyone, anywhere. +- Comes with several applications ready to be used from Live Environment. +- All the softwares comes per-configured to connect to INTERNET only through Tor network. +- Any application that tries to connect to Internet without Tor Network is blocked, automatically. +- Restricts someone who is watching what sites you visit and restricts sites to learn your geographical location. +- Connect to websites that are blocked and/or censored. +- Designed specially not to use space used by parent OS even when there is free swap space. +- The whole OS loads on RAM and is flushed when we reboot/shutdown. Hence no trace of running. +- Advanced security implementation by encrypting USB disk, HTTPS ans Encrypt and sign emails and documents. + +#### What can you expect in Tails 1.4 #### + +- Tor Browser 4.5 with a security Slider. +- Tor Upgraded to version 0.2.6.7. +- Several Security holes fixed. +- Many of the bug fixed and patches applied to Applications like curl, OpenJDK 7, tor Network, openldap, etc. + +To get a complete list of change logs you may visit [HERE][2] + +**Note**: It is strongly recommended to upgrade to Tails 1.4, if you’re using any older version of Tails. + +#### Why should I use Tails Operating System #### + +You need Tails because you need: + +- Freedom from network surveillance +- Defend freedom, privacy and confidentiality +- Security aka traffic analysis + +This tutorial will walk through the installation of Tails 1.4 OS with a short review. + +### Tails 1.4 Installation Guide ### + +1. To download the latest Tails OS 1.4, you may use wget command to download directly. + + $ wget http://dl.amnesia.boum.org/tails/stable/tails-i386-1.4/tails-i386-1.4.iso + +Alternatively you may download Tails 1.4 Direct ISO image or use a Torrent Client to pull the iso image file for you. Here is the link to both downloads: + +- [tails-i386-1.4.iso][3] +- [tails-i386-1.4.torrent][4] + +2. After downloading, verify ISO Integrity by matching SHA256 checksum with the SHA256SUM provided on the official website.. + + $ sha256sum tails-i386-1.4.iso + + 339c8712768c831e59c4b1523002b83ccb98a4fe62f6a221fee3a15e779ca65d + +If you are interested in knowing OpenPGP, checking Tails signing key against Debian keyring and anything related to Tails cryptographic signature, you may like to point your browser [HERE][5]. + +3. Next you need to write the image to USB stick or DVD ROM. You may like to check the article, [How to Create Live Bootable USB][6] for details on how to make a flash drive bootable and write ISO to it. + +4. Insert the Tails OS Bootable flash drive or DVD ROM in the disk and boot from it (select from BIOS to boot). The first screen – two options to select from ‘Live‘ and ‘Live (failsafe)‘. Select ‘Live‘ and press Enter. + +![Tails Boot Menu](http://www.tecmint.com/wp-content/uploads/2015/05/1.png) +Tails Boot Menu + +5. Just before login. You have two options. Click ‘More Options‘ if you want to configure and set advanced options else click ‘No‘. + +![Tails Welcome Screen](http://www.tecmint.com/wp-content/uploads/2015/05/2.png) +Tails Welcome Screen + +6. After clicking Advanced option, you need to setup root password. This is important if you want to upgrade it. This root password is valid till you shutdown/reboot the machine. + +Also you may enable Windows Camouflage, if you want to run this OS on a public place, so that it seems as you are running Windows 8 operating system. Good option indeed! Is not it? Also you have a option to configure Network and Mac Address. Click ‘Login‘ when done!. + +![Tails OS Configuration](http://www.tecmint.com/wp-content/uploads/2015/05/3.png) +Tails OS Configuration + +7. This is Tails GNU/Linux OS camouflaged by Windows Skin. + +![Tails Windows Look](http://www.tecmint.com/wp-content/uploads/2015/05/4.jpg) +Tails Windows Look + +8. It will start Tor Network in the background. Check the Notification on the top-right corner of the screen – Tor is Ready / You are now connected to the Internet. + +Also check what it contains under Internet Menu. Notice – It has Tor Browser (safe) and Unsafe Web Browser (Where incoming and outgoing data don’t pass through TOR Network) along with other applications. + +![Tails Menu and Tools](http://www.tecmint.com/wp-content/uploads/2015/05/5.jpg) +Tails Menu and Tools + +9. Click Tor and check your IP Address. It confirms my physical location is not shared and my privacy is intact. + +![Check Privacy on Tails](http://www.tecmint.com/wp-content/uploads/2015/05/6.jpg) +Check Privacy on Tails + +10. You may Invoke Tails Installer to clone & Install, Clone & Upgrade and Upgrade from ISO. + +![Tails Installer Options](http://www.tecmint.com/wp-content/uploads/2015/05/7.jpg) +Tails Installer Options + +11. The other option was to select Tor without any advanced option, just before login (Check step #5 above). + +![Tails Without Advance Option](http://www.tecmint.com/wp-content/uploads/2015/05/8.png) +Tails Without Advance Option + +12. You will get log-in to Gnome3 Desktop Environment. + +![Tails Gnome Desktop](http://www.tecmint.com/wp-content/uploads/2015/05/9.png) +Tails Gnome Desktop + +13. If you click to Launch Unsafe browser in Camouflage or without Camouflage, you will be notified. + +![Tails Browsing Notification](http://www.tecmint.com/wp-content/uploads/2015/05/10.png) +Tails Browsing Notification + +If you do, this is what you get in a Browser. + +![Tails Browsing Alert](http://www.tecmint.com/wp-content/uploads/2015/05/11.png) +Tails Browsing Alert + +#### Is Tails for me? #### + +To get the above question answered, first answer a few question. + +- Do you need your privacy to be intact while you are online? +- Do you want to remain hidden from Identity thieves? +- Do you want somebody to put your nose in between your private chat online? +- Do you really want to show your geographical location to anybody there? +- Do you carry out banking transactions online? +- Are you happy with the censorship by government and ISP? + +If the answer to any of the above question is ‘YES‘ you preferably need Tails. If answer to all the above question is ‘NO‘ you perhaps don’t need it. + +To know more about Tails? Point your browser to user Documentation : [https://tails.boum.org/doc/index.en.html][7] + +### Conclusion ### + +Tails is an OS which is must for those who work in an unsafe environment. An OS focused on security yet contains bundles of Application – Gnome Desktop, Tor, Firefox (Iceweasel), Network Manager, Pidgin, Claws mail, Liferea feed addregator, Gobby, Aircrack-ng, I2P. + +It also contain several tools for Encryption and Privacy Under the Hood, viz., LUKS, GNUPG, PWGen, Shamir’s Secret Sharing, Virtual Keyboard (against Hardware Keylogging), MAT, KeePassX Password Manager, etc. + +That’s all for now. Keep Connected to Tecmint. Share your thoughts on Tails GNU/Linux Operating System. What do you think about the future of the Project? Also test it Locally and let us know your experience. + +You may run it in [Virtualbox][8] as well. Remember Tails loads the whole OS in RAM hence give enough RAM to run Tails in VM. + +I tested in 1GB Environment and it worked without lagging. Thanks to all our readers for their Support. In making Tecmint a one place for all Linux related stuffs your co-operation is needed. Kudos! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-tails-1-4-linux-operating-system-to-preserve-privacy-and-anonymity/ + +作者:[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/tor-browser-for-anonymous-web-browsing/ +[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 +[5]:https://tails.boum.org/download/index.en.html#verify +[6]:http://www.tecmint.com/install-linux-from-usb-device/ +[7]:https://tails.boum.org/doc/index.en.html +[8]:http://www.tecmint.com/install-virtualbox-on-redhat-centos-fedora/ diff --git a/sources/tech/20150518 How to set up a Replica Set on MongoDB.md b/sources/tech/20150518 How to set up a Replica Set on MongoDB.md new file mode 100644 index 0000000000..07e16dafc1 --- /dev/null +++ b/sources/tech/20150518 How to set up a Replica Set on MongoDB.md @@ -0,0 +1,182 @@ +How to set up a Replica Set on MongoDB +================================================================================ +MongoDB has become the most famous NoSQL database on the market. MongoDB is document-oriented, and its scheme-free design makes it a really attractive solution for all kinds of web applications. One of the features that I like the most is Replica Set, where multiple copies of the same data set are maintained by a group of mongod nodes for redundancy and high availability. + +This tutorial describes how to configure a Replica Set on MonoDB. + +The most common configuration for a Replica Set involves one primary and multiple secondary nodes. The replication will then be initiated from the primary toward the secondaries. Replica Sets can not only provide database protection against unexpected hardware failure and service downtime, but also improve read throughput of database clients as they can be configured to read from different nodes. + +### Set up the Environment ### + +In this tutorial, we are going to set up a Replica Set with one primary and two secondary nodes. + +![](https://farm8.staticflickr.com/7667/17801038505_529a5224a1.jpg) + +In order to implement this lab, we will use three virtual machines (VMs) running on VirtualBox. I am going to install Ubuntu 14.04 on the VMs, and install official packages for Mongodb. + +I am going to set up a necessary environment on one VM instance, and then clone it to the other two VM instances. Thus pick one VM named master, and perform the following installations. + +First, we need to add the MongoDB key for apt: + + $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 + +Then we need to add the official MongoDB repository to our source.list: + + $ sudo su + # echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list + +Let's update repositories and install MongoDB. + + $ sudo apt-get update + $ sudo apt-get install -y mongodb-org + +Now let's make some changes in /etc/mongodb.conf. + + auth = true + dbpath=/var/lib/mongodb + logpath=/var/log/mongodb/mongod.log + logappend=true + keyFile=/var/lib/mongodb/keyFile + replSet=myReplica + +The first line is to make sure that we are going to have authentication on our database. keyFile is to set up a keyfile that is going to be used by MongoDB to replicate between nodes. replSet sets up the name of our replica set. + +Now we are going to create our keyfile, so that it can be in all our instances. + + $ echo -n "MyRandomStringForReplicaSet" | md5sum > keyFile + +This will create keyfile that contains a MD5 string, but it has some noise that we need to clean up before using it in MongoDB. Use the following command to clean it up: + + $ echo -n "MyReplicaSetKey" | md5sum|grep -o "[0-9a-z]\+" > keyFile + +What grep command does is to print MD5 string with no spaces or other characters that we don't want. + +Now we are going to make the keyfile ready for use: + + $ sudo cp keyFile /var/lib/mongodb + $ sudo chown mongodb:nogroup keyFile + $ sudo chmod 400 keyFile + +Now we have our Ubuntu VM ready to be cloned. Power it off, and clone it to the other VMs. + +![](https://farm9.staticflickr.com/8729/17800903865_9876a9cc9c.jpg) + +I name the cloned VMs secondary1 and secondary2. Make sure to reinitialize the MAC address of cloned VMs and clone full disks. + +![](https://farm6.staticflickr.com/5333/17613392900_6de45c9450.jpg) + +All three VM instances should be on the same network to communicate with each other. For this, we are going to attach all three VMs to "Internet Network". + +It is recommended that each VM instances be assigned a static IP address, as opposed to DHCP IP address, so that the VMs will not lose connectivity among themselves when a DHCP server assigns different IP addresses to them. + +Let's edit /etc/networks/interfaces of each VM as follows. + +On primary: + + auto eth1 + iface eth1 inet static + address 192.168.50.2 + netmask 255.255.255.0 + +On secondary1: + + auto eth1 + iface eth1 inet static + address 192.168.50.3 + netmask 255.255.255.0 + +On secondary2: + + auto eth1 + iface eth1 inet static + address 192.168.50.4 + netmask 255.255.255.0 + +Another file that needs to be set up is /etc/hosts, because we don't have DNS. We need to set the hostnames in /etc/hosts. + +On primary: + + 127.0.0.1 localhost primary + 192.168.50.2 primary + 192.168.50.3 secondary1 + 192.168.50.4 secondary2 + +On secondary1: + + 127.0.0.1 localhost secondary1 + 192.168.50.2 primary + 192.168.50.3 secondary1 + 192.168.50.4 secondary2 + +On secondary2: + + 127.0.0.1 localhost secondary2 + 192.168.50.2 primary + 192.168.50.3 secondary1 + 192.168.50.4 secondary2 + +Check connectivity among themselves by using ping command: + + $ ping primary + $ ping secondary1 + $ ping secondary2 + +### Set up a Replica Set ### + +After verifying connectivity among VMs, we can go ahead and create the admin user so that we can start working on the Replica Set. + +On primary node, open /etc/mongodb.conf, and comment out two lines that start with auth and replSet: + + dbpath=/var/lib/mongodb + logpath=/var/log/mongodb/mongod.log + logappend=true + #auth = true + keyFile=/var/lib/mongodb/keyFile + #replSet=myReplica + +Restart mongod daemon. + + $ sudo service mongod restart + +Create an admin user after conencting to MongoDB: + + > use admin + > db.createUser({ + user:"admin", + pwd:" + }) + $ sudo service mongod restart + +Connect to MongoDB and use these commands to add secondary1 and secondary2 to our Replicat Set. + + > use admin + > db.auth("admin","myreallyhardpassword") + > rs.initiate() + > rs.add ("secondary1:27017") + > rs.add("secondary2:27017") + +Now that we have our Replica Set, we can start working on our project. Consult the [official driver documentation][1] to see how to connect to a Replica Set. In case you want to query from shell, you have to connect to primary instance to insert or query the database. Secondary nodes will not let you do that. If you attempt to access the database on a secondary node, you will get this error message: + + myReplica:SECONDARY> + myReplica:SECONDARY> show databases + 2015-05-10T03:09:24.131+0000 E QUERY Error: listDatabases failed:{ "note" : "from execCommand", "ok" : 0, "errmsg" : "not master" } + at Error () + at Mongo.getDBs (src/mongo/shell/mongo.js:47:15) + at shellHelper.show (src/mongo/shell/utils.js:630:33) + at shellHelper (src/mongo/shell/utils.js:524:36) + at (shellhelp2):1:1 at src/mongo/shell/mongo.js:47 + +I hope you find this tutorial useful. You can use Vagrant to automate your local environments and help you code faster. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/setup-replica-set-mongodb.html + +作者:[Christopher Valerio][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/valerio +[1]:http://docs.mongodb.org/ecosystem/drivers/ \ No newline at end of file diff --git a/sources/tech/20150522 Analyzing Linux Logs.md b/sources/tech/20150522 Analyzing Linux Logs.md new file mode 100644 index 0000000000..38d5b4636e --- /dev/null +++ b/sources/tech/20150522 Analyzing Linux Logs.md @@ -0,0 +1,182 @@ +translating by zhangboyue +Analyzing Linux Logs +================================================================================ +There’s a great deal of information waiting for you within your logs, although it’s not always as easy as you’d like to extract it. In this section we will cover some examples of basic analysis you can do with your logs right away (just search what’s there). We’ll also cover more advanced analysis that may take some upfront effort to set up properly, but will save you time on the back end. Examples of advanced analysis you can do on parsed data include generating summary counts, filtering on field values, and more. + +We’ll show you first how to do this yourself on the command line using several different tools and then show you how a log management tool can automate much of the grunt work and make this so much more streamlined. + +### Searching with Grep ### + +Searching for text is the most basic way to find what you’re looking for. The most common tool for searching text is [grep][1]. This command line tool, available on most Linux distributions, allows you to search your logs using regular expressions. A regular expression is a pattern written in a special language that can identify matching text. The simplest pattern is to put the string you’re searching for surrounded by quotes + +#### Regular Expressions #### + +Here’s an example to find authentication logs for “user hoover” on an Ubuntu system: + + $ grep "user hoover" /var/log/auth.log + Accepted password for hoover from 10.0.2.2 port 4792 ssh2 + pam_unix(sshd:session): session opened for user hoover by (uid=0) + pam_unix(sshd:session): session closed for user hoover + +It can be hard to construct regular expressions that are accurate. For example, if we searched for a number like the port “4792” it could also match timestamps, URLs, and other undesired data. In the below example for Ubuntu, it matched an Apache log that we didn’t want. + + $ grep "4792" /var/log/auth.log + Accepted password for hoover from 10.0.2.2 port 4792 ssh2 + 74.91.21.46 - - [31/Mar/2015:19:44:32 +0000] "GET /scripts/samples/search?q=4972HTTP/1.0" 404 545 "-" "-” + +#### Surround Search #### + +Another useful tip is that you can do surround search with grep. This will show you what happened a few lines before or after a match. It can help you debug what lead up to a particular error or problem. The B flag gives you lines before, and A gives you lines after. For example, we can see that when someone failed to login as an admin, they also failed the reverse mapping which means they might not have a valid domain name. This is very suspicious! + + $ grep -B 3 -A 2 'Invalid user' /var/log/auth.log + Apr 28 17:06:20 ip-172-31-11-241 sshd[12545]: reverse mapping checking getaddrinfo for 216-19-2-8.commspeed.net [216.19.2.8] failed - POSSIBLE BREAK-IN ATTEMPT! + Apr 28 17:06:20 ip-172-31-11-241 sshd[12545]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth] + Apr 28 17:06:20 ip-172-31-11-241 sshd[12547]: Invalid user admin from 216.19.2.8 + Apr 28 17:06:20 ip-172-31-11-241 sshd[12547]: input_userauth_request: invalid user admin [preauth] + Apr 28 17:06:20 ip-172-31-11-241 sshd[12547]: Received disconnect from 216.19.2.8: 11: Bye Bye [preauth] + +#### Tail #### + +You can also pair grep with [tail][2] to get the last few lines of a file, or to follow the logs and print them in real time. This is useful if you are making interactive changes like starting a server or testing a code change. + + $ tail -f /var/log/auth.log | grep 'Invalid user' + Apr 30 19:49:48 ip-172-31-11-241 sshd[6512]: Invalid user ubnt from 219.140.64.136 + Apr 30 19:49:49 ip-172-31-11-241 sshd[6514]: Invalid user admin from 219.140.64.136 + +A full introduction on grep and regular expressions is outside the scope of this guide, but [Ryan’s Tutorials][3] include more in-depth information. + +Log management systems have higher performance and more powerful searching abilities. They often index their data and parallelize queries so you can quickly search gigabytes or terabytes of logs in seconds. In contrast, this would take minutes or in extreme cases hours with grep. Log management systems also use query languages like [Lucene][4] which offer an easier syntax for searching on numbers, fields, and more. + +### Parsing with Cut, AWK, and Grok ### + +#### Command Line Tools #### + +Linux offers several command line tools for text parsing and analysis. They are great if you want to quickly parse a small amount of data but can take a long time to process large volumes of data + +#### Cut #### + +The [cut][5] command allows you to parse fields from delimited logs. Delimiters are characters like equal signs or commas that break up fields or key value pairs. + +Let’s say we want to parse the user from this log: + + pam_unix(su:auth): authentication failure; logname=hoover uid=1000 euid=0 tty=/dev/pts/0 ruser=hoover rhost= user=root + +We can use the cut command like this to get the text after the eighth equal sign. This example is on an Ubuntu system: + + $ grep "authentication failure" /var/log/auth.log | cut -d '=' -f 8 + root + hoover + root + nagios + nagios + +#### AWK #### + +Alternately, you can use [awk][6], which offers more powerful features to parse out fields. It offers a scripting language so you can filter out nearly everything that’s not relevant. + +For example, let’s say we have the following log line on an Ubuntu system and we want to extract the username that failed to login: + + Mar 24 08:28:18 ip-172-31-11-241 sshd[32701]: input_userauth_request: invalid user guest [preauth] + +Here’s how you can use the awk command. First, put a regular expression /sshd.*invalid user/ to match the sshd invalid user lines. Then print the ninth field using the default delimiter of space using { print $9 }. This outputs the usernames. + + $ awk '/sshd.*invalid user/ { print $9 }' /var/log/auth.log + guest + admin + info + test + ubnt + +You can read more about how to use regular expressions and print fields in the [Awk User’s Guide][7]. + +#### Log Management Systems #### + +Log management systems make parsing easier and enable users to quickly analyze large collections of log files. They can automatically parse standard log formats like common Linux logs or web server logs. This saves a lot of time because you don’t have to think about writing your own parsing logic when troubleshooting a system problem. + +Here you can see an example log message from sshd which has each of the fields remoteHost and user parsed out. This is a screenshot from Loggly, a cloud-based log management service. + +![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.25.09-AM.png) + +You can also do custom parsing for non-standard formats. A common tool to use is [Grok][8] which uses a library of common regular expressions to parse raw text into structured JSON. Here is an example configuration for Grok to parse kernel log files inside Logstash: + + filter{ + grok { + match => {"message" => "%{CISCOTIMESTAMP:timestamp} %{HOST:host} %{WORD:program}%{NOTSPACE} %{NOTSPACE}%{NUMBER:duration}%{NOTSPACE} %{GREEDYDATA:kernel_logs}" + } + } + +And here is what the parsed output looks like from Grok: + +![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.30.37-AM.png) + +### Filtering with Rsyslog and AWK ### + +Filtering allows you to search on a specific field value instead of doing a full text search. This makes your log analysis more accurate because it will ignore undesired matches from other parts of the log message. In order to search on a field value, you need to parse your logs first or at least have a way of searching based on the event structure. + +#### How to Filter on One App #### + +Often, you just want to see the logs from just one application. This is easy if your application always logs to a single file. It’s more complicated if you need to filter one application among many in an aggregated or centralized log. Here are several ways to do this: + +1. Use the rsyslog daemon to parse and filter logs. This example writes logs from the sshd application to a file named sshd-messages, then discards the event so it’s not repeated elsewhere. You can try this example by adding it to your rsyslog.conf file. + + :programname, isequal, “sshd” /var/log/sshd-messages + &~ + +2. Use command line tools like awk to extract the values of a particular field like the sshd username. This example is from an Ubuntu system. + + $ awk '/sshd.*invalid user/ { print $9 }' /var/log/auth.log + guest + admin + info + test + ubnt + +3. Use a log management system that automatically parses your logs, then click to filter on the desired application name. Here is a screenshot showing the syslog fields in a log management service called Loggly. We are filtering on the appName “sshd” as indicated by the Venn diagram icon. + +![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.05.02-AM.png) + +#### How to Filter on Errors #### + +One of the most common thing people want to see in their logs is errors. Unfortunately, the default syslog configuration doesn’t output the severity of errors directly, making it difficult to filter on them. + +There are two ways you can solve this problem. First, you can modify your rsyslog configuration to output the severity in the log file to make it easier to read and search. In your rsyslog configuration you can add a [template][9] with pri-text such as the following: + + "<%pri-text%> : %timegenerated%,%HOSTNAME%,%syslogtag%,%msg%n" + +This example gives you output in the following format. You can see that the severity in this message is err. + + : Mar 11 18:18:00,hoover-VirtualBox,su[5026]:, pam_authenticate: Authentication failure + +You can use awk or grep to search for just the error messages. In this example for Ubuntu, we’re including some surrounding syntax like the . and the > which match only this field. + + $ grep '.err>' /var/log/auth.log + : Mar 11 18:18:00,hoover-VirtualBox,su[5026]:, pam_authenticate: Authentication failure + +Your second option is to use a log management system. Good log management systems automatically parse syslog messages and extract the severity field. They also allow you to filter on log messages of a certain severity with a single click. + +Here is a screenshot from Loggly showing the syslog fields with the error severity highlighted to show we are filtering for errors: + +![](http://www.loggly.com/ultimate-guide/wp-content/uploads/2015/05/Screen-Shot-2015-03-12-at-11.00.36-AM.png) + +-------------------------------------------------------------------------------- + +via: http://www.loggly.com/ultimate-guide/logging/analyzing-linux-logs/ + +作者:[Jason Skowronski][a] [Amy Echeverri][b] [ Sadequl Hussain][c] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linkedin.com/in/jasonskowronski +[b]:https://www.linkedin.com/in/amyecheverri +[c]:https://www.linkedin.com/pub/sadequl-hussain/14/711/1a7 +[1]:http://linux.die.net/man/1/grep +[2]:http://linux.die.net/man/1/tail +[3]:http://ryanstutorials.net/linuxtutorial/grep.php +[4]:https://lucene.apache.org/core/2_9_4/queryparsersyntax.html +[5]:http://linux.die.net/man/1/cut +[6]:http://linux.die.net/man/1/awk +[7]:http://www.delorie.com/gnu/docs/gawk/gawk_26.html#IDX155 +[8]:http://logstash.net/docs/1.4.2/filters/grok +[9]:http://www.rsyslog.com/doc/v8-stable/configuration/templates.html diff --git a/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md new file mode 100644 index 0000000000..436b28f79f --- /dev/null +++ b/sources/tech/20150526 20 Useful Terminal Emulators for Linux.md @@ -0,0 +1,301 @@ +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 it’s an experiment to mix the best of them into a single GTK-based program. Guake has been written in python from scratch using a little piece in C (global hotkeys stuff). + +![Guake 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. It’s 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 it’s 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 don’t 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 wouldn’t assume from a other terminal emulators, like preview thumbnails of images, videos and documents, it also allows you to see those files directly from Terminology. + +You can watch a following demonstrations video created by the Terminology developer (the video quality isn’t clear, but still it’s enough to get the idea about Terminology). + + + +- [Terminology][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 can’t 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 I’ve 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 diff --git a/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md b/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md new file mode 100644 index 0000000000..ad673a03e0 --- /dev/null +++ b/sources/tech/20150527 How to Create Own Online Shopping Store Using 'OpenCart' in Linux.md @@ -0,0 +1,225 @@ +How to Create Own Online Shopping Store Using “OpenCart” in Linux +================================================================================ +In the Internet world we are doing everything using a computer. Electronic Commerce aka e-commerce is one one of them. E-Commerce is nothing new and it started in the early days of ARPANET, where ARPANET used to arrange sale between students of Massachusetts Institute of Technology and Stanford Artificial Intelligence Laboratory. + +These days there are some 100’s of E-Commerce site viz., Flipcart, eBay, Alibaba, Zappos, IndiaMART, Amazon, etc. Have you thought of making your own Amazon and Flipcart like web-based Application Server? If yes! This article is for you. + +Opencart is a free and open source E-Commerce Application written in PHP, which can be used to develop a shopping cart system similar to Amazon and Flipcart. If you want to sell your products online or want to serve your customers even when you are closed Opencart is for you. You can build a successful online store (for online merchants) using reliable and professional Opencart Application. + +### OpenCart Web Panel Demo ### + +- Store Front – [http://demo.opencart.com/][1] +- Admin Login – [http://demo.opencart.com/admin/][2] + + ------------------ Admin Login ------------------ + Username: demo + Password: demo + +#### Features of Opencart #### + +Opencart is an application that meets all the requirements of an online merchant. It has all the features (see below) using which you can make your own E-Commerce Website. + +- It is a Free (as in beer) and Open Source (as in speech) Application released under GNU GPL License. +- Everything is well documented, means you don’t need to Google and shout for help. +- Free Life time support and updates. +- Unlimited number of categories, Products and manufacturer supported. +- Everything is Template based. +- Multi-Language and Multi-Currency Supported. It ensures your product gets a global reach. +- Built-in Product Review and Rating Features. +- Downloadable Products (viz., ebook) supported. +- Automatic Image Resizing supported. +- Features like Multi tax Rates (as in various country), Viewing Related Products, Information Page, Shipping Weight Calculation, Availing Discount Coupons, etc are well implemented by default. +- Built-in Backup and Restore tools. +- Well implemented SEO. +- Invoice Printing, Error Log and sales report are supported as well. + +#### System Requirements #### + +- Web Server (Apache HTTP Server Preferred) +- PHP (5.2 and above). +- Database (MySQLi Preferred but I am using MariaDB). + +#### Required PHP Libraries and Modules #### + +These extensions must be installed and enabled on your system to install Opencart properly on the web server. + +- Curl +- Zip +- Zlib +- GD Library +- Mcrypt +- Mbstrings + +### Step 1: Installing Apache, PHP and MariaDB ### + +1. As I said, OpenCart requires certain technical requirements such as Apache, PHP with extensions and Database (MySQL or MariaDB) to be installed on the system, in order to run Opencart properly. + +Let’s install Apache, PHP and MariaDB using following Command. + +**Install Apache** + + # apt-get install apache2 (On Debian based Systems) + # yum install httpd (On RedHat based Systems) + +**Install PHP and Extensions** + + # apt-get install php5 libapache2-mod-php5 php5-curl php5-mcrypt (On Debian based Systems) + # yum install php php-mysql php5-curl php5-mcrypt (On RedHat based Systems) + +**Install MariaDB** + + # apt-get install mariadb-server mariadb-client (On Debian based Systems) + # yum install mariadb-server mariadb (On RedHat based Systems) + +2. After installing all the above required things, you can start the Apache and MariaDB services using following commands. + + ------------------- On Debian based Systems ------------------- + # systemctl restart apache2.service + # systemctl restart mariadb.service + +---------- + + ------------------- On RedHat based Systems ------------------- + # systemctl restart httpd.service + # systemctl restart mariadb.service + +### Step 2: Downloading and Setting OpenCart ### + +3. The most recent version of OpenCart (2.0.2.0) can be obtained from [OpenCart website][3] or directly from github. + +Alternatively, you may use following wget command to download the latest version of OpenCart directly from github repository as shown below. + + # wget https://github.com/opencart/opencart/archive/master.zip + +4. After downloading zip file, copy to Apache Working directory (i.e. /var/www/html) and unzip the master.zip file. + + # cp master.zip /var/www/html/ + # cd /var/www/html + # unzip master.zip + +5. After extracting ‘master.zip‘ file, cd to extracted directory and move the content of upload directory to the root of the application folder (opencart-master). + + # cd opencart-master + # mv -v upload/* ../opencart-master/ + +6. Now you need to rename or copy OpenCart configuration files as shown below. + + # cp /var/www/html/opencart-master/admin/config-dist.php /var/www/html/opencart-master/admin/config.php + # cp /var/www/html/opencart-master/config-dist.php /var/www/html/opencart-master/config.php + +7. Next, set correct Permissions to the files and folders of /var/www/html/opencart-master. You need to provide RWX permission to all the files and folders there, recursively. + + # chmod 777 -R /var/www/html/opencart-master + +**Important**: Setting permission 777 may be dangerous, so as soon as you finish setting up everything, revert back to permission 755 recursively on the above folder. + +### Step 3: Creating OpenCart Database ### + +8. Next step is to create a database (say opencartdb) for the E-Commerce site to store data on the database. Connect to databaser server and create a database, user and grant correct privileges on the user to have full control over the database. + + # mysql -u root -p + CREATE DATABASE opencartdb; + CREATE USER 'opencartuser'@'localhost' IDENTIFIED BY 'mypassword'; + GRANT ALL PRIVILEDGES ON opencartdb.* TO 'opencartuser'@'localhost' IDENTIFIED by 'mypassword'; + +### Step 4: OpenCart Web Installation ### + +9. Once everything set correctly, navigate to the web browser and type `http://` to access the OpenCart web installation. + +Click ‘CONTINUE‘ to Agree the License Agreement. + +![Accept OpenCart License](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-License.png) + +Accept OpenCart License + +10. The next screen is Pre-installation Server Setup Check, to see that the server has all the required modules are installed properly and have correct permission on the OpenCart files. + +If any red marks are highlighted on #1 or #2, that means you need to install those components properly on the server to meet web server requirements. + +If there are any red marks on #3 or #4, that means there is issue with your files. If everything is correctly configured you should see all green marks are visible (as seen below), you may press “Continue“. + +![Server Requirement Check](http://www.tecmint.com/wp-content/uploads/2015/05/Server-Checkup.png) + +Server Requirement Check + +11. On the next screen enter your Database Credentials like Database Driver, Hostname, User-name, Password, database. You should not touch db_port and Prefix, until and unless you know what you are doing. + +Also Enter User_name, Password and Email Address for Administrative account. Note these credentials will be used for logging in to Opencart Admin Panel as root, so keep it safe. Click continue when done! + +![OpenCart Database Details](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Database.png) + +OpenCart Database Details + +12. The next screen shows message like “Installation Complete” with the Tag Line Ready to Start Selling. Also it warns to delete the installation directory, as everything required to setup using this directory has been accomplished. + +![OpenCart Installation Completes](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Installation-Completes.png) + +OpenCart Installation Completes + +To Remove install directory, you may like to run the below command. + + # rm -rf /var/www/html/opencart-master/install + +### Step 4: Access OpenCart Web and Admin ### + +13. Now point your browser to `http:///opencart-master/` and you would see something like the below screenshot. + +![OpenCart Product Showcase](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart.jpg) + +OpenCart Product Showcase + +14. In order to login to Opencart Admin Panel, point your browser to http:///opencart-master/admin and fill the Admin Credentials you input, while setting it up. + +![OpenCart Admin Login](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Admin-Login.png) + +OpenCart Admin Login + +15. If everything ok! You should be able to see the Admin Dashboard of Opencart. + +![OpenCart Dashboard](http://www.tecmint.com/wp-content/uploads/2015/05/OpenCart-Dashboard.png) + +OpenCart Dashboard + +Here in Admin Dashboard you may set up a lots of options like categories, product, options, Manufacturers, Downloads, Review, Information, Extension Installer, Shipping, Payment options, order totals, gift voucher, Paypal, Coupons, Affiliates, marketing, mails, Design and Settings, Error logs, in-built analytics and what not. + +#### What after testing the tools? #### + +If you have already tested the Application and finds it customizable, flexible, Rock Solid, Easy to maintain and use, you may need a good hosting provider to host OpenCart application, that remains live 24X7 support. Though there are a lot of options for hosting providers we recommend Hostgator. + +Hostgator is a Domain Registrant and Hosting Provider that is very well known for the service and feature it provides. It Provides you with UNLIMITED Disk Space, UNLIMITED Bandwidth, Easy to install (1-click install script), 99.9% Uptime, Award winning 24x7x365 Technical Support and 45 days money back guarantee, which means if you didn’t like the product and service you get your money back within 45 days of purchasing and mind it 45 days is a long time to Test. + +So if you have something to sell you can do it for free (by free I mean, Think of the cost you would spend on getting a physical store and then compare it with virtual store setting-up cost. You will feel its free). + +**Note**: When you buy hosting (and/or Domain) from Hostgator you will get a **Flat 25% OFF**. This offer is valid only for the readers of Tecmint Site. + +All you have to do is to Enter Promocode “**TecMint025**” during the payment of hosting. For reference see the preview of payment screen with promo code. + +![Hostgator 25% Discount - TecMint025](http://www.tecmint.com/wp-content/uploads/2015/05/Hostgator-Discount-Code.png) + +[Sign up for Hostgator][4] (Coupon code: TecMint025) + +**Note**: Also worth mentioning, that for each hosting you buy from Hostgator to host OpenCart, we will get a small amount of commission, just to keep Tecmint Live (by Paying Bandwidth and hosting charges of server). + +So If you buy it using the above code, you get discount and we will get a small amount. Also note that you won’t pay anything extra, infact you will be paying 25% less on total bill. + +### Conclusion ### + +OpenCart is an application that performs out-of-the box. It is easy to install and you have the option to choose best suited templates, add your products and you become an online merchant. + +A lots of community made extensions(free and paid) makes it rich. It is a wonderful application for those who want to setup a virtual store and remain accessible to their customer 24X7. Let me know yours experience with the application. Any suggestion and feedback is welcome as well. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-e-commerce-online-shopping-store-using-opencart-in-linux/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://demo.opencart.com/ +[2]:http://demo.opencart.com/admin/ +[3]:http://www.opencart.com/index.php?route=download/download/ +[4]:http://secure.hostgator.com/%7Eaffiliat/cgi-bin/affiliates/clickthru.cgi?id=tecmint \ No newline at end of file diff --git a/sources/tech/20150527 How to edit your documents collaboratively on Linux.md b/sources/tech/20150527 How to edit your documents collaboratively on Linux.md new file mode 100644 index 0000000000..91d2bf6441 --- /dev/null +++ b/sources/tech/20150527 How to edit your documents collaboratively on Linux.md @@ -0,0 +1,122 @@ +How to edit your documents collaboratively on Linux +================================================================================ +> "Developed many years before by some high-strung, compulsive assistant, the Bulletin was simply a Word document that lived in a shared folder both Emily and I could access. Only one of us could open it at a time and add a new message, thought, or question to the itemized list. Then we'd print out the updated version and place it on the clipboard that sat on the shelf over my desk, removing the old ones as we went." ("The Devil Wears Prada" by Lauren Weisberger) + +Even today such a "collaborative editing" is in use where only one person can open a shared file, make changes to it, and then inform others about what and when was modified. + +ONLYOFFICE is an open source online office suite integrated with different management tools for documents, emails, events, tasks and client relations. + +Using ONLYOFFICE office suite, a group of people can edit text, spreadsheet or presentation within a browser simultaneously. Leave comments directly in their document and interact with each other using the integrated chat. And, finally, save the document as a PDF file for further printing. As an added bonus, it gives the possibility to view the document history and restore the previous revision/version if needed. + +In this tutorial, I will describe how to deploy your own online office suite using [ONLYOFFICE Free Edition][1], an ONLYOFFICE self-hosted version distributed under GNU AGPL v3. + +### Installing ONLYOFFICE on Linux ### + +ONLYOFFICE installation requires the presence of mono (version 4.0.0 or later), nodejs, libstdc++6, nginx and mysql-server in your Linux system. To simplify the installation process and avoid dependency errors, I install ONLYOFFICE using Docker. In this case there is only one dependency to be installed - [Docker][2]. + +Just to remind, Docker is an open-source project that automates the deployment of applications inside software containers. If Docker is not available on your Linux system, install it first by referring to Docker installation instructions for [Debian-based][3] or [Red-Hat based][4] systems. + +Note that you will need Docker 1.4.1 or later. To check the installed Docker version, use the following command. + + $ docker version + +To try ONLYOFFICE inside a Docker container, simply execute the following commands: + + $ sudo docker run -i -t -d --name onlyoffice-document-server onlyoffice/documentserver + $ sudo docker run -i -t -d -p 80:80 -p 443:443 --link onlyoffice-document-server:document_server onlyoffice/communityserver + +These commands will download the [official ONLYOFFICE Docker image][5] with all dependencies needed for its correct work. + +It's also possible to install [ONLYOFFICE Online Editors][6] separately on a Linux server, and easily integrate it into your website or cloud application via API provided. + +### Running a Self-Hosted Online Office ### + +To open your online office, enter localhost (http://IP-Address/) in the address bar of your browser. The Welcome page will open: + +![](https://farm9.staticflickr.com/8815/18116525656_795821c73b_c.jpg) + +Enter a password and specify the email address you will use to access your office the next time. + +### Editing Your Documents Online ### + +First, click the Documents link to open **the My Documents** folder. + +![](https://farm8.staticflickr.com/7781/17956640089_d3df0b18cd_c.jpg) + +#### STEP 1. Select a Document to Edit #### + +To create a new document right there, click on the **Create** button in the upper left corner, and choose the file type from the drop-down list. To edit a file stored on your hard disk drive, upload it to **Documents** clicking the **Upload** button next to **Create** button. + +![](https://farm9.staticflickr.com/8836/17956640109_ed8be735df_c.jpg) + +#### STEP 2. Share your Document #### + +Use the **Share** button to the right side if you are in the **My Documents** folder, or follow **File >> Document Info ... >> Change Access Rights** if you are inside your document. + +In the opened **Sharing Settings** window, click on the **People outside portal** link on the left, open the access to the document, and give full access to it by enabling the **Full Access** radio button. + +Finally, choose a way to share the link to your document, send it via email or one of the available social networks: Google+, Facebook, or Twitter. + +![](https://farm8.staticflickr.com/7766/17522306273_c8a9022c75_c.jpg) + +#### STEP 3. Start the Collaborative Editing #### + +To start co-editing the document, the invited person just needs to follow the provided link. + +The text passages edited by your co-editors will be automatically marked with dashed lines of different colors. + +![](https://farm8.staticflickr.com/7790/18139370292_7ef57aae8f_c.jpg) + +As soon as one of your collaborators saves his/her changes, you will see a note appearing in the left upper corner of the top toolbar, indicating that there areupdates. + +![](https://farm8.staticflickr.com/7778/18143984831_3dd42a9672_c.jpg) + +To save your changes and get updates, click on the **Save** icon. All the updates will then be highlighted. + +![](https://farm8.staticflickr.com/7796/17955172970_e53460b8a6_c.jpg) + +#### STEP 4. Interact with your Co-editors #### + +To leave some comments, select a text passage with the mouse, right-click on it and, and choose the **Add comment** option from the context menu. + +![](https://farm8.staticflickr.com/7771/17956640359_c4e2858dc8_c.jpg) + +To interact with co-editors in real time, use the integrated chat instead. All the users who currently edit the document will be listed on the **Chat** panel. To open it, click on the **Chat** icon at the left-side bar. To start a discussion, enter your message into an appropriate field on the **Chat** panel. + +![](https://farm8.staticflickr.com/7794/18116394026_d93b00e4f8_c.jpg) + +### Useful Tips ### + +As final notes, here are some useful tips for you to take full advantage of ONLYOFFICE. + +#### Tip #1. Editing your Docs from Cloud Storage Services, Like ownCloud #### + +If you store your documents in other web resources like Box, Dropbox, Google Drive, OneDrive, SharePoint or ownCloud, you can easily synchronize them with the ONLYOFFICE. + +In the opened 'Documents' module, click one of the icons under the **Add the account** caption: Google, Box, DropBox, OneDrive, ownCloud or 'Add account', and enter the requested data. + +#### Tip #2. Editing Your Docs on iPad #### + +To add some changes to your document on the go, I use ONLYOFFICE Documents app for iPad. You can download and install it from [iTune][7], then you need to enter your ONLYOFFICE portal address, email and password to access your documents. The feature set is almost the same. + +To evaluate ONLYOFFICE Online Editors features, you can use the [cloud version][8] for personal use. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/edit-documents-collaboratively-linux.html + +作者:[Tatiana Kochedykova][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/tatiana +[1]:http://www.onlyoffice.org/ +[2]:http://xmodulo.com/recommend/dockerbook +[3]:http://xmodulo.com/manage-linux-containers-docker-ubuntu.html +[4]:http://xmodulo.com/docker-containers-centos-fedora.html +[5]:https://registry.hub.docker.com/u/onlyoffice/communityserver/ +[6]:http://onlyoffice.org/sources#document +[7]:https://itunes.apple.com/us/app/onlyoffice-documents/id944896972 +[8]:https://personal.onlyoffice.com/ \ No newline at end of file diff --git a/sources/tech/20150527 Howto Manage Host Using Docker Machine in a VirtualBox.md b/sources/tech/20150527 Howto Manage Host Using Docker Machine in a VirtualBox.md new file mode 100644 index 0000000000..ea827ec74e --- /dev/null +++ b/sources/tech/20150527 Howto Manage Host Using Docker Machine in a VirtualBox.md @@ -0,0 +1,113 @@ +Howto Manage Host Using Docker Machine in a VirtualBox +================================================================================ +Hi all, today we'll learn how to create and manage a Docker host using Docker Machine in a VirtualBox. Docker Machine is an application that helps to create Docker hosts on our computer, on cloud providers and inside our own data center. It provides easy solution for creating servers, installing Docker on them and then configuring the Docker client according the users configuration and requirements. This API works for provisioning Docker on a local machine, on a virtual machine in the data center, or on a public cloud instance. Docker Machine is supported on Windows, OSX, and Linux and is available for installation as one standalone binary. It enables us to take full advantage of ecosystem partners providing Docker-ready infrastructure, while still accessing everything through the same interface. It makes people able to deploy the docker containers in the respective platform pretty fast and in pretty easy way with just a single command. + +Here are some easy and simple steps that helps us to deploy docker containers using Docker Machine. + +### 1. Installing Docker Machine ### + +Docker Machine supports awesome on every Linux Operating System. First of all, we'll need to download the latest version of Docker Machine from the [Github site][1] . Here, we'll use curl to download the latest version of Docker Machine ie 0.2.0 . + +**For 64 Bit Operating System** + + # curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-amd64 > /usr/local/bin/docker-machine + +**For 32 Bit Operating System** + + # curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-i386 > /usr/local/bin/docker-machine + +After downloading the latest release of Docker Machine, we'll make the file named **docker-machine** under **/usr/local/bin/** executable using the command below. + + # chmod +x /usr/local/bin/docker-machine + +After doing the above, we'll wanna ensure that we have successfully installed docker-machine. To check it, we can run the docker-machine -v which will give output of the version of docker-machine installed in our system. + + # docker-machine -v + +![Installing Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/installing-docker-machine.png) + +To enable Docker commands on our machines, make sure to install the Docker client as well by running the command below. + + # curl -L https://get.docker.com/builds/linux/x86_64/docker-latest > /usr/local/bin/docker + # chmod +x /usr/local/bin/docker + +### 2. Creating VirualBox VM ### + +After we have successfully installed Docker Machine in our Linux running machine, we'll definitely wanna go for creating a Virtual Machine using VirtualBox. To get started, we need to run docker-machine create command followed by --driver flag with string as virtualbox as we are trying to deploy docker inside of Virtual Box running VM and the final argument is the name of the machine, here we have machine name as "linux". This command will download [boot2docker][2] iso which is a light-weighted linux distribution based on Tiny Core Linux with the Docker daemon installed and will create and start a VirtualBox VM with Docker running as mentioned above. + +To do so, we'll run the following command in a terminal or shell in our box. + + # docker-machine create --driver virtualbox linux + +![Creating Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/creating-docker-machine.png) + +Now, to check whether we have successfully create a Virtualbox running Docker or not, we'll run the command **docker-machine** ls as shown below. + + # docker-machine ls + +![Docker Machine List](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-list.png) + +If the host is active, we can see * under the ACTIVE column in the output as shown above. + +### 3. Setting Environment Variables ### + +Now, we'll need to make docker talk with the machine. We can do that by running docker-machine env and then the machine name, here we have named **linux** as above. + + # eval "$(docker-machine env linux)" + # docker ps + +This will set environment variables that the Docker client will read which specify the TLS settings. Note that we'll need to do this every time we reboot our machine or start a new tab. We can see what variables will be set by running the following command. + + # docker-machine env linux + + export DOCKER_TLS_VERIFY=1 + export DOCKER_CERT_PATH=/Users//.docker/machine/machines/dev + export DOCKER_HOST=tcp://192.168.99.100:2376 + +### 4. Running Docker Containers ### + +Finally, after configuring the environment variables and Virtual Machine, we are able to run docker containers in the host running inside the Virtual Machine. To give it a test, we'll run a busybox container out of it run running **docker run busybox** command with **echo hello world** so that we can get the output of the container. + + # docker run busybox echo hello world + +![Running Docker Container](http://blog.linoxide.com/wp-content/uploads/2015/05/running-docker-container.png) + +### 5. Getting Docker Host's IP ### + +We can get the IP Address of the running Docker Host's using the **docker-machine ip** command. We can see any exposed ports that are available on the Docker host’s IP address. + + # docker-machine ip + +![Docker IP Address](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-ip-address.png) + +### 6. Managing the Hosts ### + +Now we can manage as many local VMs running Docker as we desire by running docker-machine create command again and again as mentioned in above steps + +If you are finished working with the running docker, we can simply run **docker-machine stop** command to stop the whole hosts which are Active and if wanna start again, we can run **docker-machine start**. + + # docker-machine stop + # docker-machine start + +You can also specify a host to stop or start using the host name as an argument. + + $ docker-machine stop linux + $ docker-machine start linux + +### Conclusion ### + +Finally, we have successfully created and managed a Docker host inside a VirtualBox using Docker Machine. Really, Docker Machine enables people fast and easy to create, deploy and manage Docker hosts in different platforms as here we are running Docker hosts using Virtualbox platform. This virtualbox driver API works for provisioning Docker on a local machine, on a virtual machine in the data center. Docker Machine ships with drivers for provisioning Docker locally with Virtualbox as well as remotely on Digital Ocean instances whereas more drivers are in the work for AWS, Azure, VMware, and other infrastructure. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/host-virtualbox-docker-machine/ + +作者:[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://github.com/docker/machine/releases +[2]:https://github.com/boot2docker/boot2docker \ No newline at end of file diff --git a/sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md b/sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md new file mode 100644 index 0000000000..74baa5fb5b --- /dev/null +++ b/sources/tech/20150528 11 pointless but awesome Linux terminal tricks.md @@ -0,0 +1,108 @@ +Translating by goreliu ... + +11 pointless but awesome Linux terminal tricks +================================================================================ +Here are some great Linux terminal tips and tricks, each one as pointless as it is awesome. + +![](http://images.techhive.com/images/article/2015/05/slide_01-100587352-orig.png) + +### All work and no play... ### + +Linux is one of the most astoundingly functional and utilitarian Operating Systems around when it comes to working from the command line. Need to perform a particular task? Odds are there is an application or script you can use to get it done. Right from the terminal. But, as they say in the good book, "All work and no play make Jack really bored or something." So here is a collection of my favorite pointless, stupid, annoying or amusing things that you can do right in your Linux Terminal. + +![](http://images.techhive.com/images/article/2015/05/slide_02-100587353-orig.png) + +### Give the terminal an attitude ### + +Step 1) Type "sudo visudo". + +Step 2) At the bottom of the "Defaults" (near the top of the file) add, on a new line, "Defaults insults". + +Step 3) Save the file. + +"What did I just do to my computer?" you may be asking yourself. Something wonderful. Now, whenever you issue a sudo command and misstype your password, your computer will call you names. My favorite: "Listen, burrito brains, I don't have time to listen to this trash." + +![](http://images.techhive.com/images/article/2015/05/slide_03-100587354-orig.png) + +### apt-get moo ### + +That screenshot you see? That's what typing "apt-get moo" (on a Debian-based system) does. That's it. Don't go looking for this to do something fancy. It won't. That, I kid you not, is it. But it's one of the most commonly known little Easter eggs on Linux. So I include it here, right near the beginning, so I won't get 5,000 emails telling me I missed it in this list. + +![](http://images.techhive.com/images/article/2015/05/slide_04-100587355-orig.png) + +### aptitude moo ### + +A bit more entertaining is aptitude's take on "moo." Type "aptitude moo" (on Ubuntu and the like) and you'll be corrected about thinking "moo" would do anything. But you know better. Try the same command again, this time with an optional "-v" attribute. Don't stop there. Add v's, one at a time, until aptitude gives you what you want. + +![](http://images.techhive.com/images/article/2015/05/slide_05-100587356-orig.png) + +### Arch: Put Pac-Man in pacman ### + +This is one just for the Arch-lovers out there. The de facto package manager, pacman, is pretty fantastic already. Let's make it even better. + +Step 1) Open "/etc/pacman.conf". + +Step 2) In the "# Misc options", remove the "#" from in front of "Color". + +Step 3) Add "ILoveCandy". + +Now the progress for installing new packages, in pacman, will include a little tiny Pac-Man. Which should really just be the default anyway. + +![](http://images.techhive.com/images/article/2015/05/slide_06-100587358-orig.png) + +### Cowsay! ### + +Making aptitude moo is neat, I guess, but you really can't use it for much. Enter "cowsay." It does what you think. You make a cow say things. Anything you like. And it's not even limited to cows. Calvin, Beavis, and the Ghostbusters logo are all available in full ASCII art glory – type "cowsay -l" for a full list of what's available in this, Linux's most powerful tool. Remember that, like most great terminal applications, you can pipe the output from other applications straight into cowsay (ala "fortune | cowsay"). + +![](http://images.techhive.com/images/article/2015/05/slide_07-100587359-orig.png) + +### Become an 3l33t h@x0r ### + +Typing "nmap" isn't something one typically needs to do on a day-to-day basis. But when one does need to "whip out the nmap," one wants to look as l33t as humanly possible. Add a "-oS" to any nmap command (such as "nmap -oS - google.com"). Bam. You're now in what is officially known as "[Script Kiddie Mode][1]." Angelina Jolie and Keanu Reeves would be proud. + +![](http://images.techhive.com/images/article/2015/05/slide_08-100587360-orig.png) + +### Getting all Discordian ddate ### + +If you've ever been sitting around thinking, "Hey! I want today's date to be written in an essentially useless, but whimsical, way"…try typing "ddate". Results like "Today is Setting Orange, the 72nd day of Discord in the YOLD 3181," can really spice up your server logs. + +Note: Technically, this is a real thing called the [Discordian Calendar][2], used (in theory) by the followers of [Discordianism][3]. Which means I probably offended somebody. Or maybe not. I'm not really sure. Either way, ddate is a handy tool in any office. + +![](http://images.techhive.com/images/article/2015/05/slide_09-100587361-orig.png) + +### I See Colors Everywhere! ### + +Tired of boring old text? Looking to spruce things up and show the world your true style? lolcat. Install it. Use it. Everywhere. It takes any text input and turns it into a rainbow of wonder and enchantment. Piping text into lolcat (ala "fortune | lolcat") is sure to liven up any party. + +![](http://images.techhive.com/images/article/2015/05/slide_10-100587362-orig.png) + +### The Steam Locomotive ### + +Animated ASCII art steam locomotive in your terminal. You want this. You need this. Install and run "sl". Use "sl -l" for a tiny version. Or, if you want to really spend some time on this, "sl-h". This is the full train, including passenger cars. + +![](http://images.techhive.com/images/article/2015/05/slide_11-100587364-orig.png) + +### Reverse any text ### + +Pipe the output of any text into "rev" and it will reverse the text. "fortune | rev" gives you a fortune. In reverse. Which is, as odd as it may seem, not a misfortune. + +![](http://images.techhive.com/images/article/2015/05/slide_12-100587366-orig.png) + +### The Matrix is still cool, right? ### + +Want your terminal to do that scrolling text, l33t, Matrix-y thing? "cmatrix" is your friend. You can even have it output different colors, which is snazzy. Learn how by typing "man cmatrix". Or, better yet, "man cmatrix | lolcat". Which, really, is the most pointless (but wonderful) thing you can do in the Linux Terminal. So that's where I leave you. + +-------------------------------------------------------------------------------- + +via: http://www.networkworld.com/article/2926630/linux/11-pointless-but-awesome-linux-terminal-tricks.html + +作者:[Bryan Lunduke][a] +译者:[goreliu](https://github.com/goreliu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.networkworld.com/author/Bryan-Lunduke/ +[1]:http://nmap.org/book/output-formats-script-kiddie.html +[2]:http://en.wikipedia.org/wiki/Discordian_calendar +[3]:http://en.wikipedia.org/wiki/Discordianism \ No newline at end of file diff --git a/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md b/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md new file mode 100644 index 0000000000..2ba7334580 --- /dev/null +++ b/sources/tech/20150604 Nishita Agarwal Shares Her Interview Experience on Linux 'iptables' Firewall.md @@ -0,0 +1,207 @@ +Nishita Agarwal Shares Her Interview Experience on Linux ‘iptables’ Firewall +================================================================================ +Nishita Agarwal, a frequent Tecmint Visitor shared her experience (Question and Answer) with us regarding the job interview she had just given in a privately owned hosting company in Pune, India. She was asked a lot of questions on a variety of topics however she is an expert in iptables and she wanted to share those questions and their answer (she gave) related to iptables to others who may be going to give interview in near future. + +![Linux Firewall Iptables Interview Questions](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-iptables-Interview-Questions.jpg) + +All the questions and their Answer are rewritten based upon the memory of Nishita Agarwal. + +> “Hello Friends! My name is **Nishita Agarwal**. I have Pursued Bachelor Degree in Technology. My area of Specialization is UNIX and Variants of UNIX (BSD, Linux) fascinates me since the time I heard it. I have 1+ years of experience in storage. I was looking for a job change which ended with a hosting company in Pune, India.” + +Here is the collection of what I was asked during the Interview. I’ve documented only those questions and their answer that were related to iptables based upon my memory. Hope this will help you in cracking your Interview. + +### 1. Have you heard of iptables and firewall in Linux? Any idea of what they are and for what it is used? ### + +> **Answer** : I’ve been using iptables for quite long time and I am aware of both iptables and firewall. Iptables is an application program mostly written in C Programming Language and is released under GNU General Public License. Written for System administration point of view, the latest stable release if iptables 1.4.21.iptables may be considered as firewall for UNIX like operating system which can be called as iptables/netfilter, more accurately. The Administrator interact with iptables via console/GUI front end tools to add and define firewall rules into predefined tables. Netfilter is a module built inside of kernel that do the job of filtering. +> +> Firewalld is the latest implementation of filtering rules in RHEL/CentOS 7 (may be implemented in other distributions which I may not be aware of). It has replaced iptables interface and connects to netfilter. + +### 2. Have you used some kind of GUI based front end tool for iptables or the Linux Command Line? ### + +> **Answer** : Though I have used both the GUI based front end tools for iptables like Shorewall in conjugation of [Webmin][1] in GUI and Direct access to iptables via console.And I must admit that direct access to iptables via Linux console gives a user immense power in the form of higher degree of flexibility and better understanding of what is going on in the background, if not anything other. GUI is for novice administrator while console is for experienced. + +### 3. What are the basic differences between between iptables and firewalld? ### + +> **Answer** : iptables and firewalld serves the same purpose (Packet Filtering) but with different approach. iptables flush the entire rules set each time a change is made unlike firewalld. Typically the location of iptables configuration lies at ‘/etc/sysconfig/iptables‘ whereas firewalld configuration lies at ‘/etc/firewalld/‘, which is a set of XML files.Configuring a XML based firewalld is easier as compared to configuration of iptables, however same task can be achieved using both the packet filtering application ie., iptables and firewalld. Firewalld runs iptables under its hood along with it’s own command line interface and configuration file that is XML based and said above. + +### 4. Would you replace iptables with firewalld on all your servers, if given a chance? ### + +> **Answer** : I am familiar with iptables and it’s working and if there is nothing that requires dynamic aspect of firewalld, there seems no reason to migrate all my configuration from iptables to firewalld.In most of the cases, so far I have never seen iptables creating an issue. Also the general rule of Information technology says “why fix if it is not broken”. However this is my personal thought and I would never mind implementing firewalld if the Organization is going to replace iptables with firewalld. + +### 5. You seems confident with iptables and the plus point is even we are using iptables on our server. ### + +What are the tables used in iptables? Give a brief description of the tables used in iptables and the chains they support. + +> **Answer** : Thanks for the recognition. Moving to question part, There are four tables used in iptables, namely they are: +> +> Nat Table +> Mangle Table +> Filter Table +> Raw Table +> +> Nat Table : Nat table is primarily used for Network Address Translation. Masqueraded packets get their IP address altered as per the rules in the table. Packets in the stream traverse Nat Table only once. ie., If a packet from a jet of Packets is masqueraded they rest of the packages in the stream will not traverse through this table again. It is recommended not to filter in this table. Chains Supported by NAT Table are PREROUTING Chain, POSTROUTING Chain and OUTPUT Chain. +> +> Mangle Table : As the name suggests, this table serves for mangling the packets. It is used for Special package alteration. It can be used to alter the content of different packets and their headers. Mangle table can’t be used for Masquerading. Supported chains are PREROUTING Chain, OUTPUT Chain, Forward Chain, INPUT Chain, POSTROUTING Chain. +> +> Filter Table : Filter Table is the default table used in iptables. It is used for filtering Packets. If no rules are defined, Filter Table is taken as default table and filtering is done on the basis of this table. Supported Chains are INPUT Chain, OUTPUT Chain, FORWARD Chain. +> +> Raw Table : Raw table comes into action when we want to configure packages that were exempted earlier. It supports PREROUTING Chain and OUTPUT Chain. + +### 6. What are the target values (that can be specified in target) in iptables and what they do, be brief! ### + +> **Answer** : Following are the target values that we can specify in target in iptables: +> +> ACCEPT : Accept Packets +> QUEUE : Paas Package to user space (place where application and drivers reside) +> DROP : Drop Packets +> RETURN : Return Control to calling chain and stop executing next set of rules for the current Packets in the chain. + + +### 7. Lets move to the technical aspects of iptables, by technical I means practical. ### + +How will you Check iptables rpm that is required to install iptables in CentOS?. + +> **Answer** : iptables rpm are included in standard CentOS installation and we do not need to install it separately. We can check the rpm as: +> +> # rpm -qa iptables +> +> iptables-1.4.21-13.el7.x86_64 +> +> If you need to install it, you may do yum to get it. +> +> # yum install iptables-services + +### 8. How to Check and ensure if iptables service is running? ### + +> **Answer** : To check the status of iptables, you may run the following command on the terminal. +> +> # service status iptables [On CentOS 6/5] +> # systemctl status iptables [On CentOS 7] +> +> If it is not running, the below command may be executed. +> +> ---------------- On CentOS 6/5 ---------------- +> # chkconfig --level 35 iptables on +> # service iptables start +> +> ---------------- On CentOS 7 ---------------- +> # systemctl enable iptables +> # systemctl start iptables +> +> We may also check if the iptables module is loaded or not, as: +> +> # lsmod | grep ip_tables + +### 9. How will you review the current Rules defined in iptables? ### + +> **Answer** : The current rules in iptables can be review as simple as: +> +> # iptables -L +> +> Sample Output +> +> Chain INPUT (policy ACCEPT) +> target prot opt source destination +> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED +> ACCEPT icmp -- anywhere anywhere +> ACCEPT all -- anywhere anywhere +> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain FORWARD (policy ACCEPT) +> target prot opt source destination +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain OUTPUT (policy ACCEPT) +> target prot opt source destination + +### 10. How will you flush all iptables rules or a particular chain? ### + +> **Answer** : To flush a particular iptables chain, you may use following commands. +> +> +> # iptables --flush OUTPUT +> +> To Flush all the iptables rules. +> +> # iptables --flush + +### 11. Add a rule in iptables to accept packets from a trusted IP Address (say 192.168.0.7) ### + +> **Answer** : The above scenario can be achieved simply by running the below command. +> +> # iptables -A INPUT -s 192.168.0.7 -j ACCEPT +> +> We may include standard slash or subnet mask in the source as: +> +> # iptables -A INPUT -s 192.168.0.7/24 -j ACCEPT +> # iptables -A INPUT -s 192.168.0.7/255.255.255.0 -j ACCEPT + +### 12. How to add rules to ACCEPT, REJECT, DENY and DROP ssh service in iptables. ### + +> **Answer** : Hoping ssh is running on port 22, which is also the default port for ssh, we can add rule to iptables as:To ACCEPT tcp packets for ssh service (port 22). +> +> # iptables -A INPUT -s -p tcp - -dport -j ACCEPT +> +> To REJECT tcp packets for ssh service (port 22). +> +> # iptables -A INPUT -s -p tcp - -dport -j REJECT +> +> To DENY tcp packets for ssh service (port 22). +> +> +> # iptables -A INPUT -s -p tcp - -dport -j DENY +> +> To DROP tcp packets for ssh service (port 22). +> +> +> # iptables -A INPUT -s -p tcp - -dport -j DROP + +### 13. Let me give you a scenario. Say there is a machine the local ip address of which is 192.168.0.6. You need to block connections on port 21, 22, 23, and 80 to your machine. What will you do? ### + +> **Answer** : Well all I need to use is the ‘multiport‘ option with iptables followed by port numbers to be blocked and the above scenario can be achieved in a single go as. +> +> # iptables -A INPUT -s 192.168.0.6 -p tcp -m multiport --dport 22,23,80,8080 -j DROP +> +> The written rules can be checked using the below command. +> +> # iptables -L +> +> Chain INPUT (policy ACCEPT) +> target prot opt source destination +> ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED +> ACCEPT icmp -- anywhere anywhere +> ACCEPT all -- anywhere anywhere +> ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> DROP tcp -- 192.168.0.6 anywhere multiport dports ssh,telnet,http,webcache +> +> Chain FORWARD (policy ACCEPT) +> target prot opt source destination +> REJECT all -- anywhere anywhere reject-with icmp-host-prohibited +> +> Chain OUTPUT (policy ACCEPT) +> target prot opt source destination + +**Interviewer** : That’s all I wanted to ask. You are a valuable employee we won’t like to miss. I will recommend your name to the HR. If you have any question you may ask me. + +As a candidate I don’t wanted to kill the conversation hence keep asking about the projects I would be handling if selected and what are the other openings in the company. Not to mention HR round was not difficult to crack and I got the opportunity. + +Also I would like to thank Avishek and Ravi (whom I am a friend since long) for taking the time to document my interview. + +Friends! If you had given any such interview and you would like to share your interview experience to millions of Tecmint readers around the globe? then send your questions and answers to admin@tecmint.com. + +Thank you! Keep Connected. Also let me know if I could have answered a question more correctly than what I did. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-firewall-iptables-interview-questions-and-answers/ + +作者:[Avishek Kumar][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md new file mode 100644 index 0000000000..9b32c93453 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 01--Reviewing Essential Commands and System Documentation.md @@ -0,0 +1,313 @@ +RHCSA Series: Reviewing Essential Commands & System Documentation – Part 1 +================================================================================ +RHCSA (Red Hat Certified System Administrator) is a certification exam from Red Hat company, which provides an open source operating system and software to the enterprise community, It also provides support, training and consulting services for the organizations. + +![RHCSA Exam Guide](http://www.tecmint.com/wp-content/uploads/2015/02/RHCSA-Series-by-Tecmint.png) + +RHCSA Exam Preparation Guide + +RHCSA exam is the certification obtained from Red Hat Inc, after passing the exam (codename EX200). RHCSA exam is an upgrade to the RHCT (Red Hat Certified Technician) exam, and this upgrade is compulsory as the Red Hat Enterprise Linux was upgraded. The main variation between RHCT and RHCSA is that RHCT exam based on RHEL 5, whereas RHCSA certification is based on RHEL 6 and 7, the courseware of these two certifications are also vary to a certain level. + +This Red Hat Certified System Administrator (RHCSA) is essential to perform the following core system administration tasks needed in Red Hat Enterprise Linux environments: + +- Understand and use necessary tools for handling files, directories, command-environments line, and system-wide / packages documentation. +- Operate running systems, even in different run levels, identify and control processes, start and stop virtual machines. +- Set up local storage using partitions and logical volumes. +- Create and configure local and network file systems and its attributes (permissions, encryption, and ACLs). +- Setup, configure, and control systems, including installing, updating and removing software. +- Manage system users and groups, along with use of a centralized LDAP directory for authentication. +- Ensure system security, including basic firewall and SELinux configuration. + +To view fees and register for an exam in your country, check the [RHCSA Certification page][1]. + +To view fees and register for an exam in your country, check the RHCSA Certification page. + +In this 15-article RHCSA series, titled Preparation for the RHCSA (Red Hat Certified System Administrator) exam, we will going to cover the following topics on the latest releases of Red Hat Enterprise Linux 7. + +- Part 1: Reviewing Essential Commands & System Documentation +- Part 2: How to Perform File and Directory Management in RHEL 7 +- Part 3: How to Manage Users and Groups in RHEL 7 +- Part 4: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps +- Part 5: Process Management in RHEL 7: boot, shutdown, and everything in between +- Part 6: Using ‘Parted’ and ‘SSM’ to Configure and Encrypt System Storage +- Part 7: Using ACLs (Access Control Lists) and Mounting Samba / NFS Shares +- Part 8: Securing SSH, Setting Hostname and Enabling Network Services +- Part 9: Installing, Configuring and Securing a Web and FTP Server +- Part 10: Yum Package Management, Automating Tasks with Cron and Monitoring System Logs +- Part 11: Firewall Essentials and Control Network Traffic Using FirewallD and Iptables +- Part 12: Automate RHEL 7 Installations Using ‘Kickstart’ +- Part 13: RHEL 7: What is SELinux and how it works? +- Part 14: Use LDAP-based authentication in RHEL 7 +- Part 15: Virtualization in RHEL 7: KVM and Virtual machine management + +In this Part 1 of the RHCSA series, we will explain how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation. + +![RHCSA: Reviewing Essential Linux Commands – Part 1](http://www.tecmint.com/wp-content/uploads/2015/02/Reviewing-Essential-Linux-Commands.png) + +RHCSA: Reviewing Essential Linux Commands – Part 1 + +#### Prerequisites: #### + +At least a slight degree of familiarity with basic Linux commands such as: + +- [cd command][2] (change directory) +- [ls command][3] (list directory) +- [cp command][4] (copy files) +- [mv command][5] (move or rename files) +- [touch command][6] (create empty files or update the timestamp of existing ones) +- rm command (delete files) +- mkdir command (make directory) + +The correct usage of some of them are anyway exemplified in this article, and you can find further information about each of them using the suggested methods in this article. + +Though not strictly required to start, as we will be discussing general commands and methods for information search in a Linux system, you should try to install RHEL 7 as explained in the following article. It will make things easier down the road. + +- [Red Hat Enterprise Linux (RHEL) 7 Installation Guide][7] + +### Interacting with the Linux Shell ### + +If we log into a Linux box using a text-mode login screen, chances are we will be dropped directly into our default shell. On the other hand, if we login using a graphical user interface (GUI), we will have to open a shell manually by starting a terminal. Either way, we will be presented with the user prompt and we can start typing and executing commands (a command is executed by pressing the Enter key after we have typed it). + +Commands are composed of two parts: + +- the name of the command itself, and +- arguments + +Certain arguments, called options (usually preceded by a hyphen), alter the behavior of the command in a particular way while other arguments specify the objects upon which the command operates. + +The type command can help us identify whether another certain command is built into the shell or if it is provided by a separate package. The need to make this distinction lies in the place where we will find more information about the command. For shell built-ins we need to look in the shell’s man page, whereas for other binaries we can refer to its own man page. + +![Check Shell built in Commands](http://www.tecmint.com/wp-content/uploads/2015/02/Check-shell-built-in-Commands.png) + +Check Shell built in Commands + +In the examples above, cd and type are shell built-ins, while top and less are binaries external to the shell itself (in this case, the location of the command executable is returned by type). + +Other well-known shell built-ins include: + +- [echo command][8]: Displays strings of text. +- [pwd command][9]: Prints the current working directory. + +![More Built in Shell Commands](http://www.tecmint.com/wp-content/uploads/2015/02/More-Built-in-Shell-Commands.png) + +More Built in Shell Commands + +**exec command** + +Runs an external program that we specify. Note that in most cases, this is better accomplished by just typing the name of the program we want to run, but the exec command has one special feature: rather than create a new process that runs alongside the shell, the new process replaces the shell, as can verified by subsequent. + + # ps -ef | grep [original PID of the shell process] + +When the new process terminates, the shell terminates with it. Run exec top and then hit the q key to quit top. You will notice that the shell session ends when you do, as shown in the following screencast: + +注:youtube视频 + + +**export command** + +Exports variables to the environment of subsequently executed commands. + +**history Command** + +Displays the command history list with line numbers. A command in the history list can be repeated by typing the command number preceded by an exclamation sign. If we need to edit a command in history list before executing it, we can press Ctrl + r and start typing the first letters associated with the command. When we see the command completed automatically, we can edit it as per our current need: + +注:youtube视频 + + +This list of commands is kept in our home directory in a file called .bash_history. The history facility is a useful resource for reducing the amount of typing, especially when combined with command line editing. By default, bash stores the last 500 commands you have entered, but this limit can be extended by using the HISTSIZE environment variable: + +![Linux history Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-history-Command.png) + +Linux history Command + +But this change as performed above, will not be persistent on our next boot. In order to preserve the change in the HISTSIZE variable, we need to edit the .bashrc file by hand: + + # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) + HISTSIZE=1000 + +**Important**: Keep in mind that these changes will not take effect until we restart our shell session. + +**alias command** + +With no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are provided, an alias is defined for each name whose value is given. + +With alias, we can make up our own commands or modify existing ones by including desired options. For example, suppose we want to alias ls to ls –color=auto so that the output will display regular files, directories, symlinks, and so on, in different colors: + + # alias ls='ls --color=auto' + +![Linux alias Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-alias-Command.png) + +Linux alias Command + +**Note**: That you can assign any name to your “new command” and enclose as many commands as desired between single quotes, but in that case you need to separate them by semicolons, as follows: + + # alias myNewCommand='cd /usr/bin; ls; cd; clear' + +**exit command** + +The exit and logout commands both terminate the shell. The exit command terminates any shell, but the logout command terminates only login shells—that is, those that are launched automatically when you initiate a text-mode login. + +If we are ever in doubt as to what a program does, we can refer to its man page, which can be invoked using the man command. In addition, there are also man pages for important files (inittab, fstab, hosts, to name a few), library functions, shells, devices, and other features. + +#### Examples: #### + +- man uname (print system information, such as kernel name, processor, operating system type, architecture, and so on). +- man inittab (init daemon configuration). + +Another important source of information is provided by the info command, which is used to read info documents. These documents often provide more information than the man page. It is invoked by using the info keyword followed by a command name, such as: + + # info ls + # info cut + +In addition, the /usr/share/doc directory contains several subdirectories where further documentation can be found. They either contain plain-text files or other friendly formats. + +Make sure you make it a habit to use these three methods to look up information for commands. Pay special and careful attention to the syntax of each of them, which is explained in detail in the documentation. + +**Converting Tabs into Spaces with expand Command** + +Sometimes text files contain tabs but programs that need to process the files don’t cope well with tabs. Or maybe we just want to convert tabs into spaces. That’s where the expand tool (provided by the GNU coreutils package) comes in handy. + +For example, given the file NumbersList.txt, let’s run expand against it, changing tabs to one space, and display on standard output. + + # expand --tabs=1 NumbersList.txt + +![Linux expand Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-expand-Command.png) + +Linux expand Command + +The unexpand command performs the reverse operation (converts spaces into tabs). + +**Display the first lines of a file with head and the last lines with tail** + +By default, the head command followed by a filename, will display the first 10 lines of the said file. This behavior can be changed using the -n option and specifying a certain number of lines. + + # head -n3 /etc/passwd + # tail -n3 /etc/passwd + +![Linux head and tail Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-head-and-tail-Command.png) + +Linux head and tail Command + +One of the most interesting features of tail is the possibility of displaying data (last lines) as the input file grows (tail -f my.log, where my.log is the file under observation). This is particularly useful when monitoring a log to which data is being continually added. + +Read More: [Manage Files Effectively using head and tail Commands][10] + +**Merging Lines with paste** + +The paste command merges files line by line, separating the lines from each file with tabs (by default), or another delimiter that can be specified (in the following example the fields in the output are separated by an equal sign). + + # paste -d= file1 file2 + +![Merge Files in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Merge-Files-in-Linux-with-paste-command.png) + +Merge Files in Linux + +**Breaking a file into pieces using split command** + +The split command is used split a file into two (or more) separate files, which are named according to a prefix of our choosing. The splitting can be defined by size, chunks, or number of lines, and the resulting files can have a numeric or alphabetic suffixes. In the following example, we will split bash.pdf into files of size 50 KB (-b 50KB), using numeric suffixes (-d): + + # split -b 50KB -d bash.pdf bash_ + +![Split Files in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Split-Files-in-Linux-with-split-command.png) + +Split Files in Linux + +You can merge the files to recreate the original file with the following command: + + # cat bash_00 bash_01 bash_02 bash_03 bash_04 bash_05 > bash.pdf + +**Translating characters with tr command** + +The tr command can be used to translate (change) characters on a one-by-one basis or using character ranges. In the following example we will use the same file2 as previously, and we will change: + +- lowercase o’s to uppercase, +- and all lowercase to uppercase + + # cat file2 | tr o O + # cat file2 | tr [a-z] [A-Z] + +![Translate Characters in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Translate-characters-in-Linux-with-tr-command.png) + +Translate Characters in Linux + +**Reporting or deleting duplicate lines with uniq and sort command** + +The uniq command allows us to report or remove duplicate lines in a file, writing to stdout by default. We must note that uniq does not detect repeated lines unless they are adjacent. Thus, uniq is commonly used along with a preceding sort (which is used to sort lines of text files). + +By default, sort takes the first field (separated by spaces) as key field. To specify a different key field, we need to use the -k option. Please note how the output returned by sort and uniq change as we change the key field in the following example: + + # cat file3 + # sort file3 | uniq + # sort -k2 file3 | uniq + # sort -k3 file3 | uniq + +![Remove Duplicate Lines in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Remove-Duplicate-Lines-in-file.png) + +Remove Duplicate Lines in Linux + +**Extracting text with cut command** + +The cut command extracts portions of input lines (from stdin or files) and displays the result on standard output, based on number of bytes (-b), characters (-c), or fields (-f). + +When using cut based on fields, the default field separator is a tab, but a different separator can be specified by using the -d option. + + # cut -d: -f1,3 /etc/passwd # Extract specific fields: 1 and 3 in this case + # cut -d: -f2-4 /etc/passwd # Extract range of fields: 2 through 4 in this example + +![Extract Text From a File in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Extract-Text-from-a-file.png) + +Extract Text From a File in Linux + +Note that the output of the two examples above was truncated for brevity. + +**Reformatting files with fmt command** + +fmt is used to “clean up” files with a great amount of content or lines, or with varying degrees of indentation. The new paragraph formatting defaults to no more than 75 characters wide. You can change this with the -w (width) option, which set the line length to the specified number of characters. + +For example, let’s see what happens when we use fmt to display the /etc/passwd file setting the width of each line to 100 characters. Once again, output has been truncated for brevity. + + # fmt -w100 /etc/passwd + +![File Reformatting in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/File-Reformatting-in-Linux-with-fmt-command.png) + +File Reformatting in Linux + +**Formatting content for printing with pr command** + +pr paginates and displays in columns one or more files for printing. In other words, pr formats a file to make it look better when printed. For example, the following command: + + # ls -a /etc | pr -n --columns=3 -h "Files in /etc" + +Shows a listing of all the files found in /etc in a printer-friendly format (3 columns) with a custom header (indicated by the -h option), and numbered lines (-n). + +![File Formatting in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/File-Formatting-in-Linux-with-pr-command.png) + +File Formatting in Linux + +### Summary ### + +In this article we have discussed how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation. As simple as it seems, it’s a large first step in your way to becoming a RHCSA. + +If you would like to add other commands that you use on a periodic basis and that have proven useful to fulfill your daily responsibilities, feel free to share them with the world by using the comment form below. Questions are also welcome. We look forward to hearing from you! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:https://www.redhat.com/en/services/certification/rhcsa +[2]:http://www.tecmint.com/cd-command-in-linux/ +[3]:http://www.tecmint.com/ls-command-interview-questions/ +[4]:http://www.tecmint.com/advanced-copy-command-shows-progress-bar-while-copying-files/ +[5]:http://www.tecmint.com/rename-multiple-files-in-linux/ +[6]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ +[7]:http://www.tecmint.com/redhat-enterprise-linux-7-installation/ +[8]:http://www.tecmint.com/echo-command-in-linux/ +[9]:http://www.tecmint.com/pwd-command-examples/ +[10]:http://www.tecmint.com/view-contents-of-file-in-linux/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md b/sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md new file mode 100644 index 0000000000..7566862597 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 02--How to Perform File and Directory Management.md @@ -0,0 +1,322 @@ +RHCSA Series: How to Perform File and Directory Management – Part 2 +================================================================================ +In this article, RHCSA Part 2: File and directory management, we will review some essential skills that are required in the day-to-day tasks of a system administrator. + +![RHCSA: Perform File and Directory Management – Part 2](http://www.tecmint.com/wp-content/uploads/2015/03/RHCSA-Part2.png) + +RHCSA: Perform File and Directory Management – Part 2 + +### Create, Delete, Copy, and Move Files and Directories ### + +File and directory management is a critical competence that every system administrator should possess. This includes the ability to create / delete text files from scratch (the core of each program’s configuration) and directories (where you will organize files and other directories), and to find out the type of existing files. + +The [touch command][1] can be used not only to create empty files, but also to update the access and modification times of existing files. + +![touch command example](http://www.tecmint.com/wp-content/uploads/2015/03/touch-command-example.png) + +touch command example + +You can use `file [filename]` to determine a file’s type (this will come in handy before launching your preferred text editor to edit it). + +![file command example](http://www.tecmint.com/wp-content/uploads/2015/03/file-command-example.png) + +file command example + +and `rm [filename]` to delete it. + +![Linux rm command examples](http://www.tecmint.com/wp-content/uploads/2015/03/rm-command-examples.png) + +rm command example + +As for directories, you can create directories inside existing paths with `mkdir [directory]` or create a full path with `mkdir -p [/full/path/to/directory].` + +![mkdir command example](http://www.tecmint.com/wp-content/uploads/2015/03/mkdir-command-example.png) + +mkdir command example + +When it comes to removing directories, you need to make sure that they’re empty before issuing the `rmdir [directory]` command, or use the more powerful (handle with care!) `rm -rf [directory]`. This last option will force remove recursively the `[directory]` and all its contents – so use it at your own risk. + +### Input and Output Redirection and Pipelining ### + +The command line environment provides two very useful features that allows to redirect the input and output of commands from and to files, and to send the output of a command to another, called redirection and pipelining, respectively. + +To understand those two important concepts, we must first understand the three most important types of I/O (Input and Output) streams (or sequences) of characters, which are in fact special files, in the *nix sense of the word. + +- Standard input (aka stdin) is by default attached to the keyboard. In other words, the keyboard is the standard input device to enter commands to the command line. +- Standard output (aka stdout) is by default attached to the screen, the device that “receives” the output of commands and display them on the screen. +- Standard error (aka stderr), is where the status messages of a command is sent to by default, which is also the screen. + +In the following example, the output of `ls /var` is sent to stdout (the screen), as well as the result of ls /tecmint. But in the latter case, it is stderr that is shown. + +![Linux input output redirect](http://www.tecmint.com/wp-content/uploads/2015/03/Linux-input-output-redirect.png) + +Input and Output Example + +To more easily identify these special files, they are each assigned a file descriptor, an abstract representation that is used to access them. The essential thing to understand is that these files, just like others, can be redirected. What this means is that you can capture the output from a file or script and send it as input to another file, command, or script. This will allow you to store on disk, for example, the output of commands for later processing or analysis. + +To redirect stdin (fd 0), stdout (fd 1), or stderr (fd 2), the following operators are available. + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Redirection OperatorEffect
>Redirects standard output to a file containing standard output. If the destination file exists, it will be overwritten.
>>Appends standard output to a file.
2>Redirects standard error to a file containing standard output. If the destination file exists, it will be overwritten.
2>>Appends standard error to the existing file.
&>Redirects both standard output and standard error to a file; if the specified file exists, it will be overwritten.
<Uses the specified file as standard input.
<>The specified file is used for both standard input and standard output.
+ +As opposed to redirection, pipelining is performed by adding a vertical bar `(|)` after a command and before another one. + +Remember: + +- Redirection is used to send the output of a command to a file, or to send a file as input to a command. +- Pipelining is used to send the output of a command to another command as input. + +#### Examples Of Redirection and Pipelining #### + +**Example 1: Redirecting the output of a command to a file** + +There will be times when you will need to iterate over a list of files. To do that, you can first save that list to a file and then read that file line by line. While it is true that you can iterate over the output of ls directly, this example serves to illustrate redirection. + + # ls -1 /var/mail > mail.txt + +![Redirect output of command tot a file](http://www.tecmint.com/wp-content/uploads/2015/03/Redirect-output-to-a-file.png) + +Redirect output of command tot a file + +**Example 2: Redirecting both stdout and stderr to /dev/null** + +In case we want to prevent both stdout and stderr to be displayed on the screen, we can redirect both file descriptors to `/dev/null`. Note how the output changes when the redirection is implemented for the same command. + + # ls /var /tecmint + # ls /var/ /tecmint &> /dev/null + +![Redirecting stdout and stderr ouput to /dev/null](http://www.tecmint.com/wp-content/uploads/2015/03/Redirecting-stdout-stderr-ouput.png) + +Redirecting stdout and stderr ouput to /dev/null + +#### Example 3: Using a file as input to a command #### + +While the classic syntax of the [cat command][2] is as follows. + + # cat [file(s)] + +You can also send a file as input, using the correct redirection operator. + + # cat < mail.txt + +![Linux cat command examples](http://www.tecmint.com/wp-content/uploads/2015/03/cat-command-examples.png) + +cat command example + +#### Example 4: Sending the output of a command as input to another #### + +If you have a large directory or process listing and want to be able to locate a certain file or process at a glance, you will want to pipeline the listing to grep. + +Note that we use to pipelines in the following example. The first one looks for the required keyword, while the second one will eliminate the actual `grep command` from the results. This example lists all the processes associated with the apache user. + + # ps -ef | grep apache | grep -v grep + +![Send output of command as input to another](http://www.tecmint.com/wp-content/uploads/2015/03/Send-output-of-command-as-input-to-another1.png) + +Send output of command as input to another + +### Archiving, Compressing, Unpacking, and Uncompressing Files ### + +If you need to transport, backup, or send via email a group of files, you will use an archiving (or grouping) tool such as [tar][3], typically used with a compression utility like gzip, bzip2, or xz. + +Your choice of a compression tool will be likely defined by the compression speed and rate of each one. Of these three compression tools, gzip is the oldest and provides the least compression, bzip2 provides improved compression, and xz is the newest and provides the best compression. Typically, files compressed with these utilities have .gz, .bz2, or .xz extensions, respectively. + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CommandAbbreviationDescription
–createcCreates a tar archive
–concatenateAAppends tar files to an archive
–appendrAppends non-tar files to an archive
–updateuAppends files that are newer than those in an archive
–diff or –comparedCompares an archive to files on disk
–listtLists the contents of a tarball
–extract or –getxExtracts files from an archive
+ +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Operation modifierAbbreviationDescription
directory dir CChanges to directory dir before performing operations
same-permissions and same-owner pPreserves permissions and ownership information, respectively.
–verbose vLists all files as they are read or extracted; if combined with –list, it also displays file sizes, ownership, and timestamps
exclude fileExcludes file from the archive. In this case, file can be an actual file or a pattern.
gzip or gunzip zCompresses an archive through gzip
–bzip2 jCompresses an archive through bzip2
–xz JCompresses an archive through xz
+ +#### Example 5: Creating a tarball and then compressing it using the three compression utilities #### + +You may want to compare the effectiveness of each tool before deciding to use one or another. Note that while compressing small files, or a few files, the results may not show much differences, but may give you a glimpse of what they have to offer. + + # tar cf ApacheLogs-$(date +%Y%m%d).tar /var/log/httpd/* # Create an ordinary tarball + # tar czf ApacheLogs-$(date +%Y%m%d).tar.gz /var/log/httpd/* # Create a tarball and compress with gzip + # tar cjf ApacheLogs-$(date +%Y%m%d).tar.bz2 /var/log/httpd/* # Create a tarball and compress with bzip2 + # tar cJf ApacheLogs-$(date +%Y%m%d).tar.xz /var/log/httpd/* # Create a tarball and compress with xz + +![Linux tar command examples](http://www.tecmint.com/wp-content/uploads/2015/03/tar-command-examples.png) + +tar command examples + +#### Example 6: Preserving original permissions and ownership while archiving and when #### + +If you are creating backups from users’ home directories, you will want to store the individual files with the original permissions and ownership instead of changing them to that of the user account or daemon performing the backup. The following example preserves these attributes while taking the backup of the contents in the `/var/log/httpd` directory: + + # tar cJf ApacheLogs-$(date +%Y%m%d).tar.xz /var/log/httpd/* --same-permissions --same-owner + +### Create Hard and Soft Links ### + +In Linux, there are two types of links to files: hard links and soft (aka symbolic) links. Since a hard link represents another name for an existing file and is identified by the same inode, it then points to the actual data, as opposed to symbolic links, which point to filenames instead. + +In addition, hard links do not occupy space on disk, while symbolic links do take a small amount of space to store the text of the link itself. The downside of hard links is that they can only be used to reference files within the filesystem where they are located because inodes are unique inside a filesystem. Symbolic links save the day, in that they point to another file or directory by name rather than by inode, and therefore can cross filesystem boundaries. + +The basic syntax to create links is similar in both cases: + + # ln TARGET LINK_NAME # Hard link named LINK_NAME to file named TARGET + # ln -s TARGET LINK_NAME # Soft link named LINK_NAME to file named TARGET + +#### Example 7: Creating hard and soft links #### + +There is no better way to visualize the relation between a file and a hard or symbolic link that point to it, than to create those links. In the following screenshot you will see that the file and the hard link that points to it share the same inode and both are identified by the same disk usage of 466 bytes. + +On the other hand, creating a hard link results in an extra disk usage of 5 bytes. Not that you’re going to run out of storage capacity, but this example is enough to illustrate the difference between a hard link and a soft link. + +![Difference between a hard link and a soft link](http://www.tecmint.com/wp-content/uploads/2015/03/hard-soft-link.png) + +Difference between a hard link and a soft link + +A typical usage of symbolic links is to reference a versioned file in a Linux system. Suppose there are several programs that need access to file fooX.Y, which is subject to frequent version updates (think of a library, for example). Instead of updating every single reference to fooX.Y every time there’s a version update, it is wiser, safer, and faster, to have programs look to a symbolic link named just foo, which in turn points to the actual fooX.Y. + +Thus, when X and Y change, you only need to edit the symbolic link foo with a new destination name instead of tracking every usage of the destination file and updating it. + +### Summary ### + +In this article we have reviewed some essential file and directory management skills that must be a part of every system administrator’s tool-set. Make sure to review other parts of this series as well in order to integrate these topics with the content covered in this tutorial. + +Feel free to let us know if you have any questions or comments. We are always more than glad to hear from our readers. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/file-and-directory-management-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/ +[2]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/ +[3]:http://www.tecmint.com/18-tar-command-examples-in-linux/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md b/sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md new file mode 100644 index 0000000000..be78c87e3a --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 03--How to Manage Users and Groups in RHEL 7.md @@ -0,0 +1,248 @@ +RHCSA Series: How to Manage Users and Groups in RHEL 7 – Part 3 +================================================================================ +Managing a RHEL 7 server, as it is the case with any other Linux server, will require that you know how to add, edit, suspend, or delete user accounts, and grant users the necessary permissions to files, directories, and other system resources to perform their assigned tasks. + +![User and Group Management in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/User-and-Group-Management-in-Linux.png) + +RHCSA: User and Group Management – Part 3 + +### Managing User Accounts ### + +To add a new user account to a RHEL 7 server, you can run either of the following two commands as root: + + # adduser [new_account] + # useradd [new_account] + +When a new user account is added, by default the following operations are performed. + +- His/her home directory is created (`/home/username` unless specified otherwise). +- These `.bash_logout`, `.bash_profile` and `.bashrc` hidden files are copied inside the user’s home directory, and will be used to provide environment variables for his/her user session. You can explore each of them for further details. +- A mail spool directory is created for the added user account. +- A group is created with the same name as the new user account. + +The full account summary is stored in the `/etc/passwd `file. This file holds a record per system user account and has the following format (fields are separated by a colon): + + [username]:[x]:[UID]:[GID]:[Comment]:[Home directory]:[Default shell] + +- These two fields `[username]` and `[Comment]` are self explanatory. +- The second filed ‘x’ indicates that the account is secured by a shadowed password (in `/etc/shadow`), which is used to logon as `[username]`. +- The fields `[UID]` and `[GID]` are integers that shows the User IDentification and the primary Group IDentification to which `[username]` belongs, equally. + +Finally, + +- The `[Home directory]` shows the absolute location of `[username]’s` home directory, and +- `[Default shell]` is the shell that is commit to this user when he/she logins into the system. + +Another important file that you must become familiar with is `/etc/group`, where group information is stored. As it is the case with `/etc/passwd`, there is one record per line and its fields are also delimited by a colon: + + [Group name]:[Group password]:[GID]:[Group members] + +where, + +- `[Group name]` is the name of group. +- Does this group use a group password? (An “x” means no). +- `[GID]`: same as in `/etc/passwd`. +- `[Group members]`: a list of users, separated by commas, that are members of each group. + +After adding an account, at anytime, you can edit the user’s account information using usermod, whose basic syntax is: + + # usermod [options] [username] + +Read Also: + +- [15 ‘useradd’ Command Examples][1] +- [15 ‘usermod’ Command Examples][2] + +#### EXAMPLE 1: Setting the expiry date for an account #### + +If you work for a company that has some kind of policy to enable account for a certain interval of time, or if you want to grant access to a limited period of time, you can use the `--expiredate` flag followed by a date in YYYY-MM-DD format. To verify that the change has been applied, you can compare the output of + + # chage -l [username] + +before and after updating the account expiry date, as shown in the following image. + +![Change User Account Information](http://www.tecmint.com/wp-content/uploads/2015/03/Change-User-Account-Information.png) + +Change User Account Information + +#### EXAMPLE 2: Adding the user to supplementary groups #### + +Besides the primary group that is created when a new user account is added to the system, a user can be added to supplementary groups using the combined -aG, or –append –groups options, followed by a comma separated list of groups. + +#### EXAMPLE 3: Changing the default location of the user’s home directory and / or changing its shell #### + +If for some reason you need to change the default location of the user’s home directory (other than /home/username), you will need to use the -d, or –home options, followed by the absolute path to the new home directory. + +If a user wants to use another shell other than bash (for example, sh), which gets assigned by default, use usermod with the –shell flag, followed by the path to the new shell. + +#### EXAMPLE 4: Displaying the groups an user is a member of #### + +After adding the user to a supplementary group, you can verify that it now actually belongs to such group(s): + + # groups [username] + # id [username] + +The following image depicts Examples 2 through 4: + +![Adding User to Supplementary Group](http://www.tecmint.com/wp-content/uploads/2015/03/Adding-User-to-Supplementary-Group.png) + +Adding User to Supplementary Group + +In the example above: + + # usermod --append --groups gacanepa,users --home /tmp --shell /bin/sh tecmint + +To remove a user from a group, omit the `--append` switch in the command above and list the groups you want the user to belong to following the `--groups` flag. + +#### EXAMPLE 5: Disabling account by locking password #### + +To disable an account, you will need to use either the -l (lowercase L) or the –lock option to lock a user’s password. This will prevent the user from being able to log on. + +#### EXAMPLE 6: Unlocking password #### + +When you need to re-enable the user so that he can log on to the server again, use the -u or the –unlock option to unlock a user’s password that was previously blocked, as explained in Example 5 above. + + # usermod --unlock tecmint + +The following image illustrates Examples 5 and 6: + +![Lock Unlock User Account](http://www.tecmint.com/wp-content/uploads/2015/03/Lock-Unlock-User-Account.png) + +Lock Unlock User Account + +#### EXAMPLE 7: Deleting a group or an user account #### + +To delete a group, you’ll want to use groupdel, whereas to delete a user account you will use userdel (add the –r switch if you also want to delete the contents of its home directory and mail spool): + + # groupdel [group_name] # Delete a group + # userdel -r [user_name] # Remove user_name from the system, along with his/her home directory and mail spool + +If there are files owned by group_name, they will not be deleted, but the group owner will be set to the GID of the group that was deleted. + +### Listing, Setting and Changing Standard ugo/rwx Permissions ### + +The well-known [ls command][3] is one of the best friends of any system administrator. When used with the -l flag, this tool allows you to view a list a directory’s contents in long (or detailed) format. + +However, this command can also be applied to a single file. Either way, the first 10 characters in the output of `ls -l` represent each file’s attributes. + +The first char of this 10-character sequence is used to indicate the file type: + +- – (hyphen): a regular file +- d: a directory +- l: a symbolic link +- c: a character device (which treats data as a stream of bytes, i.e. a terminal) +- b: a block device (which handles data in blocks, i.e. storage devices) + +The next nine characters of the file attributes, divided in groups of three from left to right, are called the file mode and indicate the read (r), write(w), and execute (x) permissions granted to the file’s owner, the file’s group owner, and the rest of the users (commonly referred to as “the world”), respectively. + +While the read permission on a file allows the same to be opened and read, the same permission on a directory allows its contents to be listed if the execute permission is also set. In addition, the execute permission in a file allows it to be handled as a program and run. + +File permissions are changed with the chmod command, whose basic syntax is as follows: + + # chmod [new_mode] file + +where new_mode is either an octal number or an expression that specifies the new permissions. Feel free to use the mode that works best for you in each case. Or perhaps you already have a preferred way to set a file’s permissions – so feel free to use the method that works best for you. + +The octal number can be calculated based on the binary equivalent, which can in turn be obtained from the desired file permissions for the owner of the file, the owner group, and the world.The presence of a certain permission equals a power of 2 (r=22, w=21, x=20), while its absence means 0. For example: + +![File Permissions](http://www.tecmint.com/wp-content/uploads/2015/03/File-Permissions.png) + +File Permissions + +To set the file’s permissions as indicated above in octal form, type: + + # chmod 744 myfile + +Please take a minute to compare our previous calculation to the actual output of `ls -l` after changing the file’s permissions: + +![Long List Format](http://www.tecmint.com/wp-content/uploads/2015/03/Long-List-Format.png) + +Long List Format + +#### EXAMPLE 8: Searching for files with 777 permissions #### + +As a security measure, you should make sure that files with 777 permissions (read, write, and execute for everyone) are avoided like the plague under normal circumstances. Although we will explain in a later tutorial how to more effectively locate all the files in your system with a certain permission set, you can -by now- combine ls with grep to obtain such information. + +In the following example, we will look for file with 777 permissions in the /etc directory only. Note that we will use pipelining as explained in [Part 2: File and Directory Management][4] of this RHCSA series: + + # ls -l /etc | grep rwxrwxrwx + +![Find All Files with 777 Permission](http://www.tecmint.com/wp-content/uploads/2015/03/Find-All-777-Files.png) + +Find All Files with 777 Permission + +#### EXAMPLE 9: Assigning a specific permission to all users #### + +Shell scripts, along with some binaries that all users should have access to (not just their corresponding owner and group), should have the execute bit set accordingly (please note that we will discuss a special case later): + + # chmod a+x script.sh + +**Note**: That we can also set a file’s mode using an expression that indicates the owner’s rights with the letter `u`, the group owner’s rights with the letter `g`, and the rest with `o`. All of these rights can be represented at the same time with the letter `a`. Permissions are granted (or revoked) with the `+` or `-` signs, respectively. + +![Set Execute Permission on File](http://www.tecmint.com/wp-content/uploads/2015/03/Set-Execute-Permission-on-File.png) + +Set Execute Permission on File + +A long directory listing also shows the file’s owner and its group owner in the first and second columns, respectively. This feature serves as a first-level access control method to files in a system: + +![Check File Owner and Group](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Owner-and-Group.png) + +Check File Owner and Group + +To change file ownership, you will use the chown command. Note that you can change the file and group ownership at the same time or separately: + + # chown user:group file + +**Note**: That you can change the user or group, or the two attributes at the same time, as long as you don’t forget the colon, leaving user or group blank if you want to update the other attribute, for example: + + # chown :group file # Change group ownership only + # chown user: file # Change user ownership only + +#### EXAMPLE 10: Cloning permissions from one file to another #### + +If you would like to “clone” ownership from one file to another, you can do so using the –reference flag, as follows: + + # chown --reference=ref_file file + +where the owner and group of ref_file will be assigned to file as well: + +![Clone File Ownership](http://www.tecmint.com/wp-content/uploads/2015/03/Clone-File-Ownership.png) + +Clone File Ownership + +### Setting Up SETGID Directories for Collaboration ### + +Should you need to grant access to all the files owned by a certain group inside a specific directory, you will most likely use the approach of setting the setgid bit for such directory. When the setgid bit is set, the effective GID of the real user becomes that of the group owner. + +Thus, any user can access a file under the privileges granted to the group owner of such file. In addition, when the setgid bit is set on a directory, newly created files inherit the same group as the directory, and newly created subdirectories will also inherit the setgid bit of the parent directory. + + # chmod g+s [filename] + +To set the setgid in octal form, prepend the number 2 to the current (or desired) basic permissions. + + # chmod 2755 [directory] + +### Conclusion ### + +A solid knowledge of user and group management, along with standard and special Linux permissions, when coupled with practice, will allow you to quickly identify and troubleshoot issues with file permissions in your RHEL 7 server. + +I assure you that as you follow the steps outlined in this article and use the system documentation (as explained in [Part 1: Reviewing Essential Commands & System Documentation][5] of this series) you will master this essential competence of system administration. + +Feel free to let us know if you have any questions or comments using the form below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-manage-users-and-groups/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/add-users-in-linux/ +[2]:http://www.tecmint.com/usermod-command-examples/ +[3]:http://www.tecmint.com/ls-interview-questions/ +[4]:http://www.tecmint.com/file-and-directory-management-in-linux/ +[5]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md b/sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md new file mode 100644 index 0000000000..1529fecf2e --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 04--Editing Text Files with Nano and Vim or Analyzing text with grep and regexps.md @@ -0,0 +1,254 @@ +RHCSA Series: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps – Part 4 +================================================================================ +Every system administrator has to deal with text files as part of his daily responsibilities. That includes editing existing files (most likely configuration files), or creating new ones. It has been said that if you want to start a holy war in the Linux world, you can ask sysadmins what their favorite text editor is and why. We are not going to do that in this article, but will present a few tips that will be helpful to use two of the most widely used text editors in RHEL 7: nano (due to its simplicity and easiness of use, specially to new users), and vi/m (due to its several features that convert it into more than a simple editor). I am sure that you can find many more reasons to use one or the other, or perhaps some other editor such as emacs or pico. It’s entirely up to you. + +![Learn Nano and vi Editors](http://www.tecmint.com/wp-content/uploads/2015/03/Learn-Nano-and-vi-Editors.png) + +RHCSA: Editing Text Files with Nano and Vim – Part 4 + +### Editing Files with Nano Editor ### + +To launch nano, you can either just type nano at the command prompt, optionally followed by a filename (in this case, if the file exists, it will be opened in edition mode). If the file does not exist, or if we omit the filename, nano will also be opened in edition mode but will present a blank screen for us to start typing: + +![Nano Editor](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Editor.png) + +Nano Editor + +As you can see in the previous image, nano displays at the bottom of the screen several functions that are available via the indicated shortcuts (^, aka caret, indicates the Ctrl key). To name a few of them: + +- Ctrl + G: brings up the help menu with a complete list of functions and descriptions:Ctrl + X: exits the current file. If changes have not been saved, they are discarded. +- Ctrl + R: lets you choose a file to insert its contents into the present file by specifying a full path. + +![Nano Editor Help Menu](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Help.png) + +Nano Editor Help Menu + +- Ctrl + O: saves changes made to a file. It will let you save the file with the same name or a different one. Then press Enter to confirm. + +![Nano Editor Save Changes Mode](http://www.tecmint.com/wp-content/uploads/2015/03/Nano-Save-Changes.png) + +Nano Editor Save Changes Mode + +- Ctrl + X: exits the current file. If changes have not been saved, they are discarded. +- Ctrl + R: lets you choose a file to insert its contents into the present file by specifying a full path. + +![Nano: Insert File Content to Parent File](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-File-Content.png) + +Nano: Insert File Content to Parent File + +will insert the contents of /etc/passwd into the current file. + +- Ctrl + K: cuts the current line. +- Ctrl + U: paste. +- Ctrl + C: cancels the current operation and places you at the previous screen. + +To easily navigate the opened file, nano provides the following features: + +- Ctrl + F and Ctrl + B move the cursor forward or backward, whereas Ctrl + P and Ctrl + N move it up or down one line at a time, respectively, just like the arrow keys. +- Ctrl + space and Alt + space move the cursor forward and backward one word at a time. + +Finally, + +- Ctrl + _ (underscore) and then entering X,Y will take you precisely to Line X, column Y, if you want to place the cursor at a specific place in the document. + +![Navigate to Line Numbers in Nano](http://www.tecmint.com/wp-content/uploads/2015/03/Column-Numbers.png) + +Navigate to Line Numbers in Nano + +The example above will take you to line 15, column 14 in the current document. + +If you can recall your early Linux days, specially if you came from Windows, you will probably agree that starting off with nano is the best way to go for a new user. + +### Editing Files with Vim Editor ### + +Vim is an improved version of vi, a famous text editor in Linux that is available on all POSIX-compliant *nix systems, such as RHEL 7. If you have the chance and can install vim, go ahead; if not, most (if not all) the tips given in this article should also work. + +One of vim’s distinguishing features is the different modes in which it operates: + + +- Command mode will allow you to browse through the file and enter commands, which are brief and case-sensitive combinations of one or more letters. If you need to repeat one of them a certain number of times, you can prefix it with a number (there are only a few exceptions to this rule). For example, yy (or Y, short for yank) copies the entire current line, whereas 4yy (or 4Y) copies the entire current line along with the next three lines (4 lines in total). +- In ex mode, you can manipulate files (including saving a current file and running outside programs or commands). To enter ex mode, we must type a colon (:) starting from command mode (or in other words, Esc + :), directly followed by the name of the ex-mode command that you want to use. +- In insert mode, which is accessed by typing the letter i, we simply enter text. Most keystrokes result in text appearing on the screen. +- We can always enter command mode (regardless of the mode we’re working on) by pressing the Esc key. + +Let’s see how we can perform the same operations that we outlined for nano in the previous section, but now with vim. Don’t forget to hit the Enter key to confirm the vim command! + +To access vim’s full manual from the command line, type :help while in command mode and then press Enter: + +![vim Edito Help Menu](http://www.tecmint.com/wp-content/uploads/2015/03/vim-Help-Menu.png) + +vim Edito Help Menu + +The upper section presents an index list of contents, with defined sections dedicated to specific topics about vim. To navigate to a section, place the cursor over it and press Ctrl + ] (closing square bracket). Note that the bottom section displays the current file. + +1. To save changes made to a file, run any of the following commands from command mode and it will do the trick: + + :wq! + :x! + ZZ (yes, double Z without the colon at the beginning) + +2. To exit discarding changes, use :q!. This command will also allow you to exit the help menu described above, and return to the current file in command mode. + +3. Cut N number of lines: type Ndd while in command mode. + +4. Copy M number of lines: type Myy while in command mode. + +5. Paste lines that were previously cutted or copied: press the P key while in command mode. + +6. To insert the contents of another file into the current one: + + :r filename + +For example, to insert the contents of `/etc/fstab`, do: + +![Insert Content of File in vi Editor](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Content-vi-Editor.png) + +Insert Content of File in vi Editor + +7. To insert the output of a command into the current document: + + :r! command + +For example, to insert the date and time in the line below the current position of the cursor: + +![Insert Time an Date in vi Editor](http://www.tecmint.com/wp-content/uploads/2015/03/Insert-Time-and-Date-in-vi-Editor.png) + +Insert Time an Date in vi Editor + +In another article that I wrote for, ([Part 2 of the LFCS series][1]), I explained in greater detail the keyboard shortcuts and functions available in vim. You may want to refer to that tutorial for further examples on how to use this powerful text editor. + +### Analyzing Text with Grep and Regular Expressions ### + +By now you have learned how to create and edit files using nano or vim. Say you become a text editor ninja, so to speak – now what? Among other things, you will also need how to search for regular expressions inside text. + +A regular expression (also known as “regex” or “regexp“) is a way of identifying a text string or pattern so that a program can compare the pattern against arbitrary text strings. Although the use of regular expressions along with grep would deserve an entire article on its own, let us review the basics here: + +**1. The simplest regular expression is an alphanumeric string (i.e., the word “svm”) or two (when two are present, you can use the | (OR) operator):** + + # grep -Ei 'svm|vmx' /proc/cpuinfo + +The presence of either of those two strings indicate that your processor supports virtualization: + +![Regular Expression Example](http://www.tecmint.com/wp-content/uploads/2015/03/Regular-Expression-Example.png) + +Regular Expression Example + +**2. A second kind of a regular expression is a range list, enclosed between square brackets.** + +For example, `c[aeiou]t` matches the strings cat, cet, cit, cot, and cut, whereas `[a-z]` and `[0-9]` match any lowercase letter or decimal digit, respectively. If you want to repeat the regular expression X certain number of times, type `{X}` immediately following the regexp. + +For example, let’s extract the UUIDs of storage devices from `/etc/fstab`: + + # grep -Ei '[0-9a-f]{8}-([0-9a-f]{4}-){3}[0-9a-f]{12}' -o /etc/fstab + +![Extract String from a File in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Extract-String-from-a-File.png) + +Extract String from a File + +The first expression in brackets `[0-9a-f]` is used to denote lowercase hexadecimal characters, and `{8}` is a quantifier that indicates the number of times that the preceding match should be repeated (the first sequence of characters in an UUID is a 8-character long hexadecimal string). + +The parentheses, the `{4}` quantifier, and the hyphen indicate that the next sequence is a 4-character long hexadecimal string, and the quantifier that follows `({3})` denote that the expression should be repeated 3 times. + +Finally, the last sequence of 12-character long hexadecimal string in the UUID is retrieved with `[0-9a-f]{12}`, and the -o option prints only the matched (non-empty) parts of the matching line in /etc/fstab. + +**3. POSIX character classes.** + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Character ClassMatches…
 [[:alnum:]] Any alphanumeric [a-zA-Z0-9] character
 [[:alpha:]] Any alphabetic [a-zA-Z] character
 [[:blank:]] Spaces or tabs
 [[:cntrl:]] Any control characters (ASCII 0 to 32)
 [[:digit:]] Any numeric digits [0-9]
 [[:graph:]] Any visible characters
 [[:lower:]] Any lowercase [a-z] character
 [[:print:]] Any non-control characters
 [[:space:]] Any whitespace
 [[:punct:]] Any punctuation marks
 [[:upper:]] Any uppercase [A-Z] character
 [[:xdigit:]] Any hex digits [0-9a-fA-F]
 [:word:] Any letters, numbers, and underscores [a-zA-Z0-9_]
+ +For example, we may be interested in finding out what the used UIDs and GIDs (refer to [Part 2][2] of this series to refresh your memory) are for real users that have been added to our system. Thus, we will search for sequences of 4 digits in /etc/passwd: + + # grep -Ei [[:digit:]]{4} /etc/passwd + +![Search For a String in File](http://www.tecmint.com/wp-content/uploads/2015/03/Search-For-String-in-File.png) + +Search For a String in File + +The above example may not be the best case of use of regular expressions in the real world, but it clearly illustrates how to use POSIX character classes to analyze text along with grep. + +### Conclusion ### + +In this article we have provided some tips to make the most of nano and vim, two text editors for the command-line users. Both tools are supported by extensive documentation, which you can consult in their respective official web sites (links given below) and using the suggestions given in [Part 1][3] of this series. + +#### Reference Links #### + +- [http://www.nano-editor.org/][4] +- [http://www.vim.org/][5] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-how-to-use-nano-vi-editors/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/vi-editor-usage/ +[2]:http://www.tecmint.com/file-and-directory-management-in-linux/ +[3]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/ +[4]:http://www.nano-editor.org/ +[5]:http://www.vim.org/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md b/sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md new file mode 100644 index 0000000000..2befb7bc55 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 05--Process Management in RHEL 7--Boot Shutdown and Everything in Between.md @@ -0,0 +1,216 @@ +RHCSA Series: Process Management in RHEL 7: Boot, Shutdown, and Everything in Between – Part 5 +================================================================================ +We will start this article with an overall and brief revision of what happens since the moment you press the Power button to turn on your RHEL 7 server until you are presented with the login screen in a command line interface. + +![RHEL 7 Boot Process](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Process.png) + +Linux Boot Process + +**Please note that:** + +1. the same basic principles apply, with perhaps minor modifications, to other Linux distributions as well, and +2. the following description is not intended to represent an exhaustive explanation of the boot process, but only the fundamentals. + +### Linux Boot Process ### + +1. The POST (Power On Self Test) initializes and performs hardware checks. + +2. When the POST finishes, the system control is passed to the first stage boot loader, which is stored on either the boot sector of one of the hard disks (for older systems using BIOS and MBR), or a dedicated (U)EFI partition. + +3. The first stage boot loader then loads the second stage boot loader, most usually GRUB (GRand Unified Boot Loader), which resides inside /boot, which in turn loads the kernel and the initial RAM–based file system (also known as initramfs, which contains programs and binary files that perform the necessary actions needed to ultimately mount the actual root filesystem). + +4. We are presented with a splash screen that allows us to choose an operating system and kernel to boot: + +![RHEL 7 Boot Screen](http://www.tecmint.com/wp-content/uploads/2015/03/RHEL-7-Boot-Screen.png) + +Boot Menu Screen + +5. The kernel sets up the hardware attached to the system and once the root filesystem has been mounted, launches process with PID 1, which in turn will initialize other processes and present us with a login prompt. + +Note: That if we wish to do so at a later time, we can examine the specifics of this process using the [dmesg command][1] and filtering its output using the tools that we have explained in previous articles of this series. + +![Login Screen and Process PID](http://www.tecmint.com/wp-content/uploads/2015/03/Login-Screen-Process-PID.png) + +Login Screen and Process PID + +In the example above, we used the well-known ps command to display a list of current processes whose parent process (or in other words, the process that started them) is systemd (the system and service manager that most modern Linux distributions have switched to) during system startup: + + # ps -o ppid,pid,uname,comm --ppid=1 + +Remember that the -o flag (short for –format) allows you to present the output of ps in a customized format to suit your needs using the keywords specified in the STANDARD FORMAT SPECIFIERS section in man ps. + +Another case in which you will want to define the output of ps instead of going with the default is when you need to find processes that are causing a significant CPU and / or memory load, and sort them accordingly: + + # ps aux --sort=+pcpu # Sort by %CPU (ascending) + # ps aux --sort=-pcpu # Sort by %CPU (descending) + # ps aux --sort=+pmem # Sort by %MEM (ascending) + # ps aux --sort=-pmem # Sort by %MEM (descending) + # ps aux --sort=+pcpu,-pmem # Combine sort by %CPU (ascending) and %MEM (descending) + +![http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png](http://www.tecmint.com/wp-content/uploads/2015/03/ps-command-output.png) + +Customize ps Command Output + +### An Introduction to SystemD ### + +Few decisions in the Linux world have caused more controversies than the adoption of systemd by major Linux distributions. Systemd’s advocates name as its main advantages the following facts: + +Read Also: [The Story Behind ‘init’ and ‘systemd’][2] + +1. Systemd allows more processing to be done in parallel during system startup (as opposed to older SysVinit, which always tends to be slower because it starts processes one by one, checks if one depends on another, and then waits for daemons to launch so more services can start), and + +2. It works as a dynamic resource management in a running system. Thus, services are started when needed (to avoid consuming system resources if they are not being used) instead of being launched without a valid reason during boot. + +3. Backwards compatibility with SysVinit scripts. + +Systemd is controlled by the systemctl utility. If you come from a SysVinit background, chances are you will be familiar with: + +- the service tool, which -in those older systems- was used to manage SysVinit scripts, and +- the chkconfig utility, which served the purpose of updating and querying runlevel information for system services. +- shutdown, which you must have used several times to either restart or halt a running system. + +The following table shows the similarities between the use of these legacy tools and systemctl: + +注:表格 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Legacy toolSystemctl equivalentDescription
service name startsystemctl start nameStart name (where name is a service)
service name stopsystemctl stop nameStop name
service name condrestartsystemctl try-restart nameRestarts name (if it’s already running)
service name restartsystemctl restart nameRestarts name
service name reloadsystemctl reload nameReloads the configuration for name
service name statussystemctl status nameDisplays the current status of name
service –status-allsystemctlDisplays the status of all current services
chkconfig name onsystemctl enable nameEnable name to run on startup as specified in the unit file (the file to which the symlink points). The process of enabling or disabling a service to start automatically on boot consists in adding or removing symbolic links inside the /etc/systemd/system directory.
chkconfig name offsystemctl disable nameDisables name to run on startup as specified in the unit file (the file to which the symlink points)
chkconfig –list namesystemctl is-enabled nameVerify whether name (a specific service) is currently enabled
chkconfig –listsystemctl –type=serviceDisplays all services and tells whether they are enabled or disabled
shutdown -h nowsystemctl poweroffPower-off the machine (halt)
shutdown -r nowsystemctl rebootReboot the system
+ +Systemd also introduced the concepts of units (which can be either a service, a mount point, a device, or a network socket) and targets (which is how systemd manages to start several related process at the same time, and can be considered -though not equal- as the equivalent of runlevels in SysVinit-based systems. + +### Summing Up ### + +Other tasks related with process management include, but may not be limited to, the ability to: + +**1. Adjust the execution priority as far as the use of system resources is concerned of a process:** + +This is accomplished through the renice utility, which alters the scheduling priority of one or more running processes. In simple terms, the scheduling priority is a feature that allows the kernel (present in versions => 2.6) to allocate system resources as per the assigned execution priority (aka niceness, in a range from -20 through 19) of a given process. + +The basic syntax of renice is as follows: + + # renice [-n] priority [-gpu] identifier + +In the generic command above, the first argument is the priority value to be used, whereas the other argument can be interpreted as process IDs (which is the default setting), process group IDs, user IDs, or user names. A normal user (other than root) can only modify the scheduling priority of a process he or she owns, and only increase the niceness level (which means taking up less system resources). + +![Renice Process in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Process-Scheduling-Priority.png) + +Process Scheduling Priority + +**2. Kill (or interrupt the normal execution) of a process as needed:** + +In more precise terms, killing a process entitles sending it a signal to either finish its execution gracefully (SIGTERM=15) or immediately (SIGKILL=9) through the [kill or pkill commands][3]. + +The difference between these two tools is that the former is used to terminate a specific process or a process group altogether, while the latter allows you to do the same based on name and other attributes. + +In addition, pkill comes bundled with pgrep, which shows you the PIDs that will be affected should pkill be used. For example, before running: + + # pkill -u gacanepa + +It may be useful to view at a glance which are the PIDs owned by gacanepa: + + # pgrep -l -u gacanepa + +![Find PIDs of User](http://www.tecmint.com/wp-content/uploads/2015/03/Find-PIDs-of-User.png) + +Find PIDs of User + +By default, both kill and pkill send the SIGTERM signal to the process. As we mentioned above, this signal can be ignored (while the process finishes its execution or for good), so when you seriously need to stop a running process with a valid reason, you will need to specify the SIGKILL signal on the command line: + + # kill -9 identifier # Kill a process or a process group + # kill -s SIGNAL identifier # Idem + # pkill -s SIGNAL identifier # Kill a process by name or other attributes + +### Conclusion ### + +In this article we have explained the basics of the boot process in a RHEL 7 system, and analyzed some of the tools that are available to help you with managing processes using common utilities and systemd-specific commands. + +Note that this list is not intended to cover all the bells and whistles of this topic, so feel free to add your own preferred tools and commands to this article using the comment form below. Questions and other comments are also welcome. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-boot-process-and-process-management/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/dmesg-commands/ +[2]:http://www.tecmint.com/systemd-replaces-init-in-linux/ +[3]:http://www.tecmint.com/how-to-kill-a-process-in-linux/ \ No newline at end of file diff --git a/sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md b/sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md new file mode 100644 index 0000000000..474b707d23 --- /dev/null +++ b/sources/tech/RHCSA Series/RHCSA Series--Part 06--Using 'Parted' and 'SSM' to Configure and Encrypt System Storage.md @@ -0,0 +1,269 @@ +RHCSA Series: Using ‘Parted’ and ‘SSM’ to Configure and Encrypt System Storage – Part 6 +================================================================================ +In this article we will discuss how to set up and configure local system storage in Red Hat Enterprise Linux 7 using classic tools and introducing the System Storage Manager (also known as SSM), which greatly simplifies this task. + +![Configure and Encrypt System Storage](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-and-Encrypt-System-Storage.png) + +RHCSA: Configure and Encrypt System Storage – Part 6 + +Please note that we will present this topic in this article but will continue its description and usage on the next one (Part 7) due to vastness of the subject. + +### Creating and Modifying Partitions in RHEL 7 ### + +In RHEL 7, parted is the default utility to work with partitions, and will allow you to: + +- Display the current partition table +- Manipulate (increase or decrease the size of) existing partitions +- Create partitions using free space or additional physical storage devices + +It is recommended that before attempting the creation of a new partition or the modification of an existing one, you should ensure that none of the partitions on the device are in use (`umount /dev/partition`), and if you’re using part of the device as swap you need to disable it (`swapoff -v /dev/partition`) during the process. + +The easiest way to do this is to boot RHEL in rescue mode using an installation media such as a RHEL 7 installation DVD or USB (Troubleshooting → Rescue a Red Hat Enterprise Linux system) and Select Skip when you’re prompted to choose an option to mount the existing Linux installation, and you will be presented with a command prompt where you can start typing the same commands as shown as follows during the creation of an ordinary partition in a physical device that is not being used. + +![RHEL 7 Rescue Mode](http://www.tecmint.com/wp-content/uploads/2015/04/RHEL-7-Rescue-Mode.png) + +RHEL 7 Rescue Mode + +To start parted, simply type. + + # parted /dev/sdb + +Where `/dev/sdb` is the device where you will create the new partition; next, type print to display the current drive’s partition table: + +![Creat New Partition](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Partition.png) + +Creat New Partition + +As you can see, in this example we are using a virtual drive of 5 GB. We will now proceed to create a 4 GB primary partition and then format it with the xfs filesystem, which is the default in RHEL 7. + +You can choose from a variety of file systems. You will need to manually create the partition with mkpart and then format it with mkfs.fstype as usual because mkpart does not support many modern filesystems out-of-the-box. + +In the following example we will set a label for the device and then create a primary partition `(p)` on `/dev/sdb`, which starts at the 0% percentage of the device and ends at 4000 MB (4 GB): + +![Set Partition Name in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Label-Partition.png) + +Label Partition Name + +Next, we will format the partition as xfs and print the partition table again to verify that changes were applied: + + # mkfs.xfs /dev/sdb1 + # parted /dev/sdb print + +![Format Partition in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Format-Partition-in-Linux.png) + +Format Partition as XFS Filesystem + +For older filesystems, you could use the resize command in parted to resize a partition. Unfortunately, this only applies to ext2, fat16, fat32, hfs, linux-swap, and reiserfs (if libreiserfs is installed). + +Thus, the only way to resize a partition is by deleting it and creating it again (so make sure you have a good backup of your data!). No wonder the default partitioning scheme in RHEL 7 is based on LVM. + +To remove a partition with parted: + + # parted /dev/sdb print + # parted /dev/sdb rm 1 + +![Remove Partition in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Partition-in-Linux.png) + +Remove or Delete Partition + +### The Logical Volume Manager (LVM) ### + +Once a disk has been partitioned, it can be difficult or risky to change the partition sizes. For that reason, if we plan on resizing the partitions on our system, we should consider the possibility of using LVM instead of the classic partitioning system, where several physical devices can form a volume group that will host a defined number of logical volumes, which can be expanded or reduced without any hassle. + +In simple terms, you may find the following diagram useful to remember the basic architecture of LVM. + +![Basic Architecture of LVM](http://www.tecmint.com/wp-content/uploads/2015/04/LVM-Diagram.png) + +Basic Architecture of LVM + +#### Creating Physical Volumes, Volume Group and Logical Volumes #### + +Follow these steps in order to set up LVM using classic volume management tools. Since you can expand this topic reading the [LVM series on this site][1], I will only outline the basic steps to set up LVM, and then compare them to implementing the same functionality with SSM. + +**Note**: That we will use the whole disks `/dev/sdb` and `/dev/sdc` as PVs (Physical Volumes) but it’s entirely up to you if you want to do the same. + +**1. Create partitions `/dev/sdb1` and `/dev/sdc1` using 100% of the available disk space in /dev/sdb and /dev/sdc:** + + # parted /dev/sdb print + # parted /dev/sdc print + +![Create New Partitions](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Partitions.png) + +Create New Partitions + +**2. Create 2 physical volumes on top of /dev/sdb1 and /dev/sdc1, respectively.** + + # pvcreate /dev/sdb1 + # pvcreate /dev/sdc1 + +![Create Two Physical Volumes](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Physical-Volumes.png) + +Create Two Physical Volumes + +Remember that you can use pvdisplay /dev/sd{b,c}1 to show information about the newly created PVs. + +**3. Create a VG on top of the PV that you created in the previous step:** + + # vgcreate tecmint_vg /dev/sd{b,c}1 + +![Create Volume Group in Linux](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Volume-Group.png) + +Create Volume Group + +Remember that you can use vgdisplay tecmint_vg to show information about the newly created VG. + +**4. Create three logical volumes on top of VG tecmint_vg, as follows:** + + # lvcreate -L 3G -n vol01_docs tecmint_vg [vol01_docs → 3 GB] + # lvcreate -L 1G -n vol02_logs tecmint_vg [vol02_logs → 1 GB] + # lvcreate -l 100%FREE -n vol03_homes tecmint_vg [vol03_homes → 6 GB] + +![Create Logical Volumes in LVM](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Logical-Volumes.png) + +Create Logical Volumes + +Remember that you can use lvdisplay tecmint_vg to show information about the newly created LVs on top of VG tecmint_vg. + +**5. Format each of the logical volumes with xfs (do NOT use xfs if you’re planning on shrinking volumes later!):** + + # mkfs.xfs /dev/tecmint_vg/vol01_docs + # mkfs.xfs /dev/tecmint_vg/vol02_logs + # mkfs.xfs /dev/tecmint_vg/vol03_homes + +**6. Finally, mount them:** + + # mount /dev/tecmint_vg/vol01_docs /mnt/docs + # mount /dev/tecmint_vg/vol02_logs /mnt/logs + # mount /dev/tecmint_vg/vol03_homes /mnt/homes + +#### Removing Logical Volumes, Volume Group and Physical Volumes #### + +**7. Now we will reverse the LVM implementation and remove the LVs, the VG, and the PVs:** + + # lvremove /dev/tecmint_vg/vol01_docs + # lvremove /dev/tecmint_vg/vol02_logs + # lvremove /dev/tecmint_vg/vol03_homes + # vgremove /dev/tecmint_vg + # pvremove /dev/sd{b,c}1 + +**8. Now let’s install SSM and we will see how to perform the above in ONLY 1 STEP!** + + # yum update && yum install system-storage-manager + +We will use the same names and sizes as before: + + # ssm create -s 3G -n vol01_docs -p tecmint_vg --fstype ext4 /mnt/docs /dev/sd{b,c}1 + # ssm create -s 1G -n vol02_logs -p tecmint_vg --fstype ext4 /mnt/logs /dev/sd{b,c}1 + # ssm create -n vol03_homes -p tecmint_vg --fstype ext4 /mnt/homes /dev/sd{b,c}1 + +Yes! SSM will let you: + +- initialize block devices as physical volumes +- create a volume group +- create logical volumes +- format LVs, and +- mount them using only one command + +**9. We can now display the information about PVs, VGs, or LVs, respectively, as follows:** + + # ssm list dev + # ssm list pool + # ssm list vol + +![Check Information of PVs, VGs, or LVs](http://www.tecmint.com/wp-content/uploads/2015/04/Display-LVM-Information.png) + +Check Information of PVs, VGs, or LVs + +**10. As we already know, one of the distinguishing features of LVM is the possibility to resize (expand or decrease) logical volumes without downtime.** + +Say we are running out of space in vol02_logs but have plenty of space in vol03_homes. We will resize vol03_homes to 4 GB and expand vol02_logs to use the remaining space: + + # ssm resize -s 4G /dev/tecmint_vg/vol03_homes + +Run ssm list pool again and take note of the free space in tecmint_vg: + +![Check Volume Size](http://www.tecmint.com/wp-content/uploads/2015/04/Check-LVM-Free-Space.png) + +Check Volume Size + +Then do: + + # ssm resize -s+1.99 /dev/tecmint_vg/vol02_logs + +**Note**: that the plus sign after the -s flag indicates that the specified value should be added to the present value. + +**11. Removing logical volumes and volume groups is much easier with ssm as well. A simple,** + + # ssm remove tecmint_vg + +will return a prompt asking you to confirm the deletion of the VG and the LVs it contains: + +![Remove Logical Volume and Volume Group](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-LV-VG.png) + +Remove Logical Volume and Volume Group + +### Managing Encrypted Volumes ### + +SSM also provides system administrators with the capability of managing encryption for new or existing volumes. You will need the cryptsetup package installed first: + + # yum update && yum install cryptsetup + +Then issue the following command to create an encrypted volume. You will be prompted to enter a passphrase to maximize security: + + # ssm create -s 3G -n vol01_docs -p tecmint_vg --fstype ext4 --encrypt luks /mnt/docs /dev/sd{b,c}1 + # ssm create -s 1G -n vol02_logs -p tecmint_vg --fstype ext4 --encrypt luks /mnt/logs /dev/sd{b,c}1 + # ssm create -n vol03_homes -p tecmint_vg --fstype ext4 --encrypt luks /mnt/homes /dev/sd{b,c}1 + +Our next task consists in adding the corresponding entries in /etc/fstab in order for those logical volumes to be available on boot. Rather than using the device identifier (/dev/something). + +We will use each LV’s UUID (so that our devices will still be uniquely identified should we add other logical volumes or devices), which we can find out with the blkid utility: + + # blkid -o value UUID /dev/tecmint_vg/vol01_docs + # blkid -o value UUID /dev/tecmint_vg/vol02_logs + # blkid -o value UUID /dev/tecmint_vg/vol03_homes + +In our case: + +![Find Logical Volume UUID](http://www.tecmint.com/wp-content/uploads/2015/04/Logical-Volume-UUID.png) + +Find Logical Volume UUID + +Next, create the /etc/crypttab file with the following contents (change the UUIDs for the ones that apply to your setup): + + docs UUID=ba77d113-f849-4ddf-8048-13860399fca8 none + logs UUID=58f89c5a-f694-4443-83d6-2e83878e30e4 none + homes UUID=92245af6-3f38-4e07-8dd8-787f4690d7ac none + +And insert the following entries in /etc/fstab. Note that device_name (/dev/mapper/device_name) is the mapper identifier that appears in the first column of /etc/crypttab. + + # Logical volume vol01_docs: + /dev/mapper/docs /mnt/docs ext4 defaults 0 2 + # Logical volume vol02_logs + /dev/mapper/logs /mnt/logs ext4 defaults 0 2 + # Logical volume vol03_homes + /dev/mapper/homes /mnt/homes ext4 defaults 0 2 + +Now reboot (systemctl reboot) and you will be prompted to enter the passphrase for each LV. Afterwards you can confirm that the mount operation was successful by checking the corresponding mount points: + +![Verify Logical Volume Mount Points](http://www.tecmint.com/wp-content/uploads/2015/04/Verify-LV-Mount-Points.png) + +Verify Logical Volume Mount Points + +### Conclusion ### + +In this tutorial we have started to explore how to set up and configure system storage using classic volume management tools and SSM, which also integrates filesystem and encryption capabilities in one package. This makes SSM an invaluable tool for any sysadmin. + +Let us know if you have any questions or comments – feel free to use the form below to get in touch with us! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/rhcsa-exam-create-format-resize-delete-and-encrypt-partitions-in-linux/ + +作者:[Gabriel Cánepa][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/create-lvm-storage-in-linux/ \ No newline at end of file diff --git a/translated/share/20150429 What are good command line HTTP clients.md b/translated/share/20150429 What are good command line HTTP clients.md new file mode 100644 index 0000000000..fa9ef01c54 --- /dev/null +++ b/translated/share/20150429 What are good command line HTTP clients.md @@ -0,0 +1,110 @@ +什么是好的命令行HTTP客户端? +============================================================================== +整体大于各部分之和,这是引自希腊哲学家和科学家的亚里士多德的名言。这句话特别切中Linux。在我看来,Linux最强大的地方之一就是它的协作性。Linux的实用性并不仅仅源自大量的开源程序(命令行)。相反,其协作性来自于这些程序的综合利用,有时是结合更大型的应用。 + +Unix哲学引发了一场“软件工具”的运动,关注开发简洁,基础,干净,模块化和扩展性好的代码,并可以运用于其他的项目。这种哲学为许多的Linux项目留下了一个重要的元素。 + +好的开源开发者写程序为了确保该程序尽可能运行正确,同时能与其他程序很好地协作。目标就是使用者拥有一堆方便的工具,每一个力求干不止一件事。许多程序能独立工作得很好。 + +这篇文章讨论3个开源命令行HTTP客户端。这些客户端可以让你使用命令行从互联网上下载文件。但同时,他们也可以用于许多有意思的地方,如测试,调式和与HTTP服务器或网络应用互动。对于HTTP架构师和API设计人员来说,使用命令行操作HTTP是一个值得花时间学习的技能。如果你需要来回使用API,HTTPie和cURL,这没什么价值。 + +------------- + +![HTTPie](http://www.linuxlinks.com/portal/content2/png/HTTPie.png) + +![HTTPie in action](http://www.linuxlinks.com/portal/content/reviews/Internet/Screenshot-httpie.png) + +HTTPie(发音 aych-tee-tee-pie)是一款开源命令行HTTP客户端。它是一个命令行界面,类cURL的工具。 + +该软件的目标是使得与网络服务器的交互尽可能的人性化。其提供了一个简单的http命令,允许使用简单且自然的语句发送任意的HTTP请求,并显示不同颜色的输出。HTTPie可以用于测试,调式和与HTTP服务器的一般交互。 + +#### 功能包括:#### + +- 可表达,直观的语句 +- 格式化,颜色区分的终端输出 +- 内建JSON支持 +- 表单和文件上传 +- HTTPS,代理和认证 +- 任意数据请求 +- 自定义标题 (此处header不确定是否特别意义) +- 持久会话 +- 类Wget下载 +- Python 2.6,2.7和3.x支持 +- Linux,Mac OS X 和 Windows支持 +- 支持插件 +- 帮助文档 +- 测试覆盖 (直译有点别扭) + +- 网站:[httpie.org][1] +- 开发者: Jakub Roztočil +- 证书: 开源 +- 版本号: 0.9.2 + +---------- + +![cURL](http://www.linuxlinks.com/portal/content2/png/cURL1.png) + +![cURL in action](http://www.linuxlinks.com/portal/content/reviews/Internet/Screenshot-cURL.png) + +cURL是一个开源命令行工具,用于使用URL语句传输数据,支持DICT, FILE, FTP, FTPS, GOPHER, HTTP, HTTPS,IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, TELNET和TFTP。 + +cURL支持SSL证书,HTTP POST,HTTP PUT,FTP上传,HTTP基于表单上传,代理,缓存,用户名+密码认证(Basic, Digest, NTLM, Negotiate, kerberos...),文件传输恢复, 代理通道和一些其他实用窍门的总线负载。(这里的名词我不明白其专业意思) + +#### 功能包括:#### + +- 配置文件支持 +- 一个单独命令行多个URL +- “globbing”漫游支持: [0-13],{one, two, three} +- 一个命令上传多个文件 +- 自定义最大传输速度 +- 重定向标准错误输出 +- Metalink支持 + +- 网站: [curl.haxx.se][2] +- 开发者: Daniel Stenberg +- 证书: MIT/X derivate license +- 版本号: 7.42.0 + +---------- + +![Wget](http://www.linuxlinks.com/portal/content2/png/Wget1.png) + +![Wget in action](http://www.linuxlinks.com/portal/content/reviews/Utilities/Screenshot-Wget.png) + +Wget是一个从网络服务器获取信息的开源软件。其名字源于World Wide Web 和 get。Wget支持HTTP,HTTPS和FTP协议,同时也通过HTTP代理获取信息。 + +Wget可以根据HTML页面的链接,创建远程网络站点的本地版本,是完全重造源站点的目录结构。这种方式被冠名“recursive downloading。” + +Wget已经设计可以加快低速或者不稳定的网络连接。 + +功能包括: + +- 使用REST和RANGE恢复中断的下载 +- 使用文件名 +- 多语言的基于NLS的消息文件 +- 选择性地转换下载文档里地绝对链接为相对链接,使得下载文档可以本地相互链接 +- 在大多数类UNIX操作系统和微软Windows上运行 +- 支持HTTP代理 +- 支持HTTP数据缓存 +- 支持持续地HTTP连接 +- 无人照管/后台操作 +- 当远程对比时,使用本地文件时间戳来决定是否需要重新下载文档 (mirroring没想出合适的表达) + +- 站点: [www.gnu.org/software/wget/][3] +- 开发者: Hrvoje Niksic, Gordon Matzigkeit, Junio Hamano, Dan Harkless, and many others +- 证书: GNU GPL v3 +- 版本号: 1.16.3 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20150425174537249/HTTPclients.html + +作者:Frazer Kline +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://httpie.org/ +[2]:http://curl.haxx.se/ +[3]:https://www.gnu.org/software/wget/ diff --git a/translated/share/20150515 This Ubuntu App Applies Instagram Style Filters to Your Photos.md b/translated/share/20150515 This Ubuntu App Applies Instagram Style Filters to Your Photos.md new file mode 100644 index 0000000000..ae5e6df6eb --- /dev/null +++ b/translated/share/20150515 This Ubuntu App Applies Instagram Style Filters to Your Photos.md @@ -0,0 +1,74 @@ +一个Ubuntu中给你的照片加Instagram风格滤镜的程序 +================================================================================ +**在Ubuntu中寻找一个给你的照片加Instagram风格的滤镜程序么?** + +拿起你的自拍棒跟着这个来。 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/instagram-app.jpg) +XnRetro是一个照片编辑应用 + +### XnRetro 照片编辑器 ### + +**XnRetro** 是一个可以让你快速给你照片添加“类Instagram”效果的程序。 + +你知道我说的这些效果:划痕、噪点、框架、过处理、复古和怀旧色调(因为在这个数字时代,我们必须知道无尽的自拍不能称为怀旧的自己。) + +无论你认为这些效果是愚蠢的艺术价值或者创作的捷径,这些滤镜非常流行切可以帮助那些平平照片添加个性。 + + +#### XnRetro的功能 #### + +**XnRetro有下面那些功能** + +- 20色彩滤镜 +- 15中光效果(虚化、泄露等等) +- 28框架和边框 +- 5中插图 (带力度控制) +- Image adjustments for contrast, gamma, saturation, etc +- 对比度、伽马、饱和度等图像调整 +- 矩形修剪选项 + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/05/Screen-Shot-2015-05-10-at-23.30.01-e1431297068833.png) +灯光效果调整 + +你可以(理论上)编辑。jpg或者.png文件并且直接在app中等想到社交媒体上。 + +我说“理论”上的意思是保存.jpg图像无法正常在linux版的程序上工作(你可以保存.png的图像)。相似的,大多数内置的社交链接失效或者无法导出。 + +要使用**15中光影效果**你需要在XnRetro的‘light’文件夹下重新保存.jpg文件成.png文件。编辑‘light.xml’来匹配新的文件名,点击保存那没灯光效果就可以没有问题的加载进XnRetro了。 + +> ‘用户友好的XnRetro很难打败-一旦你用顺之后。’ + +**XnRetro值得安装么?** + +XnRetro并不是完美的。它看上去很丑、很难正确的安装并且已经纪念没有更新了。 + +它还可以使用,输了保存.jpg文件外。同时也是那些像Gimp或者Shotwell的那些‘正规’图片调整工具的一个灵活替代品。 + +While web apps and Chrome Apps¹ like [Pixlr Touch Up][1] and [Polarr][2] offer similar features you may be looking for a truly native solution. +虽然web应用和Chrome Apps¹像[Pixlr Touch Up][1] 和 [Polarr][2]提供另外相似的功能,而你也许正在寻找真正原生的解决方案。 + +对于此,用户友好带有容易使用滤镜的XnRetro很难被打败。 + +### 下载Ubuntu下的XnRetro ### + +XnRetro没有可用的.deb安装包。它以二进制文件的形式发型,这意味着你需要每次双击程序来运行。它也只有32位的版本。 + +你可以使用下面的XnRetro下载链接。下载完成后你需要解压压缩包并进入。双击里面的‘xnretro’程序。 + +- [下载Linux版XnRetro (32位, tar.gz)][3] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/05/instagram-photo-filters-ubuntu-desktop-app + +作者:[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]:http://www.omgchrome.com/?s=pixlr +[2]:http://www.omgchrome.com/the-best-chrome-apps-of-2014/ +[3]:http://www.xnview.com/en/xnretro/#downloads diff --git a/translated/share/20150527 How to Develop Own Custom Linux Distribution From Scratch.md b/translated/share/20150527 How to Develop Own Custom Linux Distribution From Scratch.md new file mode 100644 index 0000000000..059f07b195 --- /dev/null +++ b/translated/share/20150527 How to Develop Own Custom Linux Distribution From Scratch.md @@ -0,0 +1,65 @@ +δԼLinuxа +================================================================================ +ǷԼLinuxа棿ÿLinuxûʹLinuxĹжһԼķа棬һΡҲ⣬ΪһLinuxҲǹһԼLinuxа档һLinuxа汻Linux From Scratch (LFS) + +ڿʼ֮ǰܽһЩLFSݣ£ + +### 1. ЩҪԼLinuxаӦ˽һLinuxа棨ζŴͷʼһеLinuxаIJͬ ### + +ֻĻʾƵ¼Լӵиõʹ顣ѡκһLinuxа沢ҰϲýиԻá⣬ù߿԰ + +бļboot-loadersںˣѡʲôñȻԼһжôҪLinux From Scratch (LFS) + +**ע**ֻҪLinuxϵͳ飬ָϲʺһLinuxа棬˽ôʼԼһЩϢôָΪд + +### 2. һLinuxа棨LFSĺô ### + +- ˽Linuxϵͳڲ +- һӦϵͳ +- ϵͳLFSdzգΪԸð/ðʲôӵоԵƿ +- ϵͳLFSڰȫϻ + +### 3. һLinuxа棨LFSĻ ### + +һLinuxϵͳζŽҪĶһұ֮Ҫġĺʱ䡣ҪһõLinuxϵͳ㹻Ĵ̿ռLinuxϵͳ + +### 4. ȤǣGentoo/GNU LinuxijӽLFSGentooLFSȫԴĶƵLinuxϵͳ ### + +### 5. ӦһоLinuxûԱ൱˽⣬Ǹshellűרҡ˽һűԣCãʹЩһֻ֣ҪһѧϰߣԺ֪ܿʶҲԿʼҪDzҪLFSжʧ顣 ### + +ᶨ»LFSеһʱ + +### 6. ҪһһָһLinuxLFSǴLinuxĹٷָϡǵĴվtradepubҲΪǵĶLFSָϣͬѵġ ### + +ԴLinux From Scratch鼮 + +[![](http://www.tecmint.com/wp-content/uploads/2015/05/Linux-From-Scratch.gif)][1] + +: [Linux From Scratch][1] + +### ڣLinux From Scratch ### + +ⱾLFSĿͷGerard BeekmansģMatthew BurgessBruse Dubbs༭˶LFSĿ쵼ˡⱾݺܹ㷺338ҳ + +ݰLFS׼LinuxLFSűʹLFS͸¼к֪LFSĿж + +Ȿ黹˱һԤʱ䡣ԤʱԱһʱΪοеĶķʽ֣˵ + +гԣʱ䲢ԹԼLinuxаȤôԲ飨أĻᡣҪģⱾһLinuxϵͳκLinuxа棬㹻Ĵ̿ռ伴ɣпʼԼLinuxϵͳʱ顣 + +LinuxʹԣԼֹһԼLinuxа棬ֽ׶Ӧ֪ȫˣϢԲοӵеݡ + +˽Ķ/ʹⱾľⱾ꾡LFSָϵʹǷ㹻򵥣ѾһLFSǵĶһЩ飬ӭԺͷ + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/create-custom-linux-distribution-from-scratch/ + +ߣ[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://tecmint.tradepub.com/free/w_linu01/prgm.cgi diff --git a/translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md b/translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md new file mode 100644 index 0000000000..14dd88ef70 --- /dev/null +++ b/translated/share/20150603 Arc Is a Gorgeous GTK Theme for Linux Desktops.md @@ -0,0 +1,55 @@ +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 diff --git a/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md b/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md new file mode 100644 index 0000000000..f8d1c56d41 --- /dev/null +++ b/translated/share/20150603 Here's How to Install the Beautiful Arc GTK+ Flat Theme on Linux.md @@ -0,0 +1,61 @@ +如何在Linux中安装漂亮的扁平化Arc GTK+主题 +================================================================================ +> 易于看懂的每步都有的教程 + +**今天我们将向你介绍最新发布的GTK+主题,它拥有透明和扁平元素,并且与多个桌面环境和Linux发行版见荣发。[这个主题叫Arc][1]。** + +开始讲细节之前,我建议你快速地看一下下面的图,这样你有会对这个主题就会有一个基本的概念了。同样你应该意识到它目前可以工作在GTK+ 2.x、GTK+ 3.x、GNOME-Shell、 Budgie、 Unity和Pantheon用户界面,它们都使用了GNOME栈。 + +同样、Arc主题的开发者提醒我们它已经成功地在Ubuntu 15.04(Vivid Vervet)、 Arch Linux、 elementary OS 0.3 Freya、 Fedora 21、 Fedora 22、 Debian GNU/Linux 8.0 (Jessie)、 Debian Testing、 Debian Unstable、 openSUSE 13.2、 openSUSE Tumbleweed和Gentoo测试过了。 + +### 要求和安装指导 ### + +要构建Arc主题,你需要先安装一些包,比如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仓库中取下最新的源码并编译。这样,打开终端并运行下面的命令,一行行地,并在每行的末尾按下回车键并等待上一步完成来继续一步。 + + git clone https://github.com/horst3180/arc-theme --depth 1 && cd arc-theme + git fetch --tags + git checkout $(git describe --tags `git rev-list --tags --max-count=1`) + ./autogen.sh --prefix=/usr + sudo make install + +就是这样!此时你已经在你的GNU/Linux发行版中安装了Arc主题,如果你使用GNOME可以使用GONME Tweak工具或者如果你使用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) + +![](http://i1-news.softpedia-static.com/images/news2/Here-s-How-to-Install-the-Beautiful-Arc-GTK-plus-Flat-Theme-on-Linux-483143-3.jpg) + +![](http://i1-news.softpedia-static.com/images/news2/Here-s-How-to-Install-the-Beautiful-Arc-GTK-plus-Flat-Theme-on-Linux-483143-4.jpg) + +-------------------------------------------------------------------------------- + +via: http://news.softpedia.com/news/Here-s-How-to-Install-the-Beautiful-Arc-GTK-plus-Flat-Theme-on-Linux-483143.shtml + +作者:[Marius Nestor][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/marius-nestor +[1]: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]: diff --git a/translated/talk/20150520 Is Linux Better than OS X GNU Open Source and Apple in History.md b/translated/talk/20150520 Is Linux Better than OS X GNU Open Source and Apple in History.md new file mode 100644 index 0000000000..667a951f39 --- /dev/null +++ b/translated/talk/20150520 Is Linux Better than OS X GNU Open Source and Apple in History.md @@ -0,0 +1,57 @@ +Linux比Mac OS X更好吗?历史中的GNU,开源和Apple +============================================================================== +> 自由软件/开源社区与Apple之间的争论可以回溯到上世纪80年代,当时Linux的创始人称Mac OS X的核心就是"一个废物",还有其他一些软件历史上的轶事。 + +![](http://thevarguy.com/site-files/thevarguy.com/files/imagecache/medium_img/uploads/2015/05/untitled_2.png) + +开源拥护者们与微软之间有着很长,而且摇摆的关系。每个人都知道这个。但是,在许多方面,自由或者开源软件的支持者们与Apple之间的紧张关系则更加突出——尽管这很少受到媒体的关注。 + +需要说明的是,并不是所有的开源拥护者都厌恶苹果。Anecdotally(待译),我已经见过很多Linux的黑客玩弄iPhones和iPads。实际上,许多Linux用户是十分喜欢Apple的OS X系统的,以至于他们[创造了很多Linux的发行版][1],都设计得看起来像OS X。(顺便说下,[北朝鲜政府][2]就这样做了。) + +但是Mac的信徒与企鹅——即Linux社区(未提及自由与开源软件世界的小众群体)的信徒之间的关系,并不一直是完全的和谐。并且这绝不是一个新的现象,在我研究Linux历史和开源基金会的时候就发现了。 + +### GNU vs. Apple ### + +这场战争将回溯到至少上世界80年代后期。1988年6月,Richard Stallman发起了[GNU][3]项目,希望建立一个完全自由的类Unix操作系统,其源代码讲会免费共享,[[强烈指责][4]Apple对[Hewlett-Packard][5](HPQ)和[Microsoft][6](MSFT)的诉讼,称Apple的声明中,说别人对Macintosh操作系统的界面和体验的抄袭是不正确。如果Apple流行,GNU警告到,这家公司“将会借助大众的新力量终结掉自由软件,而自由软件可以成为商业软件的替代品。” + +那个时候,GNU对抗Apple的诉讼(这意味着,十分讽刺的是,GNU正在支持Microsoft,尽管当时的情况不一样),通过发布["让你的律师远离我的电脑”按钮][7]。同时呼吁GNU的支持者们抵制Apple,警告如果Macintoshes看起来是不错的计算机,但Apple一旦赢得了诉讼就会给市场带来垄断,这会极大地提高计算机的售价。 + +Apple最终[输掉了诉讼][8],但是直到1994年之后,GNU才[撤销对Apple的抵制][9]。这期间,GNU一直不断指责Apple。在上世纪90年代早期甚至之后,GNU开始发展GNU软件项目,可以在其他个人电脑平台包括MS-DOS上使用。[GNU 宣称][10],除非Apple停止在计算机领域垄断的野心,让用户界面可以模仿Macintosh的一些东西,否则“我们不会提供任何对Apple机器的支持。”(因此讽刺的是一大堆软件都开发了OS X和类Unix系统的版本,于是Apple在90年代后期介绍这些软件来自GNU。但是那是另外的故事了。) + +### Trovalds on Jobs ### + +除去他对大多数发行版比较自由放任的态度,Liuns Trovalds,Linux内核的创造者,相较于Stallman和GNU过去对Apple的态度没有多一点仁慈。在他2001年出版的书"Just For Fun: The Story of an Accidental Revolutionary"中,Trovalds描述到与Steve Jobs的一个会面,大约是1997年收到后者的邀请去讨论Mac OS X,Apple正在开发,但还没有公开发布。 + +"基本上,Jobs一开始就试图告诉我在桌面上的玩家就两个,Microsoft和Apple,而且他认为我能为Linux做的最好的事,就是从了Apple,努力让开源用户站到Mac OS X后面去"Trovalds写道。 + +这次谈判显然让Trovalds很不爽。争吵的一点集中在Trovalds对Mach技术上的藐视,对于Apple正在用于构建新的OS X操作系统的内核,Trovalds称其“一推废物。它包含了所有你能做到的设计错误,并且甚至打算只弥补一小部分。” + +但是更令人不快的是,显然是Jobs在开发OS X时入侵开源的方式(OS X的核心里上有很多开源程序):“他有点贬低了结构的瑕疵:谁在乎基础操作系统,真正的low-core东西是不是开源,如果你有Mac层在最上面,这不是开源?” + +一切的一切,Trovalds总结到,Jobs“并没有使用太多争论。他仅仅很简单地说着,胸有成竹地认为我会对与Apple合作感兴趣”。“他没有任何线索,不能去想像还会有人并不关心Mac市场份额的增长。我认为他真的感到惊讶了,当我表现出对Mac的市场有多大,或者Microsoft市场有多大的可怜的关心时。” + +当然,Trovalds并没有对所有Linux用户说起。他对于OS X和Apple的看法从2001年开始就渐渐软化了。但实际上,早在2000年,Linux社区的领导角色表现出对Apple和其高层的傲慢的深深的鄙视,可以看出一些重要的东西,关于Apple和开源/自由软件世界的矛盾是多么的根深蒂固。 + +从以上两则历史上的花边新闻中,可以看到关于Apple产品价值的重大争议,即是否该公司致力于提升软硬件的质量,或者仅仅是借市场的小聪明获利,后者会让Apple产品卖出更多的钱,**********(该处不知如何翻译)。但是不管怎样,我会暂时置身讨论之外。 + +-------------------------------------------------------------------------------- + +via: http://thevarguy.com/open-source-application-software-companies/051815/linux-better-os-x-gnu-open-source-and-apple- + +作者:[Christopher Tozzi][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://thevarguy.com/author/christopher-tozzi +[1]:https://www.linux.com/news/software/applications/773516-the-mac-ifying-of-the-linux-desktop/ +[2]:http://thevarguy.com/open-source-application-software-companies/010615/north-koreas-red-star-linux-os-made-apples-image +[3]:http://gnu.org/ +[4]:https://www.gnu.org/bulletins/bull5.html +[5]:http://www.hp.com/ +[6]:http://www.microsoft.com/ +[7]:http://www.duntemann.com/AppleSnakeButton.jpg +[8]:http://www.freibrun.com/articles/articl12.htm +[9]:https://www.gnu.org/bulletins/bull18.html#SEC6 +[10]:https://www.gnu.org/bulletins/bull12.html diff --git a/translated/talk/The history of Android/13 - The history of Android.md b/translated/talk/The history of Android/13 - The history of Android.md new file mode 100644 index 0000000000..8929f55064 --- /dev/null +++ b/translated/talk/The history of Android/13 - The history of Android.md @@ -0,0 +1,104 @@ +安卓编年史 +================================================================================ +![](http://cdn.arstechnica.net/wp-content/uploads/2014/03/ready-fight.png) + +### Android 2.1, update 1——无尽战争的开端 ### + +谷歌是第一代iPhone的主要合作伙伴——公司为苹果的移动操作系统提供了谷歌地图,搜索,以及Youtube。在那时,谷歌CEO埃里克·施密特是苹果的董事会成员之一。实际上,在最初的苹果发布会上,施密特是在史蒂夫·乔布斯[之后第一个登台的人][1],他还开玩笑说两家公司如此接近,都可以合并成“AppleGoo”了。 + +当谷歌开发安卓的时候,两家公司间的关系慢慢变得充满争吵。然而,谷歌很大程度上还是通过拒iPhone关键特性于安卓门外,如双指缩放,来取悦苹果。尽管如此,Nexus One是第一部不带键盘的直板安卓旗舰机,设备被赋予了和iPhone相同的外观因素。Nexus One结合了新软件和谷歌的品牌,这是压倒苹果的最后一根稻草。根据沃尔特·艾萨克森为史蒂夫·乔布斯写的传记,2010年1月在看到了Nexus One之后,这个苹果的CEO震怒了,说道:“如果需要的话我会用尽最后一口气,以及花光苹果在银行里的400亿美元,来纠正这个错误……我要摧毁安卓,因为它完全是偷窃来的产品。我愿意为此进行核战争。” + +所有的这些都在秘密地发生,仅在Nexus One发布后的几年后才公诸于众。公众们最早在安卓2.1——推送给Nexus One的一个称作“[2.1 update 1][2]”的更新,发布后一个月左右捕捉到谷歌和苹果间愈演愈烈的分歧气息。这个更新添加了一个功能,正是iOS一直居于安卓之上的功能:双指缩放。 + +尽管安卓从2.0版本开始就支持多点触控API了,默认的系统应用在乔布斯的命令下依然和这项实用的功能划清界限。在关于Nexus One的和解会议谈崩了之后,谷歌再也没有理由拒双指缩放于安卓门外了。谷歌给设备推送了更新,安卓终于补上了不足之处。 + +随着谷歌地图,浏览器以及相册中双指缩放的全面启用,谷歌和苹果的智能手机战争也就此拉开序幕。在接下来的几年中,两家公司会变成死敌。双指缩放更新的一个月后,苹果开始了他的征途,起诉了所有使用安卓的公司。HTC,摩托罗拉以及三星都被告上法庭,直到现在都还有一些诉讼还没解决。施密特辞去了苹果董事会的职务。谷歌地图和Youtube被从iPhone中移除,苹果甚至开始打造自己的地图服务。今天,这两位选手几乎是“AppleGoo”竞赛的唯一选手,涉及领域十分广:智能手机,平板,笔记本,电影,TV秀,音乐,书籍,应用,邮件,生产力工具,浏览器,个人助理,云存储,移动广告,即时通讯,地图以及机顶盒……以及不久他们将会在汽车智能,穿戴设备,移动支付,以及客厅娱乐等进行竞争。 + +### Android 2.2 Froyo——更快更华丽 ### + +[安卓2.2][3]在2010年5月,也就是2.1发布后的四个月后亮相。Froyo(冻酸奶)的亮点主要是底层优化,只为更快的速度。Froyo最大的改变是增加了JIT编译。JIT自动在运行时将java字节码转换为原生码,这会给系统全面带来显著的性能改善。 + +浏览器同样得到了性能改善,这要感谢来自Chrome的V8 Javascript引擎的整合。这是安卓浏览器从Chrome借鉴的许多特性中的第一个,最终系统内置的浏览器会被移动版Chrome彻底替代掉。在那之前,安卓团队还是需要发布一个浏览器。从Chrome借鉴特性是条升级的捷径。 + +在谷歌专注于让它的平台更快的同时,苹果正在让它的平台更全面。谷歌的竞争对手在一个月前发布了10英寸的iPad,先行进入了平板时代。尽管有些搭载Froyo和Gingerbread的安卓平板发布,谷歌的官方回应——安卓3.0 Honeycomb(蜂巢)以及摩托罗拉Xoom——在9个月后才来到。 + +![Froyo底部添加了双图标停靠栏以及全局搜索。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/22-2.png) +Froyo底部添加了双图标停靠栏以及全局搜索。 +Ron Amadeo供图 + +Froyo主屏幕最大的变化是底部的新停靠栏,电话和浏览器图标填充了先前抽屉按钮左右的空白空间。这些新图标都是现有图标的定制白色版本,并且用户没办法自己设置图标。 + +默认布局移除了所有图标,屏幕上只留下一个使用提示小部件,引导你点击启动器图标以访问你的应用。谷歌搜索小部件得到了一个谷歌logo,同时也是个按钮。点击它可以打开一个搜索界面,你可以限制搜索范围在互联网,应用或是联系人之内。 + +![下载页面有了“更新所有”按钮,Flash应用,一个flash驱动的一切皆有可能的网站,以及“移动到SD”按钮。 ](http://cdn.arstechnica.net/wp-content/uploads/2014/03/small-market-2.jpg) +下载页面有了“更新所有”按钮,Flash应用,一个flash驱动的一切皆有可能的网站,以及“移动到SD”按钮。 +[Ryan Paul][4]供图 + +还有一些优秀的新功能加入了Froyo,安卓市场加入了更多的下载控制。有个新的“更新所有”按钮固定在了下载页面底部。谷歌还添加了自动更新特性,只要应用权限没有改变就能够自动安装应用;尽管如此,自动更新默认是关闭的。 + +第二张图展示了Adobe Flash播放器,它是Froyo独占的。这个应用作为插件加入了浏览器,让浏览器能够有“完整的网络”体验。在2010年,这意味着网页充满了Flash导航和视频。Flash是安卓相比于iPhone最大的不同之一。史蒂夫·乔布斯展开了一场对抗Flash的圣战,声称它是一个被淘汰的,充满bug的软件,并且苹果不会在iOS上允许它的存在。所以安卓接纳了Flash并且让它在安卓上运行,给予用户在安卓上拥有半可用的flash实现。 + +在那时,Flash甚至能够让桌面电脑崩溃,所以在移动设备上一直保持打开状态会带来可怕的体验。为了解决这个问题,安卓浏览器上的Flash可以设置为“按需打开”——除非用户点击Flash占位图标,否则不会加载Flash内容。对Flash的支持将会持续到安卓4.1,Adobe在那时放弃并且结束了这个项目。Flash归根到底从未在安卓上完美运行过。而Flash在iPhone这个最流行的移动设备上的缺失,推动了互联网最终放弃了这个平台。 + +最后一张图片显示的是新增的移动应用到SD卡功能,在那个手机只有512MB内置存储的时代,这个功能十分的必要的。 + +![驾驶模式应用。相机现在可以旋转了。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/22carcam-2.png) +驾驶模式应用。相机现在可以旋转了。 +Ron Amadeo供图 + +相机应用终于更新支持纵向模式了。相机设置被从抽屉中移出,变成一条半透明的按钮带,放在了快门按钮和其他控制键旁边。这个新设计看起来从Cooliris相册中获得了许多灵感,有着半透明,有弹性的聊天气泡弹出窗口。看到更现代的Cooliris风格UI设计被嫁接到皮革装饰的相机应用确实十分奇怪——从审美上来说一点都不搭。 + +![半残缺的Facebook应用是个常见的2x3导航页面的优秀范例。谷歌Goggles被包含了进来但同样是残缺的。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/facebook.png) +半残缺的Facebook应用是个常见的2x3导航页面的优秀范例。谷歌Goggles被包含了进来但同样是残缺的。 +Ron Amadeo供图 + +不像在安卓2.0和2.1中包含的Facebook客户端,2.2版本的仍然部分能够工作并且登陆Facebook服务器。Facebook应用是个谷歌那时候设计指南的优秀范例,它建议应用拥有一个含有3x2图标方阵的导航页并作为应用主页。 + +这是谷歌的第一个标准化尝试,将导航元素从菜单按钮里移到屏幕上,因为用户找不到它们。这个设计很实用,但它在打开应用和使用应用之间增加了额外的障碍。谷歌不久后湖意识到当用户打开一个应用,显示应用内容而不是中间导航页是个更好的主意。以Facebook为例,打开应用直接打开信息订阅会更合适。并且不久后应用设计将会把导航降级到二层位置——先是作为顶部的标签之一,后来谷歌放在了“导航抽屉”,一个含有应用所有功能位置的滑出式面板。 + +还有个预装到Froyo的是谷歌Goggles,一个视觉搜索应用,它会尝试辨别图片上的主体。它在辨别艺术品,地标以及条形码时很实用,但差不多也就这些了。最先的两个设置屏幕,以及相机界面,这是应用里唯一现在还能运行的了。由于客户端太旧了,实际上你如今并不能完成一个搜索。应用里也没什么太多可看的,也就一个会返回搜索结果页的相机界面而已。 + +![Twitter应用,一个充满动画的谷歌和Twitter的合作成果。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/twitters-2.png) +Twitter应用,一个充满动画的谷歌和Twitter的合作成果。 +Ron Amadeo供图 + +Froyo拥有第一个安卓Twitter应用,实际上它是谷歌和Twitter的合作成果。那时,一个Twitter应用是安卓应用阵容里的大缺憾。开发者们更偏爱iPhone,加上苹果占领先机和严格的设计要求,App Store里可选择的应用远比安卓的有优势。但是谷歌需要一个Twitter应用,所以它和Twitter合作组建团队让第一个版本问世。 + +这个应用代表了谷歌的新设计语言,这以为着它有个中间导航页以及对动画要求的“技术演示”。Twitter应用甚至比Cooliris相册用的动画效果还多——所有东西一直都在动。所有页面顶部和底部的云朵以不同速度持续滚动,底部的Twitter小鸟拍动它的翅膀并且左右移动它的头。 + +Twitter应用实际上有点Action Bar早期前身的特性,一条顶部对齐的连续控制条在安卓3.0中被引入。沿着所有屏幕的顶部有条拥有Twitter标志和像搜索,刷新和新tweet这样的按钮的蓝色横栏。它和后来的Action Bar之间大的区别在于Twitter/谷歌这里的设计的右上角缺少“上一级”按钮,实际上它在应用里用了完整的第二个栏位显示你当前所在位置。在上面的第二张图里,你可以看到整条带有“Tweets”标签的专用于显示位置的栏(当然,还有持续滚动的云朵)。第二个栏的Twitter标志扮演着另一个导航元素,有时候在当前部分显示额外的下拉区域,有时候显示整个顶级快捷方式集合。 + +2.3Tweet流看起来和今天的并没有什么不同,除了隐藏的操作按钮(回复,转推等),都在右对齐的箭头按钮里。它们弹出来是一个聊天气泡菜单,看起来就像导航弹窗。仿action bar在新tweet页面有重要作用。它安置着twitter标志,剩余字数统计,以及添加照片,拍照,以及提到联系人按钮。 + +Twitter应用甚至还有一对主屏幕小部件,大号的那个占据8格,给你新建栏,更新按钮,一条tweet,以及左右箭头来查看更多tweet。小号的显示一条tweet以及回复按钮。点击大号小部件的新建栏立即打开了“新Tweet”主窗口,这让“更新”按钮变得没有价值。 + +![Google Talk和新USB对话框。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/talkusb.png) +Google Talk和新USB对话框。 +Ron Amadeo供图 + +其他部分,Google Talk(以及没有截图的短信应用)从暗色主题变成了浅色主题,这让它们看起来和现在的更接近现在的,更现代的应用。USB存储界面会在你设备接入电脑的时候从一个简单的对话框进入全屏界面。这个界面现在有个一个异形安卓机器人/USB闪存盘混合体,而不是之前的纯文字设计。 + +尽管安卓2.2在用户互动方式上没有什么新特性,但大的UI调整会在下两个版本到来。然而在所有的UI工作之前,谷歌希望先改进安卓的核心部分。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/13/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.youtube.com/watch?v=9hUIxyE2Ns8#t=3016 +[2]:http://arstechnica.com/gadgets/2010/02/googles-nexus-one-gets-multitouch/ +[3]:http://arstechnica.com/information-technology/2010/07/android-22-froyo/ +[4]:http://arstechnica.com/information-technology/2010/07/android-22-froyo/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/talk/The history of Android/14 - The history of Android.md b/translated/talk/The history of Android/14 - The history of Android.md new file mode 100644 index 0000000000..ce808f63da --- /dev/null +++ b/translated/talk/The history of Android/14 - The history of Android.md @@ -0,0 +1,82 @@ +安卓编年史 +================================================================================ +### 语音操作——口袋里的超级电脑 ### + +2010年8月,作为语音搜索应用的一项新功能,“[语音命令][1]”登陆了安卓市场。语音命令允许用户向他们的手机发出语音命令,然后安卓会试着去理解他们并完成任务。像“导航至[地址]”这样的命令会打开谷歌地图并且开始逐向导航至你所陈述的目的地。你还可以仅仅通过语音来发送短信或电子邮件,拨打电话,打开网站,获取方向,或是在地图上查看一个地点。 + +注:youtube视频地址 + + +语音命令是谷歌新应用设计哲学的顶峰。语音命令是那时候最先进的语音控制软件,秘密在于谷歌并不在设备上做任运算。一般来说,语音识别是对CPU的密集任务要求。实际上,许多语音识别程序仍然有“速度与准确性”设置,用户可以选择他们愿意为语音识别算法运行等待的时间——更多的CPU处理意味着更加准确。 + +谷歌的创新在于没有劳烦手机上能力有限的处理器来进行语音识别运算。当说出一个命令时,用户的声音会被打包并通过互联网发送到谷歌云服务器。在那里,谷歌超算中心的超级计算机分析并解释语音,然后发送回手机。这是很长的一段旅程,但互联网最终还是有足够快的速度在一两秒内完成像这样的任务。 + +很多人抛出词语“云计算”来表达“所有东西都被存储在服务器上”,但这才是真正的云计算。谷歌在云端进行这些巨量的运算操作,又因为在这个问题上投入了看似荒唐的CPU资源数目,所以语音识别准确性的唯一限制就是算法本身了。软件不需要由每个用户独立“训练”,因为所有使用语音操作的人无时不刻都在训练它。借助互联网的力量,安卓在你的口袋里放了一部超级电脑,同时相比于已有的解决方案,把语音识别这个工作量从口袋大小的电脑转移到房间大小的电脑上大大提高了准确性。 + +语音识别作为谷歌的项目已经有一段时间了,它的出现都是因为一个800号码。[1-800-GOOG-411][2]是个谷歌从2007年4月起开通的免费电话信息服务。它就像411信息服务一样工作了多年——用户可以拨打这个号码询问电话号码——但是谷歌免费提供这项服务。查询过程中没有人工的干预,411服务由语音识别和文本语音转换引擎驱动。语音命令就是人们教谷歌如何去听之后三年才有实现的可能。 + +语音识别是谷歌长远思考的极佳范例——公司并不怕在一个可能成不了商业产品的项目上投资多年。今天,语音识别驱动的产品遍布谷歌。它被用在谷歌搜索应用的输入,安卓的语音输入,以及Google.com。同时它还是Google Glass和[Android Wear][3]的默认输入界面。 + +谷歌甚至还在输入之外的地方使用语音识别。谷歌的语音识别技术被用在了转述Youtube视频上,它能自动生成字幕供听障用户观看。生成的字幕甚至被谷歌做成了索引,所以你可以搜索某句话在视频的哪里说过。语音是许多产品的未来,并且这项长期计划将谷歌带入了屈指可数的拥有自家语音识别服务的公司行列。大部分其它的语音识别产品,像苹果的Siri和三星设备,被迫使用——并且为其支付了授权费——Nuance的语音识别。 + +在计算机听觉系统设立运行之后,谷歌下一步将把这项策略应用到计算机视觉上。这就是为什么像Google Goggles,Google图像搜索和[Project Tango][4]这样的项目存在的原因。就像GOOG-411的那段日子,这些项目还处在早期阶段。当[谷歌的机器人部门][5]造出了机器人,它会需要看和听,谷歌的计算机视觉和听觉项目会给谷歌一个先机。 + +![Nexus S,第一部三星制造的Nexus手机。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/NS500.png) +Nexus S,第一部三星制造的Nexus手机。 + +### Android 2.3 Gingerbread——第一次UI大变 ### + +Gingerbread(姜饼人)发布于2010年12月,这已是2.2发布整整七个月之后了。尽管如此,等待是值得的,因为安卓2.3整个系统的每个界面几乎都改变了。这是从安卓0.9最初的样式以来第一次重大的更新。2.3开始了一系列持续的改进,试着将安卓从丑陋的小鸭子变成能承载它自己的合适的样子——从美学角度——来对抗iPhone。 + +说到苹果,六个月前,它发布了iPhone 4和iOS 4,新增了多任务处理和Facetime视频聊天。微软同样也终于重返这场游戏。微软在2010年11月发布了Windows Phone 7,也进入了智能手机时代。 + +安卓2.3在界面设计上投入了很多精力,但是由于缺乏方向或设计文档,许多应用仅仅止步于获得了一个新的定制主题而已。一些应用用了更扁平的暗色主题,一些用了充满渐变,活泼的暗色主题,其他应用则是高对比度的白色和绿色组合。尽管2.3并没有做到风格统一,Gingerbread还是完成了让系统几乎每个部分变得更现代化的任务。这同样是件好事,因为下一个手机版安卓要在将近一年后才到来。 + +Gingerbread的首发设备是Nexus S,谷歌的第二部旗舰设备,并且是第一部由三星生产的Nexus设备。尽管今天我们已经习惯了每年都有更新型号的CPU,那时候可不是这个样子。Nexus S有个1GHz Cortex A8处理器,和Nexus One是一样的。GPU从速度来说略微有所变快。Nexus S稍微比Nexus One大一点,拥有800×480分辨率的AMOLED显示屏。 + +从参数上来说,Nexus S看起来只是个平淡无奇的升级,但他确实开了安卓的许多先河。Nexus S是谷歌第一部没有MicroSD卡槽的旗舰,板载16GB存储。Nexus One只有512MB存储空间,但它有MicroSD卡槽。移除SD卡槽为用户简化了存储管理——现在只有一个存储地点了——但是影响了高级用户的扩展能力。它是谷歌第一部带有NFC的手机,手机背面的一个特殊芯片能够在和其他NFC芯片接触时传输数据。Nexus S暂时只能读取NFC标签,而不能发送数据。 + +托Gingerbread中一些升级的福,Nexus S是第一部不带有硬件十字方向键或轨迹球安卓手机之一。Nexus S缩减到只有电源,音量以及四个导航键。Nexus S同时还是如今[疯狂的曲面手机][6]的先驱,因为三星给Nexus S配备了一块略微有些弯曲的玻璃。 + +![Gingerbread更改了状态栏和壁纸,并且添加了许多新图标。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/appdrawershop.png) +Gingerbread更改了状态栏和壁纸,并且添加了许多新图标。 +Ron Amadeo供图 + +升级过的“Nexus”动态壁纸作为Nexus S的独占发布。这个壁纸基本上和Nexus One的一样,带有带动画轨迹的光点。在Nexus S上,去除了方阵设计,取而代之的是波浪形的蓝/灰色背景。底部dock有了直角和彩色图标。 + +![新通知面板和菜单。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png) +新通知面板和菜单。 +Ron Amadeo供图 + +状态栏自0.9的首次登场以来终于得到了重制。状态栏从白色渐变变成纯黑,所有图标重绘成了灰色和绿色。所有东西看起来都更加清爽和现代,这要感谢锐角图标设计和高分辨率。最奇怪的决定可能是从状态栏时钟移除了时间段显示以及信号强度那令人疑惑的灰色。尽管灰色被用在状态栏的许多图标上,而且上面截图有四格灰色信号,安卓实际上指示的是没有信号。绿色格表示信号强度,灰色格指示的是“空”信号格。 + +Gingerbread的状态栏图标同时还作为网络连接的状态指示。如果你的设备连接到了谷歌的服务器,图标会变绿,如果没有谷歌的连接,图标会是白色的。这让你可以在外出时轻松了解你的网络连接状态。 + +通知面板的设计从安卓1.5的设计改进而来。我们看到UI部分再次从浅色主题变为暗色主题,有个深灰色顶部,黑色背景以及在灰色底色上的黑色文本。 + +菜单颜色同样变深了,背景从白色变成了带点透明的黑色。菜单图标和背景的对比并没有它应该有的那么强烈,因为灰色图标的颜色和它们在白色背景上的时候是一样的。要求改变颜色意味着每个开发者都得制作新的图标,所以谷歌在黑色背景上使用了先前就有的灰色。这是系统级别的改变,所以这个新菜单会出现在每个应用中。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/14/ + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://arstechnica.com/gadgets/2010/08/google-beefs-up-voice-search-mobile-sync/ +[2]:http://arstechnica.com/business/2007/04/google-rolls-out-free-411-service/ +[3]:http://arstechnica.com/gadgets/2014/03/in-depth-with-android-wear-googles-quantum-leap-of-a-smartwatch-os/ +[4]:http://arstechnica.com/gadgets/2014/02/googles-project-tango-is-a-smartphone-with-kinect-style-computer-vision/ +[5]:http://arstechnica.com/gadgets/2013/12/google-robots-former-android-chief-will-lead-google-robotics-division/ +[6]:http://arstechnica.com/gadgets/2013/12/lg-g-flex-review-form-over-even-basic-function/ +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/tech/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md b/translated/tech/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md deleted file mode 100644 index 17da6a9508..0000000000 --- a/translated/tech/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md +++ /dev/null @@ -1,105 +0,0 @@ -dupeGuru - 直接从硬盘中查找并移除重复文件 -================================================================================ - -### 简介 ### - -对我们来说,磁盘被装满是一个较大的困扰。无论我们如何小心谨慎,我们总可能将相同的文件复制到多个不同的地方,或者在不知情的情况下,重复下载了同一个文件。因此,迟早你会看到“磁盘已满”的错误提示,若此时我们确实需要一些磁盘空间来存储重要数据,以上情形无疑是最糟糕的。假如你确信自己的系统中有重复文件,那么 **dupeGuru** 可能会帮助到你。 - -dupeGuru 团队也开发了名为 **dupeGuru 音乐版** 的应用来移除重复的音乐文件,和名为 **dupeGuru 图片版** 的应用来移除重复的图片文件。 - -### 1. dupeGuru (标准版) ### - -对于那些不熟悉 [dupeGuru][1] 的人来说,它是一个免费,开源,跨平台的应用,其用途是在系统中查找和移除重复文件。它可以在 Linux, Windows, 和 Mac OS X 等平台下使用。通过使用一个快速的模糊匹配算法,它可以在几分钟内找到重复文件。同时,你还可以调整 dupeGuru 使它去精确查找特定文件类型的重复文件,以及从你想删除的文件中,消除特定的某些文件。它支持英语、 法语、 德语、 中文 (简体)、 捷克语、 意大利语、亚美尼亚语、 俄语、乌克兰语、巴西语和越南语。 - -#### 在 Ubuntu 14.10/14.04/13.10/13.04/12.04 中安装 dupeGuru #### - -dupeGuru 开发者已经构建了一个 Ubuntu PPA (Personal Package Archives)来简化安装过程。为了安装 dupeGuru,依次在终端中键入以下命令: - -``` -sudo apt-add-repository ppa:hsoft/ppa -sudo apt-get update -sudo apt-get install dupeguru-se -``` - -### 使用 ### - -使用非常简单,可从 Unity 面板或菜单中启动 dupeGuru 。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru_007.png) - -点击位于底部的 `+` 按钮来添加你想扫描的文件目录。点击 `扫描` 按钮开始查找重复文件。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru_008.png) - -一旦所选目录中含有重复文件,则它将在窗口中展示重复文件。正如你所看到的,在下面的截图中,我的下载目录中有一个重复文件。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru-Results_009.png) - -现在,你可以决定下一步如何操作。你可以删除这个重复的文件,或者对它进行重命名,抑或是 复制/移动 这个文件到另一个位置。为此,选定该重复文件,或 在菜单栏中选定写有“**仅显示重复**”选项 ,如果你选择了“**仅显示重复**”选项,则只有重复文件在窗口中可见,这样你便可以轻易地选择并删除这些文件。点击“操作”下拉菜单,最后选择你将执行的操作。在这里,我只想删除重复文件,所以我选择了“移动标记文件到垃圾箱”这个选项。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/Menu_010.png) - -接着,点击“继续”选项来移除重复文件。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/Deletion-Options_011.png) - -### 2. dupeGuru 音乐版 ### - -[dupeGuru 音乐版][2] 或 简称 dupeGuru ME ,它的功能与 dupeGuru 类似。它拥有 dupeGuru 的所有功能,但它包含更多的信息列 (如比特率,持续时间,标签等)和更多的扫描类型(如带有字段的文件名,标签以及音频内容)。同 dupeGuru 一样, dupeGuru ME 也运行在 Linux, Windows, 和 Mac OS X 中。 - -它支持众多的格式,诸如 MP3, WMA, AAC (iTunes 格式), OGG, FLAC, 即失真率较少的 AAC 和 WMA 格式等。 - -#### 在 Ubuntu 14.10/14.04/13.10/13.04/12.04 中安装 dupeGuru ME #### - -现在,我们不必再添加任何 PPA,因为在前面的步骤中,我们已经进行了添加。所以在终端中键入以下命令来安装它: - -``` -sudo apt-get install dupeguru-me -``` - -### 使用 ### - -你可以从 Unity 面板或菜单中启动它。dupeGuru ME 的使用方法,操作界面和外观与正常的 dupeGuru 类似。添加你想扫描的目录并选择你想执行的操作。重复的音乐文件就会被删除。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru-Music-Edition-Results_012.png) - -### 3. dupeGuru 图片版 ### - -[dupeGuru 图片版][3],或简称为 duepGuru PE,是一个在你的电脑中查找重复图片的工具。它与 dupeGuru 类似,但独具匹配重复图片的功能。dupeGuru PE 可运行在 Linux, Windows, 和 Mac OS X 中。 - -dupeGuru PE 支持 JPG, PNG, TIFF, GIF 和 BMP 等图片格式。所有的这些格式可以被同时比较。Mac OS X 版的 dupeGuru PE 还支持 PSD 和 RAW (CR2 和 NEF) 格式。 - -#### 在 Ubuntu 14.10/14.04/13.10/13.04/12.04 中安装 dupeGuru PE #### - -由于我们已经添加了 PPA, 我们也不必为 dupeGuru PE 添加 PPA。只需运行如下命令来安装它。 - -``` -sudo apt-get install dupeguru-pe -``` - -#### 使用 #### - -就使用方法,操作界面和外观而言,它与 dupeGuru ,dupeGuru ME 类似。我就纳闷为什么开发者为不同的类别开发了不同的版本。我想如果开发一个结合以上三个版本功能的应用,或许会更好。 - -启动它,添加你想扫描的目录,并选择你想执行的操作。就这样,你的重复文件将消失。 - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru-Picture-Edition-Results_014.png) - -如若因为任何的安全问题而不能移除某些重复文件,请记下这些文件的位置,通过终端或文件管理器来手动删除它们。 - -欢呼吧! - --------------------------------------------------------------------------------- - -via: http://www.unixmen.com/dupeguru-find-remove-duplicate-files-instantly-hard-drive/ - -作者:[SK][a] -译者:[FSSlc](https://github.com/FSSlc) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.unixmen.com/author/sk/ -[1]:http://www.hardcoded.net/dupeguru/ -[2]:http://www.hardcoded.net/dupeguru_me/ -[3]:http://www.hardcoded.net/dupeguru_pe/ diff --git a/translated/tech/20141211 How to use matplotlib for scientific plotting on Linux.md b/translated/tech/20141211 How to use matplotlib for scientific plotting on Linux.md deleted file mode 100644 index 29c03c4c91..0000000000 --- a/translated/tech/20141211 How to use matplotlib for scientific plotting on Linux.md +++ /dev/null @@ -1,158 +0,0 @@ -+在Linux中使用matplotlib进行科学画图 -+================================================================================ -+ -+如果你想要在Linxu中获得一个高效、自动化、高质量的科学画图的解决方案,那就要考虑一下使用matplotlib库了。Matplotlib是基于python的开源科学测绘包,版权基于python软件基金许可证。大量的文档和例子,整合在Python和Numpy科学计处包中,其自动化性能是少数几个为什么这个包是在Linux环境中进行科学画图的可靠选择。这个教程将提供几个用matplotlib画图的例子。 -+ -+###特性### -+- -+-众多的画图类型,如:bar,box,contour,histogram,scatter,line plots.... -+-基于python的语法 -+-集成Numpy科学计算包 -+-可定制的画图格式(axes scales,tick positions, tick labels...) -+-可定制文本(字体,大小,位置...) -+-TeX 格式化(等式,符号,希腊字体...) -+-与IPython相兼容 -+-自动化 -用Python 的循环迭代生成图片 -+-保存所绘图片格式为图片文件,如:png,pdf,ps,eps,svg等 -+ -+ -+基于Python语法的matplotlib通过许多自身特性和高效工作流基础进行表现。 -+世面上有许多用于绘制高质量图的科学绘图包,但是这些包允许你直接在你的Python代码中去使用吗? -+除那以外,这些包允许你创建可以保存为图片文件的图片吗? -+Matplotlib允许你完成所有的这些任务。 -+你可以期望着节省你的时间,从于使用你能够花更多的时间在如何创建更多的图片。 -+ -+###安装### -+ 安装Python和Numpy包是使用Matplotlib的前提,安装Numpy的指引请见该链接。[here][1]. -+ -+ -+可以通过如下命令在Debian或Ubuntu中安装Matplotlib: -+ -+ $ sudo apt-get install python-matplotlib -+ -+ -+在Fedora或CentOS/RHEL环境则可用如下命令: -+ $ sudo yum install python-matplotlib -+ -+ -+###Matplotlib 例子### -+ -+该教程会提供几个绘图例子演示如何使用matplotlib: -+-离散和线性画图 -+-柱状图画图 -+-饼状图 -+ -+在这些例子中我们将用Python脚本来执行Mapplotlib命令。注意numpy和matplotlib模块需要通过import命令在脚本中进行导入。 -+在命令空间中,np指定为nuupy模块的引用,plt指定为matplotlib.pyplot的引用: -+ import numpy as np -+ import matplotlib.pyplot as plt -+ -+ -+###例1:离散和线性图### -+ -+第一个脚本,script1.py 完成如下任务: -+ -+-创建3个数据集(xData,yData1和yData2) -+-创建一个宽8英寸、高6英寸的图(赋值1) -+-设置图画的标题、x轴标签、y轴标签(字号均为14) -+-绘制第一个数据集:yData1为xData数据集的函数,用圆点标识的离散蓝线,标识为"y1 data" -+-绘制第二个数据集:yData2为xData数据集的函数,采用红实线,标识为"y2 data" -+-把图例放置在图的左上角 -+-保存图片为PNG格式文件 -+ -+script1.py的内容如下: -+ import numpy as np -+ import matplotlib.pyplot as plt -+ -+ xData = np.arange(0, 10, 1) -+ yData1 = xData.__pow__(2.0) -+ yData2 = np.arange(15, 61, 5) -+ plt.figure(num=1, figsize=(8, 6)) -+ plt.title('Plot 1', size=14) -+ plt.xlabel('x-axis', size=14) -+ plt.ylabel('y-axis', size=14) -+ plt.plot(xData, yData1, color='b', linestyle='--', marker='o', label='y1 data') -+ plt.plot(xData, yData2, color='r', linestyle='-', label='y2 data') -+ plt.legend(loc='upper left') -+ plt.savefig('images/plot1.png', format='png') -+ -+ -+所画之图如下: -+![](https://farm8.staticflickr.com/7529/15927002365_f5ae11cf02_z.jpg) -+ -+ -+###例2:柱状图### -+ -+第二个脚本,script2.py 完成如下任务: -+ -+-创建一个包含1000个随机样本的正态分布数据集。 -+-创建一个宽8英寸、高6英寸的图(赋值1) -+-设置图的标题、x轴标签、y轴标签(字号均为14) -+-用samples这个数据集画一个40个柱状,边从-10到10的柱状图 -+-添加文本,用TeX格式显示希腊字母mu和sigma(字号为16) -+-保存图片为PNG格式。 -+ -+script2.py代码如下: -+ import numpy as np -+ import matplotlib.pyplot as plt -+ -+ mu = 0.0 -+ sigma = 2.0 -+ samples = np.random.normal(loc=mu, scale=sigma, size=1000) -+ plt.figure(num=1, figsize=(8, 6)) -+ plt.title('Plot 2', size=14) -+ plt.xlabel('value', size=14) -+ plt.ylabel('counts', size=14) -+ plt.hist(samples, bins=40, range=(-10, 10)) -+ plt.text(-9, 100, r'$\mu$ = 0.0, $\sigma$ = 2.0', size=16) -+ plt.savefig('images/plot2.png', format='png') -+ -+ -+结果见如下链接: -+![](https://farm8.staticflickr.com/7531/15304765024_1cc271b6e0_z.jpg) -+ -+ -+###例3:饼状图### -+ -+第三个脚本,script3.py 完成如下任务: -+ -+-创建一个包含5个整数的列表 -+-创建一个宽6英寸、高6英寸的图(赋值1) -+-添加一个长宽比为1的轴图 -+-设置图的标题(字号为14) -+-用data列表画一个包含标签的饼状图 -+-保存图为PNG格式 -+ -+脚本script3.py的代码如下: -+ import numpy as np -+ import matplotlib.pyplot as plt -+ -+ data = [33, 25, 20, 12, 10] -+ plt.figure(num=1, figsize=(6, 6)) -+ plt.axes(aspect=1) -+ plt.title('Plot 3', size=14) -+ plt.pie(data, labels=('Group 1', 'Group 2', 'Group 3', 'Group 4', 'Group 5')) -+ plt.savefig('images/plot3.png', format='png') -+ -+ -+结果如下链接所示: -+![](https://farm8.staticflickr.com/7504/15926356092_7c3e5217aa_z.jpg) -+ -+ -+###总结### -+ 这个教程提供了几个用matplotlib科学画图包进行画图的例子,Matplotlib是在Linux环境中用于解决科学画图的绝佳方案,表现在其无缝地和Python、Numpy连接,自动化能力,和提供多种自定义的高质量的画图产品。[here][2]. -+ -+matplotlib包的文档和例子详见: -+-------------------------------------------------------------------------------- -+ -+via: http://xmodulo.com/matplotlib-scientific-plotting-linux.html -+ -+作者:[Joshua Reed][a] -+译者:[ideas4u](https://github.com/ideas4u) -+校对:[校对者ID](https://github.com/校对者ID) -+ -+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 -+ -+[a]:http://xmodulo.com/author/joshua -+[1]:http://xmodulo.com/numpy-scientific-computing-linux.html -+[2]:http://matplotlib.org/ diff --git a/translated/tech/20150104 How to debug a C or C++ program with Nemiver debugger.md b/translated/tech/20150104 How to debug a C or C++ program with Nemiver debugger.md deleted file mode 100644 index b5dc4c34a7..0000000000 --- a/translated/tech/20150104 How to debug a C or C++ program with Nemiver debugger.md +++ /dev/null @@ -1,126 +0,0 @@ -使用Nemiver调试器找出C/C++程序中的bug -================================================================================ - -如果你读过[my post on GDB][1],你就会明白我认为一个调试器对一段C/C++程序来说意味着多么的重要和有用。然而,如果一个像GDB的命令行对你而言听起来更像一个问题而不是一个解决方案,那么你也许会对Nemiver更感兴趣。[Nemiver][2] 是一款基于GTK+的独立图形化用于C/C++程序的调试器,同时它以GDB作为其后端。最令人佩服的是其速度和稳定性,Nemiver时一个非常可靠,具备许多优点的调试工具。 - -### Nemiver的安装 ### - -基于Debian发行版,它的安装时非常直接简单如下: - - $ sudo apt-get install nemiver - -在Arch Linux中安装如下: - - $ sudo pacman -S nemiver - -在Fedora中安装如下: - - $ sudo yum install nemiver - -如果你选择自己变异,[GNOME website][3]中最新源码包可用。 - -最令人欣慰的是,它能够很好地与GNOME环境像结合。 - -### Nemiver的基本用法 ### - -启动Nemiver的命令: - - $ nemiver - -你也可以通过执行一下命令来启动: - - $ nemiver [path to executable to debug] - -你会注意到如果在调试模式下执行编译(-g标志表示GCC)将会更有帮助。 - -还有一个优点是Nemiver的快速加载,所以你应该可以马上看到主屏幕的默认布局。 - - - - - -![](https://farm9.staticflickr.com/8679/15535277554_d320f6692c_c.jpg) - -默认情况下,断点通常位于主函数的第一行。这样就可以空出时间让你去认识调试器的基本功能: - -![](https://farm9.staticflickr.com/8669/16131832596_bc68ae18a8_o.jpg) - -- Next line (mapped to F6) -- Step inside a function (F7) -- Step out of a function (Shift+F7) -- 下一行 (映射到F6) -- 执行内部行数(F7) -- 执行外部函数(Shift+F7) ## 我不确定这个保留哪个都翻译出来了 ## - -但是由于我个人的喜好是“Run to cursor(运行至光标)”,该选项使你的程序运行精确至你光标下的行,并且默认映射到F11. - -下一步,断点通常是容易使用的。最快捷的方式是使用F8设置一个断点在相应的行。但是Nemiver也有一个更富在的菜单在“Debug”项,这允许你在一个特定的函数,行数,二进制位置文件的位置,或者类似一个异常,分支或者exec的事件。 - -![](https://farm8.staticflickr.com/7579/16157622315_d680a63896_z.jpg) - - -你也可以通过追踪来查看一个变量。在“Debug”选项,你可以通过命名来匹配一个表达式来检查。然后也可以通过将其添加到列表中以方便访问。这可能是最有用的一个功能虽然我从未因为浓厚的兴趣将鼠标悬停在一个变量来获取它的值。值得注意的是,将鼠标放置在相应位置时不生效的。如果想要让它更好地工作,Nemiver是可以看到结构并给所有成员的变量赋值。 - -![](https://farm8.staticflickr.com/7465/15970310470_7ed020c613.jpg) - - -谈到方便地访问信息,我也非常欣赏这个程序的平面布局。默认情况下,代码在上个部分,标签在下半部分。这授予你访问中断输出、文本追踪、断点列表、注册地址、内存映射和变量控制。但是注意到在“Edit”“Preferences”“Layout”下你可以选择不同的布局,包括动态修改。 - -![](https://farm9.staticflickr.com/8606/15971551549_00e4cdd32e_c.jpg) - -![](https://farm8.staticflickr.com/7525/15535277594_026fef17c1_z.jpg) - - -自然而然,一旦你设置了所有短点,观察点和布局,您可以在“File”下很方便地保存以免你不小心关掉Nemiver。 - - -### Nemiver的高级用法 ### - - -到目前为止,我们讨论的都是Nemiver的基本特征,例如,你马上开始喝调试一个简单的程序需要什么。如果你有更高的药求,特别是对于一些更佳复杂的程序,你应该会对接下来提到的这些特征更感兴趣。 - - -#### 调试一个正在运行的进程 #### - - -Nemiver允许你连接到一个正在运行的进程进行调试。在“File”菜单,你可以过滤出正在运行的进程,并连接到这个进程。 - -![](https://farm9.staticflickr.com/8593/16155720571_00e4cdd32e_z.jpg) - - -#### 通过TCP连接远程调试一个程序 #### - -Nemiver支持远程调试,当你在一台远程机器设置一个轻量级调试服务器,你可以通过调试服务器启动Nemiver从另一台机器去调试承载远程服务器上的目标。如果出于某些原因,你不能在远程机器上吗很好地驾驭Nemiver或者GDB,那么远程调试对于你来说将非常有用。在“File”菜单下,指定二进制文件、共享库的地址和端口。 - -![](https://farm8.staticflickr.com/7469/16131832746_c47dee4ef1.jpg) - -#### 使用你的GDB二进制进行调试 #### - -如果你想自行通过Nemiver进行编译,你可以在“Edit(编辑)”“Preferences(首选项)”“Debug(调试)”下给GDB制定一个新的位置。如果你想在Nemiver使用GDB的定制版本,那么这个选项对你来说是非常实用的。 - - -#### 循序一个子进程或者父进程 #### - -Nemiver是可以兼容一个子进程或者附近成的。想激活这个功能,请到“Debugger”下面的“Preferences(首选项)”。 - -![](https://farm8.staticflickr.com/7512/16131832716_5724ff434c_z.jpg) - -总而言之,Nemiver大概是我最喜欢的没有IDE的调试程序。在我看来,它甚至可以击败GDB,并且[命令行][4]程序对我本身来说更接地气。所以,如果你从未使用过的话,我会强烈推荐你使用。我只能庆祝我们团队背后给了我这么一个可靠、稳定的程序。 - -你对Nemiver有什么见解?你是否也考虑它作为独立的调试工具?或者仍然坚持使用IDE?让我们在评论中探讨吧。 - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/debug-program-nemiver-debugger.html - -作者:[Adrien Brochard][a] -译者:[disylee](https://github.com/disylee) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://xmodulo.com/author/adrien -[1]:http://xmodulo.com/gdb-command-line-debugger.html -[2]:https://wiki.gnome.org/Apps/Nemiver -[3]:https://download.gnome.org/sources/nemiver/0.9/ -[4]:http://xmodulo.com/recommend/linuxclibook diff --git a/translated/tech/20150105 How To Install Kodi 14 (XBMC) In Ubuntu 14.04 and Linux Mint 17.md b/translated/tech/20150105 How To Install Kodi 14 (XBMC) In Ubuntu 14.04 and Linux Mint 17.md deleted file mode 100644 index 20b6715d38..0000000000 --- a/translated/tech/20150105 How To Install Kodi 14 (XBMC) In Ubuntu 14.04 and Linux Mint 17.md +++ /dev/null @@ -1,51 +0,0 @@ -Ubuntu14.04或Mint17如何安装Kodi14(XBMC) -================================================================================ -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Kodi_Xmas.jpg) - -[Kodi][1],原名就是大名鼎鼎的XBMC,发布[最新版本14][2],命名为Helix。感谢官方XMBC提供的PPA,现在可以很简单地在Ubuntu14.04中安装了。 - -Kodi是一个优秀的自由和开源的(GPL)媒体中心软件,支持所有平台,如Windows, Linux, Mac, Android等。此软件拥有全屏幕的媒体中心,可以管理所有音乐和视频,不单支持本地文件还支持网络播放,如Tube,[Netflix][3], Hulu, Amazon Prime和其他串流服务商。 - -### Ubuntu 14.04, 14.10 和 Linux Mint 17 中安装XBMC 14 Kodi Helix ### - -再次感谢官方的PPA,让我们可以轻松安装Kodi 14。 -支持Ubuntu 14.04, Ubuntu 12.04, Linux Mint 17, Pinguy OS 14.04, Deepin 2014, LXLE 14.04, Linux Lite 2.0, Elementary OS and 其他基于Ubuntu的Linux 发行版。 -打开终端(Ctrl+Alt+T)然后使用下列命令。 - - sudo add-apt-repository ppa:team-xbmc/ppa - sudo apt-get update - sudo apt-get install kodi - -需要下载大约100MB,在我的观点这不是很大。若需安装解码插件,使用下列命令: - - sudo apt-get install kodi-audioencoder-* kodi-pvr-* - -#### 从Ubuntu中移除Kodi 14 #### - -从系统中移除Kodi 14 ,使用下列命令: - - sudo apt-get remove kodi - -同样也应该移除PPA软件源: - - sudo add-apt-repository --remove ppa:team-xbmc/ppa - -我希望这个简单的文章可以帮助到你,在Ubuntu, Linux Mint 和其他 Linux版本中轻松安装Kodi 14。 -你怎么发现Kodi 14 Helix? -你有没有使用其他的什么媒体中心? -可以在下面的评论区分享你的观点。 - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/install-kodi-14-xbmc-in-ubuntu-14-04-linux-mint-17/ - -作者:[Abhishek][a] -译者:[Vic020/VicYu](http://www.vicyu.net) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/Abhishek/ -[1]:http://kodi.tv/ -[2]:http://kodi.tv/kodi-14-0-helix-unwinds/ -[3]:http://itsfoss.com/watch-netflix-in-ubuntu-14-04/ diff --git a/translated/tech/20150105 How To Install Winusb In Ubuntu 14.04.md b/translated/tech/20150105 How To Install Winusb In Ubuntu 14.04.md deleted file mode 100644 index b9fe775752..0000000000 --- a/translated/tech/20150105 How To Install Winusb In Ubuntu 14.04.md +++ /dev/null @@ -1,47 +0,0 @@ -如何在Ubuntu 14.04 中安装Winusb -================================================================================ -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/WinUSB_Ubuntu_1404.jpeg) - -[WinUSB][1]是一款简单的且有用的工具,可以让你从Windows ISO镜像或者DVD中创建USB安装盘。它结合了GUI和命令行,你可以根据你的喜好决定使用哪种。 - -在本篇中我们会展示**如何在Ubuntu 14.04、14.10 和 Linux Mint 17 中安装WinUSB**。 - -### 在Ubuntu 14.04、14.10 和 Linux Mint 17 中安装WinUSB ### - -直到Ubuntu 13.10, WinUSBu一直都在积极开发,且在官方PPA中可以找到。这个PPA还没有为Ubuntu 14.04 和14.10更新,但是二进制文件仍旧可在更新版本的Ubuntu和Linux Mint中运行。基于[基于你使用的系统是32位还是64位的][2],使用下面的命令来下载二进制文件: - -打开终端,并在32位的系统下使用下面的命令: - - wget https://launchpad.net/~colingille/+archive/freshlight/+files/winusb_1.0.11+saucy1_i386.deb - -对于64位的系统,使用下面的命令: - - wget https://launchpad.net/~colingille/+archive/freshlight/+files/winusb_1.0.11+saucy1_amd64.deb - -一旦你下载了正确的二进制包,你可以用下面的命令安装WinUSB: - - sudo dpkg -i winusb* - -不要担心在你安装WinUSB时看见错误。使用这条命令修复依赖: - - sudo apt-get -f install - -之后,你就可以在Unity Dash中查找WinUSB并且用它在Ubuntu 14.04 中创建Windows的live USB了。 - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/WinUSB_Ubuntu.png) - -我希望这篇文章能够帮到你**在Ubuntu 14.04、14.10 和 Linux Mint 17 中安装WinUSB**。 - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/install-winusb-in-ubuntu-14-04/ - -作者:[Abhishek][a] -译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://itsfoss.com/author/Abhishek/ -[1]:http://en.congelli.eu/prog_info_winusb.html -[2]:http://itsfoss.com/how-to-know-ubuntu-unity-version/ \ No newline at end of file diff --git a/translated/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md b/translated/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md new file mode 100644 index 0000000000..1f645595b7 --- /dev/null +++ b/translated/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md @@ -0,0 +1,271 @@ +在Apache中使用Mod_Security和Mod_evasive来抵御暴力破解和DDos攻击 +================================================================================ +对于那些托管主机或者需要将您的主机暴露在因特网中的人来说,保证您的系统在面对攻击时安全是一个重要的事情。 + +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 + +在这篇文章中我们将讨论如何安装、配置以及在RHEL/CentOS6、7和Fedora 21-15上将它们整合到Apache。另外,我们会模拟攻击以便验证服务器做出了正确的反应。 + +以上以您的系统中安装有LAMP服务器为基础,所以,如果您没有安装,请先阅读下面链接的文章再开始阅读本文。 + +- [在RHEL/CentOS 7中安装LAMP][1] + +如果您在运行RHEL/CentOS 7或Fedora 21,您还需要安装iptables作为默认[防火墙][2]前端以取代firewalld。这样做是为了在RHEL/CentOS 7或Fedora 21中使用同样的工具。 + +### 步骤 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 ### + +另外,在安装LAMP后,您还需要在RHEL/CentOS 7/6中[开启EPEL仓库][3]来安装这两个包。Fedora用户不需要开启这个仓库,因为epel已经是Fedora项目的一部分了。 + + # yum update && yum install mod_security mod_evasive + +当安装结束后,您会在/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的顶层部分,它们分别为: + + 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的内容来验证(如果需要的话,修改它): + + # 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: + + # service httpd restart [在RHEL/CentOS 6和Fedora 20-18上] + # systemctl restart httpd [在RHEL/CentOS 7和Fedora 21上] + +---------- + + [输出已加载的静态模块和动态模块列表] + + # 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 ### + +简单来说,一个核心规则集(即CRS)为web服务器提供特定状况下如何反应的指令。mod_security的开发者们提供了一个免费的CRS,叫做OWASP([开放Web应用安全项目])ModSecurity CRS,可以从下面的地址下载和安装。 + +1. 下载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文件并修改文件夹名称 + + # 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扩展的文件。 + + # cp modsecurity_crs_10_setup.conf.example modsecurity_crs_10_setup.conf + +并通过将下面的几行插入到web服务器的主配置文件/etc/httpd/conf/httpd.conf来告诉Apache将这个文件和该模块放在一起使用。如果您选择解压打包文件到另一个文件夹,那么您需要修改Include的路径: + + + Include crs-tecmint/owasp-modsecurity-crs/modsecurity_crs_10_setup.conf + Include crs-tecmint/owasp-modsecurity-crs/base_rules/*.conf + + +最后,建议您在/etc/httpd/modsecurity.d目录下创建自己的配置文件,在那里我们可以用我们自定义的文件夹(接下来的示例中,我们会将其命名为tecmint.conf)而无需修改CRS文件的目录。这样做能够在CRSs发布新版本时更加容易的升级。 + + + SecRuleEngine On + SecRequestBodyAccess On + SecResponseBodyAccess On + SecResponseBodyMimeType text/plain text/html text/xml application/octet-stream + SecDataDir /tmp + + +您可以在[SpiderLabs的ModSecurity GitHub][5]仓库中参考关于mod_security目录的更完整的解释。 + +### 步骤 4: 配置Mod_Evasive ### + +mod_evasive被配置为使用/etc/httpd/conf.d/mod_evasive.conf中的指令。与mod_security不同,由于在包升级时没有规则来更新,因此我们不需要独立的文件来添加自定义指令。 + +默认的mod_evasive.conf开启了下列的目录(注意这个文件被详细的注释了,因此我们剔掉了注释以重点显示配置指令): + + + DOSHashTableSize 3097 + DOSPageCount 2 + DOSSiteCount 50 + DOSPageInterval 1 + DOSSiteInterval 1 + DOSBlockingPeriod 10 + + +这些指令的解释: + +- DOSHashTableSize: 这个指令指明了哈希表的大小,它用来追踪基于IP地址的活动。增加这个数字将使查询站点访问历史变得更快,但如果被设置的太高则会影响整体性能。 +- DOSPageCount: 在DOSPageInterval间隔内可由一个用户发起的面向特定的URI(例如,一个Apache托管的文件)的同一个请求的数量。 +- DOSSiteCount: 类似DOSPageCount,但涉及到整个站点总共有多少的请求可以在DOSSiteInterval间隔内被发起。 +- DOSBlockingPeriod: 如果一个用户超过了DOSSPageCount的限制或者DOSSiteCount,他的源IP地址将会在DOSBlockingPeriod期间内被加入黑名单。在DOSBlockingPeriod期间,任何从这个IP地址发起的请求将会遭遇一个403禁止错误。 + +尽可能的试验这些值,以使您的web服务器有能力处理特定大小的负载。 + +**一个小警告**: 如果这些值设置的不合适,则您会蒙受阻挡合法用户的风险。 + +您也许想考虑下其他有用的指令: + +#### DOSEmailNotify #### + +如果您运行有一个邮件服务器,您可以通过Apache发送警告消息。注意,如果SELinux已开启,您需要授权apache用户SELinux的权限来发送email。您可以通过下面的命令来授予权限: + + # setsebool -P httpd_can_sendmail 1 + +接下来,将这个指令和其他指令一起加入到mod_evasive.conf文件。 + + DOSEmailNotify you@yourdomain.com + +如果这个值被合适的设置并且您的邮件服务器在正常的运行,则当一个IP地址被加入黑名单时,会有一封邮件被发送到相应的地址。 + +#### DOSSystemCommand #### + +它需要一个有效的系统命令作为参数, + + DOSSystemCommand
+ +这个指令指定当一个IP地址被加入黑名单时执行的命令。它通常结合shell脚本来使用,在脚本中添加一条防火墙规则来阻挡某个IP进一步的连接。 + +**写一个shell脚本在防火墙阶段处理IP黑名单** + +当一个IP地址被加入黑名单,我们需要阻挡它进一步的连接。我们需要下面的shell脚本来执行这个任务。在/usr/local/bin下创建一个叫做scripts-tecmint的文件夹(或其他的名字),以及一个叫做ban_ip.sh的文件。 + + #!/bin/sh + # 由mod_evasive检测出,将被阻挡的IP地址 + IP=$1 + # iptables的完整路径 + IPTABLES="/sbin/iptables" + # mod_evasive锁文件夹 + MOD_EVASIVE_LOGDIR=/var/log/mod_evasive + # 添加下面的防火墙规则 (阻止所有从$IP流入的流量) + $IPTABLES -I INPUT -s $IP -j DROP + # 为了未来的检测,移除锁文件 + rm -f "$MOD_EVASIVE_LOGDIR"/dos-"$IP" + +我们的DOSSystemCommand指令应该是这样的: + + DOSSystemCommand "sudo /usr/local/bin/scripts-tecmint/ban_ip.sh %s" + +上面一行的%s代表了由mod_evasive检测到的攻击IP地址。 + +**将apache用户添加到sudoers文件** + +请注意,如果您不给予apache用户以无需终端和密码的方式运行我们脚本(关键就是这个脚本)的权限,则这一切都不起作用。通常,您只需要以root权限键入visudo来存取/etc/sudoers文件,接下来添加下面的两行即可: + + apache ALL=NOPASSWD: /usr/local/bin/scripts-tecmint/ban_ip.sh + Defaults:apache !requiretty + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Add-Apache-User-to-Sudoers.png) +添加Apache用户到Sudoers + +**重要**: 作为默认的安全策略,您只能在终端中运行sudo。由于这个时候我们需要在没有tty的时候运行sudo,我们像下面图片中那样必须注释掉下面这一行: + + #Defaults requiretty + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Disable-tty-for-Sudo.png) +为Sudo禁用tty + +最后,重启web服务器: + + # service httpd restart [在RHEL/CentOS 6和Fedora 20-18上] + # systemctl restart httpd [在RHEL/CentOS 7和Fedora 21上] + +### 步骤4: 在Apache上模拟DDos攻击 ### + +有许多工具可以在您的服务器上模拟外部的攻击。您可以google下“tools for simulating ddos attacks”来找一找相关的工具。 + +注意,您(也只有您)将负责您模拟所造成的结果。请不要考虑向不在您网络中的服务器发起模拟攻击。 + +假如您想对一个由别人托管的VPS做这些事情,您需要向您的托管商发送适当的警告或就那样的流量通过他们的网络获得允许。Tecmint.com不会为您的行为负责! + +另外,仅从一个主机发起一个Dos攻击的模拟无法代表真实的攻击。为了模拟真实的攻击,您需要使用许多客户端在同一时间将您的服务器作为目标。 + +我们的测试环境由一个CentOS 7服务器[IP 192.168.0.17]和一个Windows组成,在Windows[IP 192.168.0.103]上我们发起攻击: + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Confirm-Host-IPAddress.png) +确认主机IP地址 + +请播放下面的视频,并跟从列出的步骤来模拟一个Dos攻击: + +注:youtube视频,发布的时候不行做个链接吧 + + +然后攻击者的IP将被iptables阻挡: + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Blocked-Attacker-IP.png) +阻挡攻击者的IP地址 + +### 结论 ### + +在开启mod_security和mod_evasive的情况下,模拟攻击会导致CPU和RAM用量在源IP地址被加入黑名单之前出现短暂几秒的使用峰值。如果没有这些模块,模拟攻击绝对会很快将服务器击溃,并使服务器在攻击期间无法提供服务。 + +我们很高兴听见您打算使用(或已经使用过)这些工具。我们期望得到您的反馈,所以,请在留言处留下您的评价和问题,谢谢! + +### 参考链接 ### + +- [https://www.modsecurity.org/][6] +- [http://www.zdziarski.com/blog/?page_id=442][7] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/ + +作者:[Gabriel Cánepa][a] +译者:[wwy-hust](https://github.com/wwy-hust) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/ +[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/ +[7]:http://www.zdziarski.com/blog/?page_id=442 \ No newline at end of file diff --git a/translated/tech/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md b/translated/tech/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md new file mode 100644 index 0000000000..0f7bc3d62f --- /dev/null +++ b/translated/tech/20150504 How to Install and Configure 'PowerDNS' (with MariaDB) and 'PowerAdmin' in RHEL or CentOS 7.md @@ -0,0 +1,422 @@ +RHEL/CentOS 7中安装并配置‘PowerDNS’(与MariaDB搭配)和‘PowerAdmin’ +================================================================================ +PowerDNS是一个运行在许多Linux/Unix衍生版上的DNS服务器,它可以使用不同的后端进行配置,包括BIND类型的区域文件、相关的数据库,或者负载均衡/失效转移算法。它也可以被配置成一台DNS递归器,作为服务器上的一个独立进程运行。 + +PowerDNS授权服务器的最新版本是3.4.4,但是当前EPEL仓库中可以获得的版本是3.4.3。我推荐安装EPEL仓库中提供的那一个,因为该版本已经在CentOS和Fedora中测试过。那样,你也可以在今后很容易地更新PowerDNS。 + +本文倾向于向你演示如何安装并配置以MariaDB作为后端的PowerDNS和 +出于本文的写作目的,我将使用以下服务器: + + 主机名: centos7.localhost + IP地址: 192.168.0.102 + +### 步骤 1: 安装带有MariaDB后端的PowerDNS ### + +#### 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服务器。运行以下命令即可达成: #### + + # 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,并设置开机启动: #### + + # 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设置密码进行安全加固,运行以下命令: #### + + # mysql_secure_installation + +#### 按照指示做 #### + + /bin/mysql_secure_installation: line 379: find_mysql_client: command not found + + NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB + SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! + + In order to log into MariaDB to secure it, we'll need the current + password for the root user. If you've just installed MariaDB, and + you haven't set the root password yet, the password will be blank, + so you should just press enter here. + + Enter current password for root (enter for none): Press ENTER + OK, successfully used password, moving on... + + Setting the root password ensures that nobody can log into the MariaDB + root user without the proper authorisation. + + Set root password? [Y/n] y + New password: ← Set New Password + Re-enter new password: ← Repeat Above Password + Password updated successfully! + Reloading privilege tables.. + ... Success! + + + By default, a MariaDB installation has an anonymous user, allowing anyone + to log into MariaDB without having to have a user account created for + them. This is intended only for testing, and to make the installation + go a bit smoother. You should remove them before moving into a + production environment. + + Remove anonymous users? [Y/n] y ← Choose “y” to disable that user + ... Success! + + Normally, root should only be allowed to connect from 'localhost'. This + ensures that someone cannot guess at the root password from the network. + + Disallow root login remotely? [Y/n] n ← Choose “n” for no + ... skipping. + + By default, MariaDB comes with a database named 'test' that anyone can + access. This is also intended only for testing, and should be removed + before moving into a production environment. + + Remove test database and access to it? [Y/n] y ← Choose “y” for yes + - Dropping test database... + ... Success! + - Removing privileges on test database... + ... Success! + + Reloading the privilege tables will ensure that all changes made so far + will take effect immediately. + + Reload privilege tables now? [Y/n] y ← Choose “y” for yes + ... Success! + + Cleaning up... + + All done! If you've completed all of the above steps, your MariaDB + installation should now be secure. + + Thanks for using MariaDB! + +#### 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的数据库: #### + + # 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的数据库用户: #### + + 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用户 + +**注意**: 请将“tecmint123”替换为你想要设置的实际密码。 + +#### 8. 我们继续创建PowerDNS要使用的数据库表。像堆积木一样执行以下这些: #### + + MariaDB [(none)]> USE powerdns; + MariaDB [(none)]> CREATE TABLE domains ( + id INT auto_increment, + name VARCHAR(255) NOT NULL, + master VARCHAR(128) DEFAULT NULL, + last_check INT DEFAULT NULL, + type VARCHAR(6) NOT NULL, + notified_serial INT DEFAULT NULL, + account VARCHAR(40) DEFAULT NULL, + primary key (id) + ); + +![Create Table Domains for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Table-Domains-for-PowerDNS.png) +创建用于PowerDNS的表域 + + MariaDB [(none)]> CREATE UNIQUE INDEX name_index ON domains(name); + MariaDB [(none)]> CREATE TABLE records ( + id INT auto_increment, + domain_id INT DEFAULT NULL, + name VARCHAR(255) DEFAULT NULL, + type VARCHAR(6) DEFAULT NULL, + content VARCHAR(255) DEFAULT NULL, + ttl INT DEFAULT NULL, + prio INT DEFAULT NULL, + change_date INT DEFAULT NULL, + primary key(id) + ); + +![Create Index Domains for PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Index-Domains-for-PowerDNS.png) +创建用于PowerDNS的索引域 + + 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) +创建索引记录 + + MariaDB [(none)]> CREATE TABLE supermasters ( + ip VARCHAR(25) NOT NULL, + nameserver VARCHAR(255) NOT NULL, + account VARCHAR(40) DEFAULT NULL + ); + +![Create Table Supermaster](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Table-Supermaster.png) +创建表的超主 + +你现在可以输入以下命令退出MySQL控制台: + + MariaDB [(none)]> quit; + +#### 9. 最后,我们可以继续以MySQL作为后台的方式配置PowerDNS。请打开PowerDNS的配置文件: #### + + # vim /etc/pdns/pdns.conf + +在该文件中查找像下面这样的行: + + ################################# + # launch Which backends to launch and order to query them in + # + # launch= + +在这后面放置以下代码: + + launch=gmysql + gmysql-host=localhost + gmysql-user=powerdns + gmysql-password=user-pass + gmysql-dbname=powerdns + +修改“user-pass”为你先前设置的实际密码,配置如下: + +![Configure PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/Configure-PowerDNS.png) +配置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的信息,你可以参考手册[http://downloads.powerdns.com/documentation/html/index.html][1] + +### 步骤 2: 安装PowerAdmin来管理PowerDNS ### + +#### 11. 现在,我们将安装PowerAdmin——一个友好的网页接口PowerDNS服务器管理器。由于它是用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 + +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 + +你也可以参考一下文章了解CentOS 7中安装LAMP堆栈的完整指南: + +- [CentOS 7中安装LAMP][2] + +安装完成后,我们将需要启动并设置Apache开机启动: + + # systemctl enable httpd.service + # 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/,我们将下载软件包到这里。 #### + + # 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的网页安装器了,只需打开: #### + + 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数据库: #### + +![PowerDNS Database](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Database.png) +PowerDNS数据库 + +#### 15. 因为我们已经创建了一个,所以我们可以继续进入下一步。你会被要求提供先前配置的数据库详情,你也需要为Poweradmin设置管理员密码: #### + +![Enter PowerDNS Database Settings](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS.png) +输入PowerDNS数据库配置 + +#### 16. 输入这些信息后,进入步骤 4。你将创建为Poweradmin创建一个受限用户。这里你需要输入的字段是: #### + +- 用户名 - PowerAdmin用户名。 +- 密码 – 上述用户的密码。 +- 注册人 - 当创建SOA记录而你没有制定注册人时,该值会被使用。 +- 辅助域名服务器 – 该值在创建新的DNS区域时会被用于作为主域名服务器。 + +![PowerDNS Configuration Settings](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Configuration-Settings.png) +PowerDNS配置设置 + +#### 17. 在下一步中,Poweradmin会要求你在数据库表中创建新的受限数据库用户,它会提供你需要在MySQL控制台输入的代码: #### + +![Create New Database User](http://www.tecmint.com/wp-content/uploads/2015/04/Create-New-Database-User.png) +创建新的数据库用户 + +#### 18. 现在打开终端并运行: #### + + # mysql -u root -p + +提供你的密码并执行由Poweradmin提供的代码: + + MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE + ON powerdns.* + TO 'powermarin'@'localhost' + 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。 #### + +文件名是config.inc.php。为防止该脚本没有写权限,你可以手动复制这些内容到上述文件中: + +![Configuration Settings of PowerDNS](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Configuration.png) +配置PowerDNS设置 + +#### 20. 现在,进入最后页面,该页面会告知你安装已经完成以及如何访问安装好的Poweradmin: #### + +![PowerDNS Installation Completed](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Installation-Completed.png) +PowerDNS安装完成 + +你可以通过运行以下命令来启用其他动态DNS提供商的URL: + + # cp install/htaccess.dist .htaccess + +出于该目的,你将需要在Apache的配置中启用mod_rewrite。 + +#### 21. 现在,需要移除从Poweradmin的根目录中移除“install”文件夹,这一点很重要。使用以下命令: #### + + # rm -fr /var/www/html/poweradmin/install/ + +在此之后,你可以通过以下方式访问PowerAdmin: + + 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 Dashboard](http://www.tecmint.com/wp-content/uploads/2015/04/PowerDNS-Dashboard.png) +PowerDNS仪表盘 + +到这里,安装已经完成了,你也可以开始管理你的DNS区域了。 + +### 步骤 3: PowerDNS中添加、编辑和删除DNS区域 ### + +#### 22. 要添加新的主区域,只需点击“添加主区域”: #### + +![Add Master Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Add-Master-Zone.png) +添加主区域 + +在下一页中,你需要填写一些东西: + +- 域 – 你要添加区域的域。 +- 所有者 – 设置DNS区域的所有者。 +- 模板 – DNS模板 – 留空。 +- DNSSEC – Donany名称系统安全扩展(可选——检查你是否需要)。 + +点击“添加区域”按钮来添加DNS区域。 + +![Master DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Master-DNS-Zone.png) +主DNS区域 + +现在,你可以点击“首页”链接回到Poweradmin的首页。要查看所有现存的DNS区域,只需转到“列出区域”: + +![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区域或者添加新的记录,点击编辑图标: #### + +![Edit DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Edit-DNS-Zone.png) +编辑DNS区域 + +在接下来的页面,你会看到你选择的DNS区域的条目: + +![Domain DNS Zone Entries](http://www.tecmint.com/wp-content/uploads/2015/04/Domain-DNS.png) +主DNS区域条目 + +#### 24. 在此处添加新的DNS区域,你需要设置以下信息: #### + +- 名称 – 条目名称。只需添加域/子域的第一部分,Poweradmin会添加剩下的。 +- 类型 – 选择记录类型。 +- 优先级 – 记录优先级。 +- 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记录 + +最后,点击“添加记录”按钮。 + +#### 25. 如果你想要删除DNS区域,你可以回到“列出区域”页面,然后点击你想要删除的DNS区域旁边“垃圾桶”图标: #### + +![Delete DNS Zone](http://www.tecmint.com/wp-content/uploads/2015/04/Delete-DNS-Zone.png) +删除DNS区域 + +Poweradmin将问你是否确定想要删除DNS区域。只需点击“是”来完成删除。 + +如要获取更多关于怎样创建、编辑和删除区域的说明,你可以参与Poweradmin的文档: + +[https://github.com/poweradmin/poweradmin/wiki/Documentation][3] + +我希望你已经发现本文很有趣,也很有用。一如既往,如果你有问题或要发表评论,请别犹豫,在下面评论区提交你的评论吧。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/marintodorov89/ +[1]:http://downloads.powerdns.com/documentation/html/index.html +[2]:http://www.tecmint.com/install-lamp-in-centos-7/ +[3]:https://github.com/poweradmin/poweradmin/wiki/Documentation diff --git a/translated/tech/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md b/translated/tech/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md new file mode 100644 index 0000000000..cd90e2bfb7 --- /dev/null +++ b/translated/tech/20150504 Useful Commands to Create Commandline Chat Server and Remove Unwanted Packages in Linux.md @@ -0,0 +1,177 @@ +Linux中,创建聊天服务器、移除冗余软件包的实用命令 +============================================================================= +这里,我们来看Linux命令行实用技巧的下一个部分。如果你错过了Linux Tracks之前的文章,可以从这里找到。 + +- [5 Linux Command Line Tracks][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个实用的命令行技巧 + +### 1. 创建Linux命令行聊天服务 ### +我们大家使用聊天服务都有很长一段时间了。对于Google Chat,Hangout,Facebook Chat,Whatsapp,Hike和其他一些应用与集成的聊天服务,我们都很熟悉了。那你知道Linux的nc命令可以使你的Linux盒子变成一个聊天服务器,而仅仅只需要一行命令吗。什么是nc命令,它又是怎么工作的呢? + +nc是Linux netcat命令的旧版。nc就像瑞士军刀一样,内建呢大量的功能。nc可用做调式工具,调查工具,使用TCP/UDP读写网络连接,DNS正向/反向检查。 + +nc主要用在端口扫描,文件传输,后台和端口监听。nc可以使用任何闲置的端口和任何本地网络源地址。 + +使用nc命令(在192.168.0.7的服务器上)创建一个命令行即时信息传输服务器。 + + $ nc -l -vv 11119 + +对上述命令的解释。 + +- -v : 表示 Verbose +- -vv : 更多的 Verbose +- -p : 本地端口号 + +你可以用任何其他的本地端口号替换11119。 + +接下来在客户端机器(IP地址:192.168.0.15),运行下面的命令初始化聊天会话(信息传输服务正在运行)。 + + $ nc 192.168.0.7:11119 + +![Linux Commandline Chat with nc Command](http://www.tecmint.com/wp-content/uploads/2015/04/Chat-on-Linux-Commandline.gif) + +**注意**:你可以按下ctrl+c终止会话,同时nc聊天是一个一对一的服务。 + +### 2. Linux中如何统计某一列的总值 ### + +如何统计在终端里,某个命令的输出中,其中一列的数值总和, + +‘ls -l’命令的输出。 + + $ ls -l + +![Sum Numerical Values](http://www.tecmint.com/wp-content/uploads/2015/04/Sum-Values.gif) + +注意到第二列代表软连接的数量,第五列则是文件的大小。假设我们需要汇总第五列的数值。 + +仅仅列出第五列的内容。我们会使用‘awk’命令做到这点。‘$5’即代表第五列。 + + $ ls -l | awk '{print $5}' + +![List Content Column](http://www.tecmint.com/wp-content/uploads/2015/04/List-Content-Column.gif) + +现在,通过管道连接,使用awk打印出第五列数值的总和。 + + $ ls -l | awk '{print $5}' | awk '{total = total + $1}END{print total}' + +![Sum and Print Columns](http://www.tecmint.com/wp-content/uploads/2015/04/Sum-Columns.gif) + +### 在Linux里如何移除废弃包 ### + +废弃包是指那些作为其他包的依赖而被安装,但是当源包被移除之后就不再需要的包。 + +假设我们安装了gtprogram,依赖是gtdependency。除非我们安装了gtdependency,否则安装不了gtprogram。 + +当我们移除gtprogram的时候,默认并不会移除gtdependency。并且如果我们不移除gtdependency的话,它就会遗留下来成为废弃包,与其他任何包再无联系。 + + # yum autoremove [On RedHat Systems] + +![Remove Orphan Packages in CentOS](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Orphan-Packages-in-CentOS1.gif) + + # apt-get autoremove [On Debian Systems] + +![Remove Orphan Packages in Debian](http://www.tecmint.com/wp-content/uploads/2015/04/Remove-Orphan-Packages-in-Debian.gif) + +你应该经常移除废弃包,保持Linux机器仅仅加载一些需要的东西。 + +### 4. 如何获得Linux服务器本地的与公网的IP地址 ### + +为了获得本地IP地址,运行下面的一行脚本。 + + $ ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d: + +你必须安装了ifconfig,如果没有,使用apt或者yum工具安装需要的包。这里我们将会管道连接ifconfig的输出,并且结合grep命令找到包含“intel addr:”的字符串。 + +我们知道对于输出本地IP地址,ifconfig命令足够用了。但是ifconfig生成了许多的输出,而我们关注的地方仅仅是本地IP地址,不是其他的。 + + # ifconfig | grep "inet addr:" + +![Check Local IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/Check-Local-IP-Address.gif) + +尽管目前的输出好多了,但是我们需要过滤出本地的IP地址,不含其他东西。针对这个,我们将会使用awk打印出第二列输出,通过管道连接上述的脚本。 + + # ifconfig | grep “inet addr:” | awk '{print $2}' + +![Filter Only IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/Filter-IP-Address.gif) + +上面图片清楚的表示,我们已经很大程度上自定义了输出,当仍然不是我们想要的。本地环路地址 127.0.0.1 仍然在结果中。 + +我们可以使用grep的-v选项,这样会打印出不匹配给定参数的其他行。每个机器都有同样的环路地址 127.0.0.1,所以使用grep -v打印出不包含127.0.0.1的行,通过管道连接前面的脚本。 + + # ifconfig | grep "inet addr" | awk '{print $2}' | grep -v '127.0.0.1' + +![Print IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/Print-IP-Address.gif) + +我们差不多得到想要的输出了,仅仅需要从开头替换掉字符串`(addr:)`。我们将会使用cut命令单独打印出第二列。一二列之间并不是用tab分割,而是`(:)`,所以我们需要使用到域分割符选项`(-d)`,通过管道连接上面的输出。 + + # ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d: + +![Customized IP Address](http://www.tecmint.com/wp-content/uploads/2015/04/Custome-IP-Address.gif) + +最后!期望的结果出来了。 + +### 5.如何在Linux终端彩色输出 ### + +你可能在终端看见过彩色的输出。同时你也可能知道在终端里允许/禁用彩色输出。如果都不知道的话,里可以参考下面的步骤。 + +在Linux中,每个用户都有`'.bashrc'`文件,被用来管理你的终端输出。打开并且编辑该文件,用你喜欢的编辑器。注意一下,这个文件是隐藏的(文件开头为点的代表隐藏文件)。 + + $ vi /home/$USER/.bashrc + +确保以下的行没有被注释掉。ie.,行开头没有#。 + + if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dirc$ + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' + fi + +![User .bashrc File](http://www.tecmint.com/wp-content/uploads/2015/04/bashrc-file.gif) + +完成后!保存并退出。为了让改动生效,需要注销账户后再次登录。 + +现在,你会看见列出的文件和文件夹名字有着不同的颜色,根据文件类型来决定。为了解码颜色,可以运行下面的命令。 + + $ dircolors -p | less + +![Linux Color Output](http://www.tecmint.com/wp-content/uploads/2015/04/Linux-Color-Output.gif) + +### 6.如何用井号标记和Linux命令和脚本 ### + +我们一直在Twitter,Facebook和Google Plus(可能是其他我们没有提到的地方)上使用井号标签。那些井号标签使得其他人搜索一个标签更加容易。可是很少人知道,我们可以在Linux命令行使用井号标签。 + +我们已经知道配置文件里的`#`,在大多数的编程语言中,这个符号被用作注释行,即不被执行。 + +运行一个命令,然后为这个命令创建一个井号标签,这样之后我们就可以找到它。假设我们有一个很长的脚本,就上面第四点被执行的命令。现在为它创建一个井号标签。我们知道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‘。你可以从这里开始执行。 + +![Create Command Hash Tags](http://www.tecmint.com/wp-content/uploads/2015/04/Create-Command-Hash-Tags.gif) + +你可以创建很多的井号标签,为每个命令,之后使用reverse-i-search找到它。 + +目前就这么多了。我们一直在辛苦的工作,创造有趣的,有知识性的内容给你。你觉得我们是如何工作的呢?欢迎咨询任何问题。你可以在下面评论。保持联络!Kudox。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-commandline-chat-server-and-remove-unwanted-packages/ + +作者:[Avishek Kumar][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[校对者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/5-linux-command-line-tricks/ diff --git a/translated/tech/20150505 How to Manage 'Systemd' Services and Units Using 'Systemctl' in Linux.md b/translated/tech/20150505 How to Manage 'Systemd' Services and Units Using 'Systemctl' in Linux.md new file mode 100644 index 0000000000..a78dc01820 --- /dev/null +++ b/translated/tech/20150505 How to Manage 'Systemd' Services and Units Using 'Systemctl' in Linux.md @@ -0,0 +1,579 @@ +在Linux中使用‘Systemctl’管理‘Systemd’服务和单元 +================================================================================ +Systemctl是一个systemd工具,主要负责控制systemd系统和服务管理器。 + +Systemd是一个系统管理守护进程、工具和库的集合,用于取代System V初始进程。Systemd的功能是用于集中管理和配置类UNIX系统。 + +在Linux生态系统中,Systemd被部署到了大多数的标准Linux发行版中,只有位数不多的几个尚未部署。Systemd通常是所有其它守护进程的父进程,但并非总是如此。 + +![Manage Linux Services Using Systemctl](http://www.tecmint.com/wp-content/uploads/2015/04/Manage-Linux-Services-Using-Systemctl.jpg) +使用Systemctl管理Linux服务 + +本文旨在阐明在运行systemd的系统上“如何控制系统和服务”。 + +### Systemd初体验和Systemctl基础 ### + +#### 1. 首先检查你的系统中是否安装有systemd并确定当前安装的版本 #### + + # systemd --version + + systemd 215 + +PAM +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ -SECCOMP -APPARMOR + +上例中很清楚地表明,我们安装了215版本的systemd。 + +#### 2. 检查systemd和systemctl的二进制文件和库文件的安装位置 #### + + # whereis systemd + systemd: /usr/lib/systemd /etc/systemd /usr/share/systemd /usr/share/man/man1/systemd.1.gz + + + # whereis systemctl + systemctl: /usr/bin/systemctl /usr/share/man/man1/systemctl.1.gz + +#### 3. 检查systemd是否运行 #### + + # ps -eaf | grep [s]ystemd + + root 1 0 0 16:27 ? 00:00:00 /usr/lib/systemd/systemd --switched-root --system --deserialize 23 + root 444 1 0 16:27 ? 00:00:00 /usr/lib/systemd/systemd-journald + root 469 1 0 16:27 ? 00:00:00 /usr/lib/systemd/systemd-udevd + root 555 1 0 16:27 ? 00:00:00 /usr/lib/systemd/systemd-logind + dbus 556 1 0 16:27 ? 00:00:00 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation + +**注意**:systemd是作为父进程(PID=1)运行的。在上面带(-e)参数的ps命令输出中,选择所有进程,(- + +a)选择除会话前导外的所有进程,并使用(-f)参数输出完整格式列表(如 -eaf)。 + +也请注意上例中后随的方括号和样例剩余部分。方括号表达式是grep的字符类表达式的一部分。 + +#### 4. 分析systemd启动进程 #### + + # systemd-analyze + Startup finished in 487ms (kernel) + 2.776s (initrd) + 20.229s (userspace) = 23.493s + +#### 5. 分析启动时各个进程花费的时间 #### + + # systemd-analyze blame + + 8.565s mariadb.service + 7.991s webmin.service + 6.095s postfix.service + 4.311s httpd.service + 3.926s firewalld.service + 3.780s kdump.service + 3.238s tuned.service + 1.712s network.service + 1.394s lvm2-monitor.service + 1.126s systemd-logind.service + .... + +#### 6. 分析启动时的关键链 #### + + # systemd-analyze critical-chain + + The time after the unit is active or started is printed after the "@" character. + The time the unit takes to start is printed after the "+" character. + + multi-user.target @20.222s + └─mariadb.service @11.657s +8.565s + └─network.target @11.168s + └─network.service @9.456s +1.712s + └─NetworkManager.service @8.858s +596ms + └─firewalld.service @4.931s +3.926s + └─basic.target @4.916s + └─sockets.target @4.916s + └─dbus.socket @4.916s + └─sysinit.target @4.905s + └─systemd-update-utmp.service @4.864s +39ms + └─auditd.service @4.563s +301ms + └─systemd-tmpfiles-setup.service @4.485s +69ms + └─rhel-import-state.service @4.342s +142ms + └─local-fs.target @4.324s + └─boot.mount @4.286s +31ms + └─systemd-fsck@dev-disk-by\x2duuid-79f594ad\x2da332\x2d4730\x2dbb5f\x2d85d19608096 + └─dev-disk-by\x2duuid-79f594ad\x2da332\x2d4730\x2dbb5f\x2d85d196080964.device @4 + +**重要**:Systemctl接受服务(.service),挂载点(.mount),套接口(.socket)和设备(.device)作为单元。 + +#### 7. 列出所有可用单元 #### + + # systemctl list-unit-files + + UNIT FILE STATE + proc-sys-fs-binfmt_misc.automount static + dev-hugepages.mount static + dev-mqueue.mount static + proc-sys-fs-binfmt_misc.mount static + sys-fs-fuse-connections.mount static + sys-kernel-config.mount static + sys-kernel-debug.mount static + tmp.mount disabled + brandbot.path disabled + ..... + +#### 8. 列出所有运行中单元 #### + + # systemctl list-units + + UNIT LOAD ACTIVE SUB DESCRIPTION + proc-sys-fs-binfmt_misc.automount loaded active waiting Arbitrary Executable File Formats File Syste + sys-devices-pc...0-1:0:0:0-block-sr0.device loaded active plugged VBOX_CD-ROM + sys-devices-pc...:00:03.0-net-enp0s3.device loaded active plugged PRO/1000 MT Desktop Adapter + sys-devices-pc...00:05.0-sound-card0.device loaded active plugged 82801AA AC'97 Audio Controller + sys-devices-pc...:0:0-block-sda-sda1.device loaded active plugged VBOX_HARDDISK + sys-devices-pc...:0:0-block-sda-sda2.device loaded active plugged LVM PV Qzyo3l-qYaL-uRUa-Cjuk-pljo-qKtX-VgBQ8 + sys-devices-pc...0-2:0:0:0-block-sda.device loaded active plugged VBOX_HARDDISK + sys-devices-pl...erial8250-tty-ttyS0.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0 + sys-devices-pl...erial8250-tty-ttyS1.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1 + sys-devices-pl...erial8250-tty-ttyS2.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2 + sys-devices-pl...erial8250-tty-ttyS3.device loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3 + sys-devices-virtual-block-dm\x2d0.device loaded active plugged /sys/devices/virtual/block/dm-0 + sys-devices-virtual-block-dm\x2d1.device loaded active plugged /sys/devices/virtual/block/dm-1 + sys-module-configfs.device loaded active plugged /sys/module/configfs + ... + +#### 9. 列出所有失败单元 #### + + # systemctl --failed + + UNIT LOAD ACTIVE SUB DESCRIPTION + kdump.service loaded failed failed Crash recovery kernel arming + + LOAD = Reflects whether the unit definition was properly loaded. + ACTIVE = The high-level unit activation state, i.e. generalization of SUB. + SUB = The low-level unit activation state, values depend on unit type. + + 1 loaded units listed. Pass --all to see loaded but inactive units, too. + To show all installed unit files use 'systemctl list-unit-files'. + +#### 10. 检查某个单元(cron.service)是否启用 #### + + # systemctl is-enabled crond.service + + enabled + +#### 11. 检查某个单元或服务是否运行 #### + + # systemctl status firewalld.service + + firewalld.service - firewalld - dynamic firewall daemon + Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) + Active: active (running) since Tue 2015-04-28 16:27:55 IST; 34min ago + Main PID: 549 (firewalld) + CGroup: /system.slice/firewalld.service + └─549 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid + + Apr 28 16:27:51 tecmint systemd[1]: Starting firewalld - dynamic firewall daemon... + Apr 28 16:27:55 tecmint systemd[1]: Started firewalld - dynamic firewall daemon. + +### 使用Systemctl控制并管理服务 ### + +#### 12. 列出所有服务(包括启用的和禁用的) #### + + # systemctl list-unit-files --type=service + + UNIT FILE STATE + arp-ethers.service disabled + auditd.service enabled + autovt@.service disabled + blk-availability.service disabled + brandbot.service static + collectd.service disabled + console-getty.service disabled + console-shell.service disabled + cpupower.service disabled + crond.service enabled + dbus-org.fedoraproject.FirewallD1.service enabled + .... + +#### 13. Linux中如何启动、重启、停止、重载服务以及检查服务(httpd.service)状态 #### + + # systemctl start httpd.service + # systemctl restart httpd.service + # systemctl stop httpd.service + # systemctl reload httpd.service + # systemctl status httpd.service + + httpd.service - The Apache HTTP Server + Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) + Active: active (running) since Tue 2015-04-28 17:21:30 IST; 6s ago + Process: 2876 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS) + Main PID: 2881 (httpd) + Status: "Processing requests..." + CGroup: /system.slice/httpd.service + ├─2881 /usr/sbin/httpd -DFOREGROUND + ├─2884 /usr/sbin/httpd -DFOREGROUND + ├─2885 /usr/sbin/httpd -DFOREGROUND + ├─2886 /usr/sbin/httpd -DFOREGROUND + ├─2887 /usr/sbin/httpd -DFOREGROUND + └─2888 /usr/sbin/httpd -DFOREGROUND + + Apr 28 17:21:30 tecmint systemd[1]: Starting The Apache HTTP Server... + Apr 28 17:21:30 tecmint httpd[2881]: AH00558: httpd: Could not reliably determine the server's fully q...ssage + Apr 28 17:21:30 tecmint systemd[1]: Started The Apache HTTP Server. + Hint: Some lines were ellipsized, use -l to show in full. + +**注意**:当我们使用systemctl的start,restart,stop和reload命令时,我们不会不会从终端获取到任何输出内容,只有status命令可以打印输出。 + +#### 14. 如何激活服务并在启动时启用或禁用服务(系统启动时自动启动服务) #### + + # systemctl is-active httpd.service + # systemctl enable httpd.service + # systemctl disable httpd.service + +#### 15. 如何屏蔽(让它不能启动)或显示服务(httpd.service) #### + + # systemctl mask httpd.service + ln -s '/dev/null' '/etc/systemd/system/httpd.service' + + # systemctl unmask httpd.service + rm '/etc/systemd/system/httpd.service' + +#### 16. 使用systemctl命令杀死服务 #### + + # systemctl kill httpd + # systemctl status httpd + + httpd.service - The Apache HTTP Server + Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled) + Active: failed (Result: exit-code) since Tue 2015-04-28 18:01:42 IST; 28min ago + Main PID: 2881 (code=exited, status=0/SUCCESS) + Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec" + + Apr 28 17:37:29 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:29 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:39 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:39 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:49 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:49 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:59 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 17:37:59 tecmint systemd[1]: httpd.service: Got notification message from PID 2881, but recepti...bled. + Apr 28 18:01:42 tecmint systemd[1]: httpd.service: control process exited, code=exited status=226 + Apr 28 18:01:42 tecmint systemd[1]: Unit httpd.service entered failed state. + Hint: Some lines were ellipsized, use -l to show in full. + +### 使用Systemctl控制并管理挂载点 ### + +#### 17. 列出所有系统挂载点 #### + + # systemctl list-unit-files --type=mount + + UNIT FILE STATE + dev-hugepages.mount static + dev-mqueue.mount static + proc-sys-fs-binfmt_misc.mount static + sys-fs-fuse-connections.mount static + sys-kernel-config.mount static + sys-kernel-debug.mount static + tmp.mount disabled + +#### 18. 挂载、卸载、重新挂载、重载系统挂载点并检查系统中挂载点状态 #### + + # systemctl start tmp.mount + # systemctl stop tmp.mount + # systemctl restart tmp.mount + # systemctl reload tmp.mount + # systemctl status tmp.mount + + tmp.mount - Temporary Directory + Loaded: loaded (/usr/lib/systemd/system/tmp.mount; disabled) + Active: active (mounted) since Tue 2015-04-28 17:46:06 IST; 2min 48s ago + Where: /tmp + What: tmpfs + Docs: man:hier(7) + + http://www.freedesktop.org/wiki/Software/systemd/APIFileSystems + + Process: 3908 ExecMount=/bin/mount tmpfs /tmp -t tmpfs -o mode=1777,strictatime (code=exited, status=0/SUCCESS) + + Apr 28 17:46:06 tecmint systemd[1]: Mounting Temporary Directory... + Apr 28 17:46:06 tecmint systemd[1]: tmp.mount: Directory /tmp to mount over is not empty, mounting anyway. + Apr 28 17:46:06 tecmint systemd[1]: Mounted Temporary Directory. + +#### 19. 在启动时激活、启用或禁用挂载点(系统启动时自动挂载) #### + + # systemctl is-active tmp.mount + # systemctl enable tmp.mount + # systemctl disable tmp.mount + +#### 20. 在Linux中屏蔽(让它不能启动)或显示挂载点 #### + + # systemctl mask tmp.mount + + ln -s '/dev/null' '/etc/systemd/system/tmp.mount' + + # systemctl unmask tmp.mount + + rm '/etc/systemd/system/tmp.mount' + +### 使用Systemctl控制并管理套接口 ### + +#### 21. 列出所有可用系统套接口 #### + + # systemctl list-unit-files --type=socket + + UNIT FILE STATE + dbus.socket static + dm-event.socket enabled + lvm2-lvmetad.socket enabled + rsyncd.socket disabled + sshd.socket disabled + syslog.socket static + systemd-initctl.socket static + systemd-journald.socket static + systemd-shutdownd.socket static + systemd-udevd-control.socket static + systemd-udevd-kernel.socket static + + 11 unit files listed. + +#### 22. 在Linux中启动、重启、停止、重载套接口并检查其状态#### + + # systemctl start cups.socket + # systemctl restart cups.socket + # systemctl stop cups.socket + # systemctl reload cups.socket + # systemctl status cups.socket + + cups.socket - CUPS Printing Service Sockets + Loaded: loaded (/usr/lib/systemd/system/cups.socket; enabled) + Active: active (listening) since Tue 2015-04-28 18:10:59 IST; 8s ago + Listen: /var/run/cups/cups.sock (Stream) + + Apr 28 18:10:59 tecmint systemd[1]: Starting CUPS Printing Service Sockets. + Apr 28 18:10:59 tecmint systemd[1]: Listening on CUPS Printing Service Sockets. + +#### 23. 在启动时激活套接口,并启用或禁用它(系统启动时自启动) #### + + # systemctl is-active cups.socket + # systemctl enable cups.socket + # systemctl disable cups.socket + +#### 24. 屏蔽(使它不能启动)或显示套接口 #### + + # systemctl mask cups.socket + ln -s '/dev/null' '/etc/systemd/system/cups.socket' + + # systemctl unmask cups.socket + rm '/etc/systemd/system/cups.socket' + +### 服务的CPU利用率(分配额) ### + +#### 25. 获取当前某个服务的CPU分配额(如httpd) #### + + # systemctl show -p CPUShares httpd.service + + CPUShares=1024 + +**注意**:各个服务的默认CPU分配份额=1024,你可以增加/减少某个进程的CPU分配份额。 + +#### 26. 将某个服务(httpd.service)的CPU分配份额限制为2000 CPUShares/ #### + + # systemctl set-property httpd.service CPUShares=2000 + # systemctl show -p CPUShares httpd.service + + CPUShares=2000 + +**注意**:当你为某个服务设置CPUShares,会自动创建一个以服务名命名的目录(httpd.service),里面包含了一个名为90-CPUShares.conf的文件,该文件含有CPUShare限制信息,你可以通过以下方式查看该文件: + + # vi /etc/systemd/system/httpd.service.d/90-CPUShares.conf + + [Service] + CPUShares=2000 + +#### 27. 检查某个服务的所有配置细节 #### + + # systemctl show httpd + + Id=httpd.service + Names=httpd.service + Requires=basic.target + Wants=system.slice + WantedBy=multi-user.target + Conflicts=shutdown.target + Before=shutdown.target multi-user.target + After=network.target remote-fs.target nss-lookup.target systemd-journald.socket basic.target system.slice + Description=The Apache HTTP Server + LoadState=loaded + ActiveState=active + SubState=running + FragmentPath=/usr/lib/systemd/system/httpd.service + .... + +#### 28. 分析某个服务(httpd)的关键链 #### + + # systemd-analyze critical-chain httpd.service + + The time after the unit is active or started is printed after the "@" character. + The time the unit takes to start is printed after the "+" character. + + httpd.service +142ms + └─network.target @11.168s + └─network.service @9.456s +1.712s + └─NetworkManager.service @8.858s +596ms + └─firewalld.service @4.931s +3.926s + └─basic.target @4.916s + └─sockets.target @4.916s + └─dbus.socket @4.916s + └─sysinit.target @4.905s + └─systemd-update-utmp.service @4.864s +39ms + └─auditd.service @4.563s +301ms + └─systemd-tmpfiles-setup.service @4.485s +69ms + └─rhel-import-state.service @4.342s +142ms + └─local-fs.target @4.324s + └─boot.mount @4.286s +31ms + └─systemd-fsck@dev-disk-by\x2duuid-79f594ad\x2da332\x2d4730\x2dbb5f\x2d85d196080964.service @4.092s +149ms + └─dev-disk-by\x2duuid-79f594ad\x2da332\x2d4730\x2dbb5f\x2d85d196080964.device @4.092s + +#### 29. 获取某个服务(httpd)的依赖性列表 #### + + # systemctl list-dependencies httpd.service + + httpd.service + ├─system.slice + └─basic.target + ├─firewalld.service + ├─microcode.service + ├─rhel-autorelabel-mark.service + ├─rhel-autorelabel.service + ├─rhel-configure.service + ├─rhel-dmesg.service + ├─rhel-loadmodules.service + ├─paths.target + ├─slices.target + │ ├─-.slice + │ └─system.slice + ├─sockets.target + │ ├─dbus.socket + .... + +#### 30. 按等级列出控制组 #### + + # systemd-cgls + + ├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 23 + ├─user.slice + │ └─user-0.slice + │ └─session-1.scope + │ ├─2498 sshd: root@pts/0 + │ ├─2500 -bash + │ ├─4521 systemd-cgls + │ └─4522 systemd-cgls + └─system.slice + ├─httpd.service + │ ├─4440 /usr/sbin/httpd -DFOREGROUND + │ ├─4442 /usr/sbin/httpd -DFOREGROUND + │ ├─4443 /usr/sbin/httpd -DFOREGROUND + │ ├─4444 /usr/sbin/httpd -DFOREGROUND + │ ├─4445 /usr/sbin/httpd -DFOREGROUND + │ └─4446 /usr/sbin/httpd -DFOREGROUND + ├─polkit.service + │ └─721 /usr/lib/polkit-1/polkitd --no-debug + .... + +#### 31. 按CPU、内存、输入和输出列出控制组 #### + + # systemd-cgtop + + Path Tasks %CPU Memory Input/s Output/s + + / 83 1.0 437.8M - - + /system.slice - 0.1 - - - + /system.slice/mariadb.service 2 0.1 - - - + /system.slice/tuned.service 1 0.0 - - - + /system.slice/httpd.service 6 0.0 - - - + /system.slice/NetworkManager.service 1 - - - - + /system.slice/atop.service 1 - - - - + /system.slice/atopacct.service 1 - - - - + /system.slice/auditd.service 1 - - - - + /system.slice/crond.service 1 - - - - + /system.slice/dbus.service 1 - - - - + /system.slice/firewalld.service 1 - - - - + /system.slice/lvm2-lvmetad.service 1 - - - - + /system.slice/polkit.service 1 - - - - + /system.slice/postfix.service 3 - - - - + /system.slice/rsyslog.service 1 - - - - + /system.slice/system-getty.slice/getty@tty1.service 1 - - - - + /system.slice/systemd-journald.service 1 - - - - + /system.slice/systemd-logind.service 1 - - - - + /system.slice/systemd-udevd.service 1 - - - - + /system.slice/webmin.service 1 - - - - + /user.slice/user-0.slice/session-1.scope 3 - - - - + +### 控制系统运行等级 ### + +#### 32. 启动系统救援模式 #### + + # systemctl rescue + + Broadcast message from root@tecmint on pts/0 (Wed 2015-04-29 11:31:18 IST): + + The system is going down to rescue mode NOW! + +#### 33. 进入紧急模式 #### + + # systemctl emergency + + Welcome to emergency mode! After logging in, type "journalctl -xb" to view + system logs, "systemctl reboot" to reboot, "systemctl default" to try again + to boot into default mode. + +#### 34. 列出当前使用的运行等级 #### + + # systemctl get-default + + multi-user.target + +#### 35. 启动运行等级5,即图形模式 #### + + # systemctl isolate runlevel5.target + OR + # systemctl isolate graphical.target + +#### 36. 启动运行等级3,即多用户模式(命令行) #### + + # systemctl isolate runlevel3.target + OR + # systemctl isolate multiuser.target + +#### 36. 设置多用户模式或图形模式为默认运行等级 #### + + # systemctl set-default runlevel3.target + + # systemctl set-default runlevel5.target + +#### 37. 重启、停止、挂起、休眠系统或使系统进入混合睡眠 #### + + # systemctl reboot + + # systemctl halt + + # systemctl suspend + + # systemctl hibernate + + # systemctl hybrid-sleep + +对于不知运行等级为何物的人,说明如下。 + +- Runlevel 0 : 关闭系统 +- Runlevel 1 : 救援?维护模式 +- Runlevel 3 : 多用户,无图形系统 +- Runlevel 4 : 多用户,无图形系统 +- Runlevel 5 : 多用户,图形化系统 +- Runlevel 6 : 关闭并重启机器 + +到此为止吧。保持连线,进行评论。别忘了在下面的评论中为我们提供一些有价值的反馈哦。喜欢我们、与我们分享,求扩散。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/ + +作者:[Avishek Kumar][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ diff --git a/translated/tech/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md b/translated/tech/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md new file mode 100644 index 0000000000..abe1d3943d --- /dev/null +++ b/translated/tech/20150506 Linux FAQs with Answers--How to install Shrew Soft IPsec VPN client on Linux.md @@ -0,0 +1,98 @@ +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客户端,它支持多种验证方法、密钥交换、加密以及防火墙穿越选项。 + +下面介绍如何安装Shrew Soft VPN客户端到Linux平台。 + +首先,从[官方站点][1]下载它的源代码。 + +### 安装Shrew VPN客户端到Debian, Ubuntu或者Linux Mint ### + +Shrew Soft VPN客户端图形界面要求使用Qt 4.x。所以,作为依赖,你需要安装其开发文件。 + + $ sudo apt-get install cmake libqt4-core libqt4-dev libqt4-gui libedit-dev libssl-dev checkinstall flex bison + $ wget https://www.shrew.net/download/ike/ike-2.2.1-release.tbz2 + $ tar xvfvj ike-2.2.1-release.tbz2 + $ cd ike + $ cmake -DCMAKE_INSTALL_PREFIX=/usr -DQTGUI=YES -DETCDIR=/etc -DNATT=YES . + $ make + $ sudo make install + $ cd /etc/ + $ sudo mv iked.conf.sample iked.conf + +### 安装Shrew VPN客户端到CentOS, Fedora或者RHEL ### + +与基于Debian的系统类似,在编译前你需要安装一堆依赖包,包括Qt4。 + + $ sudo yum install qt-devel cmake gcc-c++ openssl-devel libedit-devel flex bison + $ wget https://www.shrew.net/download/ike/ike-2.2.1-release.tbz2 + $ tar xvfvj ike-2.2.1-release.tbz2 + $ cd ike + $ cmake -DCMAKE_INSTALL_PREFIX=/usr -DQTGUI=YES -DETCDIR=/etc -DNATT=YES . + $ make + $ sudo make install + $ cd /etc/ + $ sudo mv iked.conf.sample iked.conf + +在基于Red Hat的系统中,最后一步需要用文本编辑器打开/etc/ld.so.conf文件,并添加以下行。 + + $ sudo vi /etc/ld.so.conf + +---------- + + include /usr/lib/ + +重新加载运行时绑定的共享库文件,以容纳新安装的共享库: + + $ sudo ldconfig + +### 启动Shrew VPN客户端 ### + +首先,启动IKE守护进程(iked)。该守护进作为VPN客户端程通过IKE协议与远程主机经由IPSec通信。 + + $ sudo iked + +![](https://farm9.staticflickr.com/8685/17175688940_59c2db64c9_b.jpg) + +现在,启动qikea,它是一个IPsec VPN客户端前端。该GUI应用允许你管理远程站点配置并初始化VPN连接。 + +![](https://farm8.staticflickr.com/7750/16742992713_eed7f97939_b.jpg) + +要创建一个新的VPN配置,点击“添加”按钮,然后填入VPN站点配置。创建配置后,你可以通过点击配置来初始化VPN连接。 + +![](https://farm8.staticflickr.com/7725/17337297056_3d38dc2180_b.jpg) + +### 故障排除 ### + +1. 我在运行iked时碰到了如下错误。 + + iked: error while loading shared libraries: libss_ike.so.2.2.1: cannot open shared object file: No such file or directory + +要解决该问题,你需要更新动态链接器来容纳libss_ike库。对于此,请添加库文件的位置路径到/etc/ld.so.conf文件中,然后运行ldconfig命令。 + + $ sudo ldconfig + +验证libss_ike是否添加到了库路径: + + $ ldconfig -p | grep ike + +---------- + + libss_ike.so.2.2.1 (libc6,x86-64) => /lib/libss_ike.so.2.2.1 + libss_ike.so (libc6,x86-64) => /lib/libss_ike.so + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:https://www.shrew.net/download/ike diff --git a/translated/tech/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md b/translated/tech/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md new file mode 100644 index 0000000000..d5c2fc98f5 --- /dev/null +++ b/translated/tech/20150507 Install uGet Download Manager 2.0 in Debian Ubuntu Linux Mint and Fedora.md @@ -0,0 +1,134 @@ +在 Debian, Ubuntu, Linux Mint 及 Fedora 中安装 uGet 下载管理器 2.0 +================================================================================ +在经历了一段漫长的开发期后,期间发布了超过 11 个开发版本,最终 uGet 项目小组高兴地宣布 uGet 的最新稳定版本 uGet 2.0 已经可以下载使用了。最新版本包含许多吸引人的特点,例如一个新的设定对话框,改进了 aria2 插件对 BitTorrent 和 Metalink 协议的支持,同时对位于横栏中的 uGet RSS 信息提供了更好的支持,其他特点包括: + +- 一个新的 “检查更新” 按钮,提醒您有关新的发行版本的信息; +- 增添新的语言支持并升级了现有的语言; +- 增加了一个新的 “信息横栏” ,允许开发者轻松地向所有的用户提供有关 uGet 的信息; +- 通过对文档、提交反馈和错误报告等内容的链接,增强了帮助菜单; +- 将 uGet 下载管理器集成到了 Linux 平台下的两个主要的浏览器 Firefox 和 Google Chrome 中; +- 改进了对 Firefox 插件 ‘FlashGot’ 的支持; + +### 何为 uGet ### + +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 ; +- 队列下载: 新增队列下载,现在你可以对你的所有下载进行安排调度; +- 通过 FlashGot 与 FireFox 集成: 与作为一个独立支持的 Firefox 插件的 FlashGot 集成,从而可以处理单个或大量的下载任务; +- CLI 界面或虚拟终端支持: 提供命令行或虚拟终端选项来下载文件; +- 自动创建目录: 假如你提供了一个先前并不存在的保存路径,uGet 将会自动创建这个目录; +- 下载历史管理: 跟踪记录已下载和已删除的下载任务的条目,每个列表支持 9999 个条目,比当前默认支持条目数目更早的条目将会被自动删除; +- 多语言支持: uGet 默认使用英语,但它可支持多达 23 种语言; +- Aria2 插件: uGet 集成了 Aria2 插件,来为 aria2 提供更友好的 GUI 界面; + +如若你想了解更加完整的特点描述,请访问 uGet 官方的 [特点页面][1]. + +### 在 Debian, Ubuntu, Linux Mint 及 Fedora 中安装 uGet ### + +uGet 开发者在 Linux 平台下的各种软件仓库中添加了 uGet 的最新版本,所以你可以在你使用的 Linux 发行版本下使用受支持的软件仓库来安装或升级 uGet 。 + +当前,一些 Linux 发行版本下的 uGet 可能不是最新的,但你可以到 [uGet 下载页面][2] 去了解你所用发行版本的支持状态,在那里选择你喜爱的发行版本来了解更多的信息。 + +#### 在 Debian 下 #### + +在 Debian 的测试版本 (Jessie) 和不稳定版本 (Sid) 中,你可以在一个可信赖的基础上,使用官方的软件仓库轻易地安装和升级 uGet 。 + + $ sudo apt-get update + $ sudo apt-get install uget + +#### 在 Ubuntu 和 Linux Mint 下 #### + +在 Ubuntu 和 Linux Mint 下,你可以使用官方的 PPA `ppa:plushuang-tw/uget-stable` 安装和升级 uGet ,通过使用这个 PPA,你可以自动地与最新版本保持同步。 + + $ sudo add-apt-repository ppa:plushuang-tw/uget-stable + $ sudo apt-get update + $ sudo apt-get install uget + +#### 在 Fedora 下 #### + +在 Fedora 20 – 21 下,最新版本的 uGet(2.0) 可以从官方软件仓库中获得,从这些软件仓库中安装是非常值得信赖的。 + + $ sudo yum install uget + +**注**: 在旧版本的 Debian, Ubuntu, Linux Mint 和 Fedora 下,用户也可以安装 uGet , 但可获取的版本为 1.10.4 。假如你期待使用升级版本(例如 2.0 版本),你需要升级你的系统并添加 uGet 的 PPA 以此来获取最新的稳定版本。 + +### 安装 aria2 插件 ### + +[aria2][3] 是一个卓越的命令行下载管理应用,在 uGet 中它作为一个 aria2 插件,为 uGet 增添了更为强大的功能,如下载 toorent,metalinks 文件,支持多种协议和多来源下载等功能。 + +默认情况下,uGet 在当今大多数的 Linux 系统中使用 `curl` 来作为后端,但 aria2 插件将 curl 替换为 aria2 来作为 uGet 的后端。 + +aria2 是一个单独的软件包,需要独立安装。你可以在你的 Linux 发行版本下,使用受支持的软件仓库来轻易地安装 aria2 的最新版本,或根据 [下载 aria2 页面][4] 来安装它,该页面详细解释了在各个发行版本中如何安装 aria2 。 + +#### 在 Debian, Ubuntu 和 Linux Mint 下 #### + +利用下面的命令,使用 aria2 的个人软件仓库来安装最新版本的 aria2 : + + $ sudo add-apt-repository ppa:t-tujikawa/ppa + $ sudo apt-get update + $ sudo apt-get install aria2 + +#### 在 Fedora 下 #### + +Fedora 的官方软件仓库中已经添加了 aria2 软件包,所以你可以轻易地使用下面的 yum 命令来安装它: + + $ sudo yum install aria2 + +#### 开启 uGet #### + +为了启动 uGet,从桌面菜单的搜索栏中键入 "uGet"。可参考如下的截图: + +![开启 uGet 下载管理器](http://www.tecmint.com/wp-content/uploads/2014/03/Start-uGet.gif) +开启 uGet 下载管理器 + +![uGet 版本: 2.0](http://www.tecmint.com/wp-content/uploads/2014/03/uGet-Version.gif) +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 2.0 截图赏析 ### + +![使用 Aria2 下载文件](http://www.tecmint.com/wp-content/uploads/2014/03/Download-Files-Using-Aria2.gif) +使用 Aria2 下载文件 + +![使用 uGet 下载 Torrent 文件](http://www.tecmint.com/wp-content/uploads/2014/03/Download-Torrent-File.gif) +使用 uGet 下载 Torrent 文件 + +![使用 uGet 进行批量下载](http://www.tecmint.com/wp-content/uploads/2014/03/Batch-Download-Files.gif) +使用 uGet 进行批量下载 + +针对其他 Linux 发行版本和 Windows 平台的 RPM 包和 uGet 的源文件都可以在 uGet 的[下载页面][5] 下找到。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-uget-download-manager-in-linux/ + +作者:[Ravi Saive][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/admin/ +[1]:http://uget.visuex.com/features +[2]:http://ugetdm.com/downloads +[3]:http://www.tecmint.com/install-aria2-a-multi-protocol-command-line-download-manager-in-rhel-centos-fedora/ +[4]:http://ugetdm.com/downloads-aria2 +[5]:http://ugetdm.com/downloads \ No newline at end of file diff --git a/translated/tech/20150511 Fix Various Update Errors In Ubuntu 14.04.md b/translated/tech/20150511 Fix Various Update Errors In Ubuntu 14.04.md new file mode 100644 index 0000000000..3780b4f948 --- /dev/null +++ b/translated/tech/20150511 Fix Various Update Errors In Ubuntu 14.04.md @@ -0,0 +1,151 @@ +修复Ubuntu 14.04中各种更新错误 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/09/Fix_Ubuntu_Update_Error.jpeg) + +在Ubuntu更新中,谁没有碰见个错误?在Ubuntu和其它基于Ubuntu的Linux发行版中,更新错误很常见,也为数不少。这些错误出现的原因多种多样,修复起来也很简单。在本文中,我们将见到Ubuntu中各种类型频繁发生的更新错误以及它们的修复方法。 + +### 合并列表问题 ### + +当你在终端中运行更新命令时,你可能会碰到这个错误“[合并列表错误][1]”,就像下面这样: + +> E:Encountered a section with no Package: header, +> +> E:Problem with MergeList /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages, +> +> E:The package lists or status file could not be parsed or opened.’ + +可以使用以下命令来修复该错误: + + sudo rm -r /var/lib/apt/lists/* + sudo apt-get clean && sudo apt-get update + +### 下载仓库信息失败 -1 ### + +实际上,有两种类型的[下载仓库信息失败错误][2]。如果你的错误是这样的: + +> W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_restricted_binary-i386_Packages Hash Sum mismatch, +> +> W:Failed to fetch bzip2:/var/lib/apt/lists/partial/in.archive.ubuntu.com_ubuntu_dists_oneiric_multiverse_binary-i386_Packages Hash Sum mismatch, +> +> E:Some index files failed to download. They have been ignored, or old ones used instead + +那么,你可以用以下命令修复: + + sudo rm -rf /var/lib/apt/lists/* + sudo apt-get update + +### 下载仓库信息失败 -2 ### + +下载仓库信息失败的另外一种类型是由于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:) + +你可以运行sudo apt-get update来查看哪个PPA更新失败,你可以把它从源列表中删除。你可以按照这个截图指南来[修复下载仓库信息失败错误][3]。 + +### 下载包文件失败错误 ### + +一个类似的错误是[下载包文件失败错误][4],像这样: + +![](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) + +### 部分更新错误 ### + +在终端中运行更新会出现[部分更新错误][5]: + +> Not all updates can be installed +> +> Run a partial upgrade, to install as many updates as possible + +在终端中运行以下命令来修复该错误: + + sudo apt-get install -f + +### 加载共享库时发生错误 ### + +该错误更多是安装错误,而不是更新错误。如果尝试从源码安装程序,你可能会碰到这个错误: + +> error while loading shared libraries: +> +> cannot open shared object file: No such file or directory + +该错误可以通过在终端中运行以下命令来修复: + + sudo /sbin/ldconfig -v + +你可以在这里查找到更多详细内容[加载共享库时发生错误][6]。 + +### 无法获取锁/var/cache/apt/archives/lock ### + +在另一个程序在使用APT时,会发生该错误。假定你正在Ubuntu软件中心安装某个东西,然后你又试着在终端中运行apt。 + +> E: Could not get lock /var/cache/apt/archives/lock – open (11: Resource temporarily unavailable) +> +> E: Unable to lock directory /var/cache/apt/archives/ + +通常,只要你把所有其它使用apt的程序关了,这个问题就会好的。但是,如果问题持续,可以使用以下命令: + + sudo rm /var/lib/apt/lists/lock + +如果上面的命令不起作用,可以试试这个命令: + + sudo killall apt-get + +关于该错误的更多信息,可以在[这里][7]找到。 + +### GPG错误: 下列签名无法验证 ### + +在添加一个PPA时,可能会导致以下错误[GPG错误: 下列签名无法验证][8],这通常发生在终端中运行更新时: + +> W: GPG error: http://repo.mate-desktop.org saucy InRelease: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY 68980A0EA10B4DE8 + +我们所要做的,就是获取系统中的这个公钥,从信息中获取密钥号。在上述信息中,密钥号为68980A0EA10B4DE8。该密钥可通过以下方式使用: + + sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 68980A0EA10B4DE8 + +在添加密钥后,再次运行更新就没有问题了。 + +### BADSIG错误 ### + +另外一个与签名相关的Ubuntu更新错误是[BADSIG错误][9],它看起来像这样: + +> W: A error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: http://extras.ubuntu.com precise Release: The following signatures were invalid: BADSIG 16126D3A3E5C1192 Ubuntu Extras Archive Automatic Signing Key +> +> W: GPG error: http://ppa.launchpad.net precise Release: +> +> The following signatures were invalid: BADSIG 4C1CBC1B69B0E2F4 Launchpad PPA for Jonathan French W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/precise/Release + +要修复该BADSIG错误,请在终端中使用以下命令: + + sudo apt-get clean + cd /var/lib/apt + sudo mv lists oldlist + sudo mkdir -p lists/partial + sudo apt-get clean + sudo apt-get update + +本文汇集了你可能会碰到的**Ubuntu更新错误**,我希望这会对你处理这些错误有所帮助。你在Ubuntu中是否也碰到过其它更新错误呢?请在下面的评论中告诉我,我会试着写个快速指南。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/fix-update-errors-ubuntu-1404/ + +作者:[Abhishek][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://itsfoss.com/how-to-fix-problem-with-mergelist/ +[2]:http://itsfoss.com/solve-ubuntu-error-failed-to-download-repository-information-check-your-internet-connection/ +[3]:http://itsfoss.com/failed-to-download-repository-information-ubuntu-13-04/ +[4]:http://itsfoss.com/fix-failed-download-package-files-error-ubuntu/ +[5]:http://itsfoss.com/fix-partial-upgrade-error-elementary-os-luna-quick-tip/ +[6]:http://itsfoss.com/solve-open-shared-object-file-quick-tip/ +[7]:http://itsfoss.com/fix-ubuntu-install-error/ +[8]:http://itsfoss.com/solve-gpg-error-signatures-verified-ubuntu/ +[9]:http://itsfoss.com/solve-badsig-error-quick-tip/ diff --git a/translated/tech/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md b/translated/tech/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md new file mode 100644 index 0000000000..efa807f2f3 --- /dev/null +++ b/translated/tech/20150512 45 Zypper Commands to Manage 'Suse' Linux Package Management.md @@ -0,0 +1,767 @@ +45 个用于 ‘Suse‘ Linux 包管理的 Zypper 命令 +====================================================================== +SUSE( Software and System Entwicklung,即软件和系统开发。其中‘entwicklung‘是德语,意为开发)Linux是 Novell 公司在 Linux 内核基础上发布的操作系统。SUSE Linux 有两个发行分支。其中之一名为 OpenSUSE,这是一款自由而且免费的操作系统。该系统由开源社区开发维护,支持一些最新版本的应用软件,其最新的稳定版本为 13.2。 + +另外一个分支是SUSE Linux 企业版。该分支是一个为企业及商业化产品设计的 Linux 发行版,包含了大量的企业应用以及适用于商业产品生产环境的特性。其最新的稳定版本为 12。 + +以下的链接包含了安装企业版 SUSE Linux 服务器的详细信息。 + +- [如何安装企业版 SUSE Linux 12][1] + +Zypper 和 Yast 是 SUSE Linux 平台上的软件包管理工具,他们的底层使用了 RPM(译者注:RPM 最初指 Redhat Pacakge Manager ,现普遍解释为递归短语 RPM Package Manager 的缩写)。 + +Yast(Yet another Setup Tool )是 OpenSUSE 以及企业版 SUSE 上用于系统管理、设置和配置的工具。 + +Zypper 是软件包管理器ZYpp的命令行接口,可用于安装、删除SUSE Linux上的软件以及进行系统更新。ZYpp为Zypper和Yast提供底层支持。 + +本文将介绍实际应用中常见的一些Zypper命令。这些命令用来进行安装、更新、删除等任何软件包管理器所能够胜任的工作。 + +**重要** : 切记所有的这些指令都将在系统全局范围内产生影响,所以必须以 root 身份执行,否则命令将失败。 + +### 获取基本的 Zypper 帮助信息 ### + +1. 不带任何选项的执行 zypper, 将输出该命令的全局选项以及子命令列表(译者注:全局选项,global option,控制台命令的输入分为可选参数和位置参数两大类。按照习惯,一般可选参数称为选项'option',而位置参数称为参数 'argument')。 + +
%>  zypper
+        Usage:
+        zypper [--global-options]
+ +2. 获取一个具体的子命令的帮助信息,比如 'in' (install),可以执行下面的命令 + +
%> zypper help in
+ 或者 +
%> zypper help install
+    install (in) [options] {capability | rpm_file_uri}
+    
+    Install packages with specified capabilities or RPM files with specified
+    location. A capability is NAME[.ARCH][OP], where OP is one
+    of <, <=, =, >=, >.
+    
+      Command options:
+    --from     Select packages from the specified repository.
+    -r, --repo     Load only the specified repository.
+    -t, --type            Type of package (package, patch, pattern, product, srcpackage).
+                                Default: package.
+    -n, --name                  Select packages by plain name, not by capability.
+    -C, --capability            Select packages by capability.
+    -f, --force                 Install even if the item is already installed (reinstall),
+                                downgraded or changes vendor or architecture.
+        --oldpackage            Allow to replace a newer item with an older one.
+                                Handy if you are doing a rollback. Unlike --force
+                                it will not enforce a reinstall.
+        --replacefiles          Install the packages even if they replace files from other,
+                                already installed, packages. Default is to treat file conflicts
+                                as an error. --download-as-needed disables the fileconflict check.
+    ...... 
+ +3. 安装之前搜索一个安转包(以 gnome-desktop 为例 ) + +
# zypper se gnome-desktop
+    
+    Retrieving repository 'openSUSE-13.2-Debug' metadata ............................................................[done]
+    Building repository 'openSUSE-13.2-Debug' cache .................................................................[done]
+    Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ......................................................... [done]
+    Building repository 'openSUSE-13.2-Non-Oss' cache ...............................................................[done]
+    Retrieving repository 'openSUSE-13.2-Oss' metadata ..............................................................[done]
+    Building repository 'openSUSE-13.2-Oss' cache ...................................................................[done]
+    Retrieving repository 'openSUSE-13.2-Update' metadata ...........................................................[done]
+    Building repository 'openSUSE-13.2-Update' cache ................................................................[done]
+    Retrieving repository 'openSUSE-13.2-Update-Non-Oss' metadata ...................................................[done]
+    Building repository 'openSUSE-13.2-Update-Non-Oss' cache ........................................................[done]
+    Loading repository data...
+    Reading installed packages...
+    
+    S | Name                                  | Summary                                                   | Type
+    --+---------------------------------------+-----------------------------------------------------------+-----------
+      | gnome-desktop2-lang                   | Languages for package gnome-desktop2                      | package
+      | gnome-desktop2                        | The GNOME Desktop API Library                             | package
+      | libgnome-desktop-2-17                 | The GNOME Desktop API Library                             | package
+      | libgnome-desktop-3-10                 | The GNOME Desktop API Library                             | package
+      | libgnome-desktop-3-devel              | The GNOME Desktop API Library -- Development Files        | package
+      | libgnome-desktop-3_0-common           | The GNOME Desktop API Library -- Common data files        | package
+      | gnome-desktop-debugsource             | Debug sources for package gnome-desktop                   | package
+      | gnome-desktop-sharp2-debugsource      | Debug sources for package gnome-desktop-sharp2            | package
+      | gnome-desktop2-debugsource            | Debug sources for package gnome-desktop2                  | package
+      | libgnome-desktop-2-17-debuginfo       | Debug information for package libgnome-desktop-2-17       | package
+      | libgnome-desktop-3-10-debuginfo       | Debug information for package libgnome-desktop-3-10       | package
+      | libgnome-desktop-3_0-common-debuginfo | Debug information for package libgnome-desktop-3_0-common | package
+      | libgnome-desktop-2-17-debuginfo-32bit | Debug information for package libgnome-desktop-2-17       | package
+      | libgnome-desktop-3-10-debuginfo-32bit | Debug information for package libgnome-desktop-3-10       | package
+      | gnome-desktop-sharp2                  | Mono bindings for libgnome-desktop                        | package
+      | libgnome-desktop-2-devel              | The GNOME Desktop API Library -- Development Files        | packag
+      | gnome-desktop-lang                    | Languages for package gnome-desktop                       | package
+      | libgnome-desktop-2-17-32bit           | The GNOME Desktop API Library                             | package
+      | libgnome-desktop-3-10-32bit           | The GNOME Desktop API Library                             | package
+      | gnome-desktop                         | The GNOME Desktop API Library                             | srcpackage
+ +4. 获取一个模式包的信息(以 lamp_server 为例)。 + +
%> zypper info -t pattern lamp_server
+    
+    Loading repository data...
+    Reading installed packages...
+    
+    
+    Information for pattern lamp_server:
+    ------------------------------------
+    Repository: openSUSE-13.2-Update
+    Name: lamp_server
+    Version: 20141007-5.1
+    Arch: x86_64
+    Vendor: openSUSE
+    Installed: No
+    Visible to User: Yes
+    Summary: Web and LAMP Server
+    Description: 
+      Software to set up a Web server that is able to serve static, dynamic, and interactive content (like a Web shop). This includes Apache HTTP Server, the database management system MySQL,
+      and scripting languages such as PHP, Python, Ruby on Rails, or Perl.
+    Contents:
+    
+    S | Name                          | Type    | Dependency
+    --+-------------------------------+---------+-----------
+      | apache2-mod_php5              | package |
+      | php5-iconv                    | package |
+    i | patterns-openSUSE-base        | package |
+    i | apache2-prefork               | package |
+      | php5-dom                      | package |
+      | php5-mysql                    | package |
+    i | apache2                       | package |
+      | apache2-example-pages         | package |
+      | mariadb                       | package |
+      | apache2-mod_perl              | package |
+      | php5-ctype                    | package |
+      | apache2-doc                   | package |
+      | yast2-http-server             | package |
+      | patterns-openSUSE-lamp_server | package |
+ +5. 开启一个Zypper Shell 的会话。 + +
 %>zypper shell 
+ 或者 +
 %>zypper sh 
+ +
zypper> help
+      Usage:
+    	zypper [--global-options]
+ +**注意**:在 Zypper shell里面可以通过键入 ‘help‘ 获得全局选项以及子命令的列表。 +### Zypper 软件库管理 ### + +#### 列举已定义的软件库 #### + +6. 使用 'zypper repos' 或者 'zypper lr' 来列举所有已定以的软件库。 + +
%> zypper repos
+ 或者 +
%> zypper lr
+      | Alias                     | Name                               | Enabled | Refresh
+    --+---------------------------+------------------------------------+---------+--------
+    1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No
+    2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes
+    3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes
+    4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes
+    5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes
+    6 | repo-oss                  | openSUSE-13.2-Oss                  | Yes     | Yes
+    7 | repo-source               | openSUSE-13.2-Source               | No      | Yes
+    8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes
+    9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes
+ +7. 在表格里面显示 zypper URI + +
# zypper lr -u
+      | Alias                     | Name                               | Enabled | Refresh | URI
+    --+---------------------------+------------------------------------+---------+---------+----------------------------------------------------------------
+    1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No      | cd:///?devices=/dev/disk/by-id/ata-VBOX_CD-ROM_VB2-01700376
+    2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes     | http://download.opensuse.org/debug/distribution/13.2/repo/oss/
+    3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes     | http://download.opensuse.org/debug/update/13.2/
+    4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes     | http://download.opensuse.org/debug/update/13.2-non-oss/
+    5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes     | http://download.opensuse.org/distribution/13.2/repo/non-oss/
+    6 | repo-oss                  | openSUSE-13.2-Oss                  | Yes     | Yes     | http://download.opensuse.org/distribution/13.2/repo/oss/
+    7 | repo-source               | openSUSE-13.2-Source               | No      | Yes     | http://download.opensuse.org/source/distribution/13.2/repo/oss/
+    8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes     | http://download.opensuse.org/update/13.2/
+    9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes     | http://download.opensuse.org/update/13.2-non-oss/
+ +8. 根据优先级列举软件库。 + +
%> zypper lr -P
+      | Alias                     | Name                               | Enabled | Refresh | Priority
+    --+---------------------------+------------------------------------+---------+---------+---------
+    1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No      |   99
+    2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes     |   99
+    3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes     |   99
+    4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes     |   99
+    5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes     |   85
+    6 | repo-oss                  | openSUSE-13.2-Oss                  | Yes     | Yes     |   99
+    7 | repo-source               | openSUSE-13.2-Source               | No      | Yes     |   99
+    8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes     |   99
+    9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes     |   99
+ +#### 刷新软件库 #### + +9. 使用 'zypper refresh' or 'zypper ref' 来刷新 zypper 软件库。 + +
%> zypper refresh 
+ 或者 +
%> 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.
+    Repository 'openSUSE-13.2-Oss' is up to date.
+    Repository 'openSUSE-13.2-Update' is up to date.
+    Repository 'openSUSE-13.2-Update-Non-Oss' is up to date.
+    All repositories have been refreshed. 
+ +10. 刷新一个指定的软件库(以 'repo-non-oss' 为例 )。 + +
%> zypper refresh repo-non-oss
+    Repository 'openSUSE-13.2-Non-Oss' is up to date.
+    Specified repositories have been refreshed. 
+ +11. 强制更新一个软件库(以 'repo-non-oss' 为例 )。 + +
%> zypper ref -f repo-non-oss 
+    Forcing raw metadata refresh
+    Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ............................................................[done]
+    Forcing building of repository cache
+    Building repository 'openSUSE-13.2-Non-Oss' cache ............................................................[done]
+    Specified repositories have been refreshed.
+ +#### 修改软件库 #### + +本文中我们使用‘zypper modifyrepo‘ 或者 ‘zypper mr‘ 来关闭或者开启 zypper 软件库。 + +12. 在关闭一个软件库之前,我们需要知道在 zypper中,每一个软件库有一个唯一的标示数字与之关联,该数字用于打开或者关闭与之相联系的软件库。假设我们需要关闭 'repo-oss' 软件库,那么我们可以通过以下的法来获得该软件库的标志数字。 + +
%> zypper lr
+      | Alias                     | Name                               | Enabled | Refresh
+    --+---------------------------+------------------------------------+---------+--------
+    1 | openSUSE-13.2-0           | openSUSE-13.2-0                    | Yes     | No
+    2 | repo-debug                | openSUSE-13.2-Debug                | Yes     | Yes
+    3 | repo-debug-update         | openSUSE-13.2-Update-Debug         | No      | Yes
+    4 | repo-debug-update-non-oss | openSUSE-13.2-Update-Debug-Non-Oss | No      | Yes
+    5 | repo-non-oss              | openSUSE-13.2-Non-Oss              | Yes     | Yes
+    6 | repo-oss                  | openSUSE-13.2-Oss                  | No      | Yes
+    7 | repo-source               | openSUSE-13.2-Source               | No      | Yes
+    8 | repo-update               | openSUSE-13.2-Update               | Yes     | Yes
+    9 | repo-update-non-oss       | openSUSE-13.2-Update-Non-Oss       | Yes     | Yes
+从以上输出的列表中我们可以看到 'repo-oss' 库的标示数字是 6,因此通过以下的命令来关闭该库。 + +
%> zypper mr -d 6
+    Repository 'repo-oss' has been successfully disabled.
+ +13. 如果需要再次开启软件库 ‘repo-oss‘, 接上例,与之相关联的标示数字为 6。 + +
%> zypper mr -e 6
+    Repository 'repo-oss' has been successfully enabled.
+ +14. 针对某一个软件库(以 'repo-non-oss' 为例 )开启自动刷新( auto-refresh )和 rpm 缓存,并设置该软件库的优先级,比如85。 + +
%> zypper mr -rk -p 85 repo-non-oss
+    Repository 'repo-non-oss' priority has been left unchanged (85)
+    Nothing to change for repository 'repo-non-oss'.
+ +15. 对所有的软件库关闭 rpm 文件缓存。 + +
%> 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'.
+    RPM files caching has been disabled for repository 'repo-debug-update-non-oss'.
+    RPM files caching has been disabled for repository 'repo-non-oss'.
+    RPM files caching has been disabled for repository 'repo-oss'.
+    RPM files caching has been disabled for repository 'repo-source'.
+    RPM files caching has been disabled for repository 'repo-update'.
+    RPM files caching has been disabled for repository 'repo-update-non-oss'.
+ +16. 对所有的软件库开启 rpm 文件缓存。 +
 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'.
+    RPM files caching has been enabled for repository 'repo-debug-update-non-oss'.
+    RPM files caching has been enabled for repository 'repo-non-oss'.
+    RPM files caching has been enabled for repository 'repo-oss'.
+    RPM files caching has been enabled for repository 'repo-source'.
+    RPM files caching has been enabled for repository 'repo-update'.
+    RPM files caching has been enabled for repository 'repo-update-non-oss'.
+ +17. 关闭远程库的rpm 文件缓存 +
%> zypper mr -Kt
+    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'.
+    RPM files caching has been disabled for repository 'repo-non-oss'.
+    RPM files caching has been disabled for repository 'repo-oss'.
+    RPM files caching has been disabled for repository 'repo-source'.
+    RPM files caching has been disabled for repository 'repo-update'.
+    RPM files caching has been disabled for repository 'repo-update-non-oss'.
+ +18. 开启远程软件库的 rpm 文件缓存。 +
%> 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'.
+    RPM files caching has been enabled for repository 'repo-non-oss'.
+    RPM files caching has been enabled for repository 'repo-oss'.
+    RPM files caching has been enabled for repository 'repo-source'.
+    RPM files caching has been enabled for repository 'repo-update'.
+    RPM files caching has been enabled for repository 'repo-update-non-oss'.
+ +#### 增加新的软件库 #### + +可以通过这两个 zypper 指令 – 'zypper addrepo' 和 'zypper ar' 来增加新的软件库。在此过程中可以使用 URL 或者软件库的别名。 + +19. 增加一个新的软件库( 以 “http://download.opensuse.org/update/12.3/” 为例 )。 + +
%>  zypper ar http://download.opensuse.org/update/11.1/ update
+    Adding repository 'update' .............................................................................................................................................................[done]
+    Repository 'update' successfully added
+    Enabled     : Yes
+    Autorefresh : No
+    GPG check   : Yes
+    URI         : http://download.opensuse.org/update/11.1/
+ +20. 更改一个软件库的名字,这将仅仅改变软件库的别名。 命令 'zypper namerepo' 或者 'zypperr nr' 可以胜任此工作。例如更改标示数字为10的软件库的名字为 'upd8',或者说将标示数字为10的软件库的别名改为 'upd8',可以使用下面的命令。 + +
%> zypper nr 10 upd8
+    Repository 'update' renamed to 'upd8'.
+ +#### 删除软件库 #### + +21. 删除一个软件库。要从系统删除一个软件库可以使 'zypper removerepo' 或者 'zypper rr'。例如以下的命令可以删除软件库 'upd8' + +
%> zypper rr upd8
+    # Removing repository 'upd8' .........................................................................................[done]
+    Repository 'upd8' has been removed.
+ +### 使用 zypper 进行软件包管理 ### + +#### 用 zypper 安装一个软件包 #### + +22. 在 zypper 中,我们可以通过软件包的功能名称来安装一个软件包。以 Firefox 为例,以下的命令可以用来安装该软件包。 +
%> zypper in MozillaFirefox
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 128 NEW packages are going to be installed:
+      adwaita-icon-theme at-spi2-atk-common at-spi2-atk-gtk2 at-spi2-core cantarell-fonts cups-libs desktop-file-utils fontconfig gdk-pixbuf-query-loaders gstreamer gstreamer-fluendo-mp3
+      gstreamer-plugins-base gtk2-branding-openSUSE gtk2-data gtk2-immodule-amharic gtk2-immodule-inuktitut gtk2-immodule-thai gtk2-immodule-vietnamese gtk2-metatheme-adwaita
+      gtk2-theming-engine-adwaita gtk2-tools gtk3-data gtk3-metatheme-adwaita gtk3-tools hicolor-icon-theme hicolor-icon-theme-branding-openSUSE libasound2 libatk-1_0-0 libatk-bridge-2_0-0
+      libatspi0 libcairo2 libcairo-gobject2 libcanberra0 libcanberra-gtk0 libcanberra-gtk2-module libcanberra-gtk3-0 libcanberra-gtk3-module libcanberra-gtk-module-common libcdda_interface0
+      libcdda_paranoia0 libcolord2 libdrm2 libdrm_intel1 libdrm_nouveau2 libdrm_radeon1 libFLAC8 libfreebl3 libgbm1 libgdk_pixbuf-2_0-0 libgraphite2-3 libgstapp-1_0-0 libgstaudio-1_0-0
+      libgstpbutils-1_0-0 libgstreamer-1_0-0 libgstriff-1_0-0 libgsttag-1_0-0 libgstvideo-1_0-0 libgthread-2_0-0 libgtk-2_0-0 libgtk-3-0 libharfbuzz0 libjasper1 libjbig2 libjpeg8 libjson-c2
+      liblcms2-2 libLLVM libltdl7 libnsssharedhelper0 libogg0 liborc-0_4-0 libpackagekit-glib2-18 libpango-1_0-0 libpciaccess0 libpixman-1-0 libpulse0 libsndfile1 libsoftokn3 libspeex1
+      libsqlite3-0 libstartup-notification-1-0 libtheoradec1 libtheoraenc1 libtiff5 libvisual libvorbis0 libvorbisenc2 libvorbisfile3 libwayland-client0 libwayland-cursor0 libwayland-server0
+      libX11-xcb1 libxcb-dri2-0 libxcb-dri3-0 libxcb-glx0 libxcb-present0 libxcb-render0 libxcb-shm0 libxcb-sync1 libxcb-util1 libxcb-xfixes0 libXcomposite1 libXcursor1 libXdamage1 libXevie1
+      libXfixes3 libXft2 libXi6 libXinerama1 libxkbcommon-0_4_3 libXrandr2 libXrender1 libxshmfence1 libXtst6 libXv1 libXxf86vm1 Mesa Mesa-libEGL1 Mesa-libGL1 Mesa-libglapi0
+      metatheme-adwaita-common MozillaFirefox MozillaFirefox-branding-openSUSE mozilla-nss mozilla-nss-certs PackageKit-gstreamer-plugin pango-tools sound-theme-freedesktop
+
+    The following 10 recommended packages were automatically selected:
+      gstreamer-fluendo-mp3 gtk2-branding-openSUSE gtk2-data gtk2-immodule-amharic gtk2-immodule-inuktitut gtk2-immodule-thai gtk2-immodule-vietnamese libcanberra0 libpulse0
+      PackageKit-gstreamer-plugin
+    
+    128 new packages to install.
+    Overall download size: 77.2 MiB. Already cached: 0 B  After the operation, additional 200.0 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y
+    Retrieving package cantarell-fonts-0.0.16-1.1.noarch                                                                                                   (1/128),  74.1 KiB (115.6 KiB unpacked)
+    Retrieving: cantarell-fonts-0.0.16-1.1.noarch.rpm .........................................................................................................................[done (63.4 KiB/s)]
+    Retrieving package hicolor-icon-theme-0.13-2.1.2.noarch                                                                                                (2/128),  40.1 KiB ( 50.5 KiB unpacked)
+    Retrieving: hicolor-icon-theme-0.13-2.1.2.noarch.rpm ...................................................................................................................................[done]
+    Retrieving package sound-theme-freedesktop-0.8-7.1.2.noarch                                                                                            (3/128), 372.6 KiB (460.3 KiB unpacked) 
+ +23. 安装指定版本号的软件包,(以 gcc 5.1 为例)。 +
 %>zypper in 'gcc<5.1'
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 13 NEW packages are going to be installed:
+      cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49
+
+    13 new packages to install.
+    Overall download size: 14.5 MiB. Already cached: 0 B  After the operation, additional 49.4 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y 
+ +24. 为特定的CPU架构安装软件包(以兼容 i586 的 gcc 为例)。 + +
%> zypper in gcc.i586
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 13 NEW packages are going to be installed:
+      cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49
+
+    13 new packages to install.
+    Overall download size: 14.5 MiB. Already cached: 0 B  After the operation, additional 49.4 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y
+    Retrieving package libasan0-4.8.3+r212056-2.2.4.x86_64                                                                                                  (1/13),  74.2 KiB (166.9 KiB unpacked)
+    Retrieving: libasan0-4.8.3+r212056-2.2.4.x86_64.rpm .......................................................................................................................[done (79.2 KiB/s)]
+    Retrieving package libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64                                                                                          (2/13),  14.3 KiB ( 26.1 KiB unpacked)
+    Retrieving: libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm ...............................................................................................................[done (55.3 KiB/s)] 
+ +25. 为特定的CPU架构安装指定版本号的软件包(以兼容 i586 且版本低于5.1的 gcc 为例) + +
%> zypper in 'gcc.i586<5.1'
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 13 NEW packages are going to be installed:
+      cpp cpp48 gcc gcc48 libasan0 libatomic1-gcc49 libcloog-isl4 libgomp1-gcc49 libisl10 libitm1-gcc49 libmpc3 libmpfr4 libtsan0-gcc49
+
+    13 new packages to install.
+    Overall download size: 14.4 MiB. Already cached: 129.5 KiB  After the operation, additional 49.4 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y
+    In cache libasan0-4.8.3+r212056-2.2.4.x86_64.rpm                                                                                                        (1/13),  74.2 KiB (166.9 KiB unpacked)
+    In cache libatomic1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm                                           (2/13),  14.3 KiB ( 26.1 KiB unpacked)
+    In cache libgomp1-gcc49-4.9.0+r211729-2.1.7.x86_64.rpm                                             (3/13),  41.1 KiB ( 90.7 KiB unpacked) 
+ +26. 从指定的软件库里面安装一个软件包,例如从 amarok 中安装 libxine。 +
%> zypper in amarok upd:libxine1
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+    The following 202 NEW packages are going to be installed:
+      amarok bundle-lang-kde-en clamz cups-libs enscript fontconfig gdk-pixbuf-query-loaders ghostscript-fonts-std gptfdisk gstreamer gstreamer-plugins-base hicolor-icon-theme
+      hicolor-icon-theme-branding-openSUSE htdig hunspell hunspell-tools icoutils ispell ispell-american kde4-filesystem kdebase4-runtime kdebase4-runtime-branding-openSUSE kdelibs4
+      kdelibs4-branding-openSUSE kdelibs4-core kdialog libakonadi4 l
+    .....
+ +27. 通过指定软件包的名字安装软件包。 + +
%> zypper in -n git
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 35 NEW packages are going to be installed:
+      cvs cvsps fontconfig git git-core git-cvs git-email git-gui gitk git-svn git-web libserf-1-1 libsqlite3-0 libXft2 libXrender1 libXss1 perl-Authen-SASL perl-Clone perl-DBD-SQLite perl-DBI
+      perl-Error perl-IO-Socket-SSL perl-MLDBM perl-Net-Daemon perl-Net-SMTP-SSL perl-Net-SSLeay perl-Params-Util perl-PlRPC perl-SQL-Statement perl-Term-ReadKey subversion subversion-perl tcl
+      tk xhost
+
+    The following 13 recommended packages were automatically selected:
+      git-cvs git-email git-gui gitk git-svn git-web perl-Authen-SASL perl-Clone perl-MLDBM perl-Net-Daemon perl-Net-SMTP-SSL perl-PlRPC perl-SQL-Statement
+
+    The following package is suggested, but will not be installed:
+      git-daemon
+
+    35 new packages to install.
+    Overall download size: 15.6 MiB. Already cached: 0 B  After the operation, additional 56.7 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y 
+ +28. 通过通配符来安装软件包,例如,安装所有 php5 的软件包。 +
%> zypper in php5*
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    Problem: php5-5.6.1-18.1.x86_64 requires smtp_daemon, but this requirement cannot be provided
+      uninstallable providers: exim-4.83-3.1.8.x86_64[openSUSE-13.2-0]
+                       postfix-2.11.0-5.2.2.x86_64[openSUSE-13.2-0]
+                       sendmail-8.14.9-2.2.2.x86_64[openSUSE-13.2-0]
+                       exim-4.83-3.1.8.i586[repo-oss]
+                       msmtp-mta-1.4.32-2.1.3.i586[repo-oss]
+                       postfix-2.11.0-5.2.2.i586[repo-oss]
+                       sendmail-8.14.9-2.2.2.i586[repo-oss]
+                       exim-4.83-3.1.8.x86_64[repo-oss]
+                       msmtp-mta-1.4.32-2.1.3.x86_64[repo-oss]
+                       postfix-2.11.0-5.2.2.x86_64[repo-oss]
+                       sendmail-8.14.9-2.2.2.x86_64[repo-oss]
+                       postfix-2.11.3-5.5.1.i586[repo-update]
+                       postfix-2.11.3-5.5.1.x86_64[repo-update]
+     Solution 1: Following actions will be done:
+      do not install php5-5.6.1-18.1.x86_64
+      do not install php5-pear-Auth_SASL-1.0.6-7.1.3.noarch
+      do not install php5-pear-Horde_Http-2.0.1-6.1.3.noarch
+      do not install php5-pear-Horde_Image-2.0.1-6.1.3.noarch
+      do not install php5-pear-Horde_Kolab_Format-2.0.1-6.1.3.noarch
+      do not install php5-pear-Horde_Ldap-2.0.1-6.1.3.noarch
+      do not install php5-pear-Horde_Memcache-2.0.1-7.1.3.noarch
+      do not install php5-pear-Horde_Mime-2.0.2-6.1.3.noarch
+      do not install php5-pear-Horde_Oauth-2.0.0-6.1.3.noarch
+      do not install php5-pear-Horde_Pdf-2.0.1-6.1.3.noarch
+    ....
+ +29. 使用模式名称(模式名称是一类软件包的名字)来批量安装软件包 + +
%> zypper in -t pattern lamp_server
+    ading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 29 NEW packages are going to be installed:
+      apache2 apache2-doc apache2-example-pages apache2-mod_perl apache2-prefork patterns-openSUSE-lamp_server perl-Data-Dump perl-Encode-Locale perl-File-Listing perl-HTML-Parser
+      perl-HTML-Tagset perl-HTTP-Cookies perl-HTTP-Daemon perl-HTTP-Date perl-HTTP-Message perl-HTTP-Negotiate perl-IO-HTML perl-IO-Socket-SSL perl-libwww-perl perl-Linux-Pid
+      perl-LWP-MediaTypes perl-LWP-Protocol-https perl-Net-HTTP perl-Net-SSLeay perl-Tie-IxHash perl-TimeDate perl-URI perl-WWW-RobotRules yast2-http-server
+
+    The following NEW pattern is going to be installed:
+      lamp_server
+
+    The following 10 recommended packages were automatically selected:
+      apache2 apache2-doc apache2-example-pages apache2-mod_perl apache2-prefork perl-Data-Dump perl-IO-Socket-SSL perl-LWP-Protocol-https perl-TimeDate yast2-http-server
+
+    29 new packages to install.
+    Overall download size: 7.2 MiB. Already cached: 1.2 MiB  After the operation, additional 34.7 MiB will be used.
+    Continue? [y/n/? shows all options] (y): 
+ +30. 使用一行命令安转一个软件包同时卸载另一个软件包,例如在安装 nano 的同时卸载 vi + +
# zypper in nano -vi
+    Loading repository data...
+    Reading installed packages...
+    '-vi' not found in package names. Trying capabilities.
+    Resolving package dependencies...
+
+    The following 2 NEW packages are going to be installed:
+      nano nano-lang
+
+    The following package is going to be REMOVED:
+      vim
+
+    The following recommended package was automatically selected:
+      nano-lang
+
+    2 new packages to install, 1 to remove.
+    Overall download size: 550.0 KiB. Already cached: 0 B  After the operation, 463.3 KiB will be freed.
+    Continue? [y/n/? shows all options] (y):
+    ...
+ +31. 使用 zypper 安装 rpm 软件包。 + +
%> zypper in teamviewer*.rpm
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 24 NEW packages are going to be installed:
+      alsa-oss-32bit fontconfig-32bit libasound2-32bit libexpat1-32bit libfreetype6-32bit libgcc_s1-gcc49-32bit libICE6-32bit libjpeg62-32bit libpng12-0-32bit libpng16-16-32bit libSM6-32bit
+      libuuid1-32bit libX11-6-32bit libXau6-32bit libxcb1-32bit libXdamage1-32bit libXext6-32bit libXfixes3-32bit libXinerama1-32bit libXrandr2-32bit libXrender1-32bit libXtst6-32bit
+      libz1-32bit teamviewer
+
+    The following recommended package was automatically selected:
+      alsa-oss-32bit
+
+    24 new packages to install.
+    Overall download size: 41.2 MiB. Already cached: 0 B  After the operation, additional 119.7 MiB will be used.
+    Continue? [y/n/? shows all options] (y):
+    ..
+ +#### 使用 zypper 卸载软件包 #### + +32. 命令 ‘zypper remove‘ 和 ‘zypper rm‘ 用于卸载软件包。例如卸载 apache2: + +
%> zypper remove apache2 
+ 或者 +
%> zypper rm apache2
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following 2 packages are going to be REMOVED:
+      apache2 apache2-prefork
+
+    2 packages to remove.
+    After the operation, 4.2 MiB will be freed.
+    Continue? [y/n/? shows all options] (y): y
+    (1/2) Removing apache2-2.4.10-19.1 ........................................................................[done]
+    (2/2) Removing apache2-prefork-2.4.10-19.1 ................................................................[done] 
+ +#### 使用Zypper 进行软件包更新 #### + +33. 更新所有的软件包,可以使用 ‘zypper update‘ 或者 ‘zypper up‘。 + +
%> zypper up 
+ 或者 +
%> zypper update
+
+    Loading repository data...
+    Reading installed packages...
+    Nothing to do. 
+ +34. 更新指定的软件包,例如更新 apache2 以及 openssh。 + +
 zypper up apache2 openssh
+    Loading repository data...
+    Reading installed packages...
+    No update candidate for 'apache2-2.4.10-19.1.x86_64'. The highest available version is already installed.
+    No update candidate for 'openssh-6.6p1-5.1.3.x86_64'. The highest available version is already installed.
+    Resolving package dependencies...
+
+    Nothing to do.
+ +35. 安装一个软件库,例如 ariadb,如果该库存在则更新之。 + +
%> zypper in mariadb
+    Loading repository data...
+    Reading installed packages...
+    'mariadb' is already installed.
+    No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
+    Resolving package dependencies...
+
+    Nothing to do.
+ +#### 安装源文件并且构建依赖关系 #### + +命令 ‘zypper source-install‘ 或者 ‘zypper si‘ 可以用于从源文件编译软件包 + +36. 安装某一个软件包的源文件及其依赖关系,例如 mariadb。 + +
%> zypper si mariadb
+    Reading installed packages...
+    Loading repository data...
+    Resolving package dependencies...
+
+    The following 36 NEW packages are going to be installed:
+      autoconf automake bison cmake cpp cpp48 gcc gcc48 gcc48-c++ gcc-c++ libaio-devel libarchive13 libasan0 libatomic1-gcc49 libcloog-isl4 libedit-devel libevent-devel libgomp1-gcc49 libisl10
+      libitm1-gcc49 libltdl7 libmpc3 libmpfr4 libopenssl-devel libstdc++48-devel libtool libtsan0-gcc49 m4 make ncurses-devel pam-devel readline-devel site-config tack tcpd-devel zlib-devel
+
+    The following source package is going to be installed:
+      mariadb
+
+    36 new packages to install, 1 source package.
+    Overall download size: 71.5 MiB. Already cached: 129.5 KiB  After the operation, additional 183.9 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y 
+ +37. 仅为某一个软件包安装源文件,例如 mariadb + +
%> zypper in -D mariadb
+    Loading repository data...
+    Reading installed packages...
+    'mariadb' is already installed.
+    No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
+    Resolving package dependencies...
+
+    Nothing to do. 
+ +38. 仅为某一个软件包安装依赖关系,例如 mariadb + +
%> zypper si -d mariadb
+    Reading installed packages...
+    Loading repository data...
+    Resolving package dependencies...
+
+    The following 36 NEW packages are going to be installed:
+      autoconf automake bison cmake cpp cpp48 gcc gcc48 gcc48-c++ gcc-c++ libaio-devel libarchive13 libasan0 libatomic1-gcc49 libcloog-isl4 libedit-devel libevent-devel libgomp1-gcc49 libisl10
+      libitm1-gcc49 libltdl7 libmpc3 libmpfr4 libopenssl-devel libstdc++48-devel libtool libtsan0-gcc49 m4 make ncurses-devel pam-devel readline-devel site-config tack tcpd-devel zlib-devel
+
+    The following package is recommended, but will not be installed due to conflicts or dependency issues:
+      readline-doc
+
+    36 new packages to install.
+    Overall download size: 33.7 MiB. Already cached: 129.5 KiB  After the operation, additional 144.3 MiB will be used.
+    Continue? [y/n/? shows all options] (y): y
+ +#### Zypper in Scripts and Applications #### + +39. 安装一个软件包,并且在安装过程中跳过与用户的交互, 例如 mariadb。 + +
%> zypper --non-interactive in mariadb
+    Loading repository data...
+    Reading installed packages...
+    'mariadb' is already installed.
+    No update candidate for 'mariadb-10.0.13-2.6.1.x86_64'. The highest available version is already installed.
+    Resolving package dependencies...
+
+    Nothing to do.
+ +40. 卸载一个软件包,并且在卸载过程中跳过与用户的交互,例如 mariadb + +
%> zypper --non-interactive rm mariadb
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    The following package is going to be REMOVED:
+      mariadb
+
+    1 package to remove.
+    After the operation, 71.8 MiB will be freed.
+    Continue? [y/n/? shows all options] (y): y
+    (1/1) Removing mariadb-10.0.13-2.6.1 .............................................................................[done] 
+ +41. 将 zypper 输出用 XML 格式打印。 + +
%> zypper --xmlout
+      Usage:
+    	zypper [--global-options]  [--command-options] [arguments]
+
+      Global Options
+    ....
+ +42. 禁止详细信息输出到屏幕。 + +
%> zypper --quiet in mariadb
+    The following NEW package is going to be installed:
+      mariadb
+
+    1 new package to install.
+    Overall download size: 0 B. Already cached: 7.8 MiB  After the operation, additional 71.8 MiB will be used.
+    Continue? [y/n/? shows all options] (y):
+    ...
+ +43. 在卸载过程中禁止详细信息输出到屏幕 + +
%> zypper --quiet rm mariadb 
+ +44. 自动地同意版权或者协议。 +
%> zypper patch --auto-agree-with-licenses
+    Loading repository data...
+    Reading installed packages...
+    Resolving package dependencies...
+
+    Nothing to do.
+ +#### 清除 Zypper 缓存以及查看历史信息 #### + +45. 以下指令可以用来清理Zypper缓存。 + +
%> zypper clean
+    All repositories have been cleaned up.
+ +如果需要一次性地清理元数据以及软件包缓存,可以通过 -all/-a 选项来达到目的 + +
%> zypper clean -a
+    All repositories have been cleaned up.
+ +46. 查看 Zypper 的历史信息。籍由 Zypper 所有的软件包管理动作,包括安装、更新以及卸载都会在 /var/log/zypp/history中保留历史信息。可以通过 cat 来查看此文件,或者通过过滤器来筛选希望看到的信息。 + +
 cat /var/log/zypp/history
+    2015-05-07 15:43:03|install|boost-license1_54_0|1.54.0-10.1.3|noarch||openSUSE-13.2-0|0523b909d2aae5239f9841316dafaf3a37b4f096|
+    2015-05-07 15:43:03|install|branding-openSUSE|13.2-3.6.1|noarch||openSUSE-13.2-0|6609def94b1987bf3f90a9467f4f7ab8f8d98a5c|
+    2015-05-07 15:43:03|install|bundle-lang-common-en|13.2-3.3.1|noarch||openSUSE-13.2-0|ca55694e6fdebee6ce37ac7cf3725e2aa6edc342|
+    2015-05-07 15:43:03|install|insserv-compat|0.1-12.2.2|noarch||openSUSE-13.2-0|6160de7fbf961a279591a83a1550093a581214d9|
+    2015-05-07 15:43:03|install|libX11-data|1.6.2-5.1.2|noarch||openSUSE-13.2-0|f1cb58364ba9016c1f93b1a383ba12463c56885a|
+    2015-05-07 15:43:03|install|libnl-config|3.2.25-2.1.2|noarch||openSUSE-13.2-0|aab2ded312a781e93b739b418e3d32fe4e187020|
+    2015-05-07 15:43:04|install|wireless-regdb|2014.06.13-1.2|noarch||openSUSE-13.2-0|be8cb16f3e92af12b5ceb977e37e13f03c007bd1|
+    2015-05-07 15:43:04|install|yast2-trans-en_US|3.1.0-2.1|noarch||openSUSE-13.2-0|1865754e5e0ec3c149ac850b340bcca55a3c404d|
+    2015-05-07 15:43:04|install|yast2-trans-stats|2.19.0-16.1.3|noarch||openSUSE-13.2-0|b107d2b3e702835885b57b04d12d25539f262d1a|
+    2015-05-07 15:43:04|install|cracklib-dict-full|2.8.12-64.1.2|x86_64||openSUSE-13.2-0|08bd45dbba7ad44e3a4837f730be76f55ad5dcfa|
+    ......
+ +#### 使用 Zypper 进行SUSE系统升级 #### + +47. 可以使用 Zypper 命令的 'dist-upgrade' 选项来将当前的SUSE Linux升级至最新版本。 +
# zypper dist-upgrade
+    You are about to do a distribution upgrade with all enabled repositories. Make sure these repositories are compatible before you continue. See 'man zypper' for more information about this command.
+    Building repository 'openSUSE-13.2-0' cache .....................................................................[done]
+    Retrieving repository 'openSUSE-13.2-Debug' metadata ............................................................[done]
+    Building repository 'openSUSE-13.2-Debug' cache .................................................................[done]
+    Retrieving repository 'openSUSE-13.2-Non-Oss' metadata ..........................................................[done]
+    Building repository 'openSUSE-13.2-Non-Oss' cache ...............................................................[done]
+ +正文至此结束。希望本文可以帮助读者尤其是新手们管理SUSE Linux系统和服务器。如果您觉得某些比较重要的命令被作者漏掉了,请在评论部分写下您的返回,作者将根据评论对文章进行更新。保持联络,保持评论,多谢支持。 + +-------------------------------------------------------------------------------- + +原文地址: http://www.tecmint.com/zypper-commands-to-manage-suse-linux-package-management/ + +作者:[Avishek Kumar][a] +译者:[张博约](https://github.com/zhangboyue) +校对:[校对者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/installation-of-suse-linux-enterprise-server-12/ diff --git a/translated/tech/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md b/translated/tech/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md new file mode 100644 index 0000000000..58eb9f18ca --- /dev/null +++ b/translated/tech/20150512 A Shell Script to Monitor Network, Disk Usage, Uptime, Load Average and RAM Usage in Linux.md @@ -0,0 +1,96 @@ +Linux中用于监控网络、磁盘使用、开机时间、平均负载和内存使用率的shell脚本 +================================================================================ +系统管理员的任务真的很艰难,因为他/她必须监控服务器、用户、日志,还得创建备份,等等等等。对于大多数重复性的任务,大多数管理员都会写一个自动化脚本来日复一日重复这些任务。这里,我们已经写了一个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盒子。 + +#### 依赖性 #### + +对于一个标准的Linux发行版,使用此包时没有任何依赖。此外,该脚本不需要root权限来执行。但是,如果你想要安装,则必须输入一次root密码。 + +#### 安全性 #### + +我们也关注到了系统安全问题,所以在安装此包时,不需要安装任何额外包,也不需要root访问权限来运行。此外,源代码是采用Apache 2.0许可证发布的,这意味着只要你保留Tecmint的版权,你可以自由地编辑、修改并再分发该代码。 + +### 如何安装和运行脚本? ### + +首先,使用[wget命令][1]下载监控脚本`“tecmint_monitor.sh”`,给它赋予合适的执行权限。 + + # wget http://tecmint.com/wp-content/scripts/tecmint_monitor.sh + # chmod 755 tecmint_monitor.sh + +强烈建议你以普通用户身份安装该脚本,而不是root。安装过程中会询问root密码,并且在需要的时候安装必要的组件。 + +要安装`“tecmint_monitor.sh”`脚本,只需像下面这样使用-i(安装)选项就可以了。 + + /tecmint_monitor.sh -i + +在提示你输入root密码时输入该密码。如果一切顺利,你会看到像下面这样的安装成功信息。 + + Password: + Congratulations! Script Installed, now run monitor Command + +安装完毕后,你可以通过在任何位置,以任何用户调用命令`‘monitor’`来运行该脚本。如果你不喜欢安装,你需要在每次运行时输入路径。 + + # ./Path/to/script/tecmint_monitor.sh + +现在,以任何用户从任何地方运行monitor命令,就是这么简单: + + $ monitor + +![TecMint Monitor Script in Action](http://www.tecmint.com/wp-content/uploads/2015/05/TecMint-Monitor-Script.gif) + +你一运行命令,就会获得下面这些各种各样和系统相关的信息: + +- 互联网连通性 +- 操作系统类型 +- 操作系统名称 +- 操作系统版本 +- 架构 +- 内核版本 +- 主机名 +- 内部IP +- 外部IP +- 域名服务器 +- 已登录用户 +- 内存使用率 +- 交换分区使用率 +- 磁盘使用率 +- 平均负载 +- 系统开机时间 + +使用-v(版本)开关来检查安装的脚本的版本。 + + $ monitor -v + + tecmint_monitor version 0.1 + Designed by Tecmint.com + Released Under Apache 2.0 License + +### 小结 ### + +该脚本在一些机器上可以开机即用,这一点我已经检查过。相信对于你而言,它也会正常工作。如果你们发现了什么毛病,可以在评论中告诉我。这个脚本还不是结束,这仅仅是个开始。从这里开始,你可以将它提升到任何等级。如果你想要编辑脚本,将它带入一个更深的层次,尽管随意去做吧,别忘了给我们合适的积分,也别忘了把你更新后的脚本拿出来和我们分享哦,这样,我们也能通过给你合适的积分来更新此文。 + +别忘了和我们分享你的想法或者脚本,我们会在这儿帮助你。谢谢你们给予的所有挚爱。保持连线,不要走开哦。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-server-health-monitoring-script/ + +作者:[Avishek Kumar][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/10-wget-command-examples-in-linux/ diff --git a/translated/tech/20150515 Basic Networking Commands with Docker Containers.md b/translated/tech/20150515 Basic Networking Commands with Docker Containers.md new file mode 100644 index 0000000000..d4b90aa7f2 --- /dev/null +++ b/translated/tech/20150515 Basic Networking Commands with Docker Containers.md @@ -0,0 +1,106 @@ +关于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/ diff --git a/translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md b/translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md new file mode 100644 index 0000000000..4225cf9bb4 --- /dev/null +++ b/translated/tech/20150518 10 Amazing and Mysterious Uses of Symbol or Operator in Linux Commands.md @@ -0,0 +1,193 @@ +10!Linux¾˺÷ +================================================================================ +`'!'`Linuxв񶨷ţʷ¼ȡ򲻼޸ĵִ֮ǰеѾBash Shellоȷеؼ顣ûԹ඼ڱShellСǽLinuxз`'!'`Ǿ˺÷ + +### 1. ʹִʷбһִ ### + +ҲûʶԴʷб֮ǰѾִеҳһСȣͨ"history"֮ǰš + + $ history + +![ʹhistoryҵִе](http://www.tecmint.com/wp-content/uploads/2015/05/history-Command.gif) + +ڣֻҪʹʷʾڸǰֱ磬һ`history`б1551 + + $ !1551 + +![ʹIDִе](http://www.tecmint.com/wp-content/uploads/2015/05/Run-Commands-By-number.gif) + +Ϊ1551[top][1]ˡͨIDִ֮ǰķʽãЩܳ¡ֻҪʹ**![history]**Ե + +### 2. ֮ǰĵڶ߸ ### + +һַʽ֮ǰִеͨʹ-1-2ڶ-7߸ȡ + +ʹhistoryִйбhistoryִкбҪΪͨȷû`rm command > file`ᵼΣյִеڰ˸ʮ + + $ history + $ !-6 + $ !-8 + $ !-10 + +![֮ͨǰִе](http://www.tecmint.com/wp-content/uploads/2015/05/3.gif) +֮ͨǰִе + +### 3. ݲԷµ ### + +Ҫʾ`/home/$USER/Binary/firefox`ļеݣִУ + + $ ls /home/$USER/Binary/firefox + +ʶӦִ'ls -l'鿴ĸļǿִļӦôҲҪҽҪµдIJƣ + + $ ls -l !$ + +`!$`ִеIJݵµС + +![һIJݸ](http://www.tecmint.com/wp-content/uploads/2015/05/4.gif) +һIJݸ + +### 4. ʹ!IJ ### + +˵洴һıļfile1.txt + + $ touch /home/avi/Desktop/1.txt + +Ȼcpʹþ·`/home/avi/Downloads` + + $ cp /home/avi/Desktop/1.txt /home/avi/downloads + +ڣǸcpһ`/home/avi/Desktop/1.txt`ڶ`/home/avi/Downloads`Ƿֱǣʹ`echo [arguments]`ӡͬIJ + + $ echo "1st Argument is : !^" + $ echo "2nd Argument is : !cp:2" + +עһʹ`"!^"`дӡͨ`"![]:[]"`ӡ + +Уһ`cp`ڶҲҪӡ`"!cp:2"`κxyzʱ5Ҫõĸʹ`"!xyz:4"`еIJͨ`"!*"`á + +![IJ](http://www.tecmint.com/wp-content/uploads/2015/05/5.gif) +IJ + +### 5. ԹؼΪִϸ ### + +ǿԹؼΪִϴִеԴ⣺ + + $ ls /home > /dev/null [1] + $ ls -l /home/avi/Desktop > /dev/null [2] + $ ls -la /home/avi/Downloads > /dev/null [3] + $ ls -lA /usr/bin > /dev/null [4] + +ʹͬlsвͬĿغͲͬIJļСңǻݵ`/dev/null`Dzδնɺܸɾ + +ԹؼΪִϸ + + $ ! ls [1] + $ ! ls -l [2] + $ ! ls -la [3] + $ ! ls -lA [4] + +淢ʹùؼ`ls`ִѾִй + +![ԹؼΪִ](http://www.tecmint.com/wp-content/uploads/2015/05/6.gif) +ԹؼΪִ + +### 6. !! ### + +ʹ`(!!)`/޸ϸеһЩ޸/ϸҸչʾһЩʵ龳 + +һнűҵ˽IPִˣ + + $ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ + +ţͻȻҪűضһip.txtļˣҸôأҸضһļôһ򵥵Ľʹϵ`'> ip.txt'`ضļ + + $ ip addr show | grep inet | grep -v 'inet6'| grep -v '127.0.0.1' | awk '{print $2}' | cut -f1 -d/ > ip.txt + +л"ϵ"ڣһнű + + $ ifconfig | grep "inet addr:" | awk '{print $2}' | grep -v '127.0.0.1' | cut -f2 -d: + +һűBashʾ㷵˴Ϣ`"bash: ifconfig: command not found"`ԭ򲢲Ѳ£˱ӦrootȨ޵е + +ԣôأǺrootû¼ٴμϵҲˡˣҪ`"!!"`ȥţΪǸûϸ + + $ su -c "!!" root + +suлrootûģ`-c`ijûضҪIJ`!!`滻ΪϴеԵģҪṩroot롣 + +![!!](http://www.tecmint.com/wp-content/uploads/2015/05/7.gif) +!! + +ͨ龰ʹ`!!` + +1.ͨûapt-getͨյʾ˵ûȨִС + + $ apt-get upgrade && apt-get dist-upgrade + +ðɣд󡣵ģʹɹִ... + + $ su -c !! + +ͬڣ + + $ service apache2 start + + $ /etc/init.d/apache2 start + + $ systemctl start apache2 + +ͨûȨִЩУ + + $ su -c 'service apache2 start' + + $ su -c '/etc/init.d/apache2 start' + + $ su -c 'systemctl start apache2' + +### 7.һӰг![FILE_NAME]ļ ### + +`!`߼ǣԳ`'!'`ļеļ/չִ + +A.ļƳļ2.txt⡣ + + $ rm !(2.txt) + +B.ļƳеļͣpdfͳ⡣ + + $ rm !(*.pdf) + +### 8.ijļУ/home/avi/TecmintǷڣӡ ### + +ʹ`'! -d'`֤ļǷڣļвʱʹAND`(&&)`дӡļдʱʹOR`(||)`дӡ + +߼ϣ`[ ! -d /home/avi/Tecmint ]`Ϊ0ʱִAND߼ݣִOR߼`(||)`ݡ + + $ [ ! -d /home/avi/Tecmint ] && printf '\nno such /home/avi/Tecmint directory exist\n' || printf '\n/home/avi/Tecmint directory exist\n' + +### 9.ijļǷڣ˳ ### + +ﵱļвʱ˳ + + $ [ ! -d /home/avi/Tecmint ] && exit + +### 10.homeļڲһļУȷ˵test򴴽 ### + +ǽűеһõʵ֣ļвʱһ + + [ ! -d /home/avi/Tecmint ] && mkdir /home/avi/Tecmint + +ȫˡ֪żֵ˽`'!'`ʹ÷ڷĵطὨ顣ϵ + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/mysterious-uses-of-symbol-or-operator-in-linux-commands/ + +ߣ[Avishek Kumar][a] +ߣ[wwy-hust](https://github.com/wwy-hust) +Уԣ[УID](https://github.com/УID) + + [LCTT](https://github.com/LCTT/TranslateProject) ԭ룬[Linuxй](https://linux.cn/) Ƴ + +[a]:http://www.tecmint.com/author/avishek/ +[1]:http://www.tecmint.com/12-top-command-examples-in-linux/ diff --git a/translated/tech/20150518 70 Expected Shell Scripting Interview Questions and Answers.md b/translated/tech/20150518 70 Expected Shell Scripting Interview Questions and Answers.md new file mode 100644 index 0000000000..b5ccd63e0a --- /dev/null +++ b/translated/tech/20150518 70 Expected Shell Scripting Interview Questions and Answers.md @@ -0,0 +1,399 @@ +70 个可能的 Shell 脚本面试问题及解答 +================================================================================ +我们为你的面试准备选择了 70 个可能的 shell 脚面问题及解答。了解脚本或至少知道基础知识对系统管理员来说至关重要,它也有助于你在工作环境中自动完成很多任务。在过去的几年里,我们注意到所有的 linux 工作职位都要求脚本技能。 + +### 1) 如何向脚本传递参数 ? ### + +./script argument + +**例子** : 显示文件名称脚本 + +./show.sh file1.txt + + cat show.sh + #!/bin/bash + cat $1 + +### 2) 如何在脚本中使用参数 ? ### + +第一个参数: $1, +第二个参数 : $2 + +例子 : 脚本会复制文件(arg1) 到目标地址(arg2) + +./copy.sh file1.txt /tmp/ + + cat copy.sh + #!/bin/bash + cp $1 $2 + +### 3) 如何计算传递进来的参数 ? ### + +$# + +### 4) 如何在脚本中获取脚本名称 ? ### + +$0 + +### 5) 如何检查之前的命令是否运行成功 ? ### + +$? + +### 6) 如何获取文件的最后一行 ? ### + +tail -1 + +### 7) 如何获取文件的第一行 ? ### + +head -1 + +### 8) 如何获取一个文件每一行的第三个元素 ? ### + +awk '{print $3}' + +### 9) 假如第一个等于 FIND,如何获取文件中每行的第二个元素 ### + +awk '{ if ($1 == "FIND") print $2}' + +### 10) 如何调试 bash 脚本 ### + +Add -xv to #!/bin/bash + +例子 + +#!/bin/bash –xv + +### 11) 举例如何写一个函数 ? ### + +function example { +echo "Hello world!" +} + +### 12) 如何向 string 添加 string ? ### + +V1="Hello" +V2="World" +V3=$V1+$V2 +echo $V3 + +Output + +Hello+World + +### 13) 如何进行两个整数相加 ? ### + +V1=1 +V2=2 +V3=$V1+$V2 +echo $V3 + +Output +3 + +### 14) 如何检查文件系统中是否存在某个文件 ? ### + +if [ -f /var/log/messages ] +then +echo "File exists" +fi + +### 15) 写出 shell 脚本中所有循环语法 ? ### + +#### for loop : #### + +for i in $( ls ); do +echo item: $i +done + +#### while loop : #### + +#!/bin/bash +COUNTER=0 +while [ $COUNTER -lt 10 ]; do +echo The counter is $COUNTER +let COUNTER=COUNTER+1 +done + +#### untill oop : #### + +#!/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 + +### 17) 如何获取文本文件的第 10 行 ? ### + +head -10 file|tail -1 + +### 18) bash 脚本文件的第一个符号是什么 ### + +# + +### 19) 命令:[ -z "" ] && echo 0 || echo 1 的输出是什么 ### + +0 + +### 20) 命令 “export” 有什么用 ? ### + +使变量在子 shell 中公有 + +### 21) 如何在后台运行脚本 ? ### + +在脚本后面添加 “&” + +### 22) "chmod 500 script" 做什么 ? ### + +使脚本所有者拥有可执行权限 + +### 23) ">" 做什么 ? ### + +重定向输出流到文件或另一个流。 + +### 24) & 和 && 有什么区别 ### + +& - 希望脚本在后台运行的时候使用它 +&& - 当第一个脚本成功完成才执行命令/脚本的时候使用它 + +### 25) 什么时候要在 [ condition ] 之前使用 “if” ? ### + +当条件满足时需要运行多条命令的时候。 + +### 26) 命令: name=John && echo 'My name is $name' 的输出是什么 ### + +My name is $name + +### 27) bash shell 脚本中哪个符号用于注释 ? ### + +# + +### 28) 命令: echo ${new:-variable} 的输出是什么 ### + +variable + +### 29) ' 和 " 引号有什么区别 ? ### + +' - 当我们不希望把变量转换为值的时候使用它。 +" - 会计算所有变量的值并用值代替。 + +### 30) 如何在脚本文件中重定向标准输入输出流到 log.txt 文件 ? ### + +在脚本文件中添加 "exec >log.txt 2>&1" 命令 + +### 31) 如何只用 echo 命令获取 string 变量的一部分 ? ### + +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 ? ### + +echo ${variable#*:*:*:} +或 +echo ${variable##*:} + +### 33) 如何从上面的字符串中获取 “User” ? ### + +echo ${variable%:*:*:*} +或 +echo ${variable%%:*} + +### 34) 如何使用 awk 列出 UID 小于 100 的用户 ? ### + +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 + +### 36) 如何在 bash shell 中更改标注域分隔符为 ":" ? ### + +IFS=":" + +### 37) 如何获取变量长度 ? ### + +${#variable} + +### 38) 如何打印变量的最后 5 个字符 ? ### + +echo ${variable: -5} + +### 39) ${variable:-10} 和 ${variable: -10} 有什么区别? ### + +${variable:-10} - 如果之前没有给 variable 赋值则输出 10 +${variable: -10} - 输出 variable 的最后 10 个字符 + +### 40) 如何只用 echo 命令替换字符串的一部分 ? ### + +echo ${variable//pattern/replacement} + +### 41) 哪个命令将命令替换为大写 ? ### + +tr '[:lower:]' '[:upper:]' + +### 42) 如何计算本地用户数目 ? ### + +wc -l /etc/passwd|cut -d" " -f1 +或者 +cat /etc/passwd|wc -l + +### 43) 不用 wc 命令如何计算字符串中的单词数目 ? ### + +set ${string} +echo $# + +### 44) "export $variable" 或 "export variable" 哪个正确 ? ### + +export variable + +### 45) 如何列出第二个字母是 a 或 b 的文件 ? ### + +ls -d ?[ab]* + +### 46) 如何将整数 a 加到 b 并赋值给 c ? ### + +c=$((a+b)) +或 +c=`expr $a + $b` +或 +c=`echo "$a+$b"|bc` + +### 47) 如何去除字符串中的所有空格 ? ### + +echo $string|tr -d " " + +### 48) 重写命令输出变量转换为复数的句子: item="car"; echo "I like $item" ? ### + +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=0; i<=100; i=i+3 )); do echo "Welcome $i times"; done + +### 50) 如何打印传递给脚本的所有参数 ? ### + +echo $* +或 +echo $@ + +### 51) [ $a == $b ] 和 [ $a -eq $b ] 有什么区别 ### + +[ $a == $b ] - 用于字符串比较 +[ $a -eq $b ] - 用于数字比较 + +### 52) = 和 == 有什么区别 ### + += - 用于为变量复制 +== - 用于字符串比较 + +### 53) 写出测试 $a 是否大于 12 的命令 ? ### + +[ $a -gt 12 ] + +### 54) 写出测试 $b 是否小于等于 12 的命令 ? ### + +[ $b -le 12 ] + +### 55) 如何检查字符串是否以字母 "abc" 开头 ? ### + +[[ $string == abc* ]] + +### 56) [[ $string == abc* ]] 和 [[ $string == "abc*" ]] 有什么区别 ### + +[[ $string == abc* ]] - 检查字符串是否以字母 abc 开头 +[[ $string == "abc* " ]] - 检查字符串是否完全等于 abc* + +### 57) 如何列出以 ab 或 xy 开头的用户名 ? ### + +egrep "^ab|^xy" /etc/passwd|cut -d: -f1 + +### 58) bash 中 $! 表示什么意思 ? ### + +后台最近命令的 PID + +### 59) $? 表示什么意思 ? ### + +前台最近命令的结束状态 + +### 60) 如何输出当前 shell 的 PID ? ### + +echo $$ + +### 61) 如何获取传递给脚本的参数数目 ? ### + +echo $# + +### 62) $* 和 $@ 有什么区别 ### + +$* - 以一个字符串形式输出所有传递到脚本的参数 +$@ - 以 $IFS 为分隔符列出所有传递到脚本中的参数 + +### 63) 如何在 bash 中定义数组 ? ### + +array=("Hi" "my" "name" "is") + +### 64) 如何打印数组的第一个元素 ? ### + +echo ${array[0]} + +### 65) 如何打印数组的所有元素 ? ### + +echo ${array[@]} + +### 66) 如何输出所有数组索引 ? ### + +echo ${!array[@]} + +### 67) 如何移除数组中索引为 2 的元素 ? ### + +unset array[2] + +### 68) 如何在数组中添加 id 为 333 的元素 ? ### + +array[333]="New_element" + +### 69) shell 脚本如何获取输入的值 ? ### + +a) 通过参数 + +./script param1 param2 + +b) 通过 read 命令 + +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 + +好运 !! 如果你有任何疑问或者问题需要解答都可以在下面的评论框中写下来。让我们知道这对你的面试有所帮助:-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-shell-script/shell-scripting-interview-questions-answers/ + +作者:[Petras Liumparas][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/petrasl/ \ No newline at end of file diff --git a/translated/tech/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md b/translated/tech/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md new file mode 100644 index 0000000000..9880f7953f --- /dev/null +++ b/translated/tech/20150518 Linux FAQs with Answers--How to fix '404 Not Found' error with 'apt-get update' on old Ubuntu.md @@ -0,0 +1,45 @@ +Linux有问必答——在旧的Ubuntu上如何修复“apt-get update”的“404 Not Found”错误 +================================================================================ +> **问题**: 我的PC上安装了旧版的Ubuntu 13.04(急切的浣熊)。当我在上面运行“sudo apt-get update”时,它丢给了我一大堆“404 Not Found”错误,结果是我不能使用apt-get或aptitude来安装或更新任何软件包了。由于该错误的原因,我甚至不能将它升级到更新的版本。我怎样才能修复这个问题啊? +> +![](https://farm6.staticflickr.com/5460/17634085636_996b2a8ab5_b.jpg) + +每个Ubuntu版本都有生命结束周期(EOL)时间;常规的Ubuntu发行版提供18个月的支持,而LTS(长期支持)版本则长达3年(服务器版本)和5年(桌面版本)。当某个Ubuntu版本达到生命结束周期时,其仓库就不能再访问了,你也不能再从Canonical获取任何维护更新和安全补丁。在撰写本文时,Ubuntu 13.04(急切的浣熊)已经达到了它的生命结束周期。 + +如果你所使用的Ubuntu系统已经被结束生命周期,你就会从apt-get或aptitude得到以下404错误,因为它的仓库已经被遗弃了。 + + W: Failed to fetch http://us.archive.ubuntu.com/ubuntu/dists/raring-backports/multiverse/binary-i386/Packages 404 Not Found [IP: 91.189.91.13 80] + + W: Failed to fetch http://extras.ubuntu.com/ubuntu/dists/raring/main/binary-amd64/Packages 404 Not Found + + W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/raring-security/universe/binary-i386/Packages 404 Not Found [IP: 91.189.88.149 80] + + E: Some index files failed to download. They have been ignored, or old ones used instead + +对于那些还在使用旧版本Ubuntu的用户,Canonical维护了一个old-releases.ubuntu.com的网站,这里包含了结束生命周期的仓库归档。因此,当Canonical对你安装的Ubuntu版本结束支持时,你需要将仓库切换到old-releases.ubuntu.com(除非你在结束生命周期之前想要升级)。 + +这里,通过切换到旧版本仓库提供了一个快速修复“404 Not Found”错误的便捷方式。 + +首先,使用旧版本仓库替换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 + +然后,使用文本编辑器打开/etc/apt/sources.list,并查找extras.ubuntu.com。该仓库也不再支持Ubuntu 13.04了,所以你需要使用“#”号将extras.ubuntu.com注释掉。 + + #deb http://extras.ubuntu.com/ubuntu raring main + #deb-src http://extras.ubuntu.com/ubuntu raring main + +现在,你应该可以在旧版不受支持的Ubuntu上安装或更新软件包了。 + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/translated/tech/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md b/translated/tech/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md new file mode 100644 index 0000000000..54e0f393d1 --- /dev/null +++ b/translated/tech/20150518 Linux FAQs with Answers--How to fix 'Encountered a section with no Package--header' error on Raspbian.md @@ -0,0 +1,31 @@ +Linux 有问必答--如何修复 Raspbian 上的 “Encountered a section with no Package: header” 错误 +================================================================================ +> **问题**: 我在 Raspberry Pi 上安装新版的 Rasbian。但当我使用 sudo apt-get update 命令更新 APT 软件包索引的时候,它抛出下面的错误: + + E: Encountered a section with no Package: header + E: Problem with MergeList /var/lib/dpkg/status + E: The package lists or status file could not be parsed or opened. + +> 之后我不能在 Raspbian 上安装任何软件包。我怎样才能解决这个错误? + +![](https://farm8.staticflickr.com/7704/17445484636_05ba81722f_c.jpg) + +错误说 "Problem with MergeList /var/lib/dpkg/status" 表示由于某些原因状态文件损坏了,因此无法解释。这个状态文件包括了已经安装的 deb 软件包的信息,因此需要小心备份。 + +在这种情况下,由于这是新安装的 Raspbian,你可以安全地删除状态文件,然后用下面的命令重新生成。 + + $ sudo rm /var/lib/dpkg/status + $ sudo touch /var/lib/dpkg/status + $ sudo apt-get update + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/encountered-section-with-no-package-header-error.html + +作者:[Dan Nanni][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni \ No newline at end of file diff --git a/translated/tech/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md b/translated/tech/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md new file mode 100644 index 0000000000..a91a2b3ed3 --- /dev/null +++ b/translated/tech/20150518 Linux FAQs with Answers--How to view threads of a process on Linux.md @@ -0,0 +1,57 @@ +Linux有问必答——Linux上如何查看某个进程的线程 +================================================================================ +> **问题**: 我的程序创建并在它里头执行了多个线程,我怎样才能在该程序创建线程后监控其中单个线程?我想要看到带有它们名称的单个线程详细情况(如,CPU/内存使用率)。 + +线程是现代操作系统上进行并行执行的一个流行的编程方面的抽象概念。当一个程序内有多个线程被叉分出用以执行多个流时,这些线程就会在它们之间共享特定的资源(如,内存地址空间、打开的文件),以使叉分开销最小化,并避免大量花销IPC(进程间通信)频道。这些功能让线程在并发执行时成为一个高效的机制。 + +在Linux中,程序中创建的线程(也称为轻量级进程,LWP)会具有和程序的PID相同的“线程组ID”。然后,各个线程会获得其自身的线程ID(TID)。对于Linux内核调度器而言,线程不过是恰好共享特定资源的标准的进程。经典的命令行工具,如ps或top,都可以用来显示线程级别的信息,默认情况下它们会显示进程级别的信息。 + +这里提供了**在Linux上显示某个进程的线程**的几种方式。 + +### 方法一:PS ### + +在ps命令中,“-T”选项可以开启线程查看。下面的命令列出了由进程号为的进程创建的所有线程。 + + $ ps -T -p + +![](https://farm8.staticflickr.com/7749/17350561110_94cacfc456_c.jpg) + +“SID”栏表示线程ID,而“CMD”栏则显示了线程名称。 + +### 方法二: Top ### + +top命令可以实时显示各个线程情况。要在top输出中开启线程查看,请调用top命令的“-H”选项,该选项会列出所有Linux线程。在top运行时,你也可以通过按“H”键将线程查看模式切换为开或关。 + + $ top -H + +![](https://farm9.staticflickr.com/8824/17350561070_3dfe447974_c.jpg) + +要让top输出某个特定进程并检查该进程内运行的线程状况: + + $ top -H -p + +![](https://farm8.staticflickr.com/7797/17538002751_c8a3d574d8_c.jpg) + +### 方法三: Htop ### + +一个对用户更加友好的方式是,通过htop查看单个进程的线程,它是一个基于ncurses的交互进程查看器。该程序允许你在树状视图中监控单个独立线程。 + +要在htop中启用线程查看,请开启htop,然后按来进入htop的设置菜单。选择“设置”栏下面的“显示选项”,然后开启“树状视图”和“显示自定义线程名”选项。按退出设置。 + +![](https://farm6.staticflickr.com/5338/17350364568_59bce22e7b_b.jpg) + +现在,你就会看到下面这样单个进程的线程视图。 + +![](https://farm9.staticflickr.com/8885/17350560930_98952d5350_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/view-threads-process-linux.html + +作者:[Dan Nanni][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md b/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md new file mode 100644 index 0000000000..c43ac481e7 --- /dev/null +++ b/translated/tech/20150518 Linux FAQs with Answers--What is the Apache error log location on Linux.md @@ -0,0 +1,81 @@ +Linux有问必答——Linux上Apache错误日志的位置在哪里? +================================================================================ +> **问题**: 我尝试着解决我 Linux 系统上的 Apache 网络服务器的错误,Apache的错误日志文件放在[你的 Linux 版本]的哪个位置呢? + +错误日志和访问日志文件为系统管理员提供了有用的信息,比如,为网络服务器排障,[保护][1]系统不受各种各样的恶意活动侵犯,或者只是进行[各种各样的][2][分析][3]以监控 HTTP 服务器。根据你网络服务器配置的不同,其错误/访问日志可能放在你系统中不同位置。 + +本文可以帮助你**找到Linux上的Apache错误日志**。 + +![](https://farm8.staticflickr.com/7664/16958522954_4852ab5ea5_c.jpg) + +### Debian,Ubuntu或Linux Mint上的Apache错误日志位置 ### + +#### 默认的错误日志 #### + +在基于Debian的Linux上,系统范围的Apache错误日志默认位置是**/var/log/apache2/error.log**。默认位置可以通过编辑Apache的配置文件进行修改。 + +#### 自定义的错误日志 #### + +要找到自定义的错误日志位置,请用文本编辑器打开 /etc/apache2/apache2.conf,然后查找以 ErrorLog 开头的行,该行指定了自定义的 Apache 错误日志文件的位置。例如,在未经修改的 Apache 配置文件中可以找到以下行: + + ErrorLog ${APACHE_LOG_DIR}/error.log + +在本例中,该位置使用 APACHE_LOG_DIR 环境变量进行配置,该变量在 /etc/apache2/envvars 中已被定义。 + + export APACHE_LOG_DIR=/var/log/apache2$SUFFIX + +在实际情况中, ErrorLog 可能会指向你 Linux 系统中任意路径。 + +#### 使用虚拟主机自定义的错误日志 #### + +如果在 Apache 网络服务器中使用了虚拟主机, ErrorLog 指令可能会在虚拟主机容器内指定,在这种情况下,上面所说的系统范围的错误日志位置将被忽略。 + +启用了虚拟主机后,各个虚拟主机可以定义其自身的自定义错误日志位置。要找出某个特定虚拟主机的错误日志位置,你可以打开 /etc/apache2/sites-enabled/.conf,然后查找 ErrorLog 指令,该指令会显示站点指定的错误日志文件。 + +### CentOS,Fedora或RHEL上的Apache错误日志位置 ### + +#### 默认的错误日志 #### + +在基于 Red Hat 的Linux中,系统范围的 Apache 错误日志文件默认被放置在**/var/log/httpd/error_log**。该默认位置可以通过修改 Apache 配置文件进行自定义。 + +#### 自定义的错误日志 #### + +要找出 Apache 错误日志的自定义位置,请用文本编辑器打开 /etc/httpd/conf/httpd.conf,然后查找 ServerRoot,该参数显示了 Apache 服务器目录树的顶层,日志文件和配置都位于该目录树中。例如: + + ServerRoot "/etc/httpd" + +现在,查找 ErrorLog 开头的行,该行指出了 Apache 网络服务器将错误日志写到了哪里去。注意,指定的位置是 ServerRoot 值的相对位置。例如: + + ErrorLog "log/error_log" + +结合上面的两个指令,可以获得完整的错误日志路径,默认情况下该路径就是 /etc/httpd/logs/error_log。在全新安装的Apache中,这是一个到 /var/log/httpd/error_log 的符号链接。 + +在实际情况中, ErrorLog 可能指向你 Linux 系统中的任意位置。 + +#### 使用虚拟主机自定义的错误日志 #### + +如果你启用了虚拟主机,你可以通过检查 /etc/httpd/conf/httpd.conf(或其它任何定义了虚拟主机的文件)来找到各个虚拟主机的错误日志位置。在独立的虚拟主机部分查找 ErrorLog。如,在下面的虚拟主机部分,错误日志的位置是 /var/www/xmodulo.com/logs/error_log。 + + + ServerAdmin webmaster@xmodulo.com + DocumentRoot /var/www/xmodulo.com/public_html + ServerName www.xmodulo.com + ServerAlias xmodulo.com + ErrorLog /var/www/xmodulo.com/logs/error_log + CustomLog /var/www/xmodulo.com/logs/access_log + + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/apache-error-log-location-linux.html + +作者:[Dan Nanni][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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 diff --git a/translated/tech/20150520 How to Use Docker Machine with a Cloud Provider.md b/translated/tech/20150520 How to Use Docker Machine with a Cloud Provider.md new file mode 100644 index 0000000000..acf052d493 --- /dev/null +++ b/translated/tech/20150520 How to Use Docker Machine with a Cloud Provider.md @@ -0,0 +1,148 @@ +如何在云服务提供商的机器使用Docker Machine +================================================================================ +大家好,今天我们来学习如何使用Docker Machine在各种云服务提供商的平台部署Docker。Docker Machine是一个可以帮助我们在自己的电脑、云服务提供商的机器以及我们数据中心的机器上创建Docker机器的应用程序。它为创建服务器、在服务器中安装Docker、根据用户需求配置Docker客户端提供了简单的解决方案。驱动API对本地机器、数据中心的虚拟机或者公用云机器都适用。Docker Machine支持Windows、OSX和Linux,并且提供一个独立的二进制文件,可以直接使用。它让我们可以充分利用支持Docker的基础设施的生态环境合作伙伴,并且使用相同的接口进行访问。它让人们可以使用一个命令来简单而迅速地在不同的云平台部署Docker容器。 + + +### 1. 安装Docker Machine ### + +Docker Machine可以很好地支持每一种Linux发行版。首先,我们需要从Github网站下载最新版本的。这里我们使用curl来下载目前最新0.2.0版本的Docker Machine。 + +在64位操作系统运行: + + # curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-amd64 > /usr/local/bin/docker-machine + +在32位操作系统运行: + + # curl -L https://github.com/docker/machine/releases/download/v0.2.0/docker-machine_linux-i386 > /usr/local/bin/docker-machine + +下载最新版本的Docker Machine并将docker-machine文件放到了/usr/local/bin/后,添加执行权限: + + # chmod +x /usr/local/bin/docker-machine + +完成如上操作后,我们需要确认已经成功安装docker-machine了。可以运行如下命令检查,它会输出系统中docker-machine的版本: + + # docker-machine -v + +![Installing Docker Machine](http://blog.linoxide.com/wp-content/uploads/2015/05/installing-docker-machine.png) + +另外机器上需要有docker命令,可以使用如下命令安装: + + # curl -L https://get.docker.com/builds/linux/x86_64/docker-latest > /usr/local/bin/docker + # chmod +x /usr/local/bin/docker + +### 2. 创建机器 ### + +在自己的Linux机器上安装好了Docker Machine之后,我们想要将一个docker虚拟机部署到云服务器上。Docker Machine支持几个流行的云平台,如igital Ocean、Amazon Web Services(AWS)、Microsoft Azure、Google Cloud Computing等等,所以我们可以在不同的平台使用相同的接口来部署Docker。本文中我们会使用digitalocean驱动在Digital Ocean的服务器上部署Docker,--driver选项指定digitalocean驱动,--digitalocean-access-token选项指定[Digital Ocean Control Panel][1]提供的API Token,命令最后的是我们创建的Docker虚拟机的机器名。运行如下命令: + + # docker-machine create --driver digitalocean --digitalocean-access-token linux-dev + + # eval "$(docker-machine env linux-dev)" + +![Docker Machine Digitalocean Cloud](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-digitalocean-cloud.png) + +**注意**: 这里linux-dev是我们将要创建的机器的名称。``是一个安全key,可以在Digtal Ocean Control Panel生成。要找到这个key,我们只需要登录到我们的Digital Ocean Control Panel,然后点击API,再点击Generate New Token,填写一个名称,选上Read和Write。然后我们就会得到一串十六进制的key,那就是``,简单地替换到上边的命令中即可。 + +运行如上命令后,我们可以在Digital Ocean Droplet Panel中看到一个具有默认配置的droplet已经被创建出来了。 + +![DigitalOcean Droplet Panel](http://blog.linoxide.com/wp-content/uploads/2015/05/digitalocean-droplet-panel.png) + +简便起见,docker-machine会使用默认配置来部署Droplet。我们可以通过增加选项来定制我们的Droplet。这里是一些digitalocean相关的选项,我们可以使用它们来覆盖Docker Machine所使用的默认配置。 + + --digitalocean-image "ubuntu-14-04-x64" 是选择Droplet的镜像 + --digitalocean-ipv6 enable 是启用IPv6网络支持 + --digitalocean-private-networking enable 是启用专用网络 + --digitalocean-region "nyc3" 是选择部署Droplet的区域 + --digitalocean-size "512mb" 是选择内存大小和部署的类型 + +如果你想在其他云服务使用docker-machine,并且想覆盖默认的配置,可以运行如下命令来获取Docker Mackine默认支持的对每种平台适用的参数。 + + # docker-machine create -h + +### 3. 选择活跃机器 ### + +部署Droplet后,我们想马上运行一个Docker容器,但在那之前,我们需要检查下活跃机器是否是我们需要的机器。可以运行如下命令查看。 + + # docker-machine ls + +![Docker Machine List](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-ls.png) + +ACTIVE一列有“*”标记的是活跃机器。 + +现在,如果我们想将活跃机器切换到需要的机器,运行如下命令: + + # docker-machine active linux-dev + +**注意**:这里,linux-dev是机器名,我们打算激活这个机器,并且在其中运行Docker容器。 + +### 4. 运行一个Docker容器 ### + +现在,我们已经选择了活跃机器,就可以运行Docker容器了。可以测试一下,运行一个busybox容器来执行`echo hello word`命令,这样就可以得到输出: + + # docker run busybox echo hello world + +注意:如果你试图在一个装有32位操作系统的宿主机部署Docker容器,使用SSH来运行docker是个好办法。这样你就可以简单跳过这一步,直接进入下一步。 + +### 5. SSH到Docker机器中 ### + +如果我们想在机器或者Droplet上控制之前部署的Docker机器,可以使用docker-machine ssh命令来SSH到机器上: + + # docker-machine ssh + +![Docker Machine SSH](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-ssh.png) + +SSH到机器上之后,我们可以在上边运行任何Docker容器。这里我们运行一个nginx: + + # docker run -itd -p 80:80 nginx + +操作完毕后,我们需要运行exit命令来退出Droplet或者服务器。 + + # exit + +### 5. 删除机器 ### + +删除在运行的机器以及它的所有镜像和容器,我们可以使用docker-machine rm命令: + + # docker-machine rm linux-dev + +![Docker Machine Remove All](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-remove-machine.png) + +使用docker-machine ls命令检查是否成功删除了: + + # docker-machine ls + +![Docker Machine Remove Check](http://blog.linoxide.com/wp-content/uploads/2015/05/docker-machine-remove-check.png) + +### 6. 在不使用驱动的情况新增一个机器 ### + +我们可以在不使用驱动的情况往Docker增加一台机器,只需要一个URL。它可以使用一个已有机器的别名,所以我们就不需要每次在运行docker命令时输入完整的URL了。 + + $ docker-machine create --url=tcp://104.131.50.36:2376 custombox + +### 7. 管理机器 ### + +如果你已经让Docker运行起来了,可以使用简单的**docker-machine stop**命令来停止所有正在运行的机器,如果需要再启动的话可以运行**docker-machine start**: + + # docker-machine stop + # docker-machine start + +你也可以使用如下命令来使用机器名作为参数来将其停止或启动: + + $ docker-machine stop linux-dev + $ docker-machine start linux-dev + +### 总结 ### + +Docker Machine是一个非常棒的工具,可以使用Docker容器快速地部署服务。文中我们使用Digital Ocean Platform作演示,但Docker Machine还支持其他平台,如Amazon Web Service、Google Cloud Computing。使用Docker Machine,快速、安全地在几种不同平台部署Docker容器变得很简单了。因为Docker Machine还是Beta版本,不建议在生产环境使用。如果你有任何问题、建议、反馈,请在下方的评论框中写下来,我们会改进或者更新我们的内容。谢谢!享受吧 :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/use-docker-machine-cloud-provider/ + +作者:[Arun Pyasi][a] +译者:[goreliu](https://github.com/goreliu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:https://cloud.digitalocean.com/settings/applications \ No newline at end of file diff --git a/translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md b/translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md new file mode 100644 index 0000000000..7f3e37b3fe --- /dev/null +++ b/translated/tech/20150520 How to Use tmpfs on RHEL or CentOS 7.0.md @@ -0,0 +1,64 @@ +如何在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/ diff --git a/translated/tech/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md b/translated/tech/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md new file mode 100644 index 0000000000..1f733207f3 --- /dev/null +++ b/translated/tech/20150520 How to compile and install wxWidgets on Ubuntu or Debian or Linux Mint.md @@ -0,0 +1,167 @@ +如何在Ubuntu/Debian/Linux Mint中编译和安装wxWidgets +================================================================================ +### wxWidgets ### + +wxWidgets是一个程序开发框架/库, 允许你在Windows、Mac、Linux中使用相同的代码跨平台开发。 + +它主要用C++写成,但也可以与其他语言绑定比如Python、Perl、Ruby。 + +本教程中我将向你展示如何在基于Debian的linux中如Ubuntu和Linux Mint中编译wxwidgets 3.0+。 + +从源码编译wxWidgets并不困难,仅仅需要几分钟。 + +库可以按不同的方式来编译,比如静态或者动态库。 + +### 1. 下载 wxWidgets ### + +第一步你需要从[wxwidgets.org][1]下载wxWidgets源码文件。 + +做完后,解压到目录。 + +### 2. 设置编译环境 ### + +要编译wxwidgets,我们需要一些工具包括C++编译器, 在Linux上是g++。所有这些可以通过apt-get工具从仓库中安装。 + +我们还需要wxWidgets依赖的GTK开发库。 + + $ sudo apt-get install libgtk-3-dev build-essential checkinstall + +>checkinstall工具允许我们为wxwidgets创建一个安装包,这样之后就可以轻松的使用包管理器来卸载。 + +### 3. 编译 wxWidgets ### + +进入到wxWidgets解压后的目录。为了保持清洁,创建一个编译用的目录。 + + $ mkdir gtk-build + $ cd gtk-build/ + +现在运行configure和make命令。每个将花费一些时间来完成。 + + $ ../configure --disable-shared --enable-unicode + $ make + +"--disable-shared"选项将会编译静态库而不是动态库。 + +make命令完成后,编译也成功了。是时候安装wxWidgets到正确的目录。 + +更多信息请参考install.txt和readme.txt,这可在wxwidgets中的/docs/gtk/目录下找到。 + +### 4. 安装 checkinstall ### + +现在我们不使用"make install"命令,我们使用checkinstall命令来创建一个wxwidgets的deb安装包。运行命令: + + $ sudo checkinstall + +checkinstall会询问几个问题,请保证在提问后提供一个版本号,否则将会失败。 + +完成这一切后,wxWidgets就安装好了,deb文件也会创建在相同的目录下。 + +### 5. 追踪安装的文件 ### + +如果你想要检查文件安装的位置,使用dpkg命令后面跟上checkinstall提供的报名。 + + $ dpkg -L package_name + /. + /usr + /usr/local + /usr/local/lib + /usr/local/lib/libwx_baseu-3.0.a + /usr/local/lib/libwx_gtk3u_propgrid-3.0.a + /usr/local/lib/libwx_gtk3u_html-3.0.a + /usr/local/lib/libwxscintilla-3.0.a + /usr/local/lib/libwx_gtk3u_ribbon-3.0.a + /usr/local/lib/libwx_gtk3u_stc-3.0.a + /usr/local/lib/libwx_gtk3u_qa-3.0.a + /usr/local/lib/libwx_baseu_net-3.0.a + /usr/local/lib/libwxtiff-3.0.a + +### 6. 编译示例 ### + +编译wxWidgets完成后就可以马上编译示例程序了。在相同的目录下,一个新的sample目录已经创建了。 + +进入它并运行下面的命令 + + $ compile samples + $ cd samples/ + $ make + +make命令完成后,进入sampl子目录,这里就有一个可以马上运行的Demo程序了。 + +### 7. 编译你的第一个程序 ### + +你完成编译demo程序后,可以写你自己的程序来编译了。这个也很简单。 + +假设你用的是C++这样你可以使用编辑器的高亮特性。比如gedit、kate、kwrite等等。或者用全功能的IDE像Geany、Codelite、Codeblocks等等。 + +然而你的第一个程序只需要用一个文本编辑器来快速完成。 + +这里就是 + + #include + + class Simple : public wxFrame + { + public: + Simple(const wxString& title) + : wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(250, 150)) + { + Centre(); + } + }; + + class MyApp : public wxApp + { + public: + bool OnInit() + { + Simple *simple = new Simple(wxT("Simple")); + simple->Show(true); + return true; + } + }; + + wxIMPLEMENT_APP(MyApp); + +现在保存并用下面的命令编译。 + + # compile + $ g++ basic.cpp `wx-config --cxxflags --libs std` -o program + + # run + $ ./program + +#### 和非标准的库一起编译 #### + +面展示的wx-config命令默认只支持标准的库。如果你使用的是Aui库,那么你需要指定额外用到的库。 + + $ g++ code.cpp `wx-config --cxxflags --libs std,aui` -o program + +更多的信息参考这里[这里][2]。 + +### 资源 ### + +下载wxWidgets的源码和帮助 +[https://www.wxwidgets.org/downloads/][3] + +wxWidgets编译的wiki页面 +[https://wiki.wxwidgets.org/Compiling_and_getting_started][4] + +使用wxWidgets最新版本(3.0+)的事项 +[https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets][5] + +-------------------------------------------------------------------------------- + +via: http://www.binarytides.com/install-wxwidgets-ubuntu/ + +作者:[Silver Moon][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/117145272367995638274/posts +[1]:https://www.wxwidgets.org/downloads/ +[2]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets#The_wx-config_script +[3]:https://www.wxwidgets.org/downloads/ +[4]:https://wiki.wxwidgets.org/Compiling_and_getting_started +[5]:https://wiki.wxwidgets.org/Updating_to_the_Latest_Version_of_wxWidgets diff --git a/translated/tech/20150520 Shell Script to Backup Files or Directories Using rsync.md b/translated/tech/20150520 Shell Script to Backup Files or Directories Using rsync.md new file mode 100644 index 0000000000..639e58ede9 --- /dev/null +++ b/translated/tech/20150520 Shell Script to Backup Files or Directories Using rsync.md @@ -0,0 +1,170 @@ +Shell脚本:使用rsync备份文件/目录 +================================================================================ +本文,我们带来了shell脚本,用来使用rsync命令将你本地Linux机器上的文件/目录备份到远程Linux服务器上。使用该脚本实施备份会是一个交互的方式,你需要提供远程备份服务器的主机名/ip地址和文件夹位置。我们保留了一个独立文件,在这个文件中你需要提供需要备份的文件/目录。我们添加了两个脚本,**第一个脚本**在每次拷贝完一个文件后询问密码(如果你启用了ssh验证密钥,那么就不会询问密码),而第二个脚本中,则只会提示一次输入密码。 + +我们打算备份bckup.txt,dataconfig.txt,docs和orcledb。 + + [root@Fedora21 tmp]# ls -l + total 12 + -rw-r--r--. 1 root root 0 May 15 10:43 bckrsync.sh + -rw-r--r--. 1 root root 0 May 15 10:44 bckup.txt + -rw-r--r--. 1 root root 0 May 15 10:46 dataconfig.txt + drwxr-xr-x. 2 root root 4096 May 15 10:45 docs + drwxr-xr-x. 2 root root 4096 May 15 10:44 oracledb + +该文件包含了备份文件/目录的详情 + + [root@Fedora21 tmp]# cat /tmp/bckup.txt + /tmp/oracledb + /tmp/dataconfig.txt + /tmp/docs + [root@Fedora21 tmp]# + +### 脚本 1: ### + + #!/bin/bash + + #We will save path to backup file in variable + backupf='/tmp/bckup.txt' + + #Next line just prints message + echo "Shell Script Backup Your Files / Directories Using rsync" + + #next line check if entered value is not null, and if null it will reask user to enter Destination Server + while [ x$desthost = "x" ]; do + + #next line prints what userd should enter, and stores entered value to variable with name desthost + read -p "Destination backup Server : " desthost + + #next line finishes while loop + done + + #next line check if entered value is not null, and if null it will reask user to enter Destination Path + while [ x$destpath = "x" ]; do + + #next line prints what userd should enter, and stores entered value to variable with name destpath + read -p "Destination Folder : " destpath + + #next line finishes while loop + done + + #Next line will start reading backup file line by line + for line in `cat $backupf` + + #and on each line will execute next + do + + #print message that file/dir will be copied + echo "Copying $line ... " + #copy via rsync file/dir to destination + + rsync -ar "$line" "$desthost":"$destpath" + + #this line just print done + echo "DONE" + + #end of reading backup file + done + +#### 运行带有输出结果的脚本 #### + + [root@Fedora21 tmp]# ./bckrsync.sh + Shell Script Backup Your Files / Directories Using rsync + Destination backup Server : 104.*.*.41 + Destination Folder : /tmp + Copying /tmp/oracledb ... + The authenticity of host '104.*.*.41 (104.*.*.41)' can't be established. + ECDSA key fingerprint is 96:11:61:17:7f:fa:...... + Are you sure you want to continue connecting (yes/no)? yes + Warning: Permanently added '104.*.*.41' (ECDSA) to the list of known hosts. + root@104.*.*.41's password: + DONE + Copying /tmp/dataconfig.txt ... + root@104.*.*.41's password: + DONE + Copying /tmp/docs ... + root@104.*.*.41's password: + DONE + [root@Fedora21 tmp]# + +### 脚本 2: ### + + #!/bin/bash + + #We will save path to backup file in variable + backupf='/tmp/bckup.txt' + + #Next line just prints message + echo "Shell Script Backup Your Files / Directories Using rsync" + + #next line check if entered value is not null, and if null it will reask user to enter Destination Server + while [ x$desthost = "x" ]; do + + #next line prints what userd should enter, and stores entered value to variable with name desthost + read -p "Destination backup Server : " desthost + + #next line finishes while loop + done + + #next line check if entered value is not null, and if null it will reask user to enter Destination Path + while [ x$destpath = "x" ]; do + + #next line prints what userd should enter, and stores entered value to variable with name destpath + read -p "Destination Folder : " destpath + + #next line finishes while loop + done + + #next line check if entered value is not null, and if null it will reask user to enter password + while [ x$password = "x" ]; do + #next line prints what userd should enter, and stores entered value to variable with name password. #To hide password we are using -s key + read -sp "Password : " password + #next line finishes while loop + done + + #Next line will start reading backup file line by line + for line in `cat $backupf` + + #and on each line will execute next + do + + #print message that file/dir will be copied + echo "Copying $line ... " + #we will use expect tool to enter password inside script + /usr/bin/expect << EOD + #next line set timeout to -1, recommended to use + set timeout -1 + #copy via rsync file/dir to destination, using part of expect — spawn command + + spawn rsync -ar ${line} ${desthost}:${destpath} + #as result of previous command we expect “password” promtp + expect "*?assword:*" + #next command enters password from script + send "${password}\r" + #next command tells that we expect end of file (everything finished on remote server) + expect eof + #end of expect pard + EOD + #this line just print done + echo "DONE" + + #end of reading backup file + done + +#### 运行第二个带有输出结果的脚本的屏幕截图 #### + +![rsync script](http://blog.linoxide.com/wp-content/uploads/2015/05/bckuprsync-script.png) + +希望这些脚本对你备份会有帮助!! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-shell-script/shell-script-backup-files-directories-rsync/ + +作者:[Yevhen Duma][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/yevhend/ diff --git a/translated/tech/20150521 Linux FAQs with Answers--How to change system proxy settings from the command line on Ubuntu desktop.md b/translated/tech/20150521 Linux FAQs with Answers--How to change system proxy settings from the command line on Ubuntu desktop.md new file mode 100644 index 0000000000..526de3549e --- /dev/null +++ b/translated/tech/20150521 Linux FAQs with Answers--How to change system proxy settings from the command line on Ubuntu desktop.md @@ -0,0 +1,71 @@ +Linux 有问必答--如何在桌面版 Ubuntu 中用命令行更改系统代理设置 +================================================================================ +> **问题**: 我经常需要在桌面版 Ubuntu 中更改系统代理设置,但我不想通过繁琐的 GUI 菜单链:"系统设置" -> "网络" -> "网络代理"。在命令行中有更方便的方法更改桌面版的代理设置吗? + +在桌面版 Ubuntu 中,它的桌面环境设置,包括系统代理设置,都存储在 DConf 数据库,这是简单的键值对存储。如果你想通过系统设置菜单修改桌面属性,更改会持久保存在后端的 DConf 数据库。在 Ubuntu 中更改 DConf 数据库有基于图像用户界面和非图形用户界面的两种方式。系统设置或者 dconf-editor 是访问 DConf 数据库的图形方法,而 gsettings 或 dconf 就是能更改数据库的命令行工具。 + +下面介绍如何用 gsettings 从命令行更改系统代理设置。 + +![](https://farm6.staticflickr.com/5460/17872782271_68e5267a4a_c.jpg) + +gsetting 读写特定 Dconf 设置的基本用法如下: + +更改 DConf 设置: + + $ gsettings set + +读取 DConf 设置: + + $ gsettings get + +### 通过命令行更改系统代理设置为手动 ### + +桌面版 Ubuntu 中下面的命令会更改 HTTP 代理设置为 "my.proxy.com:8000"。 + + $ gsettings set org.gnome.system.proxy.http host 'my.proxy.com' + $ gsettings set org.gnome.system.proxy.http port 8000 + $ gsettings set org.gnome.system.proxy mode 'manual' + +如果你还想更改 HTTPS/FTP 代理为手动,用这些命令: + + $ gsettings set org.gnome.system.proxy.https host 'my.proxy.com' + $ gsettings set org.gnome.system.proxy.https port 8000 + $ gsettings set org.gnome.system.proxy.ftp host 'my.proxy.com' + $ gsettings set org.gnome.system.proxy.ftp port 8000 + +更改套接字主机设置为手动: + + $ gsettings set org.gnome.system.proxy.socks host 'my.proxy.com' + $ gsettings set org.gnome.system.proxy.socks port 8000 + +上面的更改都只适用于当前的桌面用户。如果你想在系统范围内使用代理设置更改,在 gsettings 命令面前添加 sudo。例如: + + $ sudo gsettings set org.gnome.system.proxy.http host 'my.proxy.com' + $ sudo gsettings set org.gnome.system.proxy.http port 8000 + $ sudo gsettings set org.gnome.system.proxy mode 'manual' + +### 在命令行中更改系统代理设置为自动 ### + +如果你正在使用 [自动配置代理][1] (proxy auto configuration,PAC),输入以下命令更改为 PAC。 + + $ gsettings set org.gnome.system.proxy mode 'auto' + $ gsettings set org.gnome.system.proxy autoconfig-url http://my.proxy.com/autoproxy.pac + +### 在命令行中清除系统代理设置 ### + +最后,清除所有 手动/自动 代理设置,还原为无代理设置: + + $ gsettings set org.gnome.system.proxy mode 'none' + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/change-system-proxy-settings-command-line-ubuntu-desktop.html + +作者:[Dan Nanni][a] +译者:[ictlyh](https://github.com/ictlyh) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:http://xmodulo.com/how-to-set-up-proxy-auto-config-on-ubuntu-desktop.html \ No newline at end of file diff --git a/translated/tech/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md b/translated/tech/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md new file mode 100644 index 0000000000..def6860616 --- /dev/null +++ b/translated/tech/20150521 Linux FAQs with Answers--How to install Unity Tweak Tool on Ubuntu desktop.md @@ -0,0 +1,42 @@ +Linux 有问必答--如何在桌面版 Ubuntu 中安装 Unity Tweak Tool +================================================================================ +> **问题**: 我试着给刚安装的桌面版 Ubuntu 自定制桌面。我想使用 Unity Tweak Tool。我怎样才能在 Ubuntu 上安装 Unity Tweak Tool 呢? + +[Unity Tweak Tool][1] 是个流行的 Unity 桌面自定制工具。顾名思义,该工具只适用于 Ubuntu 的默认桌面环境(例如,基于 Unity 的 GNOME 桌面)。这个多功能的工具允许你通过非常直观和简单易用的图形用户界面自定义多种 Unity 桌面特性。它的菜单看起来类似于 Ubuntu 的官方系统设置,但它的桌面自定制能力远远超过默认的系统设置。通过使用 Unity Tweak Tool,你可以自定制外观、行为以及很多桌面组件的配置,例如工作区、窗口、图标、主题、光标、字体、滑动、热键等等。如果你是 Unity 桌面用户,Unity Tweak Tool 一定是个必不可少的应用程序。 + +![](https://farm6.staticflickr.com/5463/17684020389_25dc7f0db2_b.jpg) + +尽管 Unity Tweak Tool 是桌面版 Ubuntu 的重要工具,并没有在桌面版 Ubuntu 中预安装。为了能自定制 Unity 桌面,下面介绍一下如何在桌面版 Ubuntu 中安装 Unity Tweak Tool。 + +### 在 Ubuntu 13.04 或更高版本中安装 Unity Tweak Tool ### + +从 Ubuntu 13.04 开始, Ubuntu 的基础库中就有 Unity Tweak Tool 了。因此它的安装非常简单: + + $ sudo apt-get install unity-tweak-tool + +启动 Unity Tweak Tool: + + $ unity-tweak-tool + +如果你想使用最新版本的 Unity Tweak Tool,你可以从它的 PPA 中安装(如下所述)。 + +### 在 Ubuntu 12.10 中安装 Unity Tweak Tool ### + +注意,Unity Tweak Tool 要求 Ubuntu 12.10 或更高的版本。如果你想着 Ubuntu 上安装它,你可以安装下面方法使用 PPA。当你想测试最新的开发版的时候这个 PPA 库也非常有用。 + + $ sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-daily + $ sudo apt-get update + $ sudo apt-get install unity-tweak-tool + +-------------------------------------------------------------------------------- + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni +[1]:https://launchpad.net/unity-tweak-tool \ No newline at end of file diff --git a/translated/tech/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md b/translated/tech/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md new file mode 100644 index 0000000000..dc039ba551 --- /dev/null +++ b/translated/tech/20150525 Linux ntopng--Network Monitoring Tool Installation Screenshots.md @@ -0,0 +1,189 @@ +Linux ntopng——网络监控工具的安装(附截图) +================================================================================ +当今世界,人们的计算机都相互连接,互联互通。小到你的家庭局域网(LAN),大到最大的一个被我们称为的——互联网。当你管理一台联网的计算机时,你就是在管理最关键的组件之一。由于大多数开发出的应用程序都基于网络,网络就连接起了这些关键点。 + +这就是为什么我们需要网络监控工具。最好的网络监控工具之一,它叫作ntop。来自[维基百科][1]的知识“ntop是一个网络探测器,它以与top显示进程般类似的方式显示网络使用率。在交互模式中,它显示了用户终端上的网络状态。在网页模式中,它作为网络服务器,创建网络状态的HTML转储文件。它支持NetFlow/sFlowemitter/collector,这是一个基于HTTP的客户端界面,用于创建ntop为中心的监控应用和RRD用于持续地存储通信数据” + +15年后的今天,你将见到ntopng——下一代ntop。 + +### ntopng是什么 ### + +Ntopng是一个基于网页的高速通信分析器和流量收集器。Ntopng基于ntop,它运行于所有Unix平台、MacOS X和Windows。 + +### 特性 ### + +从[ntopng网站][2]上,我们可以看到他们说它有众多的特性。这里列出了其中一些: + +- 按各种协议对网络通信排序 +- 显示网络通信和IPv4/v6激活的主机 +- 持续不断以RRD格式存储定位主机的通信数据到磁盘 +- 通过nDPI,ntop的DPI框架,发现应用协议 +- 显示各种协议间的IP通信分布 +- 分析IP通信,并根据源/目的地址进行排序 +- 显示IP通信子网的矩阵(谁在和谁通信?) +- 报告按协议类型排序的IP协议使用率 +- 生成HTML5/AJAX网络通信数据 + +### 安装 ### + +Ntop为CentOS和**基于64位**Ubuntu预编译好了包,你可以在[他们的下载页面][3]找到这些包。对于32位操作系统,你必须从源代码编译。本文在**CentOS 6.4 32位**版本上**测试过**。但是,它也可以在其它基于CentOS/RedHat的Linux版本上工作。让我们开始吧。 + +#### 先决条件 #### + +#### 开发工具 #### + +你必须确保你安装了编译ntopng所需的所有开发工具,要安装开发工具,你可以使用yum命令: + + # yum groupinstall ‘Development Tools’ + +#### 安装TCL #### + + # yum install tcl + +#### 安装libpcap #### + + # yum install libpcap libcap-devel + +#### 安装Redis #### + + # wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz + # tar zxfv redis-2.6.13.tar.gz + # cd redis-2.6.13 + # make 32bit + # make test + # make install + +### 安装ntopng ### + +#### 方法 1 : #### + + # wget http://sourceforge.net/projects/ntop/files/ntopng/ntopng-1.1_6932.tgz/download + # tar zxfv ntopng-1.1_6932.tgz + # cd ntopng-1.1_6932 + # ./configure + # make + # make install + +#### 方法 2 : #### + +在我的CentOS 6.4上,我使用方法 1时收到了一个错误消息,错误消息内容如下: + + ./third-party/LuaJIT-2.0.2/src/libluajit.a : could not read symbols : File in wrong format + +所以,我**切换**到了**SVN**来安装。对于此方法,需要联网,步骤如下: + + # svn co https://svn.ntop.org/svn/ntop/trunk/ntopng/ + # ./autogen.sh + # ./configure + # make + # make install + +*由于ntopng是一个基于网页的应用,你的系统必须安装有工作良好的网络服务器* + +### 为ntopng创建配置文件 ### + +如果一切都已安装完毕,那么我们该来运行它了。默认情况下,如果我们在./configure这一步没有明确修改安装文件夹的话,redis和ntopng将安装到/usr/local/文件夹。接下来,我们需要为ntopng创建配置文件。在本文中,我们使用vi作为文本编辑器。你也可以使用你所中意的文本编辑器来创建ntopng的配置文件。 + + # cd /usr/local/etc + # mkdir ntopng + # cd ntopng + # vi ntopng.start + + 放入这些行: + --local-network “10.0.2.0/24” + --interface 1 + + # vi ntopng.pid + + 放入该行: + -G=/var/run/ntopng.pid + +保存这些文件,然后继续下一步。 + +### 运行ntopng ### + +我们假定你已正确安装了网络服务器,那么下一步就是运行redis服务器。 + + # /usr/local/bin/redis-server + +![Starting Redis Server](http://blog.linoxide.com/wp-content/uploads/2013/11/redis-server-start.png) + +然后,**运行**ntopng + + # /usr/local/bin/ntopng + +![Starting Ntopng](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng-start.png) + +### 测试ntopng ### + +现在,你可以通过访问[http://yourserver.name:3000][4]来测试ntopng应用,你将会看到ntopng登录页面。首次登录,你可以使用用户‘**admin**’和密码‘**admin**’。 + +![Ntop Login page](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_login.png) + +仪表盘相当简洁。当你登入后,你将看到关于最高流量通信者页面。 + +![Ntopng Flow Talker](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_talkers.png) + +如果你点击右侧顶部的**流量菜单**,ntopng将会显示活动流量的更多细节。 + +![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) + +如果你点击**主机 > 交互**,ntop将显示一个漂亮的主机间的交互信息图表。 + +![Ntopng Hosts Interaction](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_hosts_interaction.png) + +**仪表盘菜单**组成部分: + +#### 顶级主机(发送+接收) #### + +![Ntopng Hosts](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_hosts.png) + +#### 顶级应用协议 #### + +![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) + +**协议菜单**将为你显示使用了多少协议及其使用百分比。 + +![Ntopng protocol](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_protocol.png) + +![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) + +![Ntopng Historical Activity detail](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_historical_detail.png) + +最后一项要点是,你也可以通过顶部右侧区域的**设置菜单**(齿轮图标的那一个)管理哪些用户可以访问ntopng。 + +![Ntopng Users](http://blog.linoxide.com/wp-content/uploads/2013/11/ntopng_users.png) + +Ntopng为你提供了一个范围宽广的时间线,从5分钟到1年都可以。你只需要点击你想要现实的时间线。图标本身是可以点击的,你可以点击它来进行缩放。 + +当然,ntopng能做的事比上面图片中展示的还要多得多。你也可以将定位和电子地图服务整合进来。在ntopng自己的网站上,有已付费的模块可供使用,如nprobe可以扩展ntopng可以提供给你的信息。更多关于ntopng的信息,你可以访问[ntopng网站][5]。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/monitoring-2/ntopng-network-monitoring-tool/ + +作者:[Pungki Arianto][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/pungki/ +[1]:http://en.wikipedia.org/wiki/Ntop +[2]:http://www.ntop.org/products/ntop/ +[3]:http://www.nmon.net/packages/ +[4]:http://yourserver.name:3000/ +[5]:http://www.ntop.org/ diff --git a/translated/tech/20150527 3 Useful Hacks Every Linux User Must Know.md b/translated/tech/20150527 3 Useful Hacks Every Linux User Must Know.md new file mode 100644 index 0000000000..25c1ef3e3d --- /dev/null +++ b/translated/tech/20150527 3 Useful Hacks Every Linux User Must Know.md @@ -0,0 +1,78 @@ +每个Linux用户都应该知道的3个有用技巧 +================================================================================ +Linux世界充满了乐趣,我们越深入进去,就会发现越多有趣的事物。我们会努力给你提供一些小技巧,让你和其他人有所不同,下面就是我们准备的3个小技巧。 + +### 1. 如何在不使用Cron的情况调度Linux下的作业 ### +在Linux下,调度一个作业/命令可以缩写为Cron。当我们需要调度一个作业时,我们会使用Cron,但你知道我们在不使用Cron的情况也可以调度一个在将来时间运行的作业吗?你可以按照如下建议操作…… + +每5秒钟运行一个命令(date)然后将结果写入到一个文件(data.txt)。为了实现这一点,我们可以直接在命令提示符运行如下单行脚本。 + + $ while true; do date >> date.txt ; sleep 5 ; done & + +上述脚本的解释: + +- `while true` :让脚本进入一个条件总为真的循环中,也就是制造一个死循环,将里边的命令一遍遍地重复运行。 +- `do` :`do`是`while`语句中的关键字,它之后的命令会被执行,在它后边可以放置一个或一系列命令。 +- `date >> date.txt` :运行date命令,并将其输出写入到data.txt文件中。注意我们使用`>>`,而不是`>`。 +- `>>` :对文件(date.txt)进行追加写的操作,这样每次运行命令后,输出内容会被追加到文件中。如果使用`>`的话,则会一遍遍地覆盖之前的内容。 +- `sleep 5` :让脚本处于5秒睡眠状态,然后再运行之后的命令。注意这里的时间单位只能用秒。也就是说如果你想让命令每6分钟运行一次,你应该使用`sleep 360`。 +- `done` :`while`循环语句块结束的标记。 +- `&` :将整个进程放到后台运行。 + +类似地,我们可以这样运行任何脚本。下边的例子是每100秒运行一个名为`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] + +### 2. 如何不使用clear命令清空终端的内容 ### + +你如何清空终端的内容?你可能会认为这是一个傻问题。好吧,大家都清楚可以使用`clear`命令。如果养成使用`ctrl + l`快捷键的习惯,我们会节省大量时间。 + +`Ctrl + l`快捷键的效果和`clear`命令一样。所以下一次你就可以使用`ctrl + l`来清空终端的内容了。 + +**总结**:因为`ctrl + l`是一个快捷键,我们不可以在脚本中使用。所以如果我们需要在脚本中清空屏幕内容,还是需要使用`clear`命令。但我能想到的所有其他情况,`ctrl + l`都更加有效。 + +### 3. 运行一个命令,然后自动回到当前的工作目录 ### + +这是一个很多人可能不知道的令人吃惊的技巧。你可能想运行任何一个命令,然后再回到当前目录。你只需要将命令放在一个圆括号里。 + +我们来看一个例子: + + avi@deb:~$ (cd /home/avi/Downloads/) + +#### 示例输出 #### + + 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 + -rw-r----- 1 avi avi 54272 May 3 18:37 text3.txt + avi@deb:~$ + +在上述命令中,它首先进入Downloads目录,然后列出文件内容,最后又回到了当前目录。并且它证明了命令成功执行了。你可以在括号中包含任何命令,执行完都会顺利返回到当前目录。 + +这就是全部内容了,如果你知道任何类似的Linux技巧,你可以在文章下面的评论框中分享给我们,不要忘记将本文和朋友分享 :) + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/useful-linux-hacks-commands/ + +作者:[Avishek Kumar][a] +译者:[goreliu](https://github.com/goreliu) +校对:[校对者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/11-cron-scheduling-task-examples-in-linux/ \ No newline at end of file diff --git a/translated/tech/20150527 How To Check Laptop CPU Temperature In Ubuntu.md b/translated/tech/20150527 How To Check Laptop CPU Temperature In Ubuntu.md new file mode 100644 index 0000000000..ace8999edb --- /dev/null +++ b/translated/tech/20150527 How To Check Laptop CPU Temperature In Ubuntu.md @@ -0,0 +1,83 @@ +如何在Ubuntu中检查笔记本CPU的温度 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Monitor_temperature_Ubuntu.png) + +笔记本过热是最近一个常见的问题。监控硬件温度或许可以帮助你诊断笔记本为什么会过热。本篇中,我们会**了解如何在Ubuntu中检查CPU的温度**。 + +我们将使用一个GUI工具[Psensor][1],它允许你在Linux中监控硬件温度。用Psensor你可以: + +- 监控cpu和主板的温度 +- 监控NVidia GPU的文档 +- 监控硬盘的温度 +- 监控风扇的速度 +- 监控CPU的利用率 + +Psensor最新的版本同样提供了Ubuntu中的指示小程序,这样使得在Ubuntu中监控温度变得更加容易。你可以选择在面板的右上角显示温度。它还会在温度上过阈值后通知。 + + +### 如何在Ubuntu 15.04 和 14.04中安装Psensor ### + +在安装Psensor前,你需要安装和配置[lm-sensors][2],一个用于硬件监控的命令行工具。如果你想要测量磁盘温度,你还需要安装[hddtemp][3]。要安装这些工具,运行下面的这些命令: + + sudo apt-get install lm-sensors hddtemp + +接着开始检测硬件传感器: + + sudo sensors-detect + +要确保已经工作,运行下面的命令: + + sensors + +它会给出下面这样的输出: + + acpitz-virtual-0 + Adapter: Virtual device + temp1: +43.0°C (crit = +98.0°C) + + coretemp-isa-0000 + Adapter: ISA adapter + Physical id 0: +44.0°C (high = +100.0°C, crit = +100.0°C) + Core 0: +41.0°C (high = +100.0°C, crit = +100.0°C) + Core 1: +40.0°C (high = +100.0°C, crit = +100.0°C) + +如果一切看上去没问题,使用下面的命令安装Psensor: + + sudo apt-get install psensor + +安装完成后,在Unity Dash中运行程序。第一次运行时,你应该配置Psensor该监控什么状态。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu.jpeg) + +### 在面板显示温度 ### + +如果你想要在面板中显示温度,进入**Sensor Preferences**: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu_1.jpeg) + +在 **Application Indicator** 菜单下,选择你想要显示温度的组件并勾上 **Display sensor in the label** 选项。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu_2.jpeg) + +### 每次启动启动Psensor ### + +进入 **Preferences->Startup** 并选择 **Launch on session startup** 使每次启动时启动Psensor。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/05/Psensor_Ubuntu_3.jpeg) + +就是这样。你所要做的就是在这里监控CPU温度。你可以时刻注意并帮助你找出使计算机过热的进程。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/check-laptop-cpu-temperature-ubuntu/ + +作者:[Abhishek][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://wpitchoune.net/blog/psensor/ +[2]:http://www.lm-sensors.org/ +[3]:https://wiki.archlinux.org/index.php/Hddtemp diff --git a/translated/tech/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md b/translated/tech/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md new file mode 100644 index 0000000000..20211ab6bf --- /dev/null +++ b/translated/tech/20150527 How to Kill Linux Processes or Unresponsive Applications Using 'xkill' Command.md @@ -0,0 +1,93 @@ +如何使用xkill命令傻点Linux进程/未响应的程序 +================================================================================ +我们如何在Linux中杀掉一个资源/进程?很明显我们会找出资源的pid然后用kill命令。 + +更准确一点,我们可以找到资源(这里就是terminal)的PID: + + $ ps -A | grep -i terminal + + 6228 ? 00:00:00 gnome-terminal + +上面的输出中,‘6288’就是进程(gnome-terminal)的pid, 使用下面的命令来杀掉进程。 + + $ kill 6228 + +kill命令会发送一个信号给该pid的进程。 + +另外一个方法是我们可以使用pkill命令,它可以基于进程的名字或者其他的属性来杀掉进程。同样我们要杀掉一个叫terminal的进程可以这么做: + + $ pkill terminal + +**注意**: pkill命令后面进程名的长度不大于15个字符 + +pkill看上去更加容易上手,因为你你不用找出进程的pid。但是如果你要对系统做更好的控制,那么没有什么可以打败'kill'。使用kill命令可以更好地审视你要杀掉的进程。 + +我们已经有一篇覆盖了[kill、pkill和killall命令][1]间细节的指导了。 + +对于那些运行X Server的人而言,有另外一个工具称为xkill可以将进程从X Window中杀掉而不必传递它的名字或者pid。 + +xkill工具强制X server关闭于它客户端之间的联系,这可以让X resource关闭这个客户端。xkill是X11工具集中一个非常容易上手的杀掉无用窗口的工具。 + +它支持的选项如在同时运行多个X Server时使用-display选项后面跟上显示号连接到指定的X server,使用-all(并不建议)杀掉所有在屏幕上的所遇顶层窗口,同时将帧(-frame)也计算在内。 + +要得到所有的客户端你可以运行: + + $ xlsclients + +#### 示例输出 #### + + ' ' /usr/lib/libreoffice/program/soffice + deb gnome-shell + deb Docky + deb google-chrome-stable + deb soffice + deb gnome-settings-daemon + deb gnome-terminal-server + +如果后面没有跟上资源id,xkill会将鼠标指针变成一个特殊符号,类似于“X”。只需在你要杀掉的窗口上点击,它就会杀掉它与server端的通信,这个程序就被杀掉了。 + + + $ xkill + +![Xkill Command](http://www.tecmint.com/wp-content/uploads/2015/05/Xkill.png) + +使用xkill杀掉进程 + +需要注意的是xkill并不能保证它的通信会被成功杀掉/退出。大多数程序会在与服务端的通信被关闭后杀掉。然而仍有少部分会继续运行。 + +需要指出的点是: + +- 这个工具只能在X11 server运行的时候才能使用,因为这是X11工具的一部分。 +- 不要在你杀掉一个资源而它没有完全退出时而困惑。 +- 这不是kill的替代品 + +**我需要在linux命令行中使用xkill么** + +不是,你不必在命令行中运行xkill。你可以设置一个快捷键,并用它来调用xkill。 + +下面是如何在典型的gnome3桌面中设置键盘快捷键。 + +进入设置-> 选择键盘。点击'+'并添加一个名字和命令。点击点击新条目并按下你想要的组合键。我的是Ctrl+Alt+Shift+x。 + +![Gnome Settings](http://www.tecmint.com/wp-content/uploads/2015/05/22.png) + +Gnome 设置 + +![Add Shortcut Key](http://www.tecmint.com/wp-content/uploads/2015/05/31.png) + +添加快捷键 + +下次你要杀掉X资源只要用组合键就行了(Ctrl+Alt+Shift+x),你看到你的鼠标变成x了。点击想要杀掉的x资源就行了。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/kill-processes-unresponsive-programs-in-ubuntu/ + +作者:[Avishek Kumar][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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/how-to-kill-a-process-in-linux/ diff --git a/translated/tech/20150527 Linux FAQs with Answers--How to mount an LVM partition on Linux.md b/translated/tech/20150527 Linux FAQs with Answers--How to mount an LVM partition on Linux.md new file mode 100644 index 0000000000..391769edc2 --- /dev/null +++ b/translated/tech/20150527 Linux FAQs with Answers--How to mount an LVM partition on Linux.md @@ -0,0 +1,89 @@ +Linux有问必答 -- 如何在Linux中挂载LVM分区 +================================================================================ +> **提问**: 我有一个USB盘包含了LVM分区。 我想要在Linux中访问这些LVM分区。我该如何在Linux中挂载LVM分区? + +】LVM是逻辑卷管理工具,它允许你使用逻辑卷和卷组的概念来管理磁盘空间。使用LVM相比传统分区最大的好处是弹性地位用户和程序分配空间而不用考虑每个物理磁盘的大小。 + +在LVM中,那些创建了逻辑分区的物理存储是传统的分区(比如:/dev/sda2,/dev/sdb1)。这些分区必须被初始化位“物理卷”并被标签(如,“Linux LVM”)来使它们可以在LVM中使用。一旦分区被标记被LVM分区,你不能直接用mount命令挂载。 + +如果你尝试挂载一个LVM分区(比如/dev/sdb2), 你会得到下面的错误。 + + $ mount /dev/sdb2 /mnt + +---------- + + mount: unknown filesystem type 'LVM2_member' + +![](https://farm8.staticflickr.com/7696/17749902190_0a6d36821f_b.jpg) + +要正确地挂载LVM分区,你必须挂载分区创建的“逻辑分区”。下面就是如何做的。 + +=首先,用下面的命令检查可用的卷组: + + $ sudo pvs + +---------- + + PV VG Fmt Attr PSize PFree + /dev/sdb2 vg_ezsetupsystem40a8f02fadd0 lvm2 a-- 237.60g 0 + +![](https://farm8.staticflickr.com/7657/17938136831_d9320b7bfc_b.jpg) + +物理卷的名字和卷组的名字分别在PV和VG列的下面。本例中,只有一个创建在dev/sdb2下的组“vg_ezsetupsystem40a8f02fadd0”。 + +接下来检查卷组中存在的逻辑卷,使用lvdisplay命令: + + $ sudo lvdisplay + +使用lvdisplay显示了可用卷的信息(如:设备名、卷名、卷大小等等)。 + + $ sudo lvdisplay /dev/vg_ezsetupsystem40a8f02fadd0 + +---------- + + --- Logical volume --- + LV Path /dev/vg_ezsetupsystem40a8f02fadd0/lv_root + LV Name lv_root + VG Name vg_ezsetupsystem40a8f02fadd0 + LV UUID imygta-P2rv-2SMU-5ugQ-g99D-A0Cb-m31eet + LV Write Access read/write + LV Creation host, time livecd.centos, 2015-03-16 18:38:18 -0400 + LV Status available + # open 0 + LV Size 50.00 GiB + Current LE 12800 + Segments 1 + Allocation inherit + Read ahead sectors auto + - currently set to 256 + Block device 252:0 + +![](https://farm8.staticflickr.com/7707/17938137591_cdb4cbfb43_b.jpg) + +如果你想要挂载一个特定的逻辑卷,使用“LV Path”下面的设备名(如:/dev/vg_ezsetupsystem40a8f02fadd0/lv_home)。 + + $ sudo mount /dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt + +你可以用mount命令不带任何参数检查挂载状态,这会显示所有已挂载的文件系统。 + + $ mount + +![](https://farm6.staticflickr.com/5449/17749903670_2ee617445d_c.jpg) + +如果你想在每次启动时自动挂载逻辑卷,在/etc/fstab中添加下面的行,你可以指定卷的文件系统类型(如 ext4),它可以从mount命令的输出中找。 + + /dev/vg_ezsetupsystem40a8f02fadd0/lv_home /mnt ext4 defaults 0 0 + +现在逻辑卷会在每次启动时挂载到/mnt。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/mount-lvm-partition-linux.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni \ No newline at end of file diff --git a/translated/tech/20150528 27 'DNF' Fork of Yum Commands for RPM Package Management in Linux.md b/translated/tech/20150528 27 'DNF' Fork of Yum Commands for RPM Package Management in Linux.md new file mode 100644 index 0000000000..48dd213d68 --- /dev/null +++ b/translated/tech/20150528 27 'DNF' Fork of Yum Commands for RPM Package Management in Linux.md @@ -0,0 +1,287 @@ +27LinuxߡDNFYumķ֧ +================================================================================ +DNFDandified YUMǻRPMķаһߡFedora 18г֣еFedora 22[YUM߼][1] + +![](http://www.tecmint.com/wp-content/uploads/2015/05/linux-dnf-command-examples.jpg) + +DNFڸYUMƿܡڴռáٶȺ档DNFʹRPMlibsolvhawkeyаδԤװCentOSRHEL 7Уͨyumװͬʱʹöߡ + +ҲĶDNFϢ + +- [ʹDNFȡYumԭ][2] + +µDNFȶ汾2015511շ1.0дƪ֮ǰԼDNF֮ǰ汾ҪPythonдGPL v2֤ + +### װDNF ### + +Fedora 22ٷѾɵDNFDNFRHEL/CentOS 7ĬϲֿС + +ΪRHEL/CentOSϵͳаװDNFҪȰװͿepel-releaseֿ⡣ + + # yum install epel-release + + # yum install epel-release -y + +ܲʹyumʱ'-y'ѡΪûǿʲôװϵͳСԴ˲⣬ʹ'-y'ѡԶİװûԤ + +ʹyumepel-realeaseֿⰲװDNF + + # yum install dnf + +װdnfһչʾ27ʵõdnfӣԱ׺͸ЧĹRPMķа档 + +### 1. DNF汾 ### + +ϵͳϰװDNF汾 + + # dnf --version + +![DNF汾](http://www.tecmint.com/wp-content/uploads/2015/05/Check-DNF-Version.gif) + +### 2. гDNFֿ ### + +dnfе'repolist'ѡʾϵͳпIJֿ⡣ + + # dnf repolist + +![пIJֿ](http://www.tecmint.com/wp-content/uploads/2015/05/Check-All-Enabled-Repositories.gif) + +### 3. гп͹رյDNFֿ ### + +'repolist all'ѡʾϵͳп/رյIJֿ⡣ + + # dnf repolist all + +![гп/رյIJֿ](http://www.tecmint.com/wp-content/uploads/2015/05/Check-All-Repositories.gif) + +### 4. DNFгпõѰװ ### + +'dnf list'гвֿпõLinuxϵͳѰװ + + # dnf list + +![DNFге](http://www.tecmint.com/wp-content/uploads/2015/05/List-All-Packages.png) + +### 5. DNFгѰװ ### + +'dnf list'гвֿпõѰװȻһʹ'list installed'ѡֻгѰװ + + # dnf list installed + +![гѰװ](http://www.tecmint.com/wp-content/uploads/2015/05/List-Installed-Packages.png) + +### 6. DNFгпõ ### + +Ƶģ'list available'ѡгпIJֿпõ + + # dnf list available + +![DNFгõ](http://www.tecmint.com/wp-content/uploads/2015/05/List-Available-Packages.png) + +### 7. ʹDNF ### + +̫밲װ֣£ʹ'search'ѡƥַ磬nanoַ + + # dnf search nano + +![ͨؼ](http://www.tecmint.com/wp-content/uploads/2015/05/Search-Package.gif) + +### 8. 鿴ĸṩijļ/ ### + +dnfѡ'provides'ܲṩijļ/磬Ǹṩϵͳе'/bin/bash'ļʹ + + # dnf provides /bin/bash + +![ṩļ](http://www.tecmint.com/wp-content/uploads/2015/05/Find-Package-Sub-Package.gif) + +### 9. ʹDNFһϸϢ ### + +ڰװһǰ֪ϸϢʹ'info'һϸϢ磺 + + # dnf info nano + +![DNF鿴Ϣ](http://www.tecmint.com/wp-content/uploads/2015/05/Check-Package-Information.gif) + +### 10. ʹDNFװ ### + +밲װһnanoֻΪnanoԶĽͰװе + + # dnf install nano + +![DNFװ](http://www.tecmint.com/wp-content/uploads/2015/05/Install-Package-DNF.gif) + +### 11. ʹDNFһ ### + +ֻһضİ磬systemdұϵͳʣ䡣 + + # dnf update systemd + +![һ](http://www.tecmint.com/wp-content/uploads/2015/05/Update-a-Package.gif) + +### 12. ʹDNFϵͳ ### + +ϵͳаװĸ¿Լ򵥵ʹdnfУ + + # dnf check-update + +![ϵͳ](http://www.tecmint.com/wp-content/uploads/2015/05/Check-For-System-Update.gif) + +### 13. ʹDNFװϵͳе ### + +ʹϵͳѰװ + + # dnf update + + # dnf upgrade + +![ϵͳ](http://www.tecmint.com/wp-content/uploads/2015/05/Update-System.gif) + +### 14. ʹDNFƳ/ɾһ ### + +dnfʹ'remove''erase'ѡƳκβҪ + + # dnf remove nano + + # dnf erase nano + +![Ƴϵͳе](http://www.tecmint.com/wp-content/uploads/2015/05/Remove-Package.gif) + +### 15. ʹDNFƳõOrphan Packages ### + +ЩΪװӦijɾ㲻Ҫˡùɾ + + # dnf autoremove + +![Ƴõ](http://www.tecmint.com/wp-content/uploads/2015/05/Autoremove-Packages.gif) + +### 16. ʹDNFƳ ### + +ʹdnfʱڵͷͲǻᵼ´ǿʹͰԶ̰Ϣͷ + + # dnf clean all + +![ƳDNF](http://www.tecmint.com/wp-content/uploads/2015/05/Remove-Cache-Packages.gif) + +### 17. ضDNFİ ### + +ҪضDNFİ磬cleanͨõ + + # dnf help clean + +![ijһ](http://www.tecmint.com/wp-content/uploads/2015/05/Help-on-DNF-Command.gif) + +### 18. гDNFѡ ### + +ҪʾdnfѡֻҪ + + # dnf help + +![ѡ](http://www.tecmint.com/wp-content/uploads/2015/05/DNF-Options.gif) + +### 19. 鿴DNFʷ¼ ### + +Ե'dnf history'鿴Ѿִйdnfб֪ʲôװ/ƳԼʱ + + # dnf history + +![鿴ʷ¼](http://www.tecmint.com/wp-content/uploads/2015/05/Check-DNF-History.gif) + +### 20. ʾ ### + +'dnf grouplist'ԴӡпõĻѰװûʲôг֪顣 + + # dnf grouplist + +![г](http://www.tecmint.com/wp-content/uploads/2015/05/List-All-Group-Packages.gif) + +### 21. ʹDNFװһ ### + +Ҫװһһ飨磬Educational SoftawareֻҪִУ + + # dnf groupinstall 'Educational Software' + +![װһ](http://www.tecmint.com/wp-content/uploads/2015/05/Install-Group-Packages.gif) + +### 22. һ ### + +ͨһ飨磬Educational Software + + # dnf groupupdate 'Educational Software' + +![](http://www.tecmint.com/wp-content/uploads/2015/05/Update-Group-Package.gif) + +### 23. Ƴһ ### + +ʹƳһ飨磬Educational Software + + # dnf groupremove 'Educational Software' + +![Ƴ](http://www.tecmint.com/wp-content/uploads/2015/05/Remove-Group-Package.gif) + +### 24. ijضIJֿⰲװһ ### + +DNFԴκضIJֿⰲװһ磬phpmyadmin + + # dnf --enablerepo=epel install phpmyadmin + +![ضIJֿⰲװ](http://www.tecmint.com/wp-content/uploads/2015/05/Install-Package-From-Specific-Repo.gif) + +### 25. Ѱװͬȶа ### + +'dnf distro-sync'ͬѰװпIJֿȶ汾ûѡͬѰװ + + # dnf distro-sync + +![ͬȶ](http://www.tecmint.com/wp-content/uploads/2015/05/Synchronize-Packages.gif) + +### 26. °װһ ### + +'dnf reinstall nano'°װһѾװ磬nano + + # dnf reinstall nano + +![°װ](http://www.tecmint.com/wp-content/uploads/2015/05/Re-Install-Package.gif) + +### 27. һ ### + +ѡ'downgrade'ʹһ磬acpid˵Ͱ汾 + + # dnf downgrade acpid + +ʾ + + Using metadata from Wed May 20 12:44:59 2015 + No match for available package: acpid-2.0.19-5.el7.x86_64 + Error: Nothing to do. + +**ҵĹ۲**dnfᰴԤһΪһbugύ + +### ### + +DNFYUMƷԶоLinuxϵͳԱĹ磺 + +- `--skip-broken`DNFʶ𣬲DNFû +- ܻdnf providesҲû'resolvedep'ˡ +- û'deplist' +- ųһֿζвųòֿ⣬yumУųһֻֿڰװʱųǡ + +LinuxûLinux̬ϵͳ⡣[Systemd滻init system][3]vDNFڲú滻YUMFedora 22RHELCentOS + +ôأDzǷаLinux̬ϵͳעûڳûԸ㣵ķǰأITҵһ仰 - ûлΪʲôҪأSystem VYUMûл + +ƪµȫˡ·˽ı뷨޺ͷ԰Ǵлл + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/dnf-commands-for-fedora-rpm-package-management/ + +ߣ[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/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement/ +[2]:http://www.tecmint.com/dnf-next-generation-package-management-utility-for-linux/ +[3]:http://www.tecmint.com/systemd-replaces-init-in-linux/ diff --git a/translated/tech/20150528 Things To Do After Installing Fedora 22.md b/translated/tech/20150528 Things To Do After Installing Fedora 22.md new file mode 100644 index 0000000000..172c7612ae --- /dev/null +++ b/translated/tech/20150528 Things To Do After Installing Fedora 22.md @@ -0,0 +1,113 @@ +安装Fedora 22后要做的事 +================================================================================ +Fedora 22,Red Hat操作系统的社区开发版的最新成员,已经于2015年5月26日发布了。这个令人神圣的Fedora发行版充斥着各种炒作和预期,Fedora 22推出了大量的重大变化。 + +就初始化进程而言,Systemd还是个新生儿,但它已经准备好替换脆弱的sysvinit这个一直是Linux生态系统一部分的模块。另外一个用户会碰到的重大改变存在于基本仓库的python版本中,这里提供了两种不同口味的python版本2.x和3.x分线,各个都有其不同的癖好和优点。所以,那些偏好2.x口味的用户可能想要安装他们喜爱的python版本。自从Fedora 18开始被打扮得更加时髦的Yum安装器也被设置来替换过时陈旧的YUM安装器后。Fedora也已最后决定,现在是时候用DNF来替换YUM了。 +### 1) 安装VLC媒体播放器 ### + +Fedora 22默认自带了媒体播放器viz gnome视频播放器(前身是totem)。如果你对此不感冒,那么我们可以跳过这一步继续往前走。但是,如果你像我一样,偏好使用最广泛的VLC,那么就去从RPMFusion仓库安装吧。安装方法如下: + + sudo dnf install vlc -y + +### 2) 配置RPMFusion仓库 ### + +正如我已经提到过的,Fedora的意识形态很是严谨,它不会自带任何非自由组件。官方仓库不会提供一些包含有非自由组件的基本软件,比如像多媒体编码。因此,安装一些第三方仓库很有必要,这些仓库会为我们提供一些基本的软件。幸运的是,RPMFusion仓库前来拯救我们了。 + + $ sudo dnf install --nogpgcheck http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-22.noarch.rpm + +### 3) 安装多媒体编码 ### + +刚刚我们说过,一些多媒体编码和插件不会随Fedora一起发送。现在,有谁想仅仅是因为专有编码而错过他们最爱的节目和电影?试试这个吧: + + $ sudo dnf install gstreamer-plugins-bad gstreamer-plugins-bad-free-extras gstreamer-plugins-ugly gstreamer-ffmpeg gstreamer1-libav gstreamer1-plugins-bad-free-extras gstreamer1-plugins-bad-freeworld gstreamer-plugins-base-tools gstreamer1-plugins-good-extras gstreamer1-plugins-ugly gstreamer1-plugins-bad-free gstreamer1-plugins-good gstreamer1-plugins-base gstreamer1 + +### 4) 更新系统 ### + +Fedora是一个尖端的发行版,因此它会持续发布更新用以修复系统中出现的错误和漏洞。因而,保持系统更新到最新,是个不错的做法。 + + $ sudo dnf update -y + +### 5) 卸载你不需要的软件 ### + +Fedora预装了一些大多数用户可以利用的包,但是对于更高级的用户,你可能意识到你并不需要它。要移除你不需要的包相当容易,只需使用以下命令——我选择卸载rhythmbox,因为我知道我不会用到它: + + $ sudo dnf remove rhythmbox + +### 6) 安装Adobe Flash ### + +我们都希望Adobe Flash不要再存在了,因为它并不被认为是最安全的,或者资源利用最好的,但是暂时先让它待着吧。Fedora 22安装Adobe Flash的唯一途径是从Adobe安装官方RPM,就像下面这样。 + +你可以从[这里][1]下载RPM。下载完后,你可以直接右击并像下面这样打开: + +![Install Adobe Flash](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-9.50.42-PM.png) + +右击并选择“用软件安装打开” + +然后,只需在弹出窗口中点击安装: + +![Install Adobe](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-9.51.07-PM.png) + +点击“安装”来完成从Adobe安装自定义RPM的过程 + +该过程完成后,“安装”按钮会变成“移除”,而此时安装也完成了。如果在此过程中你的浏览器开着,会提示你先把它关掉或在安装完成后重启以使修改生效。 + +### 7) 用Gnome Boxes加速虚拟机 ### + +你刚刚安装了Fedora,你也很是喜欢,但是出于某些私人原因,你也许仍然需要Windows,或者你只是想玩玩另外一个Linux发行版。不管哪种情况,你都可以使用Gnome Boxes来简单地创建一个虚拟机或使用一个live发行版,Fedora 22提供了该软件。遵循以下步骤,使用你所选的ISO来开始吧!谁知道呢,也许你可以检验一下某个[Fedora Spin][2]。 + +首先,打开Gnome Boxes,然后在顶部左边选择“新建”: + +![Add a new virtual machine (box)](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.24.46-PM.png) + +点击“新建”来开始添加一个新虚拟机的进程吧。 + +接下来,点击打开文件并选择一个ISO: + +![Choose ISO](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.28.44-PM.png) + +在选择选择了选择文件或ISO后,选择你的ISO。这里,我已经安装了一个Debian ISO。 + +最后,自定义VM设置或使用默认,然后点击“创建”。VM会以默认方式启动,可用的VM会在Gnome Boxes以小缩略图的方式显示。 + +![Create VM](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-10.31.11-PM.png) + +自定义设置为你所选择的,或者也可以保持默认。完成后,点击“创建”,VM就一切就绪了。 + +### 8) 安装Google Chrome ### + +Firefox被包含在Fedora 22中,但是就跟大多数软件一样,每个人都有他们自己的选择。如果你所喜爱的浏览器恰好是Google Chrome,你可以使用和上面安装Adobe Flash Player类似的指令。然而,很明显,你得使用来自Google的任何你所下载的版本的RPM。最新的版本通常可以在[这里][3]找到。 + +### 9) 添加社交媒体和其它在线帐号 ### + +Gnome自带有不错的内建功能用于容纳帐号相关的东西,像Facebook,Google以及其它在线帐号。你可以通过主Gnome设置应用访问在线帐号设置。然后,只需点击在线帐号,并添加你所选择的帐号。如果你要添加一个帐号,比如像Google,你可以用它来作为默认帐号,用来完成诸如发送邮件、日历提醒、相片和文档交互,以及诸如此类的更多事情。 + +### 10) 安装KDE或另一个桌面环境 ### + +我们中的某些人不喜欢Gnome,那也没问题。在终端中运行以下命令来安装KDE所需的一切来替换它。这些指令也可以用以安装xfce、lxde或其它桌面环境。 + + $ sudo dnf install @kde-desktop + +安装完成后,登出。当你点击你的用户名时,注意那个表示设置的小齿轮。点击它,然后选择“Plasma”。当你再次登录时,一个全新的KDE桌面就会欢迎你。 + +![Plasma on Fedora 22](http://blog.linoxide.com/wp-content/uploads/2015/05/Screen-Shot-2015-05-27-at-11.32.27-PM.png) + +刚刚安装到Fedora 22上的Plasma环境 + +### 尾声 ### + +就是这样了,一切就绪。使用新系统吧,试试新东西。如果你找不到与你喜好相关的东西,linux赋予你自由修改它的权利。Fedora自带有最新的Gnome Shell作为其桌面环境,如果你觉得太臃肿而不喜欢,那么试试KDE或一些轻量级的DE,像Cinnamon、xfce之类。愿你的Fedora之旅十分开心并且没有困扰。!! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/things-do-after-installing-fedora-22/ + +作者:[Jonathan DeMasi][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/jonathande/ +[1]:https://get.adobe.com/flashplayer/ +[2]:http://spins.fedoraproject.org/ +[3]:https://www.google.com/intl/en/chrome/browser/desktop/index.html diff --git a/translated/tech/20150601 How to monitor Linux servers with SNMP and Cacti.md b/translated/tech/20150601 How to monitor Linux servers with SNMP and Cacti.md new file mode 100644 index 0000000000..cc76945bd8 --- /dev/null +++ b/translated/tech/20150601 How to monitor Linux servers with SNMP and Cacti.md @@ -0,0 +1,181 @@ +使用SNMP和Cacti监控Linux服务器 +================================================================================ +SNMP(或者叫简单网络管理协议)用于收集设备内部发生的数据,如负载、磁盘状态、带宽之类。像Cacti这样的网络监控工具用这些数据来生成图标以达到监控的目的。 + +在一个典型的Cacti和SNMP部署中,会有一台或多台启用了SNMP的设备,以及一台独立的用来从那些设备收集SNMP回馈的监控服务器。请记住,所有需要监控的设备必须启用SNMP。在本教程中,出于演示目的,我们将在同一台Linux服务器上配置Cacti和SNMP。 + +### 在Debian或Ubuntu上配置SNMP ### + +要安装SNMP代理(snmpd)到基于Debian的系统,请运行以下命令: + + root@server:~# apt-get install snmpd + +然后,如下编辑配置文件。 + + root@server:~# vim /etc/snmp/snmpd.conf + +---------- + + # this will make snmpd listen on all interfaces + agentAddress udp:161 + + # a read only community 'myCommunity' and the source network is defined + rocommunity myCommunity 172.17.1.0/24 + + sysLocation Earth + sysContact email@domain.tld + +在编辑完配置文件后,重启snmpd。 + + root@server:~# service snmpd restart + +### 在CentOS或RHEL上配置SNMP ### + +要安装SNMP工具和库,请运行以下命令。 + + root@server:~# sudo yum install net-snmp + +然后,如下编辑SNMP配置文件。 + + root@server:~# vim /etc/snmp/snmpd.conf + +---------- + + # A user 'myUser' is being defined with the community string 'myCommunity' and source network 172.17.1.0/24 + com2sec myUser 172.17.1.0/24 myCommunity + + # myUser is added into the group 'myGroup' and the permission of the group is defined + group myGroup v1 myUser + group myGroup v2c myUser + view all included .1 + access myGroup "" any noauth exact all all none + +---------- + + root@server:~# service snmpd restart + root@server:~# chkconfig snmpd on + +重启snmpd服务,然后添加到启动服务列表。 + +### 测试SNMP ### + +SNMP可以通过运行snmpwalk命令进行测试。如果SNMP已经配置成功,该命令会生成大量输出。 + + root@server:~# snmpwalk -c myCommunity 172.17.1.44 -v1 + +---------- + + iso.3.6.1.2.1.1.1.0 = STRING: "Linux mrtg 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64" + iso.3.6.1.2.1.1.2.0 = OID: iso.3.6.1.4.1.8072.3.2.10 + iso.3.6.1.2.1.1.3.0 = Timeticks: (2097) 0:00:20.97 + + ~~ OUTPUT TRUNCATED ~~ + + iso.3.6.1.2.1.92.1.1.2.0 = Gauge32: 1440 + iso.3.6.1.2.1.92.1.2.1.0 = Counter32: 1 + iso.3.6.1.2.1.92.1.2.2.0 = Counter32: 0 + iso.3.6.1.2.1.92.1.3.1.1.2.7.100.101.102.97.117.108.116.1 = Timeticks: (1) 0:00:00.01 + iso.3.6.1.2.1.92.1.3.1.1.3.7.100.101.102.97.117.108.116.1 = Hex-STRING: 07 DD 0B 12 00 39 27 00 2B 06 00 + +### 配置带有SNMP的Cacti ### + +在本教程中,我们将在同一台Linux服务器上设置Cacti和SNMP。所以,去[安装Cacti][2]到刚刚配置SNMP的Linux服务器上吧。 + +安装完后,Cacti网页接口可以通过“http://172.17.1.44/cacti”来访问,当然,在你的环境中,请将IP地址换成你的服务器的地址。 + +![](http://farm6.staticflickr.com/5512/10972747655_0298f6ce6c_z.jpg) + +![](http://farm6.staticflickr.com/5532/10972982543_67e15433b8_z.jpg) + +安装过程中Cacti的路径一般都是正确的,但是如有必要,请再次检查以下。 + +![](http://farm4.staticflickr.com/3764/10972920304_138670d3cf_z.jpg) + +在首次安装过程中,Cacti默认的用户名和密码是“admin”和“admin”。在首次登录后会强制你修改密码。 + +![](http://farm6.staticflickr.com/5542/10972747775_531fe445ef_o.png) + +### 添加设备到Cacti并管理 ### + +Cacti将根据先前配置的SNMP字符串注册设备。在本教程中,我们将只添加启用了SNMP的本地服务器。 + +要添加设备,我们必须以管理员登录,然后转到Cacti管理员面板中的控制台。点击控制台 > 设备。 + +![](http://farm8.staticflickr.com/7411/10972747855_b464972e56_z.jpg) + +那里可能已经有一个名为‘localhost’的设备。我们不需要它,因为我们要创建全新的图表。我们可以将该设备从列表中删除,使用“添加”按钮来添加新设备。 + +![](http://farm8.staticflickr.com/7373/10972747895_977e0eccd6_z.jpg) + +接下来,我们设置设备参数。 + +![](http://farm8.staticflickr.com/7400/10972747935_df03500de7_z.jpg) + +由于设备已经添加,我们来指定想要创建的图表模板。你可以在该页的最后章节中找到本节内容。 + +![](http://farm4.staticflickr.com/3773/10972747955_083101e6ab_z.jpg) + +然后,我们继续来创建图表。 + +![](http://farm4.staticflickr.com/3734/10972747985_fae6b78888.jpg) + +这里,我们创建用于平均负载、RAM和硬盘、处理器的图表。 + +![](http://farm8.staticflickr.com/7374/10972920484_ed6b33b8b8_z.jpg) + +### 接口图表和64位计数器 ### + +默认情况下,Cacti在SNMP查询中使用32位计数器。32位计数器对于大多数带宽图表而言已经足够了,但是对于超过100Mbps的带宽,它就无能为力了。如果已经知道带宽会超过100Mbps,建议你使用64位计数器。使用64位计数器一点也不麻烦。 + +![](http://farm8.staticflickr.com/7320/10972982813_120fe1f3d0_z.jpg) + +**注意**: Cacti会花费大约15分钟来产生新图表,除了耐心等待,你别无选择。 + +### 创建图表树 ### + +这些截图展示了如何创建图表树,以及如何添加图表到这些树中。 + +![](http://farm8.staticflickr.com/7429/10972748045_ca06bec889_z.jpg) + +![](http://farm3.staticflickr.com/2833/10972920584_f33624862a_z.jpg) + +![](http://farm6.staticflickr.com/5548/10972836666_f31e4de0e7_z.jpg) + +![](http://farm4.staticflickr.com/3786/10972836776_1675611740_z.jpg) + +我们可以验证图表树中的图表。 + +![](http://farm4.staticflickr.com/3707/10972836836_3dabe56765_z.jpg) + +### 用户管理 ### + +最后,我们创建一个只具有查看我们刚创建的图表权限的用户。Cacti内建了用户管理系统,而且是高度可定制的。 + +![](http://farm8.staticflickr.com/7313/10972920624_61e13157f9_z.jpg) + +![](http://farm6.staticflickr.com/5536/10972920644_59a9797685_z.jpg) + +![](http://farm3.staticflickr.com/2872/10972920744_24f75fb5a8_z.jpg) + +在完成这些步骤后,我们可以使用‘user1’来登录进去,并验证只有该用户可以查看该图表。 + +![](http://farm8.staticflickr.com/7423/10972748265_c2608b3683_z.jpg) + +![](http://farm4.staticflickr.com/3763/10972748335_9cd012c6fe_z.jpg) + +至此,我们在网络监控系统中部署了一台Cacti服务器。Cacti服务器比较稳定,可以处理大量图表而不会出问题。 + +希望本文对你有所帮助。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/monitor-linux-servers-snmp-cacti.html + +作者:[Sarmed Rahman][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者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 diff --git a/translated/tech/20150601 How to monitor common services with Nagios.md b/translated/tech/20150601 How to monitor common services with Nagios.md new file mode 100644 index 0000000000..2898a57ad0 --- /dev/null +++ b/translated/tech/20150601 How to monitor common services with Nagios.md @@ -0,0 +1,269 @@ +如何用Nagios监控服务 +================================================================================ +Nagios内置了很多脚本来监控服务。本篇会使用其中一些来检查通用服务如MySql、Apache、DNS等等。 + +为了保证本篇集中在系统监控,我们不会配置hostgroup或者模板,它们已经在 [前面的教程][1]中覆盖了,它们可以满足这些条件了。 + +### 在命令行中运行Nagios ### + +通常建议在添加到Nagios前现在命令行中运行Nagios服务检测脚本。它会给出执行是否成功以及脚本的输出将会看上去的样子。 + +这些脚本存储在 /etc/nagios-plugins/config/ ,可执行文件在 /usr/lib/nagios/plugins/。 + +下面就是该怎么做 + + root@nagios:~# cd /etc/nagios-plugins/config/ + +提供的脚本包含了语法帮助。示例包含了部分输出。 + + root@nagios:~# cat /etc/nagios-plugins/config/tcp_udp.cfg + +---------- + + # 'check_tcp' command definition + define command{ + command_name check_tcp + command_line /usr/lib/nagios/plugins/check_tcp -H '$HOSTADDRESS$' -p '$ARG1$' + +了解了语法,TCP 80端口可以用下面的方法检查。 + + root@nagios:~# /usr/lib/nagios/plugins/check_tcp -H 10.10.10.1 -p 80 + +---------- + + TCP OK - 0.000 second response time on port 80|time=0.000222s;;;0.000000;10.000000 + +### 示例拓扑 ### + +本片中使用下面三台服务器。每台服务器运行多个通用服务。Nagios服务器现在运行的是Ubuntu。 + +- Server 1 (10.10.10.1) : MySQL, Apache2 +- Server 2 (10.10.10.2) : Postfix, Apache2 +- Server 3 (10.10.10.3): DNS + +首先,服务器被定义在了Nagios中。 + + root@nagios:~# vim /etc/nagios3/conf.d/example.cfg + +---------- + + define host{ + use generic-host + host_name test-server-1 + alias test-server-1 + address 10.10.10.1 + } + + define host{ + use generic-host + host_name test-server-2 + alias test-server-2 + address 10.10.10.2 + } + + define host{ + use generic-host + host_name test-server-3 + alias test-server-3 + address 10.10.10.3 + } + +### 监控MySQL服务 ### + +#### MySQL 监控需要 #### + +- 通过检查3306端口来检测MySQL是否运行中。 +- 检测特定的数据库'testDB'是否可用。 + +#### MySQL 服务器设置 #### + +开始检测MySQL时,需要记住MySQL默认只监听回环接口127.0.0.1。这增加了数据库的安全。手动调节需要告诉MySQL该监听什么其他接口。下面是该怎么做。 + +这个设置在所有的MySQL服务器上已经做了。 + + root@nagios:~# vim /etc/mysql/my.cnf + +下面这行被注释掉了来监听所有接口。 + + #bind-address = 127.0.0.1 + +同样,MySQL将不会运行任何主机来连接到它。在本机和任意主机都创建了用户‘nagios’。这个用户接着在所有的数据库中被授予所有的权限,这将在会用在监控中。 + +下面的设置对所有的MySQL服务器都已经设置。 + + root@nagios:~# mysql -u root –p + ## MySQL root password here ## + +'nagios@localhost'用户在MySQL服务器中创建了。 + + mysql> CREATE USER 'nagios'@'localhost' IDENTIFIED BY 'nagios-pass'; + mysql> GRANT ALL PRIVILEGES ON *.* TO 'nagios'@'localhost'; + +'nagios@any-host'用户创建了。 + + mysql> CREATE USER 'nagios'@'%' IDENTIFIED BY 'nagios-pass'; + mysql> GRANT ALL PRIVILEGES ON *.* TO 'nagios'@'%'; + + mysql> FLUSH PRIVILEGES; + +这使MySQL监听所有的接口,同样接受来自用户'nagios'的进入链接。 + +请注意,这种变化可能有安全隐患,所以需要说几句话: + +- 这个设置将会暴露MySQL给所有的接口,包括WAN。确保只有合法的网络访问是非常重要的。应该使用防火墙和TCP封装器等过滤器。 +- MySQL用户‘nagios’的密码应该非常强。如果只有几台Nagios服务器,那么应该创建'nagios@servername'用户而不是任意用户的'nagios@%'。 + +#### 对MySQL的NAgios配置 #### + +用下面的来做一些调整。 + + root@nagios:~# vim /etc/nagios3/conf.d/services_nagios2.cfg + +---------- + + define service{ + use generic-service + host_name test-server-1 + ;hostgroup can be used instead as well + + service_description Check MYSQL via TCP port + check_command check_tcp!3306 + } + + define service{ + use generic-service + host_name test-server-1 + ;hostgroup can be used instead as well + + service_description Check availability of database 'testDB' + check_command check_mysql_database!nagios!nagios-pass!testDB + ;check_mysql!userName!userPassword!databaseName + } + +这样,Nagios就可以同时监控MySQL服务器和数据库的可用性。 + +### 监控Apache服务器 ### + +Nagios同样也可以监控Apache服务。 + +#### Apache监控需要 #### + +- 监控apache是否可用 + +这个任务非常简单因为Nagios有一个内置命令。 + + root@nagios:~# vim /etc/nagios3/conf.d/services_nagios2.cfg + +---------- + + define service{ + use generic-service + host_name test-server-1, test-server-2 + service_description Check Apache Web Server + check_command check_http + } + +现在就非常简单了。 + +### 监控DNS服务 ### + +Nagios通过向DNS服务器查询一个完全合格域名(FQDN),或者使用dig工具来查询。默认用于FQDN的是www.google.com,但是这个可以按需改变。按照下面的文件修改来完成这个任务。 + + root@nagios:~# vim /etc/nagios-plugins/config/dns.cfg + +---------- + + ## The -H portion can be modified to replace Google ## + define command{ + command_name check_dns + command_line /usr/lib/nagios/plugins/check_dns -H www.google.com -s '$HOSTADDRESS$' + } + +编辑下面的行。 + + root@nagios:~# vim /etc/nagios3/conf.d/services_nagios2.cfg + +---------- + + ## Nagios asks server-3 to resolve the IP for google.com ## + define service{ + use generic-service + host_name test-server-3 + service_description Check DNS + check_command check_dns + } + + ## Nagios asks server-3 to dig google.com ## + define service{ + use generic-service + host_name test-server-3 + service_description Check DNS via dig + check_command check_dig!www.google.com + } + +### 监控邮件服务器 ### + +Nagios可以监控不同的邮件服务组件如SMTP、POP、IMAP和mailq。之前提过,server-2设置了后缀邮件服务。Nagios将被配置来监控SMTP和邮件队列。 + + + root@nagios:~# vim /etc/nagios3/conf.d/services_nagios2.cfg + +---------- + + define service{ + use generic-service + host_name test-server-2 + service_description Check SMTP + check_command check_smtp + } + + define service{ + use generic-service + host_name test-server-2 + service_description Check Mail Queue + check_command check_mailq_postfix!50!100 + ;warning at 50, critical at 100 + } + +下面的截屏显示了目前配置监控服务的概览。 + +![](http://farm8.staticflickr.com/7333/11428095956_2868bbdfcc_z.jpg) + +### 基于端口自定义监控程序 ### + +让我们假设下面的自定义程序同样运行在网络中,监听一个特定的端口。 + +- 测试1号服务器:自定义程序(TCP端口 12345) + +过一些小的调整,Nagios也可以帮助监控这个程序。 + + root@nagios:~# vim /etc/nagios3/conf.d/services_nagios2.cfg + +---------- + + define service{ + use generic-service + host_name test-server-1 + service_description Check server 1 custom application + check_command check_tcp!12345 + } + +在完结之前,Nagios可以监控网络很多其他的方面。存储在/etc/nagios-plugins/config/中的脚本为Nagios很棒的能力。 + + +一些Nagios提供的脚本被限制在本地服务器。例子包含服务负载、进程并发数量、登录用户数量。这些检查可以提供Nagios服务器内有用的信息。 + +希望这篇有用。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/monitor-common-services-nagios.html + +作者:[Sarmed Rahman][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者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-nagios-linux.html \ No newline at end of file diff --git a/translated/tech/20150602 Howto Configure OpenVPN Server-Client on Ubuntu 15.04.md b/translated/tech/20150602 Howto Configure OpenVPN Server-Client on Ubuntu 15.04.md new file mode 100644 index 0000000000..5b6c2fc6bd --- /dev/null +++ b/translated/tech/20150602 Howto Configure OpenVPN Server-Client on Ubuntu 15.04.md @@ -0,0 +1,305 @@ +Ubuntu 15.04上配置OpenVPN服务器-客户端 +================================================================================ +虚拟专用网(VPN)是几种用于建立与其它网络连接的网络技术中常见的一个名称。它被称为虚拟网,因为各个节点的连接不是通过物理线路实现的。而由于没有网络所有者的正确授权是不能通过公共线路访问到网络,所以它是专用的。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/vpn_custom_illustration.jpg) + +[OpenVPN][1]软件通过TUN/TAP驱动的帮助,使用TCP和UDP协议来传输数据。UDP协议和TUN驱动允许NAT后的用户建立到OpenVPN服务器的连接。此外,OpenVPN允许指定自定义端口。它提额外提供了灵活的配置,可以帮助你避免防火墙限制。 + +OpenVPN中,由OpenSSL库和传输层安全协议(TLS)提供了安全和加密。TLS是SSL协议的一个改进版本。 + +OpenSSL提供了两种加密方法:对称和非对称。下面,我们展示了如何配置OpenVPN的服务器端,以及如何预备使用带有公共密钥非对称加密和TLS协议基础结构(PKI)。 + +### 服务器端配置 ### + +首先,我们必须安装OpenVPN。在Ubuntu 15.04和其它带有‘apt’报管理器的Unix系统中,可以通过如下命令安装: + + sudo apt-get install openvpn + +然后,我们必须配置一个密钥对,这可以通过默认的“openssl”工具完成。但是,这种方式十分难。这也是我们使用“easy-rsa”来实现此目的的原因。接下来的命令会将“easy-rsa”安装到系统中。 + + sudo apt-get unstall easy-rsa + +**注意**: 所有接下来的命令要以超级用户权限执行,如在“sudo -i”命令后;此外,你可以使用“sudo -E”作为接下来所有命令的前缀。 + +开始之前,我们需要拷贝“easy-rsa”到openvpn文件夹。 + + mkdir /etc/openvpn/easy-rsa + cp -r /usr/share/easy-rsa /etc/openvpn/easy-rsa + mv /etc/openvpn/easy-rsa/easy-rsa /etc/openvpn/easy-rsa/2.0 + +然后进入到该目录 + + cd /etc/openvpn/easy-rsa/2.0 + +这里,我们开启了一个密钥生成进程。 + +首先,我们编辑一个“var”文件。为了简化生成过程,我们需要在里面指定数据。这里是“var”文件的一个样例: + + export KEY_COUNTRY="US" + export KEY_PROVINCE="CA" + export KEY_CITY="SanFrancisco" + export KEY_ORG="Fort-Funston" + export KEY_EMAIL="my@myhost.mydomain" + export KEY_OU=server + +希望这些字段名称对你而言已经很清楚,不需要进一步说明了。 + +其次,我们需要拷贝openssl配置。另外一个版本已经有现成的配置文件,如果你没有特定要求,你可以使用它的上一个版本。这里是1.0.0版本。 + + cp openssl-1.0.0.cnf openssl.cnf + +第三,我们需要加载环境变量,这些变量已经在前面一步中编辑好了。 + + source ./vars + +生成密钥的最后一步准备工作是清空旧的证书和密钥,以及生成新密钥的序列号和索引文件。可以通过以下命令完成。 + + ./clean-all + +现在,我们完成了准备工作,准备好启动生成进程了。让我们先来生成证书。 + + ./build-ca + +在对话中,我们可以看到默认的变量,这些变量是我们先前在“vars”中指定的。我们可以检查以下,如有必要进行编辑,然后按回车几次。对话如下 + + Generating a 2048 bit RSA private key + .............................................+++ + ...................................................................................................+++ + writing new private key to 'ca.key' + ----- + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [US]: + State or Province Name (full name) [CA]: + Locality Name (eg, city) [SanFrancisco]: + Organization Name (eg, company) [Fort-Funston]: + Organizational Unit Name (eg, section) [MyOrganizationalUnit]: + Common Name (eg, your name or your server's hostname) [Fort-Funston CA]: + Name [EasyRSA]: + Email Address [me@myhost.mydomain]: + +接下来,我们需要生成一个服务器密钥 + + ./build-key-server server + +该命令的对话如下: + + Generating a 2048 bit RSA private key + ........................................................................+++ + ............................+++ + writing new private key to 'server.key' + ----- + You are about to be asked to enter information that will be incorporated + into your certificate request. + What you are about to enter is what is called a Distinguished Name or a DN. + There are quite a few fields but you can leave some blank + For some fields there will be a default value, + If you enter '.', the field will be left blank. + ----- + Country Name (2 letter code) [US]: + State or Province Name (full name) [CA]: + Locality Name (eg, city) [SanFrancisco]: + Organization Name (eg, company) [Fort-Funston]: + Organizational Unit Name (eg, section) [MyOrganizationalUnit]: + Common Name (eg, your name or your server's hostname) [server]: + Name [EasyRSA]: + Email Address [me@myhost.mydomain]: + + Please enter the following 'extra' attributes + to be sent with your certificate request + A challenge password []: + An optional company name []: + Using configuration from /etc/openvpn/easy-rsa/2.0/openssl-1.0.0.cnf + Check that the request matches the signature + Signature ok + The Subject's Distinguished Name is as follows + countryName :PRINTABLE:'US' + stateOrProvinceName :PRINTABLE:'CA' + localityName :PRINTABLE:'SanFrancisco' + organizationName :PRINTABLE:'Fort-Funston' + organizationalUnitName:PRINTABLE:'MyOrganizationalUnit' + commonName :PRINTABLE:'server' + name :PRINTABLE:'EasyRSA' + emailAddress :IA5STRING:'me@myhost.mydomain' + Certificate is to be certified until May 22 19:00:25 2025 GMT (3650 days) + Sign the certificate? [y/n]:y + 1 out of 1 certificate requests certified, commit? [y/n]y + Write out database with 1 new entries + Data Base Updated + +这里,最后两个关于“签署证书”和“提交”的问题,我们必须回答“yes”。 + +现在,我们已经有了证书和服务器密钥。下一步,就是去省城Diffie-Hellman密钥。执行以下命令,耐心等待。在接下来的几分钟内,我们将看到许多点和加号。 + + ./build-dh + +该命令的输出样例如下 + + Generating DH parameters, 2048 bit long safe prime, generator 2 + This is going to take a long time + ................................+................ + +在漫长的等待之后,我们可以继续生成最后的密钥了,该密钥用于TLS验证。命令如下: + + openvpn --genkey --secret keys/ta.key + +现在,生成完毕,我们可以移动所有生成的文件到最后的位置中。 + + cp -r /etc/openvpn/easy-rsa/2.0/keys/ /etc/openvpn/ + +最后,我们来创建OpenVPN配置文件。让我们从样例中拷贝过来吧: + + cp /usr/share/doc/openvpn/examples/sample-config-files/server.conf.gz /etc/openvpn/ + cd /etc/openvpn + gunzip -d /etc/openvpn/server.conf.gz + +然后编辑 + + vim /etc/openvpn/server.conf + +我们需要指定密钥的自定义路径 + + ca /etc/openvpn/keys/ca.crt + cert /etc/openvpn/keys/server.crt + key /etc/openvpn/keys/server.key # This file should be kept secret + dh /etc/openvpn/keys/dh2048.pem + +一切就绪。在重启OpenVPN后,服务器端配置就完成了。 + + service openvpn restart + +### Unix的客户端配置 ### + +假定我们有一台装有类Unix操作系统的设备,比如Ubuntu 15.04,并安装有OpenVPN。我们想要从先前的部分连接到OpenVPN服务器。首先,我们需要为客户端生成密钥。为了生成该密钥,请转到服务器上的目录中: + + cd /etc/openvpn/easy-rsa/2.0 + +加载环境变量 + + source vars + +然后创建客户端密钥 + + ./build-key client + +我们将看到一个与先前关于服务器密钥生成部分的章节描述一样的对话,填入客户端的实际信息。 + +如果需要密码保护密钥,你需要运行另外一个命令,命令如下 + + ./build-key-pass client + +在此种情况下,在建立VPN连接时,会提示你输入密码。 + +现在,我们需要将以下文件从服务器拷贝到客户端/etc/openvpn/keys/文件夹。 + +服务器文件列表: + +- ca.crt, +- dh2048.pem, +- client.crt, +- client.key, +- ta.key. + +在此之后,我们转到客户端,准备配置文件。配置文件位于/etc/openvpn/client.conf,内容如下 + + dev tun + proto udp + + # IP and Port of remote host with OpenVPN server + remote 111.222.333.444 1194 + + resolv-retry infinite + + ca /etc/openvpn/keys/ca.crt + cert /etc/openvpn/keys/client.crt + key /etc/openvpn/keys/client.key + tls-client + tls-auth /etc/openvpn/keys/ta.key 1 + auth SHA1 + cipher BF-CBC + remote-cert-tls server + comp-lzo + persist-key + persist-tun + + status openvpn-status.log + log /var/log/openvpn.log + verb 3 + mute 20 + +在此之后,我们需要重启OpenVPN以接受新配置。 + + service openvpn restart + +好了,客户端配置完成。 + +### 安卓客户端配置 ### + +安卓设备上的OpenVPN配置和Unix系统上的十分类似,我们需要一个含有配置文件、密钥和证书的包。文件列表如下: + +- configuration file (.ovpn), +- ca.crt, +- dh2048.pem, +- client.crt, +- client.key. + +客户端密钥生成方式和先前章节所述的一样。 + +配置文件内容如下 + + client tls-client + dev tun + proto udp + + # IP and Port of remote host with OpenVPN server + remote 111.222.333.444 1194 + + resolv-retry infinite + nobind + ca ca.crt + cert client.crt + key client.key + dh dh2048.pem + persist-tun + persist-key + + verb 3 + mute 20 + +所有这些文件我们必须移动我们设备的SD卡上。 + +然后,我们需要安装[OpenVPN连接][2]。 + +接下来,配置过程很是简单: + + open setting of OpenVPN and select Import options + select Import Profile from SD card option + in opened window go to folder with prepared files and select .ovpn file + application offered us to create a new profile + tap on the Connect button and wait a second + +搞定。现在,我们的安卓设备已经通过安全的VPN连接连接到我们的专用网。 + +### 尾声 ### + +虽然OpenVPN初始配置花费不少时间,但是简易客户端配置为我们弥补了时间上的损失,也提供了从任何设备连接的能力。此外,OpenVPN提供了一个很高的安全等级,以及从不同地方连接的能力,包括位于NAT后面的客户端。因此,OpenVPN可以同时在家和在企业中使用。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/configure-openvpn-server-client-ubuntu-15-04/ + +作者:[Ivan Zabrovskiy][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/ivanz/ +[1]:https://openvpn.net/ +[2]:https://play.google.com/store/apps/details?id=net.openvpn.openvpn diff --git a/translated/tech/20150603 Installing Ruby on Rails using rbenv on Ubuntu 15.04.md b/translated/tech/20150603 Installing Ruby on Rails using rbenv on Ubuntu 15.04.md new file mode 100644 index 0000000000..65ff38744e --- /dev/null +++ b/translated/tech/20150603 Installing Ruby on Rails using rbenv on Ubuntu 15.04.md @@ -0,0 +1,151 @@ +在Ubuntu 15.04中安装RUby on Rails +================================================================================ +本篇我们会学习如何用rbenv在Ubuntu 15.04中安装Ruby on Rails。我们选择Ubuntu作为操作系统因为Ubuntu是Linux发行版中自带很多包和完整文档的操作系统,因此我认为这是正确的选择。如果你不想安装最新的Ubuntu,你可以从[下载iso文件][1]开始。 + +### 安装 Ruby ### + +我们要做的第一件事是更新Ubuntu包并且为Ruby安装一些依赖。 + + sudo apt-get update + sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev + +有三种方法来安装Ruby比如rbenv,rvm和从源码安装。每种都有各自的好处,但是这些天开发者们更倾向使用rbenv而不是rvm和源码来安装。我们将安装最新的Ruby版本,2.2.2。 + +用rbenv来安装只有简单的两步。第一步安装rbenv接着是ruby-build: + + cd + git clone git://github.com/sstephenson/rbenv.git .rbenv + echo 'eval "$(rbenv init -)"' >> ~/.bashrc + exec $SHELL + + git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build + echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc + exec $SHELL + + git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash + + rbenv install 2.2.2 + rbenv global 2.2.2 + ruby -v + +我们需要安装Bundler但是我们要在安装之前告诉rubygems不要为每个包本地安装文档。 + + echo "gem: --no-ri --no-rdoc" > ~/.gemrc + gem install bundler + +### 配置 GIT ### + +配置git之前,你要创建一个github账号,你可以注册[git][2]。我们需要git作为版本控制系统,因此我们要设置来匹配github账号。 + +用户的github账号来代替下面的**Name** 和 **Email address** 。 + + git config --global color.ui true + git config --global user.name "YOUR NAME" + git config --global user.email "YOUR@EMAIL.com" + ssh-keygen -t rsa -C "YOUR@EMAIL.com" + +接下来用新生成的ssh key添加到github账号中。这样你需要复制下面命令的输出并[粘贴在这][3]。 + + cat ~/.ssh/id_rsa.pub + +如果你做完了,检查是否已经成功。 + + ssh -T git@github.com + +你应该得到下面这样的信息。 + + Hi excid3! You've successfully authenticated, but GitHub does not provide shell access. + +### 安装 Rails ### + +我们需要安装javascript运行时,像NodeJS因为这些天Rails带来很多依赖。这样我们可以结合并缩小你的javascript来提供一个更快的生产环境。 + +我们需要添加PPA来安装nodeJS。 + + sudo add-apt-repository ppa:chris-lea/node.js + sudo apt-get update + sudo apt-get install nodejs + +如果在更新是晕倒了问题,你可以试试这个命令: + + # Note the new setup script name for Node.js v0.12 + curl -sL https://deb.nodesource.com/setup_0.12 | sudo bash - + + # Then install with: + sudo apt-get install -y nodejs + +下一步,用这个命令: + + gem install rails -v 4.2.1 + +因为我们正在使用rbenv,用下面的命令来安装rails。 + + rbenv rehash + +要确保rails已经正确安炸u哪个,你可以运行rails -v,显示如下: + + rails -v + # Rails 4.2.1 + +如果你得到的是不同的结果可能是环境没有设置正确。 + +### 设置 MySQL ### + +或许你已经熟悉MySQL了,你可以从Ubuntu的仓库中安装MySQL的客户端与服务端。你可以在安装时设置root用户密码。这个信息将来会进入你rails程序的database.yml文件中、用下面的命令来安装mysql。 + + sudo apt-get install mysql-server mysql-client libmysqlclient-dev + +安装libmysqlclient-dev用于提供在设置rails程序时,rails在连接mysql所需要用到的用于编译mysql2 gem的文件。 + +### 最后一步 ### + +让我们尝试创建你的第一个rails程序: + + # Use MySQL + + rails new myapp -d mysql + + # Move into the application directory + + cd myapp + + # Create Database + + rake db:create + + rails server + +访问http://localhost:3000来访问你的新网站。现在你的电脑上已经可以构建rails程序了。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/localhost_3000.png) + +如果你在创建数据库时遇到了“Access denied for user 'root'@'localhost' (Using password: NO)”这个错误信息,你需要更新你的config/database.yml文件来匹配数据库的**用户名**和**密码**。 + + # Edit your database.yml in config folder + + nano config/database.yml + +接着输入MySql root用户的密码。 + +![](http://blog.linoxide.com/wp-content/uploads/2015/05/root_passw.png) + +退出 (Ctrl+X)并保存。 + +### 总结 ### + +Rails是用Ruby写的, 也就是随着rails一起使用的编程语言。在Ubuntu 15.04中Ruby on Rails可以用rbenv、 rvm和源码的方式来安装。本篇我们使用的是rbenv方式并用了MySQL作为数据库。有任何的问题或建议,请在评论栏指出。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/installing-ruby-rails-using-rbenv-ubuntu-15-04/ + +作者:[Obet][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/obetp/ +[1]:http://release.ubuntu.com/15.04 +[2]:http://github.com +[3]:https://github.com/settings/ssh diff --git a/translated/tech/20150604 How To Install Unity 8 Desktop Preview In Ubuntu.md b/translated/tech/20150604 How To Install Unity 8 Desktop Preview In Ubuntu.md new file mode 100644 index 0000000000..bf1c3ea0bb --- /dev/null +++ b/translated/tech/20150604 How To Install Unity 8 Desktop Preview In Ubuntu.md @@ -0,0 +1,77 @@ +Ubuntu中安装Unity 8桌面预览版 +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/06/Unity_8.jpeg) + +如果你一直关注新闻,那么Ubuntu将会切换到[Mir显示服务器][1],并随同发布[Unity 8][2]桌面。然而,在尚未确定Unity 8是否会在[Ubuntu 15.10 Willy Werewolf][3]中部署到Mir上之前,提供了一个Unity 8的预览版本供你体验和测试。通过官方PPA,可以很容地**安装Unity 8到Ubuntu 14.04,14.10和15.04中**。 + +到目前为止,开发者已经可以通过[ISO][4]获得该Unity 8预览来进行测试。但是Canonical已经通过[LXC容器][5]发布了。通过该方法,你可以获取Unity 8桌面会话,让它作为任何一个桌面环境运行在Mir显示服务器上。就像你[在Ubuntu中安装Mate桌面][6],然后从LightDm登录屏幕选择桌面会话一样。 + +好奇?想要试试Unity 8?让我们来看怎样安装它吧。 + +**注意: 它是一个实验性预览,可能不是所有人都可以让它正确工作的。** + +### 安装Unity 8桌面到Ubuntu ### + +下面是安装并使用Unity 8的步骤: + +#### 步骤 1: 安装Unity 8到Ubuntu 12.04和14.04 #### + +如果你真运行着Ubuntu 12.04和14.04,那么你必须使用官方PPA来安装Unity 8。使用以下命令进行安装: + + sudo apt-add-repository ppa:unity8-desktop-session-team/unity8-preview-lxc + sudo apt-get update + sudo apt-get upgrade + sudo apt-get install unity8-lxc + +#### 步骤 1: 安装Unity 8到Ubuntu 14.10和15.04 #### + +如果你真运行着Ubuntu 14.10或15.04,那么Unity 8 LXC已经在源中准备好。你只需要运行以下命令: + + sudo apt-get update + sudo apt-get install unity8-lxc + +#### 步骤 2: 设置Unity 8桌面预览LXC #### + +安装Unity 8 LXC后,该对它进行设置,下面的命令就可达到目的: + + sudo unity8-lxc-setup + +它将花费一些时间来设置,所以,给点耐心吧。它会下载ISO,然后解压缩,接着完整最后一些必要的设置来让它工作。它也会安装一个LightDM的轻度修改版本。这一切都搞定后,需要重启。 + +#### 步骤 3: 选择Unity 8 #### + +重启后,在登录屏幕,点击你的登录旁边的Ubuntu图标: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/Change_Desktop_Environment_Ubuntu.jpeg) + +你应该可以在这看到Unity 8的选项,选择它: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/06/Select_Unity8.jpeg) + +### 卸载Unity 8 LXC ### + +如果你发现Unity 8毛病太多,或者你不喜欢它,那么你可以以相同的方式切换会默认Unity版本。此外,你也可以通过下面的命令移除Unity 8: + + sudo apt-get remove unity8-lxc + +该命令会将Unity 8选项从LightDM屏幕移除,但是配置仍然保留着。 + +以上就是你在Ubuntu中安装嗲有Mir的Unity 8的全部过程,试玩后请分享你关于Unity 8的想法哦! + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-unity-8-desktop-ubuntu/ + +作者:[Abhishek][a] +译者:[GOLinux](https://github.com/GOLinux) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/abhishek/ +[1]:http://en.wikipedia.org/wiki/Mir_%28software%29 +[2]:https://wiki.ubuntu.com/Unity8Desktop +[3]:http://itsfoss.com/ubuntu-15-10-codename/ +[4]:https://wiki.ubuntu.com/Unity8DesktopIso +[5]:https://wiki.ubuntu.com/Unity8inLXC +[6]:http://itsfoss.com/install-mate-desktop-ubuntu-14-04/ diff --git a/translated/tech/20150604 How to access SQLite database in Perl.md b/translated/tech/20150604 How to access SQLite database in Perl.md new file mode 100644 index 0000000000..76cc1f01f0 --- /dev/null +++ b/translated/tech/20150604 How to access SQLite database in Perl.md @@ -0,0 +1,171 @@ +如何用Perl访问SQLite数据库 +================================================================================ +SQLite是一个零配置,无服务端,基于文件的事务文件系统。由于它的轻量级,自包含和紧凑的设计,所以当你想要集成数据库到你的程序中时,SQLite是一个非常流行的选择。在这篇文章中,我会展示如何用Perl脚本来创建和访问SQLite数据库。我演示的Perl代码片段是完整的,所以你可以很简单地修改并集成到你的项目中。 + +![](https://farm1.staticflickr.com/552/18444614631_9e7fce8243_c.jpg) + +### 访问SQLite的准备 ### + +我会使用SQLite DBI Perl驱动来连接到SQLite3。因此你需要在Linux中安装它(和SQLite3一起)。 + +**Debian、 Ubuntu 或者 Linux Mint** + + $ sudo apt-get install sqlite3 libdbd-sqlite3-perl + +**CentOS、 Fedora 或者 RHEL** + + $ sudo yum install sqlite perl-DBD-SQLite + +安装后,你可以检查SQLite驱动可以通过下面的脚本访问到。 + + #!/usr/bin/perl + + my @drv = DBI->available_drivers(); + print join("\n", @drv), "\n"; + +如果你运行脚本,你应该会看见下面的输出。 + + DBM + ExampleP + File + Gofer + Proxy + SQLite + Sponge + +### Perl SQLite 访问示例 ### + +下面就是Perl访问SQLite的示例。这个Perl脚本会演示下面这些SQLite数据库的常规管理。 + +- 创建和连接SQLite数据库 +- 在SQLite数据库中创建新表 +- 在表中插入行 +- 在表中搜索和迭代行 +- 在表中更新行 +- 在表中删除行 + + use DBI; + use strict; + + # define database name and driver + my $driver = "SQLite"; + my $db_name = "xmodulo.db"; + my $dbd = "DBI:$driver:dbname=$db_name"; + + # sqlite does not have a notion of username/password + my $username = ""; + my $password = ""; + + # create and connect to a database. + # this will create a file named xmodulo.db + my $dbh = DBI->connect($dbd, $username, $password, { RaiseError => 1 }) + or die $DBI::errstr; + print STDERR "Database opened successfully\n"; + + # create a table + my $stmt = qq(CREATE TABLE IF NOT EXISTS NETWORK + (ID INTEGER PRIMARY KEY AUTOINCREMENT, + HOSTNAME TEXT NOT NULL, + IPADDRESS INT NOT NULL, + OS CHAR(50), + CPULOAD REAL);); + my $ret = $dbh->do($stmt); + if($ret < 0) { + print STDERR $DBI::errstr; + } else { + print STDERR "Table created successfully\n"; + } + + # insert three rows into the table + $stmt = qq(INSERT INTO NETWORK (HOSTNAME,IPADDRESS,OS,CPULOAD) + VALUES ('xmodulo', 16843009, 'Ubuntu 14.10', 0.0)); + $ret = $dbh->do($stmt) or die $DBI::errstr; + + $stmt = qq(INSERT INTO NETWORK (HOSTNAME,IPADDRESS,OS,CPULOAD) + VALUES ('bert', 16843010, 'CentOS 7', 0.0)); + $ret = $dbh->do($stmt) or die $DBI::errstr; + + $stmt = qq(INSERT INTO NETWORK (HOSTNAME,IPADDRESS,OS,CPULOAD) + VALUES ('puppy', 16843011, 'Ubuntu 14.10', 0.0)); + $ret = $dbh->do($stmt) or die $DBI::errstr; + + # search and iterate row(s) in the table + $stmt = qq(SELECT id, hostname, os, cpuload from NETWORK;); + my $obj = $dbh->prepare($stmt); + $ret = $obj->execute() or die $DBI::errstr; + + if($ret < 0) { + print STDERR $DBI::errstr; + } + while(my @row = $obj->fetchrow_array()) { + print "ID: ". $row[0] . "\n"; + print "HOSTNAME: ". $row[1] ."\n"; + print "OS: ". $row[2] ."\n"; + print "CPULOAD: ". $row[3] ."\n\n"; + } + + # update specific row(s) in the table + $stmt = qq(UPDATE NETWORK set CPULOAD = 50 where OS='Ubuntu 14.10';); + $ret = $dbh->do($stmt) or die $DBI::errstr; + + if( $ret < 0 ) { + print STDERR $DBI::errstr; + } else { + print STDERR "A total of $ret rows updated\n"; + } + + # delete specific row(s) from the table + $stmt = qq(DELETE from NETWORK where ID=2;); + $ret = $dbh->do($stmt) or die $DBI::errstr; + + if($ret < 0) { + print STDERR $DBI::errstr; + } else { + print STDERR "A total of $ret rows deleted\n"; + } + + # quit the database + $dbh->disconnect(); + print STDERR "Exit the database\n"; + +上面的Perl脚本运行成功后会创建一个叫“xmodulo.db”的数据库文件,并会有下面的输出。 + + Database opened successfully + Table created successfully + ID: 1 + HOSTNAME: xmodulo + OS: Ubuntu 14.10 + CPULOAD: 0 + + ID: 2 + HOSTNAME: bert + OS: CentOS 7 + CPULOAD: 0 + + ID: 3 + HOSTNAME: puppy + OS: Ubuntu 14.10 + CPULOAD: 0 + + A total of 2 rows updated + A total of 1 rows deleted + Exit the database + +### 错误定位 ### + +如果你尝试没有安装SQLite DBI驱动的情况下使用Perl访问SQLite的话,你会遇到下面的错误。你必须按开始说的安装DBI驱动。 + + Can't locate DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./script.pl line 3. + BEGIN failed--compilation aborted at ./script.pl line 3. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/access-sqlite-database-perl.html + +作者:[Dan Nanni][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/nanni