diff --git a/translated/tech/20100105 How to Backup and Restore Your Apps and PPAs in Ubuntu Using Aptik.md b/published/201501/20100105 How to Backup and Restore Your Apps and PPAs in Ubuntu Using Aptik.md similarity index 86% rename from translated/tech/20100105 How to Backup and Restore Your Apps and PPAs in Ubuntu Using Aptik.md rename to published/201501/20100105 How to Backup and Restore Your Apps and PPAs in Ubuntu Using Aptik.md index d55bf79f62..5b422eaef6 100644 --- a/translated/tech/20100105 How to Backup and Restore Your Apps and PPAs in Ubuntu Using Aptik.md +++ b/published/201501/20100105 How to Backup and Restore Your Apps and PPAs in Ubuntu Using Aptik.md @@ -2,9 +2,9 @@ ================================================================================ ![00_lead_image_aptik](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x300x00_lead_image_aptik.png.pagespeed.ic.n3TJwp8YK_.png) -当你想重装Ubuntu或者仅仅是想安装它的一个新版本的时候,寻到一个便捷的方法去重新安装之前的应用并且重置其设置是很有用的。此时 *Aptik* 粉墨登场,它可以帮助你轻松实现。 +当你想重装Ubuntu或者仅仅是想安装它的一个新版本的时候,如果有个便捷的方法来重新安装之前的应用并且重置其设置会很方便的。此时 *Aptik* 粉墨登场,它可以帮助你轻松实现。 -Aptik(自动包备份和回复)是一个可以用在Ubuntu,Linux Mint, 和其他基于Debian以及Ubuntu的Linux发行版上的应用,它允许你将已经安装过的包括软件库、下载包、安装的应用及其主题和设置在内的PPAs(个人软件包存档)备份到外部的U盘、网络存储或者类似于Dropbox的云服务上。 +Aptik(自动包备份和恢复)是一个可以用在Ubuntu,Linux Mint 和其他基于Debian以及Ubuntu的Linux发行版上的应用,它允许你将已经安装过的包括软件库、下载包、安装的应用和主题、用户设置在内的PPAs(个人软件包存档)备份到外部的U盘、网络存储或者类似于Dropbox的云服务上。 注意:当我们在此文章中说到输入某些东西的时候,如果被输入的内容被引号包裹,请不要将引号一起输入进去,除非我们有特殊说明。 @@ -16,7 +16,7 @@ Aptik(自动包备份和回复)是一个可以用在Ubuntu,Linux Mint, 和 ![01_command_to_add_repository](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x99x01_command_to_add_repository.png.pagespeed.ic.UfVC9QLj54.png) -输入下边的命令到提示符旁边,来确保资源库已经是最新版本。 +在命令行提示符输入下边的命令,来确保资源库已经是最新版本。 sudo apt-get update @@ -86,11 +86,11 @@ Aptik的主窗口显示出来了。从“Backup Directory”下拉列表中选 接下来,“Downloaded Packages (APT Cache)”的项目只对重装同样版本的Ubuntu有用处。它会备份下你系统缓存(/var/cache/apt/archives)中的包。如果你是升级系统的话,可以跳过这个条目,因为针对新系统的包会比现有系统缓存中的包更加新一些。 -备份和回复下载过的包,这可以在重装Ubuntu,并且重装包的时候节省时间和网络带宽。因为一旦你把这些包恢复到系统缓存中之后,他们可以重新被利用起来,这样下载过程就免了,包的安装会更加快捷。 +备份和恢复下载过的包,这可以在重装Ubuntu,并且重装包的时候节省时间和网络带宽。因为一旦你把这些包恢复到系统缓存中之后,他们可以重新被利用起来,这样下载过程就免了,包的安装会更加快捷。 如果你是重装相同版本的Ubuntu系统的话,点击 “Downloaded Packages (APT Cache)” 右侧的 “Backup” 按钮来备份系统缓存中的包。 -注意:当你备份下载过的包的时候是没有二级对话框出现。你系统缓存 (/var/cache/apt/archives) 中的包会被拷贝到备份目录下一个名叫 “archives” 的文件夹中,当整个过程完成后会出现一个对话框来告诉你备份已经完成。 +注意:当你备份下载过的包的时候是没有二级对话框出现的。你系统缓存 (/var/cache/apt/archives) 中的包会被拷贝到备份目录下一个名叫 “archives” 的文件夹中,当整个过程完成后会出现一个对话框来告诉你备份已经完成。 ![16_downloaded_packages_backed_up](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x544x16_downloaded_packages_backed_up.png.pagespeed.ic.z8ysuwzQAK.png) @@ -104,7 +104,7 @@ Aptik的主窗口显示出来了。从“Backup Directory”下拉列表中选 ![18_clicking_backup_for_software_selections](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x530x18_clicking_backup_for_software_selections.png.pagespeed.ic.QI5D-IgnP_.png) -名为 “packages.list” and “packages-installed.list” 的两个文件出现在了备份目录中,并且一个用来通知你备份完成的对话框出现。点击 ”OK“关闭它。 +备份目录中出现了两个名为 “packages.list” 和“packages-installed.list” 的文件,并且会弹出一个通知你备份完成的对话框。点击 ”OK“关闭它。 注意:“packages-installed.list”文件包含了所有的包,而 “packages.list” 在包含了所有包的前提下还指出了那些包被选择上了。 @@ -120,27 +120,27 @@ Aptik的主窗口显示出来了。从“Backup Directory”下拉列表中选 ![21_zipping_settings_files](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x530x21_zipping_settings_files.png.pagespeed.ic.dgoBj7egqv.png) -当打包完成后,打包后的文件被拷贝到备份目录下,另外一个备份成功的对话框出现。点击”OK“,关掉。 +当打包完成后,打包后的文件被拷贝到备份目录下,另外一个备份成功的对话框出现。点击“OK”关掉。 ![22_app_settings_backed_up](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x530x22_app_settings_backed_up.png.pagespeed.ic.Mb6utyLJ3W.png) -来自 “/usr/share/themes” 目录的主题和来自 “/usr/share/icons” 目录的图标也可以备份。点击 “Themes and Icons” 右侧的 “Backup” 来进行此操作。“Backup Themes” 对话框默认选择了所有的主题和图标。你可以安装需要取消到一些然后点击 “Backup” 进行备份。 +放在 “/usr/share/themes” 目录的主题和放在 “/usr/share/icons” 目录的图标也可以备份。点击 “Themes and Icons” 右侧的 “Backup” 来进行此操作。“Backup Themes” 对话框默认选择了所有的主题和图标。你可以安装需要的、取消一些不要的,然后点击 “Backup” 进行备份。 ![22a_backing_up_themes_and_icons](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x530x22a_backing_up_themes_and_icons.png.pagespeed.ic.KXa8W3YhyF.png) -主题被打包拷贝到备份目录下的 “themes” 文件夹中,图标被打包拷贝到备份目录下的 “icons” 文件夹中。然后成功提示对话框出现,点击”OK“关闭它。 +主题被打包拷贝到备份目录下的 “themes” 文件夹中,图标被打包拷贝到备份目录下的 “icons” 文件夹中。然后成功提示对话框出现,点击“OK”关闭它。 ![22b_themes_and_icons_backed_up](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x530x22b_themes_and_icons_backed_up.png.pagespeed.ic.ejjRaymD39.png) -一旦你完成了需要的备份,点击主界面左上角的”X“关闭 Aptik 。 +一旦你完成了需要的备份,点击主界面左上角的“X”关闭 Aptik 。 ![23_closing_aptik](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x542x23_closing_aptik.png.pagespeed.ic.pNk9Vt3--l.png) -备份过的文件已存在于你选择的备份目录中,可以随时取阅。 +备份过的文件已存在于你选择的备份目录中,可以随时查看。 ![24_backup_files_in_directory](http://cdn5.howtogeek.com/wp-content/uploads/2014/12/650x374x24_backup_files_in_directory.png.pagespeed.ic.vwblOfN915.png) -当你重装Ubuntu或者安装新版本的Ubuntu后,在新的系统中安装 Aptik 并且将备份好的文件置于新系统中让其可被使用。运行 Aptik,并使用每个条目的 “Restore” 按钮来恢复你的软件源、应用、包、设置、主题以及图标。 +当你重装Ubuntu或者安装新版本的Ubuntu后,在新的系统中安装 Aptik 并且将备份好的文件置于新系统中使用。运行 Aptik,并使用每个条目的 “Restore” 按钮来恢复你的软件源、应用、包、设置、主题以及图标。 -------------------------------------------------------------------------------- @@ -148,7 +148,7 @@ via: http://www.howtogeek.com/206454/how-to-backup-and-restore-your-apps-and-ppa 作者:Lori Kaufman 译者:[Ping](https://github.com/mr-ping) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/20140701 Easy File Comparisons With These Great Free Diff Tools.md b/published/201501/20140701 Easy File Comparisons With These Great Free Diff Tools.md similarity index 100% rename from published/20140701 Easy File Comparisons With These Great Free Diff Tools.md rename to published/201501/20140701 Easy File Comparisons With These Great Free Diff Tools.md diff --git a/published/20140910 With Apple Watch Unveiled, Could an Ubuntu Smartwatch Be Next.md b/published/201501/20140910 With Apple Watch Unveiled, Could an Ubuntu Smartwatch Be Next.md similarity index 100% rename from published/20140910 With Apple Watch Unveiled, Could an Ubuntu Smartwatch Be Next.md rename to published/201501/20140910 With Apple Watch Unveiled, Could an Ubuntu Smartwatch Be Next.md diff --git a/published/20140912 What' s wrong with IPv4 and Why we are moving to IPv6.md b/published/201501/20140912 What' s wrong with IPv4 and Why we are moving to IPv6.md similarity index 100% rename from published/20140912 What' s wrong with IPv4 and Why we are moving to IPv6.md rename to published/201501/20140912 What' s wrong with IPv4 and Why we are moving to IPv6.md diff --git a/published/20140915 10 Open Source Cloning Software For Linux Users.md b/published/201501/20140915 10 Open Source Cloning Software For Linux Users.md similarity index 100% rename from published/20140915 10 Open Source Cloning Software For Linux Users.md rename to published/201501/20140915 10 Open Source Cloning Software For Linux Users.md diff --git a/published/20140926 ChromeOS vs Linux--The Good, the Bad and the Ugly.md b/published/201501/20140926 ChromeOS vs Linux--The Good, the Bad and the Ugly.md similarity index 100% rename from published/20140926 ChromeOS vs Linux--The Good, the Bad and the Ugly.md rename to published/201501/20140926 ChromeOS vs Linux--The Good, the Bad and the Ugly.md diff --git a/published/20140928 What is a good subtitle editor on Linux.md b/published/201501/20140928 What is a good subtitle editor on Linux.md similarity index 100% rename from published/20140928 What is a good subtitle editor on Linux.md rename to published/201501/20140928 What is a good subtitle editor on Linux.md diff --git a/published/20140929 What Linux Users Should Know About Open Hardware.md b/published/201501/20140929 What Linux Users Should Know About Open Hardware.md similarity index 100% rename from published/20140929 What Linux Users Should Know About Open Hardware.md rename to published/201501/20140929 What Linux Users Should Know About Open Hardware.md diff --git a/translated/tech/20141008 How to configure HTTP load balancer with HAProxy on Linux.md b/published/201501/20141008 How to configure HTTP load balancer with HAProxy on Linux.md similarity index 82% rename from translated/tech/20141008 How to configure HTTP load balancer with HAProxy on Linux.md rename to published/201501/20141008 How to configure HTTP load balancer with HAProxy on Linux.md index 216483ab3c..bd7c865cda 100644 --- a/translated/tech/20141008 How to configure HTTP load balancer with HAProxy on Linux.md +++ b/published/201501/20141008 How to configure HTTP load balancer with HAProxy on Linux.md @@ -1,18 +1,17 @@ -如何在 Linux 上使用 HAProxy 配置 HTTP 负载均衡器 +使用 HAProxy 配置 HTTP 负载均衡器 ================================================================================ -随着基于 Web 的应用和服务的增多,IT 系统管理员肩上的责任也越来越重。当遇到不可预期的事件如流量达到高峰,流量增大或者内部的挑战比如硬件的损坏或紧急维修,无论如何,你的 Web 应用都必须要保持可用性。甚至现在流行的 devops 和持续交付也可能威胁到你的 Web 服务的可靠性和性能的一致性。 +随着基于 Web 的应用和服务的增多,IT 系统管理员肩上的责任也越来越重。当遇到不可预期的事件如流量达到高峰,流量增大或者内部的挑战比如硬件的损坏或紧急维修,无论如何,你的 Web 应用都必须要保持可用性。甚至现在流行的 devops 和持续交付(CD)也可能威胁到你的 Web 服务的可靠性和性能的一致性。 -不可预测,不一直的性能表现是你无法接受的。但是我们怎样消除这些缺点呢?大多数情况下一个合适的负载均衡解决方案可以解决这个问题。今天我会给你们介绍如何使用 [HAProxy][1] 配置 HTTP 负载均衡器。 +不可预测,不一致的性能表现是你无法接受的。但是我们怎样消除这些缺点呢?大多数情况下一个合适的负载均衡解决方案可以解决这个问题。今天我会给你们介绍如何使用 [HAProxy][1] 配置 HTTP 负载均衡器。 ###什么是 HTTP 负载均衡? ### -HTTP 负载均衡是一个网络解决方案,它将发入的 HTTP 或 HTTPs 请求分配至一组提供相同的 Web 应用内容的服务器用于响应。通过将请求在这样的多个服务器间进行均衡,负载均衡器可以防止服务器出现单点故障,可以提升整体的可用性和响应速度。它还可以让你能够简单的通过添加或者移除服务器来进行横向扩展或收缩,对工作负载进行调整。 +HTTP 负载均衡是一个网络解决方案,它将进入的 HTTP 或 HTTPs 请求分配至一组提供相同的 Web 应用内容的服务器用于响应。通过将请求在这样的多个服务器间进行均衡,负载均衡器可以防止服务器出现单点故障,可以提升整体的可用性和响应速度。它还可以让你能够简单的通过添加或者移除服务器来进行横向扩展或收缩,对工作负载进行调整。 ### 什么时候,什么情况下需要使用负载均衡? ### 负载均衡可以提升服务器的使用性能和最大可用性,当你的服务器开始出现高负载时就可以使用负载均衡。或者你在为一个大型项目设计架构时,在前端使用负载均衡是一个很好的习惯。当你的环境需要扩展的时候它会很有用。 - ### 什么是 HAProxy? ### HAProxy 是一个流行的开源的 GNU/Linux 平台下的 TCP/HTTP 服务器的负载均衡和代理软件。HAProxy 是单线程,事件驱动架构,可以轻松的处理 [10 Gbps 速率][2] 的流量,在生产环境中被广泛的使用。它的功能包括自动健康状态检查,自定义负载均衡算法,HTTPS/SSL 支持,会话速率限制等等。 @@ -24,13 +23,13 @@ HAProxy 是一个流行的开源的 GNU/Linux 平台下的 TCP/HTTP 服务器的 ### 准备条件 ### 你至少要有一台,或者最好是两台 Web 服务器来验证你的负载均衡的功能。我们假设后端的 HTTP Web 服务器已经配置好并[可以运行][3]。 -You will need at least one, or preferably two web servers to verify functionality of your load balancer. We assume that backend HTTP web servers are already [up and running][3]. + -### 在 Linux 中安装 HAProxy ### +## 在 Linux 中安装 HAProxy ## 对于大多数的发行版,我们可以使用发行版的包管理器来安装 HAProxy。 -#### 在 Debian 中安装 HAProxy #### +### 在 Debian 中安装 HAProxy ### 在 Debian Wheezy 中我们需要添加源,在 /etc/apt/sources.list.d 下创建一个文件 "backports.list" ,写入下面的内容 @@ -41,25 +40,25 @@ You will need at least one, or preferably two web servers to verify functionalit # apt­ get update # apt ­get install haproxy -#### 在 Ubuntu 中安装 HAProxy #### +### 在 Ubuntu 中安装 HAProxy ### # apt ­get install haproxy -#### 在 CentOS 和 RHEL 中安装 HAProxy #### +### 在 CentOS 和 RHEL 中安装 HAProxy ### # yum install haproxy -### 配置 HAProxy ### +## 配置 HAProxy ## 本教程假设有两台运行的 HTTP Web 服务器,它们的 IP 地址是 192.168.100.2 和 192.168.100.3。我们将负载均衡配置在 192.168.100.4 的这台服务器上。 为了让 HAProxy 工作正常,你需要修改 /etc/haproxy/haproxy.cfg 中的一些选项。我们会在这一节中解释这些修改。一些配置可能因 GNU/Linux 发行版的不同而变化,这些会被标注出来。 -#### 1. 配置日志功能 #### +### 1. 配置日志功能 ### 你要做的第一件事是为 HAProxy 配置日志功能,在排错时日志将很有用。日志配置可以在 /etc/haproxy/haproxy.cfg 的 global 段中找到他们。下面是针对不同的 Linux 发型版的 HAProxy 日志配置。 -**CentOS 或 RHEL:** +#### CentOS 或 RHEL:#### 在 CentOS/RHEL中启用日志,将下面的: @@ -82,7 +81,7 @@ You will need at least one, or preferably two web servers to verify functionalit # service rsyslog restart -**Debian 或 Ubuntu:** +####Debian 或 Ubuntu:#### 在 Debian 或 Ubuntu 中启用日志,将下面的内容 @@ -106,7 +105,7 @@ You will need at least one, or preferably two web servers to verify functionalit # service rsyslog restart -#### 2. 设置默认选项 #### +### 2. 设置默认选项 ### 下一步是设置 HAProxy 的默认选项。在 /etc/haproxy/haproxy.cfg 的 default 段中,替换为下面的配置: @@ -124,7 +123,7 @@ You will need at least one, or preferably two web servers to verify functionalit 上面的配置是当 HAProxy 为 HTTP 负载均衡时建议使用的,但是并不一定是你的环境的最优方案。你可以自己研究 HAProxy 的手册并配置它。 -#### 3. Web 集群配置 #### +### 3. Web 集群配置 ### Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡中的大多数设置都在这里。现在我们会创建一些基本配置,定义我们的节点。将配置文件中从 frontend 段开始的内容全部替换为下面的: @@ -141,14 +140,14 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 server web01 192.168.100.2:80 cookie node1 check server web02 192.168.100.3:80 cookie node2 check -"listen webfarm *:80" 定义了负载均衡器监听的地址和端口。为了教程的需要,我设置为 "\*" 表示监听在所有接口上。在真实的场景汇总,这样设置可能不太合适,应该替换为可以从 internet 访问的那个网卡接口。 +"listen webfarm \*:80" 定义了负载均衡器监听的地址和端口。为了教程的需要,我设置为 "*" 表示监听在所有接口上。在真实的场景汇总,这样设置可能不太合适,应该替换为可以从 internet 访问的那个网卡接口。 stats enable stats uri /haproxy?stats stats realm Haproxy\ Statistics stats auth haproxy:stats -上面的设置定义了,负载均衡器的状态统计信息可以通过 http:///haproxy?stats 访问。访问需要简单的 HTTP 认证,用户名为 "haproxy" 密码为 "stats"。这些设置可以替换为你自己的认证方式。如果你不需要状态统计信息,可以完全禁用掉。 +上面的设置定义了,负载均衡器的状态统计信息可以通过 http://\/haproxy?stats 访问。访问需要简单的 HTTP 认证,用户名为 "haproxy" 密码为 "stats"。这些设置可以替换为你自己的认证方式。如果你不需要状态统计信息,可以完全禁用掉。 下面是一个 HAProxy 统计信息的例子 @@ -160,7 +159,7 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 - **source**:对请求的客户端 IP 地址进行哈希计算,根据哈希值和服务器的权重将请求调度至后端服务器。 - **uri**:对 URI 的左半部分(问号之前的部分)进行哈希,根据哈希结果和服务器的权重对请求进行调度 - **url_param**:根据每个 HTTP GET 请求的 URL 查询参数进行调度,使用固定的请求参数将会被调度至指定的服务器上 -- **hdr(name**):根据 HTTP 首部中的 字段来进行调度 +- **hdr(name**):根据 HTTP 首部中的 \ 字段来进行调度 "cookie LBN insert indirect nocache" 这一行表示我们的负载均衡器会存储 cookie 信息,可以将后端服务器池中的节点与某个特定会话绑定。节点的 cookie 存储为一个自定义的名字。这里,我们使用的是 "LBN",你可以指定其他的名称。后端节点会保存这个 cookie 的会话。 @@ -169,25 +168,25 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 上面是我们的 Web 服务器节点的定义。服务器有由内部名称(如web01,web02),IP 地址和唯一的 cookie 字符串表示。cookie 字符串可以自定义,我这里使用的是简单的 node1,node2 ... node(n) -### 启动 HAProxy ### +## 启动 HAProxy ## 如果你完成了配置,现在启动 HAProxy 并验证是否运行正常。 -#### 在 Centos/RHEL 中启动 HAProxy #### +### 在 Centos/RHEL 中启动 HAProxy ### 让 HAProxy 开机自启,使用下面的命令 # chkconfig haproxy on # service haproxy start -当然,防火墙需要开放 80 端口,想下面这样 +当然,防火墙需要开放 80 端口,像下面这样 -**CentOS/RHEL 7 的防火墙** +####CentOS/RHEL 7 的防火墙#### # firewall­cmd ­­permanent ­­zone=public ­­add­port=80/tcp # firewall­cmd ­­reload -**CentOS/RHEL 6 的防火墙** +####CentOS/RHEL 6 的防火墙#### 把下面内容加至 /etc/sysconfig/iptables 中的 ":OUTPUT ACCEPT" 段中 @@ -197,9 +196,9 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 # service iptables restart -#### 在 Debian 中启动 HAProxy #### +### 在 Debian 中启动 HAProxy ### -#### 启动 HAProxy #### +启动 HAProxy # service haproxy start @@ -207,7 +206,7 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 ­A INPUT ­p tcp ­­dport 80 ­j ACCEPT -#### 在 Ubuntu 中启动HAProxy #### +### 在 Ubuntu 中启动HAProxy ### 让 HAProxy 开机自动启动在 /etc/default/haproxy 中配置 @@ -221,7 +220,7 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 # ufw allow 80 -### 测试 HAProxy ### +## 测试 HAProxy ## 检查 HAProxy 是否工作正常,我们可以这样做 @@ -239,7 +238,7 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 $ curl http://192.168.100.4/test.php -我们多次使用这个命令此时,会发现交替的输出下面的内容(因为使用了轮询算法): +我们多次运行这个命令此时,会发现交替的输出下面的内容(因为使用了轮询算法): Server IP: 192.168.100.2 X-Forwarded-for: 192.168.100.4 @@ -251,13 +250,13 @@ Web 集群配置定义了一组可用的 HTTP 服务器。我们的负载均衡 如果我们停掉一台后端 Web 服务,curl 命令仍然正常工作,请求被分发至另一台可用的 Web 服务器。 -### 总结 ### +## 总结 ## -现在你有了一个完全可用的负载均衡器,以轮询的模式对你的 Web 节点进行负载均衡。还可以去实验其他的配置选项以适应你的环境。希望这个教程可以帮会组你们的 Web 项目有更好的可用性。 +现在你有了一个完全可用的负载均衡器,以轮询的模式对你的 Web 节点进行负载均衡。还可以去实验其他的配置选项以适应你的环境。希望这个教程可以帮助你们的 Web 项目有更好的可用性。 你可能已经发现了,这个教程只包含单台负载均衡的设置。这意味着我们仍然有单点故障的问题。在真实场景中,你应该至少部署 2 台或者 3 台负载均衡以防止意外发生,但这不是本教程的范围。 -如果 你有任何问题或建议,请在评论中提出,我会尽我的努力回答。 +如果你有任何问题或建议,请在评论中提出,我会尽我的努力回答。 -------------------------------------------------------------------------------- @@ -265,11 +264,11 @@ via: http://xmodulo.com/haproxy-http-load-balancer-linux.html 作者:[Jaroslav Štěpánek][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/) 荣誉推出 [a]:http://xmodulo.com/author/jaroslav [1]:http://www.haproxy.org/ [2]:http://www.haproxy.org/10g.html -[3]:http://xmodulo.com/how-to-install-lamp-server-on-ubuntu.html +[3]:http://linux.cn/article-1567-1.html diff --git a/translated/tech/20141009 How to convert image audio and video formats on Ubuntu.md b/published/201501/20141009 How to convert image audio and video formats on Ubuntu.md similarity index 65% rename from translated/tech/20141009 How to convert image audio and video formats on Ubuntu.md rename to published/201501/20141009 How to convert image audio and video formats on Ubuntu.md index 8dee779cea..93dd76f5a6 100644 --- a/translated/tech/20141009 How to convert image audio and video formats on Ubuntu.md +++ b/published/201501/20141009 How to convert image audio and video formats on Ubuntu.md @@ -1,13 +1,13 @@ -如何在Ubuntu上转换图片音频和视频格式 +如何在Ubuntu上转换图像、音频和视频格式 ================================================================================ -如果你的工作中需要接触到各种不同编码格式的图片、音频和视频,那么你或许正在使用多个工具来转换这些不同的媒介格式。如果存在一个能够处理所有文件/音频/视频格式的多和一的转换工具,那就太好了。 +如果你的工作中需要接触到各种不同编码格式的图像、音频和视频,那么你很有可能正在使用多个工具来转换这些多种多样的媒体格式。如果存在一个能够处理所有图像/音频/视频格式的多合一转换工具,那就太好了。 -[Format Junkie][1] 就是这样一个有着极其友好的用户界面的多和一的媒介转换工具。更棒的是它是一个免费软件。你可以使用 Format Junkie 来转换几乎所有的流行格式的图像、音频、视频和归档文件(或称压缩文件),所有这些只需要简单地点击几下鼠标而已。 +[Format Junkie][1] 就是这样一个多合一的媒体转换工具,它有着极其友好的用户界面。更棒的是它是一个免费软件。你可以使用 Format Junkie 来转换几乎所有的流行格式的图像、音频、视频和归档文件(或称压缩文件),所有这些只需要简单地点击几下鼠标而已。 ### 在Ubuntu 12.04, 12.10 和 13.04 上安装 Format Junkie ### -Format Junkie 可以通过 Ubuntu PPA format-junkie-team 进行安装。这个PPA支持Ubuntu 12.04, 12.10 和 13.04。在以上任意一种Ubuntu版本中安装Format Junkie的话,简单的执行一下命令即可: +Format Junkie 可以通过 Ubuntu PPA format-junkie-team 进行安装。这个PPA支持Ubuntu 12.04, 12.10 和 13.04。在以上任意一种Ubuntu版本中安装Format Junkie的话,简单的执行以下命令即可: $ sudo add-apt-repository ppa:format-junkie-team/release $ sudo apt-get update @@ -16,7 +16,7 @@ Format Junkie 可以通过 Ubuntu PPA format-junkie-team 进行安装。这个PP ### 将 Format Junkie 安装到 Ubuntu 13.10 ### -如果你正在运行Ubuntu 13.10 (Saucy Salamander),你可以按照以下步骤下载 .deb 安装包来进行安装。由于Format Junkie 的 .deb 安装包只有很少的依赖包,所以使用 [gdebi deb installer][2] 来按安装它。 +如果你正在运行Ubuntu 13.10 (Saucy Salamander),你可以按照以下步骤下载 .deb 安装包来进行安装。由于Format Junkie 的 .deb 安装包只有很少的依赖包,所以使用 [gdebi deb installer][2] 来安装它。 在32位版Ubuntu 13.10上: @@ -30,9 +30,9 @@ Format Junkie 可以通过 Ubuntu PPA format-junkie-team 进行安装。这个PP $ sudo gdebi formatjunkie_1.07-1~raring0.2_amd64.deb $ sudo ln -s /opt/extras.ubuntu.com/formatjunkie/formatjunkie /usr/bin/formatjunkie -### 将 Format Junkie 安装到 Ubuntu 14.04 或 之后版本 ### +### 将 Format Junkie 安装到 Ubuntu 14.04 或之后版本 ### -现有的可供使用的官方 Format Junkie .deb 文件 需要 libavcodec-extra-53,这个东西从Ubuntu 14.04开始就已经过时了。所以如果你想在Ubuntu 14.04或之后版本上安装Format Junkie的话,可以使用以下的第三方PPA来代替。 +现有可供使用的官方 Format Junkie .deb 文件需要 libavcodec-extra-53,不过它从Ubuntu 14.04开始就已经过时了。所以如果你想在Ubuntu 14.04或之后版本上安装Format Junkie,可以使用以下的第三方PPA来代替。 $ sudo add-apt-repository ppa:jon-severinsson/ffmpeg $ sudo add-apt-repository ppa:noobslab/apps @@ -47,11 +47,11 @@ Format Junkie 可以通过 Ubuntu PPA format-junkie-team 进行安装。这个PP #### 使用 Format Junkie 来转换音频、视频、图像和归档格式 #### -就像下方展示的一样,Format Junkie 的用户界面简单而且直观。在音频、视频、图像和iso媒介之间进行选择,在顶部四个标签当中点击你需要的那个。你可以根据需要添加无限量的文件用于批量转换。添加文件后,选择输出格式,直接点击 "Start Converting" 按钮进行转换。 +就像下方展示的一样,Format Junkie 的用户界面简单而且直观。在顶部的音频、视频、图像和iso媒体四个标签当中点击你需要的那个。你可以根据需要添加任意数量的文件用于批量转换。添加文件后,选择输出格式,直接点击 "Start Converting" 按钮进行转换。 ![](http://farm9.staticflickr.com/8107/8643695905_082b323059.jpg) -Format Junkie支持以下媒介媒介媒介格式间的转换: +Format Junkie支持以下媒体格式间的转换: - **Audio**: mp3, wav, ogg, wma, flac, m4r, aac, m4a, mp2. - **Video**: avi, ogv, vob, mp4, 3gp, wmv, mkv, mpg, mov, flv, webm. @@ -60,7 +60,7 @@ Format Junkie支持以下媒介媒介媒介格式间的转换: #### 用 Format Junkie 进行字幕编码 #### -除了媒介转换,Format Junkie 可提供了字幕编码的图形界面。实际的字幕编码是由MEncoder来完成的。为了使用Format Junkie的字幕编码接口,首先你需要安装MEencoder。 +除了媒体转换,Format Junkie 可提供了字幕编码的图形界面。实际的字幕编码是由MEncoder来完成的。为了使用Format Junkie的字幕编码接口,首先你需要安装MEencoder。 $ sudo apt-get install mencoder @@ -68,9 +68,9 @@ Format Junkie支持以下媒介媒介媒介格式间的转换: ![](http://farm9.staticflickr.com/8100/8644791396_bfe602cd16.jpg) -总而言之,Format Junkie 是一个非常易于使用和多才多艺的媒介转换工具。但也有一个缺陷,它不允许对转换进行任何定制化(例如:比特率,帧率,采样频率,图像质量,尺寸)。所以这个工具推荐正在寻找一个简单易用的媒介转换工具的新手使用。 +总而言之,Format Junkie 是一个非常易于使用和多才多艺的媒体转换工具。但也有一个缺陷,它不允许对转换进行任何定制化(例如:比特率,帧率,采样频率,图像质量,尺寸)。所以这个工具推荐给正在寻找一个简单易用的媒体转换工具的新手使用。 -喜欢这篇文章吗?在facebook、twitter和google+上给我点赞吧。多谢! +喜欢这篇文章吗?请在下面发表评论吧。多谢! -------------------------------------------------------------------------------- @@ -78,7 +78,7 @@ via: http://xmodulo.com/how-to-convert-image-audio-and-video-formats-on-ubuntu.h 作者:[Dan Nanni][a] 译者:[Ping](https://github.com/mr-ping) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/20141013 How to configure peer-to-peer VPN on Linux.md b/published/201501/20141013 How to configure peer-to-peer VPN on Linux.md similarity index 100% rename from published/20141013 How to configure peer-to-peer VPN on Linux.md rename to published/201501/20141013 How to configure peer-to-peer VPN on Linux.md diff --git a/published/20141023 How to turn your CentOS box into a BGP router using Quagga.md b/published/201501/20141023 How to turn your CentOS box into a BGP router using Quagga.md similarity index 100% rename from published/20141023 How to turn your CentOS box into a BGP router using Quagga.md rename to published/201501/20141023 How to turn your CentOS box into a BGP router using Quagga.md diff --git a/published/20141023 What are useful Bash aliases and functions.md b/published/201501/20141023 What are useful Bash aliases and functions.md similarity index 100% rename from published/20141023 What are useful Bash aliases and functions.md rename to published/201501/20141023 What are useful Bash aliases and functions.md diff --git a/published/20141027 ntpq -p output.md b/published/201501/20141027 ntpq -p output.md similarity index 100% rename from published/20141027 ntpq -p output.md rename to published/201501/20141027 ntpq -p output.md diff --git a/published/20141106 5 Awesome Open Source Backup Software For Linux and Unix-like Systems.md b/published/201501/20141106 5 Awesome Open Source Backup Software For Linux and Unix-like Systems.md similarity index 100% rename from published/20141106 5 Awesome Open Source Backup Software For Linux and Unix-like Systems.md rename to published/201501/20141106 5 Awesome Open Source Backup Software For Linux and Unix-like Systems.md diff --git a/published/20141108 When hackers grow old.md b/published/201501/20141108 When hackers grow old.md similarity index 100% rename from published/20141108 When hackers grow old.md rename to published/201501/20141108 When hackers grow old.md diff --git a/published/20141112 How to Debug CPU Regressions Using Flame Graphs.md b/published/201501/20141112 How to Debug CPU Regressions Using Flame Graphs.md similarity index 100% rename from published/20141112 How to Debug CPU Regressions Using Flame Graphs.md rename to published/201501/20141112 How to Debug CPU Regressions Using Flame Graphs.md diff --git a/published/20141115 How to perform system backup with backup-manager on Linux.md b/published/201501/20141115 How to perform system backup with backup-manager on Linux.md similarity index 100% rename from published/20141115 How to perform system backup with backup-manager on Linux.md rename to published/201501/20141115 How to perform system backup with backup-manager on Linux.md diff --git a/published/20141115 What are some obscure but useful Vim commands.md b/published/201501/20141115 What are some obscure but useful Vim commands.md similarity index 100% rename from published/20141115 What are some obscure but useful Vim commands.md rename to published/201501/20141115 What are some obscure but useful Vim commands.md diff --git a/published/201501/20141117 Restricting process CPU usage using nice cpulimit and cgroups.md b/published/201501/20141117 Restricting process CPU usage using nice cpulimit and cgroups.md new file mode 100644 index 0000000000..5ca233ae98 --- /dev/null +++ b/published/201501/20141117 Restricting process CPU usage using nice cpulimit and cgroups.md @@ -0,0 +1,195 @@ +使用 nice、cpulimit 和 cgroups 限制 cpu 占用率 +================================================================================ + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/juggle.jpg) + +Linux内核是一名了不起的马戏表演者,它在进程和系统资源间小心地玩着杂耍,并保持系统的能够正常运转。 同时,内核也很公正:它将资源公平地分配给各个进程。 + +但是,如果你需要给一个重要进程提高优先级时,该怎么做呢? 或者是,如何降低一个进程的优先级? 又或者,如何限制一组进程所使用的资源呢? + +**答案是需要由用户来为内核指定进程的优先级** + +大部分进程启动时的优先级是相同的,因此Linux内核会公平地进行调度。 如果想让一个CPU密集型的进程运行在较低优先级,那么你就得事先配置好调度器。 + +下面介绍3种控制进程运行时间的方法: + +- 使用 nice 命令手动降低任务的优先级。 +- 使用 cpulimit 命令不断的暂停进程,以控制进程所占用处理能力不超过特定限制。 +- 使用linux内建的**control groups(控制组)**功能,它提供了限制进程资源消耗的机制。 + +我们来看一下这3个工具的工作原理和各自的优缺点。 + +### 模拟高cpu占用率 ### + +在分析这3种技术前,我们要先安装一个工具来模拟高CPU占用率的场景。我们会用到CentOS作为测试系统,并使用[Mathomatic toolkit][1]中的质数生成器来模拟CPU负载。 + +很不幸,在CentOS上这个工具没有预编译好的版本,所以必须要从源码进行安装。先从 http://mathomatic.orgserve.de/mathomatic-16.0.5.tar.bz2 这个链接下载源码包并解压。然后进入 **mathomatic-16.0.5/primes** 文件夹,运行 **make** 和 **sudo make install** 进行编译和安装。这样,就把 **matho-primes** 程序安装到了 **/usr/local/bin** 目录中。 + +接下来,通过命令行运行: + + /usr/local/bin/matho-primes 0 9999999999 > /dev/null & + +程序运行后,将输出从0到9999999999之间的质数。因为我们并不需要这些输出结果,直接将输出重定向到/dev/null就好。 + +现在,使用top命令就可以看到matho-primes进程榨干了你所有的cpu资源。 + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image00.jpg) + +好了,接下来(按q键)退出 top 并杀掉 matho-primes 进程(使用 fg 命令将进程切换到前台,再按 CTRL+C) + +### nice命令 ### + +下来介绍一下nice命令的使用方法,nice命令可以修改进程的优先级,这样就可以让进程运行得不那么频繁。 **这个功能在运行cpu密集型的后台进程或批处理作业时尤为有用。** nice值的取值范围是[-20,19],-20表示最高优先级,而19表示最低优先级。 Linux进程的默认nice值为0。使用nice命令(不带任何参数时)可以将进程的nice值设置为10。这样调度器就会将此进程视为较低优先级的进程,从而减少cpu资源的分配。 + +下面来看一个例子,我们同时运行两个 **matho-primes** 进程,一个使用nice命令来启动运行,而另一个正常启动运行: + + nice matho-primes 0 9999999999 > /dev/null & + matho-primes 0 9999999999 > /dev/null & + +再运行top命令。 + + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image05.jpg) + +看到没,正常运行的进程(nice值为0)获得了更多的cpu运行时间,相反的,用nice命令运行的进程占用的cpu时间会较少(nice值为10)。 + +在实际使用中,如果你要运行一个CPU密集型的程序,那么最好用nice命令来启动它,这样就可以保证其他进程获得更高的优先级。 也就是说,即使你的服务器或者台式机在重载的情况下,也可以快速响应。 + +nice 还有一个关联命令叫做 renice,它可以在运行时调整进程的 nice 值。使用 renice 命令时,要先找出进程的 PID。下面是一个例子: + + renice +10 1234 + +其中,1234是进程的 PID。 + +测试完 **nice** 和 **renice** 命令后,记得要将 **matho-primes** 进程全部杀掉。 + +### cpulimit命令 ### + +接下来介绍 **cpulimit** 命令的用法。 **cpulimit** 命令的工作原理是为进程预设一个 cpu 占用率门限,并实时监控进程是否超出此门限,若超出则让该进程暂停运行一段时间。cpulimit 使用 SIGSTOP 和 SIGCONT 这两个信号来控制进程。它不会修改进程的 nice 值,而是通过监控进程的 cpu 占用率来做出动态调整。 + +cpulimit 的优势是可以控制进程的cpu使用率的上限值。但与 nice 相比也有缺点,那就是即使 cpu 是空闲的,进程也不能完全使用整个 cpu 资源。 + +在 CentOS 上,可以用下面的方法来安装它: + + wget -O cpulimit.zip https://github.com/opsengine/cpulimit/archive/master.zip + unzip cpulimit.zip + cd cpulimit-master + make + sudo cp src/cpulimit /usr/bin + +上面的命令行,会先从从 GitHub 上将源码下载到本地,然后再解压、编译、并安装到 /usr/bin 目录下。 + +cpulimit 的使用方式和 nice 命令类似,但是需要用户使用 **-l** 选项显式地定义进程的 cpu 使用率上限值。举例说明: + + cpulimit -l 50 matho-primes 0 9999999999 > /dev/null & + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image03.jpg) + +从上面的例子可以看出 matho-primes 只使用了50%的 cpu 资源,剩余的 cpu 时间都在 idle。 + +cpulimit 还可以在运行时对进程进行动态限制,使用 **-p** 选项来指定进程的 PID,下面是一个实例: + + cpulimit -l 50 -p 1234 + +其中,1234是进程的 PID。 + +### cgroups 命令集 ### + +最后介绍,功能最为强大的控制组(cgroups)的用法。cgroups 是 Linux 内核提供的一种机制,利用它可以指定一组进程的资源分配。 具体来说,使用 cgroups,用户能够限定一组进程的 cpu 占用率、系统内存消耗、网络带宽,以及这几种资源的组合。 + +对比nice和cpulimit,**cgroups 的优势**在于它可以控制一组进程,不像前者仅能控制单进程。同时,nice 和 cpulimit 只能限制 cpu 使用率,而 cgroups 则可以限制其他进程资源的使用。 + +对 cgroups 善加利用就可以控制好整个子系统的资源消耗。就拿 CoreOS 作为例子,这是一个专为大规模服务器部署而设计的最简化的 Linux 发行版本,它的 upgrade 进程就是使用 cgroups 来管控。这样,系统在下载和安装升级版本时也不会影响到系统的性能。 + +下面做一下演示,我们将创建两个控制组(cgroups),并对其分配不同的 cpu 资源。这两个控制组分别命名为“cpulimited”和“lesscpulimited”。 + +使用 cgcreate 命令来创建控制组,如下所示: + + sudo cgcreate -g cpu:/cpulimited + sudo cgcreate -g cpu:/lesscpulimited + +其中“-g cpu”选项用于设定 cpu 的使用上限。除 cpu 外,cgroups 还提供 cpuset、memory、blkio 等控制器。cpuset 控制器与 cpu 控制器的不同在于,cpu 控制器只能限制一个 cpu 核的使用率,而 cpuset 可以控制多个 cpu 核。 + +cpu 控制器中的 cpu.shares 属性用于控制 cpu 使用率。它的默认值是 1024,我们将 lesscpulimited 控制组的 cpu.shares 设为1024(默认值),而 cpulimited 设为512,配置后内核就会按照2:1的比例为这两个控制组分配资源。 + +要设置cpulimited 组的 cpu.shares 为 512,输入以下命令: + + sudo cgset -r cpu.shares=512 cpulimited + +使用 cgexec 命令来启动控制组的运行,为了测试这两个控制组,我们先用cpulimited 控制组来启动 matho-primes 进程,命令行如下: + + sudo cgexec -g cpu:cpulimited /usr/local/bin/matho-primes 0 9999999999 > /dev/null & + +打开 top 可以看到,matho-primes 进程占用了所有的 cpu 资源。 + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image01.jpg) + +因为只有一个进程在系统中运行,不管将其放到哪个控制组中启动,它都会尽可能多的使用cpu资源。cpu 资源限制只有在两个进程争夺cpu资源时才会生效。 + +那么,现在我们就启动第二个 matho-primes 进程,这一次我们在 lesscpulimited 控制组中来启动它: + + sudo cgexec -g cpu:lesscpulimited /usr/local/bin/matho-primes 0 9999999999 > /dev/null & + +再打开 top 就可以看到,cpu.shares 值大的控制组会得到更多的 cpu 运行时间。 + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image02.jpg) + +现在,我们再在 cpulimited 控制组中增加一个 matho-primes 进程: + + sudo cgexec -g cpu:cpulimited /usr/local/bin/matho-primes 0 9999999999 > /dev/null & + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image04.jpg) + +看到没,两个控制组的 cpu 的占用率比例仍然为2:1。其中,cpulimited 控制组中的两个 matho-primes 进程获得的cpu 时间基本相当,而另一组中的 matho-primes 进程显然获得了更多的运行时间。 + +更多的使用方法,可以在 Red Hat 上查看详细的 cgroups 使用[说明][2]。(当然CentOS 7也有) + +### 使用Scout来监控cpu占用率 ### + +监控cpu占用率最为简单的方法是什么?[Scout][3] 工具能够监控能够自动监控进程的cpu使用率和内存使用情况。 + +![](https://dl.dropboxusercontent.com/u/468982/blog/server_view/processes.png) + +[Scout][3]的触发器(trigger)功能还可以设定 cpu 和内存的使用门限,超出门限时会自动产生报警。 + +从这里可以获取 [Scout][4] 的试用版。 + +### 总结 ### + +![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/overview.png) + +计算机的系统资源是非常宝贵的。上面介绍的这3个工具能够帮助大家有效地管理系统资源,特别是cpu资源: + +- **nice**可以一次性调整进程的优先级。 +- **cpulimit**在运行cpu密集型任务且要保持系统的响应性时会很有用。 +- **cgroups**是资源管理的瑞士军刀,同时在使用上也很灵活。 + +-------------------------------------------------------------------------------- + +via: http://blog.scoutapp.com/articles/2014/11/04/restricting-process-cpu-usage-using-nice-cpulimit-and-cgroups + +译者:[coloka](https://github.com/coloka) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://www.mathomatic.org/ +[2]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Resource_Management_and_Linux_Containers_Guide/chap-Introduction_to_Control_Groups.html +[3]:https://scoutapp.com/ +[4]:https://scoutapp.com/ +[5]: +[6]: +[7]: +[8]: +[9]: +[10]: +[11]: +[12]: +[13]: +[14]: +[15]: +[16]: +[17]: +[18]: +[19]: +[20]: \ No newline at end of file diff --git a/published/20141118 How to boot on an ISO image from Grub.md b/published/201501/20141118 How to boot on an ISO image from Grub.md similarity index 100% rename from published/20141118 How to boot on an ISO image from Grub.md rename to published/201501/20141118 How to boot on an ISO image from Grub.md diff --git a/published/20141119 Smartctl--Monitoring & Analysis tool for Hard drive.md b/published/201501/20141119 Smartctl--Monitoring & Analysis tool for Hard drive.md similarity index 100% rename from published/20141119 Smartctl--Monitoring & Analysis tool for Hard drive.md rename to published/201501/20141119 Smartctl--Monitoring & Analysis tool for Hard drive.md diff --git a/published/20141120 How to configure and secure your Postfix email server.md b/published/201501/20141120 How to configure and secure your Postfix email server.md similarity index 100% rename from published/20141120 How to configure and secure your Postfix email server.md rename to published/201501/20141120 How to configure and secure your Postfix email server.md diff --git a/translated/tech/20141120 How to install an Opensource VPN Server on Linux.md b/published/201501/20141120 How to install an Opensource VPN Server on Linux.md similarity index 85% rename from translated/tech/20141120 How to install an Opensource VPN Server on Linux.md rename to published/201501/20141120 How to install an Opensource VPN Server on Linux.md index 2484c31700..49150565d8 100644 --- a/translated/tech/20141120 How to install an Opensource VPN Server on Linux.md +++ b/published/201501/20141120 How to install an Opensource VPN Server on Linux.md @@ -2,17 +2,17 @@ ================================================================================ ![](http://techarena51.com/wp-content/uploads/2014/10/open-vpn.png) -我上网时最担心的一件事情是,我该如何确保我的数据安全和隐私。在搜索答案的过程中,我找到了很多保持匿名的方法,比如使用代理网站。但是使用第三方的服务不能完全保证。我需要的是有一款软件可以我自己安装并运行,那样我就能确保只有我才能访问数据。 +我上网时最担心的一件事情是,我该如何确保我的数据安全和隐私。在搜索答案的过程中,我找到了很多保持匿名的方法,比如使用代理网站。但是使用第三方的服务不能完全保证。我需要的是有一款软件可以让我自己安装并运行,那样我就能确保只有我才能访问数据。 这款软件叫什么呢? 它叫VPN服务,就是虚拟隐私网络的简称。它允许访问时通过SSL加密你的数据。因为是加密的连接,所以你的ISP不能看到你的浏览信息。 -在本篇Linux教程中,我会在CentOS 7上安装一个OpenVPN服务。OpenVPN很容易使用,开源且拥有基于社区的支持。它的客户端有Windows、Android和Mac。 +在本篇Linux教程中,我会在CentOS 7上安装一个OpenVPN服务。OpenVPN很容易使用,开源且拥有社区的支持。它的客户端支持Windows、[Android][1]和Mac。 -### 第一步: 在你的Linux机器或者 [VPS][1]上安装OpenVPN服务 ### +### 第一步: 在你的Linux机器或者 VPS 上安装OpenVPN服务 ### -从https://openvpn.net/index.php/access-server/download-openvpn-as-sw.html下载安装包,Ubuntu用户也可以找到合适的安装包并安装。 +从 https://openvpn.net/index.php/access-server/download-openvpn-as-sw.html 下载安装包,Ubuntu用户也可以找到合适的安装包并安装。 [leo@vps ]$ cd /tmp [leo@vps tmp]$ wget http://swupdate.openvpn.org/as/openvpn-as-2.0.10-CentOS7.x86_64.rpm @@ -61,11 +61,10 @@ via: http://techarena51.com/index.php/how-to-install-an-opensource-vpn-server-on 作者:[Leo G][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://techarena51.com/ [1]:https://play.google.com/store/apps/details?id=net.openvpn.openvpn&hl=en -[2]:http://supportinc.net/vps-hosting.php [3]:https://openvpn.net/index.php/access-server/docs/admin-guides-sp-859543150/howto-connect-client-configuration.html \ No newline at end of file diff --git a/published/201501/20141124 Important 10 Linux ps command Practical Examples.md b/published/201501/20141124 Important 10 Linux ps command Practical Examples.md new file mode 100644 index 0000000000..6423db4a2a --- /dev/null +++ b/published/201501/20141124 Important 10 Linux ps command Practical Examples.md @@ -0,0 +1,186 @@ +10个重要的Linux ps命令实战 +================================================================================ +Linux作为Unix的衍生操作系统,Linux内建有查看当前进程的工具。这个工具能在命令行中使用。 + +### PS 命令是什么 ### + +查看它的man手册可以看到,ps命令能够给出当前系统中进程的快照。它能捕获系统在某一事件的进程状态。如果你想不断更新查看的这个状态,可以使用top命令。 + +ps命令支持三种使用的语法格式 + +1. UNIX 风格,选项可以组合在一起,并且选项前必须有“-”连字符 +2. BSD 风格,选项可以组合在一起,但是选项前不能有“-”连字符 +3. GNU 风格的长选项,选项前有两个“-”连字符 + +我们能够混用这几种风格,但是可能会发生冲突。本文使用 UNIX 风格的ps命令。这里有在日常生活中使用较多的ps命令的例子。 + +### 1. 不加参数执行ps命令 ### + +这是一个基本的 **ps** 使用。在控制台中执行这个命令并查看结果。 + +![不加选项执行ps命令](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_no_options.png) + +结果默认会显示4列信息。 + +- PID: 运行着的命令(CMD)的进程编号 +- TTY: 命令所运行的位置(终端) +- TIME: 运行着的该命令所占用的CPU处理时间 +- CMD: 该进程所运行的命令 + +这些信息在显示时未排序。 + +### 2. 显示所有当前进程 ### + +使用 **-a** 参数。**-a 代表 all**。同时加上x参数会显示没有控制终端的进程。 + + $ ps -ax + +这个命令的结果或许会很长。为了便于查看,可以结合less命令和管道来使用。 + + $ ps -ax | less + +![ps all 信息](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_ax.png) + +### 3. 根据用户过滤进程 ### + +在需要查看特定用户进程的情况下,我们可以使用 **-u** 参数。比如我们要查看用户'pungki'的进程,可以通过下面的命令: + + $ ps -u pungki + +![通过用户过滤](http://blog.linoxide.com/wp-content/uploads/2014/10/ps__u.png) + +### 4. 通过cpu和内存使用来过滤进程 ### + +也许你希望把结果按照 CPU 或者内存用量来筛选,这样你就找到哪个进程占用了你的资源。要做到这一点,我们可以使用 **aux 参数**,来显示全面的信息: + + $ ps -aux | less + +![显示全面信息](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_aux.png) + +当结果很长时,我们可以使用管道和less命令来筛选。 + +默认的结果集是未排好序的。可以通过 **--sort**命令来排序。 + +根据 **CPU 使用**来升序排序 + + $ ps -aux --sort -pcpu | less + +![根据cpu使用排序](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_aux_sort_cpu.png) + +根据 **内存使用** 来升序排序 + + $ ps -aux --sort -pmem | less + +![根据内存使用来排序](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_aux_sort_mem.png) + +我们也可以将它们合并到一个命令,并通过管道显示前10个结果: + + $ ps -aux --sort -pcpu,+pmem | head -n 10 + +### 5. 通过进程名和PID过滤 ### + +使用 **-C 参数**,后面跟你要找的进程的名字。比如想显示一个名为getty的进程的信息,就可以使用下面的命令: + + $ ps -C getty + +![通过进程名和PID过滤](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_C.png) + +如果想要看到更多的细节,我们可以使用-f参数来查看格式化的信息列表: + + $ ps -f -C getty + +![通过进程名和PID过滤](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_C_f.png) + +### 6. 根据线程来过滤进程 ### + +如果我们想知道特定进程的线程,可以使用**-L 参数**,后面加上特定的PID。 + + $ ps -L 1213 + +![根据线程来过滤进程](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_L.png) + +### 7. 树形显示进程 ### + +有时候我们希望以树形结构显示进程,可以使用 **-axjf** 参数。 + + $ps -axjf + +![树形显示进程](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_axjf.png) + +或者可以使用另一个命令。 + + $ pstree + +![树形显示进程](http://blog.linoxide.com/wp-content/uploads/2014/10/pstree.png) + +### 8. 显示安全信息 ### + +如果想要查看现在有谁登入了你的服务器。可以使用ps命令加上相关参数: + + $ ps -eo pid,user,args + +**参数 -e** 显示所有进程信息,**-o 参数**控制输出。**Pid**,**User 和 Args**参数显示**PID,运行应用的用户**和**该应用**。 + +![显示安全信息](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_security_1.png) + +能够与**-e 参数** 一起使用的关键字是**args, cmd, comm, command, fname, ucmd, ucomm, lstart, bsdstart 和 start**。 + +### 9. 格式化输出root用户(真实的或有效的UID)创建的进程 ### + +系统管理员想要查看由root用户运行的进程和这个进程的其他相关信息时,可以通过下面的命令: + + $ ps -U root -u root u + +**-U 参数**按真实用户ID(RUID)筛选进程,它会从用户列表中选择真实用户名或 ID。真实用户即实际创建该进程的用户。 + +**-u** 参数用来筛选有效用户ID(EUID)。 + +最后的**u**参数用来决定以针对用户的格式输出,由**User, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME 和 COMMAND**这几列组成。 + +这里有上面的命令的输出结果: + +![show real and effective User ID](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_root_real_effective_ID.png) + +### 10. 使用PS实时监控进程状态 ### + +ps 命令会显示你系统当前的进程状态,但是这个结果是静态的。 + +当有一种情况,我们需要像上面第四点中提到的通过CPU和内存的使用率来筛选进程,并且我们希望结果能够每秒刷新一次。为此,我们可以**将ps命令和watch命令结合起来**。 + + $ watch -n 1 ‘ps -aux --sort -pmem, -pcpu’ + +![组合 ps 和 watch](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_watch_1.png) + +如果输出太长,我们也可以限制它,比如前20条,我们可以使用**head**命令来做到。 + + $ watch -n 1 ‘ps -aux --sort -pmem, -pcpu | head 20’ + +![组合 ps 和 watch](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_watch_2.png) + +这里的动态查看并不像top或者htop命令一样。**但是使用ps的好处是**你能够定义显示的字段,你能够选择你想查看的字段。 + +举个例子,**如果你只需要看名为'pungki'用户的信息**,你可以使用下面的命令: + + $ watch -n 1 ‘ps -aux -U pungki u --sort -pmem, -pcpu | head 20’ + +![组合 ps 和 watch](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_watch_3.png) + +### 结论 ### + +你也许每天都会使用ps命令来监控你的Linux系统。但是事实上,你可以通过ps命令的参数来生成各种你需要的报表。 + +ps命令的另一个优势是ps是各种 Linux系统都默认安装的,因此你只要用就行了。 + +不要忘了通过 man ps来查看更多的参数。(LCTT 译注:由于 ps 命令古老而重要,所以它在不同的 UNIX、BSD、Linux 等系统中的参数不尽相同,因此如果你用的不是 Linux 系统,请查阅你的文档了解具体可用的参数。) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/linux-ps-command-examples/ + +作者:[Pungki Arianto][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/pungki/ diff --git a/translated/tech/20141124 Linux blkid Command to Find Block Devices Details.md b/published/201501/20141124 Linux blkid Command to Find Block Devices Details.md similarity index 81% rename from translated/tech/20141124 Linux blkid Command to Find Block Devices Details.md rename to published/201501/20141124 Linux blkid Command to Find Block Devices Details.md index 720baf2b33..9a912daf7a 100644 --- a/translated/tech/20141124 Linux blkid Command to Find Block Devices Details.md +++ b/published/201501/20141124 Linux blkid Command to Find Block Devices Details.md @@ -2,39 +2,27 @@ ================================================================================ 今天我们将会向你展示如何使用 **lsblk** 和 **blkid** 工具来查找关于块设备的信息,我们使用的是一台安装了 CentOS 7.0 的机器。 +## lsblk ## + **lsblk** 是一个 Linux 工具,它会显示有关你系统里所有可用块设备的信息。它从 [sysfs 文件系统][1] 中获取信息。默认情况下,这个工具将会以树状格式显示(除了内存虚拟磁盘外的)所有块设备。 ### lsblk 默认输出 ### 默认情况下 lsblk 会将块设备输出为树状格式: -**NAME** +- **NAME** —— 设备的名称 - —— 设备的名称 +- **MAJ:MIN** —— Linux 操作系统中的每个设备都以一个文件表示,对块(磁盘)设备来说,这里用主次设备编号来描述设备。 -**MAJ:MIN** +- **RM** —— 可移动设备。如果这是一个可移动设备将显示 1,否则显示 0。 - —— Linux 操作系统中的每个设备都以一个文件表示,对块(磁盘)设备来说,这里用主次设备编号来描述设备。 +- **TYPE** —— 设备的类型 -**RM** +- **MOUNTPOINT** —— 设备挂载的位置 - —— 可移动设备。如果这是一个可移动设备将显示 1,否则显示 0。 +- **RO** —— 对于只读文件系统,这里会显示 1,否则显示 0。 -**TYPE** - - —— 设备的类型 - -**MOUNTPOINT** - - —— 设备挂载的位置 - -**RO** - - —— 对于只读文件系统,这里会显示 1,否则显示 0。 - -**SIZE** - - —— 设备的容量 +- **SIZE** —— 设备的容量 ![](http://blog.linoxide.com/wp-content/uploads/2014/10/lsblk.jpg) @@ -54,12 +42,14 @@ ### 在脚本中使用 ### -高级技巧:如果你想要在脚本中使用而不希望表头被显示出来,你可以这样使用 -n 选项: +高级技巧:如果你想要在脚本中使用而希望剔除表头,你可以这样使用 -n 选项: lsblk -ln ![](http://blog.linoxide.com/wp-content/uploads/2014/10/lsblk-ln.jpg) +## blkid ## + **blkid** 命令是一个命令行工具,它可以显示关于可用块设备的信息。它可以识别一个块设备内容的类型(如文件系统、交换区)以及从内容的元数据(如卷标或 UUID 字段)中获取属性(如 tokens 和键值对)。它主要有两类作用:用指定的键值对搜索一个设备,或是显示一个或多个设备的键值对。 ### blkid 使用方法 ### @@ -84,7 +74,7 @@ ### 详细信息 ### -如果你想要获取更多详细信息,你可以使用 -p 和 -o udev 选项来将它们用漂亮的格式显示出来,像这样: +如果你想要获取更多详细信息,你可以使用 -p 和 -o udev 选项来将它们用整齐的格式显示出来,像这样: # blkid -po udev /dev/sda1 @@ -102,7 +92,7 @@ via: http://linoxide.com/linux-command/linux-command-lsblk-blkid/ 作者:[Adrian Dinu][a] 译者:[felixonmars](https://github.com/felixonmars) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/20141125 Four ways Linux is headed for no-downtime kernel patching.md b/published/201501/20141125 Four ways Linux is headed for no-downtime kernel patching.md similarity index 100% rename from published/20141125 Four ways Linux is headed for no-downtime kernel patching.md rename to published/201501/20141125 Four ways Linux is headed for no-downtime kernel patching.md diff --git a/published/20141125 How to install Cacti (Monitoring tool) on ubuntu 14.10 server.md b/published/201501/20141125 How to install Cacti (Monitoring tool) on ubuntu 14.10 server.md similarity index 100% rename from published/20141125 How to install Cacti (Monitoring tool) on ubuntu 14.10 server.md rename to published/201501/20141125 How to install Cacti (Monitoring tool) on ubuntu 14.10 server.md diff --git a/published/20141127 Five Magnificent Linux Music Streaming Clients.md b/published/201501/20141127 Five Magnificent Linux Music Streaming Clients.md similarity index 100% rename from published/20141127 Five Magnificent Linux Music Streaming Clients.md rename to published/201501/20141127 Five Magnificent Linux Music Streaming Clients.md diff --git a/published/20141127 How To Create A Multiboot USB From Ubuntu Using MultiSystem.md b/published/201501/20141127 How To Create A Multiboot USB From Ubuntu Using MultiSystem.md similarity index 100% rename from published/20141127 How To Create A Multiboot USB From Ubuntu Using MultiSystem.md rename to published/201501/20141127 How To Create A Multiboot USB From Ubuntu Using MultiSystem.md diff --git a/published/201501/20141203 Docker--Present and Future.md b/published/201501/20141203 Docker--Present and Future.md new file mode 100644 index 0000000000..bdec540363 --- /dev/null +++ b/published/201501/20141203 Docker--Present and Future.md @@ -0,0 +1,158 @@ +Docker 的现状与未来 +================================================================================ + +### Docker - 迄今为止发生的那些事情 ### + +Docker 是一个专为 Linux 容器而设计的工具集,用于‘构建、交付和运行’分布式应用。它最初是 DotCloud 的一个开源项目,于2013年3月发布。这个项目越来越受欢迎,以至于 DotCloud 公司都更名为 Docker 公司(并最终[出售了原有的 PaaS 业务][1])。[Docker 1.0][2]是在2014年6月发布的,而且延续了之前每月更新一个版本的传统。 + +Docker 1.0版本的发布标志着 Docker 公司认为该平台已经充分成熟,足以用于生产环境中(由该公司与合作伙伴提供付费支持选择)。每个月发布的更新表明该项目正在迅速发展,比如增添一些新特性、解决一些他们发现的问题。该项目已经成功地分离了‘运行’和‘交付’两件事,所以来自任何版本的 Docker 镜像源都可以与其它版本共同使用(具备向前和向后兼容的特性),这为 Docker 应对快速变化提供了稳定的保障。 + +Docker 之所以能够成为最受欢迎的开源项目之一可能会被很多人看做是炒作,但是也是由其坚实的基础所决定的。Docker 的影响力已经得到整个行业许多大企业的支持,包括亚马逊, Canonical 公司, CenturyLink, 谷歌, IBM, 微软, New Relic, Pivotal, 红帽和 VMware。这使得只要有 Linux 的地方,Docker 就可以无处不在。除了这些鼎鼎有名的大公司以外,许多初创公司也在围绕着 Docker 发展,或者改变他们的发展方向来与 Docker 更好地结合起来。这些合作伙伴们(无论大或小)都将帮助推动 Docker 核心项目及其周边生态环境的快速发展。 + +### Docker 技术简要综述 ### + +Docker 利用 Linux 的一些内核机制例如 [cGroups][3]、命名空间和 [SElinux][4] 来实现容器之间的隔离。起初 Docker 只是 [LXC][5] 容器管理器子系统的前端,但是在 0.9 版本中引入了 [libcontainer][6],这是一个原生的 go 语言库,提供了用户空间和内核之间的接口。 + +容器是基于 [AUFS][7] 这样的联合文件系统的,它允许跨多个容器共享组件,如操作系统镜像和已安装的相关库。这种文件系统的分层方法也被 [Dockerfile][8] 的 DevOps 工具所利用,这些工具能够缓存成功完成的操作。这就省下了安装操作系统和相关应用程序依赖包的时间,极大地加速测试周期。另外,在容器之间的共享库也能够减少内存的占用。 + +一个容器是从一个镜像开始运行的,它可以来自本地创建,本地缓存,或者从一个注册库(registry)下载。Docker 公司运营的 [Docker Hub 公有注册库][9],为各种操作系统、中间件和数据库提供了官方仓库存储。各个组织和个人都可以在 docker Hub 上发布的镜像的公有库,也可以注册成私有仓库。由于上传的镜像可以包含几乎任何内容,所以 Docker 提供了一种自动构建工具(以往称为“可信构建”),镜像可以从一种称之为 Dockerfile 的镜像内容清单构建而成。 + +### 容器 vs. 虚拟机 ### + +容器会比虚拟机更高效,因为它们能够分享一个内核和分享应用程序库。相比虚拟机系统,这也将使得 Docker 使用的内存更小,即便虚拟机利用了内存超量使用的技术。部署容器时共享底层的镜像层也可以减少存储占用。IBM 的 Boden Russel 已经做了一些[基准测试][10]来说明两者之间的不同。 + +相比虚拟机系统,容器具有较低系统开销的优势,所以在容器中,应用程序的运行效率将会等效于在同样的应用程序在虚拟机中运行,甚至效果更佳。IBM 的一个研究团队已经发表了一本名为[虚拟机与 Linux 容器的性能比较]的文章[11]。 + +容器只是在隔离特性上要比虚拟机逊色。虚拟机可以利用如 Intel 的 VT-d 和 VT-x 技术的 ring-1 [硬件隔离][12]技术。这种隔离可以防止虚拟机突破和彼此交互。而容器至今还没有任何形式的硬件隔离,这使它容易受到攻击。一个称为 [Shocker][13] 的概念攻击验证表明,在 Docker 1.0 之前的版本是存在这种脆弱性的。尽管 Docker 1.0 修复了许多由 Shocker 漏洞带来的较为严重的问题,Docker 的 CTO Solomon Hykes 仍然[说][14],“当我们可以放心宣称 Docker 的开箱即用是安全的,即便是不可信的 uid0 程序(超级用户权限程序),我们将会很明确地告诉大家。”Hykes 的声明承认,其漏洞及相关的风险依旧存在,所以在容器成为受信任的工具之前将有更多的工作要做。 + +对于许多用户案例而言,在容器和虚拟机之间二者选择其一是种错误的二分法。Docker 同样可以在虚拟机中工作的很好,这让它可以用在现有的虚拟基础措施、私有云或者公有云中。同样也可以在容器里跑虚拟机,这也类似于谷歌在其云平台的使用方式。像 IaaS 服务这样普遍可用的基础设施,能够即时提供所需的虚拟机,可以预期容器与虚拟机一起使用的情景将会在数年后出现。容器管理和虚拟机技术也有可能被集成到一起提供一个两全其美的方案;这样,一个硬件信任锚微虚拟化所支撑的 libcontainer 容器,可与前端 Docker 工具链和生态系统整合,而使用提供更好隔离性的不同后端。微虚拟化(例如 Bromium 的 [vSentry][15] 和 VMware 的 [Project Fargo][16])已经用于在桌面环境中以提供基于硬件的应用程序隔离,所以类似的方法也可以用于 libcontainer,作为 Linux内核中的容器机制的替代技术。 + +### ‘容器化’ 的应用程序 ### + +几乎所有 Linux 应用程序都可以在 Docker 容器中运行,并没有编程语言或框架的限制。唯一的实际限制是以操作系统的角度来允许容器做什么。即使如此,也可以在特权模式下运行容器,从而大大减少了限制(与之对应的是容器中的应用程序的风险增加,可能导致损坏主机操作系统)。 + +容器都是从镜像开始运行的,而镜像也可以从运行中的容器获取。本质上说,有两种方法可以将应用程序放到容器中,分别是手动构建和 Dockerfile。 + +#### 手动构建 #### + +手动构建从启动一个基础的操作系统镜像开始,然后在交互式终端中用你所选的 Linux 提供的包管理器安装应用程序及其依赖项。Zef Hemel 在‘[使用 Linux 容器来支持便携式应用程序部署][17]’的文章中讲述了他部署的过程。一旦应用程序被安装之后,容器就可以被推送至注册库(例如Docker Hub)或者导出为一个tar文件。 + +#### Dockerfile #### + +Dockerfile 是一个用于构建 Docker 容器的脚本化系统。每一个 Dockerfile 定义了开始的基础镜像,以及一系列在容器中运行的命令或者一些被添加到容器中的文件。Dockerfile 也可以指定对外的端口和当前工作目录,以及容器启动时默认执行的命令。用 Dockerfile 构建的容器可以像手工构建的镜像一样推送或导出。Dockerfile 也可以用于 Docker Hub 的自动构建系统,即在 Docker 公司的控制下从头构建,并且该镜像的源代码是任何需要使用它的人可见的。 + +#### 单进程? #### + +无论镜像是手动构建还是通过 Dockerfile 构建,有一个要考虑的关键因素是当容器启动时仅启动一个进程。对于一个单一用途的容器,例如运行一个应用服务器,运行一个单一的进程不是一个问题(有些关于容器应该只有一个单独的进程的争议)。对于一些容器需要启动多个进程的情况,必须先启动 [supervisor][18] 进程,才能生成其它内部所需的进程。由于容器内没有初始化系统,所以任何依赖于 systemd、upstart 或类似初始化系统的东西不修改是无法工作的。 + +### 容器和微服务 ### + +全面介绍使用微服务结构体系的原理和好处已经超出了这篇文章的范畴(在 [InfoQ eMag: Microservices][19] 有全面阐述)。然而容器是绑定和部署微服务实例的捷径。 + +大规模微服务部署的多数案例都是部署在虚拟机上,容器只是用于较小规模的部署上。容器具有共享操作系统和公用库的的内存和硬盘存储的能力,这也意味着它可以非常有效的并行部署多个版本的服务。 + +### 连接容器 ### + +一些小的应用程序适合放在单独的容器中,但在许多案例中应用程序需要分布在多个容器中。Docker 的成功包括催生了一连串新的应用程序组合工具、编制工具及平台作为服务(PaaS)的实现。在这些努力的背后,是希望简化从一组相互连接的容器来创建应用的过程。很多工具也在扩展、容错、性能管理以及对已部署资产进行版本控制方面提供了帮助。 + +#### 连通性 #### + +Docker 的网络功能是相当原始的。在同一主机,容器内的服务可以互相访问,而且 Docker 也可以通过端口映射到主机操作系统,使服务可以通过网络访问。官方支持的提供连接能力的库叫做 [libchan][20],这是一个提供给 Go 语言的网络服务库,类似于[channels][21]。在 libchan 找到进入应用的方法之前,第三方应用仍然有很大空间可提供配套的网络服务。例如,[Flocker][22] 已经采取了基于代理的方法使服务实现跨主机(以及底层存储)的移植。 + +#### 合成 #### + +Docker 本身拥有把容器连接在一起的机制,与元数据相关的依赖项可以被传递到相依赖的容器中,并用于环境变量和主机入口。如 [Fig][23] 和 [geard][24] 这样的应用合成工具可以在单一文件中展示出这种依赖关系图,这样多个容器就可以汇聚成一个连贯的系统。CenturyLink 公司的 [Panamax][25] 合成工具类似 Fig 和 geard 的底层实现方法,但新增了一些基于 web 的用户接口,并直接与 GitHub 相结合,以便于应用程序分享。 + +#### 编制 #### + +像 [Decking][26]、New Relic 公司的 [Centurion][27] 和谷歌公司的 [Kubernetes][28] 这样的编制系统都是旨在协助容器的部署和管理其生命周期系统。也有许多 [Apache Mesos][30] (特别是 [Marathon(马拉松式)持续运行很久的框架])的案例(例如[Mesosphere][29])已经被用于配合 Docker 一起使用。通过为应用程序与底层基础架构之间(例如传递 CPU 核数和内存的需求)提供一个抽象的模型,编制工具提供了两者的解耦,简化了应用程序开发和数据中心操作。有很多各种各样的编制系统,因为许多来自内部系统的以前开发的用于大规模容器部署的工具浮现出来了;如 Kubernetes 是基于谷歌的 [Omega][32] 系统的,[Omega][32] 是用于管理遍布谷歌云环境中容器的系统。 + +虽然从某种程度上来说合成工具和编制工具的功能存在重叠,但这也是它们之间互补的一种方式。例如 Fig 可以被用于描述容器间如何实现功能交互,而 Kubernetes pods(容器组)可用于提供监控和扩展。 + +#### 平台(即服务)#### + +有一些 Docker 原生的 PaaS 服务实现,例如 [Deis][33] 和 [Flynn][34] 已经显现出 Linux 容器在开发上的的灵活性(而不是那些“自以为是”的给出一套语言和框架)。其它平台,例如 CloudFoundry、OpenShift 和 Apcera Continuum 都已经采取将 Docker 基础功能融入其现有的系统的技术路线,这样基于 Docker 镜像(或者基于 Dockerfile)的应用程序也可以与之前用支持的语言和框架的开发的应用一同部署和管理。 + +### 所有的云 ### + +由于 Docker 能够运行在任何正常更新内核的 Linux 虚拟机中,它几乎可以用在所有提供 IaaS 服务的云上。大多数的主流云厂商已经宣布提供对 Docker 及其生态系统的支持。 + +亚马逊已经把 Docker 引入它们的 Elastic Beanstalk 系统(这是在底层 IaaS 上的一个编制系统)。谷歌使 Docker 成为了“可管理的 VM”,它提供了GAE PaaS 和GCE IaaS 之间的中转站。微软和 IBM 也都已经宣布了基于 Kubernetes 的服务,这样可以在它们的云上部署和管理多容器应用程序。 + +为了给现有种类繁多的后端提供可用的一致接口,Docker 团队已经引进 [libswarm][35], 它可以集成于众多的云和资源管理系统。Libswarm 所阐明的目标之一是“通过切换服务来源避免被特定供应商套牢”。这是通过呈现一组一致的服务(与API相关联的)来完成的,该服务会通过特定的后端服务所实现。例如 Docker 服务器将支持本地 Docker 命令行工具的 Docker 远程 API 调用,这样就可以管理一组服务供应商的容器了。 + +基于 Docker 的新服务类型仍在起步阶段。总部位于伦敦的 Orchard 实验室提供了 Docker 的托管服务,但是 Docker 公司表示,收购 Orchard 后,其相关服务不会置于优先位置。Docker 公司也出售了之前 DotCloud 的PaaS 业务给 cloudControl。基于更早的容器管理系统的服务例如 [OpenVZ][36] 已经司空见惯了,所以在一定程度上 Docker 需要向主机托管商们证明其价值。 + +### Docker 及其发行版 ### + +Docker 已经成为大多数 Linux 发行版例如 Ubuntu、Red Hat 企业版(RHEL)和 CentOS 的一个标准功能。遗憾的是这些发行版的步调和 Docker 项目并不一致,所以在发布版中找到的版本总是远远落后于最新版本。例如 Ubuntu 14.04 版本中的版本是 Docker 0.9.1,而当 Ubuntu 升级至 14.04.1 时 Docker 版本并没有随之升级(此时 Docker 已经升至 1.1.2 版本)。在发行版的软件仓库中还有一个名字空间的冲突,因为 “Docker” 也是 KDE 系统托盘的名字;所以在 Ubuntu 14.04 版本中相关安装包的名字和命令行工具都是使用“Docker.io”的名字。 + +在企业级 Linux 的世界中,情况也并没有因此而不同。CentOS 7 中的 Docker 版本是 0.11.1,这是 Docker 公司宣布准备发行 Docker 1.0 产品版本之前的开发版。Linux 发行版用户如果希望使用最新版本以保障其稳定、性能和安全,那么最好地按照 Docker 的[安装说明][37]进行,使用 Docker 公司的所提供的软件库而不是采用发行版的。 + +Docker 的到来也催生了新的 Linux 发行版,如 [CoreOS][38] 和红帽的 [Project Atomic][39],它们被设计为能运行容器的最小环境。这些发布版相比传统的发行版,带着更新的内核及 Docker 版本,对内存的使用和硬盘占用率也更低。新发行版也配备了用于大型部署的新工具,例如 [fleet][40](一个分布式初始化系统)和[etcd][41](用于元数据管理)。这些发行版也有新的自我更新机制,以便可以使用最新的内核和 Docker。这也意味着使用 Docker 的影响之一是它抛开了对发行版和相关的包管理解决方案的关注,而对 Linux 内核(及使用它的 Docker 子系统)更加关注。 + +这些新发行版也许是运行 Docker 的最好方式,但是传统的发行版和它们的包管理器对容器来说仍然是非常重要的。Docker Hub 托管的官方镜像有 Debian、Ubuntu 和 CentOS,以及一个‘半官方’的 Fedora 镜像库。RHEL 镜像在Docker Hub 中不可用,因为它是 Red Hat 直接发布的。这意味着在 Docker Hub 的自动构建机制仅仅用于那些纯开源发行版下(并愿意信任那些源于 Docker 公司团队提供的基础镜像)。 + +Docker Hub 集成了如 Git Hub 和 Bitbucket 这样源代码控制系统来自动构建包管理器,用于管理构建过程中创建的构建规范(在Dockerfile中)和生成的镜像之间的复杂关系。构建过程的不确定结果并非是 Docker 的特定问题——而与软件包管理器如何工作有关。今天构建完成的是一个版本,明天构建的可能就是更新的版本,这就是为什么软件包管理器需要升级的原因。容器抽象(较少关注容器中的内容)以及容器扩展(因为轻量级资源利用率)有可能让这种不确定性成为 Docker 的痛点。 + +### Docker 的未来 ### + +Docker 公司对核心功能(libcontainer),跨服务管理(libswarm) 和容器间的信息传递(libchan)的发展上提出了明确的路线。与此同时,该公司已经表明愿意收购 Orchard 实验室,将其纳入自身生态系统。然而 Docker 不仅仅是 Docker 公司的,这个项目的贡献者也来自许多大牌贡献者,其中不乏像谷歌、IBM 和 Red Hat 这样的大公司。在仁慈独裁者、CTO Solomon Hykes 掌舵的形势下,为公司和项目明确了技术领导关系。在前18个月的项目中通过成果输出展现了其快速行动的能力,而且这种趋势并没有减弱的迹象。 + +许多投资者正在寻找10年前 VMware 公司的 ESX/vSphere 平台的特征矩阵,并试图找出虚拟机的普及而带动的企业预期和当前 Docker 生态系统两者的距离(和机会)。目前 Docker 生态系统正缺乏类似网络、存储和(对于容器的内容的)细粒度版本管理,这些都为初创企业和创业者提供了机会。 + +随着时间的推移,在虚拟机和容器(Docker 的“运行”部分)之间的区别将变得没那么重要了,而关注点将会转移到“构建”和“交付”方面。这些变化将会使“Docker发生什么?”变得不如“Docker将会给IT产业带来什么?”那么重要了。 + + +-------------------------------------------------------------------------------- + +via: http://www.infoq.com/articles/docker-future + +作者:[Chris Swan][a] +译者:[disylee](https://github.com/disylee) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoq.com/author/Chris-Swan +[1]:http://blog.dotcloud.com/dotcloud-paas-joins-cloudcontrol +[2]:http://www.infoq.com/news/2014/06/docker_1.0 +[3]:https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt +[4]:http://selinuxproject.org/page/Main_Page +[5]:https://linuxcontainers.org/ +[6]:http://blog.docker.com/2014/03/docker-0-9-introducing-execution-drivers-and-libcontainer/ +[7]:http://aufs.sourceforge.net/aufs.html +[8]:https://docs.docker.com/reference/builder/ +[9]:https://registry.hub.docker.com/ +[10]:http://bodenr.blogspot.co.uk/2014/05/kvm-and-docker-lxc-benchmarking-with.html?m=1 +[11]:http://domino.research.ibm.com/library/cyberdig.nsf/papers/0929052195DD819C85257D2300681E7B/$File/rc25482.pdf +[12]:https://en.wikipedia.org/wiki/X86_virtualization#Hardware-assisted_virtualization +[13]:http://stealth.openwall.net/xSports/shocker.c +[14]:https://news.ycombinator.com/item?id=7910117 +[15]:http://www.bromium.com/products/vsentry.html +[16]:http://cto.vmware.com/vmware-docker-better-together/ +[17]:http://www.infoq.com/articles/docker-containers +[18]:http://docs.docker.com/articles/using_supervisord/ +[19]:http://www.infoq.com/minibooks/emag-microservices +[20]:https://github.com/docker/libchan +[21]:https://gobyexample.com/channels +[22]:http://www.infoq.com/news/2014/08/clusterhq-launch-flocker +[23]:http://www.fig.sh/ +[24]:http://openshift.github.io/geard/ +[25]:http://panamax.io/ +[26]:http://decking.io/ +[27]:https://github.com/newrelic/centurion +[28]:https://github.com/GoogleCloudPlatform/kubernetes +[29]:https://mesosphere.io/2013/09/26/docker-on-mesos/ +[30]:http://mesos.apache.org/ +[31]:https://github.com/mesosphere/marathon +[32]:http://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/41684.pdf +[33]:http://deis.io/ +[34]:https://flynn.io/ +[35]:https://github.com/docker/libswarm +[36]:http://openvz.org/Main_Page +[37]:https://docs.docker.com/installation/#installation +[38]:https://coreos.com/ +[39]:http://www.projectatomic.io/ +[40]:https://github.com/coreos/fleet +[41]:https://github.com/coreos/etcd diff --git a/published/20141204 How To Delete Oracle 11g Database Manually.md b/published/201501/20141204 How To Delete Oracle 11g Database Manually.md similarity index 100% rename from published/20141204 How To Delete Oracle 11g Database Manually.md rename to published/201501/20141204 How To Delete Oracle 11g Database Manually.md diff --git a/translated/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md b/published/201501/20141204 How To Run Linux Programs From The Terminal In Background Mode.md similarity index 57% rename from translated/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md rename to published/201501/20141204 How To Run Linux Programs From The Terminal In Background Mode.md index a045e9f7fd..b346272331 100644 --- a/translated/tech/20141204 How To Run Linux Programs From The Terminal In Background Mode.md +++ b/published/201501/20141204 How To Run Linux Programs From The Terminal In Background Mode.md @@ -1,29 +1,29 @@ -如何从终端以后台模式运行Linux程序 +如何在终端下以后台模式运行Linux程序 === ![Linux Terminal Window.](http://0.tqn.com/y/linux/1/W/r/G/1/terminal.JPG) -Linux终端窗口。 +*Linux终端窗口* -这是一个简短但是非常有用的教程:它向你展示从终端运行Linux应用程序的同时,如何保证终端仍然在控制之中。 +这是一个简短但是非常有用的教程:它向你展示从终端运行Linux应用程序的同时,如何保证终端仍然可以操作。 -在Linux中有许多方式可以打开一个终端,这主要取决于你分类的选择和桌面环境。 +在Linux中有许多方式可以打开一个终端,这主要取决于你的发行版的选择和桌面环境。 -使用Ubuntu,你可以使用CTRL + ALT + T组合键打开一个终端。你也可以点击超级键(Windows键)打开一个终端窗口。在键盘上,[打开Ubuntu Dash][1],然后搜索"TERM"。点击"Term"图标将会打开一个终端窗口。 +使用Ubuntu的话,你可以使用CTRL + ALT + T组合键打开一个终端。你也可以点击超级键(Windows键)打开一个终端窗口。在键盘上,[打开Ubuntu Dash][1],然后搜索"TERM"。点击"Term"图标将会打开一个终端窗口。 -其他诸如XFCE, KDE, LXDE, Cinnamon和MATE的桌面环境,你将会在菜单中发现终端。还有一些分类会把终端图标放在入口处,或者在面板上放置终端启动器。 +其他诸如XFCE, KDE, LXDE, Cinnamon和MATE的桌面环境,你将会在菜单中发现“终端”这个应用。还有一些发行版会把终端图标放在菜单项,或者在面板上放置终端启动器。 -你可以在终端输入一个程序的名字来启动一个应用。举例,你可以通过输入"firefox"启动火狐浏览器。 +你可以在终端里面输入一个程序的名字来启动一个应用。举例,你可以通过输入"firefox"启动火狐浏览器。 -从终端运行程序的好处是一可以包含额外的选项。 +从终端运行程序的好处是可以使用额外的选项。 -举个例子,如果你输入下面的命令,一个新的火狐浏览器将会打开,而且默认的搜索引擎将会搜索引用之间的术语: +举个例子,如果你输入下面的命令,一个新的火狐浏览器将会打开,而且默认的搜索引擎将会搜索引号之间的词语: firefox -search "Linux.About.Com" -你会发现,如果你运行火狐浏览器,应用程序将被打开,并且控制将会回到终端,这将意味着你可以继续在终端工作。 +你会发现,如果你运行火狐浏览器,应用程序打开后,控制权将会回到终端(重新出现了命令提示符),这将意味着你可以继续在终端工作。 -通常情况下,如果你通过终端运行一个程序,程序将被打开,并且直到那个程序关闭结束,你将不会重新获得终端的控制权。这是因为你是在前台打开程序的。 +通常情况下,如果你通过终端运行一个程序,程序打开后,并且直到那个程序关闭结束,你都将不会获得终端的控制权。这是因为你是在前台打开程序的。 想要从终端运行一个程序,并且立即将终端的控制权返回给你,你需要以后台进程的方式打开程序。 @@ -31,11 +31,11 @@ Linux终端窗口。 libreoffice & -在终端中仅仅提供程序的名字,应用程序可能运行不了。如果程序不存在于一个设置了路径变量的文件夹中,你需要指定完成的路径名来运行程序。 +在终端中仅仅提供程序的名字,应用程序可能运行不了。如果程序不存在于一个设置在PATH 环境变量的文件夹中,你需要指定完整的路径名来运行程序。 /path/to/yourprogram & -如果你并不确定一个程序是否存在于Linux文件结构,使用find或者locate命令来查询应用程序。 +如果你并不确定一个程序是否存在于Linux文件系统中,使用find或者locate命令来查找该应用程序。 找一个文件的语法如下: @@ -45,7 +45,7 @@ Linux终端窗口。 find / -name firefox -输出会很快掠过,所以你可以以管道的方式控制输出的多少: +输出会很快滚动出很多,所以你可以以管道的方式控制输出的多少: find / -name firefox | more @@ -57,26 +57,25 @@ find命令将会返回因权限拒绝而发生错误的文件夹数量,这些 sudo find / -name firefox | more -如果你知道你想寻找的文件在你的当前文件夹结构中,你可以一个点代替先前的斜线,如下: +如果你知道你想寻找的文件在你的当前文件夹中,你可以一个点代替先前的斜线,如下: sudo find . -name firefox | more -你可能不需要sudo来提升权限。如果你在home文件夹结构中寻找文件,sudo就不需要。 +你可能不需要sudo来提升权限。如果你在home文件夹中寻找文件,sudo就不需要。 一些应用程序需要提升用户权限来运行,你可能得到一个缺少权限的错误,除非你使用一个具有足够权限的用户,或者使用sudo提升你的权限。 -下面是一个小花招。如果你运行一个程序,而且它需要提升权限来运行,输入下面命令: +下面是一个小花招。如果你运行一个程序,而且它需要提升权限来运行,输入下面命令来提升权限重新执行: sudo !! --- -via: http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-T -he-Terminal-In-Background-Mode.htm +via: http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-The-Terminal-In-Background-Mode.htm 作者:[Gary Newell][a] 译者:[su-kaiyao](https://github.com/su-kaiyao) -校对:[校对者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/20141205 10 free Commands to Check Memory Usage in Linux.md b/published/201501/20141205 10 free Commands to Check Memory Usage in Linux.md similarity index 75% rename from translated/tech/20141205 10 free Commands to Check Memory Usage in Linux.md rename to published/201501/20141205 10 free Commands to Check Memory Usage in Linux.md index fe56c55f93..e95227288c 100644 --- a/translated/tech/20141205 10 free Commands to Check Memory Usage in Linux.md +++ b/published/201501/20141205 10 free Commands to Check Memory Usage in Linux.md @@ -1,24 +1,22 @@ -10个检测Linux内存使用情况的‘free’命令 +检测 Linux 内存使用情况的 free 命令的10个例子 === -**Linux**是最有名的开源操作系统之一,它拥有着极其巨大的指令集。确定**物理内存**和**交换内存**所有可用空间的最重要,也是唯一的方法是使用“**free**”命令。 +**Linux**是最有名的开源操作系统之一,它拥有着极其巨大的命令集。确定**物理内存**和**交换内存**所有可用空间的最重要、也是唯一的方法是使用“**free**”命令。 -Linux “**free**”命令通过给出**Linux/Unix**操作系统中内核已使用的**buffers**情况,来提供**物理内存**和**交换内存**的总使用量和可用量。 +Linux “**free**”命令可以给出类**Linux/Unix**操作系统中**物理内存**和**交换内存**的总使用量、可用量及内核使用的**缓冲区**情况。 ![10 Linux Free Command Examples](http://www.tecmint.com/wp-content/uploads/2012/09/Linux-Free-commands.png) -这篇文章提供一些带有参数选项的“**free**”命令,这些命令对于你更好地利用你的内存会有帮助。 +这篇文章提供一些各种参数选项的“**free**”命令,这些命令对于你更好地利用你的内存会有帮助。 ### 1. 显示你的系统内存 ### -free命令用于检测**物理内存**和**交换内存**已使用量和可用量(单位为**KB**)。下面演示命令的使用情况。 +free命令用于检测**物理内存**和**交换内存**已使用量和可用量(默认单位为**KB**)。下面演示命令的使用情况。 # free - total used free shared buffers cach -ed - Mem: 1021628 912548 109080 0 120368 6555 -48 + total used free shared buffers cached + Mem: 1021628 912548 109080 0 120368 655548 -/+ buffers/cache: 136632 884996 Swap: 4194296 0 4194296 @@ -28,21 +26,18 @@ ed # free -b - total used free shared buffers cach -ed - Mem: 1046147072 934420480 111726592 0 123256832 6712811 -52 + total used free shared buffers cached + Mem: 1046147072 934420480 111726592 0 123256832 671281152 -/+ buffers/cache: 139882496 906264576 Swap: 4294959104 0 4294959104 ### 3. 以千字节为单位显示内存 ### -加上**-k**参数的free命令,以(KB)**千字节**为单位显示内存大小。 +加上**-k**参数的free命令(默认单位,所以可以不用使用它),以(KB)**千字节**为单位显示内存大小。 # free -k - total used free shared buffers cach -ed + total used free shared buffers cached Mem: 1021628 912520 109108 0 120368 655548 -/+ buffers/cache: 136604 885024 Swap: 4194296 0 4194296 @@ -53,10 +48,8 @@ ed # free -m - total used free shared buffers cach -ed - Mem: 997 891 106 0 117 6 -40 + total used free shared buffers cached + Mem: 997 891 106 0 117 640 -/+ buffers/cache: 133 864 Swap: 4095 0 4095 @@ -66,8 +59,7 @@ ed # free -g total used free shared buffers cached - Mem: 0 0 0 0 0 - 0 + Mem: 0 0 0 0 0 0 -/+ buffers/cache: 0 0 Swap: 3 0 3 @@ -77,10 +69,8 @@ ed # free -t - total used free shared buffers cache -d - Mem: 1021628 912520 109108 0 120368 6555 -48 + total used free shared buffers cached + Mem: 1021628 912520 109108 0 120368 655548 -/+ buffers/cache: 136604 885024 Swap: 4194296 0 4194296 Total: 5215924 912520 4303404 @@ -91,10 +81,8 @@ d # free -o - total used free shared buffers cache -d - Mem: 1021628 912520 109108 0 120368 6555 -48 + total used free shared buffers cached + Mem: 1021628 912520 109108 0 120368 655548 Swap: 4194296 0 4194296 ### 8. 定期时间间隔更新内存状态 ### @@ -103,10 +91,8 @@ d # free -s 5 - total used free shared buffers cach -ed - Mem: 1021628 912368 109260 0 120368 6555 -48 + total used free shared buffers cached + Mem: 1021628 912368 109260 0 120368 655548 -/+ buffers/cache: 136452 885176 Swap: 4194296 0 4194296 @@ -116,10 +102,8 @@ ed # free -l - total used free shared buffers cach -ed - Mem: 1021628 912368 109260 0 120368 6555 -48 + total used free shared buffers cached + Mem: 1021628 912368 109260 0 120368 655548 Low: 890036 789064 100972 High: 131592 123304 8288 -/+ buffers/cache: 136452 885176 @@ -139,7 +123,7 @@ via: http://www.tecmint.com/check-memory-usage-in-linux/ 作者:[Ravi Saive][a] 译者:[su-kaiyao](https://github.com/su-kaiyao) -校对:[校对者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/20141205 Find Out Network Adapters Available In Ubuntu Linux.md b/published/201501/20141205 Find Out Network Adapters Available In Ubuntu Linux.md similarity index 90% rename from translated/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md rename to published/201501/20141205 Find Out Network Adapters Available In Ubuntu Linux.md index d20083a363..b92b7cf01f 100644 --- a/translated/tech/20141205 Find Out Network Adapters Available In Ubuntu Linux.md +++ b/published/201501/20141205 Find Out Network Adapters Available In Ubuntu Linux.md @@ -1,10 +1,10 @@ -在Ubuntu上找出可用的网络适配器 +如何在Ubuntu上找出可用的网络适配器 ================================================================================ 想知道**在Linux中你正在使用的网卡是什么吗?** 在Linux中很容易就找出网卡的生产商。打开一个终端并输入下面的额命令: sudo lshw -C network -如果上面的命令不能在sudo下使用,那就移除sudo。它的输出看上去有点奇怪但是很有用。 +如果上面的命令不能在sudo下使用,那就别用 sudo 的特权模式。它的输出看上去有点奇怪但是很有用。 ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/12/Network_Adapter_Linux.jpeg) @@ -36,7 +36,7 @@ > > resources: irq:18 memory:b0600000-b0607fff memory:b0400000-b05fffff -如你所见,我Macbook Air上的无线网卡是BCM4360,这是一款在Ubuntu下面经常无法检测无线网络的很容易出问题的网卡。 +如你所见,我Macbook Air上的无线网卡是BCM4360,这是一款在Ubuntu下面很容易出现无法检测无线网络问题的网卡。 [lshw][1] 命令实际上死用来列出硬件的,因此命令的名字是lshw。带上网络的选项后,就会只过滤出网络硬件了。 @@ -82,7 +82,7 @@ > > 04:00.0 SATA controller: Marvell Technology Group Ltd. 88SS9183 PCIe SSD Controller (rev 14) -这些命令会同时列出有线和无线的网卡。你应该注意到上面的输出中显示我的系统中没有有线网卡。因为我使用的是Macbook Air,他没有以太网端口 +这些命令会同时列出有线和无线的网卡。你应该注意到上面的输出中显示我的系统中没有有线网卡。因为我使用的是Macbook Air,它没有以太网端口 我希望这边文章可以帮助你找到你系统中的网卡。欢迎提出问题和建议。 @@ -92,7 +92,7 @@ via: http://itsfoss.com/find-network-adapter-ubuntu-linux/ 作者:[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/20141205 How To Create A Bootable Ubuntu USB Drive For Mac In OS X.md b/published/201501/20141205 How To Create A Bootable Ubuntu USB Drive For Mac In OS X.md similarity index 100% rename from published/20141205 How To Create A Bootable Ubuntu USB Drive For Mac In OS X.md rename to published/201501/20141205 How To Create A Bootable Ubuntu USB Drive For Mac In OS X.md diff --git a/translated/tech/20141208 Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server.md b/published/201501/20141208 Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server.md similarity index 93% rename from translated/tech/20141208 Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server.md rename to published/201501/20141208 Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server.md index f9d13170de..200f28f0be 100644 --- a/translated/tech/20141208 Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server.md +++ b/published/201501/20141208 Install Jetty 9 (Java servlet engine and webserver) on Ubuntu 14.10 Server.md @@ -11,9 +11,9 @@ Jetty被广泛用于多种项目和产品,都可以在开发环境和生产环 - 灵活和可扩展 - 小足迹 - 可嵌入 -- 异步 +- 异步支持 - 企业弹性扩展 -- Apache和Eclipse双重许可 +- Apache和Eclipse双重许可证 ### ubuntu 14.10 server上安装Jetty 9 ### @@ -71,10 +71,9 @@ Java将会安装到/usr/lib/jvm/java-8-openjdk-i386,同时在该目录下会 #### ** ERROR: JETTY_HOME not set, you need to set it or install in a standard location #### -你需要确保在/etc/default/jetty文件中设置了正确的Jetty家目录路径, -你可以使用以下URL来测试jetty +你需要确保在/etc/default/jetty文件中设置了正确的Jetty家目录路径,你可以使用以下URL来测试jetty。 -Jetty现在应该运行在8085端口,打开浏览器并访问http://serverip:8085,你应该可以看到Jetty屏幕。 +Jetty现在应该运行在8085端口,打开浏览器并访问http://服务器IP:8085,你应该可以看到Jetty屏幕。 #### Jetty服务检查 #### @@ -96,7 +95,7 @@ via: http://www.ubuntugeek.com/install-jetty-9-java-servlet-engine-and-webserver 作者:[ruchi][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/20141208 Linux FAQs with Answers--How to disable Apport internal error reporting on Ubuntu.md b/published/201501/20141208 Linux FAQs with Answers--How to disable Apport internal error reporting on Ubuntu.md similarity index 100% rename from published/20141208 Linux FAQs with Answers--How to disable Apport internal error reporting on Ubuntu.md rename to published/201501/20141208 Linux FAQs with Answers--How to disable Apport internal error reporting on Ubuntu.md diff --git a/published/20141208 U.S. Marine Corps Wants to Change OS for Radar System from Windows XP to Linux.md b/published/201501/20141208 U.S. Marine Corps Wants to Change OS for Radar System from Windows XP to Linux.md similarity index 100% rename from published/20141208 U.S. Marine Corps Wants to Change OS for Radar System from Windows XP to Linux.md rename to published/201501/20141208 U.S. Marine Corps Wants to Change OS for Radar System from Windows XP to Linux.md diff --git a/translated/tech/20141210 How to use Evernote from the command line on Linux.md b/published/201501/20141210 How to use Evernote from the command line on Linux.md similarity index 61% rename from translated/tech/20141210 How to use Evernote from the command line on Linux.md rename to published/201501/20141210 How to use Evernote from the command line on Linux.md index a243e67fc4..e02e9db712 100644 --- a/translated/tech/20141210 How to use Evernote from the command line on Linux.md +++ b/published/201501/20141210 How to use Evernote from the command line on Linux.md @@ -1,10 +1,10 @@ 如何在Linux的命令行中使用Evernote ================================================================================ -这周让我们继续什么学习如个使用Linux命令行管理和组织信息。在命令行中管理[你的个人花费][1]后,我建议你在命令行中管理你的笔记,特别地是,当你笔记放在Evernote中时。为防止你从来没有听说过,[Evernote][2]专门有一个用户有好的在线服务用来在不同的设备间同步笔记。除了提供花哨的基于Web的API,Evernote还发布了在Windows、Mac、[Android][3]和iOS上的客户端。然而至今还没有官方的Linux客户端可用。老实说在众多的非官方Linux程序中,一个程序一出现就吸引了所有的命令行爱好者:[Geeknote][4] +这周让我们继续学习如何使用Linux命令行管理和组织信息。在命令行中管理[你的个人花费][1]后,我建议你在命令行中管理你的笔记,特别是当你用Evernote记录笔记时。要是你从来没有听说过它,[Evernote][2] 专门有一个用户友好的在线服务可以在不同的设备间同步笔记。除了提供花哨的基于Web的API,Evernote还发布了在Windows、Mac、[Android][3]和iOS上的客户端。然而至今还没有官方的Linux客户端可用。老实说在众多的非官方Linux客户端中,有一个程序一出现就吸引了所有的命令行爱好者,它就是[Geeknote][4]。 ### Geeknote 的安装 ### -Geeknote使用Python开发的。因此,在开始之前请确保你已经安装了Python(最好是2.7的版本)和git。 +Geeknote是使用Python开发的。因此,在开始之前请确保你已经安装了Python(最好是2.7的版本)和git。 #### 在 Debian、 Ubuntu 和 Linux Mint 中 #### @@ -26,38 +26,38 @@ Geeknote使用Python开发的。因此,在开始之前请确保你已经安装 ### Geeknote 的基本使用 ### -一旦你安装玩Geeknote后,你应该将Geeknote与你的Evernote账号关联: +一旦你安装完Geeknote后,你应该将Geeknote与你的Evernote账号关联: $ geeknote login -接着输入你的emial地址、密码、和你的二步验证码。如果你没有后者,忽略它并按下回车。 +接着输入你的email地址、密码和你的二步验证码。如果你没有后者的话,忽略它并按下回车。 ![](https://farm8.staticflickr.com/7525/15761947888_7bc71bf216_o.jpg) -很明显,你需要一个Evernote账号来完成这些,因此先去注册。 +显然你需要一个Evernote账号来完成这些,因此先去注册吧。 -一旦完成这一切之后,你就可以开始了,创建新的笔记并编辑它们。 +完成这些之后,你就可以开始创建新的笔记并编辑它们了。 -但是首先,你需要设置你最喜欢的文本编辑器: +不过首先,你还需要设置你最喜欢的文本编辑器: $ geeknote settings --editor vim -接着,常规创建一条新笔记的语法是: +然后,一般创建一条新笔记的语法是: $ geeknote create --title [title of the new note] (--content [content] --tags [comma-separated tags] --notebook [comma-separated notebooks]) -上面的命令中,只有‘title’是必须的,它会与一条新笔记的标题相关联。其他的标注可以为笔记添加额外的元数据:添加标签来与你的笔记关联、指定放在那个笔记本里。同样,如果你的标题或者内容还有空格,不要忘记将它们放在引号中。 +上面的命令中,只有‘title’是必须的,它会与一条新笔记的标题相关联。其他的标注可以为笔记添加额外的元数据:添加标签来与你的笔记关联、指定放在那个笔记本里。同样,如果你的标题或者内容中有空格,不要忘记将它们放在引号中。 比如: $ geeknote create --title "My note" --content "This is a test note" --tags "finance, business, important" --notebook "Family" -通常上,下一步就是编辑你的笔记。语法很相似: +然后,你可以编辑你的笔记。语法很相似: $ geeknote edit --note [title of the note to edit] (--title [new title] --tags [new tags] --notebook [new notebooks]) -注意可选的参数如标题、标签和笔记本,用来修改笔记的元数据。比如,你可以用下面的命令重命名笔记: +注意可选的参数如新的标题、标签和笔记本,用来修改笔记的元数据。你也可以用下面的命令重命名笔记: $ geeknote edit --note [old title] --title [new title] @@ -65,13 +65,13 @@ Geeknote使用Python开发的。因此,在开始之前请确保你已经安装 $ geeknote find --search [text-to-search] --tags [comma-separated tags] --notebook [comma-separated notebooks] --date [date-or-date-range] --content-search -默认上,上面的命令会通过标题搜索笔记。 用"--content-search"选项,就可以搜索它们的内容。 +默认地上面的命令会通过标题搜索笔记。 用"--content-search"选项,就可以按内容搜索。 比如: $ geeknote find --search "*restaurant" --notebooks "Family" --date 31.03.2014-31.08.2014 -显示制定标题的笔记: +显示指定标题的笔记: $ geeknote show [title] @@ -89,13 +89,13 @@ Geeknote使用Python开发的。因此,在开始之前请确保你已经安装 小心这是真正的删除。它会从云存储中删除这条笔记。 -最后有很多的选项来管理标签和笔记本。我想最有用的是显示笔记本列表。 +最后有很多的选项来管理标签和笔记本。我想最有用的就是显示笔记本列表。 $ geeknote notebook-list ![](https://farm8.staticflickr.com/7472/15762063420_43e3ee17da_o.jpg) -下面的非常相像。你可以猜到,可以用下面的命令列出所有的标签: +下面的命令非常相像。你可以猜到,可以用下面的命令列出所有的标签: $ geeknote tag-list @@ -107,27 +107,25 @@ Geeknote使用Python开发的。因此,在开始之前请确保你已经安装 $ geeknote tag-create --title [tag title] -一旦你了解了窍门,很明显语法是非常连贯且明确的。 +一旦你了解了窍门,很明显这些语法是非常自然明确的。 如果你想要了解更多,不要忘记查看[官方文档][6]。 ### 福利 ### -As a bonus, Geeknote comes with the utility gnsync, which allows for file synchronization between your Evernote account and your local computer. However, I find its syntax a bit dry: -福利的是,Geeknote自带的gnsync工具可以让你在Evernote和本地计算机之间同步。然而,我发现它的语法有点枯燥: +作为福利,Geeknote自带的gnsync工具可以让你在Evernote和本地计算机之间同步。不过,我发现它的语法有点枯燥: $ gnsync --path [where to sync] (--mask [what kind of file to sync] --format [in which format] --logpath [where to write the log] --notebook [which notebook to use]) -下面是这些的意义。 - +下面是这些参数的意义。 - **--path /home/adrien/Documents/notes/**: 与Evernote同步笔记的位置。 -- **--mask "*.txt"**: 只同步纯文本文件。默认上,gnsync会尝试同步所有文件。 +- **--mask "*.txt"**: 只同步纯文本文件。默认gnsync会尝试同步所有文件。 - **--format markdown**: 你希望它们是纯文本或者markdown格式(默认是纯文本)。 - **--logpath /home/adrien/gnsync.log**: 同步日志的位置。为防出错,gnsync会在那里写入日志信息。 -- **--notebook "Family"**: 同步哪个笔记本中的笔记。如果你那里留空,程序会创建一个以你同步文件夹命令的笔记本。 +- **--notebook "Family"**: 同步哪个笔记本中的笔记。如果留空,程序会创建一个以你同步文件夹命令的笔记本。 -总结来说,Geeknote是一款花哨的Evernote的命令行客户端。我个人不常使用Evernote,但它仍然很漂亮和有用。命令行一方面让它变得很极客且很容易与shell脚本结合。同样,还有Git上fork出来的Geeknote,在ArchLinux AUR上称为[geeknote-improved-git][7],貌似它有更多的特性和比其他分支更积极的开发。但在我看来,还很值得再看看。 +总的来说,Geeknote是一款漂亮的Evernote的命令行客户端。我个人不常使用Evernote,但它仍然很漂亮和有用。命令行一方面让它变得很极客且很容易与shell脚本结合。此外,在Git上还有Geeknote的一个分支项目,在ArchLinux AUR上称为[geeknote-improved-git][7],貌似它有更多的特性和比其他分支更积极的开发。我觉得值得去看看。 你认为Geeknote怎么样? 有什么你想用的么?或者你更喜欢使用传统的程序?在评论区中让我们知道。 @@ -137,7 +135,7 @@ via: http://xmodulo.com/evernote-command-line-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/published/20141211 NetHack.md b/published/201501/20141211 NetHack.md similarity index 100% rename from published/20141211 NetHack.md rename to published/201501/20141211 NetHack.md diff --git a/published/20141211 Yes, This Trojan Infects Linux. No, It' s Not The Tuxpocalypse.md b/published/201501/20141211 Yes, This Trojan Infects Linux. No, It' s Not The Tuxpocalypse.md similarity index 100% rename from published/20141211 Yes, This Trojan Infects Linux. No, It' s Not The Tuxpocalypse.md rename to published/201501/20141211 Yes, This Trojan Infects Linux. No, It' s Not The Tuxpocalypse.md diff --git a/translated/tech/20141222 A Great Tool To Show Linux Command Progress Like ETA.md b/published/201501/20141222 A Great Tool To Show Linux Command Progress Like ETA.md similarity index 67% rename from translated/tech/20141222 A Great Tool To Show Linux Command Progress Like ETA.md rename to published/201501/20141222 A Great Tool To Show Linux Command Progress Like ETA.md index 084a2b2858..e51bd26b4f 100644 --- a/translated/tech/20141222 A Great Tool To Show Linux Command Progress Like ETA.md +++ b/published/201501/20141222 A Great Tool To Show Linux Command Progress Like ETA.md @@ -1,12 +1,12 @@ -一个用%显示Linux命令进度预计完成时间的伟大工具 +一个可以显示Linux命令运行进度的伟大工具 ================================================================================ -Coreutils Viewer(**cv**)是一个简单的程序,它可以用于显示任何核心组件命令的进度。它使用文件描述信息来确定一个命令的进度,比如cp命令。**cv**之美在于,它能够和其它Linux命令一起使用,比如你所知道的watch以及I/O重定向命令。这样,你就可以在脚本中使用,或者你能想到的所有方式,别让你的想象力束缚住你。 +Coreutils Viewer(**cv**)是一个简单的程序,它可以用于显示任何核心组件命令(如:cp、mv、dd、tar、gzip、gunzip、cat、grep、fgrep、egrep、cut、sort、xz、exiting)的进度。它使用文件描述信息来确定一个命令的进度,比如cp命令。**cv**之美在于,它能够和其它Linux命令一起使用,比如你所知道的watch以及I/O重定向命令。这样,你就可以在脚本中使用,或者你能想到的所有方式,别让你的想象力束缚住你。 ### 安装 ### 你可以从cv的[github仓库那儿][1]下载所需的源文件。把zip文件下载下来后,将它解压缩,然后进入到解压后的文件夹。 -该程序依赖于**ncurses library**。如果你已经在你的Linux系统中安装了ncurses,那么cv的安装过程对你而言就是那么得轻松写意。 +该程序需要**ncurses library**。如果你已经在你的Linux系统中安装了ncurses,那么cv的安装过程对你而言就是那么的轻松写意。 通过以下两个简单步骤来进行编译和安装吧。 @@ -23,20 +23,21 @@ Coreutils Viewer(**cv**)是一个简单的程序,它可以用于显示任 $ cv -如果没有核心组件命令在运行,那么cv程序会退出,并告诉你:No coreutils is running。 +如果没有核心组件命令在运行,那么cv程序会退出,并告诉你:没有核心组件命令在运行。 ![cv no command](http://blog.linoxide.com/wp-content/uploads/2014/11/cv-no-command.png) 要有效使用该程序,请在你系统上运行某个核心组件程序。在本例中,我们将使用**cp**命令。 -当拷贝一个打文件时,你就可以看到进度了,以百分比显示。 +当拷贝一个打文件时,你就可以看到当前进度了,以百分比显示。 ![cv default](http://blog.linoxide.com/wp-content/uploads/2014/11/cv-default.png) -### 添加选项到cv ### +### 添加选项到 cv ### 你也可以添加几个选项到cv命令,就像其它命令一样。一个有用的选项是让你了解到拷贝或移动大文件时的预计剩余时间。 -添加**-w**选项,它会帮你做以上这些事。 + +添加**-w**选项,它就会帮你显示预计的剩余时间。 $ cv -w @@ -46,9 +47,9 @@ Coreutils Viewer(**cv**)是一个简单的程序,它可以用于显示任 $ cv -wq -### cv和watch命令 ### +### cv 和 watch 命令 ### -watch是一个用于周期性运行程序并显示输出结果的程序。有时候,你可能想要看看命令运行期间的状况而不想存储数据到日志文件中。在这种情况下,watch就会派上用场了,它可以和cv一起使用。 +watch是一个用于周期性运行程序并显示输出结果的程序。有时候,你可能想要持续看看命令运行状况而不想将 cv 的结果存储到日志文件中。在这种情况下,watch就会派上用场了,它可以和cv一起使用。 $ watch cv -qw @@ -58,7 +59,7 @@ watch是一个用于周期性运行程序并显示输出结果的程序。有时 ### 在日志文件中查看输出结果 ### -正如所承诺的那样,你可以使用cv来重定向它的输出结果到一个日志文件。这功能在命令运行太快而看不到任何有意义的内容时特别有用。 +正如其所承诺的那样,你可以使用cv来重定向它的输出结果到一个日志文件。这功能在命令运行太快而看不到任何有意义的内容时特别有用。 要在日志文件中查看进度,你仅仅需要重定向输出结果,就像下面这样。 @@ -81,7 +82,7 @@ watch是一个用于周期性运行程序并显示输出结果的程序。有时 但是,要获取上述手册页,你必须执行make install来安装cv。 -耶!现在,你的Linux工具箱中又多了个伟大的工具。 +耶!现在,你的Linux工具箱中又多了个伟大的工具。 你学会么?亲自去试试吧~ -------------------------------------------------------------------------------- @@ -89,7 +90,7 @@ via: http://linoxide.com/linux-command/tool-show-command-progress/ 作者:[Allan Mbugua][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/20141222 How to Sync Time Properly with NTP Server in CentOS 7.x.md b/published/201501/20141222 How to Sync Time Properly with NTP Server in CentOS 7.x.md similarity index 70% rename from translated/tech/20141222 How to Sync Time Properly with NTP Server in CentOS 7.x.md rename to published/201501/20141222 How to Sync Time Properly with NTP Server in CentOS 7.x.md index 80a8237b6d..d8bfbd7c49 100644 --- a/translated/tech/20141222 How to Sync Time Properly with NTP Server in CentOS 7.x.md +++ b/published/201501/20141222 How to Sync Time Properly with NTP Server in CentOS 7.x.md @@ -1,6 +1,6 @@ CentOS 7.x中正确设置时间与时钟服务器同步 ================================================================================ -**Chrony**是一个开源而自由的应用,它能帮助你保持系统时钟与时钟服务器同步,因此让你的时间保持精确。它由两个程序组成,分别是chronyd和chronyc。chronyd是一个后台运行的守护进程,用于调整内核中运行的系统时钟和时钟服务器同步。它确定计算机获取或丢失时间的比率,并对此进行补偿。chronyc提供了一个用户界面,用于监控性能并进行多样化的配置。它可以在chronyd实例控制的计算机上干这些事,也可以在一台不同的远程计算机上干这些事。 +**Chrony**是一个开源的自由软件,它能帮助你保持系统时钟与时钟服务器(NTP)同步,因此让你的时间保持精确。它由两个程序组成,分别是chronyd和chronyc。chronyd是一个后台运行的守护进程,用于调整内核中运行的系统时钟和时钟服务器同步。它确定计算机增减时间的比率,并对此进行补偿。chronyc提供了一个用户界面,用于监控性能并进行多样化的配置。它可以在chronyd实例控制的计算机上工作,也可以在一台不同的远程计算机上工作。 在像CentOS 7之类基于RHEL的操作系统上,已经默认安装有Chrony。 @@ -10,19 +10,17 @@ CentOS 7.x中正确设置时间与时钟服务器同步 **server** - 该参数可以多次用于添加时钟服务器,必须以"server "格式使用。一般而言,你想添加多少服务器,就可以添加多少服务器。 - Example: server 0.centos.pool.ntp.org server 3.europe.pool.ntp.org -**stratumweight** - stratumweight指令设置当chronyd从可用源中选择同步源时,每个层应该添加多少距离到同步距离。默认情况下,CentOS中设置为0,让chronyd在选择源时忽略层。 +**stratumweight** - stratumweight指令设置当chronyd从可用源中选择同步源时,每个层应该添加多少距离到同步距离。默认情况下,CentOS中设置为0,让chronyd在选择源时忽略源的层级。 -**driftfile** - chronyd程序的主要行为之一,就是根据实际时间计算出计算机获取或丢失时间的比率,将它记录到一个文件中是最合理的,它会在重启后为系统时钟作出补偿,甚至它可能有机会从时钟服务器获得好的估值。 +**driftfile** - chronyd程序的主要行为之一,就是根据实际时间计算出计算机增减时间的比率,将它记录到一个文件中是最合理的,它会在重启后为系统时钟作出补偿,甚至可能的话,会从时钟服务器获得较好的估值。 **rtcsync** - rtcsync指令将启用一个内核模式,在该模式中,系统时间每11分钟会拷贝到实时时钟(RTC)。 **allow / deny** - 这里你可以指定一台主机、子网,或者网络以允许或拒绝NTP连接到扮演时钟服务器的机器。 - Examples: allow 192.168.4.5 deny 192.168/16 @@ -30,11 +28,10 @@ CentOS 7.x中正确设置时间与时钟服务器同步 **bindcmdaddress** - 该指令允许你限制chronyd监听哪个网络接口的命令包(由chronyc执行)。该指令通过cmddeny机制提供了一个除上述限制以外可用的额外的访问控制等级。 - Example: bindcmdaddress 127.0.0.1 bindcmdaddress ::1 -**makestep** - 通常,chronyd将根据需求通过减慢或加速时钟,使得系统逐步纠正所有时间偏差。在某些特定情况下,系统时钟可能会漂移过快,导致该回转过程消耗很长的时间来纠正系统时钟。该指令强制chronyd在调整期大于某个阀值时调停系统时钟,但只有在因为chronyd启动时间超过指定限制(可使用负值来禁用限制),没有更多时钟更新时才生效。 +**makestep** - 通常,chronyd将根据需求通过减慢或加速时钟,使得系统逐步纠正所有时间偏差。在某些特定情况下,系统时钟可能会漂移过快,导致该调整过程消耗很长的时间来纠正系统时钟。该指令强制chronyd在调整期大于某个阀值时步进调整系统时钟,但只有在因为chronyd启动时间超过指定限制(可使用负值来禁用限制),没有更多时钟更新时才生效。 ### 使用chronyc ### @@ -66,7 +63,7 @@ via: http://linoxide.com/linux-command/chrony-time-sync/ 作者:[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/published/20141224 Calife--A lightweight alternative to sudo.md b/published/201501/20141224 Calife--A lightweight alternative to sudo.md similarity index 100% rename from published/20141224 Calife--A lightweight alternative to sudo.md rename to published/201501/20141224 Calife--A lightweight alternative to sudo.md diff --git a/published/20141224 Linux FAQs with Answers--How to check SSH protocol version on Linux.md b/published/201501/20141224 Linux FAQs with Answers--How to check SSH protocol version on Linux.md similarity index 100% rename from published/20141224 Linux FAQs with Answers--How to check SSH protocol version on Linux.md rename to published/201501/20141224 Linux FAQs with Answers--How to check SSH protocol version on Linux.md diff --git a/published/20141224 Linux FAQs with Answers--How to install 7zip on Linux.md b/published/201501/20141224 Linux FAQs with Answers--How to install 7zip on Linux.md similarity index 100% rename from published/20141224 Linux FAQs with Answers--How to install 7zip on Linux.md rename to published/201501/20141224 Linux FAQs with Answers--How to install 7zip on Linux.md diff --git a/published/20141224 Linux FAQs with Answers--How to install kernel headers on Linux.md b/published/201501/20141224 Linux FAQs with Answers--How to install kernel headers on Linux.md similarity index 100% rename from published/20141224 Linux FAQs with Answers--How to install kernel headers on Linux.md rename to published/201501/20141224 Linux FAQs with Answers--How to install kernel headers on Linux.md diff --git a/published/20141226 The Good The Bad And The Ugly Of Linux In 2014.md b/published/201501/20141226 The Good The Bad And The Ugly Of Linux In 2014.md similarity index 100% rename from published/20141226 The Good The Bad And The Ugly Of Linux In 2014.md rename to published/201501/20141226 The Good The Bad And The Ugly Of Linux In 2014.md diff --git a/published/20141229 2 Ways To Fix The UEFI Bootloader When Dual Booting Windows And Ubuntu.md b/published/201501/20141229 2 Ways To Fix The UEFI Bootloader When Dual Booting Windows And Ubuntu.md similarity index 100% rename from published/20141229 2 Ways To Fix The UEFI Bootloader When Dual Booting Windows And Ubuntu.md rename to published/201501/20141229 2 Ways To Fix The UEFI Bootloader When Dual Booting Windows And Ubuntu.md diff --git a/published/20141229 How to Install Bugzilla 4.4 on Ubuntu or CentOS 6.x.md b/published/201501/20141229 How to Install Bugzilla 4.4 on Ubuntu or CentOS 6.x.md similarity index 100% rename from published/20141229 How to Install Bugzilla 4.4 on Ubuntu or CentOS 6.x.md rename to published/201501/20141229 How to Install Bugzilla 4.4 on Ubuntu or CentOS 6.x.md diff --git a/published/20150104 Docker Image Insecurity.md b/published/201501/20150104 Docker Image Insecurity.md similarity index 100% rename from published/20150104 Docker Image Insecurity.md rename to published/201501/20150104 Docker Image Insecurity.md diff --git a/published/201501/20150106 2015--Open Source Has Won, But It Isn't Finished.md b/published/201501/20150106 2015--Open Source Has Won, But It Isn't Finished.md new file mode 100644 index 0000000000..fd8be296cf --- /dev/null +++ b/published/201501/20150106 2015--Open Source Has Won, But It Isn't Finished.md @@ -0,0 +1,47 @@ +2015:开源已经完胜,但这并不是结束 +================================================================================ +> 在 2014 年的完胜后,接下来会如何? + +新年伊始,习惯上都是回顾已经走过的一年。但只要一直关注我们,就会很容易获得过去一年的总结:开源已经全胜。让我们从头开始说起吧: + +**超级计算机**: Linux 在超级计算机系统 500 强的名单上占据绝对的主导地位这本身就令其它操作系统很尴尬。[2014年11月的数据][1]显示前500系统中的485个系统都在运行着 Linux 的发布系统,而仅仅只有一台运行着 Windows 系统。如果您看看所用的处理器数量,这数据更是让人惊叹。截止到目前,运行 Linux 系统的处理器有 22,851,693 个之多,而 windows 系统仅仅只有 30,720。这意味着什么?Linux 不仅仅是占据主导地位,在大型系统中已经是绝对的霸主了。 + +**云计算**: 去年, Linux 基金会撰写了一个有趣的[报告][2],是关于大公司在云端使用 Linux 的情况的。它发现 75% 的大公司在使用 Linux 系统作为他们的主要平台,相对的使用 Windows 系统的只占 23%。因为需要考虑云端和非云端的因素,它们已经混淆在一起了,所以很难把这比例对应到真实的市场份额里。但是,鉴于当前云计算的流行度,可以很确定的说明 Linux 使用的高速增长。事实上,同样的调查发现,在云端的 Linux 部署率已经从 45% 增长到 79%,而对于 Windows 来说已经从 45% 下降到 36%。当然了,某些人可能认为 Linux 基金会在这块上并不是完全公正无私的,但即使是有私心或是因统计的不确定性而有失公允,事情也正朝着预料的正确方向迈进。 + +**Web 服务器**: 开源已经统治这个行业近20年 - 取得了一份很惊人的成绩。然而,最近在市场份额上出现了一些有趣的变动:一点就是,在 Web 服务器的总计数上,微软的 IIS 服务已经超越了 Apache 服务。但正如 Netcraft 公司其最近的[分析][3]解释所说的那样,这儿还有很多令人大饱眼福的地方呢: + +> 这是网站总数持续大幅回落以来的第二个月,从一月份以来,本月达到了最低点。与十一月份情况一样,损失的仅仅只是集中在一小部分的主机提供商中,只占了5200万主机名数的十大点。这点损失相比于激活的站点和网站来说不是一个数据级的,所以造不成什么影响,但激活的这些站点大部分都是广告类的链接页面池,基本上没有原创的内容。大多数这些站点都是运行在微软的 IIS 服务器上的,所以在2014年7月份的调查中 IIS 的使用数就超过了 Apache。然而,近期跌势已导致其市场份额下降到 29.8%,现在已经低于Apache 10个百分点了。 + +这表明,微软的所谓“激增”更多的是表象,而事实并非如此,它的大多数增加都是基于没什么有用内容的链接页面池。事实上,Netcraft公司的关于活动网站的数据给我们描绘了一幅完全不同的图表:Apache 拥有 50.57% 的市场份额,nginx 的是 14.73% 位居第二;微软的 IIS 很无力,占到了相当微弱的 11.72%。这意味着在活跃 Web 服务器市场上开源大约有65%的份额 - 虽然没有超级计算机那么高的水平,但也还不错。 + +**移动设备系统**. 目前,开源的大军主要是 Andriod 为基础在不断高歌猛进。最新数据表明,在2014年第三季度的智能手机出货量中,Andriod 设备的市场份额从去年同期的 81.4% 上升到了 [83.6%][4]。苹果的从去年同期的 13.4% 下降到 12.3%。对于平板电脑来说,Android 平板遵循同样的轨迹:在2014年第二季度,Android 平板的占有率达到[全球平板电脑的销量的75%][5]左右,而苹果的只有25%。 + +**嵌入式系统**: 虽然很难量化 Linux 在的重要的嵌入式系统市场的市场份额,但来一个自 2013 年的研究数字表明,[按规划,大约一半的嵌入式系统][6]将会采用 Linux。 + +**物联网**: 在很多方面上可以把它们简单的认为是嵌入式系统的另外一个化身,不同之处在于它们被设计为一直在线的。虽然现在谈论它的市场份额还有点为时过早,但如我在[讨论栏目][7]里说的,AllSeen 的物联网开源框架正进行的如火如荼。他们所缺少的也最引入注目的事情只是还没有任何可信任的闭源项目对手。因此,很有可能物联网将会通过开源的方式来达到 Linux 在超级计算机中的占有率这样的水平。 + +当然了,这个阶段的成功也带来了一些问题:我们将何去何从?鉴于开源将会使很多成功的行业达到饱和点,想必唯一的办法就是下跌吗?要回答这个问题,我建议浏览下 Christopher Kelty 于2013年写的一篇供同行参阅、发人深省的文章,有个耐人寻味的标题“[天下没有免费的软件][8]”。下面是他的开头段: + +> 自由软件并不存在。在我写了一整本书后,我莫名的忧伤。但这也是我写进文章的一个观点。自由软件和与它一体两面的开源正在不断的变化着。它并不是一直持续不变的,不稳定、不固定、不持久,这正是它的特色的一部分。 + +换句话说,无论2014年带给我们多少惊人的免费软件,我们也确信2015年会更多更丰富,因为进化是永无止境的。 + +-------------------------------------------------------------------------------- + +via: http://www.computerworlduk.com/blogs/open-enterprise/open-source-has-won-3592314/ + +作者:[lyn Moody][a] +译者:[runningwater](https://github.com/runningwater) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.computerworlduk.com/author/glyn-moody/ +[1]:http://www.top500.org/statistics/list/ +[2]:http://www.linuxfoundation.org/publications/linux-foundation/linux-end-user-trends-report-2014 +[3]:http://news.netcraft.com/archives/2014/12/18/december-2014-web-server-survey.html +[4]:http://www.cnet.com/news/android-stays-unbeatable-in-smartphone-market-for-now/ +[5]:http://timesofindia.indiatimes.com/tech/tech-news/Android-tablet-market-share-hits-70-in-Q2-iPads-slip-to-25-Survey/articleshow/38966512.cms +[6]:http://linuxgizmos.com/embedded-developers-prefer-linux-love-android/ +[7]:http://www.computerworlduk.com/blogs/open-enterprise/allseen-3591023/ +[8]:http://peerproduction.net/issues/issue-3-free-software-epistemics/debate/there-is-no-free-software/ diff --git a/translated/tech/20150106 How To Install New Fonts In Ubuntu 14.04 and 14.10.md b/published/201501/20150106 How To Install New Fonts In Ubuntu 14.04 and 14.10.md similarity index 52% rename from translated/tech/20150106 How To Install New Fonts In Ubuntu 14.04 and 14.10.md rename to published/201501/20150106 How To Install New Fonts In Ubuntu 14.04 and 14.10.md index fd108461d2..6838ea7df4 100644 --- a/translated/tech/20150106 How To Install New Fonts In Ubuntu 14.04 and 14.10.md +++ b/published/201501/20150106 How To Install New Fonts In Ubuntu 14.04 and 14.10.md @@ -2,20 +2,19 @@ ================================================================================ ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/fonts.jpg) -Ubuntu默认自带了很多字体。但你或许对这些字体还不满意。因此,你可以做的是在**Ubuntu 14.04、 14.10或者像Linux Mint其他的系统中安装额外的字体**。 +Ubuntu默认自带了很多字体。但有时候你或许对这些字体还不满意。因此,你可以做的是在**Ubuntu 14.04、 14.10或者像Linux Mint之类的其它Linux系统中安装额外的字体**。 ### 第一步: 获取字体 ### -第一步也是最重要的,下载你选择的字体。现在你或许在考虑从哪里下载字体。不要担心,Google搜索可以给你提供几个免费的字体网站。你可以先去看看[ Lost Type 的字体][1]。[Squirrel的字体][2]同样也是一个下载字体的好地方。 +第一步也是最重要的一步,下载你选择的字体。现在你或许在考虑从哪里下载字体。不要担心,Google搜索可以给你提供几个免费的字体网站。你可以先去看看[ Lost Type 的字体][1]。[Squirrel][2]同样也是一个下载字体的好地方。 ### 第二步:在Ubuntu中安装新字体 ### -Font Viewer. In here, you can see the option to install the font in top right corner: -下载的字体文件可能是一个压缩包。先解压它。大多数字体文件的格式是[TTF][3] (TrueType Fonts) 或者[OTF][4] (OpenType Fonts)。无论是哪种,只要双击字体文件。它会自动用字体查看器打开。这里你可以在右上角看到安装安装选项。 +下载的字体文件可能是一个压缩包,先解压它。大多数字体文件的格式是[TTF][3] (TrueType字体) 或者[OTF][4] (OpenType字体)。无论是哪种,只要双击字体文件。它会自动用字体查看器打开。这里你可以在右上角看到安装选项。 ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Install_New_Fonts_Ubuntu.png) -在安装字体时不会看到其他信息。几秒钟后,你会看到状态变成已安装。不用猜,这就是已安装的字体。 +在安装字体时不会看到其他信息。几秒钟后,你会看到状态变成已安装。不用猜,字体已经安装完毕。 ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Install_New_Fonts_Ubuntu_1.png) @@ -23,20 +22,20 @@ Font Viewer. In here, you can see the option to install the font in top right co ### 第二步:在Linux上一次安装几个字体 ### -我没有打错。这仍旧是第二步但是只是是一个备选方案。我上面看到的在Ubuntu中安装字体的方法是不错的。但是这有一个小问题。当你有20个新字体要安装时。一个个单独双击即繁琐又麻烦。你不这么认为么? +我没有打错。这仍旧是第二步但是只是一个备选方案。我们上面看到的在Ubuntu中安装字体的方法是不错的。但是这有一个小问题。当你有20个新字体要安装时。一个个单独双击即繁琐又麻烦。你不这么认为么? -要在Ubuntu中一次安装几个字体,你要做的是创建一个.fonts文件夹,如果在你的家目录下还不存在这个目录的话。并把解压后的TTF和OTF文件复制到这个文件夹内。 +要在Ubuntu中一次安装几个字体,你唯一要做的是在你的家目录下创建一个.fonts文件夹,如果它不存在的话。并把解压后的TTF和OTF文件复制到这个文件夹内。 在文件管理器中进入家目录。按下Ctrl+H [显示Ubuntu中的隐藏文件][5]。 右键创建一个文件夹并命名为.fonts。 这里的点很重要。在Linux中,在文件的前面加上点意味在普通的视图中都会隐藏。 #### 备选方案: #### -另外你可以安装字体管理程序来以GUI的形式管理字体。要在Ubuntu中安装字体管理程序,打开终端并输入下面的命令: +另外你可以安装字体管理程序,在图形用户界面管理字体。要在Ubuntu中安装字体管理程序,打开终端并输入下面的命令: sudo apt-get install font-manager -Open the Font Manager from Unity Dash. You can see installed fonts and option to install new fonts, remove existing fonts etc here. -从Unity Dash中打开字体管理器。你可以看到已安装的字体和安装新字体、删除字体等选项。 + +从Unity Dash中打开字体管理器。在这里你可以看到已安装的字体和安装新字体、删除字体等选项。 ![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Font_Manager_Ubuntu.jpeg) @@ -44,7 +43,7 @@ Open the Font Manager from Unity Dash. You can see installed fonts and option to sudo apt-get remove font-manager -我希望这篇文章可以帮助你在Ubuntu或其他Linux系统上安装字体。如果你有任何问题或建议请让我知道。 +我希望这篇文章可以帮助你在Ubuntu或其它Linux系统上安装字体。如果你有任何问题或建议请在下方评论中告诉我。 -------------------------------------------------------------------------------- @@ -52,7 +51,7 @@ via: http://itsfoss.com/install-fonts-ubuntu-1404-1410/ 作者:[Abhishek][a] 译者:[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/) 荣誉推出 @@ -61,4 +60,4 @@ via: http://itsfoss.com/install-fonts-ubuntu-1404-1410/ [2]:http://www.fontsquirrel.com/ [3]:http://en.wikipedia.org/wiki/TrueType [4]:http://en.wikipedia.org/wiki/OpenType -[5]:http://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ \ No newline at end of file +[5]:http://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ diff --git a/published/201501/20150121 Linux FAQs with Answers--How to boot into command line on Ubuntu or Debian.md b/published/201501/20150121 Linux FAQs with Answers--How to boot into command line on Ubuntu or Debian.md new file mode 100644 index 0000000000..93bca3583c --- /dev/null +++ b/published/201501/20150121 Linux FAQs with Answers--How to boot into command line on Ubuntu or Debian.md @@ -0,0 +1,64 @@ +Linux 有问必答:如何在Ubuntu或者Debian中启动后进入命令行 +================================================================================ +> **提问**:我运行的是Ubuntu桌面,但是我希望启动后临时进入命令行。有什么简便的方法可以启动进入终端? + +Linux桌面自带了一个显示管理器(比如:GDM、KDM、LightDM),它们可以让计算机启动自动进入一个基于GUI的登录环境。然而,如果你要直接启动进入终端怎么办? 比如,你在排查桌面相关的问题或者想要运行一个不需要GUI的应用程序。 + +注意虽然你可以通过按下Ctrl+Alt+F1到F6临时从桌面GUI切换到虚拟终端。然而,在这种情况下你的桌面GUI仍在后台运行,这不同于纯文本模式启动。 + +在Ubuntu或者Debian桌面中,你可以通过传递合适的内核参数在启动时启动文本模式。 + +### 启动临时进入命令行 ### + +如果你想要禁止桌面GUI并临时进入一次文本模式,你可以使用GRUB菜单。 + +首先,打开你的电脑。当你看到初始的GRUB菜单时,按下‘e’。 + +![](https://farm8.staticflickr.com/7490/16112246542_bc1875a397_z.jpg) + +接着会进入下一屏,这里你可以修改内核启动选项。向下滚动到以“linux”开始的行,这里就是内核参数的列表。删除参数列表中的“quiet”和“splash”。在参数列表中添加“text”。 + +![](https://farm8.staticflickr.com/7471/15493282603_8a70f70af2_z.jpg) + +升级的内核选项列表看上去像这样。按下Ctrl+x继续启动。这会以详细模式启动控制台一次(LCTT译注:由于没有保存修改,所以下次重启还会进入 GUI)。 + +![](https://farm8.staticflickr.com/7570/15925676530_b11af59243_z.jpg) + +### 永久启动进入命令行 ### + +如果你想要永久启动进入命令行,你需要[更新定义了内核启动参数GRUB设置][1]。 + +在文本编辑器中打开默认的GRUB配置文件。 + + $ sudo vi /etc/default/grub + +查找以GRUB\_CMDLINE\_LINUX\_DEFAULT开头的行,并用“#”注释这行。这会禁止初始屏幕,而启动详细模式(也就是说显示详细的的启动过程)。 + +更改GRUB_CMDLINE_LINUX="" 成: + + GRUB_CMDLINE_LINUX="text" + +接下来取消“#GRUB_TERMINAL=console”的注释。 + +更新后的GRUB配置看上去像下面这样。 + +![](https://farm9.staticflickr.com/8673/16107564442_9345d94491_b.jpg) + +最后,使用update-grub命令来基于这些更改重新生成/boot下的GRUB2配置文件。 + + $ sudo update-grub + +这时,你的桌面应该可以从GUI启动切换到控制台启动了。可以通过重启验证。 + +![](https://farm8.staticflickr.com/7518/16106378151_81ac6b5a49_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/boot-into-command-line-ubuntu-debian.html + +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://xmodulo.com/add-kernel-boot-parameters-via-grub-linux.html \ No newline at end of file diff --git a/published/201501/20150126 Data of 20 Million Users Stolen from Dating Website.md b/published/201501/20150126 Data of 20 Million Users Stolen from Dating Website.md new file mode 100644 index 0000000000..2fd4acc06d --- /dev/null +++ b/published/201501/20150126 Data of 20 Million Users Stolen from Dating Website.md @@ -0,0 +1,50 @@ +交友网站的2000万用户数据遭泄露 +---------- +*泄露数据包括Gmail、Hotmail以及Yahoo邮箱* + +![泄露的数据很可能来自于在线交友网站Topface](http://i1-news.softpedia-static.com/images/news2/Data-of-20-Million-Users-Stolen-from-Dating-Website-471179-2.jpg) + +#一名黑客非法窃取了在线交友网站Topface一个包含2000万用户资料的数据库。 + +目前并不清楚这些数据是否已经公开,但是根据某些未公开页面的消息说,某个网名为“Mastermind”的人声称掌握着这些数据。 + +#泄露数据列表涵盖了全世界数百个域名 + +此人号称泄露数据的内容100%真实有效,而Easy Solutions的CTO,Daniel Ingevaldson 周日在一篇博客中说道,泄露数据包括Hotmail、Yahoo和Gmail等邮箱地址。 + +Easy Solutions是一家位于美国的公司,提供多个不同平台的网络检测与安全防护产品。 + +据Ingevaldson所说,泄露的数据中,700万来自于Hotmail,250万来自于Yahoo,220万来自于Gmail.com。 + +我们并不清楚这些数据是可以直接登录邮箱账户的用户名和密码,还是登录交友网站的账户。另外,也不清楚这些数据在数据库中是加密状态还是明文存在的。 + +邮箱地址常常被用于在线网站的登录用户名,用户可以凭借唯一密码进行登录。然而重复使用同一个密码是许多用户的常用作法,同一个密码可以登录许多在线账户。 + +[Ingevaldson 还说](1):“看起来,这些数据事实上涵盖了全世界数百个域名。除了原始被黑的网页,黑客和不法分子很可能利用窃取的帐密进行暴库、自动扫描、危害包括银行业、旅游业以及email提供商在内的多个网站。” + +#预计将披露更多信息 + +据我们的多个消息源爆料,数据的泄露源就是Topface,一个包含9000万用户的在线交友网站。其总部位于俄罗斯圣彼得堡,超过50%的用户来自于俄罗斯以外的国家。 + +我们联系了Topface,向他们求证最近是否遭受了可能导致如此大量数据泄露的网络攻击;但目前我们仍未收到该公司的回复。 + +攻击者可能无需获得非法访问权限就窃取了这些数据,Easy Solutions 推测攻击者很可能针对网站客户端使用钓鱼邮件直接获取到了用户数据。 + +我们无法通过Easy Solutions的在线网站联系到他们,但我们已经尝试了其他交互通讯方式,目前正在等待更多信息的披露。 + +-------------------------------------------------------------------------------- + +via:http://news.softpedia.com/news/Data-of-20-Million-Users-Stolen-from-Dating-Website-471179.shtml + +本文发布时间:26 Jan 2015, 10:20 GMT + +作者:[Ionut Ilascu][a] + +译者:[Mr小眼儿](https://github.com/tinyeyeser) + +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://news.softpedia.com/editors/browse/ionut-ilascu +[1]:http://newblog.easysol.net/dating-site-breached/ diff --git a/translated/tech/How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS.md b/published/201501/How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS.md similarity index 61% rename from translated/tech/How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS.md rename to published/201501/How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS.md index 0df194fe17..c151adf6b1 100644 --- a/translated/tech/How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS.md +++ b/published/201501/How to Setup Bind Chroot DNS Server on CentOS 7.0 VPS.md @@ -1,47 +1,49 @@ -在CentOS7.0 VPS上搭建 Bind Chroot DNS 服务器 +在 CentOS7.0 上搭建 Chroot 的 Bind DNS 服务器 ==================== -BIND(Berkeley internet Name Daemon)也叫做NAMED是现今互联网上使用最为广泛的DNS 服务器程序。这篇文章将要讲述如何在 chroot jail (chroot “监牢”,所谓“监牢”就是指通过chroot机制来更改某个进程所能看到的根目录,即将某进程限制在指定目录中,保证该进程只能对该目录及其子目录的文件有所动作,从而保证整个服务器的安全)中运行 BIND,这样它就无法访问文件系统中除“jail”以外的其它部分。例如,在这篇文章中,我会将BIND的运行根目录改为/var/named/chroot/。当然,对于BIND来说,这个目录就是/(根目录)。 “jail”(监牢,下同)是一个软件机制,其功能是使得某个程序无法访问规定区域之外的资源,同样也为了增强安全性。Bind Chroot DNS 服务器的默认“jail”为/var/named/chroot。你可以按照下列步骤,在CentOS 7.0 虚拟专用服务器(VPS)上部署 Bind Chroot DNS 服务器。 +BIND(Berkeley internet Name Daemon)也叫做NAMED,是现今互联网上使用最为广泛的DNS 服务器程序。这篇文章将要讲述如何在 chroot 监牢中运行 BIND,这样它就无法访问文件系统中除“监牢”以外的其它部分。 - 1. 安装Bind Chroot DNS 服务器: +例如,在这篇文章中,我会将BIND的运行根目录改为 /var/named/chroot/。当然,对于BIND来说,这个目录就是 /(根目录)。 “jail”(监牢,下同)是一个软件机制,其功能是使得某个程序无法访问规定区域之外的资源,同样也为了增强安全性(LCTT 译注:chroot “监牢”,所谓“监牢”就是指通过chroot机制来更改某个进程所能看到的根目录,即将某进程限制在指定目录中,保证该进程只能对该目录及其子目录的文件进行操作,从而保证整个服务器的安全)。Bind Chroot DNS 服务器的默认“监牢”为 /var/named/chroot。你可以按照下列步骤,在CentOS 7.0 上部署 Bind Chroot DNS 服务器。 - [root@centos7 ~]# yum install bind-chroot bind -y +### 1、安装Bind Chroot DNS 服务器 - 2. 拷贝bind相关文件,准备bind chroot 环境 + [root@centos7 ~]# yum install bind-chroot bind -y - [root@centos7 ~]# cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/ +### 2、拷贝bind相关文件,准备bind chroot 环境 - 3. 在bind chroot 的目录中创建相关文件 + [root@centos7 ~]# cp -R /usr/share/doc/bind-*/sample/var/named/* /var/named/chroot/var/named/ - [root@centos7 ~]# touch /var/named/chroot/var/named/data/cache_dump.db +### 3、在bind chroot 的目录中创建相关文件 - [root@centos7 ~]# touch /var/named/chroot/var/named/data/named_stats.txt + [root@centos7 ~]# touch /var/named/chroot/var/named/data/cache_dump.db - [root@centos7 ~]# touch /var/named/chroot/var/named/data/named_mem_stats.txt + [root@centos7 ~]# touch /var/named/chroot/var/named/data/named_stats.txt - [root@centos7 ~]# touch /var/named/chroot/var/named/data/named.run + [root@centos7 ~]# touch /var/named/chroot/var/named/data/named_mem_stats.txt - [root@centos7 ~]# mkdir /var/named/chroot/var/named/dynamic + [root@centos7 ~]# touch /var/named/chroot/var/named/data/named.run - [root@centos7 ~]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind + [root@centos7 ~]# mkdir /var/named/chroot/var/named/dynamic + + [root@centos7 ~]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind - 4. 将 Bind 锁定文件设置为可写: +### 4、 将 Bind 锁定文件设置为可写 - [root@centos7 ~]# chmod -R 777 /var/named/chroot/var/named/data - [root@centos7 ~]# chmod -R 777 /var/named/chroot/var/named/dynamic + [root@centos7 ~]# chmod -R 777 /var/named/chroot/var/named/data + [root@centos7 ~]# chmod -R 777 /var/named/chroot/var/named/dynamic - 5. 将 /etc/named.conf 拷贝到 bind chroot目录 +### 5、 将 /etc/named.conf 拷贝到 bind chroot目录 - [root@centos7 ~]# cp -p /etc/named.conf /var/named/chroot/etc/named.conf + [root@centos7 ~]# cp -p /etc/named.conf /var/named/chroot/etc/named.conf - 6. 在/etc/named.conf中对 bind 进行配置。在文件尾添加 example.local 域信息: +### 6、 在/etc/named.conf中对 bind 进行配置。 - [root@centos7 ~]# vi /var/named/chroot/etc/named.conf - -在 named.conf 中创建转发域(Forward Zone)与反向域(Reverse Zone): +在 named.conf 文件尾添加 **example.local** 域信息, 创建转发域(Forward Zone)与反向域(Reverse Zone)(LCTT 译注:这里example.local 并非一个真实有效的互联网域名,而是通常用于本地测试的一个域名;如果你需要做权威 DNS 解析,你可以将你拥有的域名如这里所示配置解析。): + [root@centos7 ~]# vi /var/named/chroot/etc/named.conf +-- .. .. zone "example.local" { @@ -56,7 +58,7 @@ BIND(Berkeley internet Name Daemon)也叫做NAMED是现今互联网上使用 .. .. -named.conf 完全配置 +named.conf 完全配置如下: // // named.conf @@ -123,9 +125,9 @@ named.conf 完全配置 include "/etc/named.rfc1912.zones"; include "/etc/named.root.key"; - 7. 为 example.local 域名创建转发域与反向域文件 +### 7、 为 example.local 域名创建转发域与反向域文件 -a)创建转发域 +#### a)创建转发域 [root@centos7 ~]# vi /var/named/chroot/var/named/example.local.zone @@ -154,11 +156,11 @@ a)创建转发域 ns1 IN A 192.168.0.70 ns2 IN A 192.168.0.80 -b)创建反向域 +#### b)创建反向域 [root@centos7 ~]# vi /var/named/chroot/var/named/192.168.0.zone ----- +-- ; ; Addresses and other host information. @@ -175,7 +177,9 @@ b)创建反向域 70.0.168.192.in-addr.arpa. IN PTR mx.example.local. 70.0.168.192.in-addr.arpa. IN PTR ns1.example.local. - 80.0.168.192.in-addr.arpa. IN PTR ns2.example.local.。开机自启动 bind-chroot 服务: + 80.0.168.192.in-addr.arpa. IN PTR ns2.example.local.。 + +### 8、开机自启动 bind-chroot 服务: [root@centos7 ~]# /usr/libexec/setup-named-chroot.sh /var/named/chroot on [root@centos7 ~]# systemctl stop named @@ -184,15 +188,13 @@ b)创建反向域 [root@centos7 ~]# systemctl enable named-chroot ln -s '/usr/lib/systemd/system/named-chroot.service' '/etc/systemd/system/multi-user.target.wants/named-chroot.service' -[跳转到档案页,阅读更多文章][1] - ------------------ via: http://www.ehowstuff.com/how-to-setup-bind-chroot-dns-server-on-centos-7-0-vps/ 作者:[skytech][a] -译者:[SPccman](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[SPccman](https://github.com/SPccman) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/translated/tech/How to filter, split or merge pcap files on Linux.md b/published/201501/How to filter, split or merge pcap files on Linux.md similarity index 61% rename from translated/tech/How to filter, split or merge pcap files on Linux.md rename to published/201501/How to filter, split or merge pcap files on Linux.md index 3c3335544d..82caa80cbd 100644 --- a/translated/tech/How to filter, split or merge pcap files on Linux.md +++ b/published/201501/How to filter, split or merge pcap files on Linux.md @@ -1,7 +1,7 @@ Linux下如何过滤、分割以及合并 pcap 文件 ============= -如果你是个网络管理员,并且你的工作包括测试一个[入侵侦测系统][1]或一些网络访问控制策略,那么你通常需要抓取数据包并且在离线状态下分析这些文件。当需要保存捕获的数据包时,我们会想到 libpcap 的数据包格式被广泛使用于许多开源的嗅探工具以及捕包程序。如果 pcap 文件被用于入侵测试或离线分析的话,那么在将他们[注入][2]网络之前通常要先对 pcap 文件进行一些操作。 +如果你是一个测试[入侵侦测系统][1]或一些网络访问控制策略的网络管理员,那么你经常需要抓取数据包并在离线状态下分析这些文件。当需要保存捕获的数据包时,我们一般会存储为 libpcap 的数据包格式 pcap,这是一种被许多开源的嗅探工具以及捕包程序广泛使用的格式。如果 pcap 文件被用于入侵测试或离线分析的话,那么在将他们[注入][2]网络之前通常要先对 pcap 文件进行一些操作。 ![](https://farm8.staticflickr.com/7570/15425147404_a69f416673_c.jpg) @@ -9,9 +9,9 @@ Linux下如何过滤、分割以及合并 pcap 文件 ### Editcap 与 Mergecap### -Wireshark,是最受欢迎的 GUI 嗅探工具,实际上它来源于一套非常有用的命令行工具集。其中包括 editcap 与 mergecap。editcap 是一个万能的 pcap 编辑器,它可以过滤并且能以多种方式来分割 pcap 文件。mergecap 可以将多个 pcap 文件合并为一个。 这篇文章就是基于这些 Wireshark 命令行工具。 +Wireshark,是最受欢迎的 GUI 嗅探工具,实际上它带了一套非常有用的命令行工具集。其中包括 editcap 与 mergecap。editcap 是一个万能的 pcap 编辑器,它可以过滤并且能以多种方式来分割 pcap 文件。mergecap 可以将多个 pcap 文件合并为一个。 这篇文章就是基于这些 Wireshark 命令行工具的。 -如果你已经安装过Wireshark了,那么这些工具已经在你的系统中了。如果还没装的话,那么我们接下来就安装 Wireshark 命令行工具。 需要注意的是,在基于 Debian 的发行版上我们可以不用安装 Wireshark GUI 而仅安装 命令行工具,但是在 Red Hat 及 基于它的发行版中则需要安装整个 Wireshark 包。 +如果你已经安装过 Wireshark 了,那么这些工具已经在你的系统中了。如果还没装的话,那么我们接下来就安装 Wireshark 命令行工具。 需要注意的是,在基于 Debian 的发行版上我们可以不用安装 Wireshark GUI 而仅安装命令行工具,但是在 Red Hat 及 基于它的发行版中则需要安装整个 Wireshark 包。 **Debian, Ubuntu 或 Linux Mint** @@ -27,15 +27,15 @@ Wireshark,是最受欢迎的 GUI 嗅探工具,实际上它来源于一套非 通过 editcap, 我们能以很多不同的规则来过滤 pcap 文件中的内容,并且将过滤结果保存到新文件中。 -首先,以“起止时间”来过滤 pcap 文件。 " - A < start-time > and " - B < end-time > 选项可以过滤出处在这个时间段到达的数据包(如,从 2:30 ~ 2:35)。时间的格式为 “ YYYY-MM-DD HH:MM:SS"。 +首先,以“起止时间”来过滤 pcap 文件。 " - A < start-time > 和 " - B < end-time > 选项可以过滤出在这个时间段到达的数据包(如,从 2:30 ~ 2:35)。时间的格式为 “ YYYY-MM-DD HH:MM:SS"。 - $ editcap -A '2014-12-10 10:11:01' -B '2014-12-10 10:21:01' input.pcap output.pcap + $ editcap -A '2014-12-10 10:11:01' -B '2014-12-10 10:21:01' input.pcap output.pcap 也可以从某个文件中提取指定的 N 个包。下面的命令行从 input.pcap 文件中提取100个包(从 401 到 500)并将它们保存到 output.pcap 中: $ editcap input.pcap output.pcap 401-500 -使用 "-D< dup-window >" (dup-window可以看成是对比的窗口大小,仅与此范围内的包进行对比)选项可以提取出重复包。每个包都依次与它之前的 < dup-window > -1 个包对比长度与MD5值,如果有匹配的则丢弃。 +使用 "-D < dup-window >" (dup-window可以看成是对比的窗口大小,仅与此范围内的包进行对比)选项可以提取出重复包。每个包都依次与它之前的 < dup-window > -1 个包对比长度与MD5值,如果有匹配的则丢弃。 $ editcap -D 10 input.pcap output.pcap @@ -71,13 +71,13 @@ Wireshark,是最受欢迎的 GUI 嗅探工具,实际上它来源于一套非 如果要忽略时间戳,仅仅想以命令行中的顺序来合并文件,那么使用 -a 选项即可。 -例如,下列命令会将 input.pcap文件的内容写入到 output.pcap, 并且将 input2.pcap 的内容追加在后面。 +例如,下列命令会将 input.pcap 文件的内容写入到 output.pcap, 并且将 input2.pcap 的内容追加在后面。 $ mergecap -a -w output.pcap input.pcap input2.pcap ###总结### -在这篇指导中,我演示了多个 editcap、 mergecap 操作 pcap 文件的案例。除此之外,还有其它的相关工具,如 [reordercap][3]用于将数据包重新排序,[text2pcap][4] 用于将pcap 文件转换为 文本格式, [pcap-diff][5]用于比较 pcap 文件的异同,等等。当进行网络入侵测试及解决网络问题时,这些工具与[包注入工具][6]非常实用,所以最好了解他们。 +在这篇指导中,我演示了多个 editcap、 mergecap 操作 pcap 文件的例子。除此之外,还有其它的相关工具,如 [reordercap][3]用于将数据包重新排序,[text2pcap][4] 用于将 pcap 文件转换为文本格式, [pcap-diff][5]用于比较 pcap 文件的异同,等等。当进行网络入侵测试及解决网络问题时,这些工具与[包注入工具][6]非常实用,所以最好了解他们。 你是否使用过 pcap 工具? 如果用过的话,你用它来做过什么呢? @@ -86,8 +86,8 @@ Wireshark,是最受欢迎的 GUI 嗅探工具,实际上它来源于一套非 via: http://xmodulo.com/filter-split-merge-pcap-linux.html 作者:[Dan Nanni][a] -译者:[SPccman](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[SPccman](https://github.com/SPccman) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 diff --git a/published/Quick systemd-nspawn guide.md b/published/201501/Quick systemd-nspawn guide.md similarity index 100% rename from published/Quick systemd-nspawn guide.md rename to published/201501/Quick systemd-nspawn guide.md diff --git a/published/20150122 How are C data types “supported directly by most computers”.md b/published/20150122 How are C data types “supported directly by most computers”.md new file mode 100644 index 0000000000..f57bd9ac7f --- /dev/null +++ b/published/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/201502/20140819 Top 4 Linux download managers.md b/published/201502/20140819 Top 4 Linux download managers.md new file mode 100644 index 0000000000..5896665a80 --- /dev/null +++ b/published/201502/20140819 Top 4 Linux download managers.md @@ -0,0 +1,152 @@ +Linux下的四大下载管理器 +================================================================================ +**改善你的网页下载,以便更好的管理文件镜像、批量下载还是仅仅希望更好的管理你的文件。** + +下载管理器现在似乎已经不新鲜了,但是他们仍然非常有用。我们来比较一下Linux上排名前四的下载管理器。 + +### [uGet][1] ### + +如同很多其他的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下载客户端的界面:有着活跃、结束、暂停等等对于不同下载任务的分类。尽管有很多的信息,但是他们都以非常简单明确的方式展现出来。旁边伴有高级选项的主下载控制非常易于使用。 + +#### 集成 #### + +它能查看到剪贴板里的URL,但uGet并没有在本地集成到Chromium和Firefox这些浏览器中。尽管如此,这两种浏览器还是能通过一些扩展程序连到uGet上:Firefox可以用Flashgot,Chromium则有专用的插件。虽然不是很理想,但是已经足够好了。 + +#### 功能 #### + +成熟的uGet完备了各种功能,包括按计划启动和终止下载任务的高级功能,通过剪贴板批量下载,还能改变它在剪贴板里查找的文件的类型。虽然有插件选项,但不多。 + +#### 可获得性 #### + +虽然在多数主要的发行版的软件库中都能得到它,但uGet网站上有着定期更新的适用于各种流行的发行版的二进制安装文件,还能轻易获得源代码。它的运行基于GTK 3+的图形库,所以它在某些桌面环境上的封装要比其他的小,然而我们得说,在KDE或其他Qt桌面上值得为此添加额外的依赖库。 + +#### 总体评价 #### + +8/10 + +我们非常喜欢uGet——它种类繁多的功能和极高的人气,让它成为了能与Linux浏览器优雅结合的万能下载管理器。 + +### [KGet][2] ### + +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采用一贯的图标和线条,与桌面环境的审美风格完美融合。它的设计也相当简洁,在主工具栏里只显示最必要的功能,当前下载也以最小界面显示。 + +#### 集成 #### + +KGet会集成到本地的KDE的Konqueror浏览器里,虽然它并不是最流行的浏览器。Firefox对KGet的支持是一如既往的是通过FlashGot完成的,但是在Chromium里并没有任何一种方法能真正的将它集成进去。你可以打开一个“询问你是否想下载已复制好的URL”的功能,然而KGet对于剪贴板的分析并不是很好,有的时候会把文本下载下来。 + +#### 功能 #### + +能够选择的功能并不多。没有计划任务,没有批量下载,基本上没有什么特色的下载功能。剪贴板扫描功能,想法很不错就是有点问题。设置菜单看起来有点怪怪的,因为它看起来应该设计有更多的功能。 + +#### 可获得性 #### + +虽然它不会随着KDE默认安装,但可以在任何支持KDE的发行版里得到它。虽然它的运行需要几个KDE库,找到它的源代码也很困难。除了少数几个发行版之外也没有什么二进制安装文件。 + +#### 总体评价 #### + +6/10 + +KGet并没有真正的给予用户比大多数主流浏览器内置下载管理器更强大的下载管理功能,但是,你可以在浏览器关闭的情况下使用它。 + +### [DownThemAll!][3] ### + +经由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!上有很多选项可以设置,这让它非常的灵活* + +#### 界面 #### + +与Firefox的集成使得DownThemAll!的风格符合浏览器的审美标准,右键单击可以唤出普通下载和DownThemAll选项。额外的对话框菜单通常和Firefox的主题风格一致,然而主下载窗口则非常整洁并采用了它自己的设计。 + +#### 集成 #### + +它并不是系统级集成,但是它伪装在Firefox中的能力让它看起来就像是原本浏览器的附加部分。如果你想,它就可以和普通下载器一同工作,在一点点手动过滤的帮助下,他还能找到网页上特定类型的链接,无需复制粘贴。 + +#### 功能 #### + +拥有着能同时控制多个下载任务的能力,限制而不浪费带宽以及先进的自动或手动过滤功能,DownThemAll!有着一大堆有助于大规模下载的优秀功能。“一键”功能还让它能非常迅速的启动预定文件夹的下载。这比普通下载功能快多了。 + +#### 可获得性 #### + +Firefox几乎能在所有的发行版和Linux以外的操作系统中获得。这让DownThemAll!也和它一样多能。不幸的是,这是一把双刃剑,因为Firefox可能不是你喜欢的浏览器。它还给浏览器增加了一些负担,让它的启动不再那么轻松。 + +#### 总体评价 #### + +7/10 + +DownThemAll!是很优秀的,如果你使用Firefox你也许就不再需要用任何其他的下载器了。然而并不是每个人都喜欢用Firefox浏览器,而且管理器需要在浏览器开启的情况下才能启动。 + +### [Steadyflow][4] ### + +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里的设置非常少,而且有点难以使用。* + +#### 界面 #### + +Steadyflow的形象相当简洁,令人愉悦的、干净的界面并没有让下载窗口变得混乱。添加下载任务的对话框足够简洁,只有基本的选项来设置下载任务,设置文件位置。真没什么可抱怨的,虽然它的确让我们觉得它的功能有点少。 + +#### 集成 #### + +查看复制的URL是标准配备,还有个让Chromium集成这个功能的插件。同样的,如果你喜欢用Firefox你可以通过Flashgot把它连到Firefox上。你并不能真正的编辑它从剪贴板里分析出的链接,它也不能像uGet和DownThemAll!一样批量下载。 + +#### 功能 #### + +极度缺少功能,选项菜单也受到很大限制。暂停和恢复功能看起来也不怎么好使——这是任何浏览器文件下载功能的最基本的部分。文件下载结束的通知和默认行为是可以设置的,还可以选择在文件下载完成之后运行脚本。 + +#### 可获得性 #### + +只能在Ubuntu上获取,还不容易得到这个应用的源代码。这意味着虽然在所有基于Ubuntu的发行版中都能很容易的得到它,但也仅限于这些发行版。由于它不是Linux上能得到的最好的下载管理器,所以也不用想太多。 + +#### 总体评价 #### + +5/10 + +坦白说,没那么好。只有非常基本的选项,还只能在Ubuntu上使用,Steadyflow要想从你能选择的浏览器自带的标准下载选项中脱颖而出,它做的还不够。 + +### 那么获奖者是…… ### + +#### uGet #### + +在此次测试中,我们已经证明了现代电脑中还是有下载管理器的一席之地的,即便它们中的佼佼者们从BT下载客户端中抄袭了某些功能,貌似侵犯了他们的权益。对于某些人来说BT下载可能是个更有效率的方式,随着ISP们对待BT流量越来越机智,一些人可能用一个好的下载管理器就得到更好的效果。大多数主流ISP不仅仅强加了数据传输限额,在高峰时段他们中的一些甚至开始减慢或封掉BT流量——甚至连发行版的ISO文件和其他免费软件的合法数据流都被限制了。 + +对于这类问题Steadyflow看起来是非常受欢迎的解决方式,但我们的使用和测试显示出,它是一个未完成的简陋的产品。更加古老的uGet则是这场表演的明星,有着惊人数量的可选功能,这些功能既能在下载单一文件中有所帮助,还能在整个网页里过滤出相关元素进行抓取。DownThemAll!与之类似,优秀的Firefox有加分,但它也离不开Firefox,有着几乎同级别的功能,但集成效果更好。 + +如果你要在这两个里面选一个,那就得谈谈你喜欢哪个浏览器还有你是否需要昼夜下载或上传文件。DownThemAll!需要Firefox一直运行,然而uGet可以单独运行,为处理器节省了很多资源和电力——这显然让uGet在24小时数据传输上显得更有前途,而且对于它来说,设置一大批下载任务或只是从你的浏览器中获取下载信息,都不是什么难事。 + +再给下载管理器一个机会。结果绝不会让你失望。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxuser.co.uk/reviews/top-4-linux-download-managers + +作者:Rob Zwetsloot +译者:[H-mudcup](https://github.com/H-mudcup) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://bit.ly/1mx4Uwz +[2]:http://bit.ly/1lilqU9 +[3]:http://bit.ly/1lilqU9 +[4]:http://bit.ly/1lilymS diff --git a/published/201502/20140821 What is a good EPUB reader on Linux.md b/published/201502/20140821 What is a good EPUB reader on Linux.md new file mode 100644 index 0000000000..7c3c4ea287 --- /dev/null +++ b/published/201502/20140821 What is a good EPUB reader on Linux.md @@ -0,0 +1,67 @@ +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阅读器的话,这个软件还是太大了。 + +### 2. FBReader ### + +![](https://farm4.staticflickr.com/3900/14975176165_f2e4afd2fa_o.jpg) + +[FBReader][2] 也是一个图书馆管理软件,但是比Calibre小。界面简洁分为两个部分:左边是文件管理、元数据编辑和下载新书等功能;右边是阅读区。如果你喜欢简洁,这个软件挺不错。我个人非常喜欢这类直观标记书籍和分类的做法。 + +### 3. Cool Reader ### + +![](https://farm6.staticflickr.com/5594/14975176195_ac46952150.jpg) + +对于那些只想想看EPUB书内容的用户,我推荐 [Cool Reader][5]。遵循Linux应用程序的文化,Cool Reader 做了优化,每次只打开一个EPUB文件,可以使用简单的快捷键进行阅读和导航。由于程序书基于Qt开发的,所以他也遵循Qt的风格,需要大量的设置项。 + +### 4. Okular ### + +![](https://farm6.staticflickr.com/5559/14788504729_5a2ec2c11b_z.jpg) + +除了Qt应用程序,如果安装了EPUB库的话,KDE的文档阅读器[Okular][3] 也能打开EPUB文件。尽管如此,如果你不是个KDE用户的话,不推荐这个软件。 + +### 5. pPub ### + +![](https://farm4.staticflickr.com/3835/14788504789_e7c742fa20_z.jpg) + +[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阅读器了。 + +### 7. Sigil ### + +![](https://farm4.staticflickr.com/3921/14788640417_7940627871_z.jpg) + +最后介绍的这个实际上不是个EPUB阅读器,应该是个独立的编辑器。[Sigil][7] 可以提取EPUB文件的内容并将其分离成其他格式:xhtml文本、图像、css,及其他的内容比如音频等。界面比基本的阅读器复杂,但是功能还是比较丰富的。我很喜它的标签体系,如果你对网页比较熟悉的话,这个软件是很好使用的。 + +总结,有很多的开源的EPUB阅读器,有一些只有最基本的功能, 另外一些功能却太多了。一般来说,我建议你选择一个最合适的使用。如果你有更好的EPUB阅读器,请在评论里告诉我们! + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/2014/08/good-epub-reader-linux.html + +作者:[Adrien Brochard][a] +译者:[shipsw](https://github.com/shipsw) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/adrien +[1]:http://calibre-ebook.com/ +[2]:http://fbreader.org/ +[3]:http://okular.kde.org/ +[4]:https://github.com/sakisds/pPub +[5]:http://crengine.sourceforge.net/ +[6]:https://github.com/rupa/epub +[7]:https://github.com/user-none/Sigil diff --git a/published/201502/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 new file mode 100644 index 0000000000..4c183956d3 --- /dev/null +++ b/published/201502/20140917 How to create a software RAID-1 array with mdadm on Linux.md @@ -0,0 +1,223 @@ +如何使用linux程序mdadm创建软件RAID1软阵列 +================================================================================ +磁盘冗余阵列(RAID)是将多个物理磁盘结合成一个逻辑磁盘的技术,该技术可以提高磁盘容错性能,提高磁盘的读写速度。根据数据存储的排列(如:条带存储,镜像存储,奇偶或者他们的组合),定义了几个不同级别的RAID(RAID-0,RAID-1,RAID-5 等等)。磁盘阵列可以使用软件或者硬件方式实现。现代Linux操作系统中,基本的软件RAID功能是默认安装的。 + +本文中,我们将介绍软件方式构建RAID-1阵列(镜像阵列),RAID-1将相同的数据写到不同的设备中。虽然可以使用同一个磁盘的两个分区实现RAID-1,但是如果磁盘坏了的话数据就都丢了,所以没什么意义。实际上,这也是为什么大多数RAID级别都使用多个物理磁盘提供冗余。当单盘失效后不影响整个阵列的运行,并且可以在线更换磁盘,最重要的是数据不会丢失。尽管如此,阵列不能取代外部存储的定期备份。 + +由于RAID-1阵列的大小是阵列中最小磁盘的大小,一般来说应该使用两个大小相同的磁盘来组建RAID-1。 + +### 安装mdadm ### + +我们将使用mdadm(简称多盘管理)工具创建、组装、管理和监控软件RAID-1。在诸如Fedora、CentOS、RHEL或者Arch Linux 的发行版中,mdadm是默认安装的。在基于Debian的发行版中,可以使用aptitude 或者 apt-get 安装mdadm。 + +#### Fedora, CentOS 或 RHEL #### + +由于adadm是预装的,所以我们只需要开启RAID守护服务,并将其配置成开机启动即可: + + # systemctl start mdmonitor + # systemctl enable mdmonitor + +对于CentOS/RHEL 6系统,使用以下命令: + + # service mdmonitor start + # chkconfig mdmonitor on + +#### Debian, Ubuntu 或 Linux Mint #### + +在Debian或类Debian系统中,mdadm可以使用 **aptitude 或者 apt-get** 安装: + + # aptitude install mdadm + +Ubuntu系统中,会要求配置Postfix MTA 以发送电子邮件通知。你可以跳过去。 + +Debian系统中,安装程序会显示以下解释信息,用来帮助我们去判断是否将根目录安装到RAID阵列中。下面的所有操作都有赖于这一步,所以应该仔细阅读他。 + +![](https://farm4.staticflickr.com/3918/15220883382_c14eb95914_z.jpg) + +我们不在根目录使用RAID-1,所以留空。 + +![](https://farm6.staticflickr.com/5555/15198241896_29e08b977f.jpg) + +提示是否开机启动阵列的时候,选择“是”。注意,这里需要往/etc/fstab 文件中添加一个条目使得系统启动的时候正确挂载阵列。 + +![](https://farm4.staticflickr.com/3875/15220883342_2b1d689a0a_z.jpg) + +### 硬盘分区 ### + +现在开始准备建立阵列需要的硬盘。这里插入两个8GB的usb磁盘,使用dmesg命令设备显示设备 /dev/sdb 和 /dev/sdc + + # dmesg | less + +---------- + +[ 60.014863] sd 3:0:0:0: [sdb] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB) +[ 75.066466] sd 4:0:0:0: [sdc] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB) + +我们使用fdisk为每个磁盘建立一个大小为8G的主分区。以下步骤是如何在/dev/sdb上建立分区,假设次磁盘从未被分区(如果有其他分区的话,可以删掉): + + # fdisk /dev/sdb + +按p键输出现在的分区表: + +![](https://farm4.staticflickr.com/3883/15198241836_24625edcf3_z.jpg) + +(如果有分区的话,可以使用 d 选项删除,w 选项应用更改)。 + +磁盘上没有分区,所以我们使用命令 ['n'] 创建一个主分区['p'], 分配分区号为['1'] 并且指定大小。你可以按回车使用默认值,或者输入一个你想设置的值。如下图: + +![](https://farm4.staticflickr.com/3875/15034475369_7e72fb9f2e_z.jpg) + +用同样的方法为/dev/sdc 分区。 + +如果我们有两个不同容量的硬盘,比如 750GB 和 1TB的话,我们需要在每个磁盘上分出一个750GB的主分区,大盘剩下的空间可以用作他用,不加入磁盘阵列。 + +### 创建 RAID-1 阵列 ### + +磁盘分区完成后,我们可以使用以下命令创建 RAID-1 阵列: + + # mdadm -Cv /dev/md0 -l1 -n2 /dev/sdb1 /dev/sdc1 + +说明: + +- **-Cv**: 创建一个阵列并打印出详细信息。 +- **/dev/md0**: 阵列名称。 +- **-l1** (l as in "level"): 指定阵列类型为 RAID-1 。 +- **-n2**: 指定我们将两个分区加入到阵列中去,分别为/dev/sdb1 和 /dev/sdc1 + +以上命令和下面的等价: + + # mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1 + +如果你想在在磁盘失效时添加另外一个磁盘到阵列中,可以指定 '--spare-devices=1 /dev/sdd1' 到以上命令。 + +输入 “y” 继续创建阵列,回车: + +![](https://farm4.staticflickr.com/3894/15034569970_709bd51718.jpg) + +可以使用以下命令查看进度: + + # cat /proc/mdstat + +![](https://farm6.staticflickr.com/5565/15221267975_701b819e6d_z.jpg) + +另外一个获取阵列信息的方法是: + + # mdadm --query /dev/md0 + # mdadm --detail /dev/md0 (or mdadm -D /dev/md0) + +![](https://farm6.staticflickr.com/5583/15034683868_6c28564e5a_z.jpg) + +'mdadm -D'命令提供的信息中,最重要就是阵列状态类。激活状态说明阵列正在进行读写操作。其他几个状态分别为:完成(读写完成)、降级(有一块磁盘失效或丢失)或者恢复中(一张新盘已插入,系统正在写入数据)。这几个状态涵盖了大多数情况。 + +### 格式化或加载磁盘阵列 ### + +下一步就是格式化阵列了,本例中使用ext4格式: + + # mkfs.ext4 /dev/md0 + +![](https://farm4.staticflickr.com/3849/15034683838_01e34e7196_z.jpg) + +现在可以加载阵列并验证其正常加载: + + # mount /dev/md0 /mnt + # mount + +![](https://farm6.staticflickr.com/5554/15034696167_c4fc907c8e_z.jpg) + +### 监控磁盘阵列 ### + +mdadm工具内置有磁盘阵列监控功能。当mdadm作为守护程序运行的时候(就像我们上文那样),会周期性的检测阵列运行状态,将检测到的信息通过电子邮件或者系统日志报告上来。当然,也可以配置其在发生致命性错误的时候调用紧急命令。 + +mdadm默认会记录所有已知分区和阵列的事件,并将他们记录到 /var/log/syslog中。或者你可以在配置文件中(debian系统:/etc/mdadm/mdadm.conf ,红帽子系统:/etc/mdadm.conf )用以下格式指定监控设备或者阵列。如果mdadm.conf文件不存在,你可以创建一个。 + + DEVICE /dev/sd[bcde]1 /dev/sd[ab]1 + + ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1 + ARRAY /dev/md1 devices=/dev/sdd1,/dev/sde1 + ..... + + # optional email address to notify events + MAILADDR your@email.com + +编辑完毕mdadm配置文件后,重启mdadm服务: + +Debian系统,Ubuntu或者Linux Mint: + + # service mdadm restart + +Fedora, CentOS 或 RHEL 7: + + # systemctl restart mdmonitor + +CentOS或者RHEL 6: + + # service mdmonitor restart + +### 自动加载阵列 ### + +现在我们在/etc/fstab中加入条目使得系统启动的时候将阵列挂载到/mnt目录下: + + # echo "/dev/md0 /mnt ext4 defaults 0 2" << /etc/fstab + +为了验证挂载脚本工作正常,我们首先卸载阵列,重启mdadm,然后重新加载。可以看到/dev/md0已经安装我们添加到/etc/fstab中的条目加载了: + + # umount /mnt + # service mdadm restart (on Debian, Ubuntu or Linux Mint) + or systemctl restart mdmonitor (on Fedora, CentOS/RHEL7) + or service mdmonitor restart (on CentOS/RHEL6) + # mount -a + +![](https://farm6.staticflickr.com/5563/15218183681_63a10da704_z.jpg) + +现在我们的阵列已经可以访问了,拷贝文件/etc/passwd到/mnt中测试一下: + +![](https://farm6.staticflickr.com/5593/15034475219_a3476aec0a_o.png) + +Debian系统中,需要在/etc/default/mdadm 设置 AUTOSTART 变量为 true 才能使mdadm守护程序在开机时自动加载阵列: + + AUTOSTART=true + +### 模拟磁盘丢失故障 ### + +我们将使用以下命令卸载磁盘来模拟磁盘故障。注意,在实际应用中,磁盘如果已经是故障状态了,不需要卸载。 + +首先,卸载阵列: + + # umount /mnt + +现在注意每次执行命令后 'mdadm -D /dev/md0' 的输出。 + + # 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 + +数据会被自动添加到备用盘 /dev/sdb1 上: + +![](https://farm4.staticflickr.com/3855/15221267875_dfc6af8804_z.jpg) + +注意以上所述步骤只适合支持磁盘热拔插的系统,在不支持热拔插的系统中,还是得停止阵列并关机后更换备用盘: + + # mdadm --stop /dev/md0 + # shutdown -h now + +最后将新驱动器重新添加到阵列中: + + # mdadm /dev/md0 --add /dev/sdb1 + # mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 + +希望本文对你有所帮助。 + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/2014/09/create-software-raid1-array-mdadm-linux.html + +作者:[Gabriel Cánepa][a] +译者:[shipsw](https://github.com/shipsw) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/gabriel 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/published/201502/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 new file mode 100644 index 0000000000..602c99eb18 --- /dev/null +++ b/published/201502/20141030 Test drive Linux with nothing but a flash drive.md @@ -0,0 +1,75 @@ +试试只用U盘加载Linux系统 +================================================================================ + +也许你听过Linux并对它有点好奇,终于想要实际体验一下,但可能不知道从哪儿开始。 + +很可能你已经在网上搜索过一些信息,然后遇到一些像双系统和虚拟机这样的词汇。它们对你来说也许太专业了,所以你肯定不会仅仅为了尝试一下Linux而牺牲正在使用的操作系统。那我们该怎么办? + +如果你手上正好有个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(LCTT 译注:它还有 Windows 和 Linux 版本)。 + +### 开始干活 ### + +把U盘插到你电脑的USB端口上,然后启动Unetbootin。然后会要求你输入当前电脑的登录密码。 + +![Unetbootin main window](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-main.png) + +还记得之前提到的ISO镜像文件吗?有两种方式可以获得:要么自己从你想尝试的Linux发行版网站上下载,或者让Unetbootin帮你下载。如果选后者,在窗口顶部点击**选择发行版**,选择你想下载的发行版,然后点击**选择版本**来选择你希望尝试的发行版版本。 + +![Downloading a Linux distribution](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-download-distro.png) + +或者,你也可以自己下载发行版。通常,我想尝试的Linux发行版都没有在列表中。如果选择自己下载,那么点击**磁盘镜像**,然后点击按钮来选择你下载好的.iso文件。 + +注意到下面的选项**预留每次重新启动后保存文件的空间(仅Ubuntu有效)**吗?如果你尝试的是Ubuntu或它的任一个衍生版(比如Lubuntu或Xubuntu),你可以在U盘上留出几M空间用来保存文件,比如网页书签或你自己创建的文档。当用这个U盘下次启动Ubuntu的时候,你可以继续使用这些文件。 + +![Ready to create a live USB](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-ready-to-go.png) + +在加载好ISO镜像后,点击**确定**。Unetbootin大概需要不到10分钟来创建USB启动盘。 + +![Creating the live USB](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-creating-disk.png) + +### 检验USB启动盘 ### + +这个时候,你需要拥抱一下自己内在的极客精神。这不会太难,不过你将需要进入[BIOS][3]去偷看一下你的电脑内部空间。你的电脑的BIOS会加载各种硬件,并控制电脑操作系统的引导或启动。 + +BIOS通常会按这个顺序搜索操作系统(或者类似的顺序):硬盘,然后是CD/DVD光驱,然后是外部存储设备。你需要调整这个顺序,让外部存储设备(在这里,指的是你的U盘启动盘)成为BIOS第一个搜索的设备。 + +要做到这一点,请把U盘插到电脑上再重启电脑。在看到提示信息**Press F2 to enter setup**之后,按它要求的做。在有的电脑上,这个键可能是F10。 + +在BIOS里,用键盘上的向右方向键切换到**Boot**菜单。然后你将看到你电脑上的驱动器列表。使用键盘上的向下方向键选中名字为**USB HDD**的选项,然后按下**F6**移动这个选项到列表的顶部。 + +完成后,按下**F10**来保存改动。然后你会从BIOS里被踢出来,然后电脑会自己启动。等一小会,你就会看到一个你正在尝试的Linux发行版的启动菜单。选择**Run without installing**(或者最类似的选项)。 + +在进入桌面后,你可以连接上无线或有线网络,看看网页,试一试预装的软件。你还可以看看,比如说,你的打印机或扫描仪是否能在你试的这个发行版下正常工作。你要是真的想不开,也可以去摸一下命令行。 + +### 能干什么 ### + +根据你尝试的Linux发行版和你使用的U盘的速度,操作系统可能会需要较长的时间来加载,而且很可能比直接装到硬盘上会慢一点。 + +还有,你也只能运行Linux发行版里预装好的基本软件。通常会有网页浏览器,一个文字处理软件,一个文本编辑器,一个媒体播放器,一个相片浏览器,以及一套实用工具。这些应该足够给你使用Linux的感觉了。 + +如果你决定使用Linux,你可以双击安装器从U盘安装到硬盘。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/life/14/10/test-drive-linux-nothing-flash-drive + +作者:[Scott Nesbitt][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/scottnesbitt +[1]:http://en.wikipedia.org/wiki/ISO_image +[2]:http://unetbootin.sourceforge.net/ +[3]:http://en.wikipedia.org/wiki/BIOS 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/translated/tech/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 78% rename from translated/tech/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 index 273d949490..57ff68b6d2 100644 --- a/translated/tech/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 @@ -2,13 +2,13 @@ Ubuntu中跟踪多个时区的简捷方法 ================================================================================ ![date-time](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/date-time.jpg) -**我是否要确保在我醒来时或者安排与*山姆陈*,Ohso的半个开发商,进行Skype通话时,澳大利亚一个关于Chromebook销售的推特已经售罄,我大脑同时在多个时区下工作。** +**无论我是要在醒来时发个关于澳大利亚的 Chromebook 销售已经售罄的推特,还是要记着和Ohso的半个开发商山姆陈进行Skype通话,我大脑都需要同时工作在多个时区下。** 那里头有个问题,如果你认识我,你会知道我的脑容量也就那么丁点,跟金鱼差不多,里头却塞着像Windows Vista这样一个臃肿货(也就是,不是很好)。我几乎记不得昨天之前的事情,更记不得我的门和金门大桥脚之间的时间差! -作为臂助,我使用一些小部件和菜单项来让我保持同步。在我常规工作日的空间里,我在多个操作系统间游弋,涵盖移动系统和桌面系统,但只有一个让我最快速便捷地设置“世界时钟”。 +作为臂助,我使用一些小部件和菜单项来让我保持同步。在我常规工作日的空间里,我在多个操作系统间游弋,涵盖移动系统和桌面系统,但只有一个可以让我最快速便捷地设置“世界时钟”。 -**而它刚好是那个名字放在门上方的东西。** +**它的名字就是我们标题上提到的那个。** ![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/11/timezones-300x180.jpg) @@ -16,10 +16,10 @@ Ubuntu中跟踪多个时区的简捷方法 Unity中默认的日期-时间指示器提供了添加并查看多个时区的支持,不需要附加组件,不需要额外的包。 -1. 点击时钟小应用,然后uxuanze‘**时间和日期设置**’条目 +1. 点击时钟小应用,然后选择‘**时间和日期设置**’条目 1. 在‘**时钟**’标签中,选中‘**其它位置的时间**’选框 1. 点击‘**选择位置**’按钮 -1. 点击‘**+**’,然后输入位置名称那个 +1. 点击‘**+**’,然后输入位置名称 #### 其它桌面环境 #### @@ -34,13 +34,13 @@ Unity中默认的日期-时间指示器提供了添加并查看多个时区的 ![World Clock Calendar in Cinnamon 2.4](http://www.omgubuntu.co.uk/wp-content/uploads/2014/12/cinnamon-applet.jpg) -Cinnamon 2.4中的世界时钟日历 +*Cinnamon 2.4中的世界时钟日历* -**XFCE**和**LXDE**就不那么慷慨了,除了自带的“工作区”作为**多个时钟**添加到面板外,每个都需要手动配置以指定位置。两个都支持‘指示器小部件’,所以,如果你没有依赖于Unity,你可以安装/添加单独的日期/时间指示器。 +**XFCE**和**LXDE**就不那么慷慨了,除了自带的“工作区”作为**多个时钟**添加到面板外,每个都需要手动配置以指定位置。两个都支持‘指示器小部件’,所以,如果你不用Unity的话,你可以安装/添加单独的日期/时间指示器。 -**Budgie**还刚初出茅庐,不足以胜任角落里的需求,因为Pantheon我还没试过——希望你们通过评论来让我知道得更多。 +**Budgie**还刚初出茅庐,不足以胜任这种角落里的需求,因为Pantheon我还没试过——希望你们通过评论来让我知道得更多。 -#### Desktop Apps, Widgets & Conky Themes桌面应用、不见和Conky主题 #### +#### 桌面应用、部件和Conky主题 #### 当然,面板小部件只是收纳其它国家多个时区的一种方式。如果你不满意通过面板去访问,那里还有各种各样的**桌面应用**可供使用,其中许多都可以跨版本,甚至跨平台使用。 @@ -54,7 +54,7 @@ via: http://www.omgubuntu.co.uk/2014/12/add-time-zones-world-clock-ubuntu 作者:[Joey-Elijah Sneddon][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/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/translated/tech/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 72% rename from translated/tech/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 index 08f4c00822..08cda11f5e 100644 --- a/translated/tech/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 @@ -1,8 +1,8 @@ CentOS上配置rsyslog客户端用以远程记录日志 ================================================================================ -**rsyslog**是一个开源工具,被广泛用于Linux系统以通过TCP/UDP协议转发或接收日志消息。rsyslog守护进程可以被配置称两种环境,一种是配置成日志收集服务器,rsyslog进程可以从网络中收集所有其它主机上的日志数据,这些主机已经将日志配置为发送到服务器。rsyslog的另外一个角色,就是可以配置为客户端,用来过滤和发送内部日志消息到本地文件夹(如/var/log)或一台可以路由到的远程rsyslog服务器上。 +**rsyslog**是一个开源工具,被广泛用于Linux系统以通过TCP/UDP协议转发或接收日志消息。rsyslog守护进程可以被配置成两种环境,一种是配置成日志收集服务器,rsyslog进程可以从网络中收集其它主机上的日志数据,这些主机会将日志配置为发送到另外的远程服务器。rsyslog的另外一个用法,就是可以配置为客户端,用来过滤和发送内部日志消息到本地文件夹(如/var/log)或一台可以路由到的远程rsyslog服务器上。 -假定你的网络中已经有一台rsyslog服务器[已经起来并且处于运行中][1],本指南将为你展示如何来设置CentOS系统将其内部日志消息路由到一台远程rsyslog服务器上。这将大大改善你的系统磁盘空间的使用,尤其是你还没有一个独立的用于/var目录的大分区。 +假定你的网络中已经有一台[已经配置好并启动的][1]rsyslog服务器,本指南将为你展示如何来设置CentOS系统将其内部日志消息路由到一台远程rsyslog服务器上。这将大大改善你的系统磁盘空间的使用,尤其是当你还没有一个用于/var目录的独立的大分区。 ### 步骤一: 安装Rsyslog守护进程 ### @@ -35,9 +35,9 @@ CentOS上配置rsyslog客户端用以远程记录日志 *.* @@192.168.1.25:514 -注意,你也可以将rsyslog服务器的IP地址替换成它的DNS名称(FQDN)。 +注意,你也可以将rsyslog服务器的IP地址替换成它的主机名(FQDN)。 -如果你只想要转发指定设备的日志消息,比如说内核设备,那么你可以在rsyslog配置文件中使用以下声明。 +如果你只想要转发服务器上的指定设备的日志消息,比如说内核设备,那么你可以在rsyslog配置文件中使用以下声明。 kern.* @192.168.1.25:514 @@ -51,9 +51,11 @@ CentOS上配置rsyslog客户端用以远程记录日志 # service rsyslog restart -在另外一种环境中,让我们假定你已经在机器上安装了一个名为“foobar”的应用程序,它会在/var/log下生成foobar.log日志文件。现在,你只想要将它的日志定向到rsyslog服务器,这可以通过像下面这样在rsyslog配置文件中加载imfile模块来实现。 +####非 syslog 日志的转发 -首先,加载imfile模块,这必须只做一次。 +在另外一种环境中,让我们假定你已经在机器上安装了一个名为“foobar”的应用程序,它会在/var/log下生成foobar.log日志文件。现在,你想要将它的日志定向到rsyslog服务器,这可以通过像下面这样在rsyslog配置文件中加载imfile模块来实现。 + +首先,加载imfile模块,这只需做一次。 module(load="imfile" PollingInterval="5") @@ -73,8 +75,7 @@ CentOS上配置rsyslog客户端用以远程记录日志 ### 步骤三: 让Rsyslog进程自动启动 ### -To automatically start rsyslog client after every system reboot, run the following command to enable it system-wide: -要让rsyslog客户端在每次系统重启后自动启动,请运行以下命令来在系统范围启用: +要让rsyslog客户端在每次系统重启后自动启动,请运行以下命令: **CentOS 7:** @@ -86,7 +87,7 @@ To automatically start rsyslog client after every system reboot, run the followi ### 小结 ### -在本教程中,我演示了如何将CentOS系统转变成rsyslog客户端以强制它发送日志消息到远程rsyslog服务器。这里我假定rsyslog客户端和服务器之间的连接是安全的(如,在有防火墙保护的公司网络中)。不管在任何情况下,都不要配置rsyslog客户端将日志消息通过不安全的网络转发,或者,特别是通过互联网转发,因为syslog协议是一个明文协议。要进行安全传输,可以考虑使用[TLS/SSL][2]来加密日志消息。 +在本教程中,我演示了如何将CentOS系统转变成rsyslog客户端以强制它发送日志消息到远程rsyslog服务器。这里我假定rsyslog客户端和服务器之间的连接是安全的(如,在有防火墙保护的公司网络中)。不管在任何情况下,都不要配置rsyslog客户端将日志消息通过不安全的网络转发,或者,特别是通过互联网转发,因为syslog协议是一个明文协议。要进行安全传输,可以考虑使用[TLS/SSL][2]来加密日志消息的传输。 -------------------------------------------------------------------------------- @@ -94,7 +95,7 @@ via: http://xmodulo.com/configure-rsyslog-client-centos.html 作者:[Caezsar M][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/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/201502/20141223 20 Linux Commands Interview Questions & Answers.md b/published/201502/20141223 20 Linux Commands Interview Questions & Answers.md new file mode 100644 index 0000000000..d7e20f6b24 --- /dev/null +++ b/published/201502/20141223 20 Linux Commands Interview Questions & Answers.md @@ -0,0 +1,143 @@ +20条Linux命令面试问答 +================================================================================ +**问:1 如何查看当前的Linux服务器的运行级别?** + +答: ‘who -r’ 和 ‘runlevel’ 命令可以用来查看当前的Linux服务器的运行级别。 + +**问:2 如何查看Linux的默认网关?** + +答: 用 “route -n” 和 “netstat -nr” 命令,我们可以查看默认网关。除了默认的网关信息,这两个命令还可以显示当前的路由表。 + +**问:3 如何在Linux上重建初始化内存盘镜像文件?** + +答: 在CentOS 5.X / RHEL 5.X中,可以用mkinitrd命令来创建初始化内存盘文件,举例如下: + + # mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r) + +如果你想要给特定的内核版本创建初始化内存盘,你就用所需的内核名替换掉 ‘uname -r’ 。 + +在CentOS 6.X / RHEL 6.X中,则用dracut命令来创建初始化内存盘文件,举例如下: + + # dracut -f + +以上命令能给当前的系统版本创建初始化内存盘,给特定的内核版本重建初始化内存盘文件则使用以下命令: + + # dracut -f initramfs-2.x.xx-xx.el6.x86_64.img 2.x.xx-xx.el6.x86_64 + +**问:4 cpio命令是什么?** + +答: cpio就是复制入和复制出的意思。cpio可以向一个归档文件(或单个文件)复制文件、列表,还可以从中提取文件。 + +**问:5 patch命令是什么?如何使用?** + +答: 顾名思义,patch命令就是用来将修改(或补丁)写进文本文件里。patch命令通常是接收diff的输出并把文件的旧版本转换为新版本。举个例子,Linux内核源代码由百万行代码文件构成,所以无论何时,任何代码贡献者贡献出代码,只需发送改动的部分而不是整个源代码,然后接收者用patch命令将改动写进原始的源代码里。 + +创建一个diff文件给patch使用, + + # diff -Naur old_file new_file > diff_file + +旧文件和新文件要么都是单个的文件要么都是包含文件的目录,-r参数支持目录树递归。 + +一旦diff文件创建好,我们就能在旧的文件上打上补丁,把它变成新文件: + + # patch < diff_file + +**问:6 aspell有什么用 ?** + +答: 顾名思义,aspell就是Linux操作系统上的一款交互式拼写检查器。aspell命令继任了更早的一个名为ispell的程序,并且作为一款免费替代品 ,最重要的是它非常好用。当aspell程序主要被其它一些需要拼写检查能力的程序所使用的时候,在命令行中作为一个独立运行的工具的它也能十分有效。 + +**问:7 如何从命令行查看域SPF记录?** + +答: 我们可以用dig命令来查看域SPF记录。举例如下: + + linuxtechi@localhost:~$ dig -t TXT google.com + +**问:8 如何识别Linux系统中指定文件(/etc/fstab)的关联包?** + +答: # rpm -qf /etc/fstab + +以上命令能列出提供“/etc/fstab”这个文件的包。 + +**问:9 哪条命令用来查看bond0的状态?** + +答: cat /proc/net/bonding/bond0 + +**问:10 Linux系统中的/proc文件系统有什么用?** + +答: /proc文件系统是一个基于内存的文件系统,其维护着关于当前正在运行的内核状态信息,其中包括CPU、内存、分区划分、I/O地址、直接内存访问通道和正在运行的进程。这个文件系统所代表的并不是各种实际存储信息的文件,它们指向的是内存里的信息。/proc文件系统是由系统自动维护的。 + +**问:11 如何在/usr目录下找出大小超过10MB的文件?** + +答: # find /usr -size +10M + +**问:12 如何在/home目录下找出120天之前被修改过的文件?** + +答: # find /home -mtime +120 + +**问:13 如何在/var目录下找出90天之内未被访问过的文件?** + +答: # find /var \\! -atime -90 + +**问:14 在整个目录树下查找文件“core”,如发现则无需提示直接删除它们。** + +答: # find / -name core -exec rm {} \; + +**问:15 strings命令有什么作用?** + +答: strings命令用来提取和显示非文本文件中的文本字符串。(LCTT 译注:当用来分析你系统上莫名其妙出现的二进制程序时,可以从中找到可疑的文件访问,对于追查入侵有用处) + +**问:16 tee 过滤器有什么作用 ?** + +答: tee 过滤器用来向多个目标发送输出内容。如果用于管道的话,它可以将输出复制一份到一个文件,并复制另外一份到屏幕上(或一些其它程序)。 + + linuxtechi@localhost:~$ ll /etc | nl | tee /tmp/ll.out + +在以上例子中,从ll输出可以捕获到 /tmp/ll.out 文件中,并且同样在屏幕上显示了出来。 + +**问:17 export PS1 = ”$LOGNAME@`hostname`:\$PWD: 这条命令是在做什么?** + +答: 这条export命令会更改登录提示符来显示用户名、本机名和当前工作目录。 + +**问:18 ll | awk ‘{print $3,”owns”,$9}’ 这条命令是在做什么?** + +答: 这条ll命令会显示这些文件的文件名和它们的拥有者。 + +**问:19 :Linux中的at命令有什么用?** + +答: at命令用来安排一个程序在未来的做一次一次性执行。所有提交的任务都被放在 /var/spool/at 目录下并且到了执行时间的时候通过atd守护进程来执行。 + +**问:20 linux中lspci命令的作用是什么?** + +答: lspci命令用来显示你的系统上PCI总线和附加设备的信息。指定-v,-vv或-vvv来获取越来越详细的输出,加上-r参数的话,命令的输出则会更具有易读性。 + +-------------------------------------------------------------------------------- + +via: http://www.linuxtechi.com/20-linux-commands-interview-questions-answers/ + +作者:[Pradeep Kumar][a] +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ +[1]: +[2]: +[3]: +[4]: +[5]: +[6]: +[7]: +[8]: +[9]: +[10]: +[11]: +[12]: +[13]: +[14]: +[15]: +[16]: +[17]: +[18]: +[19]: +[20]: 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/translated/tech/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 79% rename from translated/tech/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 index 0c7a0110b1..28cef519f8 100644 --- a/translated/tech/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 @@ -1,13 +1,11 @@ -Linux有问必答 - linux如何安装WPS +Linux有问必答 - 如何在linux上安装WPS ================================================================================ > **问题**: 我听说一个好东西Kingsoft Office(译注:就是WPS),所以我想在我的Linux上试试。我怎样才能安装Kingsoft Office呢? -Kingsoft Office 一套办公套件,支持多个平台,包括Windows, Linux, iOS 和 Android。它包含三个组件:Writer(WPS文字)用来文字处理,Presentation(WPS演示)支持幻灯片,Spereadsheets(WPS表格)为电子表格。使用免费增值模式,其中基础版本是免费使用。比较其他的linux办公套件,如LibreOffice、 OpenOffice,最大优势在于,Kingsoft Office能最好的兼容微软的Office(译注:版权问题?了解下wps和Office的历史问题,可以得到一些结论)。因此如果你需要在windowns和linux平台间交互,Kingsoft office是一个很好的选择。 - +Kingsoft Office 是一套办公套件,支持多个平台,包括Windows, Linux, iOS 和 Android。它包含三个组件:Writer(WPS文字)用来文字处理,Presentation(WPS演示)支持幻灯片,Spereadsheets(WPS表格)是电子表格。其使用免费增值模式,其中基础版本是免费使用。比较其他的linux办公套件,如LibreOffice、 OpenOffice,其最大优势在于,Kingsoft Office能最好的兼容微软的Office(译注:版权问题?了解下wps和Office的历史问题,可以得到一些结论)。因此如果你需要在windows和linux平台间交互,Kingsoft office是一个很好的选择。 ### CentOS, Fedora 或 RHEL中安装Kingsoft Office ### - 在[官方页面][1]下载RPM文件.官方RPM包只支持32位版本linux,但是你可以在64位中安装。 需要使用yum命令并用"localinstall"选项来本地安装这个RPM包 @@ -39,7 +37,7 @@ DEB包同样遇到一堆依赖。因此使用[gdebi][3]命令来代替dpkg来自 ### 启动 Kingsoft Office ### -安装完成后,你就可以在桌面管理器轻松启动Witer(WPS文字), Presentation(WPS演示), and Spreadsheets(WPS表格),如下图 +安装完成后,你就可以在桌面管理器轻松启动Witer(WPS文字), Presentation(WPS演示), and Spreadsheets(WPS表格),如下图。 Ubuntu Unity中: @@ -49,7 +47,7 @@ GNOME桌面中: ![](https://farm9.staticflickr.com/8617/16039583622_4e7c1d8545_b.jpg) -不但如此,你也可以在命令行中启动Kingsoft Office +不但如此,你也可以在命令行中启动Kingsoft Office。 启动Wirter(WPS文字),使用这个命令: @@ -74,7 +72,7 @@ GNOME桌面中: via: http://ask.xmodulo.com/install-kingsoft-office-linux.html 译者:[Vic020/VicYu](http://www.vicyu.net) -校对:[校对者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/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/published/201502/20150104 Auditd--Tool for Security Auditing on Linux Server.md b/published/201502/20150104 Auditd--Tool for Security Auditing on Linux Server.md new file mode 100644 index 0000000000..3e528fffa6 --- /dev/null +++ b/published/201502/20150104 Auditd--Tool for Security Auditing on Linux Server.md @@ -0,0 +1,213 @@ +Auditd - Linux 服务器安全审计工具 +================================================================================ +首先,Linux中国祝贺读者 **2015羊年春节快乐,万事如意!** 。下面开始这个新年版审计工具的介绍。 + +安全防护是首先要考虑的问题。为了避免别人盗取我们的数据,我们需要时刻关注它。安全防护包括很多东西,审计是其中之一。 + +我们知道Linux系统上有一个叫 **auditd** 的审计工具。这个工具在大多数Linux操作系统中是默认安装的。那么auditd 是什么?如何使用呢?下面我们开始介绍。 + +### 什么是审计? ### + +auditd(或 auditd 守护进程)是Linux审计系统中用户空间的一个组件,其负责将审计记录写入磁盘。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/what_is_auditd.png) + +### 安装 auditd ### + +Ubuntu系统中,我们可以使用 [wajig][1] 工具或者 **apt-get 工具** 安装auditd。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/install_auditd.png) + +按照下面的说明安装auditd,安装完毕后将自动安装以下auditd和相关的工具: + +- **auditctl :** 即时控制审计守护进程的行为的工具,比如如添加规则等等。 +- **/etc/audit/audit.rules :** 记录审计规则的文件。 +- **aureport :** 查看和生成审计报告的工具。 +- **ausearch :** 查找审计事件的工具 +- **auditspd :** 转发事件通知给其他应用程序,而不是写入到审计日志文件中。 +- **autrace :** 一个用于跟踪进程的命令。 +- **/etc/audit/auditd.conf :** auditd工具的配置文件。 + +首次安装 **auditd** 后, 审计规则是空的。 + +可以使用以下命令查看: + + $ sudo auditctl -l + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_no_rules.png) + +以下我们介绍如何给auditd添加审计规则。 + +### 如何使用auditd ### + +#### Audit 文件和目录访问审计 #### + +我们使用审计工具的一个基本的需求是监控文件和目录的更改。使用auditd工具,我们可通过如下命令来配置(注意,以下命令需要root权限)。 + +**文件审计** + + $ sudo auditctl -w /etc/passwd -p rwxa + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_w_etc_passwd.png) + +**选项 :** + +- **-w path :** 指定要监控的路径,上面的命令指定了监控的文件路径 /etc/passwd +- **-p :** 指定触发审计的文件/目录的访问权限 +- **rwxa :** 指定的触发条件,r 读取权限,w 写入权限,x 执行权限,a 属性(attr) + +#### 目录审计 #### + +使用类似的命令来对目录进行审计,如下: + + $ sudo auditctl -w /production/ + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_w_production.png) + +以上命令将监控对 **/production 目录** 的所有访问。 + +现在,运行 **auditctl -l** 命令即可查看所有已配置的规则。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_rules.png) + +下面开始介绍审计日志。 + +### 查看审计日志 ### + +添加规则后,我们可以查看 auditd 的日志。使用 **ausearch** 工具可以查看auditd日志。 + +我们已经添加规则监控 /etc/passwd 文件。现在可以使用 **ausearch** 工具的以下命令来查看审计日志了。 + + $ sudo ausearch -f /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 和 gid :** 访问文件的用户ID和用户组ID +- **comm :** 用户访问文件的命令 +- **exe :** 上面命令的可执行文件路径 + +以上审计日志显示文件未被改动。 + +以下我们将要添加一个用户,看看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** 访问的。 + +键入 **man chfn** 可以查看有关chfn更多的信息。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/chfn.png) + +下面我们看另外一个例子。 + +我们已经配置auditd去监控目录 /production/ 了。这是个新目录。所以我们用ausearch去查看日志的时候会发现什么都没有。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/ausearch_production_empty.png) + +下一步,使用root账户的ls命令列出 /production/ 下的文件信息。再次使用ausearch后,将会显示一些信息。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/ausearch_production_ls.png) + +> **time->**Mon Dec 22 14:18:28 2014 +> type=PATH msg=audit(1419232708.344:527): item=0 **name="/production/"** inode=797104 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL +> type=CWD msg=audit(1419232708.344:527): cwd="/root" +> type=SYSCALL msg=audit(1419232708.344:527): arch=40000003 syscall=295 success=yes exit=3 a0=ffffff9c a1=95761e8 a2=98800 a3=0 items=1 ppid=3033 pid=3444 **auid=4294967295 uid=0 gid=0** euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=4294967295 **comm="ls" exe="/bin/ls"** key=(null) + +和上一个一样,可以得出root账户使用ls命令访问了/production/目录,ls命令的文件目录是 /bin/ls + +### 查看审计报告 ### + +一旦定义审计规则后,它会自动运行。过一段时间后,我们可以看看auditd是如何帮我们跟踪审计的。 + +Auditd提供了另一个工具叫 **aureport** 。从名字上可以猜到, **aureport** 是使用系统审计日志生成简要报告的工具。 + +我们已经配置auditd去跟踪/etc/passwd文件。auditd参数设置后一段时间后,audit.log 文件就创建出来了。 + +生成审计报告,我们可以使用aureport工具。不带参数运行的话,可以生成审计活动的概述。 + + $ sudo aureport + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/aureport_2.png) + +如上,报告包含了大多数重要区域的信息。 + +上图可以看出有 **3 次授权失败**。 使用aureport,我们可以深入查看这些信息。 + +使用以下命令查看授权失败的详细信息: + + $ sudo aureport -au + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/aureport_authentication.png) + +从上图可以看出,由两个用户在特定的时间授权失败。 + +如果我们想看所有账户修改相关的事件,可以使用-m参数。 + + $ sudo aureport -m + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/aureport_m.png) + +### Auditd 配置文件 ### + +我们已经添加如下规则: + +- $ sudo auditctl -w /etc/passwd -p rwxa +- $ sudo auditctl -w /production/ + +现在,如果确信这些规则可以正常工作,我们可以将其添加到**/etc/audit/audit.rules**中使得规则永久有效。以下介绍如何将他们添加到/etc/audit/audit.rules中去。 + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/audit_rules_file.png) + +**最后,别忘了重启auditd守护程序** + + # /etc/init.d/auditd restart + +或 + + # service auditd restart + +![](http://blog.linoxide.com/wp-content/uploads/2014/12/audit_restart.png) + +### 总结 ### + +Auditd是Linux上的一个审计工具。你可以阅读auidtd文档获取更多使用auditd和工具的细节。例如,输入 **man auditd** 去看auditd的详细说明,或者键入 **man ausearch** 去看有关 ausearch 工具的详细说明。 + +**请谨慎创建规则**。太多规则会使得日志文件急剧增大! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/how-tos/auditd-tool-security-auditing/ + +作者:[Pungki Arianto][a] +译者:[shipsw](https://github.com/shipsw) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/pungki/ +[1]:http://linoxide.com/tools/wajig-package-management-debian/ 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/published/201502/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md b/published/201502/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md new file mode 100644 index 0000000000..1b414e71c0 --- /dev/null +++ b/published/201502/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md @@ -0,0 +1,123 @@ +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 中安装和应用新的主题。 + +### 在 GNOME Shell 中安装主题 ### + +要在带有 GNOME 桌面的 Ubuntu 中安装新的主题,你可以使用 Gnome Tweak Tool,它可以在 Ubuntu 软件库中得到。打开一个终端窗口并使用如下命令: + +``` +sudo apt-get install gnome-tweak-tool +``` + +或者,你可以通过把主题放置到 `~/.themes` 目录中来使用。如果你需要,我已经写了一个关于 [如何安装和使用 GNOME shell][2]的具体教程。 + +### 最好的 GNOME Shell 主题 ### + +下面列举的主题都已经在 GNOME Shell 3.10.4 上进行了测试,但对于任何版本的 GNOME 3 或更高的版本,它们应该同样适用。需要指出的是,这些主题并没有按照任何优先顺序排列。下面就让我们看看这些最好的 GNOME 主题: + +#### Numix #### + +![](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] 也不为过。 + +使用下面的命令,在基于 Ubuntu 的发行版本中安装 Numix 主题: + +``` +sudo apt-add-repository ppa:numix/ppa +sudo apt-get update +sudo apt-get install numix-icon-theme-circle +``` + +#### Elegance Colors #### + +![](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 的缩写) 使得你可以轻松安装它: + +``` +sudo add-apt-repository ppa:satyajit-happy/themes +sudo apt-get update +sudo apt-get install gnome-shell-theme-elegance-colors +``` + +#### Moka #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Moka_GNOME_Shell.jpeg) + +[Moka][7] 是另一个迷人的主题,它总是位于美丽的主题列表之中。它是由 Unity Tweak Tool 的开发者所设计。 Moka 是你一定要尝试的主题: + +``` +sudo add-apt-repository ppa:moka/stable +sudo apt-get update +sudo apt-get install moka-gnome-shell-theme +``` + +#### Viva #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Viva_GNOME_Theme.jpg) + +基于 GNOME 的默认主题 Adwaita, Viva 是一个带有黑色和橙色阴影的美丽主题。你可以从下面的链接中下载 Viva: + +- [Download Viva GNOME Shell Theme][8] + +#### Ciliora-Prima #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Ciliora_Prima_Gnome_Shell.jpeg) + +以前它以 Zukitwo Dark 的名字为人们熟知, Ciliora-Prima 是一个拥有方块图标的主题,可使用的三种版本之间彼此略有不同。你可以从下面的链接中下载它们: + +- [Download Ciliora-Prima GNOME Shell Theme][9] + +#### Faience #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Faience_GNOME_Shell_Theme.jpeg) + +Faience 作为一个受欢迎的主题已经有一段时间了。你可以通过下面的 PPA 为 GNOME 3.10 及更高版本安装 Faience: + +``` +sudo add-apt-repository ppa:tiheum/equinox +sudo apt-get update +sudo apt-get install faience-theme +``` + +#### Paper [不完善] #### + +![](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 的最好体验。假如你和我一样,具有一点实验精神,你绝对可以试一试。 + +``` +sudo add-apt-repository ppa:snwh/pulp +sudo apt-get update +sudo apt-get install paper-gtk-theme +``` + +以上就是我的列表。如果你正试着给你的 Ubuntu 换一个不同的模样,你也应该试试这个列表: [Ubuntu 14.04 中最好的图标主题][10]。 + +你是怎样找到这份 **最好的 GNOME shell 主题** 列表的呢?在上面列举的主题中,哪个是你最中意的? 如果它没有在这里列出,请一定在评论中告诉我们哪个是你心目中最好的 GNOME shell 主题 。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/gnome-shell-themes-ubuntu-1404/ + +作者:[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/how-to-install-gnome-in-ubuntu-14-04/ +[2]:http://itsfoss.com/install-switch-themes-gnome-shell/ +[3]:https://numixproject.org/ +[4]:http://itsfoss.com/numix-linux-distribution/ +[5]:http://itsfoss.com/new-beautiful-linux-2015/ +[6]:http://satya164.deviantart.com/art/Gnome-Shell-Elegance-Colors-305966388 +[7]:http://mokaproject.com/ +[8]:https://github.com/vivaeltopo/gnome-shell-theme-viva +[9]:http://zagortenay333.deviantart.com/art/Ciliora-Prima-Shell-451947568 +[10]:http://itsfoss.com/best-icon-themes-ubuntu-1404/ 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/published/201502/20150114 Why Mac users don't switch to Linux.md b/published/201502/20150114 Why Mac users don't switch to Linux.md new file mode 100644 index 0000000000..6125a676a4 --- /dev/null +++ b/published/201502/20150114 Why Mac users don't switch to Linux.md @@ -0,0 +1,81 @@ +为什么 Mac 用户不选择 Linux +================================================================================ +Linux 与 Mac 用户至少有一个共同点:他们都不太喜欢用 Windows。但除了这点外,二者再也无法达成其他共识,只得分道扬镳。为什么 Mac 用户不选择 Linux 呢?是什么因素致使 Mac 用户做出了这种选择的? + +[Datamation 就此问题做了一番调查][1],并试图进行解答。Datamation 的结论是,所有原因都只归结于众多应用及工作流程,而非操作系统的关系: + +> …某些事例表明,尝试用新应用代替现有应用,并不是很实际 - 对工作流程和整体实用性来说都是如此。但不幸的是,苹果在这些方面做得非常好。因此,在几乎不可能改变这些事实的情况下,想要拉拢那些 Mac忠实用户实在是很大的挑战。 + +> 不过老实来说,除了 Web 开发者,我还没见过 Mac 用户仅仅为了避免升级到 OS X Yosemite 而 “ +en masse”(法语:共同,一起) 尝试变更他们的工作流程。诚然,经历过 Yosemite 更新后 - 考虑过权限的用户应该会发现这方面已经变得非常令人讨厌。并且,OS X 除了在 UI 方面的微小变化,几乎没有改变,针对现有 Mac 用户的核心工作流程也在最大程度上保持了原样。 + +> 但,我相信 Linux 在未来将会继续保持多样化特点。Linux 会继续成长,但绝不是经过精确计量般得一成不变。 + +我大体上同意 Datamation 关于应用和工作流程重要性的结论,在选择操作系统时这两方面是必须要考虑顾及的。但我认为对 Mac 用户来说,选择 Mac 有比这两方面更重要的因素。我相信是不同的心态造就了 Linux 和 Mac 用户,并且我认为这才是为什么 Mac 用户不选择 Linux 的真实原因。 + +![](http://jimlynch.com/wp-content/uploads/2015/01/mac-users-switch-to-linux.jpeg) + +### 控制权才是 Linux 用户最看重的地方 ### +Linux 用户倾向于控制电脑上的所有细节,他们试图作出一切能做的努力使操作系统变成他们想要的样子。但这种方式并不适用于 OS X 以及其他任何苹果的产品。如果你使用了苹果的产品,就意味着绝大多数情况下,你只能按照苹果预先设定的模式来使用它们。 + +对 Mac(以及 iOS)用户来说这没什么,因为他们似乎并不在乎生活在苹果那围墙高筑的花园里,仅仅使用那些苹果给予他们的标准和选择。但这对绝大多数 Linux 用户来说是完全不能接受的。Linux 的新用户通常来自 Windows,正是从那里,他们开始厌恶那些告诉他们什么才叫操作系统,并试图限制操作系统权限的东西。 + +自从他们尝到使用自由的 Linux 系统所带来的甜头之后,他们就再也不会回到苹果或者微软的监牢里去了。即使在他们死后,把 Linux 从他们那冰冷僵硬的手指中撬出来,他们也不会接受苹果和微软为他们定制的操作系统。 + +但绝大部分 Mac 用户不会有这样的意志和决心。对他们来说当苹果升级 OS X 时放弃他们现有的习惯方式是非常容易的。在苹果那围墙高筑的花园里,即使他们不满意苹果的变化,他们也会迅速地接受。 + +因此,对控制权的渴望是 Mac 用户与 Linux 用户的最大不同。但我并未把它视为一个问题,尽管这反映出使用电脑的两类用户截然不同的态度。 + +### Mac 用户离不开苹果的技术支持 ### + +Linux 用户与 Mac 用户的区别也体现在 Linux 用户并不介意亲自维护自己的电脑。虽然维护电脑及控制操作系统都是很大的责任,但 Linux 用户还是愿意独自承担,愿意通过自己的力量使他们的系统工作得更棒更有效率,并且深入了解操作系统是每一位 Linux 用户都乐衷的事情。 + +当 Linux 用户遇到问题时,他们会迅速地尝试自己来解决问题。如果这不奏效的话,他们会在网上搜索其他Linux用户的解决方案,并不断进行尝试,直到问题解决。 + +但 Mac 用户却不大会这样。这也许是为什么苹果零售店如此火爆、为什么如此多的 Mac 用户在拿到新 Mac 的时候会选择购买苹果维护服务的原因。Mac 用户会很轻易得带着 TA 的电脑去苹果零售店,走进天才吧并要求苹果的工作人员为其查看和修复电脑。 + +绝大多数 Linux 用户连想都不会想这种事情。谁会愿意让一个你都不认识的家伙碰你的电脑并维修它呢? + +因此对 Mac 用户来说,很难抛弃过去可以从苹果那里得到的技术支持,转而使用 Linux。这种选择会令某些 Mac 用户觉得自己的电脑将变得非常脆弱、容易被攻击,他们如同离开母亲怀抱的婴儿般充满了无助感。 + +### Mac 用户喜爱苹果的硬件 ### + +Datamation 发表的文章中主要研究了软件方面的原因,但我认为硬件因素同样对 Mac 用户有很大影响。绝大部分 Mac 用户非常喜爱苹果的硬件。TA 们购买 Mac 并不仅仅是为了 OS X。苹果那精美的工艺设计也是 Mac 用户购买时着重考虑的一点。Mac 用户愿意支付高价购买电脑,因为他们认为这样绝对是物有所值的。 + +另一方面,Linux 用户似乎并不会考虑这些东西。我认为他们更关注电脑的花费,而不太在意电脑的外观和设计。对他们来说,花费最少的金钱来获取尽可能好的硬件才是最重要的。他们并不像 Mac 用户一样热衷于电脑的外观,因此这一点并不是他们在购买电脑时考虑的地方。 + +我认为对于硬件的两种不同观点是没有高低之分的。这仅仅和用户的不同需求有关,仅仅会在他们购买电脑时影响他们,或者对某些 Linux 用户来说只是因为他们想要自己组装电脑而已。两种观点只是因为出发点不同、对于电脑的真正价值体现所在之处的理解不同罢了。 + +当然[在 Mac 上运行 Linux 是可能的][2],直接运行或者间接地通过虚拟机运行。因此真心喜欢苹果硬件的 Mac 用户是可以选择在 Mac 上安装 Linux 的。 + +### Linux 发行版太多了不知道选哪个? ### + +另一个让 Mac 用户无法选择 Linux 的原因是:要从众多 Linux 发行版当中选择一个实在是太困难了。在大多数 Linuxer 并不抗拒的多元化发行版时代,没有相关知识的 Mac 用户会对如何选择感到十分困惑。 + +我认为,随着时间的推移,Mac 用户可以学习并找出最适合自己的发行版。但在短时间内,尤其是长时期得使用 OS X 之后,这是一个艰巨的任务。我不认为这个问题是无法克服的,但却有必要在这里提一下。 + +当然我们可以给大家提供资源,推荐参考 [DistroWatch][3] 还有我们的博客 [Desktop Linux Reviews][4],这都有助于 Mac 用户找到适合的 Linux 发行版。再说一条,网上有很多诸如“最好的 Linux 发行版”等类似的文章,当 Mac 用户想要寻找适合自己使用的发行版时可以参考一下。 + +但有苹果顾客购买 Mac 的其中一个原因是苹果硬件软件协调统一起来的简便性和易用性。所以我不确定有多少 Mac 用户愿意花费时间找出适合自己的 Linux 发行版。也许是否要使用 Linux 确实会令TA们考虑一阵子了。 + +### Mac 用户是苹果,Linux 用户是橘子 ### + +Mac 用户与 Linux 用户分道扬镳我认为并没有什么不妥。我认为我们只是在谈论两类完全不同的人群,这是一件好事,因为两类人群都在按自己喜欢的方式去使用操作系统和软件。让 Mac 用户和 Linux 用户各自沉浸在 OS X 和 Linux 中吧,希望他们都能高兴,都能对自己的电脑满意。 + +也许 Mac 用户会偶然走入 Linux 的世界并开始转向 Linux,但我认为绝大多数时候,两类人都愿意呆在不同的世界并不与对方接触。通常来说我并不会随意比较二者,尤其是你已经自己拿定主意的时候,况且这只不过是选苹果还是选橘子的问题罢了。 + +-------------------------------------------------------------------------------- + +via: http://jimlynch.com/linux-articles/why-mac-users-dont-switch-to-linux/ + +作者:[Jim Lynch][a] +译者:[Stevearzh](https://github.com/Stevearzh) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://jimlynch.com/author/Jim/ +[1]:http://www.datamation.com/open-source/why-linux-isnt-winning-over-mac-users-1.html +[2]:http://www.howtogeek.com/187410/how-to-install-and-dual-boot-linux-on-a-mac/ +[3]:http://distrowatch.com/ +[4]:http://desktoplinuxreviews.com/ 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/translated/tech/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 70% rename from translated/tech/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 index 34923b5ec3..55866282e8 100644 --- a/translated/tech/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 @@ -1,8 +1,9 @@ -如何在Linux/类Unix系统中解压tar文件到不同的目录中 +如何解压 tar 文件到不同的目录中 ================================================================================ -我想要解压一个tar文件到一个指定的目录叫/tmp/data。我该如何在Linux或者类Unix的系统中使用tar命令解压一个tar文件到不同的目录中? -你不必使用cd名切换到其他的目录并解压。可以使用下面的语法解压一个文件: +我想要解压一个tar文件到一个叫/tmp/data的指定目录。我该如何在Linux或者类Unix的系统中使用tar命令解压一个tar文件到不同的目录中? + +你不必使用cd命令切换到其他的目录并解压。可以使用下面的语法解压一个文件: ### 语法 ### @@ -16,9 +17,9 @@ GNU/tar 语法: tar xf file.tar --directory /path/to/directory -### 示例:解压文件到另一个文件夹中 ### +### 示例:解压文件到另一个目录中 ### -在本例中。我解压$HOME/etc.backup.tar到文件夹/tmp/data中。首先,你需要手动创建这个目录,输入: +在本例中。我解压$HOME/etc.backup.tar到/tmp/data目录中。首先,需要手动创建这个目录,输入: mkdir /tmp/data @@ -34,7 +35,7 @@ GNU/tar 语法: ![Gif 01: tar Command Extract Archive To Different Directory Command](http://s0.cyberciti.org/uploads/faq/2015/01/tar-extract-archive-to-dir.gif) -Gif 01: tar命令解压文件到不同的目录 +*Gif 01: tar命令解压文件到不同的目录* 你也可以指定解压的文件: @@ -56,8 +57,8 @@ via: http://www.cyberciti.biz/faq/howto-extract-tar-file-to-specific-directory-o 作者:[nixCraft][a] 译者:[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/) 荣誉推出 -[a]:http://www.cyberciti.biz/tips/about-us \ No newline at end of file +[a]:http://www.cyberciti.biz/tips/about-us diff --git a/published/201502/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 new file mode 100644 index 0000000000..0ed031e342 --- /dev/null +++ b/published/201502/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md @@ -0,0 +1,58 @@ +在 Ubuntu 14.04 中Apache从2.2迁移到2.4的问题 +================================================================================ +如果你将**Ubuntu**从12.04升级跨越到了14.04,那么这其中包括了一个重大的升级--**Apache**从2.2版本升级到2.4版本。**Apache**的这次升级带来了许多性能提升,**但是如果继续使用2.2的配置文件会导致很多错误**。 + +### 访问控制的改变 ### + +从**Apache 2.4**起,所启用的授权机制比起2.2的只是针对单一数据存储的单一检查更加灵活。过去很难确定哪个 order 授权怎样被使用的,但是授权容器指令的引入解决了这些问题,现在,配置可以控制什么时候授权方法被调用,什么条件决定何时授权访问。 + +这就是为什么大多数的升级失败是由于配置错误的原因。2.2的访问控制是基于IP地址、主机名和其他角色,通过使用指令Order,来设置Allow, Deny或 Satisfy;但是2.4,这些一切都通过新的授权方式进行检查。 + +为了弄清楚这些,可以来看一些虚拟主机的例子,这些可以在/etc/apache2/sites-enabled/default 或者 /etc/apache2/sites-enabled/*你的网站名称* 中找到: + +旧的2.2虚拟主机配置: + + Order allow,deny + Allow from all + +新的2.4虚拟主机配置: + + Require all granted + +![apache 2.4 config](http://blog.linoxide.com/wp-content/uploads/2014/12/apache-2.4-config.jpg) + +(LCTT 译注:Order、Allow和deny 这些将在之后的版本废弃,请尽量避免使用,Require 指令已可以提供比其更强大和灵活的功能。) + +### .htaccess 问题 ### + +升级后如果一些设置不工作,或者你得到重定向错误,请检查是否这些设置是放在.htaccess文件中。如果Apache 2.4没有使用 .htaccess 文件中的设置,那是因为在2.4中AllowOverride指令的默认是 none,因此忽略了.htaccess文件。你只需要做的就是修改或者添加AllowOverride All命令到你的网站配置文件中。 + +上面截图中,可以看见AllowOverride All指令。 + +### 丢失配置文件或者模块 ### + +根据我的经验,这次升级带来的另一个问题就是在2.4中,一些旧模块和配置文件不再需要或者不被支持了。你将会收到一条“Apache不能包含相应的文件”的明确警告,你需要做的是在配置文件中移除这些导致问题的配置行。之后你可以搜索和安装相似的模块来替代。 + +### 其他需要了解的小改变 ### + +这里还有一些其他的改变需要考虑,虽然这些通常只会发生警告,而不是错误。 + +- MaxClients重命名为MaxRequestWorkers,使之有更准确的描述。而异步MPM,如event,客户端最大连接数不等于工作线程数。旧的配置名依然支持。 +- DefaultType命令无效,使用它已经没有任何效果了。如果使用除了 none 之外的其它配置值,你会得到一个警告。需要使用其他配置设定来替代它。 +- EnableSendfile默认关闭 +- FileETag 现在默认为"MTime Size"(没有INode) +- KeepAlive 只接受“On”或“Off”值。之前的任何不是“Off”或者“0”的值都被认为是“On” +- 单一的 Mutex 已经替代了 Directives AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex 和 WatchdogMutexPath 等指令。你需要做的是估计一下这些被替代的指令在2.2中的使用情况,来决定是否删除或者使用Mutex来替代。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/apache-migration-2-2-to-2-4-ubuntu-14-04/ + +作者:[Adrian Dinu][a] +译者:[Vic020/VicYu](http://vicyu.net) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/adriand/ +[1]:http://httpd.apache.org/docs/2.4/ 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/published/201502/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 new file mode 100644 index 0000000000..df7266a7a1 --- /dev/null +++ b/published/201502/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md @@ -0,0 +1,174 @@ +3种方法来创建轻量、持久化的Xubuntu Linux USB系统盘 +================================================================================ + +### 使用Universal USB Install创建持久化USB Xubuntu系统盘 ### + +![](http://f.tqn.com/y/linux/1/S/2/J/1/xubuntudesktop.png) + +这个教程为你介绍如何使用Xubuntu Linux创建一个轻量并且[持久化][1]的Linux USB系统盘。 + +> 译者注:持久化Linux USB系统盘(Persistent Linux USB drive),安装在优盘的Linux系统,允许用户保存数据到优盘而不是仅仅将这些修改留在内存中。这些数据可以在重启后恢复并且重新使用,甚至是在其他的机器上面启动也没有关系。一般情况下,持久化系统盘会安装一个压缩过的Linux操作系统。 + +为什么要这样做呢,这里有5个很好的理由: + +1. 你想要在你的电脑上安装一个轻量并且功能完善的Linux版本。 +2. 你的电脑没有硬盘,那么一个Linux USB系统盘就可以让这台电脑摆脱被扔到垃圾堆的命运。 +3. 你想体验一下Linux,但是你却不想花太多的时间去准备。 +4. 你想创建一个USB系统恢复盘,并且在优盘上安装一些特定的应用程序。 +5. 你想要一个可定制的Linux版本,能装在后兜或者挂在钥匙圈上。 + +现在,我们有了充足的理由,那么开始做一些准备工作吧。 + +如果你使用的是Windows: + +1. 下载Xubuntu。 +2. 下载Universal USB Installer。 +3. 插入一个空的优盘。 +4. 使用Universal USB Installer创建一个常驻系统启动盘。 + +如果你使用的是Ubuntu: + +1. 下载Xubuntu。 +2. 使用Ubuntu Startup Creator。 + +如果你使用的是其他版本的Linux: + +1. 下载Xubuntu。 +2. 使用UNetbootin。 + +还有一些场景,可能需要使用命令行,会更难一些,但是上面列的三种应该已经可以满足大部分的情况。 + +### 下载Xubuntu和Universal USB Installer ### + +![](http://f.tqn.com/y/linux/1/S/G/J/1/xubuntuwebsite.JPG) + +访问[Xubuntu网站][2],然后选一个你喜欢的版本下载。 + +目前有两个版本可供使用: + +- [Trusty Tahr (14.04 LTS)][3] +- [Utopic Unicorn (14.10)][4] + +14.04版是一个长期维护的版本,维护周期会持续3年。14.10是最新版本,但是只提供9个月的维护。 + +你选择了下载站点以后,会提示你选择32位版本或者64位版本。如果你的电脑是32位,就选32位版本,同样,如果你的电脑是64位,那就选64位版本。 + +[点击这里,有一个教程来教你辨别你的电脑是32位还是64位][5]。 + +可以从[Pendrive Linux网站][6]下载Universal USB Installer,点击download链接,过一会下载页面就会弹出来了。 + +### 使用Universal USB Installer创建一个Xubuntu启动优盘 ### + +![](http://f.tqn.com/y/linux/1/S/-/J/1/uui1l.JPG) + +下载完Universal USB Installer和Xubuntu以后,运行Universal USB Installer,出现安全警告时,点击“Accept”。 + +Universal USB Installer用来创建一个持久化的Xubuntu启动优盘。 + +第一屏是许可协议。点击“I Agree”继续。 + +![](http://f.tqn.com/y/linux/1/S/0/J/1/uui2l.JPG) + +Universal USB Installer主界面出现以后,从下拉列表中选择你想要的配置(i.e Xubuntu),第二步,点击“Browse”选择你下载的ISO文件的路径。 + +在电脑上插入一个空的优盘,然后选中“Showing all drives”复选框。 + +在下拉列表中选中你的优盘(一定要确定选的是正确的盘符哦)。如果优盘不是空的,选中格式化复选框。 + +> 注:格式化优盘会清除优盘上的所有数据,首先一定要确认是否以及备份过相关的数据。 + +在第四步中选择用于保存“持久化”系统数据的存储空间大小。 + +点击“Create”按钮继续。 + +![](http://f.tqn.com/y/linux/1/S/1/J/1/uu3l.JPG) + +最后一个界面提示你如果点击“Yes”,那么将会直接应用你的配置。 + +这是停止安装的最后一个机会,一定要确定你选了正确的优盘盘符,并且优盘上没有需要备份的其他文件。 + +点击“Yes”,然后耐心等待优盘创建完成。 + +> 注:创建持久化保存空间会花费一些时间,并且这时候进度条不会继续滚动。 + +这个过程完成以后,重启电脑,如果从优盘启动,就会加载Xubuntu。 + +### 使用Ubuntu的Startup Disk Creator创建Xubuntu启动优盘 ### + +![](http://f.tqn.com/y/linux/1/S/H/J/1/ubuntustartupdiskcreator.png) + +如果你已经安装了Ubuntu,那么创建持久化USB Xubuntu系统盘的最简单的办法就是使用Startup Disk Creator。 + +按下超级键(Windows键),打开Dash,搜索“Startup Disk Creator”,图标出现以后点击它。 + +如果你对Ubuntu Dash不太熟悉,你可以[点击这里,查看一个完整的教程][7]。 + +Startup Disk Creator使用起来很简单。 + +界面被划分成两个部分。上部分指定下载的系统盘路径,下部分指定安装的优盘。 + +首先,点击“Other”按钮,第二步,选择你所下载的Xubuntu ISO文件。 + +然后插入优盘,点击“Erase”按钮清除优盘数据。 + +> 注:点击“Erase”会删除优盘中所有的数据,记得先备份数据。 + +选中“Stored in reserved extra sapce”单选按钮,然后拖动“How much”来确定你想要用来存储“持久化”数据的空间。 + +点击“Make Startup Disk”。 + +你创建的过程中,你可能需要输入几次你的系统密码,USB系统盘创建完成以后,你就可以使用它启动到Xubuntu了。 + +### 使用UNetbootin创建持久化的Xubuntu系统盘 ### + +![](http://f.tqn.com/y/linux/1/S/I/J/1/unetbootin1.png) + +我要介绍的最后一个工具是UNetbootin,这个工具在Windows和Linux上都可以使用。 + +个人来说,在Windows系统上面我喜欢用Universal USB Installer,但Linux的话,UNetbootin更合适一些。 + +> 注:UNetbootin并不是100%完美的,不是所有的Linux发行版都支持。 + +Windows平台可以点击[这里][8]下载UNetbootin。 + +Linux平台可以使用package manager安装UNetbootin。 + +确认你的优盘已经连接到电脑上,确认优盘已经格式化,并且在优盘上没有其他的数据。 + +在Windows平台上运行UNetbootin只需要双击可执行程序即可,在Linux运行的话则需要提升权限。 + +在Linux上如何运行取决于你使用的是何种桌面环境以及Linux发行版。从命令行运行的话,输入下列命令: + +> sudo unetbootin + +UNetbootin的界面分为两个部分。你可以在上半部分选择一个Linux发行版,然后下载它,如果已经下载了某个发行版,可以在下半部分选择已经下载的系统盘。 + +点击“Diskimage”单选框,然后点击三个点的按钮。找到已经下载的Xubuntu ISO文件。路径会显示到按钮旁边的文本框里面。 + +设置“Space used to preserve files across reboots”的值,来指定你想要用来存储“持久化”数据的空间大小。 + +类型选择USB drive,然后选择优盘的盘符。 + +点击“OK”来创建一个持久化Xubuntu启动优盘。 + +创建的过程要花一些时间,创建完成以后,你就可以通过优盘启动到Xubuntu系统了。 + +如果你想要创建一个支持UEFI的Xubuntu启动优盘,[照着这个教程来做][8],只需要把Ubuntu ISO替换为Xubuntu ISO就可以了。 + +via : http://linux.about.com/od/howtos/ss/How-To-Create-A-Persistent-Bootable-Xubuntu-Linux-USB-Drive.htm + +作者:[Gary Newell][a] +译者:[zhouj-sh](https://github.com/Zhouj-sh) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linux.about.com/bio/Gary-Newell-132058.htm +[1]:http://www.pendrivelinux.com/what-is-persistent-linux/ +[2]:http://xubuntu.org/getxubuntu/ +[3]:http://www.dedoimedo.com/computers/xubuntu-trusty.html +[4]:http://www.dedoimedo.com/computers/xubuntu-utopic.html +[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 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/published/201502/20150121 If a 32-bit integer overflows.md b/published/201502/20150121 If a 32-bit integer overflows.md new file mode 100644 index 0000000000..30687f4bc8 --- /dev/null +++ b/published/201502/20150121 If a 32-bit integer overflows.md @@ -0,0 +1,96 @@ +如果使用32位整型会溢出,那么是否可以使用一个40位结构体代替64位长整型? +====== + +###问题: + +假如说,使用32位的整型会溢出,在不考虑使用长整型的情况下,如果我们只需要表示2的40次方范围内的数,是否可以利用某些40位长的数据类型来表示呢?这样的话,每个整型数就可以节省24位的空间。 + +如果可以,该怎么做? + +需求是:我现在必须处理数以亿计的数字,所以在存储空间上受到了很大的限制。 + +###回答: + +可以是可以,但是…… + +这种方法的确可行,但这么做通常没什么意义(因为几乎没有程序需要处理多达十亿的数字): + +```C +#include // 不要考虑使用long long类型 +struct bad_idea +{ + uint64_t var : 40; +}; +``` + +在这里,变量var占据40位大小,但是这是以生成代码时拥有非常低的运行效率来换取的(事实证明“非常”二字言过其实了——测试中程序开销仅仅增加了1%到2%,正如下面的测试时间所示),而且这么做通常没什么用。除非你还需要保存一个24位的值(或者是8位、16位的值),这样你皆可以它们放到同一个结构中。不然的话,因为对齐内存地址产生的开销会抵消这么做带来的好处。 + +在任何情况下,除非你是真的需要保存数以亿计的数字,否则这样做给内存消耗带来的好处是可以忽略不计的(但是为了处理这些位字段的额外代码量是不可忽略的!)。 + +###说明: + +在此期间,这个问题已经被更新了,是为了说明实际上确实有需要处理数以亿计数字的情况。假设,采取某些措施来防止因为结构体对齐和填充抵消好处(比如在后24位中存储其它的内容,或者使用多个8位来存储40位),那么这么做就变得有意义了。 + +如果有十亿个数,每个数都节省三个字节的空间,那么这么做就非常有用了。因为使用更小的空间存储要求更少的内存页,也就会产生更少的cache和TLB不命中和内存缺页(单个缺页会产生数以千万计的指令 [译者注:直译是这样,但语义说不通!])。 + +尽管上面提到的情况不足以充分利用到剩余的24位(它仅仅使用了40位部分),如果确实在剩余位中放入了有用的数据,那么使用类似下面的方法会使得这种思路就管理内存而言显得非常有用。 + +```C +struct using_gaps +{ + uint64_t var : 40; + uint64_t useful_uint16 : 16; + uint64_t char_or_bool : 8; +}; +``` + +结构体大小和对齐长度等于64位整型的大小,所以只要使用得当就不会浪费空间,比如对一个保存10亿个数的数组使用这个结构(不考虑使用指定编译器的扩展)。如果你不会用到一个8位的值,那么你可以使用一个48位和16位的值(giving a bigger overflow margin)。 + +或者以牺牲可用性为代价,把8个64位的值放入这样的结构体中(或者使用40和64的组合使得其和满足320)。当然,在这种情况下,通过代码去访问数组结构体中的元素会变得非常麻烦(尽管一种方法是实现一个operator[]在功能上还原线性数组,隐藏结构体的复杂性)。 + +###更新: + +我写了一个快速测试工具,只是为了获得位字段的开销(以及伴随位字段引用的重载操作)。由于长度限制将代码发布在gcc.godbolt.org上,在本人64位Win7上的测试结果如下: + +```TXT +运行测试的数组大小为1048576 +what alloc seq(w) seq(r) rand(w) rand(r) free +----------------------------------------------------------- +uint32_t 0 2 1 35 35 1 +uint64_t 0 3 3 35 35 1 +bad40_t 0 5 3 35 35 1 +packed40_t 0 7 4 48 49 1 + +运行测试的数组大小为16777216 +what alloc seq(w) seq(r) rand(w) rand(r) free +----------------------------------------------------------- +uint32_t 0 38 14 560 555 8 +uint64_t 0 81 22 565 554 17 +bad40_t 0 85 25 565 561 16 +packed40_t 0 151 75 765 774 16 + +运行测试的数组大小为134177228 +what alloc seq(w) seq(r) rand(w) rand(r) free +----------------------------------------------------------- +uint32_t 0 312 100 4480 4441 65 +uint64_t 0 648 172 4482 4490 130 +bad40_t 0 682 193 4573 4492 130 +packed40_t 0 1164 552 6181 6176 130 +``` + +我们看到,位字段的额外开销是微不足道的,但是当以友好的方式线性访问数据时伴随位字段引用的操作符重载产生的开销则相当显著(大概有3倍)。在另一方面,随机访问产生的开销则无足轻重。 + +这些时间表明简单的使用64位整型会更好,因为它们在整体性能上要比位字段好(尽管占用更多的内存),但是显然它们并没有考虑随着数据集增大带来的缺页开销。一旦程序内存超过RAM大小,结果可能就不一样了(未亲自考证)。 + +------ + +via:[stackoverflow](http://stackoverflow.com/questions/27705409/if-a-32-bit-integer-overflows-can-we-use-a-40-bit-structure-instead-of-a-64-bit/27705562#27705562) + +作者:[Damon][a][Michael Kohne][b] +译者:[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/572743/damon +[b]:http://stackoverflow.com/users/5801/michael-kohne \ No newline at end of file diff --git a/published/201502/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 new file mode 100644 index 0000000000..adecdd2520 --- /dev/null +++ b/published/201502/20150121 Linux FAQs with Answers--How to check disk space on Linux with df command.md @@ -0,0 +1,157 @@ +在 Linux 下你所不知道的 df 命令的那些功能 +================================================================================ +> **问题**: 我知道在Linux上我可以用df命令来查看磁盘使用空间。你能告诉我df命令的实际例子使我可以最大限度得利用它吗? + +对于磁盘存储方面,有很多命令行或基于GUI的工具,它可以告诉你关于当前磁盘空间的使用情况。这些工具用各种人们可读的格式展示磁盘利用率的详细信息,比如易于理解的总结,详细的统计信息或直观的[可视化报告][1]。如果你只想知道不同文件系统有多少空闲的磁盘空间,那么df命令可能是你所需要的。 + +![](https://farm9.staticflickr.com/8632/15505309473_51bffec3f1_b.jpg) + +df命令可以展示任何“mounted”文件系统的磁盘利用率。该命令可以用不同的方式调用。这里有一些**有用的** df **命令例子**. + +### 用人们可读的方式展示 ### + +默认情况下,df命令用1K为块来展示磁盘空间,这看起来不是很直观。“-h”参数使df用更可读的方式打印磁盘空间(例如 100K,200M,3G)。 + + $ df -h + +---------- + + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/ubuntu-root 909G 565G 299G 66% / + none 4.0K 0 4.0K 0% /sys/fs/cgroup + udev 3.9G 4.0K 3.9G 1% /dev + tmpfs 785M 1.2M 784M 1% /run + none 5.0M 0 5.0M 0% /run/lock + none 3.9G 63M 3.8G 2% /run/shm + none 100M 48K 100M 1% /run/user + /dev/sda1 228M 98M 118M 46% /boot + +### 展示Inode使用情况 ### + +当你监视磁盘使用情况时,你必须注意的不仅仅是磁盘空间还有“inode”的使用情况。在Linux中,inode是用来存储特定文件的元数据的一种数据结构,在创建一个文件系统时,inode的预先定义数量将被分配。这意味着,**一个文件系统可能耗尽空间不只是因为大文件用完了所有可用空间,也可能是因为很多小文件用完了所有可能的inode**。用“-i”选项展示inode使用情况。 + + $ df -i + +---------- + + Filesystem Inodes IUsed IFree IUse% Mounted on + /dev/mapper/ubuntu-root 60514304 1217535 59296769 3% / + none 1004417 13 1004404 1% /sys/fs/cgroup + udev 1000623 552 1000071 1% /dev + tmpfs 1004417 608 1003809 1% /run + none 1004417 11 1004406 1% /run/lock + none 1004417 288 1004129 1% /run/shm + none 1004417 28 1004389 1% /run/user + /dev/sda1 124496 346 124150 1% /boot + +### 展示磁盘总利用率 ### + +默认情况下, df命令显示磁盘的单个文件系统的利用率。如果你想知道的所有文件系统的总磁盘使用量,增加“ --total ”选项(见最下面的汇总行)。 + + $ df -h --total + +---------- + + Filesystem Size Used Avail Use% Mounted on + /dev/mapper/ubuntu-root 909G 565G 299G 66% / + none 4.0K 0 4.0K 0% /sys/fs/cgroup + udev 3.9G 4.0K 3.9G 1% /dev + tmpfs 785M 1.2M 784M 1% /run + none 5.0M 0 5.0M 0% /run/lock + none 3.9G 62M 3.8G 2% /run/shm + none 100M 48K 100M 1% /run/user + /dev/sda1 228M 98M 118M 46% /boot + total 918G 565G 307G 65% - + +### 展示文件系统类型 ### + +默认情况下,df命令不显示文件系统类型信息。用“-T”选项来添加文件系统信息到输出中。 + + $ df -T + +---------- + + Filesystem Type 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root ext4 952893348 591583292 312882844 66% / + none tmpfs 4 0 4 0% /sys/fs/cgroup + udev devtmpfs 4002492 4 4002488 1% /dev + tmpfs tmpfs 803536 1196 802340 1% /run + none tmpfs 5120 0 5120 0% /run/lock + none tmpfs 4017668 60176 3957492 2% /run/shm + none tmpfs 102400 48 102352 1% /run/user + /dev/sda1 ext2 233191 100025 120725 46% /boot + +### 包含或排除特定的文件系统类型 ### + +如果你想知道特定文件系统类型的剩余空间,用“-t ”选项。你可以多次使用这个选项来包含更多的文件系统类型。 + + $ df -t ext2 -t ext4 + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591583380 312882756 66% / + /dev/sda1 233191 100025 120725 46% /boot + +排除特定的文件系统类型,用“-x ”选项。同样,你可以用这个选项多次来排除多种文件系统类型。 + + $ df -x tmpfs + +### 显示一个具体的挂载点磁盘使用情况 ### + +如果你用df指定一个挂载点,它将报告挂载在那个地方的文件系统的磁盘使用情况。如果你指定一个普通文件(或一个目录)而不是一个挂载点,df将显示包含这个文件(或目录)的文件系统的磁盘利用率。 + + $ df / + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591583528 312882608 66% / + +---------- + + $ df /home/dev + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591583528 312882608 66% / + +### 显示虚拟文件系统的信息 ### + +如果你想显示所有已经存在的文件系统(包括虚拟文件系统)的磁盘空间信息,用“-a”选项。这里,虚拟文件系统是指没有相对应的物理设备的假文件系统,例如,tmpfs,cgroup虚拟文件系统或FUSE文件安系统。这些虚拟文件系统大小为0,不用“-a”选项将不会被报告出来。 + + $ df -a + +---------- + + Filesystem 1K-blocks Used Available Use% Mounted on + /dev/mapper/ubuntu-root 952893348 591578716 312887420 66% / + proc 0 0 0 - /proc + sysfs 0 0 0 - /sys + none 4 0 4 0% /sys/fs/cgroup + none 0 0 0 - /sys/fs/fuse/connections + none 0 0 0 - /sys/kernel/debug + none 0 0 0 - /sys/kernel/security + udev 4002492 4 4002488 1% /dev + devpts 0 0 0 - /dev/pts + tmpfs 803536 1196 802340 1% /run + none 5120 0 5120 0% /run/lock + none 4017668 58144 3959524 2% /run/shm + none 102400 48 102352 1% /run/user + none 0 0 0 - /sys/fs/pstore + cgroup 0 0 0 - /sys/fs/cgroup/cpuset + cgroup 0 0 0 - /sys/fs/cgroup/hugetlb + /dev/sda1 233191 100025 120725 46% /boot + vmware-vmblock 0 0 0 - /run/vmblock-fuse + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/check-disk-space-linux-df-command.html + +译者:[mtunique](https://github.com/mtunique) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://xmodulo.com/visualize-disk-usage-linux.html diff --git a/published/201502/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 new file mode 100644 index 0000000000..70326e249f --- /dev/null +++ b/published/201502/20150122 Linux FAQs with Answers--How to add a cron job on Linux.md @@ -0,0 +1,66 @@ +Linux 有问必答: 如何在Linux中加入cron任务 +================================================================================ +> **提问**: 我想在我的Linux中安排一个计划任务,该任务在固定时间周期性地运行。我该如何在Linux中添加一个cron任务? + +cron是Linux中默认的计划任务。使用cron,你可以安排一个计划(比如:命令或者shell脚本)周期性地运行或者在指定的分钟、小时、天、周、月等特定时间运行。cron在你安排不同的常规维护任务时是很有用的,比如周期性地备份、日志循环、检查文件系统、监测磁盘空间等等。 + +### 从命令行中添加cron任务 ### + +要添加cron任务,你可以使用称为crontab的命令行工具。 + +输入下面的命令会创建一个以当前用户运行的新cron任务。 + + $ crontab -e + +如果你想要以其他用户运行cron任务,输入下面的命令。 + + $ sudo crontab -u -e + +你将会看见一个文本编辑窗口,这里你可以添加或者编辑cron任务。默认使用nono编辑器。 + +![](https://farm9.staticflickr.com/8586/16200331362_1385807ac0_b.jpg) + +每个cron任务的格式如下。 + + <分钟> <小时> <日> <月> <星期> <命令> + +前5个元素定义了任务的计划,最后一个元素是命令或者脚本的完整路径。 + +![](https://farm8.staticflickr.com/7472/16199272841_dffe0b2873_b.jpg) + +下面是一些cron任务示例。 + +- **\* * * * * /home/dan/bin/script.sh**: 每分钟运行。 +- **0 * * * * /home/dan/bin/script.sh**: 每小时运行。 +- **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分钟运行。 + +一旦完成上面的设置步骤后,按下Ctrl+X来保存并退出编辑器。此时,新增的计划任务应该已经激活了。 + +要查看存在的计划任务,使用下面的命令: + + $ crontab -l + +### 从GUI添加计划任务 ### + +如果你在Linux桌面环境中,你可以使用crontab的更加友好的GUI前端来添加或者添加一个cron任务。 + +在Gnome桌面中,有一个Gnome Schedule(gnome-schedule包)。 + +![](https://farm8.staticflickr.com/7484/16015054699_d96f0e9b6a_c.jpg) + +在KDE桌面中,有一个Task Scheduler(kcron包)。 + +![](https://farm8.staticflickr.com/7473/16175298266_825376c901_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/add-cron-job-linux.html + +译者:[geekpi](https://github.com/geekpi) +校对:[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/201502/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 new file mode 100644 index 0000000000..876ee88404 --- /dev/null +++ b/published/201502/20150122 Linux FAQs with Answers--How to check memory usage on Linux.md @@ -0,0 +1,113 @@ +Linux有问必答:如何检查Linux的内存使用状况 +================================================================================ + +>**问题**:我想要监测Linux系统的内存使用状况。有哪些可用的图形界面或者命令行工具来检查当前内存使用情况? + +当涉及到Linux系统性能优化的时候,物理内存是一个最重要的因素。自然的,Linux提供了丰富的选择来监测珍贵的内存资源的使用情况。不同的工具,在监测粒度(例如:全系统范围,每个进程,每个用户),接口方式(例如:图形用户界面,命令行,ncurses)或者运行模式(交互模式,批量处理模式)上都不尽相同。 + +下面是一个可供选择的,但并不全面的图形或命令行工具列表,这些工具用来检查Linux平台中已用和可用的内存。 + +### 1. /proc/meminfo ### + +一种最简单的方法是通过“/proc/meminfo”来检查内存使用状况。这个动态更新的虚拟文件事实上是诸如free,top和ps这些与内存相关的工具的信息来源。从可用/闲置物理内存数量到等待被写入缓存的数量或者已写回磁盘的数量,只要是你想要的关于内存使用的信息,“/proc/meminfo”应有尽有。特定进程的内存信息也可以通过“/proc/\/statm”和“/proc/\/status”来获取。 + + $ cat /proc/meminfo + +![](https://farm8.staticflickr.com/7483/15989497899_bb6afede11_b.jpg) + +### 2. atop ### + +atop命令是用于终端环境的基于ncurses的交互式的系统和进程监测工具。它展示了动态更新的系统资源摘要(CPU, 内存, 网络, 输入/输出, 内核),并且用醒目的颜色把系统高负载的部分以警告信息标注出来。它同样提供了类似于top的线程(或用户)资源使用视图,因此系统管理员可以找到哪个进程或者用户导致的系统负载。内存统计报告包括了总计/闲置内存,缓存的/缓冲的内存和已提交的虚拟内存。 + + $ sudo atop + +![](https://farm8.staticflickr.com/7552/16149756146_893773b84c_b.jpg) + +### 3. free ### + +free命令是一个用来获得内存使用概况的快速简单的方法,这些信息从“/proc/meminfo”获取。它提供了一个快照,用于展示总计/闲置的物理内存和系统交换区,以及已使用/闲置的内核缓冲区。 + + $ free -h + +![](https://farm8.staticflickr.com/7531/15988117988_ba8c6b7b63_b.jpg) + +### 4. GNOME System Monitor ### + +GNOME System Monitor 是一个图形界面应用,它展示了包括CPU,内存,交换区和网络在内的系统资源使用率的较近历史信息。它同时也可以提供一个带有CPU和内存使用情况的进程视图。 + + $ gnome-system-monitor + +![](https://farm8.staticflickr.com/7539/15988118078_279f0da494_c.jpg) + +### 5. htop ### + +htop命令是一个基于ncurses的交互式的进程视图,它实时展示了每个进程的内存使用情况。它可以报告所有运行中进程的常驻内存大小(RSS)、内存中程序的总大小、库大小、共享页面大小和脏页面大小。你可以横向或者纵向滚动进程列表进行查看。 + + $ htop + +![](https://farm9.staticflickr.com/8236/8599814378_de071de408_c.jpg) + +### 6. KDE System Monitor ### + +就像GNOME桌面拥有GNOME System Monitor一样,KDE桌面也有它自己的对口应用:KDE System Monitor。这个工具的功能与GNOME版本极其相似,也就是说,它同样展示了一个关于系统资源使用情况,以及带有每个进程的CPU/内存消耗情况的实时历史记录。 + + $ ksysguard + +![](https://farm8.staticflickr.com/7479/15991397329_ec5d786ffd_c.jpg) + +### 7. memstat ### + +memstat工具对于识别正在消耗虚拟内存的可执行部分、进程和共享库非常有用。给出一个进程识别号,memstat即可识别出与之相关联的可执行部分、数据和共享库究竟使用了多少虚拟内存。 + + $ memstat -p + +![](https://farm8.staticflickr.com/7518/16175635905_1880e50055_b.jpg) + +### 8. nmon ### + +nmon工具是一个基于ncurses系统基准测试工具,它能够以交互方式监测CPU、内存、磁盘I/O、内核、文件系统以及网络资源。对于内存使用状况而言,它能够展示像总计/闲置内存、交换区、缓冲的/缓存的内存,虚拟内存页面换入换出的统计,所有这些都是实时的。 + + $ nmon + +![](https://farm9.staticflickr.com/8648/15989760117_30f62f4aba_b.jpg) + +### 9. ps ### + +ps命令能够实时展示每个进程的内存使用状况。内存使用报告里包括了 %MEM (物理内存使用百分比), VSZ (虚拟内存使用总量), 和 RSS (物理内存使用总量)。你可以使用“--sort”选项来对进程列表排序。例如,按照RSS降序排序: + + $ ps aux --sort -rss + +![](https://farm9.staticflickr.com/8602/15989881547_ca40839c19_c.jpg) + +### 10. smem ### + +[smem][1]命令允许你测定不同进程和用户的物理内存使用状况,这些信息来源于“/proc”目录。它利用“按比例分配大小(PSS)”指标来精确量化Linux进程的有效内存使用情况。内存使用分析结果能够输出为柱状图或者饼图类的图形化图表。 + + $ sudo smem --pie name -c "pss" + +![](https://farm8.staticflickr.com/7466/15614838428_eed7426cfe_c.jpg) + +### 11. top ### + +top命令提供了一个运行中进程的实时视图,以及特定进程的各种资源使用统计信息。与内存相关的信息包括 %MEM (内存使用率), VIRT (虚拟内存使用总量), SWAP (换出的虚拟内存使用量), CODE (分配给代码执行的物理内存数量), DATA (分配给非执行的数据的物理内存数量), RES (物理内存使用总量; CODE+DATA), 和 SHR (有可能与其他进程共享的内存数量)。你能够基于内存使用情况或者大小对进程列表进行排序。 + +![](https://farm8.staticflickr.com/7464/15989760047_eb8d51d9f2_c.jpg) + +### 12. vmstat ### + +vmstat命令行工具显示涵盖了CPU、内存、中断和磁盘I/O在内的各种系统活动的瞬时和平均统计数据。对于内存信息而言,命令不仅仅展示了物理内存使用情况(例如总计/已使用内存和缓冲的/缓存的内存),还同样展示了虚拟内存统计数据(例如,内存页的换入/换出,虚拟内存页的换入/换出) + + $ vmstat -s + +![](https://farm9.staticflickr.com/8582/15988236860_3f142008d2_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/check-memory-usage-linux.html + +译者:[Ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://xmodulo.com/visualize-memory-usage-linux.html \ No newline at end of file diff --git a/published/201502/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 new file mode 100644 index 0000000000..145ef9168e --- /dev/null +++ b/published/201502/20150122 Linux FAQs with Answers--How to set a custom HTTP header in curl.md @@ -0,0 +1,44 @@ +Linux有问必答:如何在curl中设置自定义的HTTP头 +================================================================================ +> **问题**:我正尝试使用curl命令获取一个URL,但除此之外我还想在传出的HTTP请求中设置一些自定义的头部字段。我如何能够在curl中使用自定义的HTTP头呢? + +curl是一个强大的命令行工具,它可以通过网络将信息传递给服务器或者从服务器获取数据。他支持很多的传输协议,尤其是HTTP/HTTPS以及其他诸如FTP/FTPS, RTSP, POP3/POP3S, SCP, IMAP/IMAPS协议等。当你使用curl向一个URL发送HTTP请求的时候,它会使用一个默认只包含必要的头部字段(如:User-Agent, Host, and Accept)的HTTP头。 + +![](https://farm8.staticflickr.com/7568/16225032086_fb8f1c508a_b.jpg) + +在一些个例中,或许你想要在一个HTTP请求中覆盖掉默认的HTTP头或者添加一个新的自定义头部字段。例如,你或许想要重写“HOST”字段来测试一个[负载均衡][1],或者通过重写"User-Agent"字符串来假冒特定浏览器以解决一些访问限制的问题。 + +为了解决所有这些问题,curl提供了一个简单的方法来完全控制传出HTTP请求的HTTP头。你需要的这个参数是“-H” 或者 “--header”。 + +为了定义多个HTTP头部字段,"-H"选项可以在curl命令中被多次指定。 + +例如:以下命令设置了3个HTTP头部字段。也就是说,重写了“HOST”字段,并且添加了两个字段("Accept-Language" 和 "Cookie") + + $ curl -H 'Host: 157.166.226.25' -H 'Accept-Language: es' -H 'Cookie: ID=1234' http://cnn.com + +![](https://farm8.staticflickr.com/7520/16250111432_de39638ec0_c.jpg) + +对于"User-Agent", "Cookie", "Host"这类标准的HTTP头部字段,通常会有另外一种设置方法。curl命令提供了特定的选项来对这些头部字段进行设置: + +- **-A (or --user-agent)**: 设置 "User-Agent" 字段. +- **-b (or --cookie)**: 设置 "Cookie" 字段. +- **-e (or --referer)**: 设置 "Referer" 字段. + +例如,以下两个命令是等效的。这两个命令同样都对HTTP头的"User-Agent"字符串进行了更改。 + + $ curl -H "User-Agent: my browser" http://cnn.com + $ curl -A "my browser" http://cnn.com + +wget是另外一个类似于curl,可以用来获取URL的命令行工具。并且wget也一样允许你使用一个自定义的HTTP头。点击[这里][2]查看wget命令的详细信息。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/custom-http-header-curl.html + +译者:[Ping](http://mr-ping.com) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://xmodulo.com/haproxy-http-load-balancer-linux.html +[2]:http://xmodulo.com/how-to-use-custom-http-headers-with-wget.html \ No newline at end of file diff --git a/published/201502/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 new file mode 100644 index 0000000000..6072c2b759 --- /dev/null +++ b/published/201502/20150125 4 Best Modern Open Source Code Editors For Linux.md @@ -0,0 +1,87 @@ +4个最流行的Linux平台开源代码编辑器 +=== + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Best_Open_Source_Editors.jpeg) + +寻找**Linux平台最棒的代码编辑器**?如果你询问那些很早就玩Linux的人,他们会回答是Vi, Vim, Emacs, Nano等。但是,我今天不讨论那些。我将谈论一些新时代尖端、漂亮、时髦而且十分强大, 功能丰富的**最好的Linux平台开源代码编辑器**,它们将会提升你的编程经验。 + +### Linux平台最时髦的开源代码编辑器 ### + +我使用Ubuntu作为我的主桌面,所以我提供的安装说明是基于Ubuntu的发行版。但是这并不意味着本文列表就是**Ubuntu最好的文本编辑器**,因为本列表是适用于任何Linux发行版。而且,列表的介绍顺序并没有特定的优先级别。 + +#### Brackets #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/brackets_UI.jpeg) + +[Brackets][1]是出自[Adobe][2]的一个开源代码编辑器。它专门关注web设计者的需求,内置支持HTML, CSS和Java Script。它轻量级,但却十分强大,提供在线编辑和实时预览。而且,为了你能更好地体验Brackets,你可以使用许多可用的插件。 + +为了[在Ubuntu][3],以及其它基于Ubuntu的发行版,诸如Linux Minit上安装Brackets,你可以使用这个非官方的PPA源: + + sudo add-apt-repository ppa:webupd8team/brackets + sudo apt-get update + sudo apt-get install brackets + +其他的Linux发行版本,你可以通过下载源代码或相应Linux, OS X和Windows的二进制文件,进行安装。 + +- [下载Brackets源码和二进制文件][5] + +#### Atom #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/Atom_Editor.jpeg) + +[Atom][5]是为程序员准备的另一个时尚开源代码编辑器。Atom由Github开发,被誉为“21世纪可破解的文本编辑器”。Atom的界面和Sublime Text编辑器十分相似。Sublime Text是一个十分流行但闭源的文本编辑器。 + +Atom最近已经发布了 .deb 和 .rpm包,所以在Debian和基于Fedora的Linux版本上安装很简单。当然,你也可以获取它的源代码。 + +- [下载Atom .deb][6] +- [下载Atom .rpm][7] +- [获取Atom源代码][8] + +#### Lime Text ### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/08/LimeTextEditor.jpeg) + +如果你喜欢Sublime Text,但是你对它的闭源十分反感。别担心,我们有一个[Sublime Text的开源克隆][9],叫做[Lime Text][10]。它基于Go, HTML和QT构造。说它是Sublime Text的克隆,背后原因是Sublime Text2仍有许多bug,而且Sublime Text3到目前为止仍处于测试版本。Sublime Text在开发过程中的bug是否修复,外界并不知情。 + +所以,开源爱好者们,你们可以很开心地通过下面的连接获得Lime Text的源码: + +- [获取Lime Text源码][11] + +#### Light Table #### + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Light_Table.jpeg) + +被誉为“下一代的代码编辑器”,[Light Table][12]是另一个时髦,功能丰富的开源编辑器,它更像是一个IDE,而非仅仅是一个文本编辑器。并且,有许多可以提高其性能的扩展方法。内联评价将是你会爱上它的原因。你一定要试用一下看,这样你才会体会它的实用之处。 + +- [获取Light Table的源码][13] + +### 你的选择是什么? ### + +在Linux平台,我们不能只局限于这四种代码编辑器。这份列表仅介绍了一些时髦的,可供程序员使用的编辑器。当然,你也有许多其他的选择,比如[Notepad++的替代品Notepadqq][14]或者[SciTE][15]等等。那么,文中这四个编辑器,你最喜欢哪个呢? + +--- + +via: http://itsfoss.com/best-modern-open-source-code-editors-for-linux/ + +作者:[Abhishek][a] +译者:[su-kaiyao](https://github.com/su-kaiyao) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://itsfoss.com/author/Abhishek/ +[1]:http://brackets.io/ +[2]:http://www.adobe.com/ +[3]:http://itsfoss.com/install-brackets-ubuntu/ +[4]:https://github.com/adobe/brackets/releases +[5]:https://atom.io/ +[6]:https://atom.io/download/deb +[7]:https://atom.io/download/rpm +[8]:https://github.com/atom/atom/blob/master/docs/build-instructions/linux.md +[9]:http://itsfoss.com/lime-text-open-source-alternative/ +[10]:http://limetext.org/ +[11]:https://github.com/limetext/lime +[12]:http://lighttable.com/ +[13]:https://github.com/LightTable/LightTable +[14]:http://itsfoss.com/notepadqq-notepad-for-linux/ +[15]:http://itsfoss.com/scite-the-notepad-for-linux/ diff --git a/published/201502/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 new file mode 100644 index 0000000000..7fff32e713 --- /dev/null +++ b/published/201502/20150126 Ubuntu 15.04 to Integrate Linux Kernel 3.19 Branch Soon.md @@ -0,0 +1,33 @@ +Ubuntu 15.04即将整合Linux内核3.19分支 +---- +*Ubuntu已经开始整合一个新的内核分支* + +![Ubuntu 15.04 shortcuts](http://i1-news.softpedia-static.com/images/news2/Ubuntu-15-04-to-Integrate-Linux-Kernel-3-19-Branch-Soon-471121-2.jpg) + +Linux内核是一个发行版中最重要的组成部分,Ubuntu用户很想知道哪个版本将用于预计几个月后就会发布的15.04分支的稳定版中。 + +Ubuntu和Linux内核开发周期并不同步,所以很难预测最终哪个版本将应用在Ubuntu 15.04中。目前,Ubuntu 15.04(长尾黑颚猴)使用的是Linux内核3.18,但是开发者们已经准备应用3.19分支了。 + +“我们的Vivid的内核仍然基于v3.18.2的上游稳定内核,但是我们很快将重新基于v3.18.3内核开发。我们也将把我们的非稳定版分支的基础变更到v3.19-rc5,然后上传到我们的团队PPA。”Canonical的Joseph Salisbury[说](1)。 + +Linux内核3.19仍然处于开发阶段,预计还要几个星期才会出稳定版本,但是有充足的时间将它加入到Ubuntu中并测试。但是不可能等到3.20分支了,举个例子,即使它能在4月23日前发布。 + +你现在就可以从Softpedia[下载Ubuntu 15.04](2),试用一下。这是一个每日构建版本,会包含发行版中目前已经做出的所有改善。 + +-------------------------------------------------------------------------------- + +via:http://linux.softpedia.com/blog/Ubuntu-15-04-to-Integrate-Linux-Kernel-3-19-Branch-Soon-471121.shtml + +本文发布时间:25 Jan 2015, 20:39 GMT + +作者:[Silviu Stahie][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/silviu-stahie +[1]:https://lists.ubuntu.com/archives/ubuntu-devel/2015-January/038644.html +[2]:http://linux.softpedia.com/get/Linux-Distributions/Ubuntu-Vivid-Vervet-103651.shtml diff --git a/published/201502/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 new file mode 100644 index 0000000000..2b1b9d6631 --- /dev/null +++ b/published/201502/20150127 Bug in Wi-Fi Direct Android Implementation Causes Denial of Service.md @@ -0,0 +1,47 @@ +Android 中的 Wi-Fi 直连方式的 Bug 会导致拒绝服务 +---- + +*Google标记这个问题为低严重性,并不急着修复* + +![Wi-Fi Direct glitch crashes Android](http://i1-news.softpedia-static.com/images/news2/Bug-In-Wi-Fi-Direct-Android-Implementation-Causes-Denial-of-Service-471299-2.jpg) + +Android处理Wi-Fi直连连接的方式中的一个漏洞可以导致在搜索连接节点的时候所连接的设备重启,这个节点可能是其他手机,摄像头,游戏设备,电脑或是打印机等任何设备。 + +Wi-Fi直连技术允许无线设备之间直接建立通信,而不用加入到本地网络中。 + +###安全公司致力于协调修复这个问题 + +这个漏洞允许攻击者发送一个特定的修改过的802.11侦测响应帧给设备,从而因为WiFi监控类中的一个未处理的异常导致设备重启。 + +Core Security通过自己的CoreLabs团队发现了这个瑕疵(CVE-2014-0997),早在2014年9月就汇报给了Google。Google确认了这个问题,却把它列为低严重性,并不提供修复时间表。 + +每次Core Security联系Android安全组要求提供修复时间表的时候都会收到同样的答复。最后一次答复是1月20日,意味着这么长的时间中都没有补丁。在星期一的时候,这家安全公司公布了他们的发现。 + +这家安全公司建立了一个[概念攻击][1]来展示他们研究结果的有效性。 + +根据这个漏洞的技术细节,一些Android设备在收到一个错误的wpa_supplicant事件后可能会进入拒绝服务状态,这些事件让无线驱动和Android平台框架之间的接口有效。 + +###Google并不着急解决这个问题 + +Android安全组对于这个问题的放松态度可能是基于这个原因:这种拒绝服务状态只发生在扫描节点这一小段时间。 + +不仅如此,实际上结果也并不严重,因为它会导致设备重启。不存在数据泄漏的风险或是能引起这个问题的攻击,不会吸引攻击者。但另一方面,不管怎样都应该提供一个补丁,以减轻任何未来的潜在风险。 + +Core Security声称在Android 5.0.1及以上版本中没有测试到这个问题,他们发现的受影响的设备有Android系统4.4.4的Nexus 5和4,运行Android 4.2.2的LG D806和Samsung SM-T310,以及4.1.2版本系统的Motorola RAZR HD。 + +目前,减轻影响的方式是尽量不用Wi-Fi直连,或者升级到没有漏洞的Android版本。 + +-------------------------------------------------------------------------------- + +via:http://news.softpedia.com/news/Bug-In-Wi-Fi-Direct-Android-Implementation-Causes-Denial-of-Service-471299.shtml + +本文发布时间:27 Jan 2015, 09:11 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://www.coresecurity.com/advisories/android-wifi-direct-denial-service diff --git a/published/201502/20150127 Install Jetty Web Server On CentOS 7.md b/published/201502/20150127 Install Jetty Web Server On CentOS 7.md new file mode 100644 index 0000000000..3de2c7d9fb --- /dev/null +++ b/published/201502/20150127 Install Jetty Web Server On CentOS 7.md @@ -0,0 +1,78 @@ +在CentOS 7中安装Jetty服务器 +================================================================================ +[Jetty][1] 是一款纯Java的HTTP **(Web) 服务器**和Java Servlet容器。 通常在更大的网络框架中,Jetty经常用于设备间的通信,而其他Web服务器通常给“人类”传递文件 :D。Jetty是一个Eclipse基金会的免费开源项目。这个Web服务器用于如Apache ActiveMQ、 Alfresco、 Apache Geronimo、 Apache Maven、 Apache Spark、Google App Engine、 Eclipse、 FUSE、 Twitter的 Streaming API 和 Zimbra中。 + +这篇文章会介绍‘如何在CentOS服务器中安装Jetty服务器’。 + +**首先我们要用下面的命令安装JDK:** + + yum -y install java-1.7.0-openjdk wget + +**JDK安装之后,我们就可以下载最新版本的Jetty了:** + + wget http://download.eclipse.org/jetty/stable-9/dist/jetty-distribution-9.2.5.v20141112.tar.gz + +**解压并移动下载的包到/opt:** + + tar zxvf jetty-distribution-9.2.5.v20141112.tar.gz -C /opt/ + +**重命名文件夹名为jetty:** + + mv /opt/jetty-distribution-9.2.5.v20141112/ /opt/jetty + +**创建一个jetty用户:** + + useradd -m jetty + +**改变jetty文件夹的所属用户:** + + chown -R jetty:jetty /opt/jetty/ + +**为jetty.sh创建一个软链接到 /etc/init.d directory 来创建一个启动脚本文件:** + + ln -s /opt/jetty/bin/jetty.sh /etc/init.d/jetty + +**添加脚本:** + + chkconfig --add jetty + +**是jetty在系统启动时启动:** + + chkconfig --level 345 jetty on + +**使用你最喜欢的文本编辑器打开 /etc/default/jetty 并修改端口和监听地址:** + + vi /etc/default/jetty + +---------- + + JETTY_HOME=/opt/jetty + JETTY_USER=jetty + JETTY_PORT=8080 + JETTY_HOST=50.116.24.78 + JETTY_LOGS=/opt/jetty/logs/ + +**我们完成了安装,现在可以启动jetty服务了 ** + + service jetty start + +完成了! + +现在你可以在 **http://\<你的 IP 地址>:8080** 中访问了 + +就是这样。 + +干杯!! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-jetty-web-server-centos-7/ + +作者:[Jijo][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/jijo/ +[1]:http://eclipse.org/jetty/ 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/published/201502/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 new file mode 100644 index 0000000000..110fe965a5 --- /dev/null +++ b/published/201502/20150205 Linux FAQs with Answers--How to install Go language on Linux.md @@ -0,0 +1,96 @@ +如何在Linux中安装Go语言 +================================================================================ +Go (也叫 "golang")是一款由Google最初开发的编程语言。它的诞生有几个设计原则:简单、安全、速度。Go语言发行版拥有各种调试、测试、调优和代码审查工具。如今Go语言和它的工具链在大多数Linux发行版的基础仓库都可用,用默认的包管理器就可以安装。 + +### 在Ubuntu、Debian 或者 Linux Mint上安装Go语言 ### + +下面是在基于Debian的发行版上使用**apt-get**来安装Go语言和它的开发工具。 + + $ sudo apt-get install golang + +检查Go语言的版本来验证安装。 + + $ go version + +---------- + + go version go1.2.1 linux/amd64 + +根据你的需要,你或许想要使用apt-get安装额外的Go工具。 + + $ sudo apt-cache search golang + +![](https://farm8.staticflickr.com/7430/15812762183_f094e3bf92_c.jpg) + +### 在Fedora、CentOS/RHEL中安装Go语言 ### + +下面的命令会在基于Red Hat的发行版中安装Go语言和它的工具。 + + $ sudo yum install golang + +检查Go语言的版本来验证安装。 + + $ go version + +---------- + + go version go1.3.3 linux/amd64 + +根据你的需要,你或许想要使用yum安装额外的Go工具。 + + $ yum search golang + +![](https://farm8.staticflickr.com/7373/16432817805_775010dc18_c.jpg) + +### 从官网安装Go语言 ### + +有时发行版中的go语言版本并不是最新的。为了避免这种情况,你可以从官网安装最新的Go语言。下面是步骤。 + +进入Go语言的[官方源码][1],并下载预编译二进制代码。 + +**对于64位Linux:** + + $ wget https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz + +**对于32位Linux:** + + $ wget https://storage.googleapis.com/golang/go1.4.1.linux-386.tar.gz + +**在/usr/local下安装程序** + + $ sudo tar -xzf go1.4.1.linux-xxx.tar.gz -C /usr/local + +在/etc/profile中添加系统范围的PATH环境变量。 + + $ sudo vi /etc/profile + +---------- + + export PATH=$PATH:/usr/local/go/bin + +如果你在/usr/local之外的自定义位置中安装了Go,你同样需要设置GOROOT环境变量来指向自定义的安装位置。 + + $ sudo vi /etc/profile + +---------- + + export GOROOT=/path/to/custom/location + +检查Go语言的版本 + + $ go version + +---------- + + go version go1.4.1 linux/amd64 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/install-go-language-linux.html + +译者:[geekpi](https://github.com/geekpi) +校对:[Caroline](https://github.com/carolinewuyan) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:https://golang.org/dl/ 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/20150209 Fix Cannot Empty Trash In Ubuntu 14.04 [Quick Tip].md b/published/20150209 Fix Cannot Empty Trash In Ubuntu 14.04 [Quick Tip].md new file mode 100644 index 0000000000..dcc6cb31c4 --- /dev/null +++ b/published/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/20150211 Simple Steps Migration From MySQL To MariaDB On Linux.md b/published/20150211 Simple Steps Migration From MySQL To MariaDB On Linux.md new file mode 100644 index 0000000000..a778240683 --- /dev/null +++ b/published/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/20150215 How to share files between computers over network with btsync.md b/published/20150215 How to share files between computers over network with btsync.md new file mode 100644 index 0000000000..ac280d2ffd --- /dev/null +++ b/published/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/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 66% 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 ccd9a474d5..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,12 +1,10 @@ -Translated by H-mudcup - -Flow 'N Play视频播放器有着独具风格的界面【Ubuntu上的安装】 +在Ubuntu上安装Flow 'N Play—界面独具风格的视频播放器 ================================================================================ -**Flow ‘N Play**是个用Qt编写的新视频播放器。它有着漂亮又简洁的只提供基本播放功能的界面。 +**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月份第一次发行)。其中一个功能就是能通过拖动鼠标滑动视频列表。播放器带有基本功能,一个搜索功能,支持彩色主题。 打开一个新的视频——你还可以在同一个对话框下自定义一个封面: @@ -18,7 +16,7 @@ Flow 'N Play视频播放器有着独具风格的界面【Ubuntu上的安装】 Flow ‘N Play仍然处在早起开发中,因此相对于更高级的播放器它有一些瑕疵。可以设置的选项少,不支持加载字幕或视频和声音的过滤器。目前,在打开一个新的视频时偶尔会出错或是表现异常。 -我相信在它变得能替代其他播放器之前,会先添加几个功能。但从长远来看,Flow ‘N Play很有前途。 +我相信在它变成一款相当不错的播放器来替代其他播放器之前,还需要再添加几个功能。但从长远来看,Flow ‘N Play很有前途。 ### 在Ubuntu 14.04上安装Flow ‘N Play 0.922 ### @@ -28,11 +26,11 @@ Flow ‘N Play仍然处在早起开发中,因此相对于更高级的播放器 sudo apt-get install libqt5multimediaquick-p5 qtdeclarative5-controls-plugin qtdeclarative5 qtmultimedia-plugin qtdeclarative5-qtquick2-plugin qtdeclarative5-quicklayouts-plugin -Then download the DEB package and either double click it or change the working directory to the one where you saved it and type the following in a terminal (for 64-bit, replace the DEB file for 32-bit)然后下载DEB安装包,可以双击或在终端里把正操作的目录换到你保存安装包的目录下并输入以下命令(这个是64位的命令,对于32位的系统请将DEB文件换成32位的): +然后下载DEB安装包,可以双击或在终端里把正操作的目录换到你保存安装包的目录下并输入以下命令(这个是64位的命令,对于32位的系统请将DEB文件换成32位的): sudo dpkg -i flow-n-play_v0.926_qt-5.3.2_x64.deb -然后在终端里输入**flow-n-play**来运行它。注意:为防止产生依赖项错误,当你试图安装DEB问件事你可以运行**sudo apt-get -f install**,这样可以自动获取丢失的依赖项并安装Flow ‘N Play。 +然后在终端里输入**flow-n-play**来运行它。注意:为防止产生依赖项错误,当你试图安装DEB文件时,你可以运行**sudo apt-get -f install**,这样可以自动获取丢失的依赖项并安装Flow ‘N Play。 若用RUN脚本安装,先安装上边提到的依赖项,然后运行这个脚本: @@ -49,7 +47,7 @@ via: http://www.tuxarena.com/2014/11/flow-n-play-movie-player-has-a-stylish-inte 作者:Craciun Dan 译者:[H-mudcup](https://github.com/H-mudcup) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 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/sources/tech/20141204 Linux Namespaces.md b/published/201503/20141204 Linux Namespaces.md similarity index 56% rename from sources/tech/20141204 Linux Namespaces.md rename to published/201503/20141204 Linux Namespaces.md index 6424d8f6a4..c40854d780 100644 --- a/sources/tech/20141204 Linux Namespaces.md +++ b/published/201503/20141204 Linux Namespaces.md @@ -1,33 +1,36 @@ -[bazz2222222222] -Linux Namespaces +介绍 Linux 的命名空间 ================================================================================ -### Background ### +### 背景 ### -Starting from kernel 2.6.24, Linux supports 6 different types of namespaces. Namespaces are useful in creating processes that are more isolated from the rest of the system, without needing to use full low level virtualization technology. +从Linux 2.6.24版的内核开始,Linux 就支持6种不同类型的命名空间。它们的出现,使用户创建的进程能够与系统分离得更加彻底,从而不需要使用更多的底层虚拟化技术。 -- **CLONE_NEWIPC**: IPC Namespaces: SystemV IPC and POSIX Message Queues can be isolated. -- **CLONE_NEWPID**: PID Namespaces: PIDs are isolated, meaning that a virtual PID inside of the namespace can conflict with a PID outside of the namespace. PIDs inside the namespace will be mapped to other PIDs outside of the namespace. The first PID inside the namespace will be '1' which outside of the namespace is assigned to init -- **CLONE_NEWNET**: Network Namespaces: Networking (/proc/net, IPs, interfaces and routes) are isolated. Services can be run on the same ports within namespaces, and "duplicate" virtual interfaces can be created. -- **CLONE_NEWNS**: Mount Namespaces. We have the ability to isolate mount points as they appear to processes. Using mount namespaces, we can achieve similar functionality to chroot() however with improved security. -- **CLONE_NEWUTS**: UTS Namespaces. This namespaces primary purpose is to isolate the hostname and NIS name. -- **CLONE_NEWUSER**: User Namespaces. Here, user and group IDs are different inside and outside of namespaces and can be duplicated. +- **CLONE_NEWIPC**: 进程间通信(IPC)的命名空间,可以将 SystemV 的 IPC 和 POSIX 的消息队列独立出来。 +- **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。 -Let's look first at the structure of a C program, required to demonstrate process namespaces. The following has been tested on Debian 6 and 7. First, we need to allocate a page of memory on the stack, and set a pointer to the end of that memory page. We use **alloca** to allocate stack memory rather than malloc which would allocate memory on the heap. +下面我们介绍一下进程命名空间和网络命名空间。 + +### 进程命名空间 + +本文用 C 语言介绍上述概念,因为演示进程命名空间的时候需要用到 C 语言。下面的测试过程在 Debian 6 和 Debian 7 上执行。首先,在栈内分配一页内存空间,并将指针指向内存页的末尾。这里我们使用 **alloca()** 函数来分配内存,不要用 malloc() 函数,它会把内存分配在堆上。 void *mem = alloca(sysconf(_SC_PAGESIZE)) + sysconf(_SC_PAGESIZE); -Next, we use **clone** to create a child process, passing the location of our child stack 'mem', as well as the required flags to specify a new namespace. We specify 'callee' as the function to execute within the child space: +然后使用 **clone()** 函数创建子进程,传入我们的子栈空间地址 "mem",并指定命名空间的标记。同时我们还指定“callee”作为子进程运行的函数。 mypid = clone(callee, mem, SIGCHLD | CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNS | CLONE_FILES, NULL); -After calling **clone** we then wait for the child process to finish, before terminating the parent. If not, the parent execution flow will continue and terminate immediately after, clearing up the child with it: +**clone** 之后我们要在父进程中等待子进程先退出,否则的话,父进程会继续运行下去,并马上进程结束,留下子进程变成孤儿进程: while (waitpid(mypid, &r, 0) < 0 && errno == EINTR) { continue; } -Lastly, we'll return to the shell with the exit code of the child: +最后当子进程退出后,我们会回到 shell 界面,并返回子进程的退出码。 if (WIFEXITED(r)) { @@ -35,7 +38,7 @@ Lastly, we'll return to the shell with the exit code of the child: } return EXIT_FAILURE; -Now, let's look at the **callee** function: +上文介绍的 **callee** 函数功能如下: static int callee() { @@ -48,7 +51,7 @@ Now, let's look at the **callee** function: return ret; } -Here, we mount a **/proc** filesystem, and then set the uid (User ID) and gid (Group ID) to the value of 'u' before spawning the **/bin/bash** shell. [LXC][1] is an OS level virtualization tool utilizing cgroups and namespaces for resource isolation. Let's put it all together, setting 'u' to 65534 which is user "nobody" and group "nogroup" on Debian: +程序挂载了 **/proc** 文件系统,设置用户 ID 和组 ID,值都为“u”,然后运行 **/bin/bash** 程序,[LXC][1] 是一个操作系统级的虚拟化工具,使用 cgroups 和命名空间来完成资源的分离。现在我们把所有代码放在一起,变量“u”的值设为65534,在 Debian 系统中,这是“nobody”和“nogroup”: #define _GNU_SOURCE #include @@ -90,7 +93,7 @@ Here, we mount a **/proc** filesystem, and then set the uid (User ID) and gid (G return ret; } -To execute the code produces the following: +执行以下命令来运行上面的代码: root@w:~/pen/tmp# gcc -O -o ns.c -Wall -Werror -ansi -c89 ns.c root@w:~/pen/tmp# ./ns @@ -102,18 +105,22 @@ To execute the code produces the following: nobody 5 0.0 0.0 2784 1064 pts/1 R+ 21:21 0:00 ps auxw nobody@w:~/pen/tmp$ -Notice that the UID and GID are set to that of nobody and nogroup. Specifically notice that the full ps output shows only two running processes and that their PIDs are 1 and 5 respectively. Now, let's move on to using ip netns to work with network namespaces. First, let's confirm that no namespaces exist currently: +注意上面的结果,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". -In this case, either ip needs an upgrade, or the kernel does. Assuming you have a kernel newer than 2.6.24, it's most likely **ip**. After upgrading, **ip netns list** should by default return nothing. Let's add a new namespace called '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 ns1 -First, let's list the current interfaces: +列出网卡: root@w:~# ip link list 1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT @@ -121,7 +128,7 @@ First, let's list the current interfaces: 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 -Now to create a new virtual interface, and add it to our new namespace. Virtual interfaces are created in pairs, and are linked to each other - imagine a virtual crossover cable: +创建新的虚拟网卡,并加到命名空间。虚拟网卡需要成对创建,互相关联——就像交叉电缆一样: root@w:~# ip link add veth0 type veth peer name veth1 root@w:~# ip link list @@ -134,9 +141,9 @@ Now to create a new virtual interface, and add it to our new namespace. Virtual 4: veth0: mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000 link/ether f2:f7:5e:e2:22:ac brd ff:ff:ff:ff:ff:ff -**ifconfig** -a will also now show the addition of both veth0 and veth1. +这个时候 **ifconfig** -a 命令也能显示新添加的 veth0 和 veth1 两块网卡。 -Great, now to assign our new interfaces to the namespace. Note that ip **netns exec** is used to execute commands within the namespace: +很好,现在将这两份块网卡加到命名空间中去。注意一下,下面的 ip **netns exec** 命令用于将后面的命令在命名空间中执行(LCTT注:下面的结果显示了在 ns1 这个网络命名空间中,只存在 lo 和 veth1 两块网卡): root@w:~# ip link set veth1 netns ns1 root@w:~# ip netns exec ns1 ip link list @@ -145,21 +152,21 @@ Great, now to assign our new interfaces to the namespace. Note that ip **netns e 3: veth1: mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000 link/ether d2:e9:52:18:19:ab brd ff:ff:ff:ff:ff:ff -**ifconfig** -a will now only show veth0, as veth1 is in the ns1 namespace. +这个时候 **ifconfig** -a 命令只能显示 veth0,不能显示 veth1,因为后者现在在 ns1 命名空间中。 -Should we want to delete veth0/veth1: +如果想删除 veth0/veth1,可以执行下面的命令: ip netns exec ns1 ip link del veth1 -We can now assign IP address 192.168.5.5/24 to veth0 on our host: +我们可以为 veth0 分配 IP 地址: ifconfig veth0 192.168.5.5/24 -And assign veth1 192.168.5.10/24 within ns1: +在命名空间内为 veth1 分配 IP 地址: ip netns exec ns1 ifconfig veth1 192.168.5.10/24 up -To execute ip addr **list** on both our host and within our namespace: +在命名空间内外执行 ip addr **list** 命令: root@w:~# ip addr list 1: lo: mtu 65536 qdisc noqueue state UNKNOWN @@ -186,7 +193,7 @@ To execute ip addr **list** on both our host and within our namespace: inet6 fe80::10bd:b6ff:fe76:a6eb/64 scope link valid_lft forever preferred_lft forever -To view routing tables inside and outside of the namespace: +在命名空间内外查看路由表: root@w:~# ip route list default via 192.168.3.1 dev eth0 proto static @@ -195,7 +202,7 @@ To view routing tables inside and outside of the namespace: root@w:~# ip netns exec ns1 ip route list 192.168.5.0/24 dev veth1 proto kernel scope link src 192.168.5.10 -Lastly, to connect our physical and virtual interfaces, we'll require a bridge. Let's bridge eth0 and veth0 on the host, and then use DHCP to gain an IP within the ns1 namespace: +最后,将虚拟网卡连到物理网卡上,我们需要用到桥接。这里做的是将 veth0 桥接到 eth0,而 ns1 命名空间内则使用 DHCP 自动获取 IP 地址: root@w:~# brctl addbr br0 root@w:~# brctl addif br0 eth0 @@ -210,7 +217,7 @@ Lastly, to connect our physical and virtual interfaces, we'll require a bridge. inet6 fe80::20c:29ff:fe65:259e/64 scope link valid_lft forever preferred_lft forever -br0 has been assigned an IP of 192.168.3.122/24. Now for the namespace: +为网桥 br0 分配的 IP 地址为192.168.3.122/24。接下来为命名空间分配地址: root@w:~# ip netns exec ns1 dhclient veth1 root@w:~# ip netns exec ns1 ip addr list @@ -222,17 +229,19 @@ br0 has been assigned an IP of 192.168.3.122/24. Now for the namespace: inet6 fe80::10bd:b6ff:fe76:a6eb/64 scope link valid_lft forever preferred_lft forever -Excellent! veth1 has been assigned 192.168.3.248/24 +现在, veth1 的 IP 被设置成 192.168.3.248/24 了。 -------------------------------------------------------------------------------- via: http://www.howtoforge.com/linux-namespaces 作者:[aziods][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[bazz2](https://github.com/bazz2) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 [a]:http://www.howtoforge.com/forums/private.php?do=newpm&u=138952 [1]:http://en.wikipedia.org/wiki/LXC + + 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/published/201503/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 new file mode 100644 index 0000000000..b9768d7148 --- /dev/null +++ b/published/201503/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md @@ -0,0 +1,58 @@ +MultiWriter:同时将 ISO 镜像并发写入 20 个 USB 启动盘 +================================================================================ +**我的问题是如何把一个Linux ISO 文件烧录到 17 个 USB 启动盘?** + +精通代码的人会写一个 bash 脚本来自动化处理,而大部分的人会使用像 USB 启动盘创建器这样的图形用户界面工具来把 ISO 文件一个、一个的烧录到驱动盘中。但剩下的还有一些人也许会很快得出结论,两种方法都不太理想。 + +### 问题 > 解决 ### + +![GNOME MultiWriter in action](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/gnome-multi-writer.jpg) + +*GNOME MultiWriter 在运行当中* + +Richard Hughes,一个 GNOME 开发者,也面临着类似的困境。他要创建一批预装操作系统的 USB 启动盘,需要一个足够简单的工具,使得像他父亲这样的用户也能使用。 + +他的反应是开发**品牌性的新应用程序**,使上面的两种方法合二为一,创造出易用的一款工具。 + +它的名字就叫 “[GNOME MultiWriter][1]”,可以同时把单个的 ISO 或 IMG 文件写入多个 USB 驱动盘。 + +它不支持个性化自定义或命令行执行的功能,使用它就可以省掉浪费一下午的时间来对相同的操作的重复动作。 + +您需要的就是这一款应用程序、一个 ISO 镜像文件、一些拇指驱动盘以用许多空 USB 接口。 + +### 用例和安装 ### + +![The app can be installed on Ubuntu](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/mutli-writer-on-ubuntu.jpg) + +*该应用程序可以在 Ubuntu 上安装* + +这款应用程序的定义使用场景很不错,正适合使用于预装正要发布的操作系统或 live 映像的 USB 启动盘上。 + +那就是说,任何人想要创建一个单独可启动的 USB 启动盘的话,也是一样的适用 - 因我用 Ubuntu 的内置磁盘创建工具来创建可引导的映像从来没有一次成功过的,所以这方案对我来说是个好消息! + +它的开发者 Hughes 说它**最高能支持20个 USB 启动盘**,每个盘的大小在 1GB 到 32GB之间。 + +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][1] + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/01/gnome-multiwriter-iso-usb-utility + +作者:[Joey-Elijah Sneddon][a] +译者:[runningwater](https://github.com/runningwater) +校对:[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/ 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 76% 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 index b0f4731e18..9c6f853a30 100644 --- 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 @@ -5,7 +5,7 @@ 这是一个篇幅不长但是十分有用的教程,可以帮助你在终端启动一个Linux应用程序,并且使终端窗口不会丢失焦点。 -我们有很多方法可以在Linux系统中打开一个终端窗口,这取决与你的选择以及你的桌面环境。 +我们有很多可以在Linux系统中打开一个终端窗口的方法,这取决于你的选择以及你的桌面环境。 如果是使用Ubuntu的话,你可以利用CTRL+ALT+T组合键打开终端。当然你也可以使用超级键(Windows键)[打开Dash][1],搜索“TERM”,然后点击“Term”图标来打开终端窗口。 @@ -19,13 +19,13 @@ firefox -search "linux.cn" -你可能会注意到,当你启动Firefox的时候,如果程序打开以后,焦点重新会到终端窗口的话,你就可以继续在终端进行工作。 +你可能会注意到,如果你启动Firefox,程序打开以后,回到了终端窗口控制,这就意味着你可以继续在终端进行工作。 -通常情况下,如果你在终端启动了应用程序,焦点会切换到新启动的应用程序,只有程序被关闭以后焦点才会重新切换到终端。这是因为你在前台启动了这个程序。 +通常情况下,如果你在终端启动了应用程序,控制会切换到新启动的应用程序,只有程序被关闭以后才会重新切换到终端控制。这是因为你在前台启动了这个程序。 -如果要实现焦点仍然保持在终端窗口的目的,那么你需要将应用程序启动为后台进程。 +如果要在Linux终端打开应用程序并且返回终端控制,那么你需要将应用程序启动为后台进程。 -向下面所列的命令一样,我们可以通过增加一个(&)符号,将应用程序在后台启动。 +和下面所列的命令一样,我们可以通过增加一个(&)符号,将应用程序在后台启动。 libreoffice & @@ -61,15 +61,15 @@ sudo find / -name firefox | more -如果你知道你要查找的文件在你的当前目录及其子目录中,那么你可以使用点来代替斜杠: +如果你知道你要查找的文件在你的当前目录结构中,那么你可以使用点来代替斜杠: sudo find . -name firefox | more -你可能需要sudo来提升权限,也可能根本就不需要,如果这个文件在你的跟目录里面,那么就不需要使用sudo。 +你可能需要sudo来提升权限,也可能根本就不需要,如果这个文件在你的主目录里面,那么就不需要使用sudo。 -有些应用程序则必须要提升权限才能运行,否则你就会得到一大堆拒绝访问错误,除非你使用一个具有权限的用户,或者使用sudo提升权限。 +有些应用程序则必须要提升权限才能运行,否则你就会得到一大堆拒绝访问错误,除非你使用一个具有权限的用户或者使用sudo提升权限。 -这里有个小窍门。如果你运行了一个程序,但是它报了权限错误以后,输入下面命令试试: +这里有个小窍门。如果你运行了一个程序,但是它需要提升权限来操作,输入下面命令试试: sudo !! @@ -77,7 +77,7 @@ via : http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-The-T 作者:[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/) 荣誉推出 @@ -87,4 +87,4 @@ via : http://linux.about.com/od/commands/fl/How-To-Run-Linux-Programs-From-The-T [3]:http://linux.about.com/od/commands/l/blcmdl1_locate.htm [4]:http://linux.about.com/library/cmd/blcmdl1_less.htm [5]:http://linux.about.com/library/cmd/blcmdl1_more.htm -[6]:http://linux.about.com/od/commands/l/blcmdl8_sudo.htm \ No newline at end of file +[6]:http://linux.about.com/od/commands/l/blcmdl8_sudo.htm 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 84% 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 25396e1798..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]。这两个都是很棒的车,但是如果把劳斯莱斯给一个车迷,他们也许会卖掉它买个其他的车,同样,如果把保时捷给舒格勋爵或者休·海夫纳这类人可能也不那么合适。 +比较这两个操作系统就像比较[劳斯莱斯][3]与[保时捷][4]。这两个都是很棒的车,但是如果把劳斯莱斯给一个赛车迷,他们也许会卖掉它买个其他的车,同样,如果把保时捷给舒格勋爵或者休·海夫纳这类人可能也不那么合适。 -Ubuntu拥有一个适用性很强的桌面环境,叫做Unity,并且默认会安装一些很棒的Linux应用程序,包括Rhythmbox以及[LibreOffic][5]。Ubuntu就像是劳斯莱斯。它为舒适而生,并且尽可能的提供从A到B的最时髦的方法。 +Ubuntu拥有一个适用性很强的桌面环境,叫做Unity,并且默认会安装一些很棒的Linux应用程序,包括Rhythmbox以及[LibreOffic][5]。Ubuntu就像是劳斯莱斯。它为舒适而生,并且尽可能的提供满足需要的漂亮的解决方案。 作为一个Ubuntu用户,就像汽车里面的乘客。你在到达目的地的过程中就可以同时把事情搞定,并且所有的事看起来都很漂亮并且很简单。 @@ -28,7 +29,7 @@ Xubuntu就像一个改装过的跑车。你可以把它改装成任何你想要 但是,如果你发现Unity没办法满足你的要求,并且感觉你的计算机在运行Ubuntu时或多或少有一些性能压力,那么当然就可以考虑考虑Xubuntu。 -上周我发了一篇文章介绍怎么创建Xubuntu启动优盘(译者注:翻译ing),并且也写了一篇[安装Xubuntu的教程][b](译者注:已经完成翻译,链接为github地址)。 +上周我发了一篇文章介绍怎么[创建Xubuntu启动优盘][c],并且也写了一篇[安装Xubuntu的教程][b](译者注:链接为github地址)。 不过,如果你已经安装了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,21 +133,23 @@ 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/) 荣誉推出 [a]:http://linux.about.com/bio/Gary-Newell-132058.htm [b]:https://github.com/ZhouJ-sh/TranslateProject/blob/0c4ad0bc8e79e28c1f7f8ccf805708829baa8ea9/translated/share/20150116%20A%20Step%20By%20Step%20Guide%20To%20Installing%20Xubuntu%20Linux.md +[c]:https://github.com/ZhouJ-sh/TranslateProject/blob/d91316c19c6668b82cfabf9f89e4ad07c7193202/translated/share/20150119%203%20Ways%20To%20Create%20A%20Lightweight%20And%20Persistent%20Xubuntu%20Linux%20USB%20Drive.md [1]:http://www.everydaylinuxuser.com/2014/11/an-everyday-linux-user-review-of-ubuntu.html [2]:http://www.everydaylinuxuser.com/2015/01/an-everyday-linux-user-review-of.html [3]:http://exoticcars.about.com/od/overviewsofmaker1/p/RollsHistory.htm 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/published/201503/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 new file mode 100644 index 0000000000..e8b97a3f0d --- /dev/null +++ b/published/201503/20150121 Linux FAQs with Answers--How to check CPU info on Linux.md @@ -0,0 +1,115 @@ +Linux有问必答:如何查看Linux系统的CPU信息 +================================================================================ +> **问题**: 我想要了解我的电脑关于CPU处理器的详细信息,查看CPU信息比较有效地方法是什么? + +根据你的需要,有各种各样的关于你的CPU处理器信息你需要了解,比如CPU供应商名、模型名、时钟频率、插槽/内核的数量, L1/L2/L3缓存配置、可用的处理器能力(比如:硬件虚拟化、AES, MMX, SSE)等等。在Linux中,有许多命令行或基于GUI的工具就能来展示你的CPU硬件的相关具体信息。 + +### 1. /proc/cpuinfo ### + +最简单的方法就是查看 /proc/cpuinfo ,这个虚拟文件展示的是可用CPU硬件的配置。 + + $ more /proc/cpuinfo + +![](https://farm8.staticflickr.com/7572/15934711577_4136a8e0b9_c.jpg) + +通过查看这个文件,你能[识别出][1]物理处理器数(插槽)、每个CPU核心数、可用的CPU标志寄存器以及其它东西的数量。 + +### 2. cpufreq-info ### + +cpufreq-info命令(**cpufrequtils**包的一部分)从内核/硬件中收集并报告CPU频率信息。这条命令展示了CPU当前运行的硬件频率,包括CPU所允许的最小/最大频率、CPUfreq策略/统计数据等等。来看下CPU #0上的信息: + + $ cpufreq-info -c 0 + +![](https://farm8.staticflickr.com/7484/16094667926_d979240081_c.jpg) + +### 3. cpuid ### + +cpuid命令的功能就相当于一个专用的CPU信息工具,它能通过使用[CPUID功能][2]来显示详细的关于CPU硬件的信息。信息报告包括处理器类型/家族、CPU扩展指令集、缓存/TLB(译者注:传输后备缓冲器)配置、电源管理功能等等。 + + $ cpuid + +![](https://farm9.staticflickr.com/8563/15500753923_6f1b25e8e9_c.jpg) + +### 4. dmidecode ### + +dmidecode命令直接从BIOS的DMI(桌面管理接口)数据收集关于系统硬件的具体信息。CPU信息报告包括CPU供应商、版本、CPU标志寄存器、最大/当前的时钟速度、(启用的)核心总数、L1/L2/L3缓存配置等等。 + + $ sudo dmidecode + +![](https://farm8.staticflickr.com/7503/16094667836_825b61d0e5_b.jpg) + +### 5. hardinfo ### + +hardinfo是一个基于GUI的系统信息工具,它能展示给你一个易于理解的CPU硬件信息的概况,也包括你的系统其它的一些硬件组成部分。 + + $ hardinfo + +![](https://farm8.staticflickr.com/7482/15933041268_40ccc17407_b.jpg) + +### 6. i7z ### + +i7z是一个专供英特尔酷睿i3、i5和i7 CPU的实时CPU报告工具。它能实时显示每个核心的各类信息,比如睿频加速状态、CPU频率、CPU电源状态、温度检测等等。i7z运行在基于ncurses的控制台模式或基于QT的GUI的其中之一上。 + + $ sudo i7z + +![](https://farm8.staticflickr.com/7546/15534687744_1968dc2b18_c.jpg) + +### 8. likwid拓扑 ### + +[likwid][3] (Like I Knew What I'm Doing) 是一个用来测量、配置并显示硬件相关特性的命令行收集工具。其中的likwid拓扑结构能显示CPU硬件(线程/缓存/NUMA)的拓扑结构信息,还能识别处理器家族(比如:Intel Core 2, AMD Shanghai)。 + +![](https://farm8.staticflickr.com/7511/15934711707_5dc0793599_b.jpg) + +### 9. lscpu ### + +lscpu命令用一个更加用户友好的格式统计了 /etc/cpuinfo 的内容,比如CPU、核心、套接字、NUMA节点的数量(线上/线下)。 + + $ lscpu + +![](https://farm8.staticflickr.com/7501/15933173470_69e53b3021_b.jpg) + +### 10. lshw ### + +**lshw**命令是一个综合性硬件查询工具。不同于其它工具,lshw需要root特权才能运行,因为它是在BIOS系统里查询DMI(桌面管理接口)信息。它能报告总核心数和可用核心数,但是会遗漏掉一些信息比如L1/L2/L3缓存配置。GTK版本的lshw-gtk也是可用的。 + + $ sudo lshw -class processor + +![](https://farm9.staticflickr.com/8649/15498132484_a47c4e8cb3_c.jpg) + +### 11. lstopo ### + +lstopo命令 (包括在 [hwloc][4] 包中) 以可视化的方式组成 CPU、缓存、内存和I/O设备的拓扑结构。这个命令用来识别处理器结构和系统的NUMA拓扑结构。 + + $ lstopo + +![](https://farm8.staticflickr.com/7490/15934399829_4012213734_z.jpg) + +### 12. numactl ### + +最初其被开发的目的是为了设置NUMA的时序安排和Linux处理器的内存布局策略,numactl命令也能通过命令行来展示关于CPU硬件的NUMA拓扑结构信息。 + + $ numactl --hardware + +![](https://farm8.staticflickr.com/7553/16094667876_9d7daa77a1_b.jpg) + +### 13. x86info ### + +x86info是一个为了展示基于x86架构的CPU信息的命令行工具。信息报告包括CPU型号、线程/核心数、时钟速度、TLB(传输后备缓冲器)缓存配置、支持的特征标志寄存器等等。 + + $ x86info --all + +![](https://farm8.staticflickr.com/7522/16131238626_d8a703c060_c.jpg) + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/check-cpu-info-linux.html + +译者:[ZTinoZ](https://github.com/ZTinoZ) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://xmodulo.com/how-to-find-number-of-cpu-cores-on.html +[2]:http://en.wikipedia.org/wiki/CPUID +[3]:http://xmodulo.com/identify-cpu-processor-architecture-linux.html +[4]:http://xmodulo.com/identify-cpu-processor-architecture-linux.html diff --git a/published/201503/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 new file mode 100644 index 0000000000..e20cd1c1ab --- /dev/null +++ b/published/201503/20150122 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md @@ -0,0 +1,182 @@ +如何通过简单的3步恢复Windows 7同时删除Ubuntu +================================================================================ +### 说明 ### + +写这篇文章对我来说是一件奇怪的事情,因为我通常都是提倡安装Ubuntu而卸载Windows的。 + +让今天写这篇文章更加奇怪的是,我决定在微软决定终止对Windows7的主流支持的这一天来写。 + +那么为什么我现在要写这篇文章呢? + +到目前为止我曾经在很多场合被问到如何从一个装有Windows7或Windows8的双系统中删除Ubuntu系统,因此写这篇文章就变得有意义了。 + +我在圣诞节期间浏览了人们在我文章中的留言,感觉是时候把缺失的文章写完同时更新一下那些比较老的又需要关注的文章了。 + +我打算把一月份剩下的时间都用在这上面。这是第一步。如果你的电脑上安装了Windows7和Ubuntu双系统,同时你不想通过恢复出厂设置的方式恢复Windows7系统,那么请参考该教程。(注意:对于Windows8系统,有一个独立的教程) + +### 删除Ubuntu系统需要的步骤 ### + +1. 通过修复Windows启动项来删除Grub +1. 删除Ubuntu系统所在分区 +1. 扩展Windows系统分区 + +### 备份系统 ### + +在你开始之前,我建议为你的系统保留一个备份。 + +我建议你不要放弃备份的机会,但也不要使用微软自带的工具。 + +[点击查看如何使用Macrinum Reflect备份你的驱动][1] + +如果Ubuntu中有你希望保存的数据,现在就登录进去然后将数据保存到外部硬盘驱动器,USB驱动器或者DVD中。 + +### 步骤1 - 删除Grub启动菜单 ### + +![](http://1.bp.blogspot.com/-arVqwMLpJRQ/VLWbHWkqYsI/AAAAAAAAHmw/kn3jDPOltX4/s1600/grubmenu.jpg) + +当你启动系统的时候你会看见一个与上图类似的菜单。 + +要想删除这个菜单直接进入Windows系统,你必须修复主引导记录。 + +要达到这个目的,我将向你展示如何创建一个系统恢复盘,如何从恢复盘中启动以及如何修复主引导记录。 + +![](http://2.bp.blogspot.com/-ML2JnNc8OWY/VLWcAovwGNI/AAAAAAAAHm4/KH778_MkU7U/s1600/recoverywindow1.PNG) + +按下“开始”按钮,搜索“备份和还原”。点击出现的图标。 + +将会打开一个与上图一样的窗口。 + +点击“创建系统修复光盘”。 + +你需要一个[空的DVD盘][2]。 + +![](http://2.bp.blogspot.com/-r0GUDZ4AAMI/VLWfJ0nuJLI/AAAAAAAAHnE/RloNqdXLLcY/s1600/recoverywindow2.PNG) + +将空的DVD盘插入到驱动器中然后从下拉列表中选择你的DVD驱动器。 + +点击“创建光盘”。 + +将光盘留在电脑中并重启电脑,当出现从CD中启动的消息的时候按下键盘上的“回车”键。 + +![](http://2.bp.blogspot.com/-VPSD50bmk2E/VLWftBg7HxI/AAAAAAAAHnM/APVzvPg4rC0/s1600/recoveryoptionschooselanguage.jpg) + +屏幕上会出现“系统恢复选项”。 + +它会要求你选择你的键盘布局方式。 + +从列表中选择合适的选项,然后点击“下一步”。 + +![](http://2.bp.blogspot.com/-klK4SihPv0E/VLWgLiPO1mI/AAAAAAAAHnU/DUgxH6N2SFE/s1600/RecoveryOptions.jpg) + +下一个界面让你选择你想修复的操作系统。 + +或者你可以使用早先保存的系统镜像恢复系统。 + +选中上面的选项然后点击“下一步”。 + +![](http://2.bp.blogspot.com/-WOk-Unm6cCQ/VLWgvzoBgzI/AAAAAAAAHng/vfxm1jhW1Ms/s1600/RecoveryOptions2.jpg) + +现在你将会看到一个有修复硬盘和恢复您的系统等选项的界面。 + +你需要做的是修复主引导记录,而这可以通过领命提示符来完成。 + +点击“命令提示符”。 + +![](http://4.bp.blogspot.com/-duT-EUC0yuo/VLWhHygCApI/AAAAAAAAHno/bO7UlouyR9M/s1600/FixMBR.jpg) + +现在只需要把下面的命令输入到命令提示符中: + + bootrec.exe /fixmbr + +接下来将会出现一条消息,提示操作已经成功完成。 + +你现在就可以关闭命令提示符窗口了。 + +点击“重启”按钮然后取出DVD。 + +你的电脑就会直接启动进入Windows7系统了。 + +### 步骤 2 - 删除Ubuntu分区 ### + +![](http://4.bp.blogspot.com/-1OM0b3qBeHk/VLWh89gtgVI/AAAAAAAAHn0/ECHIARNCRp8/s1600/diskmanagement1.PNG) + +要删除Ubuntu你需要使用Windows系统提供的“磁盘管理”工具。 + +按下“开始”按钮然后在搜索框中输入“创建和格式化磁盘分区”。将会出现一个与上图类似的窗口。 + +现在上面我的屏幕将不再和你的一模一样了,不过也不会相差太多。你会看到第0块磁盘有101MB的未分配空间,另外还有4个分区。 + +这101MB的空间是之前我安装Windows7时犯的一个错误。驱动器C是Windows7系统,下一个分区(46.57GB)是Ubuntu的根分区。287G的分区是/HOME分区,8G的分区是交换空间。 + +对于Windows系统来说,我们真正需要的只有驱动器C,所以剩下的是可以删掉的。 + +**注意: 注意一下.你的磁盘上可能有恢复分区。 不要删除恢复分区。它们应该有专门的卷标,文件系统也许是NTFS或FAT32** + +![](http://3.bp.blogspot.com/-8YUE2p5Fj8Q/VLWlHXst6JI/AAAAAAAAHoQ/BJC57d9Nilg/s1600/deletevolume.png) + +在你希望删除的分区上单击右键(例如:root,home和swap分区),然后从弹出的菜单中点击“删除卷”。 + +**(不要删除任何NTFS或者FAT32文件系统的分区!)** + +对于剩下的两个分区重复执行上面的操作。 + +![](http://3.bp.blogspot.com/-IGbJLkc_soY/VLWk1Vh0XAI/AAAAAAAAHoA/v7TVFT0rC0E/s1600/diskmanagement2.PNG) + +分区被删除后你将会有很大的一片空闲区域。右键点击空闲区域然后选择删除。 + +![](http://4.bp.blogspot.com/-2xUBkWHpnC4/VLWk9cYXGZI/AAAAAAAAHoI/8F2ANkorGeM/s1600/diskmanagement3.PNG) + +现在你的磁盘将包含驱动器C和一大片没有分配的空间。 + +### 步骤 3 - 扩展Windows分区 ### + +![](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) + +接下来是一个向导界面,在这里你可以选择扩展到那个盘,同时修改扩展的大小。 + +默认情况下,向导界面将显示它能从未分配区域中获取的最大的磁盘空间数。 + +接受默认的选项,然后点击“下一步”。 + +![](http://4.bp.blogspot.com/-1rhTJvwem0k/VLWnvx7fWFI/AAAAAAAAHo0/D-4HA8E8y2c/s1600/extendvolume3.PNG) + +最后的界面展示了你在前一个界面中的选择结果。 + +点击“结束”进行磁盘扩展。 + +![](http://2.bp.blogspot.com/-CpuLXSYyPKY/VLWoEGU3sCI/AAAAAAAAHo8/7o5G4W4b7zU/s1600/diskmanagement5.PNG) + +从上图中你可以看到,我的Windows分区占据了整个磁盘(除了我之前安装Windows的时候偶然创建的101MB的空间)。 + +### 总结 ### + +![](http://1.bp.blogspot.com/-h1Flo2aGFcI/VLWogr2zfMI/AAAAAAAAHpE/2ypTSgR8_iM/s1600/fullwindowsscreen.PNG) + +这就是全部内容。一个致力于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) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://linux.about.com/od/LinuxNewbieDesktopGuide/ss/Create-A-Recovery-Drive-For-All-Versions-Of-Windows.htm +[2]:http://www.amazon.co.uk/gp/product/B0006L2HTK/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1634&creative=6738&creativeASIN=B0006L2HTK&linkCode=as2&tag=evelinuse-21&linkId=3R363EA63XB4Z3IL + + diff --git a/published/201503/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 new file mode 100644 index 0000000000..0b393aa3b1 --- /dev/null +++ b/published/201503/20150122 Linux FAQs with Answers--How to create and configure a MySQL user from the command line.md @@ -0,0 +1,107 @@ +Linux有问必答:如何通过命令行创建和设置一个MySQL用户 +================================================================================ + +> **问题**:我想要在MySQL服务器上创建一个新的用户帐号,并且赋予他适当的权限和资源限制。如何通过命令行的方式来创建并且设置一个MySQL用户呢? + +要访问一个MySQL服务器,你需要使用一个用户帐号登录其中方可进行。每个MySQL用户帐号都有许多与之相关连的属性,例如用户名、密码以及权限和资源限制。"权限"定义了特定用户能够在MySQL服务器中做什么,而"资源限制"为用户设置了一系列服务器资源的使用许可。创建或更新一个用户涉及到了对用户帐号所有属性的管理。 + +下面展示了如何在Linux中创建和设置一个MySQL用户。 + +首先以root身份登录到MySQL服务器中。 + + $ mysql -u root -p + +当验证提示出现的时候,输入MySQL的root帐号的密码。 + +![](https://farm8.staticflickr.com/7482/16024190060_fff53d8840_b.jpg) + +### 创建一个MySQL用户 ### + +使用如下命令创建一个用户名和密码分别为"myuser"和"mypassword"的用户。 + + mysql> CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypassword'; + +一旦用户被创建后,包括加密的密码、权限和资源限制在内的所有帐号细节都会被存储在一个名为**user**的表中,这个表则存在于**mysql**这个特殊的数据库里。 + +运行下列命令,验证帐号是否创建成功 + + mysql> SELECT host, user, password FROM mysql.user WHERE user='myuser'; + +### 赋予MySQL用户权限 ### + +一个新建的MySQL用户没有任何访问权限,这就意味着你不能在MySQL数据库中进行任何操作。你得赋予用户必要的权限。以下是一些可用的权限: + +- **ALL**: 所有可用的权限 +- **CREATE**: 创建库、表和索引 +- **LOCK_TABLES**: 锁定表 +- **ALTER**: 修改表 +- **DELETE**: 删除表 +- **INSERT**: 插入表或列 +- **SELECT**: 检索表或列的数据 +- **CREATE_VIEW**: 创建视图 +- **SHOW_DATABASES**: 列出数据库 +- **DROP**: 删除库、表和视图 + +运行以下命令赋予"myuser"用户特定权限。 + + mysql> GRANT ON . TO 'myuser'@'localhost'; + +以上命令中,`` 代表着用逗号分隔的权限列表。如果你想要将权限赋予任意数据库(或表),那么使用星号(*)来代替数据库(或表)的名字。 + +例如,为所有数据库/表赋予 CREATE 和 INSERT 权限: + + mysql> GRANT CREATE, INSERT ON *.* TO 'myuser'@'localhost'; + +验证给用户赋予的全权限: + + mysql> SHOW GRANTS FOR 'myuser'@'localhost'; + +![](https://farm8.staticflickr.com/7556/16209665261_923282bddd_c.jpg) + +将全部的权限赋予所有数据库/表: + + mysql> GRANT ALL ON *.* TO 'myuser'@'localhost'; + +你也可以将用户现有的权限删除。使用以下命令废除"myuser"帐号的现有权限: + + mysql> REVOKE ON .
FROM 'myuser'@'localhost'; + +### 为用户添加资源限制 ### + +在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**: 对服务器的同时连接量 + +使用以下命令为"myuser"帐号增加一个资源限制: + + mysql> GRANT USAGE ON .
TO 'myuser'@'localhost' WITH ; + +在 `` 中你可以指定多个使用空格分隔开的资源限制。 + +例如,增加 MAX_QUERIES_PER_HOUR 和 MAX_CONNECTIONS_PER_HOUR 资源限制: + + mysql> GRANT USAGE ON *.* TO 'myuser'@'localhost' WITH MAX_QUERIES_PER_HOUR 30 MAX_CONNECTIONS_PER_HOUR 6; + +验证用户的资源限制: + + mysql> SHOW GRANTS FOR 'myuser'@'localhost; + +![](https://farm8.staticflickr.com/7537/16025443759_5cb4177bc6_c.jpg) + +创建和设置一个MySQL用户最后的一个重要步骤: + + mysql> FLUSH PRIVILEGES; + +如此一来更改便生效了。现在MySQL用户帐号就可以使用了。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/create-configure-mysql-user-command-line.html + +译者:[Ping](http://weibo.com/370321376) +校对:[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/201503/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 new file mode 100644 index 0000000000..bcaa1b3c26 --- /dev/null +++ b/published/201503/20150122 Linux FAQs with Answers--How to download and install ixgbe driver on Ubuntu or Debian.md @@ -0,0 +1,144 @@ +Linux 有问必答:如何在Ubuntu或者Debian中编译安装ixgbe驱动 +================================================================================ +> **提问**: 我想为我的Intel 10G网卡下载安装最新的ixgbe驱动。我该如何在Ubuntu(或者Debian)中安装ixgbe驱动? + +Intel的10G网卡(比如,82598、 82599、 x540)由ixgbe驱动支持。现代的Linux发行版已经带有了ixgbe驱动,通过可加载模块的方式使用。然而,有些情况你希望在你机器上的自己编译安装ixgbe驱动,比如,你想要体验ixbge驱动的最新特性时。同样,内核默认自带的ixgbe驱动中的一个问题是不允许你自定义驱动的参数。如果你想要一个完全定制的ixgbe驱动(比如 RSS、多队列、中断阈值等等),你需要手动从源码编译ixgbe驱动。 + +这里是如何在Ubuntu、Debian或者它们的衍生版中下载安装ixgbe驱动的教程。 + +### 第一步: 安装前提 ### + +安装之前,需要安装匹配的内核头文件和开发工具包。 + + $ sudo apt-get install linux-headers-$(uname -r) + $ sudo apt-get install gcc make + +### 第二步: 编译Ixgbe驱动 ### + +从[最新的ixgbe驱动][1]中下载源码。 + + $ wget http://sourceforge.net/projects/e1000/files/ixgbe%20stable/3.23.2/ixgbe-3.23.2.tar.gz + +如下编译ixgbe驱动。 + + $ tar xvfvz ixgbe-3.23.2.tar.gz + $ cd ixgbe-3.23.2/src + $ make + +### 第三步: 检查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 + +---------- + + filename: /home/xmodulo/ixgbe/ixgbe-3.23.2/src/ixgbe.ko + version: 3.23.2 + license: GPL + description: Intel(R) 10 Gigabit PCI Express Network Driver + author: Intel Corporation, + srcversion: 2ADA5E537923E983FA9DAE2 + alias: pci:v00008086d00001560sv*sd*bc*sc*i* + alias: pci:v00008086d00001558sv*sd*bc*sc*i* + alias: pci:v00008086d0000154Asv*sd*bc*sc*i* + alias: pci:v00008086d00001557sv*sd*bc*sc*i* + alias: pci:v00008086d0000154Fsv*sd*bc*sc*i* + alias: pci:v00008086d0000154Dsv*sd*bc*sc*i* + alias: pci:v00008086d00001528sv*sd*bc*sc*i* + alias: pci:v00008086d000010F8sv*sd*bc*sc*i* + alias: pci:v00008086d0000151Csv*sd*bc*sc*i* + alias: pci:v00008086d00001529sv*sd*bc*sc*i* + alias: pci:v00008086d0000152Asv*sd*bc*sc*i* + alias: pci:v00008086d000010F9sv*sd*bc*sc*i* + alias: pci:v00008086d00001514sv*sd*bc*sc*i* + alias: pci:v00008086d00001507sv*sd*bc*sc*i* + alias: pci:v00008086d000010FBsv*sd*bc*sc*i* + alias: pci:v00008086d00001517sv*sd*bc*sc*i* + alias: pci:v00008086d000010FCsv*sd*bc*sc*i* + alias: pci:v00008086d000010F7sv*sd*bc*sc*i* + alias: pci:v00008086d00001508sv*sd*bc*sc*i* + alias: pci:v00008086d000010DBsv*sd*bc*sc*i* + alias: pci:v00008086d000010F4sv*sd*bc*sc*i* + alias: pci:v00008086d000010E1sv*sd*bc*sc*i* + alias: pci:v00008086d000010F1sv*sd*bc*sc*i* + alias: pci:v00008086d000010ECsv*sd*bc*sc*i* + alias: pci:v00008086d000010DDsv*sd*bc*sc*i* + alias: pci:v00008086d0000150Bsv*sd*bc*sc*i* + alias: pci:v00008086d000010C8sv*sd*bc*sc*i* + alias: pci:v00008086d000010C7sv*sd*bc*sc*i* + alias: pci:v00008086d000010C6sv*sd*bc*sc*i* + alias: pci:v00008086d000010B6sv*sd*bc*sc*i* + depends: ptp,dca + vermagic: 3.11.0-19-generic SMP mod_unload modversions + parm: InterruptType:Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), default IntMode (deprecated) (array of int) + parm: IntMode:Change Interrupt Mode (0=Legacy, 1=MSI, 2=MSI-X), default 2 (array of int) + parm: MQ:Disable or enable Multiple Queues, default 1 (array of int) + parm: DCA:Disable or enable Direct Cache Access, 0=disabled, 1=descriptor only, 2=descriptor and data (array of int) + parm: RSS:Number of Receive-Side Scaling Descriptor Queues, default 0=number of cpus (array of int) + parm: VMDQ:Number of Virtual Machine Device Queues: 0/1 = disable, 2-16 enable (default=8) (array of int) + parm: max_vfs:Number of Virtual Functions: 0 = disable (default), 1-63 = enable this many VFs (array of int) + parm: VEPA:VEPA Bridge Mode: 0 = VEB (default), 1 = VEPA (array of int) + parm: InterruptThrottleRate:Maximum interrupts per second, per vector, (0,1,956-488281), default 1 (array of int) + parm: LLIPort:Low Latency Interrupt TCP Port (0-65535) (array of int) + parm: LLIPush:Low Latency Interrupt on TCP Push flag (0,1) (array of int) + parm: LLISize:Low Latency Interrupt on Packet Size (0-1500) (array of int) + parm: LLIEType:Low Latency Interrupt Ethernet Protocol Type (array of int) + parm: LLIVLANP:Low Latency Interrupt on VLAN priority threshold (array of int) + parm: FdirPballoc:Flow Director packet buffer allocation level: + 1 = 8k hash filters or 2k perfect filters + 2 = 16k hash filters or 4k perfect filters + 3 = 32k hash filters or 8k perfect filters (array of int) + parm: AtrSampleRate:Software ATR Tx packet sample rate (array of int) + parm: FCoE:Disable or enable FCoE Offload, default 1 (array of int) + parm: LRO:Large Receive Offload (0,1), default 1 = on (array of int) + parm: allow_unsupported_sfp:Allow unsupported and untested SFP+ modules on 82599 based adapters, default 0 = Disable (array of int) + +### 第四步: 测试Ixgbe驱动 ### + +在测试新的模块之前,如果你内核中已存在旧版本ixgbe模块的话你需要先移除它。 + + $ sudo rmmod ixgbe + +接着使用insmod命令插入新编译的ixgbe模块。确保指定一个模块的绝对路径。 + + $ sudo insmod ./ixgbe.ko + +如果上面的命令成功运行,就不会显示任何的信息。 + +如果你需要,你可以尝试加入额外的参数。比如,设置RSS的队列数量为16: + + $ sudo insmod ./ixgbe.ko RSS=16 + +检查**/var/log/kern.log**来查看ixgbe驱动是否成功激活。查看日志中的“Intel(R) 10 Gigabit PCI Express Network Driver”。ixgbe的版本信息应该和之前的modinfo的显示应该相同。 + + Sep 18 14:48:52 spongebob kernel: [684717.906254] Intel(R) 10 Gigabit PCI Express Network Driver - version 3.22.3 + +![](https://farm8.staticflickr.com/7583/16056721867_f06e152076_c.jpg) + +### 第五步: 安装Ixgbe驱动 ### + +一旦你验证新的ixgbe驱动可以成功加载,最后一步是在你的系统中安装驱动。 + + $ sudo make install + +**ixgbe.ko** 会安装在/lib/modules//kernel/drivers/net/ethernet/intel/ixgbe 下。 + +从这一步起,你可以用下面的modprobe命令加载ixgbe驱动了。注意你不必再指定绝对路径。 + + $ sudo modprobe ixgbe + +如果你希望在启动时加载ixgbe驱动,你可以在/etc/modules的最后加入“ixgbe”。 + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/download-install-ixgbe-driver-ubuntu-debian.html + +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[1]:http://sourceforge.net/projects/e1000/files/ixgbe%20stable/ 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/published/201503/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md b/published/201503/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md new file mode 100644 index 0000000000..4437f991b9 --- /dev/null +++ b/published/201503/20150123 Keep History Of Notifications With Recent Notifications AppIndicator.md @@ -0,0 +1,40 @@ +使用“最近通知工具”保持桌面通知历史 +================================================================================ +![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]时帮到我。默认上通知会在桌面的顶部显示几秒接着就会消失。如果你听见了通知的声音但是没有看到内容怎么办?你该如何知道通知的内容? + +如果你可以看到最近所有通知的历史会很棒吧?是的,我知道这很棒。你可以在Ubuntu Unity或者Gnome中使用最近**通知小工具**来追踪所有的最近通知。 + +最近通知位于顶部面板,并且记录了最近所有通知的历史。当它捕获到新的通知后,它就会变绿来表明你有未读的通知。 + +![Recent notifications in Ubuntu 14.04](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/recent_notifications_Ubuntu.jpeg) + +当你点击它后,你就会看到最近所有的通知。你可以选择清空所有或者删除部分。 + +![Recent notifications applet indicator](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/recent_notifications_Ubuntu_1.jpeg) + +不幸的是它没有配置选项。因此你不能屏蔽特定程序的通知。所有的通知都会被保存。 + +### 在Ubuntu 14.04 和 14.10 中安装最近通知工具 ### + +一般说来这个最近通知工具应该也可以在Linux Mint Cinnamon版本中运行。你可以试一试。使用下面的命令来在在Ubuntu 14.04 和 14.10 中安装最近通知工具: + + sudo add-apt-repository ppa:jconti/recent-notifications + sudo apt-get update + sudo apt-get install indicator-notifications + +安装完成后,重新登录后你就可以用了。现在妈妈再也不用担心我的通知没看到了。很方便的小工具,不是么? + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/notifications-appindicator/ + +作者:[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/apps-internet-streaming-radio-ubuntu/ \ No newline at end of file diff --git a/published/201503/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 new file mode 100644 index 0000000000..2dc0d43263 --- /dev/null +++ b/published/201503/20150125 A Shell Primer--Master Your Linux OS X Unix Shell Environment.md @@ -0,0 +1,697 @@ +Shell入门:掌握Linux,OS X,Unix的Shell环境 +================================================================================ +在Linux或类Unix系统中,每个用户和进程都运行在一个特定环境中。这个环境包含了变量、设置、别名、函数以及更多的东西。下面是对Shell环境下一些常用命令的简单介绍,包括每个命令如何使用的例子,以及在命令行下设定你自己的环境来提高效率。 + +![](http://s0.cyberciti.org/uploads/cms/2015/01/bash-shell-welcome-image.jpg) + +### 找出你当前的shell ### + +在终端应用中输入下面命令中的任意一个: + + ps $$ + ps -p $$ + +或者 + + echo "$0" + +输出范例: + +[![图1: Finding out your shell name](http://s0.cyberciti.org/uploads/cms/2015/01/finding-your-shell-like-a-pro.jpg)][1] + +*图1:找出当前的shell* + +### 找出所有已安装的shell ### + +找到已安装shell的完整路径: + + type -a zsh + type -a ksh + type -a sh + type -a bash + +输出范例: + +[![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]来查看这些数据: + + cat /etc/shells + +输出范例: + + # List of acceptable shells for chpass(1). + # Ftpd will not allow users to connect who are not using + # one of these shells. + + /bin/bash + /bin/csh + /bin/ksh + /bin/sh + /bin/tcsh + /bin/zsh + /usr/local/bin/fish + +### 临时改变当前shell ### + +只需要输入shell的名字。在下面的例子里,我从bash切换到了zsh: + + zsh + +这只是临时改变了系统shell。也叫做子shell。要从子/临时shell退出,输入下面的命令或者按下CTRL-D: + + exit + +### 找出子shell的层级或临时shell的嵌套层级 ### + +每个bash实例启动后,变量$SHLVL的值都会加一。输入下面的命令: + + echo "$SHLVL" + +示例输出: + +[![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数目)* + +### 通过chsh命令永久变更系统shell ### + +想要把当前系统shell从bash永久换成zsh?试试这个: + + chsh -s /bin/zsh + +想把其他用户的shell从bash永久换成ksh?试试这个: + + sudo chsh -s /bin/ksh userNameHere + +### 查看当前的环境变量 ### + +你需要用到: + + env + env | more + env | less + env | grep 'NAME' + +示例输出: + + TERM_PROGRAM=Apple_Terminal + SHELL=/bin/bash + TERM=xterm-256color + TMPDIR=/var/folders/6x/45252d6j1lqbtyy_xt62h40c0000gn/T/ + Apple_PubSub_Socket_Render=/tmp/launch-djaOJg/Render + TERM_PROGRAM_VERSION=326 + TERM_SESSION_ID=16F470E3-501C-498E-B315-D70E538DA825 + USER=vivek + SSH_AUTH_SOCK=/tmp/launch-uQGJ2h/Listeners + __CF_USER_TEXT_ENCODING=0x1F5:0:0 + PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/go/bin:/usr/local/sbin/modemZapp:/Users/vivek/google-cloud-sdk/bin + __CHECKFIX1436934=1 + PWD=/Users/vivek + SHLVL=2 + HOME=/Users/vivek + LOGNAME=vivek + LC_CTYPE=UTF-8 + DISPLAY=/tmp/launch-6hNAhh/org.macosforge.xquartz:0 + _=/usr/bin/env + OLDPWD=/Users/vivek + +下面是bash shell里一些常见变量的列表: + +![Fig.04: Common bash environment variables](http://s0.cyberciti.org/uploads/cms/2015/01/common-shell-vars.jpg) + +*图4:常见bash环境变量* + +> **注意**:下面这些环境变量没事不要乱改。很可能会造成不稳定的shell会话: +> +> SHELL +> +> UID +> +> RANDOM +> +> PWD +> +> PPID +> +> SSH_AUTH_SOCK +> +> USER +> +> HOME +> +> LINENO + +### 显示环境变量的值 ### + +使用下面任意一条命令显示环境变量HOME的值: + + ## 使用printenv ## + printenv HOME + + ## 或者用echo ## + echo "$HOME" + + # 考虑到可移植性,也可以用printf ## + printf "%s\n" "$HOME" + +示例输出: + + /home/vivek + +### 增加或设定一个新环境变量 ### + +下面是bash,zsh,sh和ksh的语法: + + ## 语法 ## + VAR=value + FOO=bar + + ## 设定vim为默认文本编辑器 ## + EDITOR=vim + export $EDITOR + + ## 考虑安全性,设定默认shell连接超时时间 ## + TMOUT=300 + export TMOUT + + ## 你可以直接使用export命令设定命令的搜素路径 ## + export PATH=$PATH:$HOME/bin:/usr/local/bin:/path/to/mycoolapps + +然后,使用printenv或者echo或printf命令查看环境变量PATH,EDITOR,和TMOUT的值: + + printenv PATH + echo "$EDITOR" + printf "%s\n" $TMOUT + +### 怎么修改一个现有的环境变量? ### + +下面是语法: + + export VAR=value + ## 或者 ## + VAR=value + export $VAR + + ## 把默认文本编辑器从vim改为emacs ## + echo "$EDITOR" ## <--- 屏幕输出vim + EDITOR=emacs ## <--- 修改 + export $EDITOR ## <--- 让修改在其他会话生效 + echo "$EDITOR" ## <--- 屏幕输出emacs + +**tcsh shell下增加和修改变量**的语法是下面这样的: + + ## 语法 + setenv var value + printenv var + + ## 设置变量foo的值为bar ## + setenv foo bar + echo "$foo" + printenv foo + + ## 设置变量PATH ## + setenv PATH $PATH\:$HOME/bin + echo "$PATH" + + ## 设置变量PAGER ## + setenv PAGER most + printf "%s\n" $PAGER + +### 找出bash shell的配置文件 ### + +用下面的命令列出bash shell的文件: + + ls -l ~/.bash* ~/.profile /etc/bash* /etc/profile + +示例输出: + +[![Fig.05: List all bash environment configuration files](http://s0.cyberciti.org/uploads/cms/2015/01/list-bash-enviroment-variables.jpg)][5] + +*图5:列出bash的所有配置文件* + +要查看所有的bash配置文件,输入: + + less ~/.bash* ~/.profile /etc/bash* /etc/profile + +可以使用文字编辑器比如vim或emacs来一个一个编辑bash配置文件: + + vim ~/.bashrc + +编辑/etc/目录下的文件,输入: + + ## 首先是备份,以防万一 + sudo cp -v /etc/bashrc /etc/bashrc.bak.22_jan_15 + + ######################################################################## + ## 然后,随心所欲随便改吧,好好玩玩shell环境或者提高一下效率:) ## + ######################################################################## + sudo vim /etc/bashrc + +### 被Bash shell初始化过程中应用的文件搞糊涂了吗? ### + +下面的"bash初始化文件"流程图应该有些帮助: + +![](http://s0.cyberciti.org/uploads/cms/2015/01/BashStartupfiles.jpg) + +根据账户设定的默认shell,你的用户配置或系统配置可能是下面其中一种: + +### 找出zsh shell配置文件 ### + +zsh的[wiki][6]中建议用下面的命令: + + strings =zsh | grep zshrc + +示例输出: + + /etc/zshrc + .zshrc + +输入下面的命令列出你的zsh shell文件: + + ls -l /etc/zsh/* /etc/profile ~/.z* + +查看所有zsh配置文件: + + less /etc/zsh/* /etc/profile ~/.z* + +### 找出ksh shell配置文件 ### + +1. 查看~/.profile或者/etc/profile文件。 + +### 找出tcsh shell配置文件 ### + +1. C shell查看~/.login,~/.cshrc文件。 +2. TC shell查看~/.tcshrc和~/.cshrc文件。 + +### 我可以写个类似这样每次登录时都自动执行的脚本吗? ### + +是的,把你的命令或别名或其他设定添加到~/.bashrc(bash shell)或者~/.profile(sh/ksh/bash)或者~/.login(csh/tcsh)文件中。 + +### 我可以写个类似这样每次登出都自动执行的脚本吗? ### + +是的,把你的命令或别名或其他设定添加到~/.bash_logout(bash)或者~/.logout(csh/tcsh)文件。 + +### history:获取关于shell会话的更多信息 ### + +输入history命令来查看本次会话的历史: + + history + +示例输出: + + 9 ls + 10 vi advanced-cache.php + 11 cd .. + 12 ls + 13 w + 14 cd .. + 15 ls + 16 pwd + 17 ls + .... + .. + ... + 91 hddtemp /dev/sda + 92 yum install hddtemp + 93 hddtemp /dev/sda + 94 hddtemp /dev/sg0 + 95 hddtemp /dev/sg1 + 96 smartctl -d ata -A /dev/sda | grep -i temperature + 97 smartctl -d ata -A /dev/sg1 | grep -i temperature + 98 smartctl -A /dev/sg1 | grep -i temperature + 99 sensors + +输入history 20来查看命令历史的后20条: + + history 20 + +示例输出: + +[![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提示符下输入!!就好了: + + ls -l /foo/bar + !! + +在以上的历史记录中找到命令#93 (hddtemp /dev/sda),输入: + + !93 + +### 使用sudo或su改变用户 ### + +下面是语法: + + su userName + + ## 登录为tom用户 ## + su tom + + ## 为用户tom打开一个新的shell会话 ## + su tom + + ## 登录为root用户 ## + su - + + ## sudo命令语法(必须在系统中配置有这个命令) ## + sudo -s + sudo tom + +看看帖子"[Linux下使用其他用户身份运行命令][8]"更多地了解sudo,su和runuser命令。 + +### shell别名 ### + +别名仅仅是命令的一个快捷方式。 + +### 列出所有的别名 ### + +输入下面的命令: + + alias + +示例输出: + + alias ..='cd ..' + alias ...='cd ../../../' + alias ....='cd ../../../../' + alias .....='cd ../../../../' + alias .4='cd ../../../../' + alias .5='cd ../../../../..' + alias bc='bc -l' + alias cd..='cd ..' + alias chgrp='chgrp --preserve-root' + alias chmod='chmod --preserve-root' + alias chown='chown --preserve-root' + alias cp='cp -i' + alias dnstop='dnstop -l 5 eth1' + alias egrep='egrep --color=auto' + alias ethtool='ethtool eth1' + +### 设定一个别名 ### + +bash/zsh语法: + + alias c='clear' + alias down='sudo /sbin/shutdown -h now' + +对于命令clear可以输入c别名,这样我们就可以输入c代替clear命令来清空屏幕: + + c + +或者输入down来关闭基于Linux的服务器: + + down + +你可以设定任意多的别名。看下"[Linux/Unix/Mac OS X系统中的30个方便的bash shell别名][9]"了解在类Unix系统中别名的实际应用。 + +### shell函数 ### + +Bash/ksh/zsh函数允许你更进一步地配置shell环境。在这个例子中,我写了一个简单的名叫memcpu()的bash函数,用来显示前10个最占用CPU和内存的进程: + + memcpu() { echo "*** Top 10 cpu eating process ***"; ps auxf | sort -nr -k 3 | head -10; + echo "*** Top 10 memory eating process ***"; ps auxf | sort -nr -k 4 | head -10; } + +输入memcpu就可以在屏幕上看到下面的信息: + + memcpu + + *** Top 10 cpu eating process *** + nginx 39559 13.0 0.2 264020 35168 ? S 04:26 0:00 \_ /usr/bin/php-cgi + nginx 39545 6.6 0.1 216484 13088 ? S 04:25 0:04 \_ /usr/bin/php-cgi + nginx 39471 6.2 0.6 273352 81704 ? S 04:22 0:17 \_ /usr/bin/php-cgi + nginx 39544 5.7 0.1 216484 13084 ? S 04:25 0:03 \_ /usr/bin/php-cgi + nginx 39540 5.5 0.1 221260 19296 ? S 04:25 0:04 \_ /usr/bin/php-cgi + nginx 39542 5.4 0.1 216484 13152 ? S 04:25 0:04 \_ /usr/bin/php-cgi + nixcraft 39543 5.3 0.1 216484 14096 ? S 04:25 0:04 \_ /usr/bin/php-cgi + nixcraft 39538 5.2 0.1 221248 18608 ? S 04:25 0:04 \_ /usr/bin/php-cgi + nixcraft 39539 5.0 0.1 216484 16272 ? S 04:25 0:04 \_ /usr/bin/php-cgi + nixcraft 39541 4.8 0.1 216484 14860 ? S 04:25 0:04 \_ /usr/bin/php-cgi + + *** Top 10 memory eating process *** + 498 63859 0.5 4.0 2429652 488084 ? Ssl 2014 177:41 memcached -d -p 11211 -u memcached -m 2048 -c 18288 -P /var/run/memcached/memcached.pid -l 10.10.29.68 -L + mysql 64221 4.2 3.4 4653600 419868 ? Sl 2014 1360:40 \_ /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --open-files-limit=65535 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock + nixcraft 39418 0.4 1.1 295312 138624 ? S 04:17 0:02 | \_ /usr/bin/php-cgi + nixcraft 39419 0.5 0.9 290284 113036 ? S 04:18 0:02 | \_ /usr/bin/php-cgi + nixcraft 39464 0.7 0.8 294356 99200 ? S 04:20 0:02 | \_ /usr/bin/php-cgi + nixcraft 39469 0.3 0.7 288400 91256 ? S 04:20 0:01 | \_ /usr/bin/php-cgi + nixcraft 39471 6.2 0.6 273352 81704 ? S 04:22 0:17 \_ /usr/bin/php-cgi + vivek 39261 2.2 0.6 253172 82812 ? S 04:05 0:28 \_ /usr/bin/php-cgi + squid 9995 0.0 0.5 175152 72396 ? S 2014 27:00 \_ (squid) -f /etc/squid/squid.conf + cybercit 3922 0.0 0.4 303380 56304 ? S Jan10 0:13 | \_ /usr/bin/php-cgi + +看下"[如何编写和应用shell函数][10]"了解更多信息。 + +### 综合一下:定制你自己的Linux或Unix bash shell工作环境 ### + +现在,你将使用bash shell配置自己的环境。我只介绍bash。但是理论上zsh,ksh和其他常用shell都差不多。让我们看看如何调整shell来适合我作为系统管理员的需求。编辑你的~/.bashrc文件来附加设定。下面是一些常用的配置选项。 + +#### #1: 设定bash路径和环境变量 #### + + # 设定路径 ## + export PATH=$PATH:/usr/local/bin:/home/vivek/bin:/opt/firefox/bin:/opt/oraapp/bin + + # 为cd命令设定路径 + export CDPATH=.:$HOME:/var/www + +使用less或more命令作为翻页器: + + export PAGER=less + +设定vim作为默认文本编辑器: + + export EDITOR=vim + export VISUAL=vim + export SVN_EDITOR="$VISUAL" + +设定Oracle数据库特别要求的参数: + + export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server + export ORACLE_SID=XE + export NLS_LANG=$($ORACLE_HOME/bin/nls_lang.sh) + +设定JAVA_HOME和其他java路径,比如java版本: + + export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre + + # 把ORACLE和JAVA加入到PATH里 + export PATH=$PATH:$ORACLE_HOME/bin:$JAVA_HOME/bin + +[使用密钥实现免密码登录][11]让ssh远程登录更安全: + + # 再也不用输密码了 + /usr/bin/keychain $HOME/.ssh/id_rsa + source $HOME/.keychain/$HOSTNAME-sh + +最后,[打开bash命令补齐][12] + + source /etc/bash_completion + +#### #2: 设定bash命令提示符 #### + +设定[定制的bash提示符(PS1)][13]: + + PS1='{\u@\h:\w }\$ ' + +#### #3: 设定默认文件权限 #### + + ## 设定默认权限为644 ## + umask 022 + +#### #4: 调整shell命令历史设定 #### + + # 不往命令历史里写入相同的行 + HISTCONTROL=ignoreboth + + # 忽略这些命令 + HISTIGNORE="reboot:shutdown *:ls:pwd:exit:mount:man *:history" + + # 通过HISTSIZE和HISTFILESIZE设定命令历史的长度 + export HISTSIZE=10000 + export HISTFILESIZE=10000 + + # 为命令历史文件增加时间戳 + export HISTTIMEFORMAT="%F %T " + + # 附加到命令历史文件,而不是覆盖 + shopt -s histappend + +#### #5: 设定shell会话的时区 #### + + ## 为我自己的shell会话设定IST(印度标准时间) ## + TZ=Asia/Kolkata + +#### #6: 设定shell行编辑接口 #### + + ## 使用vi风格的行编辑接口,替代bash默认的emacs模式 ## + set -o vi + +#### #7: 设定自己喜好的别名 #### + + ## 增加一些保护 ## + alias rm='rm -i' + alias cp='cp -i' + alias mv='mv -i' + + ## Memcached ## + alias mcdstats='/usr/bin/memcached-tool 10.10.29.68:11211 stats' + alias mcdshow='/usr/bin/memcached-tool 10.10.29.68:11211 display' + alias mcdflush='echo "flush_all" | nc 10.10.29.68 11211' + + ## 默认命令参数 ## + alias vi='vim' + alias grep='grep --color=auto' + alias egrep='egrep --color=auto' + alias fgrep='fgrep --color=auto' + alias bc='bc -l' + alias wget='wget -c' + alias chown='chown --preserve-root' + alias chmod='chmod --preserve-root' + alias chgrp='chgrp --preserve-root' + alias rm='rm -I --preserve-root' + alias ln='ln -i' + +下面是一些额外的OS X Unix bash shell别名: + + # 从bash打开桌面应用 + alias preview="open -a '$PREVIEW'" + alias safari="open -a safari" + alias firefox="open -a firefox" + alias chrome="open -a google\ chrome" + alias f='open -a Finder ' + + # 清理那些.DS_Store文件 + alias dsclean='find . -type f -name .DS_Store -delete' + +#### #8: 寡人好色 #### + + # 彩色的grep输出 + alias grep='grep --color=auto' + export GREP_COLOR='1;33' + + # 彩色的ls + export LSCOLORS='Gxfxcxdxdxegedabagacad' + # Gnu/linux的ls + ls='ls --color=auto' + + # BSD/os x的ls命令 + # alias ls='ls -G' + +#### #9: 设定自己喜好的bash函数 #### + + # 在屏幕上显示10个最近的历史命令 + function ht { + history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head + } + + # host和ping命令的替代 + # 接受http:// 或 https:// 或 ftps:// 名称用作域或主机名 + _getdomainnameonly(){ + local h="$1" + local f="${h,,}" + # remove protocol part of hostname + f="${f#http://}" + f="${f#https://}" + f="${f#ftp://}" + f="${f#scp://}" + f="${f#scp://}" + f="${f#sftp://}" + # remove username and/or username:password part of hostname + f="${f#*:*@}" + f="${f#*@}" + # remove all /foo/xyz.html* + f=${f%%/*} + # show domain name only + echo "$f" + } + + + ping(){ + local array=( $@ ) # get all args in an array + local len=${#array[@]} # find the length of an array + local host=${array[$len-1]} # get the last arg + local args=${array[@]:0:$len-1} # get all args before the last arg in $@ in an array + local _ping="/bin/ping" + local c=$(_getdomainnameonly "$host") + [ "$t" != "$c" ] && echo "Sending ICMP ECHO_REQUEST to \"$c\"..." + # pass args and host + $_ping $args $c + } + + host(){ + local array=( $@ ) + local len=${#array[@]} + local host=${array[$len-1]} + local args=${array[@]:0:$len-1} + local _host="/usr/bin/host" + local c=$(_getdomainnameonly "$host") + [ "$t" != "$c" ] && echo "Performing DNS lookups for \"$c\"..." + $_host $args $c + } + +#### #10: 通过shell shopt命令设定bash shell行为 #### + +最后,你可以[使用set和shopt命令调整bash shell环境][14]: + + # 目录拼写纠正 + shopt -q -s cdspell + + # 保证每次终端窗口改变大小后会更新显示 + shopt -q -s checkwinsize + + # 打开高级模式匹配功能 + shopt -q -s extglob + + # 退出时附加命令历史而不是覆盖 + shopt -s histappend + + # 在命令历史使用多行 + shopt -q -s cmdhist + + # 在后台任务结束时立刻通知 + set -o notify + + # 禁用[CTRL-D]来结束shell + set -o ignoreeof + +### 总结 ### + +这个帖子不难理解。它简短地将如何定制用户环境从头介绍了一下。要深入了解bash/ksh/zsh/csh/tcsh/的能力,我建议你用下面的命令阅读man文档: + + man bash + man zsh + man tcsh + man ksh + +> 这篇文章由Aadrika T. J.贡献;由admin编辑并增加了额外内容。你也可以[为nixCraft做出贡献][15]。 + +-------------------------------------------------------------------------------- + +via: http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/ + +作者:[nixCraft][a] +译者:[zpl1025](https://github.com/zpl1025) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.cyberciti.biz/tips/about-us +[1]:http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/attachment/finding-your-shell-like-a-pro/ +[2]:http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/attachment/finding-and-verifying-shell-path/ +[3]:http://www.cyberciti.biz/faq/linux-unix-appleosx-bsd-cat-command-examples/ +[4]:http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/attachment/a-nested-shell-level-command/ +[5]:http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/attachment/list-bash-enviroment-variables/ +[6]:http://zshwiki.org/home/config/files +[7]:http://www.cyberciti.biz/howto/shell-primer-configuring-your-linux-unix-osx-environment/attachment/history-outputs/ +[8]:http://www.cyberciti.biz/open-source/command-line-hacks/linux-run-command-as-different-user/ +[9]:http://www.cyberciti.biz/tips/bash-aliases-mac-centos-linux-unix.html +[10]:http://bash.cyberciti.biz/guide/Chapter_9:_Functions +[11]:http://www.cyberciti.biz/faq/ssh-passwordless-login-with-keychain-for-scripts/ +[12]:http://www.cyberciti.biz/faq/fedora-redhat-scientific-linuxenable-bash-completion/ +[13]:http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html +[14]:http://bash.cyberciti.biz/guide/Setting_shell_options +[15]:http://www.cyberciti.biz/write-for-nixcraft/ diff --git a/published/201503/20150126 4 lvcreate Command Examples on Linux.md b/published/201503/20150126 4 lvcreate Command Examples on Linux.md new file mode 100644 index 0000000000..0da451aef2 --- /dev/null +++ b/published/201503/20150126 4 lvcreate Command Examples on Linux.md @@ -0,0 +1,88 @@ +4 个 lvcreate 常用命令举例 +================================================================================ +逻辑卷管理(LVM)是广泛使用的技术,并拥有极其灵活磁盘管理方案。主要包含3个基础命令: + +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 版本中测试通过。 + +### 4个lvcreate命令例子 ### + +1. 在名为vg_newlvm的卷组中创建15G大小的逻辑卷: + + [root@centos7 ~]# lvcreate -L 15G vg_newlvm + +2. 在名为vg_newlvm的卷组中创建大小为2500MB的逻辑卷,并命名为centos7_newvol,这样就创建了块设备/dev/vg_newlvm/centos7_newvol: + + [root@centos7 ~]# lvcreate -L 2500 -n centos7_newvol vg_newlvm + +3. 可以使用**lvcreate**命令的参数-l来指定逻辑卷扩展的大小。也可以使用这个参数以卷组的大小百分比来扩展逻辑卷。这下列的命令创建了centos7_newvol卷组的50%大小的逻辑卷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 + +更多帮助,使用**lvcreate**命令--help选项来查看: + + [root@centos7 ~]# lvcreate --help + +---------- + + lvcreate: Create a logical volume(创建逻辑卷) + + lvcreate + [-A|--autobackup {y|n}](自动备份) + [-a|--activate [a|e|l]{y|n}] + [--addtag Tag](增加标签) + [--alloc AllocationPolicy](分配策略) + [--cachemode CacheMode](Cache模式) + [-C|--contiguous {y|n}] + [-d|--debug] + [-h|-?|--help] + [--ignoremonitoring](忽略监控) + [--monitor {y|n}](监控) + [-i|--stripes Stripes [-I|--stripesize StripeSize]] + [-k|--setactivationskip {y|n}] + [-K|--ignoreactivationskip] + {-l|--extents LogicalExtentsNumber[%{VG|PVS|FREE}] |(逻辑扩展数) + -L|--size LogicalVolumeSize[bBsSkKmMgGtTpPeE]}(逻辑卷大小) + [-M|--persistent {y|n}] [--major major] [--minor minor] + [-m|--mirrors Mirrors [--nosync] [{--mirrorlog {disk|core|mirrored}|--corelog}]](镜像) + [-n|--name LogicalVolumeName](逻辑卷名字) + [--noudevsync] + [-p|--permission {r|rw}] + [--[raid]minrecoveryrate Rate] + [--[raid]maxrecoveryrate Rate] + [-r|--readahead ReadAheadSectors|auto|none](读取头扇区) + [-R|--regionsize MirrorLogRegionSize](镜像逻辑区域尺寸) + [-T|--thin [-c|--chunksize ChunkSize](块大小) + [--discards {ignore|nopassdown|passdown}] + [--poolmetadatasize MetadataSize[bBsSkKmMgG]]] + [--poolmetadataspare {y|n}] + [--thinpool ThinPoolLogicalVolume{Name|Path}] (精简池逻辑卷) + [-t|--test] + [--type VolumeType](卷类型) + [-v|--verbose] + [-W|--wipesignatures {y|n}] + [-Z|--zero {y|n}] + [--version] + VolumeGroupName [PhysicalVolumePath...] + + +-------------------------------------------------------------------------------- + +via: http://www.ehowstuff.com/4-lvcreate-command-examples-on-linux/ + +作者:[skytech][a] +译者:[Vic020](https://github.com/Vic020) +校对:[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/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/published/201503/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 new file mode 100644 index 0000000000..ff995682ad --- /dev/null +++ b/published/201503/20150126 Cleaning up Ubuntu 14.10,14.04,13.10 system.md @@ -0,0 +1,204 @@ +如何清理你的 Ubuntu 14.10/14.04/13.10 系统 +================================================================================ +前面我们已经讨论了[如何清理 Ubuntu GNU/Linux 系统][1],这篇教程将在原有教程的基础上,增加对新的 Ubuntu 发行版本的支持,并介绍更多的工具。 + +假如你想清理你的 Ubuntu 主机,你可以按照以下的一些简单步骤来移除所有不需要的垃圾文件。 + +## 移除多余软件包 ## + +这又是一个内置功能,但这次我们不必使用新得立包管理软件(Synaptic Package Manager),而是在终端中达到目的。 + +现在,在终端窗口中键入如下命令: + +``` +sudo apt-get autoclean +``` + +这便激活了包清除命令。这个命令所做的工作是: 自动清除那些当你安装或升级程序时系统所缓存的 `.deb` 包(即清除 `/var/cache/apt/archives` 目录,不过只清理过时的包)。如果需要使用清除命令,只需在终端窗口中键入以下命令: + +``` +sudo apt-get clean +``` + +然后你就可以使用自动移除命令。这个命令所做的工作是:清除那些 在系统中被某个已经卸载的软件 作为依赖所安装的软件包。要使用自动移除命令,在终端窗口中键入以下命令: + +``` +sudo apt-get autoremove +``` + +## 移除不需要的本地化数据 ## + +为达到此目的,我们需要安装 `localepurge` 软件,它将自动移除一些不需要的本地化数据(LCTT 译注:即各种语言翻译)。这个软件是一个简单的脚本,它将从那些不再需要的本地化文件和本地化联机手册( man pages ) 所占用的空间中回收磁盘空间。这个软件将在任何 apt 安装命令运行时 被自动激活。 + +在 Ubuntu 中安装 `localepurge` + +``` +sudo apt-get install localepurge +``` + +在通过 `apt-get install` 安装任意软件后, localepurge 将移除所有不是使用你系统中所设定语言的翻译文件和翻译的联机手册。 + +假如你想设置 `localepurge`,你需要编辑 `/ect/locale.nopurge` 文件。 + +根据你已经安装的软件,这将为你节省几兆的磁盘空间。 + +例子:- + +假如我试着使用 `apt-get` 来安装 `dicus`软件: + +``` +sudo apt-get install discus +``` + +在软件安装完毕之后,你将看到如下提示: + +> localepurge: Disk space freed in /usr/share/locale: 41860K + +## 移除孤包 ## + +假如你想移除孤包,你需要安装 `deborphan` 软件: + +在 Ubuntu 中安装 `deborphan` : + +``` +sudo apt-get install deborphan +``` + +### 使用 deborphan ### + +打开终端并键入如下命令即可: + +``` +sudo deborphan | xargs sudo apt-get -y remove --purge +``` + +### 使用 GtkOrphan 来移除孤包 ### + +`GtkOrphan` (一个针对 debian 系发行版本的 Perl/Gtk2 应用) 是一个分析用户安装过程状态并查找孤立库文件的图形化工具,它为 `deborphan` 提供了一个 GUI 前端,并具备移除软件包的功能。 + +#### 在 Ubuntu 中安装 GtkOrphan #### + +打开终端并运行如下命令: + +``` +sudo apt-get install gtkorphan +``` + +#### 一张截图 #### + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/01/41.png) + +### 使用 Wajig 移除孤包 ### + +`Wajig`是 Debian 包管理系统中一个简单的软件包管理前端。它将 apt、apt-cache、 dpkg、 /etc/init.d 中的脚本等 通过一个单一命令集成在一起,它的设计初衷是使用简单和为它的所有功能提供丰富的文档。 + +通过适当的 `sudo`配置,大多数(如果不是全部)的软件包安装和创建等任务可以通过一个用户 shell 来完成。`Wajig` 也适用于一般的系统管理。另外,一个 Gnome GUI 命令 `gjig`也被囊括在这个软件包之中。 + +#### 在 Ubuntu 中安装 Wajig #### + +打开终端并运行如下命令: + +``` +sudo apt-get install wajig +``` + +## Debfoster --- 跟踪你在安装过程中的操作 ## + +debfoster 将会维护一个列有被明确需要安装的软件包的列表,但不包括那些作为某个软件的依赖而被安装的软件包。参数是完全可选的,你甚至可以使得在 dpkg 和/或 apt-get 每次运行之后马上激活 debfoster 。 + +另外,你还可以在命令行中使用 debfoster 来安装或移除某些特定的软件包。那些后缀为 `---` 的软件包将会被移除,而没有后缀的软件包将会被安装。 + +假如一个新的软件包或 debfoster 注意到作为某个软件包的依赖的软件包是一个孤包,则 debfoster 将会询问你下一步如何操作。若你决定保留这个孤包, debfoster 将只会进行记录并继续安装过程;若你觉得这个软件包不足以引起你的兴趣,在 debfoster 询问这个问题后,它将移除这个软件包。进一步的,如果你的决定使得其他的软件包变为孤包,更多的提问将会接踵而来。 + +### 在 Ubuntu 中安装 debfoster ### + +打开终端并运行如下命令: + +``` +sudo apt-get install debfoster +``` + +### 使用 debfoster ### + +为了创建一个初始跟踪文件,可以使用如下命令: + +``` +sudo debfoster -q +``` + +你总可以编辑 `/var/lib/debfoster/keepers` 文件,来定义那些你想留在系统中的软件包。 + +为了编辑这个文件,可以键入: + +``` +sudo vi /var/lib/debfoster/keepers +``` + +要强制使 debfoster 去移除所有没有被列在上面这个文件的软件包,或安装作为某些列在这个文件中的软件包的依赖,它也同时会添加所有在这个列表中没有被安装的软件包。若要根据这个列表来执行相关操作,只需执行: + +``` +sudo debfoster -f +``` + +若需要跟踪你新安装的软件包,你需要时不时地执行如下命令: + +``` +sudo debfoster +``` + +## xdiskusage -- 查看你的硬盘空间都去哪儿了 ## + +图形化地展示磁盘使用情况的 du。xdiskusage 是一个用户友好型的程序,它将为你展示你所有磁盘的使用情况。 它是在 Phillip C. Dykstra 所写的 “xdu” 程序的基础上设计的。做了一些修改以使得它可以为你运行 “du”命令,并显示磁盘的剩余空间,并且假如你想清晰地了解你的磁盘空间都去哪儿了,它还可以生成一个 PostScript 格式的名为 display.xdiskusage 的文件。 + +### 在 Ubuntu 中安装 xdiskusage ### + +只需使用如下命令: + +``` +sudo apt-get install xdiskusage +``` + +若你想打开这个应用,你需要使用如下命令: + +``` +sudo xdiskusage +``` + +一旦这个应用被打开,你将看到如下图所示的界面: + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/01/5.png) + + +## Bleachbit ## + +BleachBit 能快速地释放磁盘空间并不知疲倦地保护你的隐私。它可以释放缓存,删除 cookie,清除 Internet 上网历史,粉碎临时文件,删除日志,丢弃你所不知道存在何处的垃圾。为 Linux 和 Windows 系统而设计,它支持擦除清理数以千计的应用程序,如 Firefox, Internet Explorer, Adobe Flash, Google Chrome, Opera, Safari 等等。除了简单地删除文件,BleachBit 还包括许多高级功能,诸如粉碎文件以防止恢复,擦除磁盘空间来隐藏被其他应用程序所删除文件的痕迹,为火狐“除尘”,使其速度更快等。比免费更好,BleachBit 是一个开源软件。 + +### 在 Ubuntu 中安装 Bleachbit ### + +打开终端并运行如下命令: + +``` +sudo apt-get install bleachbit +``` + +### 一张截图 ### + +![](http://www.ubuntugeek.com/wp-content/uploads/2015/01/6.png) + +### 使用 Ubuntu-Tweak ### + +最后,你也可以使用 [Ubuntu-Tweak][2] 来清理你的系统。 + +-------------------------------------------------------------------------------- + +via: http://www.ubuntugeek.com/cleaning-up-a-ubuntu-gnulinux-system-updated-with-ubuntu-14-10-and-more-tools-added.html + +作者:[ruchi][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[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://linux.cn/article-3335-1.html diff --git a/published/201503/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 new file mode 100644 index 0000000000..77a8441323 --- /dev/null +++ b/published/201503/20150126 How To Kill All Processes Of A Specific User With slay.md @@ -0,0 +1,50 @@ +用‘slay’干掉某个用户的所有进程 +================================================================================ +**slay** 是**Chris Ausbrooks**写的一款用于杀掉指定用户所有运行进程的命令行工具。slay对系统管理员而言在找出那些不应该运行进程的用户是很有用的。 + +slay在大多数发行版中都有官方仓库。 + +安装 + +### Ubuntu 和它的衍生版 ### + + sudo apt-get install slay + +### Arch Linux 和它的衍生版 ### + + sudo pacman -S slay + +### Fedora 和它的衍生版 ### + + sudo yum install slay + +### 用法 ### + +你应该有管理员权限来使用slay, + +要杀掉指定用户的进程,你就要: + + sudo slay + +比如:我想杀掉用户**amitooo**的所有进程。 + + ~ sudo slay amitooo + slay: Done. + +![](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] +译者:[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/seth/ \ No newline at end of file diff --git a/published/201503/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 new file mode 100644 index 0000000000..d54877bd36 --- /dev/null +++ b/published/201503/20150126 How to Add a New Hard Disk Without Rebooting on CentOS 7 or RHEL 7.md @@ -0,0 +1,93 @@ +如何不用重启在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) + +2. 显示当前磁盘分区: + + [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 + I/O size (minimum/optimal): 512 bytes / 512 bytes + Disk label type: dos + Disk identifier: 0x0006b96a + + Device Boot Start End Blocks Id System + /dev/sda1 * 2048 1026047 512000 83 Linux + /dev/sda2 1026048 62914559 30944256 8e Linux LVM + + Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + + Disk /dev/mapper/centos-root: 29.5 GB, 29536288768 bytes, 57688064 sectors + 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 + +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 + +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 + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + Disk label type: dos + Disk identifier: 0x0006b96a + + Device Boot Start End Blocks Id System + /dev/sda1 * 2048 1026047 512000 83 Linux + /dev/sda2 1026048 62914559 30944256 8e Linux LVM + + Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + + Disk /dev/mapper/centos-root: 29.5 GB, 29536288768 bytes, 57688064 sectors + Units = sectors of 1 * 512 = 512 bytes + Sector size (logical/physical): 512 bytes / 512 bytes + I/O size (minimum/optimal): 512 bytes / 512 bytes + + + Disk /dev/sdb: 21.5 GB, 21474836480 bytes, 41943040 sectors + 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) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ehowstuff.com/author/mhstar/ \ No newline at end of file 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/published/201503/20150127 How to limit network bandwidth on Linux.md b/published/201503/20150127 How to limit network bandwidth on Linux.md new file mode 100644 index 0000000000..5be2501e58 --- /dev/null +++ b/published/201503/20150127 How to limit network bandwidth on Linux.md @@ -0,0 +1,112 @@ +怎样在 Linux 中限制网络带宽使用 +================================================================================ +假如你经常在 Linux 桌面上运行多个网络应用,或在家中让多台电脑共享带宽;那么你可能想更好地控制带宽的使用。否则,当你使用下载器下载一个大文件时,交互式 SSH 会话可能会变得缓慢以至不可用;或者当你通过 Dropbox 来同步一个大文件夹时,你的室友可能会抱怨在她的电脑上,视频流变得断断续续。 + +在本教程中,我将为你描述两种在 Linux 中限制网络流量速率的不同方法。 + +### 在 Linux 中限制一个应用的速率 ### + +限制网络流量速率的一种方法是通过一个名为[trickle][1]的命令行工具。通过在程序运行时,预先加载一个速率限制 socket 库 的方法,trickle 命令允许你改变任意一个特定程序的流量。 trickle 命令有一个很好的特性是它仅在用户空间中运行,这意味着,你不必需要 root 权限就可以限制一个程序的带宽使用。要能使用 trickle 程序控制程序的带宽,这个程序就必须使用非静态链接库的套接字接口。当你想对一个不具有内置带宽控制功能的程序进行速率限制时,trickle 可以帮得上忙。 + +在 Ubuntu,Debian 及其衍生发行版中安装 trickle : + +``` +$ sudo apt-get install trickle +``` + +在 Fdora 或 CentOS/RHEL (带有 [EPEL 软件仓库][2]): + +``` +$ sudo yum install trickle +``` + +trickle 的基本使用方法如下。仅需简单地把 trickle 命令(及速率参数)放在你想运行的命令之前。 + +``` +$ trickle -d -u +``` + +这就可以将 `` 的下载和上传速率限定为特定值(单位 KBytes/s)。 + +例如,将你的 scp 会话的最大上传带宽设定为 100 KB/s: + +``` + $ trickle -u 100 scp backup.tgz alice@remote_host.com: +``` + +如若你想,你可以通过创建一个[自定义启动器][3]的方式,使用下面的命令为你的 Firefox 浏览器设定最大下载速率(例如, 300 KB/s)。 + +``` +trickle -d 300 firefox %u +``` + +最后, trickle 也可以以守护进程模式运行,在该模式下,它将会限制所有通过 trickle 启动且正在运行的程序的总带宽之和。 启动 trickle 使其作为一个守护进程(例如, trickled): + +``` +$ sudo trickled -d 1000 +``` + +一旦 trickled 守护进程在后台运行,你便可以通过 trickle 命令来启动其他程序。假如你通过 trickle 启动一个程序,那么这个程序的最大下载速率将是 1000 KB/s, 假如你再通过 trickle 启动了另一个程序,则每个程序的(下载)速率极限将会被限制为 500 KB/s,等等。 + +### 在 Linux 中限制一个网络接口的速率 ### + +另一种控制你的带宽资源的方式是在每一个接口上限制带宽。这在你与其他人分享你的网络连接的上行带宽时尤为实用。同其他一样,Linux 有一个工具来为你做这件事。[wondershaper][4]就是干这个的。 + +wondershaper 实际上是一个 shell 脚本,它使用 [tc][5] 来定义流量调整命令,使用 QoS 来处理特定的网络接口。外发流量通过放在不同优先级的队列中,达到限制传出流量速率的目的;而传入流量通过丢包的方式来达到速率限制的目的。 + +事实上, wondershaper 的既定目标不仅仅是对一个接口增加其带宽上限;当批量下载或上传正在进行时,wondershaper 还试图去保持互动性会话如 SSH 的低延迟。同样的,它还会控制批量上传(例如, Dropbox 的同步)不会使得下载“窒息”,反之亦然。 + +在 Ubuntu Debian 及其衍生发行版本 中安装 wondershaper: + +``` +$ sudo apt-get install wondershaper +``` + +在 Fdora 或 CentOS/RHEL (带有 [EPEL 软件仓库][2]) 中安装 wondershaper: + +``` +$ sudo yum install wondershaper +``` + +wondershaper 的基本使用如下: + +``` + $ sudo wondershaper +``` + +举个例子, 将 `eth0` 的最大下载/上传带宽分别设定为 1000Kbit/s 和 500Kbit/s: + +``` +$ sudo wondershaper eth0 1000 500 +``` + +你也可以通过运行下面的命令将速率限制进行消除: + +``` +$ sudo wondershaper clear eth0 +``` + +假如你对 wondershaper 的运行原理感兴趣,你可以阅读其 shell 脚本源文件(/sbin/wondershaper)。 + +### 总结 ### + +在本教程中,我介绍了两种不同的方法,来达到如何在 Linux 桌面环境中,控制每个应用或每个接口的带宽使用的目的。 这些工具的使用都很简单,都为用户提供了一个快速且容易的方式来调整或限制流量。 对于那些想更多地了解如何在 Linux 中进行速率控制的读者,请参考 [the Linux bible][7]. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/limit-network-bandwidth-linux.html + +作者:[Dan Nanni][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/nanni +[1]:http://monkey.org/~marius/trickle +[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://linux.cn/article-2324-1.html +[7]:http://www.lartc.org/lartc.html diff --git a/published/201503/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md b/published/201503/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md new file mode 100644 index 0000000000..e9db8a1172 --- /dev/null +++ b/published/201503/20150127 LinSSID--A Graphical Wi-Fi Scanner for Linux.md @@ -0,0 +1,61 @@ +LinSSID:一款Linux下的图形化Wi-Fi扫描器 +================================================================================ +### 介绍 ### + +你可能知道,**LinSSID** 是一款可以用于寻找可用无线网络的图形化软件。它完全开源,用C++写成,使用了Linux wireless tools、Qt5、Qwt6.1,它在外观和功能上与**Inssider** (MS Windows 下的)相近。 + +### 安装 ### + +你可以使用源码安装,如果你使用的是基于DEB的系统比如Ubuntu和LinuxMint等等,你也可以使用PPA安装。 + +你可用从[这个][1]下载并安装LinSSID。 + +这里我门将使用PPA来安装并测试这个软件。 + +添加LinSSID的PPA并输入下面的命令安装。 + + sudo add-apt-repository ppa:wseverin/ppa + sudo apt-get update + sudo apt-get install linssid + +### 用法 ### + +安装完成之后,你可以从菜单或者unity中启动。 + +你需要输入管理员密码。 + +![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://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/LinSSID_002.png) + +现在选择你想要连接无线网络的网卡,比如这里是wlan0,点击Play按钮来搜寻wi-fi网络列表。 + +几秒钟之后,LinSSID就会显示wi-fi网络了。 + +![LinSSID_003](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/01/LinSSID_003.png) + +如你在上面的截屏中所见,LinSSID显示SSID名、MAC ID、通道、隐私、加密方式、信号和协议等等信息。当然,你可以让LinSSID显示更多的选项,比如安全设置、带宽等等。要显示这些,进入**View**菜单并选择需要的选项。同样,它显示了不同的通道中的信号随着时间信号强度的变化。最后,它可以工作在2.4Ghz和5Ghz通道上。 + +就是这样。希望这个工具对你有用。 + +干杯!! + +参考链接: + +- [LinSSID 主页][2] + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/linssid-graphical-wi-fi-scanner-linux/ + +作者:[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://sourceforge.net/projects/linssid/files/ +[2]:http://sourceforge.net/projects/linssid/ 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/published/201503/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 new file mode 100644 index 0000000000..7a12be0642 --- /dev/null +++ b/published/201503/20150128 How To Monitor Access Point Signal Strength With wifi-linux.md @@ -0,0 +1,86 @@ +如何用wifi-linux检测AP信号强度 +================================================================================ +作为一名python极客,我喜欢在github上挖掘新的用于linux用户的python工具。今天我发现了一款用python写成的用于检测AP信号强度的工具:wifi-linux。 + +我已经在**wifi-linux**上实验了大约两个小时,并且它工作的很好但是我希望在不久的将来在作者那里看到一些单元测试,因为命令**plot**无法在我的电脑上工作,并且会导致一些问题。 + +### 什么是wifi-linux ### + +根据github上作者账号的官方的 readme.md文件, wifi-linux是一个简单的收集你周围AP的RSSI信息的python脚本,它还会画出RSSI活动图形。 + +作者说可以在该程序中可以使用plot命令绘制RSSI 活动图形,但是不幸的是,这对我不可行。wifi-linux也支持其他的命令,比如**bp** 来加入一个断点,**print**会打印一些统计和**启动开关**。 + +wifi-linux程序有下面这些依赖: + +- dbus-python +- gnuplot-py + +首先我们需要安装所有的包依赖以使它可以运行在我们的linux机器上。 + +### 安装wifi-linux需要的包 ### + +我尝试使用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。 + + sudo apt-get install python-dbus + +上面的命令只有在有apt-get包管理器的机器中才可以使用,比如Debian和Ubuntu。 + +我们要安装的第二个依赖是gnuplot-py。下载并用tar解压,接着运行setup.py来安装包。 + +第一步是下载gnuplot-py。 + + wget http://prdownloads.sourceforge.net/gnuplot-py/gnuplot-py-1.8.tar.gz + +接着使用tar工具解压。 + + tar xvf gnuplot-py-1.8.tar.gz + +接着使用cd命令改变目录。 + + cd gnuplot-py-1.8 + +接着运行下面的命令在你的系统中安装gnuplot-py。 + + sudo setup.py install + +安装完成后,你就可以在你的系统中运行wifi-linux了。只需下载并用下面的命令运行脚本。 + +用下面的命令下载wifi-linux到你的机器中。 + + wget https://github.com/dixel/wifi-linux/archive/master.zip + +解压master.zip接着使用下面的命令运行list_rsssi.py脚本。 + + python list_rssi.py + +下面的截图说明wifi-linux在工作了。 + +![wifi-linux to monitor wifi signal strength](http://blog.linoxide.com/wp-content/uploads/2015/01/wifi-linux.png) + +命令**bp**用于像下面那样添加一个断点。 + +![the bp command in wifi-linux](http://blog.linoxide.com/wp-content/uploads/2015/01/wifi-linux2.png) + +命令**print**可以用于在终端上显示你机器的状态。下面就是一个例子。 + +![the print command](http://blog.linoxide.com/wp-content/uploads/2015/01/wifi-linux3.png) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/monitor-access-point-signal-strength-wifi-linux/ + +作者:[Oltjano Terpollari][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/oltjano/ diff --git a/published/201503/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 new file mode 100644 index 0000000000..a5bdc115e2 --- /dev/null +++ b/published/201503/20150128 Linux Basics--How To Check If A Package Is Installed Or Not In Ubuntu.md @@ -0,0 +1,137 @@ +Linux 基础:如何在Ubuntu上检查一个软件包是否安装 +================================================================================ +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2014/04/ubuntu-790x558.png) + +如果你正在管理Debian或者Ubuntu服务器,你也许会经常使用**dpkg** 或者 **apt-get**命令。这两个命令用来安装、卸载和更新包。 + +在本篇中,让我们看下如何在基于DEB的系统下检查是否安装了一个包。 + +要检查特定的包,比如firefox是否安装了,使用这个命令: + + dpkg -s firefox + +示例输出: + + Package: firefox + Status: install ok installed + Priority: optional + Section: web + Installed-Size: 93339 + Maintainer: Ubuntu Mozilla Team + Architecture: amd64 + Version: 35.0+build3-0ubuntu0.14.04.2 + Replaces: kubuntu-firefox-installer + Provides: gnome-www-browser, iceweasel, www-browser + Depends: lsb-release, libasound2 (>= 1.0.16), libatk1.0-0 (>= 1.12.4), libc6 (>= 2.17), libcairo2 (>= 1.2.4), libdbus-1-3 (>= 1.0.2), libdbus-glib-1-2 (>= 0.78), libfontconfig1 (>= 2.9.0), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libgdk-pixbuf2.0-0 (>= 2.22.0), libglib2.0-0 (>= 2.37.3), libgtk2.0-0 (>= 2.24.0), libpango-1.0-0 (>= 1.22.0), libpangocairo-1.0-0 (>= 1.14.0), libstartup-notification0 (>= 0.8), libstdc++6 (>= 4.6), libx11-6, libxcomposite1 (>= 1:0.3-1), libxdamage1 (>= 1:1.1), libxext6, libxfixes3, libxrender1, libxt6 + Recommends: xul-ext-ubufox, libcanberra0, libdbusmenu-glib4, libdbusmenu-gtk4 + Suggests: ttf-lyx + Conffiles: + /etc/firefox/syspref.js 09e457e65435a1a043521f2bd19cd2a1 + /etc/apport/blacklist.d/firefox ee63264f847e671832d42255912ce144 + /etc/apport/native-origins.d/firefox 7c26b75c7c2b715c89cc6d85338252a4 + /etc/apparmor.d/usr.bin.firefox f54f7a43361c7ecfa3874abca2f292cf + Description: Safe and easy web browser from Mozilla + Firefox delivers safe, easy web browsing. A familiar user interface, + enhanced security features including protection from online identity theft, + and integrated search let you get the most out of the web. + Xul-Appid: {ec8030f7-c20a-464f-9b0e-13a3a9e97384} + +如上所见,firefox已经安装了。 + +同样,你可以使用**dpkg-query** 命令。这个命令会有一个更好的输出,当然,你可以用通配符。 + + dpkg-query -l firefox + +示例输出: + + Desired=Unknown/Install/Remove/Purge/Hold + | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend + |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad) + ||/ Name Version Architecture Description + +++-====================================-=======================-=======================-============================================================================= + ii firefox 35.0+build3-0ubuntu0.14 amd64 Safe and easy web browser from Mozilla + +要列出你系统中安装的所有包,输入下面的命令: + + dpkg --get-selections + +示例输出: + + abiword install + abiword-common install + accountsservice install + acl install + adduser install + alsa-base install + alsa-utils install + anacron install + app-install-data install + apparmor install + . + . + . + zeitgeist install + zeitgeist-core install + zeitgeist-datahub install + zenity install + zenity-common install + zip install + zlib1g:amd64 install + zlib1g:i386 install + +上面的输出可能会非常长,这依赖于你的系统已安装的包。 + +你同样可以通过**grep**来过滤割到更精确的包。比如,我想要使用**dpkg**命令查看系统中安装的gcc包: + + dpkg --get-selections | grep gcc + +示例输出: + + gcc install + gcc-4.8 install + gcc-4.8-base:amd64 install + gcc-4.8-base:i386 install + gcc-4.9-base:amd64 install + gcc-4.9-base:i386 install + libgcc-4.8-dev:amd64 install + libgcc1:amd64 install + libgcc1:i386 install + +此外,你可以使用“**-L**”参数来找出包中文件的位置。 + + dpkg -L gcc-4.8 + +示例输出: + + /. + /usr + /usr/share + /usr/share/doc + /usr/share/doc/gcc-4.8-base + /usr/share/doc/gcc-4.8-base/README.Bugs + /usr/share/doc/gcc-4.8-base/NEWS.html + /usr/share/doc/gcc-4.8-base/quadmath + /usr/share/doc/gcc-4.8-base/quadmath/changelog.gz + /usr/share/doc/gcc-4.8-base/gcc + . + . + . + /usr/bin/x86_64-linux-gnu-gcc-4.8 + /usr/bin/x86_64-linux-gnu-gcc-ar-4.8 + /usr/bin/x86_64-linux-gnu-gcov-4.8 + +就是这样了。希望这篇对你有用。 + +美好的一天! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/linux-basics-check-package-installed-not-ubuntu/ + +作者:[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/ 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/published/201503/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 new file mode 100644 index 0000000000..c374f9f670 --- /dev/null +++ b/published/201503/20150202 How To Install Websvn for Subversion in CentOS 7.0.md @@ -0,0 +1,126 @@ +如何在CentOS 7.0 安装 Websvn +================================================================================ +大家好,今天我们会在CentOS 7.0 上为 subversion(SVN)安装Web 界面 WebSVN。(subverion 是 apache 的顶级项目,也称为 Apache SVN 或 SVN) + +WebSVN 将 Svbverion 的操作你的仓库的各种功能通过 Web 界面提供出来。通过它,我们可以看到任何给定版本的任何文件或者目录的日志,并且可看到所有文件改动、添加、删除的列表。我们同样可以查看两个版本间的差异来知道特定版本改动了什么。 + +### 特性 ### + +WebSVN提供了下面这些特性: + +- 易于使用的用户界面 +- 可定制的模板系统 +- 色彩化的文件列表 +- 追溯视图 +- 日志信息查询 +- RSS支持 +- [更多][1] + +由于其使用PHP写成,WebSVN同样易于移植和安装。 + +现在我们将为Subverison安装WebSVN。请确保你的服务器上已经安装了 SVN。如果你还没有安装,你可以按[本教程][2]安装。 + +安装完SVN后,你需要以下几步。 + +### 1. 下载 WebSVN ### + +你可以从官方网站 http://www.websvn.info/download/ 中下载 WebSVN。我们首先进入 /var/www/html/ 并在这里下载安装包。 + + $ sudo -s + +**请在shell或者终端中执行上面的命令,因为我们需要切换到root权限来对系统限制区域有访问权。** + + # cd /var/www/html + # wget http://websvn.tigris.org/files/documents/1380/49057/websvn-2.3.3.zip + +![downloading websvn package](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-websvn.png) + +这里,我下载的是最新的2.3.3版本的 websvn。你可以从上面这个网站找到下载链接,用适合你的包的链接来替换上面的链接。 + +### 2. 解压下载的zip ### + + # unzip websvn-2.3.3.zip + + # mv websvn-2.3.3 websvn + +![extracting websvn](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-websvn.png) + +### 3. 安装php ### + + # yum install php + +![yum install php](http://blog.linoxide.com/wp-content/uploads/2015/01/yum-install-php.png) + +### 4. 编辑WebSVN配置 ### + +现在,我们需要拷贝位于 /var/www/html/websvn/include 的 distconfig.php 为 config.php,并且接着编辑该配置文件。 + + # cd /var/www/html/websvn/include + + # cp distconfig.php config.php + + # nano config.php + +现在我们需要按如下改变文件。完成之后,请保存并退出。 + + // Configure these lines if your commands aren't on your path. + // + $config->setSVNCommandPath('/usr/bin'); // e.g. c:\\program files\\subversion\\bin + $config->setDiffPath('/usr/bin'); + + // For syntax colouring, if option enabled... + $config->setEnscriptPath('/usr/bin'); + $config->setSedPath('/bin'); + + // For delivered tarballs, if option enabled... + $config->setTarPath('/bin'); + + // For delivered GZIP'd files and tarballs, if option enabled... + $config->setGZipPath('/bin'); + + // + $config->parentPath('/svn/'); + + $extEnscript[".pl"] = "perl"; + $extEnscript[".py"] = "python"; + $extEnscript[".sql"] = "sql"; + $extEnscript[".java"] = "java"; + $extEnscript[".html"] = "html"; + $extEnscript[".xml"] = "html"; + $extEnscript[".thtml"] = "html"; + $extEnscript[".tpl"] = "html"; + $extEnscript[".sh"] = "bash"; + +![websvn config file](http://blog.linoxide.com/wp-content/uploads/2015/01/config-file-websvn.png) + +### 5. 启动 WebSVN ### + +现在,我们将近完成了。现在需要重启Apache服务。你可以用下面的命令。 + + # systemctl restart httpd.service + +接着我们在浏览器中打开WebSVN,输入 http:// IP地址/websvn ,或者你在本地的话,你可以输入 http://localhost/websvn 。 + +![websvn successfully installed](http://blog.linoxide.com/wp-content/uploads/2015/01/websvn-success.png) + +**注意**: 如果你遇到一个像"Unable to find "enscript" tool at location "/usr/bin/enscript"这样的问题,那么你需要使用“yum install enscript”安装enscript来修复这个问题。 + +### 总结 ### + +好了,我们已经在CentOS 7上完成WebSVN的安装了。这个教程同样适用于RHEL 7。WebSVN 提供了 Subverion 中的各种功能来查看你的仓库。你可以看到任何给定版本的任何文件或者目录的日志,并且看到所有文件改动、添加、删除的列表。 + +如果你有任何问题、评论、反馈请在下面的评论栏中留下,来让我们知道该添加什么和改进。谢谢! 用用看吧。:-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-websvn-subversion-centos-7/ + +作者:[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://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/published/201503/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 new file mode 100644 index 0000000000..31a10d3923 --- /dev/null +++ b/published/201503/20150205 Linux Basics--Assign Multiple IP Addresses To Single Network Interface Card On CentOS 7.md @@ -0,0 +1,206 @@ +在CentOS 7上给一个网卡分配多个IP地址 +================================================================================ +有时你也许想要给一个网卡多个地址。你该怎么做呢?另外买一个网卡来分配地址?在小型网络中其实不用这么做。我们现在可以在CentOS/RHEL 7中给一个网卡分配多个ip地址。想知道怎么做么?好的,跟随我,这并不难。 + +首先,让我们找到网卡的IP地址。在我的CentOS 7服务器中,我只使用了一个网卡。 + +用root特权运行下面的命令: + + ip addr + +示例输出: + + 1: lo: mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever + 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether 08:00:27:80:63:19 brd ff:ff:ff:ff:ff:ff + inet 192.168.1.150/24 brd 192.168.1.255 scope global enp0s3 + valid_lft forever preferred_lft forever + +如上所见,我的网卡名是enp0s3,ip地址是192.168.1.150。 + +如你所知,网卡的配置文件存储在 **/etc/sysconfig/network-scripts/** 目录下。每个网卡的详细内容将会以不同的名字存储,比如**ifcfg-enp0s3**。 + +让我们看下**ifcfg-enp0s3**的细节。 + + cat /etc/sysconfig/network-scripts/ifcfg-enp0s3 + +示例输出: + + TYPE="Ethernet" + BOOTPROTO="none" + DEFROUTE="yes" + IPV4_FAILURE_FATAL="no" + IPV6INIT="yes" + IPV6_AUTOCONF="yes" + IPV6_DEFROUTE="yes" + IPV6_FAILURE_FATAL="no" + NAME="enp0s3" + UUID="e9f9caef-cb9e-4a19-aace-767c6ee6f849" + ONBOOT="yes" + HWADDR="08:00:27:80:63:19" + IPADDR0="192.168.1.150" + PREFIX0="24" + GATEWAY0="192.168.1.1" + DNS1="192.168.1.1" + IPV6_PEERDNS="yes" + IPV6_PEERROUTES="yes" + +好的,现在我们将在相同的子网中分配多个地址了。 + +编辑文件 **/etc/sysconfig/network-scripts/ifcfg-enp0s3**: + + vi /etc/sysconfig/network-scripts/ifcfg-enp0s3 + +像下面那样加入额外的IP地址。 + + TYPE="Ethernet" + BOOTPROTO="none" + DEFROUTE="yes" + IPV4_FAILURE_FATAL="no" + IPV6INIT="yes" + IPV6_AUTOCONF="yes" + IPV6_DEFROUTE="yes" + IPV6_FAILURE_FATAL="no" + NAME="enp0s3" + UUID="933cdc9b-b383-4ddd-b219-5a72c69c9cf0" + ONBOOT="yes" + HWADDR="08:00:27:3F:AB:68" + IPADDR0="192.168.1.150" + IPADDR1="192.168.1.151" + IPADDR2="192.168.1.152" + PREFIX0="24" + GATEWAY0="192.168.1.1" + DNS1="192.168.1.1" + IPV6_PEERDNS="yes" + IPV6_PEERROUTES="yes" + +如你所见,我已经加了两个IP地址:**IPADDR1=”192.168.1.151″ & IPADDR2=”192.168.1.152″** + +类似地,你可以加入更多的ip地址。 + +最后,保存并退出文件。重启网络服务来使更改生效。 + + systemctl restart network + +现在,让我们检查是否已经加入了ip地址。 + + ip addr + +示例输出: + + : lo: mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever + 2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether 08:00:27:3f:ab:68 brd ff:ff:ff:ff:ff:ff + inet 192.168.1.150/24 brd 192.168.1.255 scope global enp0s3 + valid_lft forever preferred_lft forever + inet 192.168.1.151/24 brd 192.168.1.255 scope global secondary enp0s3 + valid_lft forever preferred_lft forever + inet 192.168.1.152/24 brd 192.168.1.255 scope global secondary enp0s3 + valid_lft forever preferred_lft forever + inet6 fe80::a00:27ff:fe3f:ab68/64 scope link + valid_lft forever preferred_lft forever + +如你所见,单个网卡已经有3个ip地址了。 + +让我们ping一下新增的IP地址: + + ping -c 4 192.168.1.151 + +示例输出: + + 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 + 64 bytes from 192.168.1.151: icmp_seq=2 ttl=64 time=0.075 ms + 64 bytes from 192.168.1.151: icmp_seq=3 ttl=64 time=0.077 ms + 64 bytes from 192.168.1.151: icmp_seq=4 ttl=64 time=0.077 ms + + --- 192.168.1.151 ping statistics --- + 4 packets transmitted, 4 received, 0% packet loss, time 2999ms + rtt min/avg/max/mdev = 0.048/0.069/0.077/0.013 ms + +---------- + + ping -c 4 192.168.1.152 + +示例输出: + + 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 + 64 bytes from 192.168.1.152: icmp_seq=2 ttl=64 time=0.075 ms + 64 bytes from 192.168.1.152: icmp_seq=3 ttl=64 time=0.073 ms + 64 bytes from 192.168.1.152: icmp_seq=4 ttl=64 time=0.075 ms + + --- 192.168.1.152 ping statistics --- + 4 packets transmitted, 4 received, 0% packet loss, time 2999ms + rtt min/avg/max/mdev = 0.034/0.064/0.075/0.018 ms + +如果你想要使用**不同的子网**,你要改变**PREFIX0=24**成不同的子网,比如 **PREFIX1=16**。 + +比如,我想要添加一个A类地址(**比如10.0.0.1*)到我的网卡中。 + + TYPE="Ethernet" + BOOTPROTO="none" + DEFROUTE="yes" + IPV4_FAILURE_FATAL="no" + IPV6INIT="yes" + IPV6_AUTOCONF="yes" + IPV6_DEFROUTE="yes" + IPV6_FAILURE_FATAL="no" + NAME="enp0s3" + UUID="933cdc9b-b383-4ddd-b219-5a72c69c9cf0" + ONBOOT="yes" + HWADDR="08:00:27:3F:AB:68" + IPADDR0="192.168.1.150" + IPADDR1="192.168.1.151" + IPADDR2="192.168.1.152" + IPADDR3="10.0.0.1" + PREFIX0="24" + PREFIX1=16 + GATEWAY0="192.168.1.1" + DNS1="192.168.1.1" + IPV6_PEERDNS="yes" + IPV6_PEERROUTES="yes" + +你可以看到我已经添加一个A类地址(10.0.0.1)并且前缀是16。 + +保存并退出文件。重启网络服务,接着,ping新增的地址: + + ping -c 4 10.0.0.1 + +示例输出: + + 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 + 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=0.073 ms + 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=0.074 ms + 64 bytes from 10.0.0.1: icmp_seq=4 ttl=64 time=0.075 ms + + --- 10.0.0.1 ping statistics --- + 4 packets transmitted, 4 received, 0% packet loss, time 3000ms + rtt min/avg/max/mdev = 0.073/0.079/0.097/0.014 ms + +相似地,你可以添加不同的网关。 + +就是这样。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/linux-basics-assign-multiple-ip-addresses-single-network-interface-card-centos-7/ + +作者:[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/ 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/20150306 Nmap--Not Just for Evil.md b/published/20150306 Nmap--Not Just for Evil.md new file mode 100644 index 0000000000..e84ed9a1a7 --- /dev/null +++ b/published/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/20150310 4 Linux Based Mini PC You Can Buy In 2015.md b/published/20150310 4 Linux Based Mini PC You Can Buy In 2015.md new file mode 100644 index 0000000000..bbb7efa05c --- /dev/null +++ b/published/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/20150318 Fedora GNOME Keyboard Shortcuts.md b/published/20150318 Fedora GNOME Keyboard Shortcuts.md new file mode 100644 index 0000000000..75fdf0916e --- /dev/null +++ b/published/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/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 9af3b6665c..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. - --------------------------------------------------------------------------------- - -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/ \ No newline at end of file diff --git a/sources/news/20150402 The VirtualBox 5.0 beta is finally here.md b/sources/news/20150402 The VirtualBox 5.0 beta is finally here.md new file mode 100644 index 0000000000..475ef2f811 --- /dev/null +++ b/sources/news/20150402 The VirtualBox 5.0 beta is finally here.md @@ -0,0 +1,35 @@ +The VirtualBox 5.0 beta is finally here +======================================= +**Oracle's desktop virtualization software gets its first major point revision in almost five years, but the changes are more evolutionary than revolutionary.** + +VirtualBox, the open source virtualization system originally created by Sun and now under Oracle's stewardship, has released its first revision to the left of the decimal point in nearly five years. + +Don't expect anything truly revolutionary, though, judging from the release notes for and the behavior of the beta itself. With this release, VirtualBox picks up a bit more polish, both visually and technologically, but its main advantage over VMware remains with its offer of a free incarnation of many of the same core features. + +The last major version of VirtualBox 4.0 was released in December 2010, and it delivered a heavily reworked version of the program with a new GUI, new virtual hardware, and a reorganized project design. But the pace of major releases for the project was slow, with the last major release (version 4.3) arriving in late 2013. Everything since then has been officially designated as a "maintenance" release. + +**VirtualBox 5.0** + +*The first beta of VirtualBox 5.0 adds features like the ability to edit the menus and shortcut icons for VM windows, as shown here.* + +Among the biggest changes for VirtualBox 5.0 is support for more instruction set extensions that run with hardware-assisted virtualization. The AES-NI instruction set, typically used for hardware acceleration of encryption, and the SSE 4.1 and SSE 4.2 instructions sets were included among them. Also new is paravirtualization support for Windows and Linux guests, a new architecture for abstracting host audio, and support for USB 3 (xHCI) controller in guests. + +Most of the usability updates are improvements to the VirtualBox GUI. One big change is the ability to customize the menus and the toolbar for individual virtual machines so that little- or never-used options can be removed entirely. Another major addition is the ability to encrypt virtual volumes from within the VirtualBox interface, rather than relying on the guest OS's own disk-encryption system (assuming it has one). + +Oracle warns that this is beta software and should be treated accordingly. Sure enough, the main GUI and the guest OS windows all sport black-and-red Beta warnings in one corner. But a Windows 10 VM created with the previous VirtualBox release (4.3.26) booted and ran fine, and the 5.0 version of the VirtualBox Guest Additions -- for better video support, bidirectional copy and paste, and other features -- installed without issues. (Fixes to better support Windows 10 have been showing up since version 4.3.18.) + +No word has been given yet on when the final version of 5.0 will be out, but Oracle [encourages users][1] to download and try out the beta -- in a nonproduction environment -- and file bug reports with their [beta feedback forum][2]. + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2905098/virtualization/oracle-virtualbox-5-0-beta-is-finally-here.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]:https://forums.virtualbox.org/viewtopic.php?f=15&t=66904 +[2]:https://forums.virtualbox.org/viewforum.php?f=15 diff --git a/sources/share/20140804 Group Test--Linux Text Editors.md b/sources/share/20140804 Group Test--Linux Text Editors.md index b1f2846a0e..02c1b2b586 100644 --- a/sources/share/20140804 Group Test--Linux Text Editors.md +++ b/sources/share/20140804 Group Test--Linux Text Editors.md @@ -1,3 +1,4 @@ +Love-xuan Translating Group Test: Linux Text Editors ================================================================================ > Mayank Sharma tests five supercharged text editors that can crunch more than just words. @@ -315,4 +316,4 @@ via: http://www.linuxvoice.com/text-editors/ 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 -[a]:http://www.linuxvoice.com/author/ben_everard/ \ No newline at end of file +[a]:http://www.linuxvoice.com/author/ben_everard/ diff --git a/sources/share/20140819 Top 4 Linux download managers.md b/sources/share/20140819 Top 4 Linux download managers.md deleted file mode 100644 index 0282a2e91c..0000000000 --- a/sources/share/20140819 Top 4 Linux download managers.md +++ /dev/null @@ -1,150 +0,0 @@ -Translating By H-mudcup - -Top 4 Linux download managers -================================================================================ -**Improve and better manage your web downloads for mirroring, mass grabs or just better control over your files** - -Download managers seem to be old news these days, but there are still some excellent uses for them. We compare the top four of them on Linux. - -### [uGet][1] ### - -Advertised as lightweight and full- featured like a majority of other Linux apps, uGet can handle multi- threaded streams, includes filters and can integrate with an undefined selection of web browsers. It’s been around for over ten years now, starting out as UrlGet, and can also run on 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 is actually very full-featured, with a lot of the kind of functions that advanced torrent clients use - -#### Interface #### - -uGet reminds us of any number of torrent client interfaces, with categories for Active, Finished, Paused and so on for the different downloads. Although there is a lot of information to take in, it’s all presented very cleanly and clearly. The main downloading controls are easy to access, with more advanced ones alongside them. - -#### Integration #### - -While it can see into the clipboard for URLs, uGet doesn’t natively integrate into browsers like Chromium and Firefox. Still, there are add-ons for both these browsers that allow them to connect to uGet: Firefox via FlashGot and Chromium with a dedicated plug-in. Not ideal, but good enough. - -#### Features #### - -uGet’s maturity affords it a range of features, including advanced scheduling to switch downloading on and off, batch download via the clipboard and the ability to change which file types it looks for in the clipboard. There are plug-in options, but not a huge amount. - -#### Availability #### - -While it’s also available in most major distro repos, the uGet website includes regularly updated binaries for a variety of popular distributions as well as easily accessible source code. It runs on GTK 3+ so it has a smaller footprint in some desktop environments than others, although we’d say it’s worth the extra dependancies in KDE or other Qt desktops. - -#### Overall #### - -8/10 - -We very much like uGet – its wide variety of features and popularity have allowed it to develop quite a lot to be an all-encompassing solution to download management, with some decent integration with Linux browsers. - -### [KGet][2] ### - -KDE’s own download manager seems to have been originally designed to work with Konqueror, the KDE web browser. It comes with the kind of features we’re looking for in this test: control of multiple downloads and the ability to run a checksum alongside the downloaded product. - -![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) -You need to manually activate the ability to keep an eye on the clipboard for links - -#### Interface #### - -As expected of a KDE app, KGet fits the aesthetic style of the desktop environment with similar icons and curves throughout. It’s quite a simple design as well, with only the most necessary functions available on the main toolbars and a minimal view of the current downloads. - -#### Integration #### - -KGet natively integrates with KDE’s Konqueror browser, although it’s not the most popular. Support for it in Firefox is done via FlashGot as usual, but there’s no real way to do it in Chromium. You can turn on a feature that asks if you want to download copied URLs, however it doesn’t parse the clipboard very well and sometimes wants to download text. - -#### Features #### - -The selection of features available are not that high. No scheduling, no batch operations and generally an almost bare-minimum amount of downloading features. The clipboard-scanning feature is a nice idea but it’s a bit buggy. It’s a little weird as the Settings menu looks like it’s designed to have more settings and options. - -#### Availability #### - -While it doesn’t come by default with a KDE install, it is available for any distro that supports KDE. It does need a few KDE libraries to run though, and it’s a bit tricky to find the source code. There isn’t a selection of binaries that you can use with a few distros either. - -#### Overall #### - -6/10 - -KGet doesnt really offer users a huge amount more than the download manager in the majority of popular browsers, although at least you can use it while the browsers are otherwise turned off. - -### [DownThemAll!][3] ### - -DownThemAll, being somewhat platform-independent, comes to Linux by way of Firefox as an add- on. This limits it somewhat to use with only Firefox, however as one of the most popular browsers in the world its tighter integration may be just what some are looking for in a download manager. - -![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) -There are actually a whole lot of options available for DownThemAll! that make it very flexible - -#### Interface #### - -Part of the integration in Firefox allows DownThemAll! to slot into the standard aesthetic of the browser, with right-clicking bringing up options alongside the normal downloading ones. The extra dialog menus are generally themed after Firefox as well, while the main download window is clean and based on its own design - -#### Integration #### - -It doesn’t integrate system-wide but its ability to camouflage itself with Firefox makes it seem like an extra part of the original browser. It can also run alongside the normal downloader if you want, and can find specific link types on a webpage with little manual filtering, and no need for copy and pasting. - -#### Features #### - -With the ability to control how many downloads can happen at once, limit bandwidth when not idle and advanced auto or manual filtering, DownThemAll! is full of excellent features that aid mass downloading. The One Click function also allows it to very quickly start downloads to a pre- determined folder faster than normal download functions. - -#### Availability #### - -Firefox is available on just about every distro and other operating system around, which makes DownThemAll! just as prolific. Unfortunately this is a double-edged sword, as Firefox may not be your browser of choice. It also adds a little weight to the browser, which isn’t the lightest to begin with. - -#### Overall #### - -7/10 - -DownThemAll! is excellent and if you use Firefox you may not need to use anything else. Not everyone uses Firefox as their preferred browser though, and it needs to be left on for the manager to start running. - -### [Steadyflow][4] ### - -Easily available in Ubuntu and some Debian-based distros, Steadyflow may be limited in terms of where you can get it but it’s got a reputation in some circles as one of the better managers available for any distro. It can read the clipboard for URLs, use GNOME’s preset proxies and has many other features. - -![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) -The settings in Steady flow are extremely limiting and somewhat difficult to access - -#### Interface #### - -Steadyflow is quite simple in appearance with a pleasant, clean interface that doesn’t clutter the download window. The dialog for adding downloads is simple enough, with basic options for how to treat it and where the file should live. It’s nothing we can really complain about, although it does remind us of the lack of features in the app. - -#### Integration #### - -Reading copied URLs is as standard and there’s a plug-in for Chromium to integrate with that. Again, you can use FlashGot to link it up to Firefox if that’s your preferred browser. You can’t really edit what it parses from the clipboard though and there’s no batch ability like in uGet and DownThemAll! - -#### Features #### - -Extremely lacking in features and the Options menu is very limited as well. The Pause and Resume function also doesn’t seem to work – a basic part of any browser’s file download features. Still, notifications and default action on finished files can be edited, along with an option to run a script once downloads are finished. - -#### Availability #### - -Only available on Ubuntu and there’s no easy way to get the source code for the app either. This means while it’s easily obtainable on all Ubuntu- based distros, it’s limited to these types of distros. As it’s not even the best download manager available on Linux, that shouldn’t be too big of a concern. - -#### Overall #### - -5/10 - -Frankly, not that good. With very basic options and limited to only working on Ubuntu, Steadyflow doesn’t do enough to differentiate itself from the standard downloading options you’ll get on your web browser. - -### And the winner is… ### - -#### uGet #### - -In this test we’ve proven that there is a place for download managers on modern computers, even if the better ones have cribbed from the torrent clients that seem to have usurped them. While torrenting may be a more effective way for some, with ISPs getting wiser to torrent traffic some people may get better results with a good download manager. Not only are transfer caps imposed by most major ISPs, some are even beginning to slow- down or even block torrent traffic in peak hours – even legal traffic such as distro ISOs and other free software are throttled. - -Steadyflow seems to be a very popular solution for this, but our usage and tests showed an underdeveloped and weak product. The much older uGet was the star of the show, with an amazing selection of features that can aid in downloading single items or filtering through an entire webpage for relevant items to grab. The same goes for DownThemAll!, the excellent Firefox add-on that, while stuck with Firefox, has just about the same level of features, albeit with better integration. - -If you’re choosing between the two it really comes down to what your preferred browser is and whether you need to have downloads and uploads going around the clock. DownThemAll! requires Firefox running, whereas uGet runs on its own, saving a lot of resources and electricity in the process – obviously this makes uGet a much better prospect for 24-hour data transferring and it really isn’t a major hassle to set up big batch downloads, or even just get the download information from your browser. - -Give download managers another chance. You will not be disappointed with the results. - --------------------------------------------------------------------------------- - -via: http://www.linuxuser.co.uk/reviews/top-4-linux-download-managers - -作者:Rob Zwetsloot -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://bit.ly/1mx4Uwz -[2]:http://bit.ly/1lilqU9 -[3]:http://bit.ly/1lilqU9 -[4]:http://bit.ly/1lilymS diff --git a/sources/share/20140821 What is a good EPUB reader on Linux.md b/sources/share/20140821 What is a good EPUB reader on Linux.md deleted file mode 100644 index 7e1958256b..0000000000 --- a/sources/share/20140821 What is a good EPUB reader on Linux.md +++ /dev/null @@ -1,66 +0,0 @@ -What is a good EPUB reader on Linux -================================================================================ -If the habit on reading books on electronic tablets is still on its way, reading books on a computer is even rarer. It is hard enough to focus on the classics of the 16th century literature, so who needs the Facebook chat pop up sound in the background in addition? But if for some reasons you wish to open an electronic book in your computer, chances are that you will need specific software. Indeed, most editors agreed with using the EPUB format for electronic books (for "Electronic PUBlication"). Hopefully, Linux is not deprived of good programs capable of dealing with such format. In short, here is a non-exhaustive list of good EPUB readers on Linux. - -### 1. Calibre ### - -![](https://farm6.staticflickr.com/5577/14975176155_0989766bb3_z.jpg) - -Let's dive in with maybe the biggest name of that list: [Calibre][1]. More than just an ebook reader, Calibre is a fully packaged e-library. It supports a plethora of formats (almost every I can think of), integrates a reader, a manager, a meta-data editor which can download covers from the Internet, an EPUB editor, a news reader, and a search engine to download additional books. To top it all, the interface is slick and has nothing to envy to other professional software. The only potential downside is that if you are looking for an EPUB reader, and are not interested in the whole library manager aspect, the program is too heavy for your needs. - -### 2. FBReader ### - -![](https://farm4.staticflickr.com/3900/14975176165_f2e4afd2fa_o.jpg) - -[FBReader][2] is also a library manager, but in a lighter way than Calibre. The interface is more sober, and is clearly cut in two: (1) the library aspect where you can add files, edit the meta-data, or download new books, and (2) the reader aspect. If you like simplicity, you might enjoy this program. I personally appreciate its straightforward tag and series system for classifying books. - -### 3. Cool Reader ### - -![](https://farm6.staticflickr.com/5594/14975176195_ac46952150.jpg) - -For all of you who are just looking for a way to visualize the content of an EPUB file, I recommend [Cool Reader][5]. In the spirit of Linux applications which do only one thing and do it well, Cool Reader is optimized to just open an EPUB file, and navigate through it via handy shortcuts. And since it is based on Qt, it also follows Qt's mentality by giving a ton of settings to mess around with. - -### 4. Okular ### - -![](https://farm6.staticflickr.com/5559/14788504729_5a2ec2c11b_z.jpg) - -Since we were talking about Qt applications, one of KDE's main document viewer, [Okular][3], also has the capacity to view EPUB files, once an EPUB library has been installed on the system. However, this is probably not a very good option if you are not a KDE user. - -### 5. pPub ### - -![](https://farm4.staticflickr.com/3835/14788504789_e7c742fa20_z.jpg) - -[pPub][4] is an old project that you can still find on Github. Its latest change seems to have been made two years ago. However, pPub is one of those programs that really deserve a second life. Written in Python and based on GTK3 and WebKit, pPub is lightweight and intuitive. The interface probably needs a little updating and is beyond sober, but the core is very good. It even supports JavaScript. So please, someone kick that up again. - -### 6. epub ### - -![](https://farm4.staticflickr.com/3871/14788844378_16fb51a1b9_z.jpg) - -If all you need is a quick and easy way to check the content of an EPUB file, without caring about any fancy GUI, maybe an EPUB reader with command line interface might just do. [epub][6] is a minimalistic EPUB reader written in Python, which allows you to read an EPUB file in a terminal environment. You can switch between chapter/TOC views, up/down a page, and nothing more. This is as simple as any EPUB reader can possibly get. - -### 7. Sigil ### - -![](https://farm4.staticflickr.com/3921/14788640417_7940627871_z.jpg) - -Finally, last of the list is not actually an EPUB reader, but more of a standalone editor. [Sigil][7] is able to extract the content of an EPUB file, and break it down for what it really is: xhtml text, images, styles, and sometimes audio. The interface is a lot more complex than the one for a basic reader, but remains clear and well thought, on par with the features it provides. I particularly appreciate the tab system. If you are familiar with editing web pages, you will be in know territory here. - -To conclude, there are a lot of open source EPUB readers out there. Some do nothing more, while others go way beyond that. As usual, I recommend using the one that makes the most sense for you to use. If you know more good EPUB readers on Linux that you like, please let us know in the comments. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/2014/08/good-epub-reader-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://calibre-ebook.com/ -[2]:http://fbreader.org/ -[3]:http://okular.kde.org/ -[4]:https://github.com/sakisds/pPub -[5]:http://crengine.sourceforge.net/ -[6]:https://github.com/rupa/epub -[7]:https://github.com/user-none/Sigil \ 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/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md b/sources/share/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md deleted file mode 100644 index c1d1106e03..0000000000 --- a/sources/share/20150106 This App Can Write a Single ISO to 20 USB Drives Simultaneously.md +++ /dev/null @@ -1,59 +0,0 @@ -This App Can Write a Single ISO to 20 USB Drives Simultaneously -================================================================================ -**If I were to ask you to burn a single Linux ISO to 17 USB thumb drives how would you go about doing it?** - -Code savvy folks would write a little bash script to automate the process, and a large number would use a GUI tool like the USB Startup Disk Creator to burn the ISO to each drive in turn, one by one. But the rest of us would fast conclude that neither method is ideal. - -### Problem > Solution ### - -![GNOME MultiWriter in action](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/gnome-multi-writer.jpg) - -GNOME MultiWriter in action - -Richard Hughes, a GNOME developer, faced a similar dilemma. He wanted to create a number of USB drives pre-loaded with an OS, but wanted a tool simple enough for someone like his dad to use. - -His response was to create a **brand new app** that combines both approaches into one easy to use tool. - -It’s called “[GNOME MultiWriter][1]” and lets you write a single ISO or IMG to multiple USB drives at the same time. - -It nixes the need to customize or create a command line script and relinquishes the need to waste an afternoon performing an identical set of actions on repeat. - -All you need is this app, an ISO, some thumb-drives and lots of empty USB ports. - -### Use Cases and Installing ### - -![The app can be installed on Ubuntu](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/mutli-writer-on-ubuntu.jpg) - -The app can be installed on Ubuntu - -The app has a pretty defined usage scenario, that being situations where USB sticks pre-loaded with an OS or live image are being distributed. - -That being said, it should work just as well for anyone wanting to create a solitary bootable USB stick, too — and since I’ve never once successfully created a bootable image from Ubuntu’s built-in disk creator utility, working alternatives are welcome news to me! - -Hughes, the developer, says it **supports up to 20 USB drives**, each being between 1GB and 32GB in size. - -The drawback (for now) is that GNOME MultiWriter is not a finished, stable product. It works, but at this early blush there are no pre-built binaries to install or a PPA to add to your overstocked software sources. - -If you know your way around the usual configure/make process you can get it up and running in no time. On Ubuntu 14.10 you may also need to install the following packages first: - - sudo apt-get install gnome-common yelp-tools libcanberra-gtk3-dev libudisks2-dev gobject-introspection - -If you get it up and running, give it a whirl and let us know what you think! - -Bugs and pull requests can be longed on the GitHub page for the project, which is where you’ll also found tarball downloads for manual installation. - -- [GNOME MultiWriter on Github][2] - --------------------------------------------------------------------------------- - -via: http://www.omgubuntu.co.uk/2015/01/gnome-multiwriter-iso-usb-utility - -作者:[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://github.com/hughsie/gnome-multi-writer/ -[2]:https://github.com/hughsie/gnome-multi-writer/ \ No newline at end of file diff --git a/sources/share/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md b/sources/share/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md deleted file mode 100644 index 8836812288..0000000000 --- a/sources/share/20150112 Best GNOME Shell Themes For Ubuntu 14.04.md +++ /dev/null @@ -1,111 +0,0 @@ -Best GNOME Shell Themes For Ubuntu 14.04 -================================================================================ -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Best_Gnome_Shell_Themes.jpeg) - -Themes are the best way to customize your Linux desktop. If you [install GNOME on Ubuntu 14.04][1] or 14.10, you might want to change the default theme and give it a different look. To help you in this task, I have compiled here a **list of best GNOME shell themes for Ubuntu** or any other Linux OS that has GNOME shell installed on it. But before we see the list, let’s first see how to change install new themes in GNOME Shell. - -### Install themes in GNOME Shell ### - -To install new themes in GNOME with Ubuntu, you can use Gnome Tweak Tool which is available in software repository in Ubuntu. Open a terminal and use the following command: - - sudo apt-get install gnome-tweak-tool - -Alternatively, you can use themes by putting them in ~/.themes directory. I have written a detailed tutorial on [how to install and use themes in GNOME Shell][2], in case you need it. - -### Best GNOME Shell themes ### - -The themes listed here are tested on GNOME Shell 3.10.4 but it should work for all version of GNOME 3 and higher. For the sake of mentioning, the themes are not in any kind of priority order. Let’s have a look at the best GNOME themes: - -#### Numix #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2014/02/mockups_numix_5.jpeg) - -No list can be completed without the mention of [Numix themes][3]. These themes got so popular that it encouraged [Numix team to work on a new Linux OS, Ozon][4]. Considering their design work with Numix theme, it won’t be exaggeration to call it one of the [most beautiful Linux OS][5] releasing in near future. - -To install Numix theme in Ubuntu based distributions, use the following commands: - - sudo apt-add-repository ppa:numix/ppa - sudo apt-get update - sudo apt-get install numix-icon-theme-circle - -#### Elegance Colors #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Elegance_Colors_Theme_GNOME_Shell.jpeg) - -Another beautiful theme from Satyajit Sahoo, who is also a member of Numix team. [Elegance Colors][6] has its own PPA so that you can easily install it: - - sudo add-apt-repository ppa:satyajit-happy/themes - sudo apt-get update - sudo apt-get install gnome-shell-theme-elegance-colors - -#### Moka #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Moka_GNOME_Shell.jpeg) - -[Moka][7] is another mesmerizing theme that is always included in the list of beautiful themes. Designed by the same developer who gave us Unity Tweak Tool, Moka is a must try: - - sudo add-apt-repository ppa:moka/stable - sudo apt-get update - sudo apt-get install moka-gnome-shell-theme - -#### Viva #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Viva_GNOME_Theme.jpg) - -Based on Gnome’s default Adwaita theme, Viva is a nice theme with shades of black and oranges. You can download Viva from the link below. - -- [Download Viva GNOME Shell Theme][8] - -#### Ciliora-Prima #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Ciliora_Prima_Gnome_Shell.jpeg) - -Previously known as Zukitwo Dark, Ciliora-Prima has square icons theme. Theme is available in three versions that are slightly different from each other. You can download it from the link below. - -- [Download Ciliora-Prima GNOME Shell Theme][9] - -#### Faience #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Faience_GNOME_Shell_Theme.jpeg) - -Faience has been a popular theme for quite some time and rightly so. You can install Faience using the PPA below for GNOME 3.10 and higher. - - sudo add-apt-repository ppa:tiheum/equinox - sudo apt-get update - sudo apt-get install faience-theme - -#### Paper [Incomplete] #### - -![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/01/Paper_GTK_Theme.jpeg) - -Ever since Google talked about Material Design, people have been going gaga over it. Paper GTK theme, by Sam Hewitt (of Moka Project), is inspired by Google Material design and currently under development. Which means you will not have the best experience with Paper at the moment. But if your a bit experimental, like me, you can definitely give it a try. - - sudo add-apt-repository ppa:snwh/pulp - sudo apt-get update - sudo apt-get install paper-gtk-theme - -That concludes my list. If you are trying to give a different look to your Ubuntu, you should also try the list of [best icon themes for Ubuntu 14.04][10]. - -How do you find this list of **best GNOME Shell themes**? Which one is your favorite among the one listed here? And if it’s not listed here, do let us know which theme you think is the best GNOME Shell theme. - --------------------------------------------------------------------------------- - -via: http://itsfoss.com/gnome-shell-themes-ubuntu-1404/ - -作者:[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/how-to-install-gnome-in-ubuntu-14-04/ -[2]:http://itsfoss.com/install-switch-themes-gnome-shell/ -[3]:https://numixproject.org/ -[4]:http://itsfoss.com/numix-linux-distribution/ -[5]:http://itsfoss.com/new-beautiful-linux-2015/ -[6]:http://satya164.deviantart.com/art/Gnome-Shell-Elegance-Colors-305966388 -[7]:http://mokaproject.com/ -[8]:https://github.com/vivaeltopo/gnome-shell-theme-viva -[9]:http://zagortenay333.deviantart.com/art/Ciliora-Prima-Shell-451947568 -[10]:http://itsfoss.com/best-icon-themes-ubuntu-1404/ \ 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 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md b/sources/share/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md deleted file mode 100644 index 05f307c9d5..0000000000 --- a/sources/share/20150119 3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive.md +++ /dev/null @@ -1,12 +0,0 @@ -3 Ways To Create A Lightweight And Persistent Xubuntu Linux USB Drive -================================================================================ - -via : http://linux.about.com/od/howtos/ss/How-To-Create-A-Persistent-Bootable-Xubuntu-Linux-USB-Drive.htm - - - -作者:[Gary Newell][a] -译者:[zhouj-sh](https://github.com/Zhouj-sh) -校对:[校对者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/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/20150225 Install Google's Material Design Inspired GTK And Icon Theme Paper in Linux.md b/sources/share/20150225 Install Google's Material Design Inspired GTK And Icon Theme Paper in Linux.md new file mode 100644 index 0000000000..33aa731843 --- /dev/null +++ b/sources/share/20150225 Install Google's Material Design Inspired GTK And Icon Theme Paper in Linux.md @@ -0,0 +1,67 @@ +Install Google’s Material Design Inspired GTK And Icon Theme Paper in Linux +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Paper_theme_Material_Design.jpg) + +[Paper][1] is a new upcoming GTK and icon theme inspired by Google’s [Material design][2] guidelines. It is developed by Sam Hewitt, the man behind [Moka Project][3]. Moka has always been in the list of [best themes for Ubuntu][4] and looking at Paper, I can say that once it is developed completely, it will surely be listed as one of the [best GTK themes][5]. + +Yes, you heard it right. The theme is still under development. Therefore I suggest that if you want to install Paper theme in Ubuntu or any other Linux distributions, do it only for experimentation purpose. You may see some broken icons here and there but the over all experience is nice. + +### Install Paper theme in Ubuntu based distributions via PPA ### + +Sam has a dedicated PPA for Ubuntu based distributions. I recommend that you use this PPA instead of downloading the theme because you’ll be getting the updates on the themes regularly. This PPA is available for Ubuntu 15.04, Ubuntu 14.10, Ubuntu 14.04, Elementary OS Freya, Elementary OS Luna, Linux Mint 17, Linux Mint 16 and other Linux distributions based on Ubuntu. + +Open a terminal and use the following commands: + + sudo add-apt-repository ppa:snwh/pulp + sudo apt-get update + sudo apt-get install paper-gtk-theme paper-icon-theme + +### Download Paper GTK and icon theme ### + +If you do not want to use the PPA, you can download the themes and icons manually. As I said previously, you won’t get the updates automatically this way. + +- [Download Paper icon themes][6] +- [Download Paper GTK themes][7] + +#### Using Paper themes and icons #### + +I hope that you know how to change or install themes in your respective Linux distributions. If you are not unaware of it, below are few tutorials that could help you to install new themes: + +- [How to change themes in Ubuntu Unity][8] +- [How to change themes in GNOME Shell][9] +- [How to change themes in Linux Mint][10] +- [How to change theme in Elementary OS Freya][11] + +#### Here is what Paper theme looks like #### + +Since I am using [Elementary OS Freya][12] these days, here are some of the screenshots of how Paper theme and icons look like in Elementary OS Freya. I have used a wallpaper with Material design look so that it blends well with the icon and themes. + +![](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. + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/install-paper-theme-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://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/ \ No newline at end of file diff --git a/sources/share/20150227 Chess in a Few Bytes.md b/sources/share/20150227 Chess in a Few Bytes.md new file mode 100644 index 0000000000..e0f6302dcd --- /dev/null +++ b/sources/share/20150227 Chess in a Few Bytes.md @@ -0,0 +1,116 @@ +Translating by FSSlc + +Chess in a Few Bytes +================================================================================ +I am showing my age by mentioning that my introduction to computing was a ZX81, a home computer produced by a UK developer (Sinclair Research) which had a whopping 1KB of RAM. The 1KB is not a typographical error, the home computer really shipped with a mere 1KB of onboard memory. But this memory limitation did not prevent enthusiasts producing a huge variety of software. In fact the machine sparked a generation of programming wizards who were forced to get to grips with its workings. The machine was upgradable with a 16KB RAM pack which offered so many more coding possibilities. But the unexpanded 1KB machine still inspired programmers to release remarkable software. + +![1K ZX Chess ](http://www.linuxlinks.com/portal/content2/reviews/Games2/1KZXChess.jpg) + +My favourite ZX81 games were Flight Simulation, 3D Monster Maze, Galaxians, and above all 1K ZX Chess. Only the latter was written for the unexpanded ZX81. In fact, David Horne's 1K ZX Chess was coded in a mere 672 bytes of RAM. However, the game managed to implement most chess rules, and offer a computer opponent. While some important rules were omitted (castling, pawn promotion, and en passant capture), it was still amazing to be able to play against artificial intelligence. The game took up a fair chunk of my misspent youth. + +1K ZX Chess remained the smallest implementation of chess on any computer for 33 years until the record was broken by BootChess this year, and subsequently by Toledo AtomChess. These three games do not implement all of the chess rules, so for completeness I have included my favourite small implementation of chess that implements a complete set of chess rules. + +Linux has a good range of extremely strong chess engines such as Stockfish, Critter, Togo II, Crafty, GNU Chess, and Komodo. The chess engines featured in this article offer no match to a good chess engine, but they show how much can be achieved with a minuscule codebase. + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/ToledoAtomchess.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Toledo.png) + +You may have seen a considerable amount of press coverage about BootChess, a chess program written in 487 bytes of code, smashing the record of the then smallest chess program, 1K ZX Chess. Óscar Toledo Gutiérrez took up the mantle and decided to code an even more compact chess game. Toledo Atomchess is a mere 481 bytes of x86 assembly code which fits in a boot sector. The engine plays a reasonable game of chess given the limitations of its incredibly small codebase. + +Features include: + +- Basic chess movements +- ASCII text representation of chess board +- Moves are entered in algebraic form +- Search depth of 3-ply + +Obviously, to fit the chess of game into 481 bytes, the author had to make some sacrifices. These limitations include: + +- No promotion of pawns +- No castling +- No en passant +- No move validation + +The author has also written chess programs in C, JavaScript and Java; each are very small implementations of chess. + +- Website: [nanochess.org/chess6.html][1] +- Developer: Óscar Toledo Gutiérrez +- License: Free for non-commercial use +- Version Number: - + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/BootChess.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-BootChess.png) + +BootChess is an extremely small computer implementation of chess. The game is crammed into a mere 487 bytes and runs on Windows, Mac OS X and Linux operating systems. The board and pieces of BootChess are represented by text alone, with P representing pawns, Q used for the queens and full stops entered for empty squares. + +Features include: + +- Graphic text representation of chess board and use input +- Bootsector sized (512 bytes) with a playable chess game +- x86 bios hardware only bootstrap (no software dependencies) +- All main legal moves including double square pawn start +- Pawn promotion to queen (contrary to 1k ZX Chess) +- CPU artificial intelligence called taxiMax > minMax half-ply +- Hard-coded Spanish white pieces opening + +Again, there are some important limitations. Omissions include: + +- Under-promotion +- En passant pawn capture +- No castling +- 3-repetition rule +- 50 move draw rule +- No opening or closing books +- One or more minMax/negaMax full plies for artificial intelligence + +- Website: [www.pouet.net/prod.php?which=64962][2] +- Developer: Olivier "Baudsurfer/RSi" Poudade +- License: WTFPL v2 +- Version Number: .02 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/Micro-Max.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-Micro-Max.png) + +Micro-Max is a 133-line chess source which is written in C + +The author has implemented a (hash) transposition table, the engine checks the legality of the input moves, and full FIDE rules except for for under-promotions. + +Features include: + +- Recursive negamax search +- Quiescence search with recaptures +- Recapture extensions +- Iterative deepening +- Best-move-first 'sorting' +- Hash table storing score and best move +- Full FIDE rules (except under promotion) and move-legality checking + +There is also a stripped-down 1433-character version, but allowing you to play under-promotions for full FIDE-rule compliance. + +- Website: [home.hccnet.nl/h.g.muller/max-src2.html][3] +- Developer: Harm Geert Muller +- License: The MIT License +- Version Number: 3.2 + +-------------------------------------------------------------------------------- + +via: http://www.linuxlinks.com/article/20150222033906262/ChessBytes.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://nanochess.org/chess6.html +[2]:http://www.pouet.net/prod.php?which=64962 +[3]:http://home.hccnet.nl/h.g.muller/max-src2.html diff --git a/sources/share/20150323 Red Hat Developer Toolset 3.1 beta arrives.md b/sources/share/20150323 Red Hat Developer Toolset 3.1 beta arrives.md new file mode 100644 index 0000000000..9faf1f2eb4 --- /dev/null +++ b/sources/share/20150323 Red Hat Developer Toolset 3.1 beta arrives.md @@ -0,0 +1,52 @@ +Red Hat Developer Toolset 3.1 beta arrives +================================================================================ +> **Summary**:Want the newest developer tools for Red Hat Enterprise Linux 6 or 7? The beta's ready for you now. + +It's one of those eternal problems between developers and operators that even [DevOps][1] can't entirely solve. System administrators want the most stable operating system possible, while programmers want the latest and greatest development tools. [Red Hat][2]'s solution for this dilemma has been to take those brand spanking-new tools, test them out on the latest stable [Red Hat Enterprise Linux (RHEL)][3], and then release them to developers. + +![Red Hat Developer Toolset](http://zdnet4.cbsistatic.com/hub/i/2015/03/18/d92b1067-6b36-4ff0-ac9e-608fbe3e8c5d/ae80362df5401a37e3cbcd2598f33370/rhel-dev-tools.png) +Red Hat Developer Toolset + +So it is that Red Hat has just announced its latest toys for developers, [Red Hat Developer Toolset 3.1][4]. This packaging of the hottest new tools is now available in beta. + +This update includes: + +[GNUCompiler Collection (GCC) 4.9][5]: the latest stable upstream version of GCC, which provides numerous improvements and bug fixes + +[Eclipse 4.4.1][6]: with support for Java 8 and updated versions of Eclipse CDT (8.5), Eclipse Linux Tools (3.1), Eclipse Mylyn (3.14), and Eclipse Egit/Jgit (3.6.1) + +Numerous additional updated packages: These include GDB 7.8.2, elfutils 0.161, memstomp 0.1.5, SystemTap 2.6, Valgrind 3.10.1, Dyninst 8.2.1, and ltrace 0.7.91. + +With these development programs, you'll be able to create applications for RHEL 6 and 7.x. These apps will then run on RHEL regardless of whether you're running it on a physical, virtual or cloud environments. They will also run on Red Hat's [OpenShift][7], its Platform-as-a-Service (PaaS) offering. + +This new set of developer programs includes packages for both RHEL 7 and 7 running on [AMD64 and Intel 64 architectures][8]. Although the tools are 64-bit you can use them to create and modify 32-bit binaries. + +Before you try running any of these programs, you should patch RHEL with all the latest updates. To install the beta Toolset, your systems need to be subscribed to the Optional channel to access all the required Red Hat Developer Toolset tool-chain packages. + +In addition, if you've installed earlier Toolkits you may run into some [problems while installing Toolkit 3.1][9]. While these difficulties are easy enough to fix, you should go over these possible hiccups before trying to install the new Toolkit. + +Finally, you may notice that some of the most exciting of the new tools, such as Docker, Kubernetes, and other container tools aren't here. That's because they're in the newly released [RHEL 7.1][10] and [Red Hat Enterprise Linux 7 Atomic Host (RHELAH)][11]. [Red Hat has partnered with Docker][12], but you'll need to move to a Docker-friendly version of RHEL to get at these container-friendly programs. + +-------------------------------------------------------------------------------- + +via: http://www.zdnet.com/article/red-hat-developer-toolset-3-1-beta-arrives/ + +作者:[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://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/sources/share/20150323 Square 2.0 Icon Pack Is Twice More Beautiful.md b/sources/share/20150323 Square 2.0 Icon Pack Is Twice More Beautiful.md new file mode 100644 index 0000000000..b0e5afbf8b --- /dev/null +++ b/sources/share/20150323 Square 2.0 Icon Pack Is Twice More Beautiful.md @@ -0,0 +1,56 @@ +Square 2.0 Icon Pack Is Twice More Beautiful +================================================================================ +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux_3.jpeg) + +Elegant, modern looking [Square icon theme][1] has recently been upgraded to version 2.0, which makes it more beautiful than ever. Square icon packs are compatible with all major desktop environments such as **Unity, GNOME, KDE, MATE** etc. Which means that you can use them for all popular Linux distributions such as Ubuntu, Fedora, Linux Mint, elementary OS etc. The vastness of this icon pack can be estimated from the fact it contains over 15,000 icons. + +### Install and use Square icon pack 2.0 in Linux ### + +There are two variants of Square icons, dark and light. Based on your preference, you can choose either of the two. For experimentation sake, I would advise you to download both variants of the icon theme. + +You can download the icon pack from the link below. The files are stored in Google Drive, so don’t be suspicious if you don’t see a standard website like [SourceForge][2]. + +- [Square Dark Icons][3] +- [Square Light Icons][4] + +To use the icon theme, extract the downloaded files in ~/.icons directory. If this doesn’t exist, create it. Once you have the files in the right place, based on your desktop environment, use a tool to change the icon theme. I have written some small tutorials in the past on this topic. Feel free to refer to them if you need further help: + +- [How to change themes in Ubuntu Unity][5] +- [How to change themes in GNOME Shell][6] +- [How to change themes in Linux Mint][7] +- [How to change theme in Elementary OS Freya][8] + +### Give it a try ### + +Here is what my Ubuntu 14.04 looks like with Square icons. I am using [Ubuntu 15.04 default wallpaper][9] in the background. + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux_2.jpeg) + +A quick look at several icons in the Square theme: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Square_Icon_Pack_Linux.jpeg) + +How do you find it? Do you think it can be considered as one of the [best icon themes for Ubuntu 14.04][10]? Do share your thoughts and stay tuned for more articles on customizing your Linux desktop. + + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/square-2-0-icon-pack-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://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/ \ No newline at end of file diff --git a/sources/share/20150324 How to Install Telegram Messenger Application on Linux.md b/sources/share/20150324 How to Install Telegram Messenger Application on Linux.md new file mode 100644 index 0000000000..0d4946db1f --- /dev/null +++ b/sources/share/20150324 How to Install Telegram Messenger Application on Linux.md @@ -0,0 +1,132 @@ +How to Install Telegram Messenger Application on Linux +================================================================================ +Telegram is an Instant Messaging (IM) application similar to whatsapp. It has a very large user base. It has a lot of features that differentiate it from other messaging application. + +![Install Telegram in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Install-Telegram-in-Linux.png) +Telegram Messenger for Linux + +This article aims at making you aware of telegram application followed by detailed installation instructions on Linux Box. + +#### Features of Telegram #### + +- Implementation for mobile devices +- Available for Desktop. +- Application Program Interface (API) of Telegram can be Accessed by third party developers. +- Available for Android, iphone/ipad, Windows Phone, Web-Version, PC, Mac and Linux +- The above application provides Heavily Encrypted and self destruct messages. +- Lets you access your message from multiple devices and platform. +- The overall processing and message delivery is lightening fast. +- Distributed server across the globe for security and speed. +- Open API and Free Protocol +- NoAds, No Subscription charge. – Free forever. +- Powerful – No limit to media and chats +- Several security measures that make it safe from Hackers. +- Reply to Specific message in group. Mention @username to notify multiple users in group. + +#### Why Telegram? #### + +When Applications like whatsapp and other IM are providing almost same things in bag, why should someone opt for Telegram? + +Well Availability of API to third party developer is enough to say. Moreover availability for PC which means you won’t have to struggle typing message using your mobile, but you can use your PC and that is pretty more than sufficient. + +Also The option to connect on remote locations, Co-ordinate – Group of upto 200 Members, Sync all your devices, Send – Documents of all kind, Encrypt message, Self destruction of message, Storage of Media in Cloud, Build own tool on freely available API and what not. + +**Testing Environment** + +We have used Debian GNU/Linux, x86_64 architecture to test it and the overall process went very smooth for us. Here what we did stepwise. + +### Installation of Telegram Messenger in Linux ### + +First go to the official Telegram site, and download Telegram source package ([tsetup.0.7.23.tar.xz][1]) for Linux system or you may use following wget command to download directly. + + # wget https://updates.tdesktop.com/tlinux/tsetup.0.7.23.tar.xz + +Once package has been downloaded, unpack the tarball and switch from current working directory to the extracted directory. + + # tar -xf tsetup.0.7.23.tar.xz + # cd Telegram/ + +Next, execute the binary file ‘Telegram’ from the command line as shown below. + + # ./Telegram + +1. The first Impression. Click “START MESSAGING”. + +![Start Messaging](http://www.tecmint.com/wp-content/uploads/2015/03/Start-Messaging.jpeg) +Start Messaging + +2. Enter Your phone Number. Click “NEXT”. If you have not registered for telegram before this, using the same number as entered above you will get a warning that you don’t have a telegram account yet. Click “Register Here”. + +![Signup for Telegram](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Register.png) +Signup for Telegram + +3. After submitting your phone number, telegram will send you a verification code, shortly. You need to Enter it. + +![Telegram Verification Code](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Verfication-Code.png) +Telegram Verification Code + +4. Enter your First_Name, Last_name and pics and click “SIGNUP”. + +![Enter Account Details](http://www.tecmint.com/wp-content/uploads/2015/03/Enter-Account-Details.jpeg) +Enter Account Details + +5. After account creation, I got this interface. Everything seems at its place, even when I am new to telegram Application. The interface is really simple. + +![Telegram Interface](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Interface.jpeg) +Telegram Interface + +6. Click Add a contact and Enter Their first_name, last_name and Phone number. Click create when done!. + +![Add New Telegram Contact](http://www.tecmint.com/wp-content/uploads/2015/03/Add-New-Telegram-Contact.png) +Add New Telegram Contact + +7. If the contact you added is not on telegram already, You get a warning message and telegram will acknowledge you when your contact joins telegram. + +![Telegram Contact Notification](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Contact-Notification.jpeg) +Telegram Contact Notification + +8. As soon as the contact joins telegram you get a message (pop-out like) that reads [YOUR_CONTACT] joined telegram. + +9. A formal chat window on Linux Machine. Nice experience… + +![Telegram Contact Join Message](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Contact-Join-Message.jpeg) +Telegram Contact Join Message + +10. At the same time, I’ve tried messaging from my android mobile device, the interface looks similar on both. + +![Telegram Mobile Interface](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Mobile-Interface.png) +Telegram Mobile Interface + +11. Telegram settings page. You have a lot of options to configure. + +![Telegram Settings](http://www.tecmint.com/wp-content/uploads/2015/03/Telegram-Settings.png) +Telegram Settings + +12. About Telegram. + +![About Telegram](http://www.tecmint.com/wp-content/uploads/2015/03/About-Telegram.jpeg) +About Telegram + +#### Less Interesting Points #### + +- Telegram usage protocol MTProto Mobile protocol. +- Released Initially for iPhone in the year 2013 (August 14).. +- People Behind this Amazing Project: Pavel and Nikolai Durov.. + +That’s all for now. I’ll be here again with another interesting article you will love to read. I take the pleasure on behalf of Tecmint to thank all our valuable readers and critics who made us stand where we are now through continuous self evolving process. Keep Connected! Keep Commenting. Share if you care for us. + +- [https://telegram.org/][2] + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-telegram-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]:https://tdesktop.com/linux +[2]:https://telegram.org/ \ No newline at end of file diff --git a/sources/share/20150326 Mydumper--Mysql Database Backup tool.md b/sources/share/20150326 Mydumper--Mysql Database Backup tool.md new file mode 100644 index 0000000000..e8260760e2 --- /dev/null +++ b/sources/share/20150326 Mydumper--Mysql Database Backup tool.md @@ -0,0 +1,110 @@ +Mydumper – Mysql Database Backup tool +================================================================================ +Mydumper is a tool used for backing up MySQL database servers much faster than the mysqldump tool distributed with MySQL. It also has the capability to retrieve the binary logs from the remote server at the same time as the dump itself. + +### Mydumper advantages ### + +o Parallelism (hence, speed) and performance (avoids expensive character set conversion routines, efficient code overall) + +o Easier to manage output (separate files for tables, dump metadata,etc, easy to view/parse data) + +o Consistency -- maintains snapshot across all threads, provides accurate master and slave log positions, etc + +o Manageability -- supports PCRE for specifying database and tables inclusions and exclusions + +### Install mydumper on ubuntu ### + +Open the terminal and run the following command + + sudo apt-get install mydumper + +### Using Mydumper ### + +#### Syntax #### + + mydumper [options] + +Application Options: + +- -B, --database Database to dump +- -T, --tables-list Comma delimited table list to dump (does not exclude regex option) +- -o, --outputdir Directory to output files to +- -s, --statement-size Attempted size of INSERT statement in bytes, default 1000000 +- -r, --rows Try to split tables into chunks of this many rows +- -c, --compress Compress output files +- -e, --build-empty-files Build dump files even if no data available from table +- -x, --regex Regular expression for ‘db.table' matching +- -i, --ignore-engines Comma delimited list of storage engines to ignore +- -m, --no-schemas Do not dump table schemas with the data +- -k, --no-locks Do not execute the temporary shared read lock. WARNING: This will cause inconsistent backups +- -l, --long-query-guard Set long query timer in seconds, default 60 +- --kill-long-queries Kill long running queries (instead of aborting) +- -b, --binlogs Get a snapshot of the binary logs as well as dump data +- -D, --daemon Enable daemon mode +- -I, --snapshot-interval Interval between each dump snapshot (in minutes), requires --daemon, default 60 +- -L, --logfile Log file name to use, by default stdout is used +- -h, --host The host to connect to +- -u, --user Username with privileges to run the dump +- -p, --password User password +- -P, --port TCP/IP port to connect to +- -S, --socket UNIX domain socket file to use for connection +- -t, --threads Number of threads to use, default 4 +- -C, --compress-protocol Use compression on the MySQL connection +- -V, --version Show the program version and exit +- -v, --verbose Verbosity of output, 0 = silent, 1 = errors, 2 = warnings, 3 = info, default 2 + +#### Mydumper Example #### + + 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 + +Description of Mydumper's output data + +Mydumper does not output to files, but rather to files in a directory. The --outputdir option specifies the name of the directory to use. + +The output is two parts + +Schema + +For each table in the database, a file containing the CREATE TABLE statement will be created. It will be named: + +dbname.tablename-schema.sql.gz + +Data + +For each table with number of rows above the --rows parameter, you will have a file called: + +dbname.tablename.0000n.sql.gz + +Where "n" starts with 0 up to the number of. + +If you want to restore these backup you can use 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] +译者:[译者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/share/20150330 Picty--Managing Photos Made Easy.md b/sources/share/20150330 Picty--Managing Photos Made Easy.md new file mode 100644 index 0000000000..e88ef85cec --- /dev/null +++ b/sources/share/20150330 Picty--Managing Photos Made Easy.md @@ -0,0 +1,102 @@ +Picty: Managing Photos Made Easy +================================================================================ +![](http://1102047360.rsc.cdn77.org/wp-content/uploads/2015/03/picty_002-790x429.png) + +### About Picty ### + +**Picty** is a free, simple, yet powerful photo collection manager that will help you to manage your photos. It is designed around managing **metadata** and a **lossless** approach to image handling. Picty currently supports both online(web-based) and offline(local) collections. In local collections, the images will be stored in a local folder and it’s sub-folders. A database will be maintained to speed up the image queries in the user’s home folder. In online(web-based) collections, you can upload and share images through a web browser. Ant user with proper rights can share photos to any persons, and each user can have multiple collections open at once and collections can be shared by multiple users. There is a simple interface for transferring images between collections using a transfer plugin. + +You can download any number of photos from your Camera or any devices. Also, Picty allows you to browse photo collections from your Camera before downloading it. Picty is lightweight application, and has snappy interface. It supports Linux, and Windows platforms. + +### Features ### + +- Supports big photo collections (20,000 plus images). +- Open more than one collection at a time and transfer images between them. +- Collections are: + - Folders of images in your local file system. + - Images on cameras, phones and other media devices. + - Photo hosting services (Flickr currently supported). +- picty does not “Import” photos into its own database, it simply provides an interface for accessing them wherever they are. To keep things snappy and to allow you to browse even if you are offline, picty maintains a cache of thumbnails and metadata. +- Reads and writes metadata in industry standard formats Exif, IPTC and Xmp +- Lossless approach: + - picty writes all changes including image edits as metadata. e.g. an image crop is stored as any instruction, the original pixels remain in the file + - Changes are stored in picty’s collection cache until you save your metadata changes to the images. You can easily revert unsaved changes that you don’t like. +- Basic image editing: + - Current support for basic image enhancements such as brightness, contrast, color, cropping, and straightening. + - Improvements to those tools and other tools coming soon (red eye reduction, levels, curves, noise reduction) +- Image tagging: + - Use standard IPTC and Xmp keywords for image tags + - A tag tree view lets you easily manage your tags and navigate your collection +- Folder view: + - Navigate the directory heirarchy of your image collection +- Multi-monitor support + - picty can be configured to let you browse your collection on one screen and view full screen images on another. +- Customizable + - Create launchers for external tools + - Supports plugins – many of the current features (tagging and folder views, and all of the image editing tools) are provided by plugins + - Written in python – batteries included! + +### Installation ### + +#### 1. Install from PPA #### + +Picty developers has a PPA for Debian based distributions, like Ubuntu, to make the installation much easier. + +To install in Ubuntu and derivatives, run: + + sudo add-apt-repository ppa:damien-moore/ppa + sudo apt-get update + sudo apt-get install picty + +#### 2. Install from Source #### + +Also, you can install it from Source files. First, install the following dependencies. + + sudo apt-get install bzr python-pyinotify python-pyexiv2 python-gtk2 python-gnome2 dcraw python-osmgpsmap python-flickrapi + +Then, get the latest version using command: + + bzr branch lp:picty + +To run picty, change to the picty directory, and enter: + + cd picty + bin/picty + +To update to the latest version, run: + + cd picty + bzr pull + +### Usage ### + +Launch Picty either from Menu or Unity Dash. + +![picty_001](http://www.unixmen.com/wp-content/uploads/2015/03/picty_001.png) + +You can either choose existing collection, device or directory. Let us create a **new collection**. To do that, create New Collection button. Enter the collection, and browse to the path where you have the images stored. Finally, click **Create** button. + +![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) + +You can modify, rotate, add/remove tags, set descriptive info of each images. To do that, just right click any image and do the actions of your choice. + +Visit the following Google group to get more information and support about Picty Photo manager. + +- [http://groups.google.com/group/pictyphotomanager][1] + +Cheers! + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/picty-managing-photos-made-easy/ + +作者:[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://groups.google.com/group/pictyphotomanager \ 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..130201bff4 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,4 @@ -////translating by yupmoon - - +[raywang] 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/20141223 20 Linux Commands Interview Questions & Answers.md b/sources/talk/20141223 20 Linux Commands Interview Questions & Answers.md deleted file mode 100644 index 88e9b83ce2..0000000000 --- a/sources/talk/20141223 20 Linux Commands Interview Questions & Answers.md +++ /dev/null @@ -1,144 +0,0 @@ -Translating by ZTinoZ -20 Linux Commands Interview Questions & Answers -================================================================================ -**Q:1 How to check current run level of a linux server ?** - -Ans: ‘who -r’ & ‘runlevel’ commands are used to check the current runlevel of a linux box. - -**Q:2 How to check the default gatway in linux ?** - -Ans: Using the commands “route -n” and “netstat -nr” , we can check default gateway. Apart from the default gateway info , these commands also display the current routing tables . - -**Q:3 How to rebuild initrd image file on Linux ?** - -Ans: In case of CentOS 5.X / RHEL 5.X , mkinitrd command is used to create initrd file , example is shown below : - - # mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r) - -If you want to create initrd for a specific kernel version , then replace ‘uname -r’ with desired kernel - -In Case of CentOS 6.X / RHEL 6.X , dracut command is used to create initrd file example is shown below : - - # dracut -f - -Above command will create the initrd file for the current version. To rebuild the initrd file for a specific kernel , use below command : - - # dracut -f initramfs-2.x.xx-xx.el6.x86_64.img 2.x.xx-xx.el6.x86_64 - -**Q:4 What is cpio command ?** - -Ans: cpio stands for Copy in and copy out. Cpio copies files, lists and extract files to and from a archive ( or a single file). - -**Q:5 What is patch command and where to use it ?** - -Ans: As the name suggest patch command is used to apply changes ( or patches) to the text file. Patch command generally accept output from the diff and convert older version of files into newer versions. For example Linux kernel source code consists of number of files with millions of lines , so whenever any contributor contribute the changes , then he/she will be send the only changes instead of sending the whole source code. Then the receiver will apply the changes with patch command to its original source code. - -Create a diff file for use with patch, - - # diff -Naur old_file new_file > diff_file - -Where old_file and new_file are either single files or directories containing files. The r option supports recursion of a directory tree. - -Once the diff file has been created, we can apply it to patch the old file into the new file: - - # patch < diff_file - -**Q:6 What is use of aspell ?** - -Ans: As the name suggest aspell is an interactive spelling checker in linux operating system. The aspell command is the successor to an earlier program named ispell, and can be used, for the most part, as a drop-in replacement. While the aspell program is mostly used by other programs that require spell-checking capability, it can also be used very effectively as a stand-alone tool from the command line. - -**Q:7 How to check the SPF record of domain from command line ?** - -Ans: We can check SPF record of a domain using dig command. Example is shown below : - - linuxtechi@localhost:~$ dig -t TXT google.com - -**Q:8 How to identify which package the specified file (/etc/fstab) is associated with in linux ?** - -Ans: # rpm -qf /etc/fstab - -Above command will list the package which provides file “/etc/fstab” - -**Q:9 Which command is used to check the status of bond0 ?** - -Ans: cat /proc/net/bonding/bond0 - -**Q:10 What is the use of /proc file system in linux ?** - -Ans: The /proc file system is a RAM based file system which maintains information about the current state of the running kernel including details on CPU, memory, partitioning, interrupts, I/O addresses, DMA channels, and running processes. This file system is represented by various files which do not actually store the information, they point to the information in the memory. The /proc file system is maintained automatically by the system. - -**Q:11 How to find files larger than 10MB in size in /usr directory ?** - -Ans: # find /usr -size +10M - -**Q:12 How to find files in the /home directory that were modified more than 120 days ago ?** - -Ans: # find /home -mtime +l20 - -**Q:13 How to find files in the /var directory that have not been accessed in the last 90 days ?** - -Ans: # find /var -atime -90 - -**Q:14 Search for core files in the entire directory tree and delete them as found without prompting for confirmation** - -Ans: # find / -name core -exec rm {} \; - -**Q:15 What is the purpose of strings command ?** - -Ans: The strings command is used to extract and display the legible contents of a non-text file. - -**Q:16 What is the use tee filter ?** - -Ans: The tee filter is used to send an output to more than one destination. It can send one copy of the output to a file and another to the screen (or some other program) if used with pipe. - - linuxtechi@localhost:~$ ll /etc | nl | tee /tmp/ll.out - -In the above example, the output from ll is numbered and captured in /tmp/ll.out file. The output is also displayed on the screen. - -**Q:17 What would the command export PS1 = ”$LOGNAME@`hostname`:\$PWD: do ?** - -Ans: The export command provided will change the login prompt to display username, hostname, and the current working directory. - -**Q:18 What would the command ll | awk ‘{print $3,”owns”,$9}’ do ?** - -Ans: The ll command provided will display file names and their owners. - -**Q:19 What is the use of at command in linux ?** - -Ans: The at command is used to schedule a one-time execution of a program in the future. All submitted jobs are spooled in the /var/spool/at directory and executed by the atd daemon when the scheduled time arrives. - -**Q:20 What is the role of lspci command in linux ?** - -Ans: The lspci command displays information about PCI buses and the devices attached to your system. Specify -v, -vv, or -vvv for detailed output. With the -m option, the command produces more legible output. - --------------------------------------------------------------------------------- - -via: http://www.linuxtechi.com/20-linux-commands-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/ -[1]: -[2]: -[3]: -[4]: -[5]: -[6]: -[7]: -[8]: -[9]: -[10]: -[11]: -[12]: -[13]: -[14]: -[15]: -[16]: -[17]: -[18]: -[19]: -[20]: 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..3fe7cd788c 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 @@ -1,8 +1,12 @@ +theol-l translating + The Curious Case of the Disappearing Distros +关于消失的发行版的古怪情形。 ================================================================================ ![](http://www.linuxinsider.com/ai/828896/linux-distros.jpg) "Linux is a big game now, with billions of dollars of profit, and it's the best thing since sliced bread, but corporations are taking control, and slowly but systematically, community distros are being killed," said Google+ blogger Alessandro Ebersol. "Linux is slowly becoming just like BSD, where companies use and abuse it and give very little in return." +"Linux现在成为了一个大型的游戏,同时具有巨额的利润,这是有史以来最好的事情。但是公司企业进行了控制,于是缓慢而系统的社区发行版就逐渐被干掉了,",Google+的一个博主 Alessandro Ebersol说到。"Linux开始变得像BSD--一些公司使用和滥用但是没有任何回报--一样缓慢。" Well the holidays are pretty much upon us at last here in the Linux blogosphere, and there's nowhere left to hide. The next two weeks or so promise little more than a blur of forced social occasions and too-large meals, punctuated only -- for the luckier ones among us -- by occasional respite down at the Broken Windows Lounge. @@ -117,4 +121,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/20150114 Why Mac users don't switch to Linux.md b/sources/talk/20150114 Why Mac users don't switch to Linux.md deleted file mode 100644 index f0094f14d9..0000000000 --- a/sources/talk/20150114 Why Mac users don't switch to Linux.md +++ /dev/null @@ -1,81 +0,0 @@ -Why Mac users don’t switch to Linux -================================================================================ -Linux and Mac users share at least one common thing: they prefer not to use Windows. But after that the two groups part company and tend to go their separate ways. But why don’t more Mac users switch to Linux? Is there something that prevents Mac users from making the jump? - -[Datamation took a look at these questions][1] and tried to answer them. Datamation’s conclusion was that it’s really about the applications and workflow, not the operating system: - -> …there are some instances where replacing existing applications with new options isn’t terribly practical – both in workflow and in overall functionality. This is an area where, sadly, Apple has excelled in. So while it’s hardly “impossible” to get around these issues, they are definitely a large enough challenge that it will give the typical Mac enthusiast pause. -> -> But outside of Web developers, honestly, I don’t see Mac users “en masse,” seeking to disrupt their workflows for the mere idea of avoiding the upgrade to OS X Yosemite. Granted, having seen Yosemite up close – Mac users who are considered power users will absolutely find this change-up to be hideous. However, despite poor OS X UI changes, the core workflow for existing Mac users will remain largely unchanged and unchallenged. -> -> No, I believe Linux adoption will continue to be sporadic and random. Ever-growing, but not something that is easily measured or accurately calculated. - -I agree to a certain extent with Datamation’s take on the importance of applications and workflows, both things are important and matter in the choice of a desktop operating system. But I think there’s something more going on with Mac users than just that. I believe that there’s a different mentality that exists between Linux and Mac users, and I think that’s the real reason why many Mac users don’t switch to Linux. - -![](http://jimlynch.com/wp-content/uploads/2015/01/mac-users-switch-to-linux.jpeg) - -### It’s all about control for Linux users ### - -Linux users tend to want control over their computing experience, they want to be able to change things to make them the way that they want them. One simply cannot do that in the same way with OS X or any other Apple products. With Apple you get what they give you for the most part. - -For Mac (and iOS) users this is fine, they seem mostly content to stay within Apple’s walled garden and live according to whatever standards and options Apple gives them. But this is totally unacceptable to most Linux users. People who move to Linux usually come from Windows, and it’s there that they develop their loathing for someone else trying to define or control their computing experiences. - -And once someone like that has tasted the freedom that Linux offers, it’s almost impossible for them to want to go back to living under the thumb of Apple, Microsoft or anyone else. You’d have to pry Linux from their cold, dead fingers before they’d accept the computing experience created for them Apple or Microsoft. - -But you won’t find that same determination to have control among most Mac users. For them it’s mostly about getting the most out of whatever Apple has done with OS X in its latest update. They tend to adjust fairly quickly to new versions of OS X and even when unhappy with Apple’s changes they seem content to continue living within Apple’s walled garden. - -So the need for control is a huge difference between Mac and Linux users. I don’t see it as a problem though since it just reflects the reality of two very different attitudes toward using computers. - -### Mac users need Apple’s support mechanisms ### - -Linux users are also different in the sense that they don’t mind getting their hands dirty by getting “under the hood” of their computers. Along with control comes the personal responsibility of making sure that their Linux systems work well and efficiently, and digging into the operating system is something that many Linux users have no problem doing. - -When a Linux user needs to fix something, chances are they will attempt to do so immediately themselves. If that doesn’t work then they’ll seek additional information online from other Linux users and work through the problem until it has been resolved. - -But Mac users are most likely not going to do that to the same extent. That is probably one of the reasons why Apple stores are so popular and why so many Mac users opt to buy Apple Care when they get a new Mac. A Mac user can simply take his or her computer to the Apple store and ask someone to fix it for them. There they can belly up to the Genius Bar and have their computer looked at by someone Apple has paid to fix it. - -Most Linux users would blanche at the thought of doing such a thing. Who wants some guy you don’t even know to lay hands on your computer and start trying to fix it for you? Some Linux users would shudder at the very idea of such a thing happening. - -So it would be hard for a Mac user to switch to Linux and suddenly be bereft of the support from Apple that he or she was used to getting in the past. Some Mac users might feel very vulnerable and uncertain if they were cut off from the Apple mothership in terms of support. - -### Mac users love Apple’s hardware ### - -The Datamation article focused on software, but I believe that hardware also matters to Mac users. Most Apple customers tend to love Apple’s hardware. When they buy a Mac, they aren’t just buying it for OS X. They are also buying Apple’s industrial design expertise and that can be an important differentiator for Mac users. Mac users are willing to pay more because they perceive that the overall value they are getting from Apple for a Mac is worth it. - -Linux users, on the other hand, seem less concerned by such things. I think they tend to focus more on cost and less on the looks or design of their computer hardware. For them it’s probably about getting the most value from the hardware at the lowest cost. They aren’t in love with the way their computer hardware looks in the same way that some Mac users probably are, and so they don’t make buying decisions based on it. - -I think both points of view on hardware are equally valid. It ultimately gets down to the needs of the individual user and what matters to them when they choose to buy or, in the case of some Linux users, build their computer. Value is the key for both groups, and each has its own perceptions of what constitutes real value in a computer. - -Of course it is [possible to run Linux on a Mac][2], directly or indirectly via virtual machine. So a user that really liked Apple’s hardware does have the option of keeping their Mac but installing Linux on it. - -### Too many Linux distros to choose from? ### - -Another reason that might make it hard for a Mac user to move to Linux is the sheer number of distributions to choose from in the world of Linux. While most Linux users probably welcome the huge diversity of distros available, it could also be very confusing for a Mac user who hasn’t learned to navigate those choices. - -Over time I think a Mac user would learn and adjust by figuring out which distribution worked best for him or her. But in the short term it might be a very daunting hurdle to overcome after being used to OS X for a long period of time. I don’t think it’s insurmountable, but it’s definitely something that is worth mentioning here. - -Of course we do have helpful resources like [DistroWatch][3] and even my own [Desktop Linux Reviews][4] blog that can help people find the right Linux distribution. Plus there are many articles available about “the best Linux distro” and that sort of thing that Mac users can use as resources when trying to figure out the distribution they want to use. - -But one of the reasons why Apple customers buy Macs is the simplicity and all-in-one solution that they offer in terms of the hardware and software being unified by Apple. So I am not sure how many Mac users would really want to spend the time trying to find the right Linux distribution. It might be something that puts them off really considering the switch to Linux. - -### Mac users are apples and Linux users are oranges ### - -I see nothing wrong with Mac and Linux users going their separate ways. I think we’re just talking about two very different groups of people, and it’s a good thing that both groups can find and use the operating system and software that they prefer. Let Mac users enjoy OS X and let Linux users enjoy Linux, and hopefully both groups will be happy and content with their computers. - -Every once in a while a Mac user might stray over to Linux or vice versa, but for the most part I think the two groups live in different worlds and mostly prefer to stay separate and apart from one another. I generally don’t compare the two because when you get right down to it, it’s really just a case of apples and oranges. - --------------------------------------------------------------------------------- - -via: http://jimlynch.com/linux-articles/why-mac-users-dont-switch-to-linux/ - -作者:[Jim Lynch][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://jimlynch.com/author/Jim/ -[1]:http://www.datamation.com/open-source/why-linux-isnt-winning-over-mac-users-1.html -[2]:http://www.howtogeek.com/187410/how-to-install-and-dual-boot-linux-on-a-mac/ -[3]:http://distrowatch.com/ -[4]:http://desktoplinuxreviews.com/ \ 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/20150121 Did this JavaScript break the console.md b/sources/talk/20150121 Did this JavaScript break the console.md new file mode 100644 index 0000000000..aab924ab33 --- /dev/null +++ b/sources/talk/20150121 Did this JavaScript break the console.md @@ -0,0 +1,91 @@ +Did this JavaScript break the console? +--------- + +#Q: + +Just doing some JavaScript stuff in google chrome (don't want to try in other browsers for now, in case this is really doing real damage) and I'm not sure why this seemed to break my console. + +```javascript +>var x = "http://www.foo.bar/q?name=%%this%%"; +x +``` + +After x (and enter) the console stops working... I restarted chrome and now when I do a simple + +```javascript +console.clear(); +``` + +It's giving me + +```javascript +Console was cleared +``` + +And not clearing the console. Now in my scripts console.log's do not register and I'm wondering what is going on. 99% sure it has to do with the double percent signs (%%). + +Anyone know what I did wrong or better yet, how to fix the console? + +[A bug report for this issue has been filed here.][1] +Edit: Feeling pretty dumb, but I had Preserve log checked... That's why the console wasn't clearing. + +#A: + +As discussed in the comments, there are actually many different ways of constructing a string that causes this issue, and it is not necessary for there to be two percent signs in most cases. + +```TXT +http://example.com/% +http://%%% +http://ab% +http://%ab +http://%zz +``` + +However, it's not just the presence of a percent sign that breaks the Chrome console, as when we enter the following well-formed URL, the console continues to work properly and produces a clickable link. + +```TXT +http://ab%20cd +``` + +Additionally, the strings `http://%`, and `http://%%` will also print properly, since Chrome will not auto-link a URL-link string unless the [`http://`][2] is followed by at least 3 characters. + +From here I hypothesized that the issue must be in the process of linking a URL string in the console, likely in the process of decoding a malformed URL. I remembered that the JavaScript function `decodeURI` will throw an exception if given a malformed URL, and since Chrome's developer tools are largely written in JavaScript, could this be the issue that is evidently crashing the developer console? + +To test this theory, I ran Chrome by the command link, to see if any errors were being logged. + +Indeed, the same error you would see if you ran decodeURI on a malformed URL (i.e. decodeURI('http://example.com/%')) was being printed to the console: + +>[4810:1287:0107/164725:ERROR:CONSOLE(683)] "Uncaught URIError: URI malformed", source: chrome-devtools://devtools/bundled/devtools.js (683) +>So, I opened the URL 'chrome-devtools://devtools/bundled/devtools.js' in Chrome, and on line 683, I found the following. + +```javascript +{var parsedURL=new WebInspector.ParsedURL(decodeURI(url));var origin;var folderPath;var name;if(parsedURL.isValid){origin=parsedURL.scheme+"://"+parsedURL.host;if(parsedURL.port) +``` + +As we can see, `decodeURI(url)` is being called on the URL without any error checking, thus throwing the exception and crashing the developer console. + +A real fix for this issue will come from adding error handling to the Chrome console code, but in the meantime, one way to avoid the issue would be to wrap the string in a complex data type like an array to prevent parsing when logging. + +```javascript +var x = "http://example.com/%"; +console.log([x]); +``` + +Thankfully, the broken console issue does not persist once the tab is closed, and will not affect other tabs. + +###Update: + +Apparently, the issue can persist across tabs and restarts if Preserve Log is checked. Uncheck this if you are having this issue. + +via:[stackoverflow](http://stackoverflow.com/questions/27828804/did-this-javascript-break-the-console/27830948#27830948) + +作者:[Alexander O'Mara][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/3155639/alexander-omara +[1]:https://code.google.com/p/chromium/issues/detail?id=446975 +[2]:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/decodeURI \ No newline at end of file diff --git a/sources/talk/20150128 7 communities driving open source development.md b/sources/talk/20150128 7 communities driving open source development.md new file mode 100644 index 0000000000..3b3c450cf8 --- /dev/null +++ b/sources/talk/20150128 7 communities driving open source development.md @@ -0,0 +1,86 @@ +7 communities driving open source development +================================================================================ +Not so long ago, the open source model was the rebellious kid on the block, viewed with suspicion by established industry players. Today, open initiatives and foundations are flourishing with long lists of vendor committers who see the model as a key to innovation. + +![](http://images.techhive.com/images/article/2015/01/0_opensource-title-100539095-orig.jpg) + +### Open Development of Tech Drives Innovation ### + +Over the past two decades, open development of technology has come to be seen as a key to driving innovation. Even companies that once saw open source as a threat have come around — Microsoft, for example, is now active in a number of open source initiatives. To date, most open development has focused on software. But even that is changing as communities have begun to coalesce around open hardware initiatives. Here are seven organizations that are successfully promoting and developing open technologies, both hardware and software. + +### OpenPOWER Foundation ### + +![](http://images.techhive.com/images/article/2015/01/1_openpower-100539100-orig.jpg) + +The [OpenPOWER Foundation][2] was founded by IBM, Google, Mellanox, Tyan and NVIDIA in 2013 to drive open collaboration hardware development in the same spirit as the open source software development which has found fertile ground in the past two decades. + +IBM seeded the foundation by opening up its Power-based hardware and software technologies, offering licenses to use Power IP in independent hardware products. More than 70 members now work together to create custom open servers, components and software for Linux-based data centers. + +In April, OpenPOWER unveiled a technology roadmap based on new POWER8 process-based servers capable of analyzing data 50 times faster than the latest x86-based systems. In July, IBM and Google released a firmware stack. October saw the availability of NVIDIA GPU accelerated POWER8 systems and the first OpenPOWER reference server from Tyan. + +### The Linux Foundation ### + +![](http://images.techhive.com/images/article/2015/01/2_the-linux-foundation-100539101-orig.jpg) + +Founded in 2000, [The Linux Foundation][2] is now the host for the largest open source, collaborative development effort in history, with more than 180 corporate members and many individual and student members. It sponsors the work of key Linux developers and promotes, protects and advances the Linux operating system and collaborative software development. + +Some of its most successful collaborative projects include Code Aurora Forum (a consortium of companies with projects serving the mobile wireless industry), MeeGo (a project to build a Linux kernel-based operating system for mobile devices and IVI) and the Open Virtualization Alliance (which fosters the adoption of free and open source software virtualization solutions). + +### Open Virtualization Alliance ### + +![](http://images.techhive.com/images/article/2015/01/3_open-virtualization-alliance-100539102-orig.jpg) + +The [Open Virtualization Alliance (OVA)][3] exists to foster the adoption of free and open source software virtualization solutions like Kernel-based Virtual Machine (KVM) through use cases and support for the development of interoperable common interfaces and APIs. KVM turns the Linux kernel into a hypervisor. + +Today, KVM is the most commonly used hypervisor with OpenStack. + +### The OpenStack Foundation ### + +![](http://images.techhive.com/images/article/2015/01/4_the-openstack-foundation-100539096-orig.jpg) + +Originally launched as an Infrastructure-as-a-Service (IaaS) product by NASA and Rackspace hosting in 2010, the [OpenStack Foundation][4] has become the home for one of the biggest open source projects around. It boasts more than 200 member companies, including AT&T, AMD, Avaya, Canonical, Cisco, Dell and HP. + +Organized around a six-month release cycle, the foundation's OpenStack projects are developed to control pools of processing, storage and networking resources through a data center — all managed or provisioned through a Web-based dashboard, command-line tools or a RESTful API. So far, the collaborative development supported by the foundation has resulted in the creation of OpenStack components including OpenStack Compute (a cloud computing fabric controller that is the main part of an IaaS system), OpenStack Networking (a system for managing networks and IP addresses) and OpenStack Object Storage (a scalable redundant storage system). + +### OpenDaylight ### + +![](http://images.techhive.com/images/article/2015/01/5_opendaylight-100539097-orig.jpg) + +Another collaborative project to come out of the Linux Foundation, [OpenDaylight][5] is a joint initiative of industry vendors, like Dell, HP, Oracle and Avaya founded in April 2013. Its mandate is the creation of a community-led, open, industry-supported framework consisting of code and blueprints for Software-Defined Networking (SDN). The idea is to provide a fully functional SDN platform that can be deployed directly, without requiring other components, though vendors can offer add-ons and enhancements. + +### Apache Software Foundation ### + +![](http://images.techhive.com/images/article/2015/01/6_apache-software-foundation-100539098-orig.jpg) + +The [Apache Software Foundation (ASF)][7] is home to nearly 150 top level projects ranging from open source enterprise automation software to a whole ecosystem of distributed computing projects related to Apache Hadoop. These projects deliver enterprise-grade, freely available software products, while the Apache License is intended to make it easy for users, whether commercial or individual, to deploy Apache products. + +ASF was incorporated in 1999 as a membership-based, not-for-profit corporation with meritocracy at its heart — to become a member you must first be actively contributing to one or more of the foundation's collaborative projects. + +### Open Compute Project ### + +![](http://images.techhive.com/images/article/2015/01/7_open-compute-project-100539099-orig.jpg) + +An outgrowth of Facebook's redesign of its Oregon data center, the [Open Compute Project (OCP)][7] aims to develop open hardware solutions for data centers. The OCP is an initiative made up of cheap, vanity-free servers, modular I/O storage for Open Rack (a rack standard designed for data centers to integrate the rack into the data center infrastructure) and a relatively "green" data center design. + +OCP board members include representatives from Facebook, Intel, Goldman Sachs, Rackspace and Microsoft. + +OCP recently announced two options for licensing: an Apache 2.0-like license that allows for derivative works and a more prescriptive license that encourages changes to be rolled back into the original software. + +-------------------------------------------------------------------------------- + +via: http://www.networkworld.com/article/2866074/opensource-subnet/7-communities-driving-open-source-development.html + +作者:[Thor Olavsrud][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.networkworld.com/author/Thor-Olavsrud/ +[1]:http://openpowerfoundation.org/ +[2]:http://www.linuxfoundation.org/ +[3]:https://openvirtualizationalliance.org/ +[4]:http://www.openstack.org/foundation/ +[5]:http://www.opendaylight.org/ +[6]:http://www.apache.org/ +[7]:http://www.opencompute.org/ \ No newline at end of file diff --git a/sources/talk/20150128 The top 10 rookie open source projects.md b/sources/talk/20150128 The top 10 rookie open source projects.md new file mode 100644 index 0000000000..0dfcb07a48 --- /dev/null +++ b/sources/talk/20150128 The top 10 rookie open source projects.md @@ -0,0 +1,153 @@ +The top 10 rookie open source projects +================================================================================ +Black Duck presents its Open Source Rookies of the Year -- the 10 most exciting, active new projects germinated by the global open source community + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_01-100564902-orig.jpeg) + +### Open Source Rookies of the Year ### + +Each year sees the start of thousands of new open source projects. Only a handful gets real traction. Some projects gain momentum by building on existing, well-known technologies; others truly break new ground. Many projects are created to solve a simple development problem, while others begin with loftier intentions shared by like-minded developers around the world. + +Since 2009, the open source software logistics company Black Duck has identified the [Open Source Rookies of the Year][1], based on activity tracked by its [Open Hub][2] (formerly Ohloh) site. This year, we're delighted to present 10 winners and two honorable mentions for 2015, selected from thousands of open source projects. Using a weighted scoring system, points were awarded based on project activity, the pace of commits, and several other factors. + +Open source has become the industry's engine of innovation. This year, for example, growth in projects related to Docker containerization trumped every other rookie area -- and not coincidentally reflected the most exciting area of enterprise technology overall. At the very least, the projects described here provide a window on what the global open source developer community is thinking, which is fast becoming a good indicator of where we're headed. + +### 2015 Open Source Rookie of the Year: DebOps ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_02-100564903-orig.jpeg) + +[DebOps][3] is a collection of [Ansible][4] playbooks and roles, scalable from one container to an entire data center. Founder Maciej Delmanowski open-sourced DebOps to ensure his work outlived his current work environment and could grow in strength and depth from outside contributors. + +DebOps began at a small university in Poland that ran its own data center, where everything was configured by hand. Crashes sometimes led to days of downtime -- and Delmanowski realized that a configuration management system was needed. Starting with a Debian base, DebOps is a group of Ansible playbooks that configure an entire data infrastructure. The project has been implemented in many different working environments, and the founders plan to continue supporting and improving it as time goes on. + +### 2015 Open Source Rookie of the Year: Code Combat ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_03-100564904-gallery.idge.jpg) + +The traditional pen-and-paper way of learning falls short for technical subjects. Games, however, are all about engagement -- which is why the founders of [CodeCombat][5] went about creating a multiplayer programming game to teach people how to code. + +At its inception, CodeCombat was an idea for a startup, but the founders decided to create an open source project instead. The idea blossomed within the community, and the project gained contributors at a steady rate. A mere two months after its launch, the game was accepted into Google’s Summer of Code. The game reaches a broad audience and is available in 45 languages. CodeCombat hopes to become the standard for people who want to learn to code and have fun at the same time. + +### 2015 Open Source Rookie of the Year: Storj ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_04-100564905-gallery.idge.jpg) + +[Storj][6] is a peer-to-peer cloud storage network that implements end-to-end encryption, enabling users to transfer and share data without reliance on a third party. Based on bitcoin blockchain technology and peer-to-peer protocols, Storj provides secure, private, and encrypted cloud storage. + +Opponents of cloud-based data storage worry about cost efficiencies and vulnerability to attack. Intended to address both concerns, Storj is a private cloud storage marketplace where space is purchased and traded via Storjcoin X (SJCX). Files uploaded to Storj are shredded, encrypted, and stored across the community. File owners are the sole individuals who possess keys to the encrypted information. + +The proof of concept for this decentralized cloud storage marketplace was first presented at the Texas Bitcoin Conference Hackathon in 2014. After winning first place in the hackathon, the project founders and leaders used open forums, Reddit, bitcoin forums, and social media to grow an active community, now an essential part of the Storj decision-making process. + +### 2015 Open Source Rookie of the Year: Neovim ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_05-100564906-orig.jpg) + +Since its inception in 1991, Vim has been a beloved text editor adopted by millions of software developers. [Neovim][6] is the next generation. + +The software development ecosystem has experienced exponential growth and innovation over the past 23 years. Neovim founder Thiago de Arruda knew that Vim was lacking in modern-day features and development speed. Although determined to preserve the signature features of Vim, the community behind Neovim seeks to improve and evolve the technology of its favorite text editor. Crowdfunding initially enabled de Arruda to focus six uninterrupted months on launching this endeavor. He credits the Neovim community for supporting the project and for inspiring him to continue contributing. + +### 2015 Open Source Rookie of the Year: CockroachDB ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_06-100564907-orig.jpg) + +Former Googlers are bringing a big-company data solution to open source in the form of [CockroachDB][8], a scalable, geo-replicated, transactional data store. + +To maintain the terabytes of data transacted over its global online properties, Google developed Spanner. This powerful tool provides Google with scalability, survivability, and transactionality -- qualities that the team behind CockroachDB is serving up to the open source community. Like an actual cockroach, CockroachDB can survive without its head, tolerating the failure of any node. This open source project has a devoted community of experienced contributors, actively cultivated by the founders via social media, GitHub, networking, conferences, and meet-ups. + +### 2015 Open Source Rookie of the Year: Kubernetes ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_07-100564908-orig.jpg) + +In introducing containerized software development to the open source community, [Docker][9] has become the backbone of a strong, innovative set of tools and technologies. [Kubernetes][10], which Google introduced last June, is an open source container management tool used to accelerate development and simplify operations. + +Google has been using containers for years in its internal operations. At the summer 2014 DockerCon, the Internet giant open-sourced Kubernetes, which was developed to meet the needs of the exponentially growing Docker ecosystem. Through collaborations with other organizations and projects, such as Red Hat and CoreOS, Kubernetes project managers have grown their project to be the No. 1 downloaded tool on the Docker Hub. The Kubernetes team hopes to expand the project and grow the community, so software developers can spend less time managing infrastructure and more time building the apps they want. + +### 2015 Open Source Rookie of the Year: Open Bazaar ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_08-100564909-orig.jpg) + +[OpenBazaar][11] is a decentralized marketplace for trading with anyone using bitcoin. The proof of concept for OpenBazaar was born at a hackathon, where its founders combined BitTorent, bitcoin, and traditional financial server methodologies to create a censorship-resistant trading platform. The OpenBazaar team sought new members, and before long they were able to expand the OpenBazaar community immensely. The table stakes of OpenBazaar -- transparency and a common goal to revolutionize trade and commerce -- are helping founders and contributors work toward a real-world, uncontrolled, and decentralized marketplace. + +### 2015 Open Source Rookie of the Year: IPFS ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_09-100564910-orig.jpg) + +[IPFS (InterPlanetary File System)][12] is a global, versioned, peer-to-peer file system.It synthesizes many of the ideas behind Git, BitTorrent, and HTTP to bring a new data and data structure transport protocol to the open Web. + +Open source is known for developing simple solutions to complex problems that result in many innovations, but these powerful projects represent only one slice of the open source community. IFPS belong to a more radical group whose proof of concept seems daring, outrageous, and even unattainable -- in this case, a peer-to-peer distributed file system that seeks to connect all computing devices. This possible HTTP replacement maintains a community through multiple mediums, including the Git community and an IRC channel that has more than 100 current contributors. This “crazy” idea will be available for alpha testing in 2015. + +### 2015 Open Source Rookie of the Year: cAdvisor ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_10-100564911-orig.jpg) + +[cAdvisor (Container Advisor)][13] is a daemon that collects, aggregates, processes, and exports information about running containers, providing container users with an understanding of resource usage and performance characteristics. For each container, cAdvisor keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage, and network statistics. This data is exported by container and across machines. + +cAdvisor can run on most Linux distros and supports many container types, including Docker. It has become the de facto monitoring agent for containers, has been integrated into many systems, and is one of the most downloaded images on the Docker Hub. The team hopes to grow cAdvisor to understand application performance more deeply and to integrate this information into clusterwide systems. + +### 2015 Open Source Rookie of the Year: Terraform ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_11-100564912-orig.jpg) + +[Terraform][14] provides a common configuration to launch infrastructure, from physical and virtual servers to email and DNS providers. The idea is to encompass everything from custom in-house solutions to services offered by public cloud platforms. Once launched, Terraform enables ops to change infrastructure safely and efficiently as the configuration evolves. + +Working at a devops company, Terraform.io's founders identified a pain point in codifying the knowledge required to build a complete data center, from plugged-in servers to a fully networked and functional data center. Infrastructure is described using a high-level configuration syntax, which allows a blueprint of your data center to be versioned and treated as you would any other code. Sponsorship from the well-respected open source company HashiCorp helped launch the project. + +### Honorable mention: Docker Fig ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_12-100564913-orig.jpg) + +[Fig][15] provides fast, isolated development environments using [Docker][16]. It moves the configuration required to orchestrate Docker into a simple fig.yml file. It handles all the work of building and running containers and forwarding their ports, as well as sharing volumes and linking them. + +Orchard formed Fig last year to create a new system of tools to make Docker work. It was developed as a way of setting up development environments with Docker, enabling users to define the exact environment for their apps, while also running databases and caches inside Docker. Fig solved a major pain point for developers. Docker fully supports this open source project and [recently purchased Orchard][17] to expand the reach of Fig. + +### Honorable mention: Drone ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_13-100564916-orig.jpg) + +[Drone][18] is a Continuous Integration platform built on Docker and [written in Go][19]. The Drone project grew out of frustration with existing available technologies and processes for setting up development environments. + +Drone provides a simple approach to automated testing and continuous delivery: Simply pick a Docker image tailored to your needs, connect GitHub, and commit. Drone uses Docker containers to provision isolated testing environments, giving every project complete control over its stack without the burden of traditional server administration. The community behind Drone is 100 contributors strong and hopes to bring this project to the enterprise and to mobile app development. + +### Open source rookies ### + +![](http://images.techhive.com/images/article/2015/01/open_source_rookies_14-100564941-orig.jpg) + +- [Open Source Rookies of the 2014 Year][20] +- [InfoWorld's 2015 Technology of the Year Award winners][21] +- [Bossies: The Best of Open Source Software Awards][22] +- [15 essential open source tools for Windows admins][23] + +-------------------------------------------------------------------------------- + +via: http://www.infoworld.com/article/2875439/open-source-software/the-top-10-rookie-open-source-projects.html + +作者:[Black Duck Software][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Black-Duck-Software/ +[1]:https://www.blackducksoftware.com/open-source-rookies +[2]:https://www.openhub.net/ +[3]:https://github.com/debops/debops +[4]:http://www.infoworld.com/article/2612397/data-center/review--ansible-orchestration-is-a-veteran-unix-admin-s-dream.html +[5]:https://codecombat.com/ +[6]:http://storj.io/ +[7]:http://neovim.org/ +[8]:https://github.com/cockroachdb/cockroach +[9]:http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker +[10]:http://kubernetes.io/ +[11]:https://openbazaar.org/ +[12]:http://ipfs.io/ +[13]:https://github.com/google/cadvisor +[14]:https://www.terraform.io/ +[15]:http://www.fig.sh/ +[16]:http://www.infoworld.com/resources/16373/application-virtualization/the-beginners-guide-to-docker +[17]:http://www.infoworld.com/article/2608546/application-virtualization/docker-acquires-orchard-in-a-sign-of-rising-ambitions.html +[18]:https://drone.io/ +[19]:http://www.infoworld.com/article/2683845/google-go/164121-Fast-guide-to-Go-programming.html +[20]:https://www.blackducksoftware.com/open-source-rookies +[21]:http://www.infoworld.com/article/2871935/application-development/infoworlds-2015-technology-of-the-year-award-winners.html +[22]:http://www.infoworld.com/article/2688104/open-source-software/article.html +[23]:http://www.infoworld.com/article/2854954/microsoft-windows/15-essential-open-source-tools-for-windows-admins.html \ 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 new file mode 100644 index 0000000000..90923c1aae --- /dev/null +++ b/sources/talk/20150205 GHOST--Another Security Bug Hits Linux, But is it That Bad.md @@ -0,0 +1,34 @@ +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/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/20150310 FAQ--BSD.md b/sources/talk/20150310 FAQ--BSD.md new file mode 100644 index 0000000000..80f77ef656 --- /dev/null +++ b/sources/talk/20150310 FAQ--BSD.md @@ -0,0 +1,81 @@ +FAQ: BSD +================================================================================ +![](http://www.linuxvoice.com/wp-content/uploads/2015/02/faq1-large1.png) + +### Had history been slightly different, you’d be reading FreeBSD Voice today… ### + +#### So what’s the deal with this Birsa Seva Dal then? Isn’t it a political group in India? #### + +Very funny – you looked up the “BSD” disambiguation page on Wikipedia just to make that joke, didn’t you? Here we’re talking about the Berkeley Software Distribution, a family of operating systems that are much more widely used than you might think. + +#### Sorry, I couldn’t help myself. OK, so what’s the deal with these OSes? #### + +There are three main BSD operating systems in use today. They are based on Unix, they are open source, they tend to be used in server roles, but can also make good desktops and workstations as well. They run KDE, Firefox, LibreOffice, Apache, MySQL and pretty much any open source application you can name. They’re reliable, secure and support a lot of different hardware. + +#### Congratulations – you’ve just described GNU/Linux… #### + +True. Linux has all of the things I’ve just mentioned, and that’s why a lot of people never investigate BSD. In day-to-day usage, there isn’t a lot of difference between the BSD family and Linux, largely because they all have Unix underpinnings, and also because they share a lot of software. You could be logged into a remote machine, hacking some Python code in Vim, and checking your email in Mutt, and you wouldn’t know you were running BSD. Or you could be using an internet terminal in a cafe somewhere and not know it’s BSD. + +The biggest differences are in the development model and licence, and to understand this, we need to step back in time. The B in BSD refers to the University of California, Berkeley, which was a hotbed of open source Unix development back in the 1980s. As the 90s came, x86-based PCs were becoming popular and many people were interested in having a Unix-like OS on their home computers. A project called 386BSD was released in 1992 to provide just that. + +#### And where were all the Linux distributions at this time? #### + +Good question! You might know that one year before, Linus Torvalds had announced his kernel, which, when paired with the GNU project, formed a complete open source operating system. Linus had been following GNU’s own kernel (Hurd) and 386BSD, and said that had either of them been ready for daily use, he probably wouldn’t have created Linux. So the first few years of the 90s were tremendously lively for open source operating systems, and nobody was really sure which ones would succeed. + +Then it got messy for BSD. AT&T, the original developer of Unix, was trying to monetise its work on the operating system and claimed that BSD infringed its intellectual property rights. This culminated in a lawsuit in 1992 which severely held back BSD development. In the end, various chunks of the BSD source code had to be rewritten – while all this time, GNU/Linux was gaining features, stability and popularity. + +BSD was arguably in a more mature state than GNU/Linux in the early 1990s, and without these legal complications it could have become the standard on x86 PCs. We could all be using it today instead of Linux. + +#### But you said earlier that BSD is still widely used, so things improved after that? #### + +Yes. 386BSD development stagnated, but two teams of developers working over the internet created separate successor projects. FreeBSD became the most widely used flavour of BSD, and is now the closest to Linux as a desktop and server operating system, while NetBSD focused on portability (today it runs on over 50 platforms, all built from the same codebase). The third flavour, OpenBSD, forked off from NetBSD just a few years after NetBSD started due to a developer spat, and today it’s well known for its concentration on security. Over the years, OpenBSD has created many programs that have become standard on Linux, such as OpenSSH – and now we have LibreSSL too. + +#### So these three flavours of BSD are like Linux distributions? #### + +Yes and no. Each BSD has a separate codebase and separate development teams, although there is a lot of code-flow between them (especially for hardware drivers). But they are standalone operating systems with their own features, pros and cons. + +We mentioned that the development model of the BSDs is one feature that really distinguishes them from GNU/Linux. There’s nobody in charge of GNU/Linux as a whole: some teams are working on the GNU components, some are working on the kernel, some on boot scripts, some on manual pages, some on libraries, and so forth. The development model is often called “wild west”, with a lack of central authority, and distributions do all the hard work of fitting everything together. + +The BSDs, in contrast, are developed as complete projects from centralised source code trees. The kernel, the libraries, the system utilities and the manual pages are all stored and worked on in the same place. Many BSD fans argue that this gives the operating systems more coherency and stability, and from our years of dabbling with BSD we can attest that the manual pages are largely superb. + +![](http://www.linuxvoice.com/wp-content/uploads/2015/02/faq2-large1.png) + +#### Don’t the BSDs use anything from GNU/Linux? #### + +Yes, especially GCC. The GNU Compiler Collection has been the de-facto standard compiler on free Unix systems for decades, although FreeBSD has recently moved to LLVM/Clang. It’s important to note that the BSDs also use other open source projects that aren’t specifically GNU or Linux, such as the X Window System (XFree86 and X.org), Perl and so forth. And thanks to standards such as POSIX, most programs that run on Linux can be recompiled to run on the various BSD flavours. + +So, you could replace the L in a LAMP (Linux, Apache, MySQL and PHP) stack with FreeBSD, and get pretty much the same environment, with a different set of features (eg variations in filesystem and driver support). And there are some mega, super, huge users of FreeBSD, such as Netflix, which serve up ridiculous amounts of data every day. While FreeBSD makes a good desktop OS, its strengths really lie in the server room, with exceptional reliability and network performance. + +OpenBSD tends to be used in smaller web serving, file hosting, firewall and gateway roles where security is imperative. NetBSD is the least popular of the main BSD flavours – it can run on almost anything though, including old Amigas and Acorn boxes, and sometimes finds itself inside closed-source network devices. + +#### Hang on – how can someone close the source code? That ain’t kosher in Linux! #### + +Correct, and here we come to the other major difference with GNU/Linux. The licence for the BSD flavours (called, funnily enough, the BSD Licence) is very different to the GPL that we know. For starters, it’s much shorter. The BSD Licence essentially says: do what you want with this code, but give the original developers credit for writing it, and don’t try to sue them if it blows up your computer. + +So there’s nothing in the licence that forces the code to stay open, unlike with the GPL, which requires that users of the code also make their modifications freely available. This crucial difference has sparked countless flame wars over the years, with BSD fans saying that their licence is more free (because it’s less restrictive), while GNU/GPL fans say that their licence is actually more free (because it preserves freedom down the road). + +#### Blimey. Anyway, now that you’ve piqued my interest, where can I try out all these lovely BSD flavours? #### + +You can probably guess the websites – [www.openbsd.org][1], [www.freebsd.org][2] and [www.netbsd.org][3] – where you can download ISO images, boot them in VirtualBox, and play around. If you’ve been using Linux for a while, you won’t find any of them too difficult, although you’re expected to know your way around the command line. If you’re looking for something more newbie-friendly, PC-BSD + +([www.pcbsd.org][4]) is a customised version of FreeBSD focused on the desktop, with a fancy graphical installer and super-simple management of software. Have fun exploring! + + + + + +-------------------------------------------------------------------------------- + +via: http://www.linuxvoice.com/faq-bsd-2/ + +作者:[Mike Saunders][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/mike/ +[1]:http://www.openbsd.org/ +[2]:http://www.freebsd.org/ +[3]:http://www.netbsd.org/ +[4]:http://www.pcbsd.org/ \ 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/The history of Android/12 - The history of Android.md b/sources/talk/The history of Android/12 - The history of Android.md deleted file mode 100644 index 67538389d0..0000000000 --- a/sources/talk/The history of Android/12 - The history of Android.md +++ /dev/null @@ -1,100 +0,0 @@ -translating by alim0x - -The history of Android -================================================================================ -### Android 2.1—the discovery (and abuse) of animations ### - -Android 2.1 came out with the launch of the Nexus One, which was only three months after the release of 2.0. The new OS wasn't a huge release, so it still kept the codename "Éclair." Android development was chugging along at an unheard-of pace, with Google averaging a new OS release every two-and-a-half months over the last 15 months. - -Thanks mostly to the marketing efforts of Verizon and the "Droid" line of phones, Android was gaining in popularity. The OS was still considered ugly, though, and while the Android engineers at the time seemed to have almost no formal design training, in Android 2.1 they tried to spruce things up a bit by slathering on heavy-handed animation effects wherever they could. The result was an OS that seemed to be desperately trying to prove that it could do animation effects. Many of the new additions felt more like tech demos than user-experience improvements. - -![The lock and home screens from Android 2.1 and 2.0.](http://cdn.arstechnica.net/wp-content/uploads/2014/01/21.png) -The lock and home screens from Android 2.1 and 2.0. -Photo by Ron Amadeo - -Android 2.0's rotary dial lock screen was kicked to the curb after only one version and replaced with the same pull tabs the incoming call screen used. The lock screen clock was an attempt at a uniquely Android font, but as typefaces go, it was pretty hideous looking. - -One of the biggest features in Android 2.1 was "Live Wallpapers"—interactive or moving images that could be set as the wallpaper. The default Live Wallpaper was a grid of squares with blue, red, yellow, and green lights continually streaking across it. Tapping on the screen would send lights firing out in all four directions from the center of your tap. While Live Wallpapers looked neat (and was a unique feature over the iPhone), the animated backgrounds sucked up battery power and CPU cycles. It seemed to make the whole phone run a little slower. - -On the home screen, the default Google Search widget was given a lot more padding and now sits centered in its row. Page indicators now lived in the bottom left and right corners of the screen, and the number of home screen pages jumped from three to five. The app drawer tab at the bottom was replaced with an icon showing a grid of squares, a metaphor that Google still uses today. - -![A picture showing the app drawer design and a composite image showing the app selection for Android 2.1 and 2.0.](http://cdn.arstechnica.net/wp-content/uploads/2014/01/21icons.png) -A picture showing the app drawer design and a composite image showing the app selection for Android 2.1 and 2.0. -Photo by Ron Amadeo - -With the new app drawer icon came a totally new app drawer. Instead of a tabbed container that lifted up from the bottom of the screen, the app drawer displayed as a full-screen interface. The carbon fiber weave was removed, and the background switched to a plain black background—a decision that would stick around all the way up to KitKat. - -Google decided to add a floating, semi-transparent home icon to the bottom of the app drawer to give people an easy way out of the full-screen tab interface. This could be seen as a precursor to the on-screen home button that was introduced in Android 4.0. - -The app drawer was given a tacky graphics effect, too. While scrolling, the icons at the top and bottom of the list would bend inward and appear to move deeper into the phone, sort of like the opening scroll in Star Wars. - -There were a few changes to the icons. "Amazon MP3" and "Alarm Clock" both lost their first names, along with their premium alphabetical real-estate at the top of the app drawer. Two new apps showed up: News and Weather, and Google Voice, which was Google's telecommunication service. Since the Nexus One was not a Verizon phone, Verizon's Visual Voicemail app was dumped. - -![The revamped clock app.](http://cdn.arstechnica.net/wp-content/uploads/2014/01/clo2ck.png) -The revamped clock app. -Photo by Ron Amadeo - -Along with the name change, the clock app got a total revamp. Tapping on the clock shortcut no longer opened the alarms page; instead it went to a "desk clock" interface (left picture, above) with a background that matched the wallpaper. The clock used the same font from the lock screen, pulling in weather from the new News And Weather app. - -The new alarm page cleaned up a lot of the weirder design decisions made in the old version. The analog clock and selectable clock designs were dead. The checkboxes were replaced with a green on/off light, which was much easier to parse than "gray check/green check." While it might be hard to see from the thumbnail (click for a bigger version), the old alarm design displayed AM and PM next to the time. The 2.1 design did away with that, only showing the relevant meridian. A digital clock was placed at the bottom, and the clock icon took you back to the desk clock interface. - -![The Gallery and individual image screens from 2.1 and 2.0.](http://cdn.arstechnica.net/wp-content/uploads/2014/01/gallery1.png) -The Gallery and individual image screens from 2.1 and 2.0. -Photo by Ron Amadeo - -Google's desire to improve the look of Android was most evident in the 2.1 Gallery, which was all about heavy-handed animation effects and transparencies. When the app opened, individual pictures flew in from the top of the screen and shuffled into little piles that made up an album. When opening an album, the picture stack separated, and the photos slid into a grid formation. Everything you touched would pop open, squish, and stretch like a spring-loaded piece of Jell-o. - -There was no "normal" background for the Gallery. It would randomly pick a picture on the screen and heavily distort it for use as a background image. When that picture scrolled off-screen, it would pick a new background image, so the tone of the background always matched your pictures. - -The top left of the screen housed a breadcrumbs bar. It displayed your current location and any folders between you and the main screen—it could be thought of as an early precursor to the "Up" button that would debut in Android 3.0. In the top right was a link to the camera app, which still sported the same faux-leather design that debuted in Android 1.6—the two designs could not be more different. - -While the camera was another weird, one-off design, never was the wild UI disparity between Android apps more apparent than in the new Gallery. It didn't use Android buttons, menus, or any of the existing UI paradigms. It even hid the status bar in every screen—you could barely tell you were looking at Android. - -In the individual photo view, you could finally swipe between images, which removed the need for chunky left and right arrows. For some reason, the color-matched background wasn't on this screen. It was the only part of the app where the background is black. Zoom controls were in the top-right (still no pinch zoom), and commands were held in a single strip along the bottom of the screen. Hitting the "menu" button (software or hardware) didn't bring up a 2×3 grid of options like every other app—the items in the bottom strip just changed from two options to three other options. - -![The animation-filled Gallery app.](http://cdn.arstechnica.net/wp-content/uploads/2014/01/gallery2.png) -The animation-filled Gallery app. -Photo by Ron Amadeo - -The first picture, above, shows an album view. You could scroll horizontally through a large album or use the fast scroll bar at the bottom of the screen. Long pressing on a picture (or, bizarrely, pressing the hardware menu button) would bring up a "checkbox" interface, where you could tap on several pictures to select them. After you've selected pictures, you could then batch share, delete, or rotate them. - -The menus on this screen and the next individual picture screen were semi-transparent speech bubbles that would spring out of their respective buttons when tapped on. Again, this was about as far away from the normal Android conventions as you could get. The Gallery was also one of the first apps to have an overscroll effect. When you hit the end of the photo wall, the entire surface would skew in the direction of the scrolling. - -The 2.1 Gallery was the first photo client to show your cloud-stored Picasa photos along with local pictures. These were marked with a white camera shutter icon in the bottom left corner of a thumbnail. This would later become Google+ Photos. - -No Android app before or since had looked like the gallery. There was good reason for that—it wasn’t made by Google! The app was farmed out to Cooliris, who didn't bother following a single existing Android UI paradigm. While the app was usable, all the animations and effects made it seem like a case of style over substance. - -![The "News and Weather" app showing... the news and weather.](http://cdn.arstechnica.net/wp-content/uploads/2014/01/newsandweather.png) -The "News and Weather" app showing... the news and weather. -Photo by Ron Amadeo - -Compare the Gallery to the other new Android 2.1 app: News And Weather. While the Gallery was a transparency-filled animation fest, News And Weather was all about dark gradients and contrasting colors. This app powered the weather display on the desk clock app, and it even came with a home screen widget. The first screen just showed the weather and a six-day forecast for your current location. Along the top of the screens were tabs, next to the city name was a small "i" button that would bring up a temperature and precipitation graph. You could slide your finger along the graph to get exact temperatures and precipitation for any given minute. - -The big innovation in this app was swipeable tabs, an idea that would eventually become a standard Android UI convention. After the weather were a bunch of user configurable news tabs, and besides tapping on the tabs to switch to them, you could just swipe horizontally across the screen and the tab would change. The news tabs all showed a list of news headlines that were almost always truncated to the point that you had no idea what the story was about. When opening a webpage from this app, it didn't load the browser. Instead, it opened the story within the app complete with a weird white border. - -![Google Maps showing off some Labs features, the new widget designs, the only screen we can access in Google Voice, and the new tabbed music design.](http://cdn.arstechnica.net/wp-content/uploads/2014/04/ccccombo.jpg) -Google Maps showing off some Labs features, the new widget designs, the only screen we can access in Google Voice, and the new tabbed music design. -Photo by Ron Amadeo - -Widgets in 2.1 were all redesigned, with almost everything receiving a black gradient, and made better use of the available space. The clock changed back to a circle, and the calendar got a blue top, which matched the app a little more closely. Google Voice will start up, but the sign-in is broken—this is as far as you can get. - -The oft-neglected Music app got a minor update. The four-button home screen was removed completely, and tabs for each music display mode were added to the top of the screen. This meant when opening the app, you were immediately presented with a list of music, instead of a navigational page. Unlike the News and Weather app, these newly installed tabs here could not be swiped between. - ----------- - -![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: - -译者:[译者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/ronamadeo -[t]:https://twitter.com/RonAmadeo 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 index 85c04441ac..31f5cd7eb4 100644 --- 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 @@ -1,4 +1,4 @@ -The history of Android +【translating】The history of Android ================================================================================ ![](http://cdn.arstechnica.net/wp-content/uploads/2014/03/ready-fight.png) @@ -101,4 +101,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor [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 \ No newline at end of file +[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 index 2825d7eee8..3377527026 100644 --- 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 @@ -1,3 +1,5 @@ +alim0x translating + The history of Android ================================================================================ ### Voice Actions—a supercomputer in your pocket ### @@ -79,4 +81,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor [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 \ No newline at end of file +[t]:https://twitter.com/RonAmadeo diff --git a/sources/tech/20140917 How to create a software RAID-1 array with mdadm on Linux.md b/sources/tech/20140917 How to create a software RAID-1 array with mdadm on Linux.md deleted file mode 100644 index 6e8ee86ad6..0000000000 --- a/sources/tech/20140917 How to create a software RAID-1 array with mdadm on Linux.md +++ /dev/null @@ -1,223 +0,0 @@ -How to create a software RAID-1 array with mdadm on Linux -================================================================================ -Redundant Array of Independent Disks (RAID) is a storage technology that combines multiple hard disks into a single logical unit to provide fault-tolerance and/or improve disk I/O performance. Depending on how data is stored in an array of disks (e.g., with striping, mirroring, parity, or any combination thereof), different RAID levels are defined (e.g., RAID-0, RAID-1, RAID-5, etc). RAID can be implemented either in software or with a hardware RAID card. On modern Linux, basic software RAID functionality is available by default. - -In this post, we'll discuss the software setup of a RAID-1 array (also known as a "mirroring" array), where identical data is written to the two devices that form the array. While it is possible to implement RAID-1 with partitions on a single physical hard drive (as with other RAID levels), it won't be of much use if that single hard drive fails. In fact, that's why most RAID levels normally use multiple physical drives to provide redundancy. In the event of any single drive failure, the virtual RAID block device should continue functioning without issues, and allow us to replace the faulty drive without significant production downtime and, more importantly, with no data loss. However, it does not replace the need to save periodic system backups in external storage. - -Since the actual storage capacity (size) of a RAID-1 array is the size of the smallest drive, normally (if not always) you will find two identical physical drives in RAID-1 setup. - -### Installing mdadm on Linux ### - -The tool that we are going to use to create, assemble, manage, and monitor our software RAID-1 is called mdadm (short for **m**ultiple **d**isks **adm**in). On Linux distros such as Fedora, CentOS, RHEL or Arch Linux, mdadm is available by default. On Debian-based distros, mdadm can be installed with aptitude or apt-get. - -#### Fedora, CentOS or RHEL #### - -As mdadm comes pre-installed, all you have to do is to start RAID monitoring service, and configure it to auto-start upon boot: - - # systemctl start mdmonitor - # systemctl enable mdmonitor - -For CentOS/RHEL 6, use these commands instead: - - # service mdmonitor start - # chkconfig mdmonitor on - -#### Debian, Ubuntu or Linux Mint #### - -On Debian and its derivatives, mdadm can be installed with **aptitude or apt-get**: - - # aptitude install mdadm - -On Ubuntu, you will be asked to configure postfix MTA for sending out email notifications (as part of RAID monitoring). You can skip it for now. - -On Debian, the installation will start with the following explanatory message to help us decide whether or not we are going to install the root filesystem on a RAID array. What we need to enter on the next screen will depend on this decision. Read it carefully: - -![](https://farm4.staticflickr.com/3918/15220883382_c14eb95914_z.jpg) - -Since we will not use our RAID-1 for the root filesystem, we will leave the answer blank: - -![](https://farm6.staticflickr.com/5555/15198241896_29e08b977f.jpg) - -When asked whether we want to start (reassemble) our array automatically during each boot, choose "Yes". Note that we will need to add an entry to the /etc/fstab file later in order for the array to be properly mounted during the boot process as well. - -![](https://farm4.staticflickr.com/3875/15220883342_2b1d689a0a_z.jpg) - -### Partitioning Hard Drives ### - -Now it's time to prepare the physical devices that will be used in our array. For this setup, I have plugged in two 8 GB USB drives that have been identified as /dev/sdb and /dev/sdc from dmesg output: - - # dmesg | less - ----------- - -[ 60.014863] sd 3:0:0:0: [sdb] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB) -[ 75.066466] sd 4:0:0:0: [sdc] 15826944 512-byte logical blocks: (8.10 GB/7.54 GiB) - -We will use fdisk to create a primary partition on each disk that will occupy its entire size. The following steps show how to perform this task on /dev/sdb, and assume that this drive hasn't been partitioned yet (otherwise, we can delete the existing partition(s) to start off with a clean disk): - - # fdisk /dev/sdb - -Press 'p' to print the current partition table: - -![](https://farm4.staticflickr.com/3883/15198241836_24625edcf3_z.jpg) - -(if one or more partitions are found, they can be deleted with 'd' option. Then 'w' option is used to apply the changes). - -Since no partitions are found, we will create a new primary partition ['n'] as a primary partition ['p'], assign the partition number = ['1'] to it, and then indicate its size. You can press Enter key to accept the proposed default values, or enter a value of your choosing, as shown in the image below. - -![](https://farm4.staticflickr.com/3875/15034475369_7e72fb9f2e_z.jpg) - -Now repeat the same process for /dev/sdc. - -If we have two drives of different sizes, say 750 GB and 1 TB for example, we should create a primary partition of 750 GB on each of them, and use the remaining space on the bigger drive for another purpose, independent of the RAID array. - -### Create a RAID-1 Array ### - -Once you are done with creating the primary partition on each drive, use the following command to create a RAID-1 array: - - # mdadm -Cv /dev/md0 -l1 -n2 /dev/sdb1 /dev/sdc1 - -Where: - -- **-Cv**: creates an array and produce verbose output. -- **/dev/md0**: is the name of the array. -- **-l1** (l as in "level"): indicates that this will be a RAID-1 array. -- **-n2**: indicates that we will add two partitions to the array, namely /dev/sdb1 and /dev/sdc1. - -The above command is equivalent to: - - # mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1 - -If alternatively you want to add a spare device in order to replace a faulty disk in the future, you can add '--spare-devices=1 /dev/sdd1' to the above command. - -Answer "y" when prompted if you want to continue creating an array, then press Enter: - -![](https://farm4.staticflickr.com/3894/15034569970_709bd51718.jpg) - -You can check the progress with the following command: - - # cat /proc/mdstat - -![](https://farm6.staticflickr.com/5565/15221267975_701b819e6d_z.jpg) - -Another way to obtain more information about a RAID array (both while it's being assembled and after the process is finished) is: - - # mdadm --query /dev/md0 - # mdadm --detail /dev/md0 (or mdadm -D /dev/md0) - -![](https://farm6.staticflickr.com/5583/15034683868_6c28564e5a_z.jpg) - -Of the information provided by 'mdadm -D', perhaps the most useful is that which shows the state of the array. The active state means that there is currently I/O activity happening. Other possible states are clean (all I/O activity has been completed), degraded (one of the devices is faulty or missing), resyncing (the system is recovering from an unclean shutdown such as a power outage), or recovering (a new drive has been added to the array, and data is being copied from the other drive onto it), to name the most common states. - -### Formatting and Mounting a RAID Array ### - -The next step is formatting (with ext4 in this example) the array: - - # mkfs.ext4 /dev/md0 - -![](https://farm4.staticflickr.com/3849/15034683838_01e34e7196_z.jpg) - -Now let's mount the array, and verify that it was mounted correctly: - - # mount /dev/md0 /mnt - # mount - -![](https://farm6.staticflickr.com/5554/15034696167_c4fc907c8e_z.jpg) - -### Monitor a RAID Array ### - -The mdadm tool comes with RAID monitoring capability built in. When mdadm is set to run as a daemon (which is the case with our RAID setup), it periodically polls existing RAID arrays, and reports on any detected events via email notification or syslog logging. Optionally, it can also be configured to invoke contingency commands (e.g., retrying or removing a disk) upon detecting any critical errors. - -By default, mdadm scans all existing partitions and MD arrays, and logs any detected event to /var/log/syslog. Alternatively, you can specify devices and RAID arrays to scan in mdadm.conf located in /etc/mdadm/mdadm.conf (Debian-based) or /etc/mdadm.conf (Red Hat-based), in the following format. If mdadm.conf does not exist, create one. - - DEVICE /dev/sd[bcde]1 /dev/sd[ab]1 - - ARRAY /dev/md0 devices=/dev/sdb1,/dev/sdc1 - ARRAY /dev/md1 devices=/dev/sdd1,/dev/sde1 - ..... - - # optional email address to notify events - MAILADDR your@email.com - -After modifying mdadm configuration, restart mdadm daemon: - -On Debian, Ubuntu or Linux Mint: - - # service mdadm restart - -On Fedora, CentOS/RHEL 7: - - # systemctl restart mdmonitor - -On CentOS/RHEL 6: - - # service mdmonitor restart - -### Auto-mount a RAID Array ### - -Now we will add an entry in the /etc/fstab to mount the array in /mnt automatically during boot (you can specify any other mount point): - - # echo "/dev/md0 /mnt ext4 defaults 0 2" << /etc/fstab - -To verify that mount works okay, we now unmount the array, restart mdadm, and remount. We can see that /dev/md0 has been mounted as per the entry we just added to /etc/fstab: - - # umount /mnt - # service mdadm restart (on Debian, Ubuntu or Linux Mint) - or systemctl restart mdmonitor (on Fedora, CentOS/RHEL7) - or service mdmonitor restart (on CentOS/RHEL6) - # mount -a - -![](https://farm6.staticflickr.com/5563/15218183681_63a10da704_z.jpg) - -Now we are ready to access the RAID array via /mnt mount point. To test the array, we'll copy the /etc/passwd file (any other file will do) into /mnt: - -![](https://farm6.staticflickr.com/5593/15034475219_a3476aec0a_o.png) - -On Debian, we need to tell the mdadm daemon to automatically start the RAID array during boot by setting the AUTOSTART variable to true in the /etc/default/mdadm file: - - AUTOSTART=true - -### Simulating Drive Failures ### - -We will simulate a faulty drive and remove it with the following commands. Note that in a real life scenario, it is not necessary to mark a device as faulty first, as it will already be in that state in case of a failure. - -First, unmount the array: - - # umount /mnt - -Now, notice how the output of 'mdadm -D /dev/md0' indicates the changes after performing each command below. - - # mdadm /dev/md0 --fail /dev/sdb1 #Marks /dev/sdb1 as faulty - # mdadm --remove /dev/md0 /dev/sdb1 #Removes /dev/sdb1 from the array - -Afterwards, when you have a new drive for replacement, re-add the drive again: - - # mdadm /dev/md0 --add /dev/sdb1 - -The data is then immediately started to be rebuilt onto /dev/sdb1: - -![](https://farm4.staticflickr.com/3855/15221267875_dfc6af8804_z.jpg) - -Note that the steps detailed above apply for systems with hot-swappable disks. If you do not have such technology, you will also have to stop a current array, and shutdown your system first in order to replace the part: - - # mdadm --stop /dev/md0 - # shutdown -h now - -Then add the new drive and re-assemble the array: - - # mdadm /dev/md0 --add /dev/sdb1 - # mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 - -Hope this helps. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/2014/09/create-software-raid1-array-mdadm-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 diff --git a/sources/tech/20141030 Test drive Linux with nothing but a flash drive.md b/sources/tech/20141030 Test drive Linux with nothing but a flash drive.md deleted file mode 100644 index 84d5b7a9d4..0000000000 --- a/sources/tech/20141030 Test drive Linux with nothing but a flash drive.md +++ /dev/null @@ -1,75 +0,0 @@ -Test drive Linux with nothing but a flash drive -================================================================================ -![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) -Image by : Opensource.com - -Maybe you’ve heard about Linux and are intrigued by it. So intrigued that you want to give it a try. But you might not know where to begin. - -You’ve probably done a bit of research online and have run across terms like dual booting and virtualization. Those terms might mean nothing to you, and you’re definitely not ready to sacrifice the operating system that you’re currently using to give Linux a try. So what can you do? - -If you have a USB flash drive lying around, you can test drive Linux by creating a live USB. It’s a USB flash drive that contains an operating system that can start from the flash drive. It doesn’t take much technical ability to create one. Let’s take a look at how to do that and how to run Linux using a live USB. - -### What you’ll need ### - -Aside from a desktop or laptop computer, you’ll need: - -- A blank USB flash drive—preferably one that has a capacity of 4 GB or more. -- An [ISO image][1] (an archive of the contents of a hard disk) of the Linux distribution that you want to try. More about this in a moment. -- An application called [Unetbootin][2], an open source tool, cross platform tool that creates a live USB. You don’t need to be running Linux to use it. In the instructions that below, I’m running Unetbootin on a MacBook. - -### Getting to work ### - -Plug your flash drive into a USB port on your computer and then fire up Unetbootin. You’ll be asked for the password that you use to log into your computer. - -![Unetbootin main window](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-main.png) - -Remember the ISO image that was mentioned a few moments ago? There are two ways you can get one: either by downloading it from the website of the Linux distribution that you want to try, or by having Unetbootin download it for you. To do that latter, click **Select Distribution** at the top of the window, choose the distribution that you want to download, and then click **Select Version** to select the version of the distribution that you want to try. - -![Downloading a Linux distribution](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-download-distro.png) - -Or, you can download the distribution yourself. Usually, the Linux distributions that I want to try aren’t in the list. If you go the second route, click **Disk image** and then click the button to search for the .iso file that you downloaded. - -Notice the **Space used to preserve files across reboots (Ubuntu only)** option? If you’re testing Ubuntu or one of its derivatives (like Lubuntu or Xubuntu), you can set aside a few megabytes of space on your flash drive to save files like web browser bookmarks or documents that you create. When you load Ubuntu from the flash drive again, you can reuse those files. - -![Ready to create a live USB](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-ready-to-go.png) - -Once the ISO image is loaded, click **OK**. It takes anywhere from a couple of minutes to 10 minutes for Unetbootin to create the live USB. - -![Creating the live USB](http://opensource.com/sites/default/files/images/life-uploads/unetbootin-creating-disk.png) - -### Testing out the live USB ### - -This is the point where you have to embrace your inner geek a bit. Not too much, but you will be taking a peek into the innards of your computer by going into the [BIOS][3]. Your computer’s BIOS starts various bits of hardware and controls where the computer’s operating system starts, or boots, from. - -The BIOS usually looks for the operating system in this order (or something like it): hard drive, then CD-ROM or DVD drive, and then an external drive. You’ll want to change that order so that the external drive (in this case, your live USB) is the one that the BIOS checks first. - -To do that, restart your computer with the flash drive plugged into a USB port. When you see the message **Press F2 to enter setup**, do just that. On some computers, the key might be F10. - -In the BIOS, use the right arrow key on your keyboard to navigate to the **Boot** menu. You’ll see a list of drives on your computer. Use the down arrow key on your keyboard to navigate to the item labeled **USB HDD** and then press **F6** to move that item to the top of the list. - -Once you’ve done that, press **F10** to save the changes. You’ll be kicked out of the BIOS and your computer will start up. After a short amount of time, you’ll be presented with a menu listing the options for starting the Linux distribution you’re trying out. Select **Run without installing** (or the menu item closest to it). - -Once the desktop loads, you can connect to a wireless or wired network, browse the web, and give the pre-installed software a whirl. You can also check to see if, for example, your printer or scanner works with the Linux distribution you’re testing. If you really, really want to you can also fiddle at the command line. - -### What to expect ### - -Depending on the Linux distribution you’re testing and the speed of the flash drive you’re using, the operating system might take longer to load and it might run a bit slower than it would if it was installed on your hard drive. - -As well, you’ll only have the basic software that the Linux distribution packs out of the box. You generally get a web browser, a word processor, a text editor, a media player, an image viewer, and a set of utilities. That should be enough to give you a feel for what it’s like to use Linux. - -If you decide that you like using Linux, you can install it from the flash drive by double clicking on the installer. - --------------------------------------------------------------------------------- - -via: https://opensource.com/life/14/10/test-drive-linux-nothing-flash-drive - -作者:[Scott Nesbitt][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/scottnesbitt -[1]:http://en.wikipedia.org/wiki/ISO_image -[2]:http://unetbootin.sourceforge.net/ -[3]:http://en.wikipedia.org/wiki/BIOS \ No newline at end of file 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/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md b/sources/tech/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md deleted file mode 100644 index d81a33de40..0000000000 --- a/sources/tech/20141127 dupeGuru--Find And Remove Duplicate Files Instantly From Hard Drive.md +++ /dev/null @@ -1,98 +0,0 @@ -dupeGuru – Find And Remove Duplicate Files Instantly From Hard Drive -================================================================================ -### Introduction ### - -Disk full is one of the big trouble for us. No matter how we’re careful, sometimes we might copy the same file to multiple locations, or download the same file twice unknowingly. Therefore, sooner or later we will end up with disk full error message, which is worst when we really need some space to store important data. If you believe your system has multiple duplicate files, then **dupeGuru** might help you. - -dupeGuru team have also developed applications called **dupeGuru Music Edition** to remove duplicate music files, and **dupeGuru Picture Edition** to remove duplicate pictures. - -### 1. dupeGuru (Standard Edition) ### - -For those who don’t know about [dupeGuru][1], It is a free, open source, cross-platform application that can used to find and remove the duplicate files in your system. It will run under Linux, Windows, and Mac OS X platforms. It uses a quick fuzzy matching algorithm to find the duplicate files in minutes. Also, you can tweak dupeGuru to find exactly what kind of duplicate files you want to, and eliminate what kind of files from deletion. It supports English, French, German, Chinese (Simplified), Czech, Italian, Armenian, Russian, Ukrainian, Brazilian, and Vietnamese. - -#### Install dupeGuru On Ubuntu 14.10/14.04/13.10/13.04/12.04 #### - -dupeGuru developers have created a Ubuntu PPA to ease the installation. To install dupeGuru, enter the following commands one by one in your Terminal. - - sudo apt-add-repository ppa:hsoft/ppa - sudo apt-get update - sudo apt-get install dupeguru-se - -#### Usage #### - -Usage is very simple. Launch dupeGuru either from Unity Dash or Menu. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru_007.png) - -Click + button on the bottom, and add the folder you want to scan. Click Scan button to start finding the duplicate files. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru_008.png) - -If the selected folder contains any duplicate files, it will display them. As you in the below screen shot, I have a duplicate file in the Downloads directory. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru-Results_009.png) - -Now, you can decide what to do. You can either delete the duplicate file, or rename it, or copy/move it to another location. To do that select the duplicate files, or check the box that says “**Dupes only**” on the Menu bar. If you selected the Dupes only option, the duplicates files will only visible. So you can select and delete them easily. Click on the **Actions** drop-down box. Finally, select the action you want to perform. Here, I just want to delete the duplicate file, so I selected the option: **Send marked to Recycle bin**. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/Menu_010.png) - -Then, click **Proceed** to delete the duplicate files. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/Deletion-Options_011.png) - -### 2. dupeGuru Music Edition ### - -[dupeGuru Music Edition][2] or dupeGuru ME in short, is just like dupeGuru. It does everything dupeGuru does, but it has more information columns (such as bitrate, duration, tags, etc..) and more scan types (filename with fields, tags and audio content). Like dupeGuru, dupeGuru ME also runs on Linux, Windows, and Mac OS X. - -It supports variety of formats such as MP3, WMA, AAC (iTunes format), OGG, FLAC, loss-less AAC and loss-less WMA etc, - -#### Install dupeGuru ME On Ubuntu 14.10/14.04/13.10/13.04/12.04 #### - -Now, we don’t have to add any PPA, because already the added in the previous steps. So, enter the following command to install from your Terminal. - - sudo apt-get install dupeguru-me - -#### Usage #### - -Launch it either from Unity dash or Menu. The usage, interface, and look of dupeGuru ME is similar to normal dupeGuru. Add the folder you to scan and select the action you want to perform. The duplicate music files will be deleted. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru-Music-Edition-Results_012.png) - -### 3. dupeGuru Picture Edition ### - -[dupeGuru Picture Edition][3], or duepGuru PE in short, is a tool to find duplicate pictures on your computer. It is as like as dupeGuru, but is specialized for duplicate pictures matching. dupeGuru PE runs on Linux, Windows, and Mac OS X. - -dupeGuru PE supports JPG, PNG, TIFF, GIF and BMP formats. All these formats can be compared together. The Mac OS X version of dupeGuru PE also supports PSD and RAW (CR2 and NEF) formats. - -#### Install dupeGuru PE On Ubuntu 14.10/14.04/13.10/13.04/12.04 #### - -As we have already added the PPA, We don’t need to add PPA for dupeGuru either. Just, run the following command to install it. - - sudo apt-get install dupeguru-pe - -#### Usage #### - -It’s also look like dupeGuru, and dupeGuru ME in terms of usage, interface, and look.I wonder why the developer have created there separate versions for each category. It would be better, a single application has all of the above three features combined. - -Launch it, add the folder you want to scan, and select the action you want to perform. That’s it. you duplicated files will be gone. - -![](http://180016988.r.cdn77.net/wp-content/uploads/2014/11/dupeGuru-Picture-Edition-Results_014.png) - -If you can’t remove them in case of any security problems, note down the location of the files, and manually delete them either from Terminal or File manager. - -Cheers! - --------------------------------------------------------------------------------- - -via: http://www.unixmen.com/dupeguru-find-remove-duplicate-files-instantly-hard-drive/ - -作者:[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.hardcoded.net/dupeguru/ -[2]:http://www.hardcoded.net/dupeguru_me/ -[3]:http://www.hardcoded.net/dupeguru_pe/ \ No newline at end of file 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/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 Auditd--Tool for Security Auditing on Linux Server.md b/sources/tech/20150104 Auditd--Tool for Security Auditing on Linux Server.md deleted file mode 100644 index 9375385927..0000000000 --- a/sources/tech/20150104 Auditd--Tool for Security Auditing on Linux Server.md +++ /dev/null @@ -1,203 +0,0 @@ -Auditd - Tool for Security Auditing on Linux Server -================================================================================ -First of all , we wish all our readers **Happy & Prosperous New YEAR 2015** from our Linoxide team. So lets start this new year explaining about Auditd tool. - -Security is one of the main factor that we need to consider. We must maintain it because we don't want someone steal our data. Security includes many things. Audit, is one of it. - -On Linux system, we know that we have a tool named **auditd**. This tool is by default exist in most of Linux operating system. What is auditd tool and how to use it? We will cover it below. - -### What is auditd? ### - -Auditd or audit daemon, is a userspace component to the Linux Auditing System. It’s responsible for writing audit records to the disk. - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/what_is_auditd.png) - -### Installing auditd ### - -On Ubuntu based system , we can use [wajig][1] tool or **apt-get tool** to install auditd. - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/install_auditd.png) - -Just follow the instruction to get it done. Once it finish it will install some tools related to auditd tool. Here are the tools : - -- **auditctl ;** is a tool to control the behaviour of the daemon on the fly, adding rules, etc -- **/etc/audit/audit.rules ;** is the file that contains audit rules -- **aureport ;** is tool to generate and view the audit report -- **ausearch ;** is a tool to search various events -- **auditspd ;** is a tool which can be used to relay event notifications to other applications instead of writing them to disk in the audit log -- **autrace ;** is a command that can be used to trace a process -- **/etc/audit/auditd.conf ;** is the configuration file of auditd tool -- When the first time we install **auditd**, there will be no rules available yet. - -We can check it using this command : - - $ sudo auditctl -l - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_no_rules.png) - -To add rules on auditd, let’s continue to the section below. - -### How to use it ### - -#### Audit files and directories access #### - -One of the basic need for us to use an audit tool are, how can we know if someone change a file(s) or directories? Using auditd tool, we can do with those commands (please remember, we will need root privileges to configure auditd tool): - -**Audit files** - - $ sudo auditctl -w /etc/passwd -p rwxa - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_w_etc_passwd.png) - -**With :** - -- **-w path ;** this parameter will insert a watch for the file system object at path. On the example above, auditd will wacth /etc/passwd file -- **-p ; **this parameter describes the permission access type that a file system watch will trigger on -- **rwxa ;** are the attributes which bind to -p parameter above. r is read, w is write, x is execute and a is attribute - -#### Audit directories #### - -To audit directories, we will use a similar command. Let’s take a look at the command below : - - $ sudo auditctl -w /production/ - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_w_production.png) - -The above command will watch any access to the **/production folder**. - -Now, if we run **auditctl -l** command again, we will see that new rules are added. - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/auditctl_rules.png) - -Now let’s see the audit log says. - -### Viewing the audit log ### - -After rules are added, now we can see how auditd in action. To view audit log, we can use **ausearch** tool. - -We already add rule to watch /etc/passwd file. Now we will try to use **ausearch** tool to view the audit log. - - $ sudo ausearch -f /etc/passwd - -- **-f** parameter told ausearch to investigate /etc/passwd file -- The result is shown below : -> **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) - - Now let’s we understand the result. - -- **time ;** is when the audit is done -- **name ;** is the object name to be audited -- **cwd ;** is the current directory -- **syscall ;** is related syscall -- **auid ;** is the audit user ID -- **uid and gid ;** are User ID and Group ID of the user who access the file -- **comm ;** is the command that the user is used to access the file -- **exe ;** is the location of the command of comm parameter above -- The above audit log is the original file. - - Next, we are going to add a new user, to see how the auditd record the activity to /etc/passwd file. - -> **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) - -As we can see above, that on that particular time, **/etc/passwd was accessed** by user root (uid = 0 and gid = 0) **from** directory /root (cwd = /root). The /etc/passwd file was accessed using **chfn** command which located in **/usr/bin/chfn** - -If we type **man chfn** on the console, we will see more detail about what is chfn. - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/chfn.png) - -Now we take a look at another example. - -We already told auditd to watch directory /production/ . That is a new directory. So when we try to use ausearch tool at the first time, it found nothing. - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/ausearch_production_empty.png) - -Next, root account try to list the /production directory using ls command. The second time we use ausearch tool, it will show us some information. - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/ausearch_production_ls.png) - -> **time->**Mon Dec 22 14:18:28 2014 -> type=PATH msg=audit(1419232708.344:527): item=0 **name="/production/"** inode=797104 dev=08:01 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL -> type=CWD msg=audit(1419232708.344:527): cwd="/root" -> type=SYSCALL msg=audit(1419232708.344:527): arch=40000003 syscall=295 success=yes exit=3 a0=ffffff9c a1=95761e8 a2=98800 a3=0 items=1 ppid=3033 pid=3444 **auid=4294967295 uid=0 gid=0** euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=4294967295 **comm="ls" exe="/bin/ls"** key=(null) - -Similar with the previous one, we can determine that **/production folder was looked** by root account (uid=0 gid=0) **using ls command** (comm = ls) and the ls command is **located in /bin/ls folder**. - -### Viewing the audit reports ### - -Once we put the audit rules, it will run automatically. And after a period of time, we want to see how auditd can help us to track them. - -Auditd comes with another tool called **aureport**. As we can guess from its name, **aureport** is a tool that produces summary reports of the audit system log. - -We already told auditd to track /etc/passwd before. And a moment after the auditd parameter is developed, the audit.log file is created. - -To generate the report of audit, we can use aureport tool. Without any parameters, aureport will generate a summary report of audit activity. - - $ sudo aureport - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/aureport_2.png) - -As we can see, there are some information available which cover most important area. - -On the picture above we see there are **3 times failed authentication**. Using aureport, we can drill down to that information. - -We can use this command to look deeper on failed authentication : - - $ sudo aureport -au - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/aureport_authentication.png) - -As we can see on the picture above, there are two users which at the particular time are failed to authenticated - -If we want to see all events related to account modification, we can use -m parameter. - - $ sudo aureport -m - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/aureport_m.png) - -### Auditd configuration file ### - -Previously we already added : - -- $ sudo auditctl -w /etc/passwd -p rwxa -- $ sudo auditctl -w /production/ -- Now, if we sure the rules are OK, we can add it into - -**/etc/audit/audit.rules** to make them permanently.Here’s how to put them into the /etc/audit/audit.rules fileSample of audit rule file - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/audit_rules_file.png) - -**Then don’t forget to restart auditd daemon.** - - # /etc/init.d/auditd restart - -OR - - # service auditd restart - -![](http://blog.linoxide.com/wp-content/uploads/2014/12/audit_restart.png) - -### Conclusion ### - -Auditd is one of the audit tool that available on Linux system. You can explore more detail about auditd and its related tools by reading its manual page. For example, just type **man auditd** to see more detail about auditd. Or type **man ausearch** to see more detail about ausearch tool. - -**Please be careful before creating rules**. It will increase your log file size significantly if too much information to record. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/how-tos/auditd-tool-security-auditing/ - -作者:[Pungki Arianto][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/pungki/ -[1]:http://linoxide.com/tools/wajig-package-management-debian/ \ No newline at end of file diff --git a/sources/tech/20150104 How to debug a C or C++ program with Nemiver debugger.md b/sources/tech/20150104 How to debug a C or C++ program with Nemiver debugger.md deleted file mode 100644 index fb3f313038..0000000000 --- a/sources/tech/20150104 How to debug a C or C++ program with Nemiver debugger.md +++ /dev/null @@ -1,111 +0,0 @@ -hi ! 让我来翻译 - -How to debug a C/C++ program with Nemiver debugger -================================================================================ -If you read [my post on GDB][1], you know how important and useful a debugger I think can be for a C/C++ program. However, if a command line debugger like GDB sounds more like a problem than a solution to you, you might be more interested in Nemiver. [Nemiver][2] is a GTK+-based standalone graphical debugger for C/C++ programs, using GDB as its back-end. Admirable for its speed and stability, Nemiver is a very reliable debugger filled with goodies. - -### Installation of Nemiver ### - -For Debian based distributions, it should be pretty straightforward: - - $ sudo apt-get install nemiver - -For Arch Linux: - - $ sudo pacman -S nemiver - -For Fedora: - - $ sudo yum install nemiver - -If you prefer compiling yourself, the latest sources are available from [GNOME website][3]. - -As a bonus, it integrates very well with the GNOME environment. - -### Basic Usage of Nemiver ### - -Start Nemiver with the command: - - $ nemiver - -You can also summon it with an executable with: - - $ nemiver [path to executable to debug] - -Note that Nemiver will be much more helpful if the executable is compiled in debug mode (the -g flag with GCC). - -A good thing is that Nemiver is really fast to load, so you should instantly see the main screen in the default layout. - -![](https://farm9.staticflickr.com/8679/15535277554_d320f6692c_c.jpg) - -By default, a breakpoint has been placed in the first line of the main function. This gives you the time to recognize the basic debugger functions: - -![](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) - -But maybe my personal favorite is the option "Run to cursor" which makes the program run until a precise line under your cursor, and is by default mapped to F11. - -Next, the breakpoints are also easy to use. The quick way to lay a breakpoint at a line is using F8. But Nemiver also has a more complex menu under "Debug" which allows you to set up a breakpoint at a particular function, line number, location of binary file, or even at an event like an exception, a fork, or an exec. - -![](https://farm8.staticflickr.com/7579/16157622315_d680a63896_z.jpg) - -You can also watch a variable by tracking it. In "Debug" you can inspect an expression by giving its name and examining it. It is then possible to add it to the list of controlled variable for easy access. This is probably one of the most useful aspects as I have never been a huge fan of hovering over a variable to get its value. Note that hovering does work though. And to make it even better, Nemiver is capable of watching a struct, and giving you the values of all the member variables. - -![](https://farm8.staticflickr.com/7465/15970310470_7ed020c613.jpg) - -Talking about easy access to information, I also really appreciate the layout of the program. By default, the code is in the upper half and the tabs in the lower part. This grants you access to a terminal for output, a context tracker, a breakpoints list, register addresses, memory map, and variable control. But note that under "Edit" "Preferences" "Layout" you can select different layouts, including a dynamic one for you to modify. - -![](https://farm9.staticflickr.com/8606/15971551549_00e4cdd32e_c.jpg) - -![](https://farm8.staticflickr.com/7525/15535277594_026fef17c1_z.jpg) - -And naturally, once you set up all your breakpoints, watch-points, and layout, you can save your session under “File” for easy retrieval in case you close Nemiver. - -### Advanced Usage of Nemiver ### - -So far, we talked about the basic features of Nemiver, i.e., what you need to get started and debug simple programs immediately. If you have more advanced needs, and especially more complex programs, you might be more interested in some of these features mentioned here. - -#### Debugging a running process #### - -Nemiver allows you to attach to a running process for debugging. Under the "File" menu, you can filter the list of running processes, and connect to a process. - -![](https://farm9.staticflickr.com/8593/16155720571_00e4cdd32e_z.jpg) - -#### Debugging a program remotely over a TCP connection #### - -Nemiver supports remote-debugging, where you set up a lightweight debug server on a remote machine, and launch Nemiver from another machine to debug a remote target hosted by the debug server. Remote debugging can be useful if you cannot run full-fledged Nemiver or GDB on the remote machine for some reason. Under the "File" menu, specify the binary, shared library location, and the address and port. - -![](https://farm8.staticflickr.com/7469/16131832746_c47dee4ef1.jpg) - -#### Using your own GDB binary to debug #### - -In case you compiled Nemiver yourself, you can specify a new location for GDB under "Edit" "Preferences" "Debug". This option can be useful if you want to use a custom version of GDB in Nemiver for some reason. - -#### Follow a child or parent process #### - -Nemiver is capable of following a child or parent process in case your program forks. To enable this feature, go to "Preferences" under "Debugger" tab. - -![](https://farm8.staticflickr.com/7512/16131832716_5724ff434c_z.jpg) - -To conclude, Nemiver is probably my favorite program for debugging without an IDE. It even beats GDB in my opinion, and [command line][4] programs generally have a good grip on me. So if you have never used it, I really recommend it. I can only congratulate the team behind it for giving us such a reliable and stable program. - -What do you think of Nemiver? Would you consider it for standalone debugging? Or do you still stick to an IDE? Let us know in the comments. - --------------------------------------------------------------------------------- - -via: http://xmodulo.com/debug-program-nemiver-debugger.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/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/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/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 index f17e45cbf4..eeda3f0542 100644 --- 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 @@ -1,3 +1,4 @@ +translating by coloka 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. diff --git a/sources/tech/20150114 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md b/sources/tech/20150114 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md deleted file mode 100644 index 901dcd951c..0000000000 --- a/sources/tech/20150114 How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps.md +++ /dev/null @@ -1,180 +0,0 @@ -How To Recover Windows 7 And Delete Ubuntu In 3 Easy Steps -================================================================================ -### Introduction ### - -This is a strange article for me to write as I am normally in a position where I would advocate installing Ubuntu and getting rid of Windows. - -What makes writing this article today doubly strange is that I am choosing to write it on the day that Windows 7 mainstream support comes to an end. - -So why am I writing this now? - -I have been asked on so many occasions now how to remove Ubuntu from a dual booting Windows 7 or a dual booting Windows 8 system and it just makes sense to write the article. - -I spent the Christmas period looking through the comments that people have left on articles and it is time to write the posts that are missing and update some of those that have become old and need attention. - -I am going to spend the rest of January doing just that. This is the first step. If you have Windows 7 dual booting with Ubuntu and you want Windows 7 back without restoring to factory settings follow this guide. (Note there is a separate guide required for Windows 8) - -### The Steps Required To Remove Ubuntu ### - -1. Remove Grub By Fixing The Windows Boot Record -1. Delete The Ubuntu Partitions -1. Expand The Windows Partition - -### Back Up Your System ### - -Before you begin I recommend taking a backup of your system. - -I also recommend not leaving this to chance nor Microsoft's own tools. - -[Click here for a guide showing how to backup your drive using Macrium Reflect.][1] - -If you have any data you wish to save within Ubuntu log into it now and back up the data to external hard drives, USB drives or DVDs. - -### Step 1 - Remove The Grub Boot Menu ### - -![](http://1.bp.blogspot.com/-arVqwMLpJRQ/VLWbHWkqYsI/AAAAAAAAHmw/kn3jDPOltX4/s1600/grubmenu.jpg) - -When you boot your system you will see a menu similar to the one in the image. - -To remove this menu and boot straight into Windows you have to fix the master boot record. - -To do this I am going to show you how to create a system recovery disk, how to boot to the recovery disk and how to fix the master boot record. - -![](http://2.bp.blogspot.com/-ML2JnNc8OWY/VLWcAovwGNI/AAAAAAAAHm4/KH778_MkU7U/s1600/recoverywindow1.PNG) - -Press the "Start" button and search for "backup and restore". Click the icon that appears. - -A window should open as shown in the image above. - -Click on "Create a system repair disc". - -You will need a [blank DVD][2]. - -![](http://2.bp.blogspot.com/-r0GUDZ4AAMI/VLWfJ0nuJLI/AAAAAAAAHnE/RloNqdXLLcY/s1600/recoverywindow2.PNG) - -Insert the blank DVD in the drive and select your DVD drive from the dropdown list. - -Click "Create Disc". - -Restart your computer leaving the disk in and when the message appears to boot from CD press "Enter" on the keyboard. - -![](http://2.bp.blogspot.com/-VPSD50bmk2E/VLWftBg7HxI/AAAAAAAAHnM/APVzvPg4rC0/s1600/recoveryoptionschooselanguage.jpg) - -A set of "Systems Recovery Options" screens will appear. - -You will be asked to choose your keyboard layout. - -Choose the appropriate options from the lists provided and click "Next". - -![](http://2.bp.blogspot.com/-klK4SihPv0E/VLWgLiPO1mI/AAAAAAAAHnU/DUgxH6N2SFE/s1600/RecoveryOptions.jpg) - -The next screen lets you choose an operating system to attempt to fix. - -Alternatively you can restore your computer using a system image saved earlier. - -Leave the top option checked and click "Next". - -![](http://2.bp.blogspot.com/-WOk-Unm6cCQ/VLWgvzoBgzI/AAAAAAAAHng/vfxm1jhW1Ms/s1600/RecoveryOptions2.jpg) - -You will now see a screen with options to repair your disk and restore your system etc. - -All you need to do is fix the master boot record and this can be done from the command prompt. - -Click "Command Prompt". - -![](http://4.bp.blogspot.com/-duT-EUC0yuo/VLWhHygCApI/AAAAAAAAHno/bO7UlouyR9M/s1600/FixMBR.jpg) - -Now simply type the following command into the command prompt: - - bootrec.exe /fixmbr - -A message will appear stating that the operation has completed successfully. - -You can now close the command prompt window. - -Click the "Restart" button and remove the DVD. - -Your computer should boot straight into Windows 7. - -### Step 2 - Delete The Ubuntu Partitions ### - -![](http://4.bp.blogspot.com/-1OM0b3qBeHk/VLWh89gtgVI/AAAAAAAAHn0/ECHIARNCRp8/s1600/diskmanagement1.PNG) - -To delete Ubuntu you need to use the "Disk Management" tool from within Windows. - -Press "Start" and type "Create and format hard disk partitions" into the search box. A window will appear similar to the image above. - -Now my screen above isn't going to be quite the same as yours but it won't be much different. If you look at disk 0 there is 101 MB of unallocated space and then 4 partitions. - -The 101 MB of space is a mistake I made when installing Windows 7 in the first place. The C: drive is Windows 7, the next partition (46.57 GB) is Ubuntu's root partition. The 287 GB partition is the /HOME partition and the 8 GB partition is the SWAP space. - -The only one we really need for Windows is the C: drive so the rest can be deleted. - -**Note: Be careful. You may have recovery partitions on the disk. Do not delete the recovery partitions. They should be labelled and will have file systems set to NTFS or FAT32** - -![](http://3.bp.blogspot.com/-8YUE2p5Fj8Q/VLWlHXst6JI/AAAAAAAAHoQ/BJC57d9Nilg/s1600/deletevolume.png) - -Right click on one of the partitions you wish to delete (i.e. the root, home and swap partitions) and from the menu click "Delete Volume". - -**(Do not delete any partitions that have a file system of NTFS or FAT32)** - -Repeat this process for the other two partitions. - -![](http://3.bp.blogspot.com/-IGbJLkc_soY/VLWk1Vh0XAI/AAAAAAAAHoA/v7TVFT0rC0E/s1600/diskmanagement2.PNG) - -After the partitions have been deleted you will have a large area of free space. Right click the free space and choose delete. - -![](http://4.bp.blogspot.com/-2xUBkWHpnC4/VLWk9cYXGZI/AAAAAAAAHoI/8F2ANkorGeM/s1600/diskmanagement3.PNG) - -Your disk will now contain your C drive and a large amount of unallocated space. - -### Step 3 - Expand The Windows Partition ### - -![](http://4.bp.blogspot.com/-pLV5L3CvQ1Y/VLWmh-5SKTI/AAAAAAAAHoc/7sJzITyvduo/s1600/diskmanagement4.png) - -The final step is to expand Windows so that it is one large partition again. - -To do this right click on the Windows partition (C: drive) and choose "Extend Volume". - -![](http://1.bp.blogspot.com/-vgmw_N2WZWw/VLWm7i5oSxI/AAAAAAAAHok/k0q_gnIik9A/s1600/extendvolume1.PNG) - -When the Window to the left appears click "Next", - -![](http://3.bp.blogspot.com/-WLA86V-Au8g/VLWnTq5RpAI/AAAAAAAAHos/6vzjLNkrwRQ/s1600/extendvolume2.PNG) - -The next screen shows a wizard whereby you can select the disks to expand to and change the size to expand to. - -By default the wizard shows the maximum amount of disk space it can claim from unallocated space. - -Accept the defaults and click "Next". - -![](http://4.bp.blogspot.com/-1rhTJvwem0k/VLWnvx7fWFI/AAAAAAAAHo0/D-4HA8E8y2c/s1600/extendvolume3.PNG) - -The final screen shows the settings that you chose from the previous screen. - -Click "Finish" to expand the disk. - -![](http://2.bp.blogspot.com/-CpuLXSYyPKY/VLWoEGU3sCI/AAAAAAAAHo8/7o5G4W4b7zU/s1600/diskmanagement5.PNG) - -As you can see from the image above my Windows partition now takes up the entire disk (except for the 101 MB that I accidentally created before installing Windows in the first place). - -### Summary ### - -![](http://1.bp.blogspot.com/-h1Flo2aGFcI/VLWogr2zfMI/AAAAAAAAHpE/2ypTSgR8_iM/s1600/fullwindowsscreen.PNG) - -That is all folks. A site dedicated to Linux has just shown you how to remove Linux and replace it with Windows 7. - -Any questions? Use the comments section below. - --------------------------------------------------------------------------------- - -via: http://www.everydaylinuxuser.com/2015/01/how-to-recover-windows-7-and-delete.html - -作者:Gary Newell -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://linux.about.com/od/LinuxNewbieDesktopGuide/ss/Create-A-Recovery-Drive-For-All-Versions-Of-Windows.htm -[2]:http://www.amazon.co.uk/gp/product/B0006L2HTK/ref=as_li_qf_sp_asin_il_tl?ie=UTF8&camp=1634&creative=6738&creativeASIN=B0006L2HTK&linkCode=as2&tag=evelinuse-21&linkId=3R363EA63XB4Z3IL \ 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 63acd23a67..0000000000 --- a/sources/tech/20150114 How to Configure Chroot Environment in Ubuntu 14.04.md +++ /dev/null @@ -1,146 +0,0 @@ -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 \ No newline at end of file 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 348a159fc8..0000000000 --- a/sources/tech/20150115 Get back your privacy and control.md +++ /dev/null @@ -1,1113 +0,0 @@ -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 \ No newline at end of file diff --git a/sources/tech/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md b/sources/tech/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md deleted file mode 100644 index c456aa6601..0000000000 --- a/sources/tech/20150115 Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04.md +++ /dev/null @@ -1,58 +0,0 @@ - Vic020 - -Tips for Apache Migration From 2.2 to 2.4 on Ubuntu 14.04 -================================================================================ -If you do a distribution upgrade from **Ubuntu** 12.04 to 14.04, the upgrade will bring among other things an important update to **Apache**, from [version 2.2][1] to version 2.4. The update brings many improvements but it may cause some errors when used with the old configuration file from 2.2. - -### Access control in Apache 2.4 Virtual Hosts ### - -Starting with **Apache 2.4** authorization is applied in a way that is much more flexible then just a single check against a single data store like it was in 2.2. In the past it was tricky to figure how and in what order authorization is applied but with the introduction of authorization container directives such as and , the configuration also has control over when the authorization methods are called and what criteria determines when access is granted. - -This is the point where most upgrades fail because of wrong configuration because in 2.2 access control based on IP address, hostname or other characteristic was done using the directives Order, Allow, Deny or Satisfy, but in 2.4 this is done with authorization checks using the new modules. - -To be clear let's see some virtual host examples, this can be found in your /etc/apache2/sites-enabled/default or /etc/apache2/sites-enabled/YOUR_WEBSITE_NAME: - -Old 2.2 virtual host configuration: - - Order allow,deny - Allow from all - -New 2.4 virtual host configuration: - - Require all granted - -![apache 2.4 config](http://blog.linoxide.com/wp-content/uploads/2014/12/apache-2.4-config.jpg) - -### .htaccess problems ### - -If after the upgrade some settings don't work or you get redirect errors, check if those settings are in a .htaccess file. If settings in the .htaccess file are not used by Apache it's because in 2.4 AllowOverride directive is set to None by default, thus ignoring the .htaccess files. All you have to do is to either change or add the AllowOverride All directive to your site configuration file. - -You also see the AllowOverride All directive set in the screenshot above. - -### Missing config file or module ### - -From my experience another problem during upgrades is that your configuration file includes an old module or configuration file that is no longer needed or supported in 2.4, you will get a clear warning that Apache can't include the respective file and all you have to do is go to your configuration file and remove the line that causes problem. Afterwards you can search or install a similar module. - -### Other small changes you shound know about ### - -There are a few other changes that you should consider, although they generally result in an warning and not an error: - -- MaxClients has been renamed to MaxRequestWorkers, which describes more accurately what it does. For async MPMs, like event, the maximum number of clients is not equivalent than the number of worker threads. The old name is still supported. -- The DefaultType directive no longer has any effect, other than to emit a warning if it's used with any value other than none. You need to use other configuration settings to replace it in 2.4. -- EnableSendfile now defaults to Off. -- FileETag now defaults to "MTime Size" (without INode). -- KeepAlive only accepts values of On or Off. Previously, any value other than "Off" or "0" was treated as "On". -- Directives AcceptMutex, LockFile, RewriteLock, SSLMutex, SSLStaplingMutex, and WatchdogMutexPath have been replaced with a single Mutex directive. You will need to evaluate any use of these removed directives in your 2.2 configuration to determine if they can just be deleted or will need to be replaced using Mutex. - --------------------------------------------------------------------------------- - -via: http://linoxide.com/linux-how-to/apache-migration-2-2-to-2-4-ubuntu-14-04/ - -作者:[Adrian Dinu][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/adriand/ -[1]:http://httpd.apache.org/docs/2.4/ diff --git a/sources/tech/20150121 Syncthing--A Private And Secure Tool To Sync Files or Folders Between Computers.md b/sources/tech/20150121 Syncthing--A Private And Secure Tool To Sync Files or Folders Between Computers.md new file mode 100644 index 0000000000..8a4aff4dfb --- /dev/null +++ b/sources/tech/20150121 Syncthing--A Private And Secure Tool To Sync Files or Folders Between Computers.md @@ -0,0 +1,207 @@ +Syncthing: A Private, And Secure Tool To Sync Files/Folders Between Computers +================================================================================ +### Introduction ### + +**Syncthing** is a free, Open Source tool that can be used to sync files/folders between your networked computers. Unlike other sync tools, such as **BitTorrent Sync** or **Dropbox**, Syncthing transfers data directly from one system to another system, and It is completely open source, secure and private. All of your precious data will be stored in your system so that you can have full control over your files and folders, and none of them are stored in any third party systems. Also, you deserve to choose where it is stored, if it is shared with some third party and how it’s transmitted over the Internet. + +All communication is encrypted using TLS, so your data is very secure from the prying eyes. Syncthing has a responsive and powerful WebGUI which will help the users to easily add, delete and manage directories to be synced over network. Using Syncthing, you can sync multiple folders to multiple systems at a time. Syncthing is very simple, portable, yet powerful tool in terms of installation and usage. Since all files/folders are directly transferred from one computer to another computer, you don’t have to worry about purchasing extra space from your Cloud provider. All you need is very stable LAN/WAN connection and enough disk space on your systems. It supports all modern operating systems, including GNU/Linux, Windows, Mac OS X, and ofcourse Android. + +### Installation ### + +For the purpose of this tutorial, We will be using two systems, one is running with Ubuntu 14.04 LTS, and another one is running with Ubuntu 14.10 server. To easily recognize these two systems, we will be calling them using names **system1**, and **system2**. + +### System1 Details: ### + +- **OS**: Ubuntu 14.04 LTS server; +- **Hostname**: server1.unixmen.local; +- **IP Address**: 192.168.1.150. +- **System user**: sk (You can use your own) +- **Sync Directory**: /home/Sync/ (Will be created by default by Syncthing) + +### System2 Details: ### + +- **OS**: Ubuntu 14.10 server; +- **Hostname**: server.unixmen.local; +- **IP Address**: 192.168.1.151. +- **System user**: sk (You can use your own) +- **Sync Directory**: /home/Sync/ (Will be created by default by Syncthing) + +### Creating User For Syncthing On System 1 & System2: ### + +Run the following commands on both system to create the user for Syncthing and the directory to be synced between two systems: + + sudo useradd sk + sudo passwd sk + +### Install Syncthing On System1 And System2: ### + +You should do the following steps on both System 1 and System 2. + +Download the latest version from the [official download page][1]. As I am using 64bit system, I downloaded the 6bbit package. + + wget https://github.com/syncthing/syncthing/releases/download/v0.10.20/syncthing-linux-amd64-v0.10.20.tar.gz + +Extract the download file: + + tar xzvf syncthing-linux-amd64-v0.10.20.tar.gz + +Cd to the extracted folder: + + cd syncthing-linux-amd64-v0.10.20/ + +Copy the excutable file “syncthing” to **$PATH**: + + sudo cp syncthing /usr/local/bin/ + +Now, run the following command to run the syncthing for the first time. + + syncthing + +When you run the above command, syncthing will generate a configuration and some keys and then start the admin GUI in your browser. You should see something like below. + +Sample output: + + [monitor] 15:40:27 INFO: Starting syncthing + 15:40:27 INFO: Generating RSA key and certificate for syncthing... + [BQXVO] 15:40:34 INFO: syncthing v0.10.20 (go1.4 linux-386 default) unknown-user@syncthing-builder 2015-01-13 16:27:47 UTC + [BQXVO] 15:40:34 INFO: My ID: BQXVO3D-VEBIDRE-MVMMGJI-ECD2PC3-T5LT3JB-OK4Z45E-MPIDWHI-IRW3NAZ + [BQXVO] 15:40:34 INFO: No config file; starting with empty defaults + [BQXVO] 15:40:34 INFO: Edit /home/sk/.config/syncthing/config.xml to taste or use the GUI + [BQXVO] 15:40:34 INFO: Starting web GUI on http://127.0.0.1:8080/ + [BQXVO] 15:40:34 INFO: Loading HTTPS certificate: open /home/sk/.config/syncthing/https-cert.pem: no such file or directory + [BQXVO] 15:40:34 INFO: Creating new HTTPS certificate + [BQXVO] 15:40:34 INFO: Generating RSA key and certificate for server1... + [BQXVO] 15:41:01 INFO: Starting UPnP discovery... + [BQXVO] 15:41:07 INFO: Starting local discovery announcements + [BQXVO] 15:41:07 INFO: Starting global discovery announcements + [BQXVO] 15:41:07 OK: Ready to synchronize default (read-write) + [BQXVO] 15:41:07 INFO: Device BQXVO3D-VEBIDRE-MVMMGJI-ECD2PC3-T5LT3JB-OK4Z45E-MPIDWHI-IRW3NAZ is "server1" at [dynamic] + [BQXVO] 15:41:07 INFO: Completed initial scan (rw) of folder default + +Syncthing has been successfully initialized, and the Web admin interface can be accessed using URL: **http://localhost:8080** from your browser. As you see in the above output, syncthing has automatically created a folder called **default** for you, in a directory called **Sync** in your **home** directory. + +By default, Syncthing WebGUI will only be accessed from the localhost itself. To access the WebGUI from the remote systems, you need to do the following changes on both systems. + +First, stop the Syncthing initialization process by pressing the CTRL+C. Now, you will be returned back to the Terminal. + +Edit file **config.xml**, + + sudo nano ~/.config/syncthing/config.xml + +Find this directive: + + [...] + +
127.0.0.1:8080
+ -Su9v0lW80JWybGjK9vNK00YDraxXHGP +
+ [...] + +In the **
** field, change **127.0.0.1:8080** to **0.0.0.0:8080**. So, your config.xml will look like below. + + +
0.0.0.0:8080
+ -Su9v0lW80JWybGjK9vNK00YDraxXHGP +
+ +Save and close the file. + +Now, start again the Syncthing initialization on both systems by entering the following command: + + syncthing + +### Access the WebGUI ### + +Now, open your browser **http://ip-address:8080/**. You will see the following screen, + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server1-Mozilla-Firefox_001.png) + +The WebGUI has two panes. In the left pane, you may see the list of folders to be synced. As I mentioned before, the folder **default** has been automatically created for you while initializing Syncthing. If you want to sync more folders, you can add using **Add Folder** button. + +In the right pane, you see the number of devices connected. Currently there is only one device, the computer you are running this on. + +### Configure Syncthing Web GUI ### + +For the security enhancement, let us enable TLS, and setup administrative user and password to access the WebGUI. To od that, click on the gear button and select **Settings** on the top right corner. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Menu_002.png) + +Enter the admin username/password. In my case it is admin/ubuntu. You should use some strong password. And, check the box that says: **Use HTTPS for GUI**. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server1-Mozilla-Firefox_004.png) + +Click Save button. Now, you’ll be asked to restart the Syncthing to activate the changes. Click Restart. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Selection_005.png) + +Selection_005Refresh you web browser. You’ll see the SSL warning like below. Click on the button that says: **I understand the Risks**. And, click Add Exception button to add this page to the browser trusted lists. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Untrusted-Connection-Mozilla-Firefox_006.png) + +Enter the administrative user and password which we configured in the previous steps. In my case it’s **admin/ubuntu**. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Authentication-Required_007.png) + +We have secured the WebGUI now. Don’t forget to do the same steps on both server. + +### Connect Servers To Each Other ### + +To sync folders between systems, you must told them about each other. This is accomplished by exchanging “device IDs”. You can find it in the web GUI by selecting the “gear menu” (top right) and “Show ID”. + +For example, here is my System 1 ID. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server1-Mozilla-Firefox_008.png) + +Copy the ID, and go to the another system (system 2) WebGUI. From the second system (system 2) WebGUI window, click on the Add Device on the right side. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server-Mozilla-Firefox_010.png) + +The following screen should appear. Paste the **System 1 ID** in the Device section. Enter the Device name(optional). In the Addresses field, you can either enter the IP address of the other system or leave it as default. The default value is **dynamic**. Finally, select the folder to be synced. In our case, the sync folder is **default**. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server-Mozilla-Firefox_009.png) + +Once you done, click on the save button. You’ll be asked to restart the Syncthing. Click Restart button to activate the changes. + +Now, go to the **System 1** WebUI, you’ll see a request has been sent from the System 2 to connect and sync. Click **Add** button. Now, the System 2 will ask the System 1 to share and sync the folder called “default”. Click **Share** button. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Selection_013.png) + +Next restart the Syncthing service on the System 1 to activate the changes. + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Selection_014.png) + +Wait for few seconds, approximately 60 seconds, and you’ll see the two systems have been successfully connected and synced to each other. + +You can verify it under the Add Device section of the WebGUI. + +System 1 WebGUI console after adding System 2: + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server-Mozilla-Firefox_016.png) + +System 2 WebGUI console after adding System 1: + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server-Mozilla-Firefox_018.png) + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Syncthing-server-Mozilla-Firefox_018.png) + +Now, put any file or folder in any one of the systems “**default**” folder. You may see the file/folder will be synced to the other system automatically. + +That’s it! Happy Sync’ing!! + +Cheers!!! + +- [Syncthing Website][2] + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/syncthing-private-secure-tool-sync-filesfolders-computers/ + +作者:[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]:https://github.com/syncthing/syncthing/releases/tag/v0.10.20 +[2]:http://syncthing.net/ \ 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 new file mode 100644 index 0000000000..7d46d1de68 --- /dev/null +++ b/sources/tech/20150123 How to make a file immutable on Linux.md @@ -0,0 +1,74 @@ +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 Installing Cisco Packet tracer in Linux.md b/sources/tech/20150126 Installing Cisco Packet tracer in Linux.md new file mode 100644 index 0000000000..edac7a7490 --- /dev/null +++ b/sources/tech/20150126 Installing Cisco Packet tracer in Linux.md @@ -0,0 +1,197 @@ +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 new file mode 100644 index 0000000000..f39d53a47d --- /dev/null +++ b/sources/tech/20150126 iptraf--A TCP or UDP Network Monitoring Utility.md @@ -0,0 +1,66 @@ +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/20150127 25 Useful Apache '.htaccess' Tricks to Secure and Customize Websites.md b/sources/tech/20150127 25 Useful Apache '.htaccess' Tricks to Secure and Customize Websites.md new file mode 100644 index 0000000000..e9e8ecb4eb --- /dev/null +++ b/sources/tech/20150127 25 Useful Apache '.htaccess' Tricks to Secure and Customize Websites.md @@ -0,0 +1,422 @@ +25 Useful Apache ‘.htaccess’ Tricks to Secure and Customize Websites +================================================================================ +Websites are important parts of our lives. They serve the means to expand businesses, share knowledge and lots more. Earlier restricted to providing only static contents, with introduction of dynamic client and server side scripting languages and continued advancement of existing static language like html to html5, adding every bit of dynamicity is possible to the websites and what left is expected to follow soon in near future. + +With websites, comes the need of a unit that can display these websites to a huge set of audience all over the globe. This need is fulfilled by the servers that provide means to host a website. This includes a list of servers like: Apache HTTP Server, Joomla, and WordPress that allow one to host their websites. + +![Apache htaccess Tricks](http://www.tecmint.com/wp-content/uploads/2015/01/htaccess-tricks.jpg) +25 htaccess Tricks + +One who wants to host a website can create a local server of his own or can contact any of above mentioned or any another server administrator to host his website. But the actual issue starts from this point. Performance of a website depends mainly on following factors: + +- Bandwidth consumed by the website. +- How secure is the website against hackers. +- Optimism when it comes to data search through the database +- User-friendliness when it comes to displaying navigation menus and providing more UI features. + +Alongside this, various factors that govern success of servers in hosting websites are: + +- Amount of data compression achieved for a particular website. +- Ability to simultaneously serve multiple clients asking for a same or different website. +- Securing the confidential data entered on the websites like: emails, credit card details and so on. +- Allowing more and more options to enhance dynamicity to a website. + +This article deals with one such feature provided by the servers that help enhance performance of websites along with securing them from bad bots, hotlinks etc. i.e. ‘.htaccess‘ file. + +### What is .htaccess? ### + +htaccess (or hypertext access) are the files that provide options for website owners to control the server environment variables and other parameters to enhance functionality of their websites. These files can reside in any and every directory in the directory tree of the website and provide features to the directory and the files and folders inside it. + +What are these features? Well these are the server directives i.e. the lines that instruct server to perform a specific task, and these directives apply only to the files and folders inside the folder in which this file is placed. These files are hidden by default as all Operating System and the web servers are configured to ignore them by default but making the hidden files visible can make you see this very special file. What type of parameters can be controlled is the topic of discussion of subsequent sections. + +Note: If .htaccess file is placed in /apache/home/www/Gunjit/ directory then it will provide directives for all the files and folders in that directory, but if this directory contains another folder namely: /Gunjit/images/ which again has another .htaccess file then the directives in this folder will override those provided by the master .htaccess file (or file in the folder up in hierarchy). + +### Apache Server and .htaccess files ### + +Apache HTTP Server colloquially called Apache was named after a Native American Tribe Apache to respect its superior skills in warfare strategy. Build on C/C++ and XML it is cross-platform web server which is based on NCSA HTTPd server and has a key role in growth and advancement of World Wide Web. + +Most commonly used on UNIX, Apache is available for wide variety of platforms including FreeBSD, Linux, Windows, Mac OS, Novel Netware etc. In 2009, Apache became the first server to serve more than 100 million websites. + +Apache server has one .htaccess file per user in www/ directory. Although these files are hidden but can be made visible if required. In www/ directory there are a number of folders each pertaining to a website named on user’s or owner’s name. Apart from this you can have one .htaccess file in each folder which configured files in that folder as stated above. + +How to configure htaccess file on Apache server is as follows… + +### Configuration on Apache Server ### + +There can be two cases: + +#### Hosting website on own server #### + +In this case, if .htaccess files are not enabled, you can enable .htaccess files by simply going to httpd.conf (Default configuration file for Apache HTTP Daemon) and finding the section. + + + +And locate the line that says… + + AllowOverride None + +And correct it to. + + AllowOverride All + +Now, on restarting Apache, .htaccess will work. + +#### Hosting website on different hosting provider server #### + +In this case it is better to consult the hosting admin, if they allow access to .htaccess files. + +### 25 ‘.htaccess’ Tricks of Apache Web Server for Websites ### + +#### 1. How to enable mod_rewrite in .htaccess file #### + +mod_rewrite option allows you to use redirections and hiding your true URL with redirecting to some other URL. This option can prove very useful allowing you to replace the lengthy and long URL’s to short and easy to remember ones. + +To allow mod_rewrite just have a practice to add the following line as the first line of your .htaccess file. + + Options +FollowSymLinks + +This option allows you to follow symbolic links and thus enable the mod_rewrite option on the website. Replacing the URL with short and crispy one is presented later on. + +#### 2. How to Allow or Deny Access to Websites #### + +htaccess file can allow or deny access of website or a folder or files in the directory in which it is placed by using order, allow and deny keywords. + +**Allowing access to only 192.168.3.1 IP** + + Order Allow, Deny + Deny from All + Allow from 192.168.3.1 + + OR + + Order Allow, Deny + Allow from 192.168.3.1 + +Order keyword here specifies the order in which allow, deny access would be processed. For the above ‘Order’ statement, the Allow statements would be processed first and then the deny statements would be processed. + +**Denying access to only one IP Address** + +The below lines provide the means to allow access of the website to all the users accept one with IP Address: 192.168.3.1. + + rder Allow, Deny + Deny from 192.168.3.1 + Allow from All + + OR + + + Order Deny, Allow + Deny from 192.168.3.1 + +#### 3. Generate Apache Error documents for different error codes. #### + +Using some simple lines, we can fix the error document that run on different error codes generated by the server when user/client requests a page not available on the website like most of us would have seen the ‘404 Page not found’ page in their web browser. ‘.htaccess’ files specify what action to take in case of such error conditions. + +To do this, the following lines are needed to be added to the ‘.htaccess’ files: + + ErrorDocument + +‘ErrorDocument’ is a keyword, error-code can be any of 401, 403, 404, 500 or any valid error representing code and lastly, ‘path-of-document’ represents the path on the local machine (in case you are using your own local server) or on the server (in case you are using any other’s server to host your website). + +**Example:** + + ErrorDocument 404 /error-docs/error-404.html + +The above line sets the document ‘error-404.html’ placed in error-docs folder to be displayed in case the 404 error is reported by the server for any invalid request for a page by the client. + +rrorDocument 404 "404 Page not found

The page you request is not present. Check the URL you have typed

" + +The above representation is also correct which places the string representing a usual html file. + +#### 4. Setting/Unsetting Apache server environment variables #### + +In .htaccess file you can set or unset the global environment variables that server allow to be modified by the hosters of the websites. For setting or unsetting the environment variables you need to add the following lines to your .htaccess files. + +**Setting the Environment variables** + + SetEnv OWNER “Gunjit Khera” + +Unsetting the Environment variables + + UnsetEnv OWNER + +#### 5. Defining different MIME types for files #### + +MIME (Multipurpose Internet Multimedia Extensions) are the types that are recognized by the browser by default when running any web page. You can define MIME types for your website in .htaccess files, so that different types of files as defined by you can be recognized and run by the server. + + + AddType application/javascript js + AddType application/x-font-ttf ttf ttc + + +Here, mod_mime.c is the module for controlling definitions of different MIME types and if you have this module installed on your system then you can use this module to define different MIME types for different extensions used in your website so that server can understand them. + +#### 6. How to Limit the size of Uploads and Downloads in Apache #### + +.htaccess files allow you the feature to control the amount of data being uploaded or downloaded by a particular client from your website. For this you just need to append the following lines to your .htaccess file: + + php_value upload_max_filesize 20M + php_value post_max_size 20M + php_value max_execution_time 200 + php_value max_input_time 200 + +The above lines set maximum upload size, maximum size of data being posted, maximum execution time i.e. the maximum time the a user is allowed to execute a website on his local machine, maximum time constrain within on the input time. + +#### 7. Making Users to download .mp3 and other files before playing on your website. #### + +Mostly, people play songs on websites before downloading them to check the song quality etc. Being a smart seller you can add a feature that can come in very handy for you which will not let any user play songs or videos online and users have to download them for playing. This is very useful as online playing of songs and videos consumes a lot of bandwidth. + +Following lines are needed to be added to be added to your .htaccess file: + + AddType application/octet-stream .mp3 .zip + +#### 8. Setting Directory Index for Website #### + +Most of website developers would already know that the first page that is displayed i.e. the home page of a website is named as ‘index.html’ .Many of us would have seen this also. But how is this set? + +.htaccess file provides a way to list a set of pages which would be scanned in order when a client requests to visit home page of the website and accordingly any one of the listed set of pages if found would be listed as the home page of the website and displayed to the user. + +Following line is needed to be added to produce the desired effect. + + DirectoryIndex index.html index.php yourpage.php + +The above line specifies that if any request for visiting the home page comes by any visitor then the above listed pages will be searched in order in the directory firstly: index.html which if found will be displayed as the sites home page, otherwise list will proceed to the next page i.e. index.php and so on till the last page you have entered in the list. + +#### 9. How to enable GZip compression for Files to save site’s bandwidth. #### + +This is a common observation that heavy sites generally run bit slowly than light weight sites that take less amount of space. This is just because for a heavy site it takes time to load the huge script files and images before displaying them on the client’s web browser. + +This is a common mechanism that when a browser requests a web page, server provides the browser with that webpage and now to locally display that web page, the browser has to download that page and then run the script inside that page. + +What GZip compression does here is saving the time required to serve a single customer thus increasing the bandwidth. The source files of the website on the server are kept in compressed form and when the request comes from a user then these files are transferred in compressed form which are then uncompressed and executed on the server. This improves the bandwidth constrain. + +Following lines can allow you to compress the source files of your website but this requires mod_deflate.c module to be installed on your server. + + + AddOutputFilterByType DEFLATE text/plain + AddOutputFilterByType DEFLATE text/html + AddOutputFilterByType DEFLATE text/xml + AddOutputFilterByType DEFLATE application/html + AddOutputFilterByType DEFLATE application/javascript + AddOutputFilterByType DEFLATE application/x-javascript + + +#### 10. Playing with the File types. #### + +There are certain conditions that the server assumes by default. Like: .php files are run on the server, similarly .txt files say for example are meant to be displayed. Like this we can make some executable cgi-scripts or files to be simply displayed as the source code on our website instead of being executed. + +To do this observe the following lines from a .htaccess file. + + RemoveHandler cgi-script .php .pl .py + AddType text/plain .php .pl .py + +These lines tell the server that .pl (perl script), .php (PHP file) and .py (Python file) are meant to just be displayed and not executed as cgi-scripts. + +#### 11. Setting the Time Zone for Apache server #### + +The power and importance of .htaccess files can be seen by the fact that this can be used to set the Time Zone of the server accordingly. This can be done by setting a global Environment variable ‘TZ’ of the list of global environment variables that are provided by the server to each of the hosted website for modification. + +Due to this reason only, we can see time on the websites (that display it) according to our time zone. May be some other person hosting his website on the server would have the timezone set according to the location where he lives. + +Following lines set the Time Zone of the Server. + + SetEnv TZ India/Kolkata + +#### 12. How to enable Cache Control on Website #### + +A very interesting feature of browser, most have observed is that on opening one website simultaneously more than one time, the latter one opens fast as compared to the first time. But how is this possible? Well in this case, the browser stores some frequently visited pages in its cache for faster access later on. + +But for how long? Well this answer depends on you i.e. on the time you set in your .htaccess file for Cache control. The .htaccess file can specify the amount of time for which the pages of website can stay in the browser’s cache and after expiration of time, it must revalidate i.e. pages would be deleted from the Cache and recreated the next time user visits the site. + +Following lines implement Cache Control for your website. + + + Header Set Cache-Control "max-age=3600, public" + + + Header Set Cache-Control "public" + Header Set Expires "Sat, 24 Jan 2015 16:00:00 GMT" + + +The above lines allow caching of the pages which are inside the directory in which .htaccess files are placed for 1 hour. + +#### 13. Configuring a single file, the option. #### + +Usually the content in .htaccess files apply to all the files and folders inside the directory in which the file is placed, but you can also provide some special permissions to a special file, like denying access to that file only or so on. + +For this you need to add tag to your file in a way like this: + + + Order allow, deny + Deny from 188.100.100.0 + + +This is a simple case of denying a file ‘conf.html’ from access by IP 188.100.100.0, but you can add any or every feature described for .htaccess file till now including the features yet to be described to the file like: Cache-control, GZip compression. + +This feature is used by most of the servers to secure .htaccess files which is the reason why we are not able to see the .htaccess files on the browsers. How the files are authenticated is demonstrated in subsequent heading. + +#### 14. Enabling CGI scripts to run outside of cgi-bin folder. #### + +Usually servers run CGI scripts that are located inside the cgi-bin folder but, you can enable running of CGI scripts located in your desired folder but just adding following lines to .htaccess file located in the desired folder and if not, then creating one, appending following lines: + + AddHandler cgi-script .cgi + Options +ExecCGI + +#### 15. How to enable SSI on Website with .htaccess #### + +Server side includes as the name suggests would be related to something included at the server side. But what? Generally when we have many pages in our website and we have a navigation menu on our home page that displays links to other pages then, we can enable SSI (Server Size Includes) option that allows all the pages displayed in the navigation menu to be included with the home page completely. + +The SSI allows inclusion of multiple pages as if content they contain is a part of a single page so that any editing needed to be done is done in one file only which saves a lot of disk space. This option is by default enabled on servers but for .shtml files. + +In case you want to enable it for .html files you need to add following lines: + + AddHandler server-parsed .html + +After this following in the html file would lead to SSI. + + + +#### 16. How to Prevent website Directory Listing #### + +To prevent any client being able to list the directories of the website on the server at his local machine add following lines to the file inside the directory you don’t want to get listed. + + Options -Indexes + +#### 17. Changing Default charset and language headers. #### + +.htaccess files allow you to modify the character set used i.e. ASCII or UNICODE, UTF-8 etc. for your website along with the default language used for the display of content. + +Following server’s global environment variables allow you to achieve above feature. + + AddDefaultCharset UTF-8 + DefaultLanguage en-US + +**Re-writing URL’s: Redirection Rules** + +Re-writing feature simply means replacing the long and un-rememberable URL’s with short and easy to remember ones. But, before going into this topic there are some rules and some conventions for special symbols used later on in this article. + +**Special Symbols:** + + Symbol Meaning + ^ - Start of the string + $ - End of the String + | - Or [a|b] – a or b + [a-z] - Any of the letter between a to z + + - One or more occurrence of previous letter + * - Zero or more occurrence of previous letter + ? - Zero or one occurrence of previous letter + +**Constants and their meaning:** + + Constant Meaning + NC - No-case or case sensitive + L - Last rule – stop processing further rules + R - Temporary redirect to new URL + R=301 - Permanent redirect to new URL + F - Forbidden, send 403 header to the user + P - Proxy – grab remote content in substitution section and return it + G - Gone, no longer exists + S=x - Skip next x rules + T=mime-type - Force specified MIME type + E=var:value - Set environment variable var to value + H=handler - Set handler + PT - Pass through – in case of URL’s with additional headers. + QSA - Append query string from requested to substituted URL + +#### 18. Redirecting a non-www URL to a www URL. #### + +Before starting with the explanation, lets first see the lines that are needed to be added to .htaccess file to enable this feature. + + RewriteEngine ON + RewriteCond %{HTTP_HOST} ^abc\.net$ + RewriteRule (.*) http://www.abc.net/$1 [R=301,L] + +The above lines enable the Rewrite Engine and then in second line check all those URL’s that pertain to host abc.net or have the HTTP_HOST environment variable set to “abc.net”. + +For all such URL’s the code permanently redirects them (as R=301 rule is enabled) to the new URL http://www.abc.net/$1 where $1 is the non-www URL having host as abc.net. The non-www URL is the one in bracket and is referred by $1. + +#### 19. Redirecting entire website to https. #### + +Following lines will help you transfer entire website to https: + + RewriteEngine ON + RewriteCond %{HTTPS} !on + RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} + +The above lines enable the re-write engine and then check the value of HTTPS environment variable. If it is on then re-write the entire pages of the website to https. + +#### 20. A custom redirection example #### + +For example, redirect url ‘http://www.abc.net?p=100&q=20 ‘ to ‘http://www.abc.net/10020pq’. + + RewriteEngine ON + RewriteRule ^http://www.abc.net/([0-9]+)([0-9]+)pq$ ^http://www.abc.net?p=$1&q=$2 + +In above lines, $1 represents the first bracket and $2 represents the second bracket. + +#### 21. Renaming the htaccess file #### + +For preventing the .htaccess file from the intruders and other people from viewing those files you can rename that file so that it is not accessed by client’s browser. The line that does this is: + + AccessFileName htac.cess + +#### 22. How to Prevent Image Hotlinking for your Website #### + +Another problem that is major factor of large bandwidth consumption by the websites is the problem of hot links which are links to your websites by other websites for display of images mostly of your website which consumes your bandwidth. This problem is also called as ‘bandwidth theft’. + +A common observation is when a site displays the image contained in some other site due to this hot-linking your site needs to be loaded and at the stake of your site’s bandwidth, the other site’s images are displayed. To prevent this for like: images such as: .gif, .jpeg etc. following lines of code would help: + + RewriteEngine ON + RewriteCond %{HTTP_REFERER} !^$ + RewriteCond %{HTTP_REFERERER} !^http://(www\.)?mydomain.com/.*$ [NC] + RewriteRule \.(gif|jpeg|png)$ - [F]. + +The above lines check if the HTTP_REFERER is not set to blank or not set to any of the links in your websites. If this is happening then all the images in your page are replaced by 403 forbidden. + +#### 23. How to Redirect Users to Maintenance Page. #### + +In case your website is down for maintenance and you want to notify all your clients that need to access your websites about this then for such cases you can add following lines to your .htaccess websites that allow only admin access and replace the site pages having links to any .jpg, .css, .gif, .js etc. + + RewriteCond %{REQUEST_URI} !^/admin/ [NC] + RewriteCond %{REQUEST_URI} !^((.*).css|(.*).js|(.*).png|(.*).jpg) [NC] + RewriteRule ^(.*)$ /ErrorDocs/Maintainence_Page.html + [NC,L,U,QSA] + +These lines check if the Requested URL contains any request for any admin page i.e. one starting with ‘/admin/’ or any request to ‘.png, .jpg, .js, .css’ pages and for any such requests it replaces that page to ‘ErrorDocs/Maintainence_Page.html’. + +#### 24. Mapping IP Address to Domain Name #### + +Name servers are the servers that convert a specific IP Address to a domain name. This mapping can also be specified in the .htaccess files in the following manner. + + For Mapping L.M.N.O address to a domain name www.hellovisit.com + RewriteCond %{HTTP_HOST} ^L\.M\.N\.O$ [NC] + RewriteRule ^(.*)$ http://www.hellovisit.com/$1 [L,R=301] + +The above lines check if the host for any page is having the IP Address as: L.M.N.O and if so the page is mapped to the domain name http://www.hellovisit.com by the third line by permanent redirection. + +#### 25. FilesMatch Tag #### + +Like tag that is used to apply conditions to a single file, can be used to match to a group of files and apply some conditions to the group of files as below: + + + Order Allow, Deny + Deny from All + + +### Conclusion ### + +The list of tricks that can be done with .htaccess files is much more. Thus, this gives us an idea how powerful this file is and how much security and dynamicity and other features it can give to your website. + +We’ve tried our best to cover as much as htaccess tricks in this article, but incase if we’ve missed any important trick, or you most welcome to post your htaccess ideas and tricks that you know via comments section below – we will include those in our article too… + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/apache-htaccess-tricks/ + +作者:[Gunjit Khera][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/gunjitk94/ \ No newline at end of file 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 new file mode 100644 index 0000000000..9a9341b4b7 --- /dev/null +++ b/sources/tech/20150128 Docker-2 Setting up a private Docker registry.md @@ -0,0 +1,241 @@ +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 new file mode 100644 index 0000000000..f450361a68 --- /dev/null +++ b/sources/tech/20150128 Docker-3 Automated Docker-based Rails deployments.md @@ -0,0 +1,253 @@ +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 new file mode 100644 index 0000000000..92ac657b5a --- /dev/null +++ b/sources/tech/20150202 How to Bind Apache Tomcat to IPv4 in Centos or Redhat.md @@ -0,0 +1,79 @@ +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 filter BGP routes in Quagga BGP router.md b/sources/tech/20150202 How to filter BGP routes in Quagga BGP router.md new file mode 100644 index 0000000000..d92c47c774 --- /dev/null +++ b/sources/tech/20150202 How to filter BGP routes in Quagga BGP router.md @@ -0,0 +1,201 @@ +How to filter BGP routes in Quagga BGP router +================================================================================ +In the [previous tutorial][1], we demonstrated how to turn a CentOS box into a BGP router using Quagga. We also covered basic BGP peering and prefix exchange setup. In this tutorial, we will focus on how we can control incoming and outgoing BGP prefixes by using **prefix-list** and **route-map**. + +As described in earlier tutorials, BGP routing decisions are made based on the prefixes received/advertised. To ensure error-free routing, it is recommended that you use some sort of filtering mechanism to control these incoming and outgoing prefixes. For example, if one of your BGP neighbors starts advertising prefixes which do not belong to them, and you accept such bogus prefixes by mistake, your traffic can be sent to that wrong neighbor, and end up going nowhere (so-called "getting blackholed"). To make sure that such prefixes are not received or advertised to any neighbor, you can use prefix-list and route-map. The former is a prefix-based filtering mechanism, while the latter is a more general prefix-based policy mechanism used to fine-tune actions. + +We will show you how to use prefix-list and route-map in Quagga. + +### Topology and Requirement ### + +In this tutorial, we assume the following topology. + +![](https://farm8.staticflickr.com/7394/16407625405_4f7d24d1f6_c.jpg) + +Service provider A has already established an eBGP peering with service provider B, and they are exchanging routing information between them. The AS and prefix details are as stated below. + +- **Peering block**: 192.168.1.0/24 +- **Service provider A**: AS 100, prefix 10.10.0.0/16 +- **Service provider B**: AS 200, prefix 10.20.0.0/16 + +In this scenario, service provider B wants to receive only prefixes 10.10.10.0/23, 10.10.10.0/24 and 10.10.11.0/24 from provider A. + +### Quagga Installation and BGP Peering ### + +In the [previous tutorial][1], we have already covered the method of installing Quagga and setting up BGP peering. So we will not go through the details here. Nonetheless, I am providing a summary of BGP configuration and prefix advertisements: + +![](https://farm8.staticflickr.com/7428/16219986668_97cb193b15_c.jpg) + +The above output indicates that the BGP peering is up. Router-A is advertising multiple prefixes towards router-B. Router-B, on the other hand, is advertising a single prefix 10.20.0.0/16 to router-A. Both routers are receiving the prefixes without any problems. + +### Creating Prefix-List ### + +In a router, a prefix can be blocked with either an ACL or prefix-list. Using prefix-list is often preferred to ACLs since prefix-list is less processor intensive than ACLs. Also, prefix-list is easier to create and maintain. + + ip prefix-list DEMO-PRFX permit 192.168.0.0/23 + +The above command creates prefix-list called 'DEMO-FRFX' that allows only 192.168.0.0/23. + +Another great feature of prefix-list is that we can specify a range of subnet mask(s). Take a look at the following example: + + ip prefix-list DEMO-PRFX permit 192.168.0.0/23 le 24 + +The above command creates prefix-list called 'DEMO-PRFX' that permits prefixes between 192.168.0.0/23 and /24, which are 192.168.0.0/23, 192.168.0.0/24 and 192.168.1.0/24. The 'le' operator means less than or equal to. You can also use 'ge' operator for greater than or equal to. + +A single prefix-list statement can have multiple permit/deny actions. Each statement is assigned a sequence number which can be determined automatically or specified manually. + +Multiple prefix-list statements are parsed one by one in the increasing order of sequence numbers. When configuring prefix-list, we should keep in mind that there is always an **implicit deny** at the end of all prefix-list statements. This means that anything that is not explicitly allowed will be denied. + +To allow everything, we can use the following prefix-list statement which allows any prefix starting from 0.0.0.0/0 up to anything with subnet mask /32. + + ip prefix-list DEMO-PRFX permit 0.0.0.0/0 le 32 + +Now that we know how to create prefix-list statements, we will create prefix-list called 'PRFX-LST' that will allow prefixes required in our scenario. + + router-b# conf t + router-b(config)# ip prefix-list PRFX-LST permit 10.10.10.0/23 le 24 + +### Creating Route-Map ### + +Besides prefix-list and ACLs, there is yet another mechanism called route-map, which can control prefixes in a BGP router. In fact, route-map can fine-tune possible actions more flexibly on the prefixes matched with an ACL or prefix-list. + +Similar to prefix-list, a route-map statement specifies permit or deny action, followed by a sequence number. Each route-map statement can have multiple permit/deny actions with it. For example: + + route-map DEMO-RMAP permit 10 + +The above statement creates route-map called 'DEMO-RMAP', and adds permit action with sequence 10. Now we will use match command under sequence 10. + + router-a(config-route-map)# match (press ? in the keyboard) + +---------- + + as-path Match BGP AS path list + community Match BGP community list + extcommunity Match BGP/VPN extended community list + interface match first hop interface of route + ip IP information + ipv6 IPv6 information + metric Match metric of route + origin BGP origin code + peer Match peer address + probability Match portion of routes defined by percentage value + tag Match tag of route + +As we can see, route-map can match many attributes. We will match a prefix in this tutorial. + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + +The match command will match the IP addresses permitted by the prefix-list 'DEMO-PRFX' created earlier (i.e., prefixes 192.168.0.0/23, 192.168.0.0/24 and 192.168.1.0/24). + +Next, we can modify the attributes by using the set command. The following example shows possible use cases of set. + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + set (press ? in keyboard) + +---------- + + aggregator BGP aggregator attribute + as-path Transform BGP AS-path attribute + atomic-aggregate BGP atomic aggregate attribute + comm-list set BGP community list (for deletion) + community BGP community attribute + extcommunity BGP extended community attribute + forwarding-address Forwarding Address + ip IP information + ipv6 IPv6 information + local-preference BGP local preference path attribute + metric Metric value for destination routing protocol + metric-type Type of metric + origin BGP origin code + originator-id BGP originator ID attribute + src src address for route + tag Tag value for routing protocol + vpnv4 VPNv4 information + weight BGP weight for routing table + +As we can see, the set command can be used to change many attributes. For a demonstration purpose, we will set BGP local preference. + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + set local-preference 500 + +Just like prefix-list, there is an implicit deny at the end of all route-map statements. So we will add another permit statement in sequence number 20 to permit everything. + + route-map DEMO-RMAP permit 10 + match ip address prefix-list DEMO-PRFX + set local-preference 500 + ! + route-map DEMO-RMAP permit 20 + +The sequence number 20 does not have a specific match command, so it will, by default, match everything. Since the decision is permit, everything will be permitted by this route-map statement. + +If you recall, our requirement is to only allow/deny some prefixes. So in our scenario, the set command is not necessary. We will just use one permit statement as follows. + + router-b# conf t + router-b(config)# route-map RMAP permit 10 + router-b(config-route-map)# match ip address prefix-list PRFX-LST + +This route-map statement should do the trick. + +### Applying Route-Map ### + +Keep in mind that ACLs, prefix-list and route-map are not effective unless they are applied to an interface or a BGP neighbor. Just like ACLs or prefix-list, a single route-map statement can be used with any number of interfaces or neighbors. However, any one interface or a neighbor can support only one route-map statement for inbound, and one for outbound traffic. + +We will apply the created route-map to the BGP configuration of router-B for neighbor 192.168.1.1 with incoming prefix advertisement. + + router-b# conf terminal + router-b(config)# router bgp 200 + router-b(config-router)# neighbor 192.168.1.1 route-map RMAP in + +Now, we check the routes advertised and received by using the following commands. + +For advertised routes: + + show ip bgp neighbor-IP advertised-routes + +For received routes: + + show ip bgp neighbor-IP routes + +![](https://farm8.staticflickr.com/7424/16221405429_4d86119548_c.jpg) + +You can see that while router-A is advertising four prefixes towards router-B, router-B is accepting only three prefixes. If we check the range, we can see that only the prefixes that are allowed by route-map are visible on router-B. All other prefixes are discarded. + +**Tip**: If there is no change in the received prefixes, try resetting the BGP session using the command: "clear ip bgp neighbor-IP". In our case: + + clear ip bgp 192.168.1.1 + +As we can see, the requirement has been met. We can create similar prefix-list and route-map statements in routers A and B to further control inbound and outbound prefixes. + +I am summarizing the configuration in one place so you can see it all at a glance. + + router bgp 200 + network 10.20.0.0/16 + neighbor 192.168.1.1 remote-as 100 + neighbor 192.168.1.1 route-map RMAP in + ! + ip prefix-list PRFX-LST seq 5 permit 10.10.10.0/23 le 24 + ! + route-map RMAP permit 10 + match ip address prefix-list PRFX-LST + +### Summary ### + +In this tutorial, we showed how we can filter BGP routes in Quagga by defining prefix-list and route-map. We also demonstrated how we can combine prefix-list with route-map to fine-control incoming prefixes. You can create your own prefix-list and route-map in a similar way to match your network requirements. These tools are one of the most effective ways to protect the production network from route poisoning and advertisement of bogon routes. + +Hope this helps. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html + +作者:[Sarmed Rahman][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/sarmed +[1]:http://xmodulo.com/centos-bgp-router-quagga.html \ No newline at end of file diff --git a/sources/tech/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md b/sources/tech/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md new file mode 100644 index 0000000000..4af1fc99cb --- /dev/null +++ b/sources/tech/20150205 How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto.md @@ -0,0 +1,424 @@ +How To Scan And Check A WordPress Website Security Using WPScan, Nmap, And Nikto +================================================================================ +### 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. + +If you haven’t installed WordPress yet, check the following article. +On Debian based systems: + +- [How to install WordPress On Ubuntu][1] + +On RPM based systems: + +- [How to install wordpress On CentOS][2] + +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. + +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**. + +### WPScan to Test for Vulnerable Plugins and Themes in WordPress ### + +**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. + +### Download and Install WPScan ### + +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 is hosted on Github, so if it is not already installed we will need to install the git packages before we can continue. + + sudo apt-get install git + +Once git is installed, we need to install the dependencies for 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. + + 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. + + 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. + +#### Update 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. + + 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 + | Location: http://********.com/wp-content/plugins/akismet/ + + | Name: audio-player + | Location: http://********.com/wp-content/plugins/audio-player/ + | + | * Title: Audio Player - player.swf playerID Parameter XSS + | * Reference: http://seclists.org/bugtraq/2013/Feb/35 + | * Reference: http://secunia.com/advisories/52083 + | * Reference: http://osvdb.org/89963 + | * Fixed in: 2.0.4.6 + + | Name: bbpress - v2.3.2 + | Location: http://********.com/wp-content/plugins/bbpress/ + | Readme: http://********.com/wp-content/plugins/bbpress/readme.txt + | + | * Title: BBPress - Multiple Script Malformed Input Path Disclosure + | * Reference: http://xforce.iss.net/xforce/xfdb/78244 + | * Reference: http://packetstormsecurity.com/files/116123/ + | * Reference: http://osvdb.org/86399 + | * Reference: http://www.exploit-db.com/exploits/22396/ + | + | * Title: BBPress - forum.php page Parameter SQL Injection + | * Reference: http://xforce.iss.net/xforce/xfdb/78244 + | * Reference: http://packetstormsecurity.com/files/116123/ + | * Reference: http://osvdb.org/86400 + | * Reference: http://www.exploit-db.com/exploits/22396/ + + | 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. + + 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/ + | Style URL: http://********.com/wp-content/themes/path/style.css + | Description: + + | Name: pub + | Location: http://********.com/wp-content/themes/pub/ + | Style URL: http://********.com/wp-content/themes/pub/style.css + | Description: + + | Name: rockstar + | Location: http://********.com/wp-content/themes/rockstar/ + | Style URL: http://********.com/wp-content/themes/rockstar/style.css + | Description: + | + | * Title: WooThemes WooFramework Remote Unauthenticated Shortcode Execution + | * Reference: https://gist.github.com/2523147 + + | Name: twentyten + | Location: http://********.com/wp-content/themes/twentyten/ + | 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. + + ruby wpscan.rb --url http(s)://www.host-name.com --enumerate u + +#### Enumerate Timthumb Files #### + +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. + + ruby wpscan.rb --url http(s)://www.host-name.com --enumerate tt + +### Nmap to Scan for Open Ports on your 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 + +### Download and install nmap on Debian and Ubuntu ### + +To install nmap for Debian and Ubuntu Linux based server systems type the following apt-get command: + + sudo apt-get install nmap + +**Sample outputs:** + + Reading package lists... Done + Building dependency tree + Reading state information... Done + The following NEW packages will be installed: + nmap + 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. + Need to get 1,643 kB of archives. + After this operation, 6,913 kB of additional disk space will be used. + Get:1 http://mirrors.service.networklayer.com/ubuntu/ precise/main nmap amd64 5.21-1.1ubuntu1 [1,643 kB] + Fetched 1,643 kB in 0s (16.4 MB/s) + Selecting previously unselected package nmap. + (Reading database ... 56834 files and directories currently installed.) + Unpacking nmap (from .../nmap_5.21-1.1ubuntu1_amd64.deb) ... + Processing triggers for man-db ... + Setting up nmap (5.21-1.1ubuntu1) ... + +#### Examples #### + +To find the nmap version, enter: + + nmap -V + +OR + + nmap --version + +**Sample outputs:** + + Nmap version 5.21 ( http://nmap.org ) + +### Dowonlad and install nmap on Centos ### + +To install nmap on RHEL based Linux distributions, type the following yum command: + + yum install nmap + +**Sample outputs:** + + Loaded plugins: protectbase, rhnplugin, security + 0 packages excluded due to repository protections + Setting up Install Process + Resolving Dependencies + --> Running transaction check + ---> Package nmap.x86_64 2:5.51-2.el6 will be installed + --> Finished Dependency Resolution + + Dependencies Resolved + + ================================================================================ + Package Arch Version Repository Size + ================================================================================ + Installing: + nmap x86_64 2:5.51-2.el6 rhel-x86_64-server-6 2.8 M + + Transaction Summary + ================================================================================ + Install 1 Package(s) + + Total download size: 2.8 M + Installed size: 0 + Is this ok [y/N]: y + Downloading Packages: + nmap-5.51-2.el6.x86_64.rpm | 2.8 MB 00:00 + Running rpm_check_debug + Running Transaction Test + Transaction Test Succeeded + Running Transaction + Installing : 2:nmap-5.51-2.el6.x86_64 1/1 + Verifying : 2:nmap-5.51-2.el6.x86_64 1/1 + + Installed: + nmap.x86_64 2:5.51-2.el6 + + Complete! + +#### Examples #### + +To find the nmap version, enter: + + nmap --version + +**Sample outputs:** + + Nmap version 5.51 ( http://nmap.org ) + +#### Scan Ports with 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. + +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: + + scanme.nmap.org + +Some commands may take a long while to complete: + +To scan an IP address or a host name (FQDN), run: + + 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: + + 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: + + 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: + + 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) + Host 192.168.1.2 is up (0.0038s latency). + MAC Address: 74:44:01:40:57:FB (Unknown) + Host 192.168.1.5 is up. + Host nas03 (192.168.1.12) is up (0.0091s latency). + 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. + +### Nikto to Scan for vulnerabilities in your website ### + +[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. + +### Download and install Nikto on Linux server ### + +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. + + 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 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 + --------------------------------------------------------------------------- + + ERROR: No host specified + + -config+ Use this config file + -Cgidirs+ scan these CGI dirs: 'none', 'all', or values like "/cgi/ /cgi-a/" + -dbcheck check database and other key files for syntax errors + -Display+ Turn on/off display outputs + -evasion+ ids evasion technique + -Format+ save file (-o) format + -host+ target host + -Help Extended help information + -id+ Host authentication to use, format is id:pass or id:pass:realm + -list-plugins List all available plugins + -mutate+ Guess additional file names + -mutate-options+ Provide extra information for mutations + -output+ Write output to this file + -nocache Disables the URI cache + -nossl Disables using SSL + -no404 Disables 404 checks + -port+ Port to use (default 80) + -Plugins+ List of plugins to run (default: ALL) + -root+ Prepend root value to all requests, format is /directory + -ssl Force ssl mode on port + -Single Single request mode + -timeout+ Timeout (default 2 seconds) + -Tuning+ Scan tuning + -update Update databases and plugins from CIRT.net + -vhost+ Virtual host (for Host header) + -Version Print plugin and database versions + + requires a value + + 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). + +#### Update the nikto Database #### + +Before performing any scan we need to update the nikto database packages using. + + /usr/local/bin/nikto.pl -update + +To list the available Plugins for nikto we can use the below command. + + nikto.pl -list-plugins // To list the installed plugins // + +#### Scan for vulnerabilities #### + +For a simple test for we will use test a single 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 -h http://www.host-name.com + - Nikto v2.1.4 + --------------------------------------------------------------------------- + + Target IP: 1.2.3.4 + + Target Hostname: host-name.com + + Target Port: 80 + + Start Time: 2012-08-11 14:27:31 + --------------------------------------------------------------------------- + + Server: Apache/2.2.22 (FreeBSD) mod_ssl/2.2.22 OpenSSL/1.0.1c DAV/2 + + robots.txt contains 4 entries which should be manually viewed. + + mod_ssl/2.2.22 appears to be outdated (current is at least 2.8.31) (may depend on server version) + + ETag header found on server, inode: 5918348, size: 121, mtime: 0x48fc943691040 + + mod_ssl/2.2.22 OpenSSL/1.0.1c DAV/2 - mod_ssl 2.8.7 and lower are vulnerable to a remote buffer overflow which may allow a remote shell (difficult to exploit). CVE-2002-0082, OSVDB-756. + + Allowed HTTP Methods: GET, HEAD, POST, OPTIONS, TRACE + + OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST + + /lists/admin/: PHPList pre 2.6.4 contains a number of vulnerabilities including remote administrative access, harvesting user info and more. Default login to admin interface is admin/phplist + + OSVDB-2322: /gallery/search.php?searchstring=: Gallery 1.3.4 and below is vulnerable to Cross Site Scripting (XSS). Upgrade to the latest version. http://www.securityfocus.com/bid/8288. + + OSVDB-7022: /calendar.php?year=&month=03&day=05: DCP-Portal v5.3.1 is vulnerable to Cross Site Scripting (XSS). http://www.cert.org/advisories/CA-2000-02.html. + + OSVDB-3233: /phpinfo.php: Contains PHP configuration information + + OSVDB-3092: /system/: This might be interesting... + + OSVDB-3092: /template/: This may be interesting as the directory may hold sensitive files or reveal system information. + + OSVDB-3092: /updates/: This might be interesting... + + OSVDB-3092: /README: README file found. + + 6448 items checked: 1 error(s) and 14 item(s) reported on remote host + + End Time: 2012-08-11 15:52:57 (5126 seconds) + --------------------------------------------------------------------------- + + 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. + +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. + +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) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/anis/ +[1]:http://www.unixmen.com/install-wordpress-ubuntu-14-10/ +[2]:http://www.unixmen.com/install-configure-wordpress-4-0-benny-centos-7/ +[3]:http://www.unixmen.com/secure-wordpress-website/ +[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 diff --git a/sources/tech/20150205 Install Strongswan - A Tool to Setup IPsec Based VPN in Linux.md b/sources/tech/20150205 Install Strongswan - A Tool to Setup IPsec Based VPN in Linux.md new file mode 100644 index 0000000000..ca909934fa --- /dev/null +++ b/sources/tech/20150205 Install Strongswan - A Tool to Setup IPsec Based VPN in Linux.md @@ -0,0 +1,113 @@ +Install Strongswan - A Tool to Setup IPsec Based VPN in Linux +================================================================================ +IPsec is a standard which provides the security at network layer. It consist of authentication header (AH) and encapsulating security payload (ESP) components. AH provides the packet Integrity and confidentiality is provided by ESP component . IPsec ensures the following security features at network layer. + +- Confidentiality +- Integrity of packet +- Source Non. Repudiation +- Replay attack protection + +[Strongswan][1] is an open source implementation of IPsec protocol and Strongswan stands for Strong Secure WAN (StrongS/WAN). It supports the both version of automatic keying exchange in IPsec VPN (Internet keying Exchange (IKE) V1 & V2). + +Strongswan basically provides the automatic keying sharing between two nodes/gateway of the VPN and after that it uses the Linux Kernel implementation of IPsec (AH & ESP). Key shared using IKE mechanism is further used in the ESP for the encryption of data. In IKE phase, strongswan uses the encryption algorithms (AES,SHA etc) of OpenSSL and other crypto libraries. However, ESP component of IPsec uses the security algorithm which are implemented in the Linux Kernel. The main features of Strongswan are given below. + +- 509 certificates or pre-shared keys based Authentication +- Support of IKEv1 and IKEv2 key exchange protocols +- Optional built-in integrity and crypto tests for plugins and libraries +- Support of elliptic curve DH groups and ECDSA certificates +- Storage of RSA private keys and certificates on a smartcard. + +It can be used in the client / server (road warrior) and gateway to gateway scenarios. + +### How to Install ### + +Almost all Linux distro’s, supports the binary package of Strongswan. In this tutorial, we will install the strongswan from binary package and also the compilation of strongswan source code with desirable features. + +### Using binary package ### + +Strongswan can be installed using following command on Ubuntu 14.04 LTS . + + $sudo aptitude install strongswan + +![Installation of strongswan](http://blog.linoxide.com/wp-content/uploads/2014/12/strongswan-binary.png) + +The global configuration (strongswan.conf) file and ipsec configuration (ipsec.conf/ipsec.secrets) files of strongswan are under /etc/ directory. + +### Pre-requisite for strongswan source compilation & installation ### + +- GMP (Mathematical/Precision Library used by strongswan) +- OpenSSL (Crypto Algorithms from this library) +- PKCS (1,7,8,11,12)(Certificate encoding and smart card integration with Strongswan ) + +#### Procedure #### + +**1)** Go to /usr/src/ directory using following command in the terminal. + + $cd /usr/src + +**2)** Download the source code from strongswan site suing following command + + $sudo wget http://download.strongswan.org/strongswan-5.2.1.tar.gz + +(strongswan-5.2.1.tar.gz is the latest version.) + +![Downloading software](http://blog.linoxide.com/wp-content/uploads/2014/12/download_strongswan.png) + +**3)** Extract the downloaded software and go inside it using following command. + + $sudo tar –xvzf strongswan-5.2.1.tar.gz; cd strongswan-5.2.1 + +**4)** Configure the strongswan as per desired options using configure command. + + ./configure --prefix=/usr/local -–enable-pkcs11 -–enable-openssl + +![checking packages for strongswan](http://blog.linoxide.com/wp-content/uploads/2014/12/strongswan-configure.png) + +If GMP library is not installed, then configure script will generate following error. + +![GMP library error](http://blog.linoxide.com/wp-content/uploads/2014/12/gmp-error.png) + +Therefore, first of all, install the GMP library using following command and then run the configure script. + +![gmp installation](http://blog.linoxide.com/wp-content/uploads/2014/12/gmp-installation1.png) + +However, if GMP is already installed and still above error exists then create soft link of libgmp.so library at /usr/lib , /lib/, /usr/lib/x86_64-linux-gnu/ paths in Ubuntu using following command. + + $ sudo ln -s /usr/lib/x86_64-linux-gnu/libgmp.so.10.1.3 /usr/lib/x86_64-linux-gnu/libgmp.so + +![softlink of libgmp.so library](http://blog.linoxide.com/wp-content/uploads/2014/12/softlink.png) + +After the creation of libgmp.so softlink, again run the ./configure script and it may find the gmp library. However, it may generate another error of gmp header file which is shown the following figure. + +![GMP header file issu](http://blog.linoxide.com/wp-content/uploads/2014/12/gmp-header.png) + +Install the libgmp-dev package using following command for the solution of above error. + + $sudo aptitude install libgmp-dev + +![Installation of Development library of GMP](http://blog.linoxide.com/wp-content/uploads/2014/12/gmp-dev.png) + +After installation of development package of gmp library, again run the configure script and if it does not produce any error, then the following output will be displayed. + +![Output of Configure scirpt](http://blog.linoxide.com/wp-content/uploads/2014/12/successful-run.png) + +Type the following commands for the compilation and installation of strongswan. + + $ sudo make ; sudo make install + +After the installation of strongswan , the Global configuration (strongswan.conf) and ipsec policy/secret configuration files (ipsec.conf/ipsec.secretes) are placed in **/usr/local/etc** directory. + +Strongswan can be used as tunnel or transport mode depends on our security need. It provides well known site-2-site and road warrior VPNs. It can be use easily with Cisco,Juniper devices. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/security/install-strongswan/ + +作者:[nido][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/naveeda/ +[1]:https://www.strongswan.org/ \ No newline at end of file diff --git a/sources/tech/20150205 Inxi--Find System And Hardware Information On Linux.md b/sources/tech/20150205 Inxi--Find System And Hardware Information On Linux.md new file mode 100644 index 0000000000..efdc243fc6 --- /dev/null +++ b/sources/tech/20150205 Inxi--Find System And Hardware Information On Linux.md @@ -0,0 +1,171 @@ +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 diff --git a/sources/tech/20150205 zBackup--A versatile deduplicating backup tool.md b/sources/tech/20150205 zBackup--A versatile deduplicating backup tool.md new file mode 100644 index 0000000000..62eee8521c --- /dev/null +++ b/sources/tech/20150205 zBackup--A versatile deduplicating backup tool.md @@ -0,0 +1,63 @@ +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/20150211 Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10.md b/sources/tech/20150211 Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10.md new file mode 100644 index 0000000000..fe2432f8b3 --- /dev/null +++ b/sources/tech/20150211 Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10.md @@ -0,0 +1,70 @@ +Install Linux-Dash (Web Based Monitoring tool) on Ubntu 14.10 +================================================================================ +A low-overhead monitoring web dashboard for a GNU/Linux machine. Simply drop-in the app and go!.Linux Dash's interface provides a detailed overview of all vital aspects of your server, including RAM and disk usage, network, installed software, users, and running processes. All information is organized into sections, and you can jump to a specific section using the buttons in the main toolbar. Linux Dash is not the most advanced monitoring tool out there, but it might be a good fit for users looking for a slick, lightweight, and easy to deploy application. + +### Linux-Dash Features ### + +A beautiful web-based dashboard for monitoring server info + +Live, on-demand monitoring of RAM, Load, Uptime, Disk Allocation, Users and many more system stats + +Drop-in install for servers with Apache2/nginx + PHP + +Click and drag to re-arrange widgets + +Support for wide range of linux server flavors + +### List of Current Widgets ### + +- General info +- Load Average +- RAM +- Disk Usage +- Users +- Software +- IP +- Internet Speed +- Online +- Processes +- Logs + +### Install Linux-dash on ubuntu server 14.10 ### + +First you need to make sure you have [Ubuntu LAMP server 14.10][1] installed and Now you have to install the following package + + sudo apt-get install php5-json unzip + +After the installation this module will enable for apache2 so you need to restart the apache2 server using the following command + + sudo service apache2 restart + +Now you need to download the linux-dash package and install + + wget https://github.com/afaqurk/linux-dash/archive/master.zip + + unzip master.zip + + sudo mv linux-dash-master/ /var/www/html/linux-dash-master/ + +Now you need to change the permissions using the following command + + sudo chmod 755 /var/www/html/linux-dash-master/ + +Now you need to go to http://serverip/linux-dash-master/ you should see similar to the following output + +![](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] +译者:[译者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.ubuntugeek.com/step-by-step-ubuntu-14-10-utopic-unicorn-lamp-server-setup.html diff --git a/sources/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md b/sources/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md new file mode 100644 index 0000000000..29bb770e5d --- /dev/null +++ b/sources/tech/20150211 Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules.md @@ -0,0 +1,270 @@ +Protect Apache Against Brute Force or DDoS Attacks Using Mod_Security and Mod_evasive Modules +================================================================================ +For those of you in the hosting business, or if you’re hosting your own servers and exposing them to the Internet, securing your systems against attackers must be a high priority. + +mod_security (an open source intrusion detection and prevention engine for web applications that integrates seamlessly with the web server) and mod_evasive are two very important tools that can be used to protect a web server against brute force or (D)DoS attacks. + +mod_evasive, as its name suggests, provides evasive capabilities while under attack, acting as an umbrella that shields web servers from such threats. + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Install-Mod_Security-Mod_evasive-in-CentOS.jpg) +Install Mod_Security and Mod_Evasive to Protect Apache + +In this article we will discuss how to install, configure, and put them into play along with Apache on RHEL/CentOS 6 and 7 as well as Fedora 21-15. In addition, we will simulate attacks in order to verify that the server reacts accordingly. + +This assumes that you have a LAMP server installed on your system. If not, please check this article before proceeding further. + +- [Install LAMP stack in RHEL/CentOS 7][1] + +You will also need to setup iptables as the default [firewall][2] front-end instead of firewalld if you’re running RHEL/CentOS 7 or Fedora 21. We do this in order to use the same tool in both RHEL/CentOS 7/6 and Fedora 21. + +### Step 1: Installing Iptables Firewall on RHEL/CentOS 7 and Fedora 21 ### + +To begin, stop and disable firewalld: + + # systemctl stop firewalld + # systemctl disable firewalld + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Disable-Firewalld-Service.png) +Disable Firewalld Service + +Then install the iptables-services package before enabling iptables: + + # 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) +Install Iptables Firewall + +### Step 2: Installing Mod_Security and Mod_evasive ### + +In addition to having a LAMP setup already in place, you will also have to [enable the EPEL repository][3] in RHEL/CentOS 7/6 in order to install both packages. Fedora users don’t need to enable any repo, because epel is a already part of Fedora project. + + # yum update && yum install mod_security mod_evasive + +When the installation is complete, you will find the configuration files for both tools in /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 Configurations + +Now, in order to integrate these two modules with Apache and have it load them when it starts, make sure the following lines appear in the top level section of mod_evasive.conf and mod_security.conf, respectively: + + LoadModule evasive20_module modules/mod_evasive24.so + LoadModule security2_module modules/mod_security2.so + +Note that modules/mod_security2.so and modules/mod_evasive24.so are the relative paths, from the /etc/httpd directory to the source file of the module. You can verify this (and change it, if needed) by listing the contents of the /etc/httpd/modules directory: + + # 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) +Verify mod_security + mod_evasive Modules + +Then restart Apache and verify that it loads mod_evasive and mod_security: + + # service httpd restart [On RHEL/CentOS 6 and Fedora 20-18] + # systemctl restart httpd [On RHEL/CentOS 7 and Fedora 21] + +---------- + + [Dump a list of loaded Static and Shared Modules] + + # httpd -M | grep -Ei '(evasive|security)' + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Check-mod_security-mod_evasive-Loaded.png) +Check mod_security + mod_evasive Modules Loaded + +### Step 3: Installing A Core Rule Set and Configuring Mod_Security ### + +In few words, a Core Rule Set (aka CRS) provides the web server with instructions on how to behave under certain conditions. The developer firm of mod_security provide a free CRS called OWASP ([Open Web Application Security Project][4]) ModSecurity CRS that can be downloaded and installed as follows. + +1. Download the OWASP CRS to a directory created for that purpose. + + # 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) +Download mod_security Core Rules + +2. Untar the CRS file and change the name of the directory for one of our convenience. + + # 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) +Extract mod_security Core Rules + +3. Now it’s time to configure mod_security. Copy the sample file with rules (owasp-modsecurity-crs/modsecurity_crs_10_setup.conf.example) into another file without the .example extension: + + # cp modsecurity_crs_10_setup.conf.example modsecurity_crs_10_setup.conf + +and tell Apache to use this file along with the module by inserting the following lines in the web server’s main configuration file /etc/httpd/conf/httpd.conf file. If you chose to unpack the tarball in another directory you will need to edit the paths following the Include directives: + + + Include crs-tecmint/owasp-modsecurity-crs/modsecurity_crs_10_setup.conf + Include crs-tecmint/owasp-modsecurity-crs/base_rules/*.conf + + +Finally, it is recommended that we create our own configuration file within the /etc/httpd/modsecurity.d directory where we will place our customized directives (we will name it tecmint.conf in the following example) instead of modifying the CRS files directly. Doing so will allow for easier upgrading the CRSs as new versions are released. + + + SecRuleEngine On + SecRequestBodyAccess On + SecResponseBodyAccess On + SecResponseBodyMimeType text/plain text/html text/xml application/octet-stream + SecDataDir /tmp + + +You can refer to the [SpiderLabs’ ModSecurity GitHub][5] repository for a complete explanatory guide of mod_security configuration directives. + +### Step 4: Configuring Mod_Evasive ### + +mod_evasive is configured using directives in /etc/httpd/conf.d/mod_evasive.conf. Since there are no rules to update during a package upgrade, we don’t need a separate file to add customized directives, as opposed to mod_security. + +The default mod_evasive.conf file has the following directives enabled (note that this file is heavily commented, so we have stripped out the comments to highlight the configuration directives below): + + + DOSHashTableSize 3097 + DOSPageCount 2 + DOSSiteCount 50 + DOSPageInterval 1 + DOSSiteInterval 1 + DOSBlockingPeriod 10 + + +Explanation of the directives: + +- DOSHashTableSize: This directive specifies the size of the hash table that is used to keep track of activity on a per-IP address basis. Increasing this number will provide a faster look up of the sites that the client has visited in the past, but may impact overall performance if it is set too high. +- DOSPageCount: Legitimate number of identical requests to a specific URI (for example, any file that is being served by Apache) that can be made by a visitor over the DOSPageInterval interval. +- DOSSiteCount: Similar to DOSPageCount, but refers to how many overall requests can be made to the entire site over the DOSSiteInterval interval. +- DOSBlockingPeriod: If a visitor exceeds the limits set by DOSSPageCount or DOSSiteCount, his source IP address will be blacklisted during the DOSBlockingPeriod amount of time. During DOSBlockingPeriod, any requests coming from that IP address will encounter a 403 Forbidden error. + +Feel free to experiment with these values so that your web server will be able to handle the required amount and type of traffic. + +**Only a small caveat**: if these values are not set properly, you run the risk of ending up blocking legitimate visitors. + +You may also want to consider other useful directives: + +#### DOSEmailNotify #### + +If you have a mail server up and running, you can send out warning messages via Apache. Note that you will need to grant the apache user SELinux permission to send emails if SELinux is set to enforcing. You can do so by running + + # setsebool -P httpd_can_sendmail 1 + +Next, add this directive in the mod_evasive.conf file with the rest of the other directives: + + DOSEmailNotify you@yourdomain.com + +If this value is set and your mail server is working properly, an email will be sent to the address specified whenever an IP address becomes blacklisted. + +#### DOSSystemCommand #### + +This needs a valid system command as argument, + + DOSSystemCommand + +This directive specifies a command to be executed whenever an IP address becomes blacklisted. It is often used in conjunction with a shell script that adds a firewall rule to block further connections coming from that IP address. + +**Write a shell script that handles IP blacklisting at the firewall level** + +When an IP address becomes blacklisted, we need to block future connections coming from it. We will use the following shell script that performs this job. Create a directory named scripts-tecmint (or whatever name of your choice) in /usr/local/bin and a file called ban_ip.sh in that directory. + + #!/bin/sh + # IP that will be blocked, as detected by mod_evasive + IP=$1 + # Full path to iptables + IPTABLES="/sbin/iptables" + # mod_evasive lock directory + MOD_EVASIVE_LOGDIR=/var/log/mod_evasive + # Add the following firewall rule (block all traffic coming from $IP) + $IPTABLES -I INPUT -s $IP -j DROP + # Remove lock file for future checks + rm -f "$MOD_EVASIVE_LOGDIR"/dos-"$IP" + +Our DOSSystemCommand directive should read as follows: + + DOSSystemCommand "sudo /usr/local/bin/scripts-tecmint/ban_ip.sh %s" + +In the line above, %s represents the offending IP as detected by mod_evasive. + +**Add the apache user to the sudoers file** + +Note that all of this just won’t work unless you to give permissions to user apache to run our script (and that script only!) without a terminal and password. As usual, you can just type visudo as root to access the /etc/sudoers file and then add the following 2 lines as shown in the image below: + + 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) +Add Apache User to Sudoers + +**IMPORTANT**: As a default security policy, you can only run sudo in a terminal. Since in this case we need to use sudo without a tty, we have to comment out the line that is highlighted in the following image: + + #Defaults requiretty + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Disable-tty-for-Sudo.png) +Disable tty for Sudo + +Finally, restart the web server: + + # service httpd restart [On RHEL/CentOS 6 and Fedora 20-18] + # systemctl restart httpd [On RHEL/CentOS 7 and Fedora 21] + +### Step 4: Simulating an DDoS Attacks on Apache ### + +There are several tools that you can use to simulate an external attack on your server. You can just google for “tools for simulating ddos attacks” to find several of them. + +Note that you, and only you, will be held responsible for the results of your simulation. Do not even think of launching a simulated attack to a server that you’re not hosting within your own network. + +Should you want to do the same with a VPS that is hosted by someone else, you need to appropriately warn your hosting provider or ask permission for such a traffic flood to go through their networks. Tecmint.com is not, by any means, responsible for your acts! + +In addition, launching a simulated DoS attack from only one host does not represent a real life attack. To simulate such, you would need to target your server from several clients at the same time. + +Our test environment is composed of a CentOS 7 server [IP 192.168.0.17] and a Windows host from which we will launch the attack [IP 192.168.0.103]: + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Confirm-Host-IPAddress.png) +Confirm Host IPAddress + +Please play the video below and follow the steps outlined in the indicated order to simulate a simple DoS attack: + +注:youtube视频,发布的时候不行做个链接吧 + + +Then the offending IP is blocked by iptables: + +![](http://www.tecmint.com/wp-content/uploads/2012/06/Blocked-Attacker-IP.png) +Blocked Attacker IP + +### Conclusion ### + +With mod_security and mod_evasive enabled, the simulated attack causes the CPU and RAM to experiment a temporary usage peak for only a couple of seconds before the source IPs are blacklisted and blocked by the firewall. Without these tools, the simulation will surely knock down the server very fast and render it unusable during the duration of the attack. + +We would love to hear if you’re planning on using (or have used in the past) these tools. We always look forward to hearing from you, so don’t hesitate to leave your comments and questions, if any, using the form below. + +### Reference Links ### + +- [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] +译者:[译者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/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/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/20150225 Linux FAQs with Answers--How to disable IPv6 on Linux.md b/sources/tech/20150225 Linux FAQs with Answers--How to disable IPv6 on Linux.md new file mode 100644 index 0000000000..c6f0cde895 --- /dev/null +++ b/sources/tech/20150225 Linux FAQs with Answers--How to disable IPv6 on Linux.md @@ -0,0 +1,148 @@ +Linux FAQs with Answers--How to disable IPv6 on Linux +================================================================================ +> **Question**: I notice that one of my applications is trying to establish a connection over IPv6. But since our local network is not able to route IPv6 traffic, the IPv6 connection times out, and the application falls back to IPv4, which causes unnecessary delay. As I don't have any need for IPv6 at the moment, I would like to disable IPv6 on my Linux box. What is a proper way to turn off IPv6 on Linux? + +IPv6 has been introduced as a replacement of IPv4, the traditional 32-bit address space used in the Internet, to solve the imminent exhaustion of available IPv4 address space. However, since IPv4 has been used by every host or device connected to the Internet, it is practically impossible to switch every one of them to IPv6 overnight. Numerous IPv4 to IPv6 transition mechanisms (e.g., dual IP stack, tunneling, proxying) have been proposed to facilitate the adoption of IPv6, and many applications are being rewritten, as we speak, to add support for IPv6. One thing for sure is that IPv4 and IPv6 will inevitably coexist for the forseeable future. + +Ideally the [ongoing IPv6 transition process][1] should not be visible to end users, but the mixed IPv4/IPv6 environment might sometimes cause you to encounter various hiccups originating from unintended interaction between IPv4 and IPv6. For example, you may experience timeouts from applications such as apt-get or ssh trying to unsuccessfully connecting via IPv6, DNS server accidentally dropping AAAA DNS records for IPv6, or your IPv6-capable device not compatible with your ISP's legacy IPv4 network, etc. + +Of course this doesn't mean that you should blindly disable IPv6 on you Linux box. With all the benefits promised by IPv6, we as a society want to fully embrace it eventually, but as part of troubleshooting process for end-user experienced hiccups, you may try turning off IPv6 to see if indeed IPv6 is a culprit. + +Here are a few techniques allowing you to disable IPv6 partially (e.g., for a certain network interface) or completely on Linux. These tips should be applicable to all major Linux distributions including Ubuntu, Debian, Linux Mint, CentOS, Fedora, RHEL, and Arch Linux. + +### Check if IPv6 is Enabled on Linux ### + +All modern Linux distributions have IPv6 automatically enabled by default. To see IPv6 is activated on your Linux, use ifconfig or ip commands. If you see "inet6" in the output of these commands, this means your Linux has IPv6 enabled. + + $ ifconfig + +![](https://farm8.staticflickr.com/7282/16415082398_5fb0920506_b.jpg) + + $ ip addr + +![](https://farm8.staticflickr.com/7290/16415082248_c4e075548b_c.jpg) + +### Disable IPv6 Temporarily ### + +If you want to turn off IPv6 temporarily on your Linux system, you can use /proc file system. By "temporarily", we mean that the change we make to disable IPv6 will not be preserved across reboots. IPv6 will be enabled back again after you reboot your Linux box. + +To disable IPv6 for a particular network interface, use the following command. + + $ sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf//disable_ipv6' + +For example, to disable IPv6 for eth0 interface: + + $ sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' + +![](https://farm8.staticflickr.com/7288/15982511863_0c1feafe7f_b.jpg) + +To enable IPv6 back on eth0 interface: + + $ sudo sh -c 'echo 0 > /proc/sys/net/ipv6/conf/eth0/disable_ipv6' + +If you want to disable IPv6 system-wide for all interfaces including loopback interface, use this command: + + $ sudo sh -c 'echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6' + +### Disable IPv6 Permanently across Reboots ### + +The above method does not permanently disable IPv6 across reboots. IPv6 will be activated again once you reboot your system. If you want to turn off IPv6 for good, there are several ways you can do it. + +#### Method One #### + +The first method is to apply the above /proc changes persistently in /etc/sysctl.conf file. + +That is, open /etc/sysctl.conf with a text editor, and add the following lines. + + # to disable IPv6 on all interfaces system wide + net.ipv6.conf.all.disable_ipv6 = 1 + + # to disable IPv6 on a specific interface (e.g., eth0, lo) + net.ipv6.conf.lo.disable_ipv6 = 1 + net.ipv6.conf.eth0.disable_ipv6 = 1 + +To activate these changes in /etc/sysctl.conf, run: + + $ sudo sysctl -p /etc/sysctl.conf + +or simply reboot. + +#### Method Two #### + +An alternative way to disable IPv6 permanently is to pass a necessary kernel parameter via GRUB/GRUB2 during boot time. + +Open /etc/default/grub with a text editor, and add "ipv6.disable=1" to GRUB_CMDLINE_LINUX variable. + + $ sudo vi /etc/default/grub + +---------- + + GRUB_CMDLINE_LINUX="xxxxx ipv6.disable=1" + +In the above, "xxxxx" denotes any existing kernel parameter(s). Add "ipv6.disable=1" after them. + +![](https://farm8.staticflickr.com/7286/15982512103_ec5d940e58_b.jpg) + +Finally, don't forget to apply the modified GRUB/GRUB2 settings by running: + +On Debian, Ubuntu or Linux Mint: + + $ sudo update-grub + +On Fedora, CentOS/RHEL: + + $ sudo grub2-mkconfig -o /boot/grub2/grub.cfg + +Now IPv6 will be completely disabled once you reboot your Linux system. + +### Other Optional Steps after Disabling IPv6 ### + +Here are a few optional steps you can consider after disabling IPv6. This is because while you disable IPv6 in the kernel, other programs may still try to use IPv6. In most cases, such application behaviors will not break things, but you want to disable IPv6 for them for efficiency or safety reason. + +#### /etc/hosts #### + +Depending on your setup, /etc/hosts may contain one or more IPv6 hosts and their addresses. Open /etc/hosts with a text editor, and comment out all lines which contain 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 #### + +If you are using NetworkManager to manage your network settings, you can disable IPv6 on NetworkManager as follows. Open the wired connection on NetworkManager, click on "IPv6 Settings" tab, and choose "Ignore" in "Method" field. Save the change and exit. + +![](https://farm8.staticflickr.com/7293/16394993017_21917f027b_o.png) + +#### SSH server #### + +By default, OpenSSH server (sshd) tries to bind on both IPv4 and IPv6 addresses. + +To force sshd to bind only on IPv4 address, open /etc/ssh/sshd_config with a text editor, and add the following line. inet is for IPv4 only, and inet6 is for IPv6 only. + + $ sudo vi /etc/ssh/sshd_config + +---------- + + AddressFamily inet + +and restart sshd server. + +-------------------------------------------------------------------------------- + +via: http://ask.xmodulo.com/disable-ipv6-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://ask.xmodulo.com/author/nanni +[1]:http://www.google.com/intl/en/ipv6/statistics.html \ No newline at end of file diff --git a/sources/tech/20150227 Enjoy Android Apps on Ubuntu using ARChon Runtime.md b/sources/tech/20150227 Enjoy Android Apps on Ubuntu using ARChon Runtime.md new file mode 100644 index 0000000000..f85b2cf725 --- /dev/null +++ b/sources/tech/20150227 Enjoy Android Apps on Ubuntu using ARChon Runtime.md @@ -0,0 +1,114 @@ +Enjoy Android Apps on Ubuntu using ARChon Runtime +================================================================================ +Before, we gave try to many android app emulating tools like Genymotion, Virtualbox, Android SDK, etc to try to run android apps on it. But, with this new Chrome Android Runtime, we are able to run Android Apps on our Chrome Browser. So, here are the steps we'll need to follow to install Android Apps on Ubuntu using ARChon Runtime. + +Google had [announced the first set of Android apps is ready to run natively on Chrome OS][1], a feature made possible using a new ‘**Android Runtime**’ extension. Now, a developer named Vlad Filippov has figured out a way to bring Android Apps to Chrome on the desktop. His chromeos-apk script and ARChon Android Runtime extension work hand-in-hand to bring Android apps to Chrome browser on the Windows, Mac and Linux desktop. + +Performance of this apps through the runtime is not pretty good. Similarly, as its both an unofficial repackaging of the official runtime and running outside of Google's Chrome OS, system integration like webcam, speakers, etc. may be patchy or non-existent. + +### Installing Chrome ### + +First of all, we'll need Chrome installed in our machine, Chrome version 37 or higher is required. We can download them from the [download page of Chrome Browser][2]. + +If you wanna install a Dev Channel version you'll need to follow below procedure. + +We'll need to add repository source list for Google Chrome which can be done my using the following command. + + $ 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) + +After adding the repository source list, we'll need to update the local repository index by the command below. + + $ sudo apt-get update + +Now, we'll gonna install google chrome unstable which is dev version. + + $ 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) + +### Installing Archon Runtime ### + +Next we'll need to download the custom-made ergo officially not endorsed by Google or Chromium Android Runtime created by Vlad Filippov. This differs from the official version in a number of ways, the chief being it can be used on desktop versions of the browser. Here below is the runtime we need to download, please select anyone of the following according to your bit of Ubuntu installed. + +For **32-bit** Ubuntu Distributions: + +- [Download Archron for 32-bit Ubuntu][3] + +For **64-bit** Ubuntu Distributions: + +- [Download Archron for 64-bit Ubuntu][4] + +Once the runtime has fully downloaded you will need to extract the contents from the .zip files and move the resulting directory to Home. Here is the gist commands for this steps to download and extract the contents. + + $ 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 ~/ + +Now to install the runtime, we'll gonna Open our latest Google Chrome and goto the url **chrome://extensions/** then, we'll need to check ‘**Enable developer mode**’. Finally, we'll gonna click on the ‘**load unpacked extension**’ button and select the folder which was placed into **~/Home**. + +### Installing ChromeOS-APK ### + +To convert APKs manually is something you really don’t need to do any more if you use one of the apps mentioned above — you will need to install the ‘[chromeos-apk][5]’ command line JavaScript utility. This is available to install through the Node Packaged Modules (npm) manager. To install nmp and chromeos-apk, we'll need to run the following command in a shell or terminal. + + $ sudo apt-get install npm nodejs nodejs-legacy + +**If you are running 64 bit OS**, you should grab the following library, to do so run the below commands in a shell or terminal. + + $ sudo apt-get install lib32stdc++6 + +Now run the command to install the the latest chromeos-apk is: + + $ npm install -g chromeos-apk@latest + +![chromeos apk installation](http://blog.linoxide.com/wp-content/uploads/2015/02/chomeos-apk-installation.png) + +Depending on your system configuration you may need to need to run this latter command as sudo. + +Now, we'll gonna for Google to find an APK of an app to give it a try, bearing in mind **not all Android apps will work**, and those that do may be unstable or lack features. Most of the messenger out of the box are not working. + +### Converting APK ### + +Place your **Android APK in ~/Home**, then return to **Terminal** to convert it using the following command: + + $ chromeos-apk myapp.apk --archon + +If you want the app in fullscreen mode then run the following instead: + + $ chromeos-apk myapp.apk --archon --tablet + +Note: Please replace myapp.apk to the Android APK app filename you want to convert. + +For our ease, we can also use [Twerk][6] for the conversion process if we want to skip this step. + +### Running Android Apk ### + +Finally, we'll need to open our chrome browser and then goto chrome://extensions page and enable developer mode then tap the ‘load unpacked extension’ button and select the folder the script above created. + +Now, we can Open the Chrome App Launcher to run it. + +### Conclusion ### + +Hurray! We have successfully installed Android Apk App in our favorite desktop browser ie Chrome Browser. This article is all about the popular Chrome Android Runtime called Archon created by Vlad Filippov. This runtime allows us to run converted Apk files in our Chrome browser. It has not yet supported messaging apps like Whatsapp, etc. So, if you have any questions, suggestions, feedback please write them in the comment box below. Thank you ! Enjoy Archon :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/android-apps-ubuntu-archon-runtime/ + +作者:[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://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/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/20150302 How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle.md b/sources/tech/20150302 How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle.md new file mode 100644 index 0000000000..ef1fee0680 --- /dev/null +++ b/sources/tech/20150302 How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle.md @@ -0,0 +1,298 @@ +theo-l translating + +How to Limit the Network Bandwidth Used by Applications in a Linux System with Trickle +================================================================================ +Have you ever encountered situations where one application dominated you all network bandwidth? If you have ever been in a situation where one application ate all your traffic, then you will value the role of the trickle bandwidth shaper application. Either you are a system admin or just a Linux user, you need to learn how to control the upload and download speeds for applications to make sure that your network bandwidth is not burned by a single application. + +![Install Trickle Bandwidth Limit in Linux](http://www.tecmint.com/wp-content/uploads/2013/11/Bandwidth-limit-trickle.png) +Install Trickle Bandwidth Limit in Linux + +### What is Trickle? ### + +Trickle is a network bandwidth shaper tool that allows us to manage the upload and download speeds of applications in order to prevent any single one of them to hog all (or most) of the available bandwidth. In few words, trickle lets you control the network traffic rate on a per-application basis, as opposed to per-user control, which is the classic example of bandwidth shaping in a client-server environment, and is probably the setup we are more familiar with. + +### How Trickle Works? ### + +In addition, trickle can help us to define priorities on a per-application basis, so that when overall limits have been set for the entire system, priority apps will still get more bandwidth automatically. To accomplish this task, trickle sets traffic limits to the way in which data is sent to, and received from, sockets using TCP connections. We must note that, other than the data transfer rates, trickle does not modify in any way the behavior of the process it is shaping at any given moment. + +### What Can’t Trickle do? ### + +The only limitation, so to speak, is that trickle will not work with statically linked applications or binaries with the SUID or SGID bits set since it uses dynamic linking and loading to place itself between the shaped process and its associated network socket. Trickle then acts as a proxy between these two software components. + +Since trickle does not require superuser privileges in order to run, users can set their own traffic limits. Since this may not be desirable, we will explore how to set overall limits that system users cannot exceed. In other words, users will still be able to manage their traffic rates, but always within the boundaries set by the system administrator. + +In this article we will explain how to limit the network bandwidth used by applications in a Linux server with trickle. To generate the necessary traffic, we will use ncftpput and ncftpget (both tools are available by installing ncftp) on the client (CentOS 7 server – dev1: 192.168.0.17), and vsftpd on the server (Debian Wheezy 7.5 – dev2: 192.168.0.15) for demonstration purposes. The same instructions also works on RedHat, Fedora and Ubuntu based systems. + +#### Prerequisites #### + +1. For RHEL/CentOS 7/6, [enable the EPEL repository][1]. Extra Packages for Enterprise Linux (EPEL) is a repository of high-quality free and open-source software maintained by the Fedora project and is 100% compatible with its spinoffs, such as Red Hat Enterprise Linux and CentOS. Both trickle and ncftp are made available from this repository. + +2. Install ncftp as follows: + + # yum update && sudo yum install ncftp [On RedHat based systems] + # aptitude update && aptitude install ncftp [On Debian based systems] + +3. Set up a FTP server in a separate server. Please note that although FTP is inherently insecure, it is still widely used in cases when security in uploading or downloading files is not needed. We are using it in this article to illustrate the bounties of trickle and because it shows the transfer rates in stdout on the client, and we will leave the discussion of whether it should or should not be used for another date and time :). + + # yum update && yum install vsftpd [On RedHat based systems] + # aptitude update && aptitude install vsftpd [On Debian based systems] + +Now, edit the /etc/vsftpd/vsftpd.conf file on the FTP server as follows: + + anonymous_enable=NO + local_enable=YES + chroot_local_user=YES + allow_writeable_chroot=YES + +After that, make sure to start vsftpd for your current session and to enable it for automatic start on future boots: + + # systemctl start vsftpd [For systemd-based systems] + # systemctl enable vsftpd + # service vsftpd start [For init-based systems] + # chkconfig vsftpd on + +4. If you chose to set up the FTP server in a CentOS/RHEL 7 droplet with SSH keys for remote access, you will need a password-protected user account with the appropriate directory and file permissions for uploading and downloading the desired content OUTSIDE root’s home directory. + +You can then browse to your home directory by entering the following URL in your browser. A login window will pop up prompting you for a valid user account and password on the FTP server. + + ftp://192.168.0.15 + +If the authentication succeeds, you will see the contents of your home directory. Later in this tutorial you will be able to refresh that page to display the files that have been uploaded during previous steps. + +![FTP Directory Tree](http://www.tecmint.com/wp-content/uploads/2013/11/FTP-Directory-Tree.png) +FTP Directory Tree + +### How to Install Trickle in Linux ### + +1. Install trickle via yum or aptitude. + +To ensure a successful installation, it is considered good practice to make sure the currently installed packages are up-to-date (using yum update) before installing the tool itself. + + # yum -y update && yum install trickle [On RedHat based systems] + # aptitude -y update && aptitude install trickle [On Debian based systems] + +2. Verify whether trickle will work with the desired binary. + +As we explained earlier, trickle will only work with binaries using dynamic, or shared, libraries. To verify whether we can use this tool with a certain application, we can use the well-known ldd utility, where ldd stands for list dynamic dependencies. Specifically, we will look for the presence of glibc (the GNU C library) in the list of dynamic dependencies of any given program because it is precisely that library which defines the system calls involved in communication through sockets. + +Run the following command against a given binary to see if trickle can be used to shape its bandwidth: + + # ldd $(which [binary]) | grep libc.so + +For example, + + # ldd $(which ncftp) | grep libc.so + +whose output is: + + # libc.so.6 => /lib64/libc.so.6 (0x00007efff2e6c000) + +The string between brackets in the output may change from system to system and even between subsequent runs of the same command, since it represents the load address of the library in physical memory. + +If the above command does not return any results, it means that the binary it was run against does not use libc and thus trickle cannot be used as bandwidth shaper in that case. + +### Learn How to Use Trickle ### + +The most basic usage of trickle is in standalone mode. Using this approach, trickle is used to explicitly define the download and upload speeds of a given application. As we explained earlier, for the sake of brevity, we will use the same application for download and upload tests. + +#### Running Trickle in Standalone Mode #### + +We will compare the download and upload speeds with and without using trickle. The -d option indicates the download speed in KB/s, while the -u flag tells trickle to limit the upload speed by the same unit. In addition, we will use the -s flag, which specifies that trickle should run in standalone mode. + +The basic syntax to run trickle in standalone mode is as follows: + + # trickle -s -d [download rate in KB/s] -u [upload rate in KB/s] + +In order to perform the following examples on your own, make sure to have trickle and ncftp installed on the client machine (192.168.0.17 in my case). + +**Example 1: Uploading a 2.8 MB PDF file with and without trickle.** + +We are using the freely-distributable Linux Fundamentals PDF file (available from [here][2]) for the following tests. + +You can initially download this file to your current working directory with the following command: + + # wget http://linux-training.be/files/books/LinuxFun.pdf + +The syntax to upload a file to our FTP server without trickle is as follows: + + # ncftpput -u username -p password 192.168.0.15 /remote_directory local-filename + +Where /remote_directory is the path of the upload directory relative to username’s home, and local-filename is a file in your current working directory. + +Specifically, without trickle we get a peak upload speed of 52.02 MB/s (please note that this is not the real average upload speed, but an instant starting peak), and the file gets uploaded almost instantly: + + # ncftpput -u username -p password 192.168.0.15 /testdir LinuxFun.pdf + +Output: + + LinuxFun.pdf: 2.79 MB 52.02 MB/s + +With trickle, we will limit the upload transfer rate at 5 KB/s. Before uploading the file for the second time, we need to delete it from the destination directory; otherwise, ncftp will inform us that the file at the destination directory is the same that we are trying to upload, and will not perform the transfer: + + # rm /absolute/path/to/destination/directory/LinuxFun.pdf + +Then: + + # trickle -s -u 5 ncftpput -u username -p password 111.111.111.111 /testdir LinuxFun.pdf + +Output: + + LinuxFun.pdf: 2.79 MB 4.94 kB/s + +In the example above, we can see that the average upload speed dropped to ~5 KB/s. + +**Example 2: Downloading the same 2.8 MB PDF file with and without trickle** + +First, remember to delete the PDF from the original source directory: + + # rm /absolute/path/to/source/directory/LinuxFun.pdf + +Please note that the following cases will download the remote file to the current directory in the client machine. This fact is indicated by the period (‘.‘) that appears after the IP address of the FTP server. + +Without trickle: + + # ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf + +Output: + + LinuxFun.pdf: 2.79 MB 260.53 MB/s + +With trickle, limiting the download speed at 20 KB/s: + + # trickle -s -d 30 ncftpget -u username -p password 111.111.111.111 . /testdir/LinuxFun.pdf + +Output: + + LinuxFun.pdf: 2.79 MB 17.76 kB/s + +### Running Trickle in Supervised [unmanaged] Mode ### + +Trickle can also run in unmanaged mode, following a series of parameters defined in /etc/trickled.conf. This file defines how trickled (the daemon) behaves and manages trickle. + +In addition, if we want to set global settings to be used, overall, by all applications, we will need to use the trickled command. This command runs the daemon and allows us to define download and upload limits that will be shared by all the applications run through trickle without us needing to specify limits each time. + +For example, running: + + # trickled -d 50 -u 10 + +Will cause that the download and upload speeds of any application run through trickle be limited to 30 KB/s and 10 KB/s, respectively. + +Please note that you can check at any time whether trickled is running and with what arguments: + + # ps -ef | grep trickled | grep -v grep + +Output: + + root 16475 1 0 Dec24 ? 00:00:04 trickled -d 50 -u 10 + +**Example 3: Uploading a 19 MB mp4 file to our FTP server using with and without trickle.** + +In this example we will use the freely-distributable “He is the gift” video, available for download from [this link][3]. + +We will initially download this file to your current working directory with the following command: + + # wget http://media2.ldscdn.org/assets/missionary/our-people-2014/2014-00-1460-he-is-the-gift-360p-eng.mp4 + +First off, we will start the trickled daemon with the command listed above: + + # trickled -d 30 -u 10 + +Without trickle: + + # ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4 + +Output: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 36.31 MB/s + +With trickle: + + # trickle ncftpput -u username -p password 192.168.0.15 /testdir 2014-00-1460-he-is-the-gift-360p-eng.mp4 + +Output: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 9.51 kB/s + +As we can see in the output above, the upload transfer rate dropped to ~10 KB/s. + +**Example 4: Downloading the same video with and without trickle** + +As in Example 2, we will be downloading the file to the current working directory. + +Without trickle: + + # ncftpget -u username -p password 192.168.0.15 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4 + +Output: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 108.34 MB/s + +With trickle: + + # trickle ncftpget -u username -p password 111.111.111.111 . /testdir/2014-00-1460-he-is-the-gift-360p-eng.mp4 + +Output: + + 2014-00-1460-he-is-the-gift-360p-eng.mp4: 18.53 MB 29.28 kB/s + +Which is in accordance with the download limit set earlier (30 KB/s). + +**Note:** That once the daemon has been started, there is no need to set individual limits for each application that uses trickle. + +As we mentioned earlier, one can further customize trickle’s bandwidth shaping through trickled.conf. A typical section in this file consists of the following: + + [service] + Priority = + Time-Smoothing = + Length-Smoothing = + +Where, + +- [service] indicates the name of the application whose bandwidth usage we intend to shape. +- Priority allows us to specify a service to have a higher priority relative to another, thus not allowing a single application to hog all the bandwidth which the daemon is managing. The lower the number, the more bandwidth that is assigned to [service]. +- Time-Smoothing [in seconds]: defines with what time intervals trickled will try to let the application transfer and / or receive data. Smaller values (something between the range of 0.1 – 1s) are ideal for interactive applications and will result in a more continuous (smooth) session while slightly larger values (1 – 10 s) are better for applications that need bulk transfer. If no value is specified, the default (5 s) is used. +- Length-Smoothing [in KB]: the idea is the same as in Time-Smoothing, but based on the length of an I/O operation. If no value is specified, the default (10 KB) is used. + +Changing the smoothing values will translate into the application specified by [service] using transfer rates within an interval instead of a fixed value. Unfortunately, there is no formula to calculate the lower and upper limits of this interval as it mainly depends of each specific case scenario. + +The following is a trickled.conf sample file in the CentOS 7 client (192.168.0.17): + + [ssh] + Priority = 1 + Time-Smoothing = 0.1 + Length-Smoothing = 2 + + [ftp] + Priority = 2 + Time-Smoothing = 1 + Length-Smoothing = 3 + +Using this setup, trickled will prioritize SSH connections over FTP transfers. Note that an interactive process, such as SSH, uses smaller time-smoothing values, whereas a service that performs bulk data transfers (FTP) uses a greater value. The smoothing values are responsible for the download and upload speeds in our previous example not matching the exact value specified by the trickled daemon but moving in an interval close to it. + +### Conclusion ### + +In this article we have explored how to limit the bandwidth used by applications using trickle on Fedora-based distributions and Debian / derivatives. Other possible use cases include, but are not limited to: + +- Limiting the download speed via a system utility such as [wget][4], or a torrent client, for example. +- Limiting the speed at which your system can be updated via `[yum][5]` (or `[aptitude][6]`, if you’re in a Debian-based system), the package management system. +- If your server happens to be behind a proxy or firewall (or is the proxy or firewall itself), you can use trickle to set limits on both the download and upload, or communication speed with the clients or the outside. + +Questions and comments are most welcome. Feel free to use the form below to send them our way. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/manage-and-limit-downloadupload-bandwidth-with-trickle-in-linux/ + +作者:[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://www.tecmint.com/author/gacanepa/ +[1]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ +[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/sources/tech/20150316 5 Interesting Command Line Tips and Tricks in Linux--Part 1.md b/sources/tech/20150316 5 Interesting Command Line Tips and Tricks in Linux--Part 1.md new file mode 100644 index 0000000000..352fa2816c --- /dev/null +++ b/sources/tech/20150316 5 Interesting Command Line Tips and Tricks in Linux--Part 1.md @@ -0,0 +1,115 @@ +5 Interesting Command Line Tips and Tricks in Linux – Part 1 +================================================================================ +Are you making most out of the Linux? There are lots of helpful features which appears to be Tips and Tricks for many of Linux Users. Sometimes Tips and Tricks become the need. It helps you get productive with the same set of commands yet with enhanced functionality. + +![5 Command Line Tips and Tricks](http://www.tecmint.com/wp-content/uploads/2015/03/5-Command-Line-Tips.jpg) +5 Command Line Tips and Tricks + +Here we are starting a new series, where we will be writing some tips and tricks and will try to yield as more as we can in small time. + +### 1. To audit the commands we’d run in past, we use [history command][1]. Here is a sample output of history command. ### + + # history + +![history command example](http://www.tecmint.com/wp-content/uploads/2015/03/history-command.gif) +history command example + +Obvious from output, the history command do not output the time stamp with the log of last executed commands. Any solution for this? Yeah! Run the below command. + + # HISTTIMEFORMAT="%d/%m/%y %T " + # history + +If you want to permanently append this change, add the below line to `~/.bashrc`. + + export HISTTIMEFORMAT="%d/%m/%y %T " + +and then, from terminal run, + + # source ~/.bashrc + +Explanation of commands and switches. + +- history – GNU History Library +- HISTIMEFORMAT – Environmental Variable +- %d – Day +- %m – Month +- %y – Year +- %T – Time Stamp +- source – in short send the contents of file to shell +- .bashrc – is a shell script that BASH runs whenever it is started interactively. + +![history Command Logs](http://www.tecmint.com/wp-content/uploads/2015/03/History-Command-Logs.gif) +history Command Logs + +### 2. The next gem in the list is – how to check disk write speed? Well one liner dd command script serves the purpose. ### + + # dd if=/dev/zero of=/tmp/output.img bs=8k count=256k conv=fdatasync; rm -rf /tmp/output.img + +![dd Command Example](http://www.tecmint.com/wp-content/uploads/2015/03/dd-Command-Example.gif) +dd Command Example + +Explanation of commands and switches. + +- dd – Convert and Copy a file +- if=/dev/zero – Read the file and not stdin +- of=/tmp/output.img – Write to file and not stdout +- bs – Read and Write maximum upto M bytes, at one time +- count – Copy N input block +- conv – Convert the file as per comma separated symbol list. +- rm – Removes files and folder +- -rf – (-r) removes directories and contents recursively and (-f) Force the removal without prompt. + +### 3. How will you check the top six files that are eating out your space? A simple one liner script made from [du command][2], which is primarily used as file space usages. ### + + # du -hsx * | sort -rh | head -6 + +![Check Disk Space Usage](http://www.tecmint.com/wp-content/uploads/2015/03/check-disk-space-usage.gif) +Check Disk Space Usage + +Explanation of commands and switches. + +- du – Estimate file space usages +- -hsx – (-h) Human Readable Format, (-s) Summaries Output, (-x) One File Format, skip directories on other file format. +- sort – Sort text file lines +- -rf – (-r) Reverse the result of comparison, (-f) Ignore case +- head – output first n lines of file. + +### 4. The next step involves statistics in terminal of a file of every kind. We can output the statistics related to a file with the help of stat (output file/fileSystem status) command. ### + + # stat filename_ext (viz., stat abc.pdf) + +![Check File Statistics](http://www.tecmint.com/wp-content/uploads/2015/03/Check-File-Statistics.gif) +Check File Statistics + +### 5. The next and last but not the least, this one line script is for those, who are newbies. If you are an experienced user you probably don’t need it, unless you want some fun out of it. Well newbies are Linux-command-line phobic and the below one liner will generate random man pages. The benefit is as a newbie you always get something to learn and never get bored. ### + + # man $(ls /bin | shuf | head -1) + +![Generate Random Man Pages](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Man-Pages.gif) +Generate Random Man Pages + +Explanation of commands and switches. + +- man – Linux Man pages +- ls – Linux Listing Commands +- /bin – System Binary file Location +- shuf – Generate Random Permutation +- head – Output first n line of file. + +That’s all for now. If you know any such tips and tricks you may share with us and we will post the same in your words on our reputed Tecmint.com website. + +If you want to share any tips and tricks that you cannot make into article you may share it at tecmint[dot]com[at]gmail[dot]com and we will include it in our article. Don’t forget to provide us with your valuable feedback in the comments below. Keep connected. Like and share us and help us get spread. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/5-linux-command-line-tricks/ + +作者:[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/history-command-examples/ +[2]:http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/ \ 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..a2e5ebc1d8 --- /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/ \ No newline at end of file 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..570217f220 --- /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/ + +译者:[译者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/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..7554abd392 --- /dev/null +++ b/sources/tech/20150318 How to Use LVM on Ubuntu for Easy Partition Resizing and Snapshots.md @@ -0,0 +1,67 @@ +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/20150318 How to share a directory with Samba on Fedora or CentOS.md b/sources/tech/20150318 How to share a directory with Samba on Fedora or CentOS.md new file mode 100644 index 0000000000..0c01862bff --- /dev/null +++ b/sources/tech/20150318 How to share a directory with Samba on Fedora or CentOS.md @@ -0,0 +1,144 @@ +How to share a directory with Samba on Fedora or CentOS +================================================================================ +Nowadays sharing data across different computers is not something new at home or many work places. Riding on this trend, modern operating systems make it easy to share and exchange data transparently across computers via network file systems. If your work environment involves a mix of Microsoft Windows and Linux computers, one way to share files and folders among them is via SMB/CIFS, a cross-platform network file sharing protocol. Windows Microsoft natively supports SMB/CIFS, while Linux offers free software implementation of SMB/CIFS network protocol in Samba. + +In this article, we will demonstrate **how to share a directory using Samba**. The Linux platform we will use is **Fedora or CentOS**. This article is dividied into four parts. First, we will install Samba under Fedora/CentOS environment. Next, we discuss how to adjust SELinux and firewall configurations to allow file sharing with Samba. Finally, we cover how to enable Samba to share a directory. + +### Step One: Install Samba on Fedora or CentOS ### + +First thing first. Let's install Samba and configure basic settings. + +Check whether Samba application is already installed on your system by running: + + $ rpm -q samba samba-common samba-client + +If the above command doesn't show anything at all, it means that Samba is not installed. In that case, install Samba using the command below. + + $ sudo yum install samba samba-common samba-client + +Next, creates a local directory which will share data over network. This directory will be exported to remote users as a Samba share. In this tutorial, we will create this directory in the top-level directory '/', so make sure that you have the privileges to do it. + + $ sudo mkdir /shared + +If you want to create a shared directory inside your home directory (e.g., ~/shared), you must activate Samba home directory sharing in the SELinux options, which will be described below in more detail. + +After creating /shared directory, set the privileges of the directory so other users can access it. + + $ sudo chmod o+rw /shared + +If you don't want other users to be able to have write to the directory, just remove the 'w' option in chmod command as follows. + + $ sudo chmod o+r /shared + +Next, create one empty file as a test. This file will be used to verify that he Samba share is mounted properly. + + $ sudo touch /shared/file1 + +### Step Two: Configure SELinux for Samba ### + +Next, we need to re-configure SELinux which is enabled by default in Fedora and CentOS distributions. SELinux allows Samba to read and modify files or directories only when they have the right security context (e.g., labeled with the 'samba_share_t' attribute). + +The following command adds the necessary label to file-context configuration: + + $ sudo semanage fcontext -a -t samba_share_t "(/.*)?" + +Replace the with the local directory we created earlier for Samba share (e.g., /shared): + + $ sudo semanage fcontext -a -t samba_share_t "/shared(/.*)?" + +To activate the label change, we then must run the restorecon command like below. + + $ sudo restorecon -R -v /shared + +![](https://farm9.staticflickr.com/8584/16652774078_2055f45f70_b.jpg) + +To share a directory inside our home directory via Samba, we must enable sharing home directory option in SELinux because it is disabled by default. The following command achieves the desired effect. Skip this step if you are not sharing your home directory. + + $ sudo setsebool -P samba_enable_home_dirs 1 + +### Step Three: Configure Firewall for Samba ### + +The next step is to open necessary TCP/UDP ports in the firewall settings for Samba to operate. + +If you are using firewalld (e.g., on Fedora or CentOS 7), the following command will take care of permanent firewall rule change for Samba service. + + $ sudo firewall-cmd --permanent --add-service=samba + +If you are using iptables for your firewall (e.g., CentOS 6 or earlier), use the following commands to open up necessary Samba ports to the world. + + $ 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 + +Then restart iptables service: + + $ sudo service iptables restart + +### Step Four: Change Samba Configuration ### + +The last step is to configure Samba to export a created local directory as a Samba-share. + +Open the Samba configuration file with a text editor, and add the following lines at the bottom of the file. + + $ sudo nano /etc/samba/smb.conf + +---------- + + [myshare] + comment=my shared files + path=/shared + public=yes + writeable=yes + +In the above the text inside a pair of brackets (e.g., "myshare") is the name of the Samba-shared resource, which will be used to access the Samba share from a remote host. + +Create a Samba user account which is required to mount and export the Samba file system. To create a Samba user, use the smbpasswd tool. Note that the Samba user account must be the same as any existing Linux user. If you try to add a non-existing user with smbpasswd, it will give an error message. + +If you don't want to use any existing Linux user as a Samba user, you can create a new dedicated user in your system. For safety, set the new user's login shell to /sbin/nologin, and do not create its home directory. + +In this example, we are creating a new user named "sambaguest" as follows. + + $ sudo useradd -M -s /sbin/nologin sambaguest + $ sudo passwd sambaguest + +![](https://farm9.staticflickr.com/8702/16814479366_53f540d3ba_b.jpg) + +After creating a new user, add the user as a Samba user using smbpasswd command. When this command asks a password, you can type a different password than the user's password. + + $ sudo smbpasswd -a sambaguest + +4. Activate the Samba service, and check whether the Samba service is running or not. + + $ sudo systemctl enable smb.service + $ sudo systemctl start smb.service + $ sudo systemctl is-active smb + +![](https://farm8.staticflickr.com/7607/16652984770_622f24bccc_b.jpg) + +To see the list of shared directories in Samba, type the following command. + + $ smbclient -U sambaguest -L localhost + +![](https://farm8.staticflickr.com/7281/16220411103_06bf585901_b.jpg) + +The following is a screenshot of accessing the Samba-shared directory on Thunar file manager, and doing copy-paste of file1. Note that the Samba share is accessible via "smb:///myshare" address on Thunar. + +![](https://farm8.staticflickr.com/7644/16218011174_c8b34fcedc_b.jpg) + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/share-directory-samba-fedora-centos.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 \ No newline at end of file diff --git a/sources/tech/20150320 Sleuth Kit--Open Source Forensic Tool to Analyze Disk Images and Recover Files.md b/sources/tech/20150320 Sleuth Kit--Open Source Forensic Tool to Analyze Disk Images and Recover Files.md new file mode 100644 index 0000000000..4e8461528e --- /dev/null +++ b/sources/tech/20150320 Sleuth Kit--Open Source Forensic Tool to Analyze Disk Images and Recover Files.md @@ -0,0 +1,162 @@ + +tranlating by haimingfg + +Sleuth Kit - Open Source Forensic Tool to Analyze Disk Images and Recover Files +================================================================================ +SIFT is a Ubuntu based forensics distribution provided by SANS Inc. It consist of many forensics tools such as Sleuth kit / Autopsy etc . However, Sleuth kit/Autopsy tools can be installed on Ubuntu/Fedora distribution instead of downloading complete distribution of SIFT. + +Sleuth Kit /Autopsy is open source digital forensics investigation tool which is used for recovering the lost files from disk image and analysis of images for incident response. Autopsy tool is a web interface of sleuth kit which supports all features of sleuth kit. This tool is available for both Windows and Linux Platforms. + +### Install Sleuth kit ### + +First of all, download Sleuth kit software from [sleuthkit][1] website. Use wget command to download it in terminal which is shown in the figure. + + # wget http://cznic.dl.sourceforge.net/project/sleuthkit/sleuthkit/4.1.3/sleuthkit-4.1.3.tar.gz + +![Download Sleuth Kit](http://blog.linoxide.com/wp-content/uploads/2015/03/download-sleuthkeit.png) + +Extract the sleuthkit-4.1.3.tar.gz using following command and go inside the extracted directory + + # tar -xvzf sleuthkit-4.1.3.tar.gz + +![Extraction Process](http://blog.linoxide.com/wp-content/uploads/2015/03/extract.png) + +Run following command which perform the requirement check before sleuth kit installation + + #./configure + +![configure](http://blog.linoxide.com/wp-content/uploads/2015/03/configure.png) + +Make command compile the sleuth kit code. + + #make + +![make](http://blog.linoxide.com/wp-content/uploads/2015/03/make.png) + +Finally following command install it under **/usr/local** path. + + #make install + +![make install](http://blog.linoxide.com/wp-content/uploads/2015/03/make-install.png) + +### Install Autopsy Tool ### + +Sleuth kit installation is complete and now we will install autopsy interface. Download Autopsy software from [sleuthkit's autopsy page][2] . Use wget command to download it in terminal which is shown in the figure. + + # wget http://kaz.dl.sourceforge.net/project/autopsy/autopsy/2.24/autopsy-2.24.tar.gz + +![Autpsy download link](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy.png) + +Extract the autopsy-2.24.tar.gz using following command and go inside the extracted directory + + # tar -xvzf autopsy-2.24.tar.gz + +![Autopsy Extraction](http://blog.linoxide.com/wp-content/uploads/2015/03/Autopsy-extraction.png) + +Configuration script of autopsy asks for NSRL (National Software Reference Library) and path of **Evidence_Locker** folder. + +Enter "n" for NSRL prompt and create Evidence_Locker folder under **/usr/local** directory. Autopsy stores the configuration files, audit logs and output under Evidence_Locker folder. + + #mkdir /usr/local/Evidence_Locker + + #cd autopsy-2.24 + + #./configure + +![Autopsy Configuration Script](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-configuration.png) + +After adding Evidence_Locker path in installation process , autopsy stores configuration files in it and shows a following message to run the autopsy program. + +![Start Autopsy](http://blog.linoxide.com/wp-content/uploads/2015/03/start-autopsy.png) + +Type **./autopsy** command in terminal to start the graphical interface of Sleuth kit tool. + +![Autopsy Started](http://blog.linoxide.com/wp-content/uploads/2015/03/autopsy-started.png) + +Type following address in the web browser to access the interface of autopsy . + + http://localhost:9999/autopsy + +Main web page of autopsy plugin is shown int the following figure. + +![Main Page](http://blog.linoxide.com/wp-content/uploads/2015/03/main-interface.png) + +Click on the **New Case** button to start analysis in autopsy tool. Enter the case name, description about the investigation and name of agent which is shown in the following figure. + +![create new case](http://blog.linoxide.com/wp-content/uploads/2015/03/create-new-case1.png) + +Following web page will appear after entering the details in the above page. Click on **Add Host** button to add details for the analyst machine. + +![add host](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host1.png) + +Enter host name, description and time zone setting of analyst machine on the next page. + +![add host-detial](http://blog.linoxide.com/wp-content/uploads/2015/03/add-host-detial.png) + +Click on the **Add Image** button to add image file for forensics analysis. + +![add image](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image.png) + +Click on the **Add Image File** button on the following web page. It opens new web page which require Path of image file and select type & importing method. + +![Add image file](http://blog.linoxide.com/wp-content/uploads/2015/03/Add-image-file.png) + +As shown in the following figure, we have entered path of Linux image file. In our case, image file is partition of disk. + +![add image parition](http://blog.linoxide.com/wp-content/uploads/2015/03/add-image-parition.png) + +Click on the next button and select **Calculate hash** option in the next page which is shown in the following figure. It also detect the file system type of the given image. + +![image and file system detail](http://blog.linoxide.com/wp-content/uploads/2015/03/image-and-file-system-detail.png) + +Following window shows the MD5 hash of the image file before static analysis . + +![hash](http://blog.linoxide.com/wp-content/uploads/2015/03/hash1.png) + +On the next web page, autopsy shows following information about the image file. + +- mount point for the image +- name of image +- file system type of given image + +Click on the **details** button to get more information about the given image file. It also offer extraction of unallocated fragments and strings from the volume of image file which is shown in the following figure. + +![Image detail](http://blog.linoxide.com/wp-content/uploads/2015/03/image-details.png) + +Click on **Analyze** button which is shown in the below figure to start analysis on given image . It opens another page which shows the multiple options for image analysis. + +![analysis](http://blog.linoxide.com/wp-content/uploads/2015/03/analysis1.png) + +Autopsy offer following features during image analysis process. + +- File Analysis +- Keyword Search +- File Type +- Image Details +- Data Unit + +File Analysis on given image of Linux partition is shown in the following figure. + +![Analysis of image](http://blog.linoxide.com/wp-content/uploads/2015/03/Analysis-of-image.png) + +It extracts all files and folders from the given image . Extraction of deleted files are shown int he figure. + +![Deleted Files](http://blog.linoxide.com/wp-content/uploads/2015/03/deleted.png) + +### Conclusion ### + +Hopefully this article will be useful for the beginner in static forensics analysis of disk image. Autopsy is web interface for sleuth kit which provides features such as extraction of strings , recovery of deleted files, timeline analysis, extraction of web surfing history, keyword search and email analysis on windows and linux disk images. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/autopsy-sleuth-kit-installation-ubuntu/ + +作者:[nido][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/naveeda/ +[1]:http://www.sleuthkit.org/sleuthkit/download.php +[2]:http://www.sleuthkit.org/autopsy/download.php diff --git a/sources/tech/20150323 How to set up networking between Docker containers.md b/sources/tech/20150323 How to set up networking between Docker containers.md new file mode 100644 index 0000000000..7f950494be --- /dev/null +++ b/sources/tech/20150323 How to set up networking between Docker containers.md @@ -0,0 +1,160 @@ +How to set up networking between Docker containers +================================================================================ +As you may be aware, Docker container technology has emerged as a viable lightweight alternative to full-blown virtualization. There are a growing number of use cases of Docker that the industry adopted in different contexts, for example, enabling rapid build environment, simplifying configuration of your infrastructure, isolating applications in multi-tenant environment, and so on. While you can certainly deploy an application sandbox in a standalone Docker container, many real-world use cases of Docker in production environments may involve deploying a complex multi-tier application in an ensemble of multiple containers, where each container plays a specific role (e.g., load balancer, LAMP stack, database, UI). + +There comes the problem of **Docker container networking**: How can we interconnect different Docker containers spawned potentially across different hosts when we do not know beforehand on which host each container will be created? + +One pretty neat open-source solution for this is [weave][1]. This tool makes interconnecting multiple Docker containers pretty much hassle-free. When I say this, I really mean it. + +In this tutorial, I am going to demonstrate **how to set up Docker networking across different hosts using weave**. + +### How Weave Works ### + +![](https://farm8.staticflickr.com/7288/16662287067_27888684a7_b.jpg) + +Let's first see how weave works. Weave creates a network of "peers", where each peer is a virtual router container called "weave router" residing on a distinct host. The weave routers on different hosts maintain TCP connections among themselves to exchange topology information. They also establish UDP connections among themselves to carry inter-container traffic. A weave router on each host is then connected via a bridge to all other Docker containers created on the host. When two containers on different hosts want to exchange traffic, a weave router on each host captures their traffic via a bridge, encapsulates the traffic with UDP, and forwards it to the other router over a UDP connection. + +Each weave router maintains up-to-date weave router topology information, as well as container's MAC address information (similar to switch's MAC learning), so that it can make forwarding decision on container traffic. Weave is able to route traffic between containers created on hosts which are not directly reachable, as long as two hosts are interconnected via an intermediate weave router on weave topology. Optionally, weave routers can be set to encrypt both TCP control data and UDP data traffic based on public key cryptography. + +### Prerequisite ### + +Before using weave on Linux, of course you need to set up Docker environment on each host where you want to run [Docker][2] containers. Check out [these][3] [tutorials][4] on how to create Docker containers on Ubuntu or CentOS/Fedora. + +Once Docker environment is set up, install weave on Linux as follows. + + $ wget https://github.com/zettio/weave/releases/download/latest_release/weave + $ chmod a+x weave + $ sudo cp weave /usr/local/bin + +Make sure that /usr/local/bin is include in your PATH variable by appending the following in /etc/profile. + + export PATH="$PATH:/usr/local/bin" + +Repeat weave installation on every host where Docker containers will be deployed. + +Weave uses TCP/UDP 6783 port. If you are using firewall, make sure that these port numbers are not blocked by the firewall. + +### Launch Weave Router on Each Host ### + +When you want to interconnect Docker containers across multiple hosts, the first step is to launch a weave router on every host. + +On the first host, run the following command, which will create and start a weave router container. + + $ sudo weave launch + +The first time you run this command, it will take a couple of minutes to download a weave image before launching a router container. On successful launch, it will print the ID of a launched weave router. + +To check the status of the router, use this command: + + $ sudo weave status + +![](https://farm9.staticflickr.com/8632/16249607573_4514790cf5_c.jpg) + +Since this is the first weave router launched, there will be only one peer in the peer list. + +You can also verify the launch of a weave router by using docker command. + + $ docker ps + +![](https://farm8.staticflickr.com/7655/16681964438_51d8b18809_c.jpg) + +On the second host, run the following command, where we specify the IP address of the first host as a peer to join. + + $ sudo weave launch + +When you check the status of the router, you will see two peers: the current host and the first host. + +![](https://farm8.staticflickr.com/7608/16868571891_e66d4b8841_c.jpg) + +As you launch more routers on subsequent hosts, the peer list will grow accordingly. When launching a router, just make sure that you specify any previously launched peer's IP address. + +At this point, you should have a weave network up and running, which consists of multiple weave routers across different hosts. + +### Interconnect Docker Containers across Multiple Hosts ### + +Now it is time to launch Docker containers on different hosts, and interconnect them on a virtual network. + +Let's say we want to create a private network 10.0.0.0/24, to interconnect two Docker containers. We will assign random IP addressses from this subnet to the containers. + +When you create a Docker container to deploy on a weave network, you need to use weave command, not docker command. Internally, the weave command uses docker command to create a container, and then sets up Docker networking on it. + +Here is how to create a Ubuntu container on hostA, and attach the container to 10.0.0.0/24 subnet with an IP addresss 10.0.0.1. + + hostA:~$ sudo weave run 10.0.0.1/24 -t -i ubuntu + +On successful run, it will print the ID of a created container. You can use this ID to attach to the running container and access its console as follows. + + hostA:~$ docker attach + +Move to hostB, and let's create another container. Attach it to the same subnet (10.0.0.0/24) with a different IP address 10.0.0.2. + + hostB:~$ sudo weave run 10.0.0.2/24 -t -i ubuntu + +Let's attach to the second container's console as well: + + hostB:~$ docker attach + +At this point, those two containers should be able to ping each other via the other's IP address. Verify that from each container's console. + +![](https://farm9.staticflickr.com/8566/16868571981_d73c8e401b_c.jpg) + +If you check the interfaces of each container, you will see an interface named "ethwe" which is assigned an IP address (e.g., 10.0.0.1 and 10.0.0.2) you specified. + +![](https://farm8.staticflickr.com/7286/16681964648_013f9594b1_b.jpg) + +### Other Advanced Usages of Weave ### + +Weave offers a number of pretty neat features. Let me briefly cover a few here. + +#### Application Isolation #### + +Using weave, you can create multiple virtual networks and dedicate each network to a distinct application. For example, create 10.0.0.0/24 for one group of containers, and 10.10.0.0/24 for another group of containers, and so on. Weave automatically takes care of provisioning these networks, and isolating container traffic on each network. Going further, you can flexibly detach a container from one network, and attach it to another network without restarting containers. For example: + +First launch a container on 10.0.0.0/24: + + $ sudo weave run 10.0.0.2/24 -t -i ubuntu + +Detach the container from 10.0.0.0/24: + + $ sudo weave detach 10.0.0.2/24 + +Re-attach the container to another network 10.10.0.0/24: + + $ sudo weave attach 10.10.0.2/24 + +![](https://farm8.staticflickr.com/7639/16247212144_c31a49714d_c.jpg) + +Now this container should be able to communicate with other containers on 10.10.0.0/24. This is a pretty useful feature when network information is not available at the time you create a container. + +#### Integrate Weave Networks with Host Network #### + +Sometimes you may need to allow containers on a virtual weave network to access physical host network. Conversely, hosts may want to access containers on a weave network. To support this requirement, weave allows weave networks to be integrated with host network. + +For example, on hostA where a container is running on network 10.0.0.0/24, run the following command. + + hostA:~$ sudo weave expose 10.0.0.100/24 + +This will assign IP address 10.0.0.100 to hostA, so that hostA itself is also connected to 10.0.0.0/24 network. Obviously, you need to choose an IP address which is not used by any other containers on the network. + +At this point, hostA should be able to access any containers on 10.0.0.0/24, whether or not the containers are residing on hostA. Pretty neat! + +### Conclusion ### + +As you can see, weave is a pretty useful Docker networking tool. This tutorial only covers a glimpse of [its powerful features][5]. If you are more ambitious, you can try its multi-hop routing, which can be pretty useful in multi-cloud environment, dynamic re-routing, which is a neat fault-tolerance feature, or even its distributed DNS service which allows you to name containers on weave networks. If you decide to use this gem in your environment, feel free to share your use case! + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/networking-between-docker-containers.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://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 \ No newline at end of file diff --git a/sources/tech/20150323 Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS.md b/sources/tech/20150323 Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS.md new file mode 100644 index 0000000000..9306f21c8d --- /dev/null +++ b/sources/tech/20150323 Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS.md @@ -0,0 +1,121 @@ +Linux FAQs with Answers--How to install and access CentOS remote desktop on VPS +================================================================================ +> **Question**: I want to install CentOS desktop on VPS, and be able to access the desktop GUI remotely from home. What is a recommended way to set up and access CentOS-based remote desktop on VPS? + +Nowadays teleworking or remote working with flexible hours is increasingly popular in tech industry. One of the enabling technologies behind this trend is remote desktop. Your desktop environment is in the cloud, and you can access the remote desktop anywhere you go, either from home or at your workplace. + +This tutorial describes how you can set up CentOS based remote desktop on VPS. Here we are going to demonstrate CentOS 7 based environment. + +We assume that you already created a CentOS 7 VPS instance somewhere (e.g., using [DigitalOcean][1] or Amazon EC2). Make sure that the VPS instance has at least 1GB memory. Otherwise, CentOS desktop will crash when you try to access remote desktop. + +### Step One: Install CentOS Desktop ### + +If an available CentOS image is a minimal version of CentOS without desktop, you will need to install desktop (e.g., GNOME) on your CentOS VPS before proceeding. For example, DigitalOcean's CentOS image is such a minimal version, which requires [desktop GUI installation][2] as follows. + + # yum groupinstall "GNOME Desktop" + +Reboot a VPS after finishing installation. + +### Step Two: Install and Configure VNC Server ### + +The next step is to install and configure VNC server. We are going to use TigerVNC, an open-source VNC server implementation. + + # yum install tigervnc-server + +Now create a user account (e.g., xmodulo) which will be used to access remote desktop. + + # useradd xmodulo + # passwd xmodulo + +When a user tries to access remote desktop using VNC, a dedicated VNC server daemon will be launched to handle its requests. This means that you will need to create a separate VNC server configuration for each user. + +CentOS 7 relies on systemd to manage and configure system services. So we are going to configure VNC server for xmodulo user using systemd. + +Let's first check the status of VNC server by running either command below: + + # systemctl status vncserver@:.service + # systemctl is-enabled vncserver@.service + +By default, freshly installed VNC service is not active (disabled). + +![](https://farm8.staticflickr.com/7613/16877514732_8ccffe7b6b_b.jpg) + +Now create a VNC service configuration for xmodulo user by copying a generic VNC service unit file as follows. + + # cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service + +Open the configuration file with a text editor, and replace with an actual user name (e.g., xmodulo) under [Service] section. Also, append "-geometry " parameter in ExecStart. In the end, the following two lines with bold font will be modified. + + # 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 || :' + +Now set up (optional) VNC password for xmodulo user for security. For this, switch to the user, and run vncserver command. + + # su - xmodulo + # vncserver + +You will be prompted to enter a VNC password for the user. Once the password is set, you will need to use this password to gain access to remote desktop. + +![](https://farm9.staticflickr.com/8752/16692564599_9c4e5da1b6_b.jpg) + +Finally, reload services to activate the new VNC configuration: + + # systemctl daemon-reload + +and enable VNC service to make it start automatically upon boot: + + # systemctl enable vncserver@:1.service + +Check the port number that a VNC server is listening on by running: + + # netstat -tulpn | grep vnc + +![](https://farm8.staticflickr.com/7625/16692646729_7bb16c4897_b.jpg) + +Port 5901 is the default port number for VNC client to connect to a VNC server. + +### Step Three: Connect to Remote Desktop over SSH ### + +By design, Remote Frame Buffer (RFB) protocol used by VNC is not a secure protocol. Thus it is not a good idea to directly connect to a remote VNC server running on VPS using a VNC client. Any sensitive information such as password could easily be leaked from VNC traffic. So instead, I strongly recommend that you [tunnel VNC traffic][3] over a secure SSH tunnel, as described here. + +On a local host where you want to run VNC client, create an SSH tunnel to a remote VPS using the following command. When prompted for SSH password, type the password of the user. + + $ ssh xmodulo@ -L 5901:127.0.0.1:5901 + +Replace "xmodulo" with your own VNC user, and fill in the IP address of your VPS instance. + +Once an SSH tunnel is established, remote VNC traffic will be routed over the SSH tunnel, and be sent to 127.0.0.1:5901. + +Now go ahead and launch your favorite VNC client (e.g., vinagre), and connect to 127.0.0.1:5901. + +![](https://farm8.staticflickr.com/7639/16691289910_fae83510fb_o.png) + +You will be asked to enter a VNC password. When you type a correct VNC password, you will finally be able to CentOS remote desktop on VPS securely. + +![](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] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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 \ No newline at end of file diff --git a/sources/tech/20150324 7 Quirky' ls' Command Tricks Every Linux User Should Know.md b/sources/tech/20150324 7 Quirky' ls' Command Tricks Every Linux User Should Know.md new file mode 100644 index 0000000000..9878cc8cee --- /dev/null +++ b/sources/tech/20150324 7 Quirky' ls' Command Tricks Every Linux User Should Know.md @@ -0,0 +1,163 @@ +7 Quirky ‘ls’ Command Tricks Every Linux User Should Know +================================================================================ +We have covered most of the things on ‘ls‘ command in last two articles of our Interview series. This article is the last part of the ‘ls command‘ series. If you have not gone through last two articles of this series you may visit the links below. + +注:以下三篇都做过源文,看看翻译了没有,如果发布了可适当改链接地址 +- [15 Basic ‘ls’ Command Examples in Linux][] +- [15 Interview Questions on Linux “ls” Command – Part 1][] +- [10 Useful ‘ls’ Command Interview Questions – Part 2][] + +![7 Quirky ls Command Tricks](http://www.tecmint.com/wp-content/uploads/2015/03/ls-command-tricks.jpg) +7 Quirky ls Command Tricks + +### 1. List the contents of a directory with time using various time styles. ### + +To list the contents of a directory with times using style, we need to choose any of the below two methods. + + # ls -l –time-style=[STYLE] (Method A) + +**Note** – The above switch (`--time` style must be run with switch `-l`, else it won’t serve the purpose). + + # ls –full-time (Method B) + +Replace `[STYLE]` with any of the below option. + + full-iso + long-iso + iso + locale + +%H:%M:%S:%D + +**Note** – In the above line H(Hour), M(Minute), S(Second), D(Date) can be used in any order. + +Moreover you just choose those relevant and not all options. E.g., `ls -l --time-style=+%H` will show only hour. + +`ls -l --time-style=+%H:%M:%D` will show Hour, Minute and date. + + # 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 Command Full Time Style + + # ls -l --time-style=long-iso + +![Long Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Long-Time-Listing-Format.gif) +Long Time Style Listing + + # ls -l --time-style=iso + +![Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Local-Time-Style-Listing.gif) +Time Style Listing + + # ls -l --time-style=locale + +![Locale Time Style Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Hour-Mintue-Time-Style-Listing.gif) +Locale Time Style Listing + + # 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) +Date and Time Style Listing + + # ls --full-time + +![Full Style Time Listing](http://www.tecmint.com/wp-content/uploads/2015/03/Full-Style-Time-Listing.gif) + +Full Style Time Listing + +### 2. Output the contents of a directory in various formats such as separated by commas, horizontal, long, vertical, across, etc. ### + +Contents of directory can be listed using ls command in various format as suggested below. + +- across +- comma +- horizontal +- long +- single-column +- verbose +- vertical + + # 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) +Listing Formats of ls Command + +### 3. Use ls command to append indicators like (/=@|) in output to the contents of the directory. ### + +The option `-p` with ‘ls‘ command will server the purpose. It will append one of the above indicator, based upon the type of file. + + # ls -p + +![Append Indicators to Content](http://www.tecmint.com/wp-content/uploads/2015/03/Append-Indicators.gif) +Append Indicators to Content + +### 4. Sort the contents of directory on the basis of extension, size, time and version. ### + +We can use options like `--extension` to sort the output by extension, size by extension `--size`, time by using extension `-t` and version using extension `-v`. + +Also we can use option `--none` which will output in general way without any sorting in actual. + + # 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) +Sort Listing of Content by Options + +### 5. Print numeric UID and GID for every contents of a directory using ls command. ### + +The above scenario can be achieved using flag -n (Numeric-uid-gid) along with ls command. + + # 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) +Print Listing of Content by UID and GID + +### 6. Print the contents of a directory on standard output in more columns than specified by default. ### + +Well ls command output the contents of a directory according to the size of the screen automatically. + +We can however manually assign the value of screen width and control number of columns appearing. It can be done using switch ‘`--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) +List Content Based on Window Sizes + +**Note**: You can experiment what value you should pass with width flag. + +### 7. Include manual tab size at the contents of directory listed by ls command instead of default 8. ### + + # ls --tabsize=[value] + +![List Content by Table Size](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-by-Table-Size.gif) +List Content by Table Size + +**Note**: Specify the `[Value]=` Numeric value. + +That’s all for now. Stay tuned to Tecmint till we come up with next article. Do not 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/linux-ls-command-tricks/ + +作者:[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/15-basic-ls-command-examples-in-linux/ +[2]:http://www.tecmint.com/ls-command-interview-questions/ +[3]:http://www.tecmint.com/ls-interview-questions/ \ No newline at end of file diff --git a/sources/tech/20150324 How to Host Open Source Code Repository in github.md b/sources/tech/20150324 How to Host Open Source Code Repository in github.md new file mode 100644 index 0000000000..267486f211 --- /dev/null +++ b/sources/tech/20150324 How to Host Open Source Code Repository in github.md @@ -0,0 +1,114 @@ +Translating by ZTinoZ +How to Host Open Source Code Repository in github +================================================================================ +Hi all, today we will be learning how to host Source Code of Open Source Software in the repository hosted by github.com . GitHub is a web-based Git repository hosting service, which offers all of the distributed revision control and source code management (SCM) functionality of Git as well as adding its own features. It provides a workplace to host powerful collaboration, code review, and code management for open source and private projects. Unlike Git, which is strictly a command-line tool, GitHub provides a web-based graphical interface and desktop as well as mobile integration. GitHub offers both paid plans for private repositories and free accounts, which are usually used to host open-source software projects. + +![github universe logo](http://blog.linoxide.com/wp-content/uploads/2015/03/github-universe.jpg) + +It is fast and more flexible web based hosting service which is easy to use and to manage distributed revision control. Anyone can host their software's source code in github's repository for the use, contribution, sharing, issue tracking and many more by millions of people across the globe. Here are some easy and quick steps to easily host software's source code. + +### 1. Creating a new Github Account ### + +First of all, open your favorite browser and go to Github's homepage url ie [github][1]. Then, the homepage will be opened as shown below. + +![Github Homepage](http://blog.linoxide.com/wp-content/uploads/2015/03/github-homepage.png) + +Now, after the homepage has been opened, please fill form shown to sign up for a new github account. + +After the you entered the valid information required for sign up, you'll be redirected to the plan choosing step. We have 5 plans listed in this page. One can choose the plan according to their requirement. Here, we'll go for a free plan. So, click on Choose to the Free plan and click on Finish Sign up. If we are planning to create an organization then, we need to tick on Help me setup an organization next. + +![choosing plan](http://blog.linoxide.com/wp-content/uploads/2015/03/choosing-plan.png) + +### 2. Creating a New Repository ### + +After we have successfully signed up a new account or logged in to Github, we'll now need to create a new Repository to get started. + +Click on **(+)** button which is located at the top right near the account id. Then Click on New Repository . + +![Add new repository](http://blog.linoxide.com/wp-content/uploads/2015/03/create-new-repository.png) + +Now, after clicking on add a new repository, we'll now be directed to the page where we'll need to enter the required information. + +![adding repository information](http://blog.linoxide.com/wp-content/uploads/2015/03/adding-information-repository.png) + +Now, after entering the required information about the new repository, we'll need to click on green Create repository button. + +After it is done, we'll get to see something similar like this image. + +![repository github](http://blog.linoxide.com/wp-content/uploads/2015/03/repository-github.png) + +### 3. Uploading an existing Project ### + +If we want to share our existing project on Github, we'll surely need to push the codes to the repository we created. To do so, we'll first need to install git in our Linux machine. As I am running Ubuntu 14.04 LTS in my machine, I'll need to run **apt** manger to install it. + + $ sudo apt-get install git + +![installing git](http://blog.linoxide.com/wp-content/uploads/2015/03/install-git.png) + +Now, as git is ready, we are now ready to upload the codes. + +**Note**: To avoid errors, do not initialize the new repository with **README**, license, or gitignore files. You can add these files after your project has been pushed to GitHub. + +In Terminal, we'll need to change the current working directory to your local project then initialize the local directory as a Git repository/ + + $ git init + +We'll then add the files in our new local repository. This stages them for the first commit. + + $ git add . + +Now, we'll need to commit the files that we've staged in our local repository. + + $ git commit -m 'First commit' + +![git commit](http://blog.linoxide.com/wp-content/uploads/2015/03/git-commit.png) + +In Terminal, we'll add the URL for the remote repository where our local repostory will be pushed. + + $ git remote add origin remote Repository url + $ git remote -v + +![adding remote url](http://blog.linoxide.com/wp-content/uploads/2015/03/adding-remote-url.png) + +Note: Please do replace remote Repository url to the url of the remote repo. + +Now, to push the changes in our local repository to GitHub's repo we'll need to run as below and enter the required credential for the repository. + + $ git push origin master + +![pushing repo](http://blog.linoxide.com/wp-content/uploads/2015/03/pushing-repo.png) + +### Cloning a Repo ### + +If we want to download a code repository from github straight to our local drives with a single command then, we can simply use git clone command which will clone the current directory to the remote repository. + + $ git clone https://github.com/aruntechgeek/linspeed.git + +![cloning repo](http://blog.linoxide.com/wp-content/uploads/2015/03/cloning-repo.png) + +Please change the above url to the repository you want to clone from. + +### Updating a Change ### + +If we made changes to our code and want to push them to our remote repository then after changing the changes, we should run the following commands inside that directory. + + $ git add . + $ git commit -m "Updating" + $ git push + +### Conclusion ### + +Hurray! We have successfully hosted our Project Source Code in Github repository. Github is fast and more flexible web based hosting service which is easy to use and to manage distributed revision control. Millions of awesome Open Source projects are hosted in github. So, if you have any questions, suggestions, feedback please write them in the comment box below. Thank you ! Enjoy Github :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/usr-mgmt/host-open-source-code-repository-github/ + +作者:[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://github.com/ diff --git a/sources/tech/20150326 A Peep into Process Management Commands in Linux.md b/sources/tech/20150326 A Peep into Process Management Commands in Linux.md new file mode 100644 index 0000000000..e1df53bab5 --- /dev/null +++ b/sources/tech/20150326 A Peep into Process Management Commands in Linux.md @@ -0,0 +1,193 @@ + Vic020 + +A Peep into Process Management Commands in Linux +================================================================================ +A program in execution is called a process. While a program is an executable file present in storage and is passive, a process is a dynamic entity comprising of allocated system resources, memory, security attributes and has a state associated with it. There can be multiple processes associated with the same program and operating simultaneously without interfering with each other. The operating system efficiently manages and keeps track of all the processes running in the system. + +In order to manage these processes, user should be able to + +- See all the processes that are running +- View the system resources consumed by the processes +- Locate a particular process and take specific action on it +- Change the priority levels associated with processes +- Kill the required processes +- Restrict the system resources available to processes etc. + +Linux offers many commands to the user to effectively handle the above mentioned scenarios. Let's understand them one by one. + +### 1. ps ### + +'ps' is one of the basic commands in Linux to view the processes on the system. It lists the running processes in a system along with other details such as process id, command, cpu usage, memory usage etc. Some of the following options come handy to get more useful information + + ps -a - List all the running / active processes + +![Output of "ps -a" command](http://blog.linoxide.com/wp-content/uploads/2015/02/ps-a2.png) + + ps -ef |grep - List only the required process + + ps -aux - Displays processes including those with no terminals(x) Output is user oriented (u) with fields like USER, PID, %CPU, %MEM etc + +### 2. pstree ### + +In Linux, every process gets spawned by its parent process. This command helps visualize the processes by displaying a tree diagram of the processes showing the relationship between them. If a pid is mentioned, the root of the tree will be the pid. Else it will be rooted at init. + +![pstree](http://blog.linoxide.com/wp-content/uploads/2015/02/pstree.png) + +### 3. top ### + +'top' is a very useful command to monitor the system as it shows the system resources used by different processes. It gives a snapshot of the situation that the system is currently in. Its output includes data like process identification number(PID), user of the process, nice value, %CPU and %memory currently consumed by the process etc. One can use this output to figure out which process is hogging the CPU or memory. + +![top](http://blog.linoxide.com/wp-content/uploads/2015/02/top.png) + +### 4. htop ### + +htop is similar to top, but is an interactive text mode process viewer. It displays the per CPU usage and memory, swap usage using a text graph. One can use the Up/Down arrow key to select processes, F7 and F8 to change the priority and F9 to kill a process. It is not present by default in the system and need to be installed explicitly. + +![htop output](http://blog.linoxide.com/wp-content/uploads/2015/03/htop1.png) + +### 5. nice ### + +With the help of nice command, users can set or change the priorities of processes in Linux. Higher the priority of a process, more is the CPU time allocated by the kernel for it. By default, a process gets launched with priority 0. Process priority can be viewed using the top command output under the NI (nice value) column. + +Values of process priority range from -20 to 19. Lower the nice value, higher the priority. + + nice - starts the process by setting its priority to the given value + +![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) + +In the above example, 'top' gets launched with a priority -3. + +### 6. renice ### + +It is similar to nice command. Use this command to change the priority of an already running process. Please note that users can change the priority of only the processes that they own. + + renice -n -p - change the priority of the given process + +![renice command](http://blog.linoxide.com/wp-content/uploads/2015/02/renice2.png) + +Priority of process with id 3806 which had an initial priority of 0 is now changed to priority 4. + + renice -u -g - change the priority of processes owned by the given user and group +![output of renice for a user group](http://blog.linoxide.com/wp-content/uploads/2015/02/renice1.png) + +In the above example, priority of all processes owned by user 'mint' get changed to '-3' + +### 7. kill ### + +This is a command used to terminate processes by sending signals. If a process is not responding to kill command, then it can be forcefully killed using the kill -9 command. But this needs to be used carefully as it does not give a chance for the process to clean up and might end up in corrupted files. If we are not aware of the PID of the process to be killed or want to mention the process name to be killed, then killall comes to rescue. + + kill + + kill -9 + + killall -9 - kill all instances having the same process name + +If you use kill, you need to know the process id of the process to be killed. pkill is a similar command but can be used to kill processes using a pattern, i.e. process name, process owner etc. + + 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 ### + +Command useful in controlling the system-wide resources available to the shells and processes. Mostly useful for system administrators to manage systems that are heavily used and have performance problems. Limiting the resources ensures that important processes continue to run while other processes do not consume more resources. + + ulimit -a - Displays the current limits associated with the current user. + +![ulimit -a](http://blog.linoxide.com/wp-content/uploads/2015/02/ulimit-a.png) + + -f - maximum file size + + -v - maximum virtual memory size (in KB) + + -n - maximum file descriptor plus 1 + + -H : To change and report the hard limit + + -S : To change and report the soft limit + +Check out the ulimit man page for more options. + +### 9. w ### + +w gives us information about the users who have currently logged in and the processes that they are running. The header details displayed contain information like current time, how long the system has been running, total number of users logged in, load average of the system for the last 1, 5 and 15 minutes + +Based on the user information, one can take care before terminating any processes that do not belong to them. + +!['w' command](http://blog.linoxide.com/wp-content/uploads/2015/02/w.png) + +**who** is a related command and gives a list of currently logged in users, time of last system boot, current run levels etc. + +!['who' command](http://blog.linoxide.com/wp-content/uploads/2015/02/who.png) + +**whoami** command prints the username of the current user ID + +!['whoami' command](http://blog.linoxide.com/wp-content/uploads/2015/02/whoami.png) + +### 10. pgrep ### + +pgrep stands for "Process-ID Global Regular Expression Print". It scans the currently running processes and lists the process IDs that match the selection criteria mentioned on command line to stdout. Useful for retrieving the process id of a process by using its name. + + pgrep -u mint sh + +This command will display the process ID for the process named 'sh' and owned by user 'mint' + +![output of pgrep](http://blog.linoxide.com/wp-content/uploads/2015/03/pgrep.png) + +### 11. fg , bg ### + +Sometimes, the commands that we execute take a long time to complete. In such situations, we can push the jobs to be executed in the background using 'bg' command and can be brought to the foreground with the 'fg' command. + +We can start a program in background by using the '&' : + + find . -name *iso > /tmp/res.txt & + +A program that is already running can also be sent to the background using 'CTRL+Z' and 'bg' command: + + find . -name *iso > /tmp/res.txt & - start the job in the background + + ctrl+z - suspend the currently executing foreground job + + bg - push the command execution to background + +We can list all the background processes using 'jobs' command + + jobs + +We can bring back a background process to foreground using the 'fg' command. + + fg % + +![output of fg, bg and jobscommands](http://blog.linoxide.com/wp-content/uploads/2015/03/fg-bg-jobs.png) + +### 12. ipcs ### + +ipcs command is used for listing the inter-process communication facilities (shared memory, semaphores and message queues). + +This command with -p option can be combined with options -m, -s or-q to display the process id which recently accessed the corresponding ipc facility. + + ipcs -p -m + +The screen shot below is listing the creator id and process id which accessed the shared memory recently. + +![ipcs command](http://blog.linoxide.com/wp-content/uploads/2015/03/ipcs.png) + +### Conclusion ### + +Generally, it is considered the job of administrators to fix problems and tweak the system to improve the performance. But users also need to deal with processes in Linux quite often. Hence, it is essential to familiarise ourselves with the various commands available to manage them effectively. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-command/process-management-commands-linux/ + +作者:[B N Poornima][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/bnpoornima/ diff --git a/sources/tech/20150326 How to set up server monitoring system with Monit.md b/sources/tech/20150326 How to set up server monitoring system with Monit.md new file mode 100644 index 0000000000..c8f9efaecd --- /dev/null +++ b/sources/tech/20150326 How to set up server monitoring system with Monit.md @@ -0,0 +1,252 @@ +How to set up server monitoring system with Monit +================================================================================ +Many Linux admins rely on a centralized remote monitoring system (e.g., [Nagios][1] or [Cacti][2]) to check the health of their network infrastructure. While centralized monitoring makes an admin's life easy when dealing with many hosts and devices, a dedicated monitoring box obviously becomes a single point of failure; if the monitoring box goes down or becomes unreachable for whatever reason (e.g., bad hardware or network outage), you will lose visibility on your entire infrastructure. + +One way to add redundancy to your monitoring system is to install standalone monitoring software (as a fallback) at least on any critical/core servers on your network. In case a centralized monitor is down, you will still be able to maintain visibility on your core servers from their backup monitor. + +### What is Monit? ### + +[Monit][3] is a cross-platform open-source tool for monitoring Unix/Linux systems (e.g., Linux, BSD, OSX, Solaris). Monit is extremely easy to install and reasonably lightweight (with only 500KB in size), and does not require any third-party programs, plugins or libraries. Yet, Monit lends itself to full-blown monitoring, capable of process status monitoring, filesystem change monitoring, email notification, customizable actions for core services, and so on. The combination of ease of setup, lightweight implementation and powerful features makes Monit an ideal candidate for a backup monitoring tool. + +I have been using Monit for several years on multiple hosts, and I am very pleased how reliable it has been. Even as a full-blown monitoring system, Monit is very useful and powerful for any Linux admin. In this tutorial, let me demonstrate how to set up Monit on a local server (as a backup monitor) to monitor common services. With this setup, I will only scrach the surface of what Monit can do for us. + +### Installation of Monit on Linux ### + +Most Linux distributions already include Monit in their repositories. + +Debian, Ubuntu or Linux Mint: + + $ sudo aptitude install monit + +Fedora or CentOS/RHEL: + +On CentOS/RHEL, you must enable either [EPEL][4] or [Repoforge][5] repository first. + + # yum install monit + +Monit comes with a very well documented configuration file with a lots of examples. The main configuration file is located in /etc/monit.conf in Fedora/CentOS/RHEL, or /etc/monit/monitrc in Debian/Ubuntu/Mint. Monit configuration has two parts: "Global" and "Services" sections. + +Gl### ###obal Configuration: Web Status Page + +Monit can use several mail servers for notifications, and/or an HTTP/HTTPS status page. Let's start with the web status page with the following requirements. + +- Monit listens on port 1966. +- Access to the web status page is encrypted with SSL. +- Login requires monituser/romania as user/password. +- Login is permitted from localhost, myhost.mydomain.ro, and internal LAN (192.168.0.0/16) only. +- Monit stores an SSL certificate in a pem format. + +For subsequent steps, I will use a Red Hat based system. Similar steps will be applicable on a Debian based system. + +First, generate and store a self-signed certificate (monit.pem) in /var/cert. + + # mkdir /var/certs + # cd /etc/pki/tls/certs + # ./make-dummy-cert monit.pem + # cp monit.pem /var/certs + # chmod 0400 /var/certs/monit.pem + +Now put the following snippet in the Monit's main configuration file. You can start with an empty configuration file or make a copy of the original file. + + 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 ### + +Next, let's set up email notification in Monit. We need at least one active [SMTP server][6] which can send mails from the Monit host. Something like the following will do (adjust it for your case): + +- Mail server hostname: smtp.monit.ro +- Sender email address used by monit (from): monit@monit.ro +- Who will receive mail from monit daemon: guletz@monit.ro +- SMTP port used by mail server: 587 (default is 25) + +With the above information, email notification would be configured like this: + + 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 + +As you can see, Monit offers several built-in variables ($DATE, $EVENT, $HOST, etc.), and you can customize your email message for your needs. If you want to send mails from the Monit host itself, you need a sendmail-compatible program (e.g., postfix or ssmtp) already installed. + +### Global Configuration: Monit Daemon ### + +The next part is setting up monit daemon. We will set it up as follows. + +- Performs the first check after 120 seconds. +- Checks services once every 3 minutes. +- Use syslog for logging. + +Place the following snippet to achieve the above setting. + + set daemon 120 + with start delay 240 + set logfile syslog facility log_daemon + +We must also define "idfile", a unique ID used by monit demon, and "eventqueue", a path where mails sent by monit but undelivered due to SMTP/network errors. Verifiy that path (/var/monit) already exists. The following configuration will do. + + set idfile /var/monit/id + set eventqueue + basedir /var/monit + +### Test Global Configuration ### + +Now the "Global" section is finished. The Monit configuration file will look like this: + + # 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 + +Now it is time to check what we have done. You can test an existing configuration file (/etc/monit.conf) by running: + + # monit -t + +---------- + + Control file syntax OK + +If Monit complains about any error, please review the configuration file again. Fortunately, error/warnings messages are informative. For example: + + 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' + +Once you verify the syntax of configuration, start monit daemon, and wait 2 to 3 minutes: + + # service monit start + +If you are using systemd, run: + + # systemctl start monit + +Now open a browser window, and go to https://:1966. Replace & with your Monit hostname or IP address. + +Note that if you have a self-signed SSL certificate, you will see a warning message in your browser. + +![](https://farm8.staticflickr.com/7596/16737206479_96b9f7dfdb_c.jpg) + +After you have completed login, you must see the following page. + +![](https://farm8.staticflickr.com/7594/16303369973_6019482dea_c.jpg) + +In the rest of the tutorial, let me show how we can monitor a local server and common services. You will see a lot of useful examples on the [official wiki page][7]. Most of them are copy-and-pastable! + +### Service Configuration: CPU/Memory Monitoring ### + +Let start with monitoring a local server's CPU/memory usage. Copy the following snippet in the configuration file. + + 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 + +You can easily interpret the above configuration. The above checks are performed on local host for every monitoring cycle (which is set to 120 seconds in the Global section). If any condition is met, monit daemon will send an alert with an email. + +If certain properties do not need to be monitored for every cycle, you can use the following format. For example, this will monitor average load every other cycle (i.e., every 240 seconds). + + if loadavg (1min) > 10 for 2 cycles then alert + +### Service Configuration: SSH Service Monitoring ### + +Let's check if we have sshd binary installed in /usr/sbin/sshd: + + check file sshd_bin with path /usr/sbin/sshd + +We also want to check if the init script for sshd exist: + + check file sshd_init with path /etc/init.d/sshd + +Finally, we want to check if sshd daemon is up an running, and listens on port 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 + +More specifically, we can interpret the above configuration as follows. We check if a process named sshd and a pidfile (/var/run/sshd.pid) exist. If either one does not exist, we restart sshd demon using init script. We check if a process listening on port 22 can speak SSH protocol. If not, we restart sshd daemon. If there are at least 5 restarts within the last 5 monitoring cycles (i.e., 5x120 seconds), sshd daemon is declared non-functional, and we do not try to check again. + +![](https://farm9.staticflickr.com/8685/16735725998_62c26a24bc_c.jpg) + +### Service Configuration: SMTP Service Monitoring ### + +Now let's set up a check on a remote SMTP mail server (e.g., 192.168.111.102). Let's assume that the SMTP server is running SMTP, IMAP and SSH on its LAN interface. + + 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 + +We check if the remote host responds to ICMP. If we haven't received ICMP response within 10 cycles, we send out an alert. If testing for SMTP protocol on port 25 fails, we send out an alert. If testing succeeds again after a failed test, we run a script (/scripts/mail-script). If testing for SSH and IMAP protocols fail on port 22 and 143, respectively, we send out an alert. + +### Conclusion ### + +In this tutorial, I demonstrate how to set up Monit on a local server. What I showed here is just the tip of the iceberg, as far as Monit's capabilities are concerned. Take your time and read the man page about Monit (a very good one). Monit can do a lot for any Linux admin with a very nice and easy to understand syntax. If you put together a centralized remote monitor and Monit to work for you, you will have a more reliable monitoring system. What is your thought on Monit? + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/server-monitoring-system-monit.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/monitor-common-services-nagios.html +[2]:http://xmodulo.com/monitor-linux-servers-snmp-cacti.html +[3]:http://mmonit.com/monit/ +[4]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.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/sources/tech/20150330 2 Ways to Create Your Own Docker Base Image.md b/sources/tech/20150330 2 Ways to Create Your Own Docker Base Image.md new file mode 100644 index 0000000000..80a7d4d4fa --- /dev/null +++ b/sources/tech/20150330 2 Ways to Create Your Own Docker Base Image.md @@ -0,0 +1,57 @@ +2 Ways to Create Your Own Docker Base Image +================================================================================ +Greetings to everyone, today we'll learn about docker base Images and how we can build our own. [Docker][1] is an Open Source project that provides an open platform to pack, ship and run any application as a lightweight container. It has no boundaries of Language support, Frameworks or packaging system and can be run anywhere, anytime from a small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider. + +Docker Images is a read-only layer which never changes. It Docker uses a **Union File System** to add a read-write file system over the read-only file system. But all the changes go to the top-most writeable layer, and underneath, the original file in the read-only image is unchanged. Since images don't change, images do not have state. Base Images are those images that has no parent. The major benefits of it is that it allows us to have a separate linux OS running. + +Here are the ways on how we can create a custom base image. + +### 1. Creating Docker Base Image using Tar ### + +We can create our own base image using tar, we'll want to start building it with a working Linux Distribution we'll want to package as base image. This process may differ and depends on what distribution we are trying to build. In Debian distribution of Linux, debootstrap is preinstalled. We'll need to install debootstrap before starting the below process. Debootstrap is used to fetch the required packages to build the base system. Here, we'll create image based on Ubuntu 14.04 "Trusty". To do so, we'll need to run the following command in a terminal or shell. + + $ sudo debootstrap trusty trusty > /dev/null + $ sudo tar -C trusty -c . | sudo docker import - trusty + +![creating docker base image using debootstrap](http://blog.linoxide.com/wp-content/uploads/2015/03/creating-base-image-debootstrap.png) + +Here, the above command creates a tar file of the current directory and outputs it to STDOUT, where "docker import - trusty" takes it from STDIN and creates a base image called trusty from it. Then, we'll run a test command inside that image as follows. + + $ docker run trusty cat /etc/lsb-release + +Here are some example scripts that will allow us to build quick base images in [Docker GitHub Repo][2] . + +### 2. Creating Base Image using Scratch ### + +In the Docker registry, there is a special repository known as Scratch, which was created using an empty tar file: + + $ tar cv --files-from /dev/null | docker import - scratch + +![creating docker base image using scratch](http://blog.linoxide.com/wp-content/uploads/2015/03/creating-base-image-using-scratch.png) + + +We can use that image to base our new minimal containers FROM: + +FROM scratch +ADD script.sh /usr/local/bin/run.sh +CMD ["/usr/local/bin/run.sh"] + +The above Dockerfile is from an extremely minimal image. Here, first it starts with a totally blank filesystem, then it copies script.sh that is created to /usr/local/bin/run.sh and then run the script /usr/local/bin/run.sh . + +### Conclusion ### + +Here, in this tutorial, we learned how we can build a custom Docker Base Image out of the box. Building a docker base image is an easy task because there are sets of packages and scripts already available for. Building a docker base image is a lot useful if we want to install what we want in it. So, if you have any questions, suggestions, feedback please write them in the comment box below. Thank you ! Enjoy :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/2-ways-create-docker-base-image/ + +作者:[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://www.docker.com/ +[2]:https://github.com/docker/docker/blob/master/contrib/mkimage-busybox.sh \ No newline at end of file diff --git a/sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md b/sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md new file mode 100644 index 0000000000..806a462675 --- /dev/null +++ b/sources/tech/20150330 How to Serve Git Repositories Using Gitblit Tool in Linux.md @@ -0,0 +1,101 @@ +How to Serve Git Repositories Using Gitblit Tool in Linux +================================================================================ +Hi friends, today we'll be learning how to install Gitblit in your Linux Server or PC. So, lets check out what is a Git, its features and steps to install Gitblit. [Git is a distributed revision control system][1] with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. It was initially designed and developed by Linus Torvalds for Linux kernel under the terms of the GNU General Public License version 2 development in 2005, and has since become the most widely adopted version control system for software development. + +[Gitblit is a free and open source][2] built on a pure Java stack designed to handle everything from small to very large projects with speed and efficiency for serving Git repositories. It is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows. + +#### Features of Gitblit #### + +- It can be used as a dumb repository viewer with no administrative controls or user accounts. +- It can be used as a complete Git stack for cloning, pushing, and repository access control. +- It can be used without any other Git tooling (including actual Git) or it can cooperate with your established tools. + +### 1. Creating Gitblit install directory ### + +First of all we'll gonna to create a directory in our server in which we'll be installing our latest gitblit in. + + $ sudo mkdir -p /opt/gitblit + + $ cd /opt/gitblit + +![creating directory gitblit](http://blog.linoxide.com/wp-content/uploads/2015/01/creating-directory-gitblit.png) + +### 2. Downloading and Extracting ### + +Now, we will want to download the latest gitblit from the official site. Here, the current version of gitblit we are gonna install is 1.6.2 . So, please change it as the version you are gonna install in your system. + + $ sudo wget http://dl.bintray.com/gitblit/releases/gitblit-1.6.2.tar.gz + +![downloading gitblit package](http://blog.linoxide.com/wp-content/uploads/2015/01/downloading-gitblit.png) + +Now, we'll be extracting our downloaded tarball package to our current folder ie /opt/gitblit/ + + $ sudo tar -zxvf gitblit-1.6.2.tar.gz + +![extracting gitblit tar](http://blog.linoxide.com/wp-content/uploads/2015/01/extracting-gitblit-tar.png) + +### 3. Configuring and Running ### + +Now, we'll configure our Gitblit configuration. If you want to customize the behavior of Gitblit server, you can do it by modifying `gitblit/data/gitblit.properties` . Now, after you are done configuring the configuration. We finally wanna run our gitblit. We have two options on running gitblit, first is that we run it manually by the command below: + + $ sudo java -jar gitblit.jar --baseFolder data + +And next is to add and use gitblit as service. Here are the steps that we'll need to follow to use gitblit as service in linux. + +So, As I am running Ubuntu, the command below will be sudo cp service-ubuntu.sh /etc/init.d/gitblit so please change the file name service-ubuntu.sh to the distribution you are currently running. + + $ sudo ./install-service-ubuntu.sh + + $ sudo service gitblit start + +![starting gitblit service](http://blog.linoxide.com/wp-content/uploads/2015/01/starting-gitblit-service.png) + +Open your browser to http://localhost:8080 or https://localhost:8443 or replace "localhost" with the ip-address of the machine depending on your system configuration. Enter the default administrator credentials: admin / admin and click the Login button. + +![gitblit welcome](http://blog.linoxide.com/wp-content/uploads/2015/01/gitblit-welcome.png) + +Now, we'll wanna add a new user. First you'll need to login to the admin with default administrator credentials: username = **admin** and password = **admin** . + +Then, Goto user icon > users > (+) new user. And create a new user like as shown in the figure below. + +![add new user](http://blog.linoxide.com/wp-content/uploads/2015/01/add-user.png) + +Now, we'll create a new repo out of the box. Go to repositories > (+) new repository . Then, add new repository as shown below. + +![add new repository](http://blog.linoxide.com/wp-content/uploads/2015/01/add-new-repository.png) + +#### Create a new repository on the command-line #### + + 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 + +Please replace the username arunlinoxide with the user you add. + +#### Push an existing repository from the command-line #### + + git remote add origin ssh://arunlinoxide@localhost:29418/linoxide.com.git + git push -u origin master + +**Note**: It is highly recommended to everyone to change the password of username "admin" as it comes by default. + +### Conclusion ### + +Hurray, we finally installed our latest Gitblit in our Linux Computer. We can now enjoy such a beautiful version controlling system for our projects whether its small or large, no matter. With Gitblit, version controlling has been too easy. It is easy to learn and has a tiny footprint with lightning fast performance. So, if you have any questions, suggestions, feedback please write them in the comment box below. + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/serve-git-repositories-gitblit/ + +作者:[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://git-scm.com/ +[2]:http://gitblit.com/ \ No newline at end of file diff --git a/sources/tech/20150330 How to secure SSH login with one-time passwords on Linux.md b/sources/tech/20150330 How to secure SSH login with one-time passwords on Linux.md new file mode 100644 index 0000000000..9133679994 --- /dev/null +++ b/sources/tech/20150330 How to secure SSH login with one-time passwords on Linux.md @@ -0,0 +1,180 @@ +How to secure SSH login with one-time passwords on Linux +================================================================================ +As someone says, security is a not a product, but a process. While SSH protocol itself is cryptographically secure by design, someone can wreak havoc on your SSH service if it is not administered properly, be it weak passwords, compromised keys or outdated SSH client. + +As far as SSH authentication is concerned, [public key authentication][1] is in general considered more secure than password authentication. However, key authentication is actually not desirable or even less secure if you are logging in from a public or shared computer, where things like stealth keylogger or memory scraper can always a possibility. If you cannot trust the local computer, it is better to use something else. This is when "one-time passwords" come in handy. As the name implies, each one-time password is for single-use only. Such disposable passwords can be safely used in untrusted environments as they cannot be re-used even when they are stolen. + +One way to generate disposable passwords is [Google Authenticator][2]. In this tutorial, I am going to demonstrate another way to create one-time passwords for SSH login: [OTPW][3], a one-time password login package. Unlike Google Authenticator, you do not rely on any third party for one-time password generation and verification. + +### What is OTPW? ### + +OTPW consists of one-time password generator and PAM-integrated verification routines. In OTPW, one-time passwords are generated apriori with the generator, and carried by a user securely (e.g., printed in a paper sheet). Cryptographic hash of the generated passwords are then stored in the SSH server host. When a user logs in with a one-time password, OTPW's PAM module verifies the password, and invalidates it to prevent re-use. + +### Step One: Install and Configure OTPW on Linux ### + +#### Debian, Ubuntu or Linux Mint #### + +Install OTPW packages with apt-get. + + $ sudo apt-get install libpam-otpw otpw-bin + +Open a PAM configuration file for SSH (/etc/pam.d/sshd) with a text editor, and comment out the following line (to disable password authentication). + + #@include common-auth + +and add the following two lines (to enable one-time password authentication): + + auth required pam_otpw.so + session optional pam_otpw.so + +![](https://farm8.staticflickr.com/7599/16775121360_d1f93feefa_b.jpg) + +#### Fedora or CentOS/RHEL #### + +OTPW is not available as a prebuilt package on Red Hat based systems. So let's install OTPW by building it from the source. + +First, install prerequites: + + $ sudo yum git gcc pam-devel + $ git clone https://www.cl.cam.ac.uk/~mgk25/git/otpw + $ cd otpw + +Open Makefile with a text editor, and edit a line that starts with "PAMLIB=" as follows. + +On 64-bit system: + + PAMLIB=/usr/lib64/security + +On 32-bit system: + + PAMLIB=/usr/lib/security + +Compile and install it. Note that installation will automatically restart an SSH server. So be ready to be disconnected if you are on an SSH connection. + + $ make + $ sudo make install + +Now you need to update SELinux policy since /usr/sbin/sshd tries to write to user's home directory, which is not allowed by default SELinux policy. The following commands will do. If you are not using SELinux, skip this step. + + $ sudo grep sshd /var/log/audit/audit.log | audit2allow -M mypol + $ sudo semodule -i mypol.pp + +Next, open a PAM configuration file for SSH (/etc/pam.d/sshd) with a text editor, and comment out the following line (to disable password authentication). + + #auth substack password-auth + +and add the following two lines (to enable one-time password authentication): + + auth required pam_otpw.so + session optional pam_otpw.so + +#### Step Two: Configure SSH Server for One-time Passwords #### + +The next step is to configure an SSH server to accept one-time passwords. + +Open /etc/ssh/sshd_config with a text editor, and set the following three parameters. Make sure that you do not add these lines more than once, because that will cause an SSH server to fail. + + UsePrivilegeSeparation yes + ChallengeResponseAuthentication yes + UsePAM yes + +You also need to disable default password authentication. Optionally, enable public key authentication, so that you can fall back to key-based authentication in case you do not have one-time passwords. + + PubkeyAuthentication yes + PasswordAuthentication no + +Now restart SSH server. + +Debian, Ubuntu or Linux Mint: + + $ sudo service ssh restart + +Fedora or CentOS/RHEL 7: + + $ sudo systemctl restart sshd + +#### Step Three: Generate One-time Passwords with OTPW #### + +As mentioned earlier, you need to create one-time passwords beforehand, and have them stored on the remote SSH server host. For this, run otpw-gen tool as the user you will be logging in as. + + $ cd ~ + $ otpw-gen > temporary_password.txt + +![](https://farm9.staticflickr.com/8751/16961258882_c49cfe03fb_b.jpg) + +It will ask you to set a prefix password. When you later log in, you need to type this prefix password AND one-time password. Essentially the prefix password is another layer of protection. Even if the password sheet falls into the wrong hands, the prefix password forces them to brute-force. + +Once the prefix password is set, the command will generate 280 one-time passwords, and store them in the output text file (e.g., temporary_password.txt). Each password (length of 8 characters by default) is preceded by a three-digit index number. You are supposed to print the file in a sheet and carry it with you. + +![](https://farm8.staticflickr.com/7281/16962594055_c2696d5ae1_b.jpg) + +You will also see ~/.otpw file created, where cryptographic hashs of these passwords are stored. The first three digits in each line indicate the index number of the password that will be used for SSH login. + + $ 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 + +### Test One-time Passwords for SSH Login ### + +Now let's login to an SSH server in a usual way: + + $ ssh user@remote_host + +If OTPW is successfully set up, you will see a slightly different password prompt: + + Password 191: + +Now open up your password sheet, and look for index number "191" in the sheet. + + 023 kBvp tq/G 079 jKEw /HRM 135 oW/c /UeB 191 fOO+ PeiD 247 vAnZ EgUt + +According to sheet above, the one-time password for number "191" is "fOO+PeiD". You need to prepend your prefix password to it. For example, if your prefix password is "000", the actual one-time password you need to type is "000fOO+PeiD". + +Once you successfully log in, the password used is automatically invalidated. If you check ~/.otpw, you will notice that the first line is replaced with "---------------", meaning that password "191" has been voided. + + OTPW1 + 280 3 12 8 + --------------- + 218tYRZc%PIY27a + 241ve8ns%NsHFmf + 055W4/YCauQJkr: + 102ZnJ4VWLFrk5N + 2273Xww55hteJ8Y + 1509d4b5=A64jBT + 168FWBXY%ztm9j% + 000rWUSdBYr%8UE + 037NvyryzcI+YRX + 122rEwA3GXvOk=z + +### Conclusion ### + +In this tutorial, I demonstrated how to set up one-time password login for SSH using OTPW package. You may realized that a print sheet can be considered a less fancy version of security token in two-factor authentication. Yet, it is simpler and you do not rely on any third-party for its implementation. Whatever mechanism you are using to create disposable passwords, they can be helpful when you need to log in to an SSH server from an untrusted public computer. Feel free to share your experience or opinion on this topic. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/secure-ssh-login-one-time-passwords-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://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.cl.cam.ac.uk/~mgk25/otpw.html \ No newline at end of file diff --git a/sources/tech/20150331 Conky--The Ultimate X Based System Monitor Application.md b/sources/tech/20150331 Conky--The Ultimate X Based System Monitor Application.md new file mode 100644 index 0000000000..fdb2648a36 --- /dev/null +++ b/sources/tech/20150331 Conky--The Ultimate X Based System Monitor Application.md @@ -0,0 +1,147 @@ +Conky – The Ultimate X Based System Monitor Application +================================================================================ +Conky is a system monitor application written in ‘C’ Programming Language and released under GNU General Public License and BSD License. It is available for Linux and BSD Operating System. The application is X (GUI) based that was originally forked from [Torsmo][1]. + +#### Features #### + +- Simple User Interface +- Higher Degree of configuration +- It can show System stats using built-in objects (300+) as well as external scripts either on the desktop or in it’s own container. +- Low on Resource Utilization +- Shows system stats for a wide range of system variables which includes but not restricted to CPU, memory, swap, Temperature, Processes, Disk, Network, Battery, email, System messages, Music player, weather, breaking news, updates and blah..blah..blah +- Available in Default installation of OS like CrunchBang Linux and Pinguy OS. + +#### Lesser Known Facts about Conky #### + +- The Name conky was derived from a Canadian Television Show. +- It has already been ported to Nokia N900. +- It is no more maintained officially. + +### Conky Installation and Usage in Linux ### + +Before we install conky, we need to install packages like lm-sensors, curl and hddtemp using following command. + + # apt-get install lm-sensors curl hddtemp + +Time to detect-sensors. + + # sensors-detect + +**Note**: Answer ‘Yes‘ when prompted! + +Check all the detected sensors. + + # sensors + +#### Sample Output #### + + 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 can be installed from repo as well as, can be compiled from source. + + # yum install conky [On RedHat systems] + # apt-get install conky-all [On Debian systems] + +**Note**: Before you install conky on Fedora/CentOS, you must have enabled [EPEL repository][2]. + +After conky has been installed, just issue following command to start it. + + $ conky & + +![Conky Monitor in Action](http://www.tecmint.com/wp-content/uploads/2015/03/Start-Conkey.jpeg) +Conky Monitor in Action + +It will run conky in a popup like window. It uses the basic conky configuration file located at /etc/conky/conky.conf. + +You may need to integrate conky with the desktop and won’t like a popup like window every-time. Here is what you need to do + +Copy the configuration file /etc/conky/conky.conf to your home directory and rename it as ‘`.conkyrc`‘. The dot (.) at the beginning ensures that the configuration file is hidden. + + $ cp /etc/conky/conky.conf /home/$USER/.conkyrc + +Now restart conky to take new changes. + + $ killall -SIGUSR1 conky + +![Conky Monitor Window](http://www.tecmint.com/wp-content/uploads/2015/03/Restart-Conky.jpeg) +Conky Monitor Window + +You may edit the conky configuration file located in your home dircetory. The configuration file is very easy to understand. + +Here is a sample configuration of conky. + +![Conky Configuration](http://www.tecmint.com/wp-content/uploads/2015/03/Conky-Configuration.jpeg) +Conky Configuration + +From the above window you can modify color, borders, size, scale, background, alignment and several other properties. By setting different alignments to different conky window, we can run more than one conky script at a time. + +**Using script other than the default for conky and where to find it?** + +You may write your own conky script or use one that is available over Internet. We don’t suggest you to use any script you find on the web which can be potentially dangerous unless you know what you are doing. However a few famous threads and pages have conky script that you can trust as mentioned below. + +- [http://ubuntuforums.org/showthread.php?t=281865][3] +- [http://conky.sourceforge.net/screenshots.html][4] + +At the above url, you will find every screenshot has a hyperlink, which will redirects to script file. + +#### Testing Conky Script #### + +Here I will be running a third party written conky-script on my Debian Jessie Machine, to test. + + $ wget https://github.com/alexbel/conky/archive/master.zip + $ unzip master.zip + +Change current working directory to just extracted directory. + + $ cd conky-master + +Rename the secrets.yml.example to secrets.yml. + + $ mv secrets.yml.example secrets.yml + +Install Ruby before you could run this (ruby) script. + + $ sudo apt-get install ruby + $ ruby starter.rb + +![Conky Fancy Look](http://www.tecmint.com/wp-content/uploads/2015/03/Conky-Fancy-Look.jpeg) +Conky Fancy Look + +**Note**: This script can be modified to show your current weather, temperature, etc. + +If you want to start conky at boot, add the below one liner to startup Applications. + + conky --pause 10 + save and exit. + +And Finally…such a lightweight and useful GUI eye candy like package is not in active stage and is not maintained officially anymore. The last stable release was conky 1.9.0 released on May 03, 2012. A thread on Ubuntu forum has gone over 2k pages of users sharing configuration. (link to forum : [http://ubuntuforums.org/showthread.php?t=281865/][5]) + +- [Conky Homepage][6] + +That’s all for now. Keep connected. Keep commenting. Share your thoughts and configuration in comments below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/install-conky-in-ubuntu-debian-fedora/ + +作者:[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://torsmo.sourceforge.net/ +[2]:http://www.tecmint.com/how-to-enable-epel-repository-for-rhel-centos-6-5/ +[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/ \ No newline at end of file diff --git a/sources/tech/20150331 How to Generate or Encrypt or Decrypt Random Passwords in Linux.md b/sources/tech/20150331 How to Generate or Encrypt or Decrypt Random Passwords in Linux.md new file mode 100644 index 0000000000..1cd2991879 --- /dev/null +++ b/sources/tech/20150331 How to Generate or Encrypt or Decrypt Random Passwords in Linux.md @@ -0,0 +1,104 @@ +How to Generate/Encrypt/Decrypt Random Passwords in Linux +================================================================================ +We have taken initiative to produce Linux tips and tricks series. If you’ve missed the last article of this series, you may like to visit the link below. + +注:此篇文章做过原文 +- [5 Interesting Command Line Tips and Tricks in Linux][1] + +In this article, we will share some interesting Linux tips and tricks to generate random passwords and also how to encrypt and decrypt passwords with or without slat method. + +Security is one of the major concern of digital age. We put on password to computers, email, cloud, phone, documents and what not. We all know the basic to choose the password that is easy to remember and hard to guess. What about some sort of machine based password generation automatically? Believe me Linux is very good at this. + +**1. Generate a random unique password of length equal to 10 characters using command ‘pwgen‘. If you have not installed pwgen yet, use Apt or YUM to get.** + + $ pwgen 10 1 + +![Generate Random Unique Password](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Random-Unique-Password-in-Linux.gif) +Generate Random Unique Password + +Generate several random unique passwords of character length 50 in one go! + + $ pwgen 50 + +![Generate Multiple Random Passwords](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-Multiple-Random-Passwords.gif) +Generate Multiple Random Passwords + +**2. You may use ‘makepasswd‘ to generate random, unique password of given length as per choice. Before you can fire makepasswd command, make sure you have installed it. If not! Try installing the package ‘makepasswd’ using Apt or YUM.** + +Generate a random password of character length 10. Default Value is 10. + + $ makepasswd + +![makepasswd Generate Unique Password](http://www.tecmint.com/wp-content/uploads/2015/03/mkpasswd-generate-unique-password.gif) +makepasswd Generate Unique Password + +Generate a random password of character length 50. + + $ makepasswd --char 50 + +![Generate Length 50 Password](http://www.tecmint.com/wp-content/uploads/2015/03/Random-Password-Generate.gif) +Generate Length 50 Password + +Generate 7 random password of 20 characters. + + $ makepasswd --char 20 --count 7 + +![](http://www.tecmint.com/wp-content/uploads/2015/03/Generate-20-Character-Password.gif) + +**3. Encrypt a password using crypt along with salt. Provide salt manually as well as automatically.** + +For those who may not be aware of salt, + +Salt is a random data which servers as an additional input to one way function in order to protect password against dictionary attack. + +Make sure you have installed mkpasswd installed before proceeding. + +The below command will encrypt the password with salt. The salt value is taken randomly and automatically. Hence every time you run the below command it will generate different output because it is accepting random value for salt every-time. + + $ mkpasswd tecmint + +![Encrypt Password Using Crypt](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-Password-in-Linux.gif) +Encrypt Password Using Crypt + +Now lets define the salt. It will output the same result every-time. Note you can input anything of your choice as salt. + + $ mkpasswd tecmint -s tt + +![Encrypt Password Using Salt](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-Password-Using-Salt.gif) +Encrypt Password Using Salt + +Moreover, mkpasswd is interactive and if you don’t provide password along with the command, it will ask password interactively. + +**4. Encrypt a string say “Tecmint-is-a-Linux-Community” using aes-256-cbc encryption using password say “tecmint” and salt.** + + # echo Tecmint-is-a-Linux-Community | openssl enc -aes-256-cbc -a -salt -pass pass:tecmint + +![Encrypt A String in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Encrypt-A-String-in-Linux.gif) +Encrypt A String in Linux + +Here in the above example the output of 注:此篇原文也做过[echo command][2] is pipelined with openssl command that pass the input to be encrypted using Encoding with Cipher (enc) that uses aes-256-cbc encryption algorithm and finally with salt it is encrypted using password (tecmint). + +**5. Decrypt the above string using openssl command using the -aes-256-cbc decryption.** + + # echo U2FsdGVkX18Zgoc+dfAdpIK58JbcEYFdJBPMINU91DKPeVVrU2k9oXWsgpvpdO/Z | openssl enc -aes-256-cbc -a -d -salt -pass pass:tecmint + +![Decrypt String in Linux](http://www.tecmint.com/wp-content/uploads/2015/03/Decrypt-String-in-Linux.gif) +Decrypt String in Linux + +That’s all for now. If you know any such tips and tricks you may send us your tips at admin@tecmint.com, your tip will be published under your name and also we will include it in our future article. + +Keep connected. Keep Connecting. Stay Tuned. Don’t forget to provide us with your valuable feedback in the comments below. + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/generate-encrypt-decrypt-random-passwords-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/5-linux-command-line-tricks/ +[2]:http://www.tecmint.com/echo-command-in-linux/ \ No newline at end of file diff --git a/sources/tech/20150331 How to Install WordPress with Nginx in a Docker Container.md b/sources/tech/20150331 How to Install WordPress with Nginx in a Docker Container.md new file mode 100644 index 0000000000..9f74c672f4 --- /dev/null +++ b/sources/tech/20150331 How to Install WordPress with Nginx in a Docker Container.md @@ -0,0 +1,348 @@ +How to Install WordPress with Nginx in a Docker Container +================================================================================ +Hi all, today we'll learn how to install WordPress running Nginx Web Server in a Docker Container. WordPress is an awesome free and open source Content Management System running thousands of websites throughout the globe. [Docker][1] is an Open Source project that provides an open platform to pack, ship and run any application as a lightweight container. It has no boundaries of Language support, Frameworks or packaging system and can be run anywhere, anytime from a small home computers to high-end servers. It makes them great building blocks for deploying and scaling web apps, databases, and back-end services without depending on a particular stack or provider. + +Today, we'll deploy a docker container with the latest WordPress package with necessary prerequisites ie Nginx Web Server, PHP5, MariaDB Server, etc. Here are some short and sweet steps to successfully install a WordPress running Nginx in a Docker Container. + +### 1. Installing Docker ### + +Before we really start, we'll need to make sure that we have Docker installed in our Linux machine. Here, we are running CentOS 7 as host so, we'll be running yum manager to install docker using the below command. + + # yum install docker + +![Installing Docker](http://blog.linoxide.com/wp-content/uploads/2015/03/installing-docker.png) + + # systemctl restart docker.service + +### 2. Creating WordPress Dockerfile ### + +We'll need to create a Dockerfile which will automate the installation of the wordpress and its necessary pre-requisites. This Dockerfile will be used to build the image of WordPress installation we created. This WordPress Dockerfile fetches a CentOS 7 image from the Docker Registry Hub and updates the system with the latest available packages. It then installs the necessary softwares like Nginx Web Server, PHP, MariaDB, Open SSH Server and more which are essential for the Docker Container to work. It then executes a script which will initialize the installation of WordPress out of the box. + + # nano Dockerfile + +Then, we'll need to add the following lines of configuration inside that 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 Dockerfile](http://blog.linoxide.com/wp-content/uploads/2015/03/Dockerfile-wordpress.png) + +### 3. Creating Start script ### + +After we create our Dockerfile, we'll need to create a script named start.sh which will run and configure our WordPress installation. It will create and configure database, passwords for wordpress. To create it, we'll need to open start.sh with our favorite text editor. + + # nano start.sh + +After opening start.sh, we'll need to add the following lines of configuration into it. + + #!/bin/bash + + __check() { + if [ -f /usr/share/nginx/html/wp-config.php ]; then + exit + fi + } + + __create_user() { + # Create a user to SSH into as. + SSH_USERPASS=`pwgen -c -n -1 8` + useradd -G wheel user + echo user:$SSH_USERPASS | chpasswd + echo ssh user password: $SSH_USERPASS + } + + __mysql_config() { + # Hack to get MySQL up and running... I need to look into it more. + 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() { + # Here we generate random passwords (thank you pwgen!). The first two are for mysql users, the last batch for random keys in wp-config.php + WORDPRESS_DB="wordpress" + MYSQL_PASSWORD=`pwgen -c -n -1 12` + WORDPRESS_PASSWORD=`pwgen -c -n -1 12` + # This is so the passwords show up in logs. + 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 + # There used to be a huge ugly line of sed and cat and pipe and stuff below, + # but thanks to @djfiander's thing at https://gist.github.com/djfiander/6141138 + # there isn't now. + 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 start mysqld.service + 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 + } + + # Call all functions + __check + __create_user + __mysql_config + __handle_passwords + __httpd_perms + __start_mysql + __run_supervisor + +![Start Script](http://blog.linoxide.com/wp-content/uploads/2015/03/start-script.png) + +After adding the above configuration, we'll need to save it and then exit. + +### 4. Creating Configuration files ### + +Now, we'll need to create configuration file for Nginx Web Server named nginx-site.conf . + + # nano nginx-site.conf + +Then, we'll add the following configuration to the config file. + + 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 configuration](http://blog.linoxide.com/wp-content/uploads/2015/03/nginx-conf.png) + +Now, we'll create supervisord.conf file and add the following lines as shown below. + + # nano supervisord.conf + +Then, add the following lines. + + [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 Configuration](http://blog.linoxide.com/wp-content/uploads/2015/03/supervisord.png) + +After adding, we'll save and exit the file. + +### 5. Building WordPress Container ### + +Now, after done with creating configurations and scripts, we'll now finally use the Dockerfile to build our desired container with the latest WordPress CMS installed and configured according to the configuration. To do so, we'll run the following command in that directory. + + # docker build --rm -t wordpress:centos7 . + +![Building WordPress Container](http://blog.linoxide.com/wp-content/uploads/2015/03/building-wordpress-container.png) + +### 6. Running WordPress Container ### + +Now, to run our newly built container and open port 80 and 22 for Nginx Web Server and SSH access respectively, we'll run the following command. + + # CID=$(docker run -d -p 80:80 wordpress:centos7) + +![Run WordPress Docker](http://blog.linoxide.com/wp-content/uploads/2015/03/run-wordpress-docker.png) + +To check the process and commands executed inside the container, we'll run the following command. + + # echo "$(docker logs $CID )" + +TO check if the port mapping is correct or not, run the following command. + + # docker ps + +![docker state](http://blog.linoxide.com/wp-content/uploads/2015/03/docker-state.png) + +### 7. Web Interface ### + +Finally if everything went accordingly, we'll be welcomed with WordPress when pointing the browser to http://ip-address/ or http://mywebsite.com/ . + +![Wordpress Start](http://blog.linoxide.com/wp-content/uploads/2015/03/wordpress-start.png) + +Now, we'll go step wise through the web interface and setup wordpress configuration, username and password for the WordPress Panel. + +![Wordpress Welcome](http://blog.linoxide.com/wp-content/uploads/2015/03/wordpress-welcome.png) + +Then, use the username and password entered above into the WordPress Login page. + +![wordpress login](http://blog.linoxide.com/wp-content/uploads/2015/03/wordpress-login.png) + +### Conclusion ### + +We successfully built and run WordPress CMS under LEMP Stack running in CentOS 7 Operating System as the docker OS. Running WordPress inside a container makes a lot safe and secure to the host system from the security perspective. This article enables one to completely configure WordPress to run under Docker Container with Nginx Web Server. If you have any questions, suggestions, feedback please write them in the comment box below so that we can improve or update our contents. Thank you ! Enjoy :-) + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-wordpress-nginx-docker-container/ + +作者:[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://docker.io/ \ 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..8f98a2ba02 --- /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 \ No newline at end of file diff --git a/sources/tech/20150331 Its Now Worth Try Installing PHP 7.0 on CentOS 7.x or Fedora 21.md b/sources/tech/20150331 Its Now Worth Try Installing PHP 7.0 on CentOS 7.x or Fedora 21.md new file mode 100644 index 0000000000..68db83d812 --- /dev/null +++ b/sources/tech/20150331 Its Now Worth Try Installing PHP 7.0 on CentOS 7.x or Fedora 21.md @@ -0,0 +1,324 @@ +translating wi-cuckoo LLAP +Its Now Worth Try Installing PHP 7.0 on CentOS 7.x / Fedora 21 +================================================================================ +PHP is a well known general purpose, server side web scripting language. A vast majority of online websites are coded in this language. PHP is ever evolving, feature rich, easy to use and well organized scripting language. Currently PHP development team is working on next major release of PHP, named PHP 7. The current production PHP version is PHP 5.6, as you might already know that PHP 6 was aborted in the past, the supporters of PHP 7 did not want the next important PHP version to be confused with that branch that was killed long time in the past. So it has been decided to name the next major release of PHP as PHP 7 instead of 6. PHP 7.0 is supposed to be released in November this year. + +Here are some of the prominent features in next major PHP release. + +- In order to improve performance and memory footprints PHPNG feature has been added to this new release. +- JIT engine has been included to dynamically compile Zend opcodes into native machine code in order to achieve faster processing. This feature will allow subsequent calls to the same code so that it may run much faster. +- AST (Abstract Syntax Tree) is a newly added feature which will enhance support for php extensions and userland applications. +- Asynchronous Programming feature will add support for parallel tasks within the same request. +- New version will support for stand alone multi-threading web server so that it may handle many simultaneous requests using a single memory pool. + +### Installing PHP 7 on Centos / Fedora ### + +Lets see how we can install PHP7 on Centos 7 and Fedora 21. In order to install PHP7 we will need to first clone php-src repository. Once cloning process is complete, we will configure and compile it. Before we proceed, lets ensure that we do have followings installed on our Linux system otherwise PHP compile process will return errors and abort. + +- Git +- autoconf +- gcc +- bison + +All of the above metioned prerequisits can be installed using Yum package manager. The following single command should take care of this: + + yum install git autoconf gcc bison + +Ready to start PHP7 installation process ? Lets first create PHP7 directory and make it your working directory. + + mkdir php7 + + cd php7 + +Now clone php-src repo, run following command on the terminal. + + git clone https://git.php.net/repository/php-src.git + +The process should complete in few min, here is sample output which you should see at the completion of this task. + + [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. + +Lets configure and compile PHP7, run following commands on the terminal to start the configuration process: + + cd php-src + + ./buildconf + +Here is sample output for ./buildconf command. + + [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 + +Proceed further with the configuration process using following command: + + ./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 + +It will take a sweet amount to time, once completed, you should see output like this: + + 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 + + + +Run following command to complete the compilation process. + + make + +Sample output for “make” command is shown below: + + 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'. + +That’s all, its time to install PHP7 now, run following to install it. + + make install + +Sample output for successful install process should look like: + + [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/ + +Conguratulaion, PHP 7 has been installed on your Linux system now. Once installation is complete, move to sapi/cli direcoty inside php7 installation folder. + + cd sapi/cli + +and verify PHP version from here. + + [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 + +### Conclusion ### + +PHP 7 is also [added in remi repositories][1], this upcoming version is mainly focused on performance improvements, its new features are aimed to make PHP as a well fit for modern programming needs and trends. PHP 7.0 will have many new features and some deprecations to the old items. We hope to see details about new features and deprecations in the coming months. Enjoy! + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/linux-how-to/install-php-7-centos-7-fedora-21/ + +作者:[Aun Raza][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/arunrz/ +[1]:http://blog.famillecollet.com/post/2015/03/25/PHP-7.0-as-Software-Collection diff --git a/sources/tech/20150331 Linux Email App Geary Updated--How To Install It In Ubuntu.md b/sources/tech/20150331 Linux Email App Geary Updated--How To Install It In Ubuntu.md new file mode 100644 index 0000000000..1ddccaa8c6 --- /dev/null +++ b/sources/tech/20150331 Linux Email App Geary Updated--How To Install It In Ubuntu.md @@ -0,0 +1,70 @@ +Linux Email App Geary Updated — How To Install It In Ubuntu +================================================================================ +**Geary, the popular desktop email client for Linux, has been updated to version 0.10 — and it gains a glut of new features in the process.** + +![An older version of Geary running in elementary OS](http://www.omgubuntu.co.uk/wp-content/uploads/2015/01/geary.jpg) +An older version of Geary running in elementary OS + +Geary 0.100 features some welcome user interface improvements and additional UI options, including: + +- New: Ability to ‘Undo’ Archive, Trash and Move actions +- New: Option to switch between a 2 column or 2 column layout +- New “split header bar” — improves message list, composer layouts +- New shortcut keys — use j/k to navigate next/previous conversations + +This update also introduces a **brand new full-text search algorithm** designed to improve the search experience in Geary, according to Yorba. + +This introduction should calm some complaints of the app’s search prowess, which often sees Geary return a slew of search results that are, to quote software outfit themselves, “…seemingly unrelated to the search query.” + +> ‘Yorba recommends that all users of the client upgrade to this release’ + +*“Although not all search problems are fixed in 0.10, Geary should be more conservative about displaying results that match the user’s query,” [the team notes][1]. * + +Last but by no means least on the main feature front is something sure to find favour with power users: **support for multiple/alternate e-mail addresses per account**. + +If your main Gmail account is set-up in Geary to pull in your Yahoo, Outlook and KittyMail messages too then you should now see them all kept neatly together and be given the option of picking which identity you send from when using the composer ‘From’ field. No, it’s not the sexiest feature but it is one that has been requested often. + +Rounding out this release of the popular Linux email client is the usual gamut of bug fixes, performance optimisations and miscellaneous improvements. + +Yorba recommends that all users of the client upgrade to this release. + +### Install Geary 0.10 in Ubuntu 14.04, 14.10 & 15.04 ### + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2014/09/geary-inline-composor.jpg) + +The latest version of Yorba is available to download as source, ready for compiling from the GNOME Git. But let’s be honest: that’s a bit of a hassle, right? + +Ubuntu users wondering how to install Geary 0.10 in **14.04, 14.10** and (for early birds) **15.04** have things easy. + +The official Yorba PPA contains the **latest versions of Geary** as well as those for Shotwell (photo manager) and [California][2] (calendar app). Be aware that any existing versions of these apps installed on your computer may/will be upgraded to a more recent version by adding this PPA. + +Capiche? Coolio. + +To install Geary in Ubuntu you first need to add the Yorba PPA your Softwares Sources. To do this just open a new Terminal window and carefully enter the following two commands: + + sudo add-apt-repository ppa:yorba/ppa + + sudo apt-get update && sudo apt-get install geary + +After hitting return/enter on the last you’ll be prompted to enter your password. Do this, and then let the installation complete. + +![](http://www.omgubuntu.co.uk/wp-content/uploads/2013/04/20130320161830-geary-yorba.png) + +Once done, open your desktop environment’s app launcher and seek out the ‘Geary’ icon. Click it, add your account(s) and discover [what the email mail man has dropped off through the information superhighway][3] and into the easy to use graphical interface. + +**Don’t forget: you can always tip us with news, app suggestions, and anything else you’d like to see us cover by using the power of electronic mail. Direct your key punches to joey [at] oho [dot] io.** + +-------------------------------------------------------------------------------- + +via: http://www.omgubuntu.co.uk/2015/03/install-geary-ubuntu-linux-email-update + +作者:[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://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/sources/tech/20150401 ZMap Documentation.md b/sources/tech/20150401 ZMap Documentation.md new file mode 100644 index 0000000000..810140d774 --- /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 \ No newline at end of file diff --git a/translated/share/20141204 Intense Gameplay--Try these 13 Roguelike games.md b/translated/share/20141204 Intense Gameplay--Try these 13 Roguelike games.md new file mode 100644 index 0000000000..aedc2fe881 --- /dev/null +++ b/translated/share/20141204 Intense Gameplay--Try these 13 Roguelike games.md @@ -0,0 +1,400 @@ +寻求激烈的游戏玩法?那就试试这 13 款 Roguelike 游戏吧 +================================================================================ +Roguelike 是角色扮演游戏的一个子类。从字面上看,它的意思是 “像 Rogue 的游戏”。Rogue 是一个关于地下城冒险的视频游戏,于 1980 年第一次发行,以友好、易上瘾而著称。这个游戏的目标是取得深藏于第 26 层的 "Amulet of Yendor",再返回到顶层逃出生天。 + +Roguelike 的准确定义并不存在,但这类游戏通常具有下面的特点: + +- 奇幻的叙事背景; +- 程序性的关卡产生。每个新的游戏环节中的游戏世界均由游戏产生。这样做是为了鼓励玩家重玩; +- 回合制的地下城探险和战斗; +- 随机生成的基于瓷砖的(Tile-based)图形环境; +- 随机的冲突生成; +- 永久死亡 。在游戏中,死亡真的存在,一旦你死了,就代表你真的结束了。 +- 高难度。 + +这篇文章精心挑选了一些可运行在 Linux 平台下的 roguelike 游戏。假如你喜欢激烈、易上瘾的游戏,可以尝试这 13 款游戏。不要因它们原始的画质而退步,一旦你沉浸其中,你将很快忘记画面的简陋。所有的这些都可以免费下载,并且几乎所有的游戏都是在开源协议下发行的。 +---------- + +![](http://www.linuxlinks.com/portal/content2/png/DungeonCrawlStoneSoup.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-Dungeon1.png) + +Dungeon Crawl Stone Soup 是一个开源的,单用户角色扮演类的 roguelike 游戏,玩家要在充满危险和不友好的怪兽的地下城中进行探险和寻找宝藏,并在任务中拯救 mystifyingly fabulous Orb of 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 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/DwarfFortress.png) + +![](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 + +---------- + +![](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) 是一个 rogue-like 游戏,自从 1994 年开始,它一直在开发。 + +它是一个包含复杂地牢的单用户游戏。你控制一个用种族,类别,属性,技巧和装备等描述的虚构角色。这个虚构角色正尝试着达到一个特定的目标(参考下面的介绍)并在一个困难的任务中取胜。为了完成任务,你必须在以前没有发现的隧道和地牢中探险,和丑陋的怪兽战斗,解开一系列遗忘的秘密,并找到宝藏。 + +在游戏期间,你在每次游戏时随机生成的各层地牢中探索。你也可能遇到某个特定的关卡,其中有着特定的挑战或者围绕某个特定主题而生成。 + +特点包括: + +- 拥有上百个地点的巨大游戏世界,例如城堡,随机生成的地牢,主题寺庙,墓地,古代遗迹,塔台和其他名胜; +- 各种各样的种族(dwarves, drakelings, mist elves, hurthlings, orcs, trolls, ratlings and many others)(注:种族信息可以参考[这里](http://ancardia.wikia.com/wiki/Race) 和更多的类别 (fighters, elementalists, assassins, chaos knights, duelists and much more),允许无限的游戏风格; +- 上百个怪兽和物品,其中的许多拥有增强的随机特性; +- 一个堕落系统,迫使你在对力量的欲望和对诅咒的恐惧之间进行权衡; +- 法术,祈祷,思想技艺,炼金术,手工艺和更多; +- 多样的任务和分支故事主线; +- 许多完全不同的结局,可能改变现实本身 + +- 网站: [www.adom.de][3] +- 开发者: Thomas Biskup +- 协议: Postcardware +- 版本号: 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) (注:中文翻译为 马基埃亚尔的传说) 是一个免费,开源的 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 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/CataclysmDarkDaysAhead1.png) + +![](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 种物品类型,包括众多的现实世界的枪支,药品和工具; + - 许多药品是上瘾的,并需要持续使用来避免负面效果; +- 通过修补门,窗,建造陷阱和巩固你的家的基石来防止一个僵尸的突然造访; +- 拥有构建你自己的木质建筑,包括墙和屋顶的能力; +- 使用汽车在“后末世”发现的景观中兜风; + - 这个可以根据你的需求来修改,或甚至你可以从底层建造一个景观; +- 一个温度系统,太冷或太热都非常危险; +- 初步支持 tile 界面; +- 一个类似于 World Gen 一样的选项和多彩的编辑方法; + +- 网站: [en.cataclysmdda.com][5] +- 作者: Kevin Granade 及其他 +- 协议: Creative Commons Attribution-ShareAlike 3.0 Unported License +- 版本号: 0.B + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/GoblinHack1.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-GoblinHack.png) + +Goblin Hack 是一个拥有基于 OpenGL 的平滑滚动的图形界面的开源 roguelike 游戏。这个游戏受 NetHack 外观的启发,但更加快速且使用更少的按键。 + +Goblin Hack 有一个简洁的界面,在今天这个过度渲染的游戏世界中,似乎它对所有年龄段的玩家都有吸引力,并启发了这些玩家的想象力。 + +在被投进一个随机的正在生成的地牢之前,玩家可以从几个角色类别中选择一个角色。 + +特点包括: + +- 令人印象深刻的界面(相比于许多其他的 roguelike 游戏); +- 简洁的界面; +- 在被投进一个随机的正在生成的第一层地牢之前,玩家可以从几个角色类别中选择一个角色; +- 手动保存游戏; + +- 网站: [goblinhack.sourceforge.net][6], [github.com/goblinhack/goblinhack][7] +- 作者: Neil McGill +- 协议: GNU GPL v2 +- 版本号: 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) 是一个角色扮演游戏,在其中你控制一个单独的角色。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 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/NetHack.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games/Screenshot-NetHack.jpg) + + +NetHack 是一个绝妙的简洁,但又非常吸引人的具有地下城与龙风格的冒险游戏。“net”元素指的是它的发展已经根据网络进行了协调,“hack”元素指的是角色扮演游戏的一种体裁,以乱砍、猛砍著称,着眼于战斗。 + +在 NetHack 中,你扮演激烈的战士、精灵或许多其他种类的一部分角色,一路战斗着,为你的神灵获取 Amulet of Yendor(可以说这是一个倒退!)。在这个过程中,你可能会遇到一个或两个 quantum mechanic(注:从[这里](http://nethack.wikia.com/wiki/Quantum_mechanic)得知,这指的是一种怪兽),或者可能遇到一个小型的太空舰队,抑或是 --假如你*足够*幸运 -- Ravenous Bugblatter Beast of Traal。(注:我参考了[这里](http://nethack.wikia.com/wiki/Douglas_Adams))。 + +特点包括: + +- 45-50 个关卡, 其中的大多数随机生成 +- 各种各样的物品:武器、盔甲、卷轴、药水、戒指、宝石和各种各样的工具,如钥匙和灯 +- 祝福和诅咒 +- Permadeath永久死亡: 若没有对当前的保存文件进行备份,过期的角色不能再找回; +- 界面: + - 控制台; + - 图形化界面, 使用 X、Qt 工具集或 GNOME 库 + +- 网站: [www.nethack.org][9] +- 开发者: NetHack 开发团队 +- 协议: NetHack 通用公共许可证 +- 版本号: 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 是一个免费的太空战斗/探险/交易游戏,它基于经典的电脑游戏 `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, and Viridian; +- 可下载的任务; +- 任务可用脚本编辑; +- Ascii Sector 任务语言,在 Ascii Sector 宇宙中创造你自己的故事; +- 可以袭击或抢劫位于星球上的 NPCs(指非玩家控制角色); +- 可以到处移动的持久性舰队、可以改变系统的控制、玩弄敌人的舰队、回基地修复或重建; +- 可以登录系统受损的飞船; +- 可下载高质量的音乐文件; + +- 网站: [www.asciisector.net][10] +- 开发者: Christian Knudsen +- 协议: 免费软件 +- 版本号: 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 是一个免费、单用户、图形界面的地下城探险游戏,它使用 ASCII 字符的角色,在其中你将以一个冒险者的角色探索一个深深的地下城,与怪兽战斗,获得你能取得的最好武器,准备着与黑暗之主 Morgoth 的最后绝战。从上世纪九十年代开始,它一直在持续地开发着。 + +Angband 沿袭了 Rogue 和 NetHack 的风格路线。它由 Moria 和 Umoria 游戏衍生而来,反过来这两个游戏都以 Rogue 为基础。它经常被描述为一个 “roguelike”游戏,因为它的外观和游戏体验与 Rogue 非常相似。很多游戏中的新生物、物品都来自 J.R.R Tolkien 的画作,尽管有些野兽直接来源于经典的神话、Dungeons & Dragons, Rolemaster(根据wikipedia,这两个都是角色扮演游戏的名称)、或原来 Angband 开发者的脑海中。 + +特点包括: + +- 100 层地牢; +- 随机产生的新关卡; +- 可以选择成为人类、半精灵、精灵、霍比特人、地精、矮人,半兽人,半巨魔, 登丹人 ,高等精灵,或者狗头人; +- 神器; +- 施法; +- 怪物; +- 怪物坑; +- 怪物巢穴; + +- 网站: [rephial.org][11] +- 开发者: Angband 开发小组 +- 协议: GNU GPL v2 +- 版本号: 3.5.0 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/UnNetHack1.png) + +![](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 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/HydraSlayer.png) + +![](http://www.linuxlinks.com/portal/content/reviews/Games2/Screenshot-HydraSlayer.png) + +Hydra Slayer 是一个专注于杀死九头蛇的开源 Roguelike 游戏。它受希腊神话、地下城探险、MathRL 七日 rouguelike,和一些关于勇敢的英雄杀死多头野兽的数字谜题等启发。 + +特点如下: + +- 独特的游戏机制; +- 混合希腊神话和数字迷宫的主题; +- 传统的 roguelike ASSCII 字符界面或 砖块/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 + +---------- + +![](http://www.linuxlinks.com/portal/content2/png/Brogue1.png) + +![](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 (流明石)(注:这里与我在[这里](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) +校对:[校对者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]:levelling system \ No newline at end of file diff --git a/translated/share/20150323 Papyrus--An Open Source Note Manager.md b/translated/share/20150323 Papyrus--An Open Source Note Manager.md new file mode 100644 index 0000000000..87c80fa0ac --- /dev/null +++ b/translated/share/20150323 Papyrus--An Open Source Note Manager.md @@ -0,0 +1,61 @@ +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的功能: ### + +虽然Papyrus强调简洁,它依然有很多丰富的功能。他的一些主要功能如下: +- 按类别和标签管理笔记 +- 高级搜索选项 +- 触屏模式 +- 全屏选项 +- 备份至Dropbox/硬盘 +- 某些页面允许加密 +- 可与其他软件共享笔记 +- 与Dropbox加密同步 +- 除Linux外,还可在Android,Windows和OS X使用 + +### Install 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吧,你会喜欢上它的。 + +(译者注;此软件暂无中文版) + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/papyrus-open-source-note-manager/ + +作者:[Abhishek][a] +译者:[KevinSJ](https://github.com/KevinSJ) +校对:[校对者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/go-for-it-to-do-app-in-linux/ +[2]:http://aseman.co/en/products/papyrus/ +[3]:https://github.com/sialan-labs/kaqaz/ +[4]:http://aseman.co/en/products/papyrus/ diff --git a/translated/talk/20141203 Docker--Present and Future.md b/translated/talk/20141203 Docker--Present and Future.md deleted file mode 100644 index da2b1b7b48..0000000000 --- a/translated/talk/20141203 Docker--Present and Future.md +++ /dev/null @@ -1,168 +0,0 @@ -Docker的现状与未来 -================================================================================ - -### Docker - 故事渊源流长 ### - -Docker是一个专为Linux容器而设计的工具集,用于‘构建,交付和运行’分布式应用。它最初是通过DotCloud作为一个开源项目在2013年3月的时候发布的。这个项目越来越受欢迎,这使得DotCloud更名为Docker公司(并最终 [出售了原有的PaaS业务][1]).[Docker 1.0][2]是在2014年6月发布的,而且延续了之前每月更新一个版本的习惯。 - - -1.0版本的发布标志着Docker公司认为这个平台的充分成熟已经足以用于生产环境中(由本公司与合作伙伴提供付费支持选项).每个月发布的更新显示,该项目正在迅速发展,增添一些新特性、解决一些他们发现的问题。然而该项目已经成功地从‘运行’和‘交付’实现分离,所以任何版本的Docker镜像源都可以与其它版本共同使用(具备向前和向后兼容的特性),这为Docker使用的快速变化提供了稳定的保障。 - -Docker之所以能够成为最受欢迎的开源项目之一除了很多人会认为是的炒作成分,也是由坚实的物质基础奠定的。Docker的影响力已经得到整个行业许多品牌的支持,包括亚马逊, Canonical公司, 世纪互联, 谷歌, IBM, 微软, New Relic, Pivotal, 红帽和VMware. 这使只要Linux可使用的地方,Docker的使用便无处不在。除了这些鼎鼎有名的大公司以外,许多初创公司也在围绕着Docker在成长,或者改变他们的发展方向来与Docker更好地结合起来。这些合作关系(无论大于小)都将帮助推动Docker核心项目及其周边生态环境的快速发展。 - - -### Docker技术的简要综述 ### - -Docker利用Linux的一些内核工具例如[cGroups][3],命名空间和[SElinux][4]来实现容器之间的隔离。起初Docker只是[LXC][5]容器管理器子系统的前端,但是在0.9版本中引入了[libcontainer][6],这是原生go语言库用于提供用户空间和内核之间的接口。 - -容器位于联合文件系统的顶部,例如[AUFS][7],它允许跨多个容器共享例如操作系统镜和安装相关库的组件。在文件系统中的分层方法也利用[ Dockerfile ] [8]中的DevOps工具,这些工具能够成功地完成高速缓存的操作。利用等待时间来安装操作系统和相关应用程序依赖包将会极大地加速测试周期。容器之间的共享库也能够减少内存的占用。 - -一个容器是从一个镜像开始运行的,它可以本地创建,本地缓存,或者通过注册表来下载。Docker公司经营的 [Docker 公有注册库][9],这为各种操作系统、中间件和数据库提供了主机官方仓库。组织和个人可以在docker公司的为镜像创建公有库,并且也有举办私人仓库的订阅服务。由于上传的镜像会包含几乎所有Docker提供的自动化构建工具(以往称为“受信任的构建”),它的镜像是从Dockerfile创建的,而Dockerfile是镜像内容的清单。 - -### 容器 vs 虚拟机 ### - -容器会比虚拟机更高效,因为它们能够分享一个内核和分享共享应用程序库。相比虚拟机系统,这也将使得Docker使用的内存空间很小,即使虚拟机利用了内存超量使用的技术。部署容器时共享底层的镜像层也可以减少内存的占用。IBM的Boden Russel已经做了一些[基准测试][10]说明两者的不同。 - -相比虚拟机系统,容器呈现出较低系统开销的优势,所以在容器中,应用程序的运行效率将会等效于在同样的应用程序在虚拟机中运行甚至效果更佳。IBM的一个研究团队已经发表了一本名为[虚拟机与Linux容器的性能比较]的文章[11]. - - -容器在隔离特性上要比虚拟机逊色。虚拟机可以利用ring-1[硬件隔离][12]例如Intel的VT-d和VT-x技术。这种隔离可以防止虚拟机爆发和彼此交互。而容器至今还没有任何形式的硬件隔离,这使它容易受到攻击。一个命名为[Shocker][13]的概念攻击验证表明,在之前的1.0版本中Docker是存在这种脆弱性的。尽管Docker1.0修复了许多由于Shocker漏洞引发较为的严重问题,Docker的CTO Solomon Hykes仍然[表态][14],“当我们自然而然地说Docker的开箱即用是安全的,即便包含了不收信任的uid0程序,我们将会很明确地这样表述。”Hykes的声明承认,其它的漏洞及相关的风险依旧存在,所以在容器成为受信任的工具之前将有更多的工作需要被完成。 - -对于许多用户案例而言,在容器和虚拟机两者之间选择一种是一种错误的二分法。Docker同样可以在虚拟机中很好工作,它可以被用于现有的虚拟基础措施、私有云或者公有云。同样也可以在容器里跑虚拟机,这也是谷歌使用云平台的一部分。给予一个广泛可利用的基础设施例如IaaS服务,可以为虚拟机提供合理的预期需求,这个合理的预期即容器与虚拟机一起使用的情景将会在数年后出现。容器管理和虚拟机技术有可能被集成到一起提供一个两全其美的方案;所以,位于libcontainer 容器后面的硬件信任锚微虚拟化实施例,可与前端 Docker 工具链和生态系统整合,而不同于后端使用的是能够提供更好绝缘性。微虚拟化(例如Bromium的[vSentry][15]和VMware的 [Project Fargo][16])已经在桌面环境中使用以提供应用程序之间基于硬件的隔离,所以类似的方法可以用于连接libcontainer代替Linux内核中的容器机制。 - -### ‘Dockerizing’ 应用程序 ### - -几乎所有Linux应用程序都可以在Docker容器中运行。它们不受任何语言的选择或框架的限制。唯一在实践中受限的是从操作系统的角度来允许容器做什么。即使如此,bar可以在特权模式下通过运行容器,从而大大减少了控制(并相应地增加了容器中的应用程序,这将会导致损坏主机操作系统存在的风险)。 - - -容器都是从镜像开始运行的,而镜像也可以从运行中的容器获取。通常使用2中方法从容器中获取应用程序,分别是手动获取和Dockerfile.. - -#### 手动构建 #### - -手动构建首先通过基础操作系统镜像启动一个基本操作。交互式的终端可以安装应用程序和用于包管理的依赖项来选择所需要的Linux风格。Zef Hemel在‘[使用Linux容器来支持便携式应用程序部署][17]’的文章中讲述了他部署的过程。一旦应用程序被安装之后,容器可以被推送至注册中心(例如Docker Hub)或者导出一个tar文件。 - -#### Dockerfile #### - -Dockerfile是一个用于构建Docker容器的脚本化系统。每一个Dockerfile定义了开始的基础镜像,从一系列的命令在容器中运行或者一些列的文件被添加到容器中。当容器启动时默认命令会在启动时被执行,Dockerfile也可以指定对外的端口和当前工作目录。容器类似手工构建一样可以通过可推送或导出的Dockerfiles来构建。Dockerfiles也可以被用于Docker Hub的自动构建系统,使用的镜像受Docker公司的控制并且该镜像源代码是任何人可视的。 - - -####仅仅一个进程? #### - -无论镜像是手动构建还是通过Dockerfile构建,有一个关键的考虑因素是当容器启动时,只有一个进程进程被启动。对于一个容器一对一服务的目的,例如运行一个应用服务器,运行一个单一的进程不是一个问题(有些关于容器应该只有一个单独的进程的争议)。对于一些容器需要启动多个进程的情况,必须先启动 [supervisor][18]进程,才能生成其它内部所需的进程。 - -### 容器和微服务 ### - -一个完整的关于使用微服务结构体系的原理和好处已经远远超出了这篇文章(并已经覆盖了[InfoQ eMag: Microservices][19])的范围).然而容器是微服务捆绑和部署实例的捷径。 - -尽管大多数实际案例表明大量的微服务目前还是大多数部署在虚拟机,容器相对拥有较小的部署机会。容器具备位操作系统共享内存和硬盘占用量的能力,库常见的应用程序代码也意味着并排部署多个办法的服务是非常高效的。 - -### 连接容器 ### - -一些小的应用程序适合放在单独的容器中,但在许多案例中应用程序将遍布多个容器。Docker的成功包括催生了一连串的新应用程序组合工具、业务流程工具和实现平台作为服务(PaaS)过程。许多工具还帮助实现缩放、容错、业务管理以及对已部署资产进行版本控制。 - - -#### 连接 #### - -Docker的网络功能是相当原始的。在同一主机,容器内的服务和一互相访问,而且Docker也可以通过端口映射到主机操作系统使服务可以通过网络服务被调用。官方的赞助方式是连接到[libchan][20],这是一个提供给Go语言的网络服务库,类似于[channels][21]。直至libcan找到方法进入应用程序,第三方应用仍然有很大空间可提供配套的网络服务。例如,[Flocker][22]已经采取了基于代理的方法使服务实现跨主机(以及底层存储)移植。 - -#### 合成 #### - -Docker本身拥有把容器连接在一起的机制,与元数据相关的依赖项可以被传递到相依赖的容器并用于环境变量和主机入口的消耗。应用合成工具例如[Fig][23]和[geard][24]展示出其依赖关系图在一个独立的文件中,于是多个容器可以汇聚成一个连贯的系统。世纪互联公司的[Panamax][25]合成工具类似底层Fig和 geard的方法,但新增了一些基于web的用户接口,并直接与GitHub相结合,以便于应用程序可以直接被共享。 - -#### 业务流程 #### - -业务流程系统例如[Decking][26],New Relic公司的[Centurion][27]和谷歌公司的[Kubernetes][28]都是旨在帮助部署容器和管理其生命周期系统。也有无数的例子(例如[Apache Mesos][30](特别是[Marathon(马拉松式)持续运行很久的框架] 的 [Mesosphere][29]正在与Docker一起使用。通过为应用程序(例如传递CPU核数和内存的需求)与底层基础架构之间提供一个抽象的模型,业务流程工具提供了解耦,旨在简化应用程序开发和数据中心操作。还有各种各样的业务流程系统,因为人们已经淘汰了以前开发的内部系统,取而代之的是大量容器部署的管理系统;例如Kubernetes是基于谷歌的[Omega][32]系统,这个系统用于管理谷歌区域内的容器。 - -虽然从某种程度上来说合成工具和业务流程工具的功能存在重叠,另外这也是它们之间互补的一种方式。例如Fig可以被用于描述容器间如何实现功能交互,而Kubernetes pods可能用于提供监控和缩放。 - - -#### 平台 (类似一个服务) #### - -大量的Docker已经实现本地PaaS安装部署,例如[Deis][33] 和 [Flynn][34]的出现并在现实中得到利用,Linux容器在很大程度上为开发人员提供了灵活性(而不是“固执己见”地给出一组语言和框架)。其它平台例如CloudFoundry, OpenShift 和 Apcera Continuum都已经采取Docker基础功能融入其现有的系统,这样基于Docker镜像(或者基于Dockerfile)的应用程序也可以用之前支持的语言和框架一起部署和管理。 - -### 支持所有的云 ### - -由于Docker能够在任何的Linux虚拟机中运行并合理地更新内核,它几乎可以为所有云提供IaaS服务。大多数的云厂商已经宣布对码头及其生态系统提供附加支持。 - -亚马逊已经把Docker引入它们的Elastic Beanstalk系统(这是在底层IaaS的一个业务流程系统)。谷歌已经启用‘managed VMs'’,这是提供 -程序引擎PaaS和计算引擎IaaS之间的中转站。微软和IBM都已经宣布基于Kubernetes的服务,所以多容器应用程序可以在它们的云上被部署和管理。 - -为了给现有种类繁多的后端提供可用的一致接口,Docker团队已经引进[libswarm][35], 它能用于集成众多云和资源管理系统。Libswarm所阐明的目标之一是‘避免供应商通过交换任何服务锁定另一个’。这是通过呈现一组一致服务(与API相关联的)来完成的,该服务会附加执行特定的后端服务。例如装有Docker服务的服务器将对Docker命令行工具展示Docker远程API,这样容器就可以被托管在一些列的服务供应商。 - -基于Docker的新服务类型仍在起步阶段。总部位于伦敦的Orchard实验室提供了Docker的托管服务,但是Docker公司表示,收购后,Orchard的服务将不会是一个有优先事项。Docker公司也出售之前DotCloud的PaaS业务给cloudControl。基于就更早前的容器管理系统的服务例如[OpenVZ][36]已经司空见惯了,所以在一定程度上Docker需要向托管供应商证明其价值。 - -### Docker 及其发行版 ### - -Docker已经成为大多数Linux发行版例如Ubuntu,Red Hat企业版(RHEL)和CentOS的一个标准功能。遗憾的是发布是以不同的移动速度到Docker项目,所以在发布版中找到的版本总是远远落后于可用版本。例如Ubuntu 14.04版本是对应Docker 0.9.1版本发布的,但是并没有相应的版本更改点当Ubuntu升级至14.04.1(这个时候Docker已经升至1.1.2版本)。由于Docker也是一个KDE系统托盘,所以在官方库同样存在命名问题;所以在Ubuntu14.04版本中相关安装包的名字和命令行工具都是使用‘Docker.io’命名。 - -在企业版的Linux世界中,情况也并没有因此而不同。CentOS7伴随着Docker 0.11.1的到来,该发行版本即是之前Docker公司宣布准备发行Docker 1.0版本的准备版。Linux发行版用户希望最新版本可以承诺其稳定性,性能和安全性能够更完善,并且更好地结合[安装说明][37]和使用Docker公司的库托管而不是采取包括其分布的版本库。 - -Docker的到来催生了新的Linux发行版本例如[CoreOS][38]和红帽被用于设计为运行容器最小环境的[Project Atomic][39]。这些发布版相比传统的发布版伴随着更多新内核和Docker版本的特性。它们对内存的使用和硬盘占用率更小。新的发行也配备了新的工具用于大型部署例如[fleet][40],这是‘一个分布式init系统’和[etcd][41]是用于元数据管理。也有新机制用于更新发布版本身来使得内核和Docker可以被使用。这也意味着使用Docker的影响之一是它抛开分布版和相关的包管理解决方案的关注,使Linux内核(即Docker子系统正在使用)更加重要。 - -新的发布版将是运行Docker的最好方式,但是传统的发布版本和它们的包管理对容器来说仍然是非常重要的。Docker Hub托管的官方镜像有Debian,Ubuntu和CentOS。当然也有一个‘半官方’的库用于Fedora镜像。RHEL镜像在Docker Hub中不可用,因为是从Red Hat直接发布的。这意味着在Docker Hub的自动构建机制仅仅用于那些纯粹的开源发布版不(并愿意信任基于Docker公司团队所策划镜像的出处)。 - - -虽然Docker Hub与源代码控制系统相结合,例如Git Hub和Bitbucket在构建过程中用于自动创建包管理及生成规范之间的复杂关系(在Dockerfile中),并在构建过程中建立镜像。在构建过程中的非确定性结果并非是Docker具体的问题——这个是由于软件包如何管理工作的结果。在构建完成的当天将会给出一个版本,这个构建完成的另外一次将会得到最新版本,这就是为什么软件包管理需要升级措施。容器的抽象(较少关注一个容器的内容)以及容器的分散(因为轻量级资源利用率)是更有可能与Docker获取关联的痛点。 - -### Docker的未来 ### - -Docker公司对核心功能(libcontainer),跨服务管理(libswarm) 和容器间的信息传递(libchan)的发展提出了明确的路线。与此同时公司已经表明愿意利用自身生态系统和收购Orchard实验室。然而Docker相比Docker公司意味着更多,随着项目的壮大,越来越多对这个项目的 -大牌贡献者,其中不乏像谷歌、IBM和Red Hat这样的大公司。在仁慈独裁者CTO Solomon Hykes 掌舵的形势下,为公司和项目明确了技术领导的关系。在前18个月的项目中通过成果输出展现了快速行动的能力,而且这种趋势并没有减弱的迹象。 - -许多投资者正在寻找10年前VMware公司的ESX/vSphere平台的特征矩阵,并找出虚拟机的普及而驱动的企业预期和当前Docker生态系统两者的距离(和机会)。目前Docker生态系统正缺乏类似网络、存储和版本细粒度的管理(对容器的内容),这些都为初创企业和在职人员提供机会。 - -随着时间的推移,在虚拟机和容器(Docker的运行部分)之间的区别将变得不重要了,而关注点将会转移到‘构建’和‘交付’缓解。这些变化将会使‘Docker发生什么?’这个问题变得比‘Docker将会给IT产业带来什么?’更不重要了。 - - --------------------------------------------------------------------------------- - -via: http://www.infoq.com/articles/docker-future - -作者:[Chris Swan][a] -译者:[disylee](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.infoq.com/author/Chris-Swan -[1]:http://blog.dotcloud.com/dotcloud-paas-joins-cloudcontrol -[2]:http://www.infoq.com/news/2014/06/docker_1.0 -[3]:https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt -[4]:http://selinuxproject.org/page/Main_Page -[5]:https://linuxcontainers.org/ -[6]:http://blog.docker.com/2014/03/docker-0-9-introducing-execution-drivers-and-libcontainer/ -[7]:http://aufs.sourceforge.net/aufs.html -[8]:https://docs.docker.com/reference/builder/ -[9]:https://registry.hub.docker.com/ -[10]:http://bodenr.blogspot.co.uk/2014/05/kvm-and-docker-lxc-benchmarking-with.html?m=1 -[11]:http://domino.research.ibm.com/library/cyberdig.nsf/papers/0929052195DD819C85257D2300681E7B/$File/rc25482.pdf -[12]:https://en.wikipedia.org/wiki/X86_virtualization#Hardware-assisted_virtualization -[13]:http://stealth.openwall.net/xSports/shocker.c -[14]:https://news.ycombinator.com/item?id=7910117 -[15]:http://www.bromium.com/products/vsentry.html -[16]:http://cto.vmware.com/vmware-docker-better-together/ -[17]:http://www.infoq.com/articles/docker-containers -[18]:http://docs.docker.com/articles/using_supervisord/ -[19]:http://www.infoq.com/minibooks/emag-microservices -[20]:https://github.com/docker/libchan -[21]:https://gobyexample.com/channels -[22]:http://www.infoq.com/news/2014/08/clusterhq-launch-flocker -[23]:http://www.fig.sh/ -[24]:http://openshift.github.io/geard/ -[25]:http://panamax.io/ -[26]:http://decking.io/ -[27]:https://github.com/newrelic/centurion -[28]:https://github.com/GoogleCloudPlatform/kubernetes -[29]:https://mesosphere.io/2013/09/26/docker-on-mesos/ -[30]:http://mesos.apache.org/ -[31]:https://github.com/mesosphere/marathon -[32]:http://static.googleusercontent.com/media/research.google.com/en/us/pubs/archive/41684.pdf -[33]:http://deis.io/ -[34]:https://flynn.io/ -[35]:https://github.com/docker/libswarm -[36]:http://openvz.org/Main_Page -[37]:https://docs.docker.com/installation/#installation -[38]:https://coreos.com/ -[39]:http://www.projectatomic.io/ -[40]:https://github.com/coreos/fleet -[41]:https://github.com/coreos/etcd diff --git a/translated/talk/20150106 2015--Open Source Has Won, But It Isn't Finished.md b/translated/talk/20150106 2015--Open Source Has Won, But It Isn't Finished.md deleted file mode 100644 index 1646773bb5..0000000000 --- a/translated/talk/20150106 2015--Open Source Has Won, But It Isn't Finished.md +++ /dev/null @@ -1,47 +0,0 @@ -2015:开源已经完胜,但还在继续 -================================================================================ -> 在 2014 年的完胜后,接下来会如何? - -新年伊始,习惯上都是回顾已经走过的一年。但只要观注我们的这个栏目,就会很容易获得过去一年的总结:开源已经全胜。让我们从头开始说起吧: - -**超级计算机**: Linux 在超级计算机系统 500 强的名单上占据绝对的主导地位这本身就令人很尴尬。[2014年11月的数据][1]显示前500系统中的485个系统都在运行着 Linux 的发布系统,而仅仅只有一台运行着 Windows 系统。如果您查询相关的核心数据,这问题更是让人触目惊心。截止到目前,Linux 系统有 22,851,693 之多而 windows 系统仅仅只有 30,720。这意味着什么?Linux 不仅仅是占据主导地位,在大型系统中已经是绝对的霸主了。 - -**云计算**: 去年, Linux 基金会撰写了一个有趣的[报告][2],是关于大公司在云端使用 Linux 的情况的。它发现 75% 的大公司在使用 Linux 系统作为他们的主要平台,相对的使用 Windows 系统的只占 23%。因为需要考虑云端和非云端的因素,它们已经混淆在一起了,所以很难把这比例对应到真实的市场份额里。但是,鉴于当前云计算的流行度,可以很确定的说明 Linux 使用的高速增长。事实上,同样的调查发现,在云端的 Linux 部署率已经从 45% 增长到 79%,而对于 Windows 来说已经从 45% 下降到 36%。当然了,某些人可能认为 Linux 基金会在这块上并不是完全公正无私的,但即使是有私心或是统计的不确定性而有失公允,事情也正朝着预料的正确方向迈进。 - -**Web 服务器**: 开源已经统治这个行业近20年 - 取得了一份很惊人的成绩。然而,最近在市场份额上出现了一些有趣的变动:一点就是,在 Web 服务器的总计数上,微软的 IIS 服务已经超越了 Apache 服务。但正如 Netcraft 公司其最近的[分析][3]解释所说的那样,这儿还有很多令人大饱眼福的地方呢: - -> 这是网站总数持续大幅回落以来的第二个月,从一月份以来,创造了一个月的最低点。由于在十一月份的时候,损失的仅仅只是集中在主机提供商中的一小部分,只占了5200万主机名数的十大点。这点损失相比于激活的站点和网站来说不是一个数据级的,所以造不成什么影响,但激活的这些站点大部分都是广告类的链接页面,基本上没有原创的内容。大多数这些站点都是运行在微软的 IIS 服务器上的,所以在2014年7月份的调查中 IIS 的使用数就超过的 Apache 的。然而,近期跌势已导致其市场份额下降到 29.8%,现在已经低于Apache 10个百分点了。 - -这表明,微软的所谓“激增”更多的是表象,而事实并非如此,它的大多数增加都是基于链接页面站点,其内容很少有用。事实上,Netcraft公司的关于活动网站的数据给我们描绘了一幅完全不同的图表:Apache 拥有 50.57% 的市场份额,nginx 的是 14.73% 位居第二;微软的 IIS 很无力,占到了相当微弱的 11.72%。这意味着在活跃 Web 服务器市场上开源大约有65%的份额 - 虽然没有超级计算机那么高的水平,但也还不错。 - -**移动设备系统**. 目前,开源的大军主要是 Andriod 为基础在继续着。最新数据表明,在2014年第三季度的智能手机出货量中,Andriod 设备的市场份额从去年同期的 81.4% 上升到了 [83.6%][4]。苹果的从去年同期的 13.4% 下降到 12.3%。对于平板电脑来说,Android 平板遵循同样的轨迹:在2014年第二季度,Android 平板的占有率达到[全球平板电脑的销量的75%][5]左右,而苹果的只有25%。 - -**嵌入式系统**: 虽然很难量化 Linux 在的重要的嵌入式系统市场的市场份额,但来一个自 2013 年的研究数字表明,[计划大约一半的嵌入式系统][6]将会采用 Linux。 - -**物联网**: 在很多方面上可以把它们简单的认为是嵌入式系统的另外一个化身,不同之处在于它们被设计为一直在线的。虽然现在谈论它的市场份额还有点为时过早,但如我在[讨论栏目][7]里的,AllSeen 的物联网开源框架正进行的如火如荼。他们所缺少的也最引入注目的事情是要让任何可信任的闭源项目把其当做对手。因此,很有可能物联网将会通过开源的方式来达到 Linux 在超级计算机中的占有率这样的水平。 - -当然了,这个阶段的成功也带来了一些问题:我们将何去何从?鉴于开源将会使很多成功的行业达到饱和点,想必唯一的办法就是下跌吗?要回答这个问题,我建议浏览下 Christopher Kelty 于2013年写的一篇供同行参阅、发人深省的文章,有个耐人寻味的标题“[天下没有免费的软件][8]”。下面是他的开头段: - -> 免费软件并不存在。在我写了一整本书后,我莫名的忧伤。但这也是我写进文章的一个观点。免费软件和它的分身开源正在不断的变化着。它并不是一直持续不变的,不稳定、不固定、不持久,这正是它的特色的一部分。 - -换句话说,无论2014年带给我们多少惊人的免费软件,我们也确信2015年会更多更丰富,因为进化是永无止境的。 - --------------------------------------------------------------------------------- - -via: http://www.computerworlduk.com/blogs/open-enterprise/open-source-has-won-3592314/ - -作者:[lyn Moody][a] -译者:[runningwater](https://github.com/runningwater) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.computerworlduk.com/author/glyn-moody/ -[1]:http://www.top500.org/statistics/list/ -[2]:http://www.linuxfoundation.org/publications/linux-foundation/linux-end-user-trends-report-2014 -[3]:http://news.netcraft.com/archives/2014/12/18/december-2014-web-server-survey.html -[4]:http://www.cnet.com/news/android-stays-unbeatable-in-smartphone-market-for-now/ -[5]:http://timesofindia.indiatimes.com/tech/tech-news/Android-tablet-market-share-hits-70-in-Q2-iPads-slip-to-25-Survey/articleshow/38966512.cms -[6]:http://linuxgizmos.com/embedded-developers-prefer-linux-love-android/ -[7]:http://www.computerworlduk.com/blogs/open-enterprise/allseen-3591023/ -[8]:http://peerproduction.net/issues/issue-3-free-software-epistemics/debate/there-is-no-free-software/ diff --git a/translated/talk/20150124 Why does C++ promote an int to a float when a float cannot represent all int values.md b/translated/talk/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..e9dd6e997c --- /dev/null +++ b/translated/talk/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) +校对:[校对者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/translated/talk/20150225 Torvalds--'People who start writing kernel code get hired really quickly'.md b/translated/talk/20150225 Torvalds--'People who start writing kernel code get hired really quickly'.md new file mode 100644 index 0000000000..62d9af6b24 --- /dev/null +++ b/translated/talk/20150225 Torvalds--'People who start writing kernel code get hired really quickly'.md @@ -0,0 +1,39 @@ +translated by haimingfg + +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里面报道,无偿贡献者还是主要的共享来源,共有11,968改变,整体来说有12.4%是好的,企业贡献者共同占比越来越多,有超过80%的内核贡献是有有尝的专业开发者来完成,linux基金会说。 + + +根据 linus Torvalds 说,这个有偿开发者趋势不会改变太多这个内核发展的本身。 + + +他向全世界人说,我认为不会改变太多的一个原因是不会有更多的无偿自愿者因为编写内核就会更加快找到工作而离开。 + + +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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.infoworld.com/author/Jon-Gold/ diff --git a/translated/talk/20150318 The future of Linux storage.md b/translated/talk/20150318 The future of Linux storage.md new file mode 100644 index 0000000000..23a2dfc674 --- /dev/null +++ b/translated/talk/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的baked(烦请校正补充);内置的文件系统压缩,以及集成了对多种存储设备的支持。 + +当然,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) +校对:[校对者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.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/translated/talk/The history of Android/12 - The history of Android.md b/translated/talk/The history of Android/12 - The history of Android.md new file mode 100644 index 0000000000..9d28e9861d --- /dev/null +++ b/translated/talk/The history of Android/12 - The history of Android.md @@ -0,0 +1,98 @@ +安卓编年史 +================================================================================ +### Android 2.1——动画的大发现(以及滥用)时代 ### + +安卓2.1随着Nexus One的发布一同到来,这时距安卓2.0的发布仅仅过了三个月。新系统并不是一个大的更新升级,所以它仍然使用Éclair(泡芙)这个名称。安卓的开发以一种闻所未闻的步伐不稳定地进行,在过去的15个月中,谷歌平均每两个半月就发布一个新版本。 + +绝大部分得益于威瑞森在市场营销上的努力以及“Droid”产品线,安卓日益流行起来。即便如此,这个系统还是被认为丑,这时的安卓工程师看起来几乎没有接受过正式的设计培训,在安卓2.1中,他们尝试着通过在所有能用上的地方大量使用动画效果,想让东西看起来更整齐一点。这么做的结果就是系统看起来拼命想要证明它可以实现动画效果。许多新增的部分感觉更像是技术的演示(demo)而不是用户体验的改善。 + +![安卓2.1和2.0中的锁屏和主屏幕。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/21.png) +安卓2.1和2.0中的锁屏和主屏幕。 +Ron Amadeo供图 + +安卓2.0的旋转拨号式锁屏在仅仅一个版本之后就被踢到路边去了,取而代之的是和来电界面使用的相同的左/右拉标签式解锁。锁屏时钟尝试使用了一种独特的安卓字体,但是相比其它字体来说,它真是丑得可以。 + +安卓2.1最大的特色之一是“动态壁纸”——可互动的或是动态图片可以被设置为壁纸。默认的动态壁纸是个灰色正方形组成的大方阵,不断有蓝色,红色,黄色以及绿色的光点拖着尾巴穿越屏幕。点击屏幕会使光点以你点击的位置为中心向四个方向射出。尽管动态壁纸看起来很棒(并且相对iPhone而言是个独特的特性),动画背景对电池和处理器而言可不是什么好事。它似乎让整个系统的运行都变得有点慢了。 + +在主屏幕上,默认的谷歌搜索小部件周围有了更多空间,并且现在它位于所在行的正中央。页面指示器现在在屏幕底部的左右角落,主屏幕的页数也从3变成了5。底部的应用抽屉标签被替换为一个正方形方阵组成的图标,这个(对应用列表的)暗喻直到今天谷歌也还在使用。 + +![图片展示了安卓2.1和2.0中的应用抽屉设计以及应用的选择。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/21icons.png) +图片展示了安卓2.1和2.0中的应用抽屉设计以及应用的选择。 +Ron Amadeo供图 + +和新应用抽屉图标一同到来的还有全新的应用抽屉。应用抽屉不再是以前从屏幕底部上拉的带标签容器的样子,新界面显示为一个全屏界面。原先的碳纤维编织纹理被去掉了,变成了一个纯黑背景——这个决定会一直持续到KitKat。 + +谷歌决定添加一个浮动的,半透明的home图标到应用抽屉的底部,好让人们方便地退出全屏的应用列表界面。这个可以看作是安卓4.0中引入的虚拟home键的前身。 + +应用抽屉同样有个俗气的图形效果。在滚动的时候,在应用列表顶部和底部的图标会向内弯曲并且看起来像是向手机深处移动一样,有点像星球大战开场的滚动字幕。 + +应用的图标也有不多的改变。“Amazon MP3”和“Alarm Clock”(闹钟)都去掉了前面那个单词,然后他们就从按字母排序的列表的前两个位置退了下来。出现了两个新的应用:新闻和天气,以及Google Voice,这是谷歌的通信服务。由于Nexus One不是威瑞森的定制机,威瑞森的可视语音邮件被去掉了。 + +![修改后的时钟应用。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/clo2ck.png) +修改后的时钟应用。 +Ron Amadeo供图 + +不止是名称的更改,时钟应用还迎来了整体上的重制。点击时钟快捷方式不再会打开闹钟页面;取而代之的是去到“桌面时钟”界面(上方左图),它带有一个和壁纸一致的背景。时钟使用和锁屏一样的字体,并从新的新闻和天气应用中获取天气。 + +新的闹钟页面清除了许多旧版本中奇怪的设计。模拟时钟和可选择的时钟样式已经不见了。复选框已经被一个带绿色亮光的开关所取代,它比“灰色勾选/绿色勾选”更容易理解。尽管可能从快照很难看出来,旧的闹钟设计在时间旁同时显示AM和PM。2.1的设计里取消了这一项,只显示相关的AM/PM标记。底部放置了一个数字时钟,点击时钟图标会将你带回桌面时钟界面。 + +![安卓2.1和2.0中的相册和单独图片查看界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/gallery1.png) +安卓2.1和2.0中的相册和单独图片查看界面。 +Ron Amadeo供图 + +谷歌想要改进安卓外观的欲望在2.1的相册中最为明显,这里几乎都是大量使用的动画效果和半透明。当应用打开的时候,单独的图片从屏幕顶部飞下并且打乱成小堆组成相册。当打开相册的时候,图片堆各自分离,照片滑开形成方阵的形式。所有你触摸的东西会弹开,压缩,以及拉伸,就像是果冻的弹簧片一样。 + +相册这里没有一个“标准”的背景。他会从屏幕上随机选择一张图片并深度模糊,然后作为背景图片使用。当这张图片滑出屏幕显示范围后,它会重新选择一张背景图片,所以背景色调总是会和你的图片相匹配。 + +屏幕的左上角放置了面包屑导航栏。它显示你当前的位置,以及你所在位置和主界面之间的任何文件夹——它可以被看作是在安卓3.0中即将推出的“向上”按钮的前身。在右上角是一个相机的链接,这还留着相同的在安卓1.6中登场的人造皮革设计——两个设计截然不同。 + +而相机是另一个奇怪的,一次性的设计,从来没有哪个安卓应用间随意的UI设计差距能有和新的相册应用间这么明显。它并没有采用安卓的按钮,菜单,或任何现有的UI规范。它甚至在每个界面隐藏了状态栏——你几乎不能分辨出你正在盯着的是安卓。 + +在单张照片查看视图,你终于可以图片之间滑动切换,从而去掉了短粗的左右箭头。出于某种原因,这个界面并没有颜色匹配的背景。它是应用中唯一一个背景为黑色的部分。缩放控制在右上方(仍然没有捏合缩放),可用命令沿着屏幕的底部排成一行。点击“菜单”按钮(虚拟或实体键)并不会像所有其他的应用一样出现一个2×3格的方阵——仅仅是底部的一行选项从两个变成了另外三个选项。 + +![充满动画效果的相册应用。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/gallery2.png) +充满动画效果的相册应用。 +Ron Amadeo供图 + +上面第一张图片,显示了一个相册视图。大型相册的话你可以水平滚动,或使用在屏幕底部的快速滚动条。长按上的图片(虽然有点奇怪,或者按实体菜单按钮)会弹出一个“复选框”界面,在这里你可以点击几张照片同时选中它们。你选中照片之后,你可以批量分享,删除或旋转照片。 + +这个界面和接下来的单张照片查看界面的菜单是半透明语音气泡式的,点击各个按钮时它们会跳出来。再重复一遍,这和你所得到的正常的安卓体验规范远远不同。相册还是第一个拥有越界效果(overscroll)的应用之一。当你到达照片墙的底部时,整个界面会向滚动的方向扭曲。 + +2.1的相册是第一个能同时显示您云存储的Picasa照片以及本地照片的客户端。这些照片缩略图的左下角有白色相机快门图标。这后来成为了Google+ Photos。 + +之前或之后任何安卓应用程序看起来都不像这个相册。有很好的理由解释这是为什么——它不是谷歌做的!这个应用外包给了Cooliris,他们看样子并没有打算花费精力遵循任何一条现有的安卓UI规范。尽管应用是可用的,所有的动画和效果使它看起来像是只注重风格而不注重实质的产物。 + +![“新闻和天气”应用展示了……新闻和天气。](http://cdn.arstechnica.net/wp-content/uploads/2014/01/newsandweather.png) +“新闻和天气”应用展示了……新闻和天气。 +Ron Amadeo供图 + +来比较下相册应用和另一个全新的安卓2.1应用:新闻和天气。相册是个充满透明动画效果的汇聚,而新闻和天气则全是深色渐变和对比色。这个应用提供了桌面时钟的天气显示,它甚至还带着一个主屏幕小部件。第一张图显示的是当前位置的天气和六天预报。沿着屏幕顶部排列着一些标签,城市名称旁有个小小的“i”按钮,点击它会打开温度和降水图。你可以在图上滑动以得到指定时间的精确温度和降水信息。 + +这个应用里最大的创新在于可滑动标签,这个想法最终将成为一个标准的安卓UI规范。在天气之后是一些可由用户定制的新闻标签,除了点击标签切换之外,你还可以在屏幕上水平滑动,标签也会跟着切换。新闻标签都显示着一个新闻标题列表,它们几乎总是正好截断到你弄不明白这条新闻讲了什么的程度。当你从这个应用打开一个网页时,它并不会启动浏览器。相反,它会在应用内打开新闻,带着个奇怪的白色边框。 + +![谷歌地图的一些实验性功能,新的小部件设计,Google Voice里我们能接触到的唯一一个界面,以及新的带标签的音乐界面设计。](http://cdn.arstechnica.net/wp-content/uploads/2014/04/ccccombo.jpg) +谷歌地图的一些实验性功能,新的小部件设计,Google Voice里我们能接触到的唯一一个界面,以及新的带标签的音乐界面设计。 +Ron Amadeo供图 + +安卓2.1里的小部件全部经过了重新设计,几乎所有东西都带有黑色渐变,空间利用上也更加合理。时钟变回了一个圆,日历的顶部加上了蓝色,着让它和应用变得更加相似。Google Voice可以启动,但是登录已经失效了——这是你现在能看到的所有东西了。 + +人们经常忽视的音乐应用有个小更新。四个按钮的主界面被完全去除,并且在屏幕顶部添加了每个音乐显示模式的标签。这意味着在打开应用的时候,你就能直接看到音乐列表,而不是一个导航页。不同于新闻和天气应用里的标签,这些新增的标签不能滑动切换。 + +---------- + +![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg) + +[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。 + +[@RonAmadeo][t] + +-------------------------------------------------------------------------------- + +via: + +译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://arstechnica.com/author/ronamadeo +[t]:https://twitter.com/RonAmadeo diff --git a/translated/tech/20141117 Restricting process CPU usage using nice cpulimit and cgroups.md b/translated/tech/20141117 Restricting process CPU usage using nice cpulimit and cgroups.md deleted file mode 100644 index 7dd9bc4851..0000000000 --- a/translated/tech/20141117 Restricting process CPU usage using nice cpulimit and cgroups.md +++ /dev/null @@ -1,196 +0,0 @@ -使用nice、cpulimit和cgroups限制cpu占用率 -================================================================================ -注:本文中的图片似乎都需要翻墙后才能看到,发布的时候注意 - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/juggle.jpg) - -Linux内核是一名了不起的马戏表演者,它在进程和系统资源间小心地玩着杂耍,并保持系统的能够正常运转。 同时,内核也很公正:它将资源公平地分配给各个进程。 - -但是,如果你需要给一个重要进程提高优先级时,该怎么做呢? 或者是,如何降低一个进程的优先级? 又或者,如何限制一组进程所使用的资源呢? - -**答案是需要由用户来为内核指定进程的优先级** - -大部分进程启动时的优先级时相同的,因此Linux内核会公平地进行调度。 如果想让一个CPU密集型的进程运行在低优先级,那么你就得事先配置好调度器。 - -下面介绍3种控制进程运行时间的方法: - -- 使用nice命令手动减低任务的优先级。 -- 使用cpulimit命令控制进程的运行时间上限。 -- 使用linux内建的**control groups**功能,它提供了限制进程资源消耗的机制。 - -我们来看一下这3个工具的工作原理和各自的优缺点。 - -### 模拟高cpu占用率 ### - -在分析这3种技术前,我们要先安装一个工具来模拟高CPU占用率的场景。我们会用到CentOS作为测试系统,并使用[Mathomatic toolkit][1]中的质数生成器来模拟CPU负载。 - -很不幸,在CentOS上这个工具没有预编译好的版本,所以必须要从源码进行安装。先从http://mathomatic.orgserve.de/mathomatic-16.0.5.tar.bz2这个链接下载源码包并解压。然后进入**mathomatic-16.0.5/primes**文件夹,运行**make** 和 **sudo make install**进行编译和安装。这样,就把**matho-primes**程序安装到了**/usr/local/bin**目录中。 - -接下来,通过命令行运行: - - /usr/local/bin/matho-primes 0 9999999999 > /dev/null & - -程序运行后,将输出从0到9999999999之间的质数。因为我们并不需要这些输出结果,直接将输出重定向到/dev/null就好。 - -现在,使用top命令就可以看到matho-primes进程榨干了你所有的cpu资源。 - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image00.jpg) - -好了,接下来退出top(按q键)并杀掉matho-primes进程(使用fg命令将进程切换到前台,再按CTRL+C) - -### nice命令 ### -下来介绍一下nice命令的使用方法,nice命令可以修改进程的优先级,这样就可以让进程运行得不那么频繁。 **这个功能在运行cpu密集型的后台进程或批处理作业时尤为有用。** nice值的取值范围是[-20,19],-20表示最高优先级,而19表示最低优先级。 Linux进程的默认nice值为0。使用nice命令(不带任何参数时)可以将进程的nice值设置为10。这样调度器就会将此进程视为低优先级的进程,从而减少cpu资源的分配。 - -下面来看一个例子,我们同时运行两个**matho-primes**进程,一个使用nice命令来启动运行,而另一个正常启动运行: - - nice matho-primes 0 9999999999 > /dev/null & - matho-primes 0 9999999999 > /dev/null & - -再运行top命令。 - - - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image05.jpg) - -看到没,正常运行的进程(nice值为0)获得了更多的cpu运行时间,相反的,用nice命令运行的进程占用的cpu时间会较少(nice值为10)。 - -在实际使用中,如果你要运行一个CPU密集型的程序,那么最好用nice命令来启动它,这样就可以保证其他进程获得更高的优先级。 也就是说,即使你的服务器或者台式机在重载的情况下,也可以快速响应。 - -nice还有一个关联命令叫做renice,它可以在运行时调整进程的nice值。使用renice命令时,要先找出进程的PID。下面是一个例子: - - renice +10 1234 - -其中,1234是进程的PID。 - -测试完**nice** 和 **renice**命令后,记得要将**matho-primes**进程全部杀掉。 - -### cpulimit命令 ### - -接下来介绍 **cpulimit** 命令的用法。 **cpulimit** 命令的工作原理是为进程预设一个cpu占用率门限,并实时监控进程是否超出此门限,若超出则让该进程暂停运行一段时间。cpulimit使用 SIGSTOP和SIGCONT这两个信号来控制进程。它不会修改进程的nice值,而是通过监控进程的cpu占用率来做出动态调整。 - -cpulimit的优势是可以控制进程的cpu使用率的上限值。但与nice相比也有缺点,那就是即使cpu是空闲的,进程也不能完全使用整个cpu资源。 - -在CentOS上,可以用下面的方法来安装: - - wget -O cpulimit.zip https://github.com/opsengine/cpulimit/archive/master.zip - unzip cpulimit.zip - cd cpulimit-master - make - sudo cp src/cpulimit /usr/bin - -上面的命令行,会先从从GitHub上将源码下载到本地,然后再解压、编译、并安装到/usr/bin目录下。 - -cpulimit的使用方式和nice命令类似,但是需要用户使用-l选项显式地定义进程的cpu使用率上限值。举例说明: - - cpulimit -l 50 matho-primes 0 9999999999 > /dev/null & - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image03.jpg) - -从上面的例子可以看出matho-primes只使用了50%的cpu资源,剩余的cpu时间都为idle。 - -You can also limit a currently running process by specifying its PID using the ‘-p’ parameter. For example -cpulimit还可以在运行时对进程进行动态限制,使用-p选项来指定进程的PID,下面是一个实例: - - cpulimit -l 50 -p 1234 - -其中,1234是进程的PID。 - -### cgroups命令集 ### - -最后介绍,功能最为强大的控制组(cgroups)的用法。cgroups是Linux内核提供的一种机制,利用它可以指定一组进程的资源分配。 具体来说,使用cgroups,用户能够限定一组进程的cpu占用率、系统内存消耗、网络带宽,以及这几种资源的组合。 - -对比nice和cpulimit,**cgroups的优势**在于它可以控制一组进程,不像前者仅能控制单进程。同时,nice和cpulimit只能限制cpu使用率,而cgroups可以限制其他进程资源的使用。 - -对cgroups善加利用就可以控制好整个子系统的资源消耗。就拿CoreOS作为例子,这是一个专为大规模服务器部署而设计的最简化的Linux发行版本,它的upgrade进程就是使用cgroups来管控。这样,系统在下载和安装升级版本时也不会影响到系统的性能。 - -下面做一下演示,我们将创建两个控制组(cgroups),并对其分配不同的cpu资源。这两个控制组分别命名为“cpulimited”和“lesscpulimited”。 - -使用cgcreate命令来创建控制组,如下所示: - - sudo cgcreate -g cpu:/cpulimited - sudo cgcreate -g cpu:/lesscpulimited - -其中“-g cpu”选项用于设定cpu的使用上限。除此cpu外,cgroups还提供cpuset、memory、blkio等控制器。cpuset控制器与cpu控制器的不同在于,cpu控制器只能限制一个cpu核的使用率,而cpuset可以控制多个cpu核。 - -cpu控制器中的cpu.shares属性用于控制cpu使用率。它的默认值是1024,我们将lesscpulimited控制组的cpu.shares设为1024(默认值),而cpulimited设为512,配置后内核就会按照2:1的比例为这两个控制组分配资源。 - -To set the cpu.shares to 512 in the cpulimited group, type: - - sudo cgset -r cpu.shares=512 cpulimited - -使用cgexec命令来启动控制组的运行,为了测试这两个控制组,我们先用cpulimited控制组来启动matho-primes进程,命令行如下: - - sudo cgexec -g cpu:cpulimited /usr/local/bin/matho-primes 0 9999999999 > /dev/null & - -打开top可以看到,matho-primes进程占用了所有的cpu资源。 - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image01.jpg) - -因为只有一个进程在系统中运行,不管将其放到哪个控制组中启动,它都会尽可能多的使用cpu资源。cpu资源限制只有在两个进程争夺cpu资源时才会生效。 - -那么,现在我们就启动第二个matho-primes进程,这一次我们在lesscpulimited控制组中来启动它: - - sudo cgexec -g cpu:lesscpulimited /usr/local/bin/matho-primes 0 9999999999 > /dev/null & - -再打开top就可以看到,cpu.shares值大的控制组会得到更多的cpu运行时间。 - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image02.jpg) - -现在,我们再在cpulimited控制组中增加一个matho-primes进程: - - sudo cgexec -g cpu:cpulimited /usr/local/bin/matho-primes 0 9999999999 > /dev/null & - -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/image04.jpg) - -看到没,两个控制组的cpu的占用率比例仍然为2:1。其中,cpulimited控制组中的两个matho-primes进程获得的cpu时间基本相当,而另一组中的matho-primes进程显然获得了更多的运行时间。 - -更多的使用方法,可以在Red Hat上查看详细的cgroups使用[说明][2]。(当然CentOS 7也有) - -### 使用Scout来监控cpu占用率 ### - -监控cpu占用率最为简单的方法是什么?[Scout][3]工具能够监控能够自动监控进程的cpu使用率和内存使用情况。 - -![](https://dl.dropboxusercontent.com/u/468982/blog/server_view/processes.png) - -[Scout][3]的触发器(trigger)功能还可以设定cpu和内存的使用门限,超出门限时会自动产生报警。 - -从这里可以获取[Scout][4]的试用版。 - -### 总结 ### -![](https://dl.dropboxusercontent.com/u/468982/blog/cpu_usage_blog/overview.png) - -计算机的系统资源是非常宝贵的。上面介绍的这3个工具能够帮助大家有效地管理系统资源,特别是cpu资源: - -- **nice**可以一次性调整进程的优先级。 -- **cpulimit**在运行cpu密集型任务且要保持系统的响应性时会很有用。 -- **cgroups**是资源管理的瑞士军刀,同时在使用上也很灵活。 - --------------------------------------------------------------------------------- - -via: http://blog.scoutapp.com/articles/2014/11/04/restricting-process-cpu-usage-using-nice-cpulimit-and-cgroups - -译者:[coloka](https://github.com/coloka) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[1]:http://www.mathomatic.org/ -[2]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Resource_Management_and_Linux_Containers_Guide/chap-Introduction_to_Control_Groups.html -[3]:https://scoutapp.com/ -[4]:https://scoutapp.com/ -[5]: -[6]: -[7]: -[8]: -[9]: -[10]: -[11]: -[12]: -[13]: -[14]: -[15]: -[16]: -[17]: -[18]: -[19]: -[20]: \ No newline at end of file diff --git a/translated/tech/20141124 Important 10 Linux ps command Practical Examples.md b/translated/tech/20141124 Important 10 Linux ps command Practical Examples.md deleted file mode 100644 index 7e1ece4787..0000000000 --- a/translated/tech/20141124 Important 10 Linux ps command Practical Examples.md +++ /dev/null @@ -1,186 +0,0 @@ -10个重要的Linux ps命令实战 -================================================================================ -Linux作为Unix的衍生操作系统,Linux拥有内建用来查看当前进程的工具。这个工具能在命令行中使用。 - -### PS 命令是什么 ### - -查看它的man手册可以看到,ps命令能够给出当前系统中进程的快照。它能捕获系统在某一事件的进程状态。如果你想实时更新这个状态,可以使用top命令。 - -ps命令支持三种使用的语法格式 - -1. UNIX 风格,一定要被分组并且必须有Dash引导使用(可以理解为必须在dash中使用,dash是一种shell) -2. BSD 风格,一点要被分组但不一定要在dash中使用 -3. GNU 风格,能够在两种dash中使用 - -我们能够混用这几种风格,但是可能会发生冲突。本文使用UNIX风格的ps命令。这里有在日常生活中使用较多的ps命令的例子。 - -### 1. 不加参数执行ps命令 ### - -这是一个基本的 **ps** 使用。只要在控制台中执行这个命令并查看结果。 - -![不加选项执行ps命令](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_no_options.png) - -结果默认会显示4列信息。 - -- PID: 运行命令(CMD)的进程编号 -- TTY: 命令运行的位置 -- TIME: 说明运行这个命令所用的CPU时间 -- CMD: 作为当前进程运行的命令 - -这些信息在显示时未排序。 - -### 2. 显示所有当前进程 ### - -使用 **-a** 参数。**-a 代表 all**。同时加上x参数会显示没有控制终端的进程。 - - $ ps -ax - -这个命令的结果或许会很长。为获得简练的信息,可以结合less命令和管道来使用。 - - $ ps -ax | less - -![ps all 信息](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_ax.png) - -### 3. 根据用户过滤进程 ### - -在需要查看特点用户的进程是情况下,我们可以使用 **-u** 参数。比如我们要查看用户'pungki'的进程,可以通过下面的命令 - - $ ps -u pungki - -![通过user过滤](http://blog.linoxide.com/wp-content/uploads/2014/10/ps__u.png) - -### 4. 通过cpu和内存使用来过滤进程 ### - -可以使用 **aux 参数**,来显示全面的信息: - - $ ps -aux | less - -![显示全面信息](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_aux.png) - -当结果很长时,我们可以使用管道和less命令来筛选。 -默认的结果集是未排好序的。可以通过 **--sort**命令好排序。 - -根据 **CPU 使用**来升序排序 - - $ ps -aux --sort -pcpu | less - -![根据cpu使用排序](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_aux_sort_cpu.png) - -根据 **内存使用** 来升序排序 - - $ ps -aux --sort -pmem | less - -![根据内存使用来排序](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_aux_sort_mem.png) - -我们也可以通过管道显示前10个结果: - - $ ps -aux --sort -pcpu,+pmem | head -n 10 - -### 5. 通过进程name和id过滤 ### - -使用 **-C 参数**,后面跟你要找的进程的name。比如想显示一个名为getty的进程的信息,就可以使用下面的命令: - - $ ps -C getty - -![通过进程name和id过滤](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_C.png) - -如果想要看到更多的细节,我们可以使用-f参数来查看格式化的信息列表: - - $ ps -f -C getty - -![通过进程name和id过滤](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_C_f.png) - -### 6. 根据线程来过滤进程 ### - -如果我们想知道特定进程的线程,可以使用**-L 参数**,后面加上特定的PID。 - - $ ps -L 1213 - -![根据线程来过滤进程](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_L.png) - -### 7. 分层显示进程 ### - -使用 **-axjf** 参数。 - - $ps -axjf - -![分层显示进程](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_axjf.png) - -或者可以使用另一个命令。 - - $ pstree - -![分层显示进程](http://blog.linoxide.com/wp-content/uploads/2014/10/pstree.png) - -### 8. 显示安全信息 ### - -如果想要查看现在有谁登入了你的server。可以使用ps命令加上相关参数: - - $ ps -eo pid,user,args - -**参数 -e** 显示所有进程信息 **-o 参数**控制输出。**Pid**,**User 和 Args**参数显示**PID,运行应用的用户**和**运行的应用**。 - -![显示安全信息](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_security_1.png) - -能够与**-e 参数** 一起使用的关键字是**args, cmd, comm, command, fname, ucmd, ucomm, lstart, bsdstart and start**。 - -### 9. 格式化输出root用户创建的进程 ### - -系统管理员想要查看由root用户运行的进程和这个进程的其他相关信息时,可以通过下面的命令: - - $ ps -U root -u root u - -**-U 参数**用来选择特定的用户ID(在userlist中存在的用户名或ID)。用户ID用来标识创建进程的用户。 - -While the **-u paramater** will select by effective user ID (EUID) -**-u** 参数用来筛选有效的用户ID。 - - -最后的**u**参数用来确定结果的输出格式,由**User, PID, %CPU, %MEM, VSZ, RSS, TTY, STAT, START, TIME and COMMAND**这几列组成。 - -这里有上面的命令的输出结果 - -![show real and effective User ID](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_root_real_effective_ID.png) - -### 10. 使用PS实时监控进程状态 ### - -ps 命令会显示你系统当前的进程状态,但是这个结果是静态的。 -当有一种情况,我们需要想上面第四点中提到的通过CPU和内存的使用率来过滤进程。并且我们希望结果能够每秒更新一次。为此,我们可以**将ps命令和watch命令结合起来**。 - - $ watch -n 1 ‘ps -aux --sort -pmem, -pcpu’ - -![combine ps with watch](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_watch_1.png) - -并且可以通过**head**命令还进行限制。 - - $ watch -n 1 ‘ps -aux --sort -pmem, -pcpu | head 20’ - -![combine ps with watch](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_watch_2.png) - -这里的动态查看不想top或者htop命令。**但是使用ps的好处是**你能够定义显示的字段。你能够选择你想查看的字段。 - -举个例子,**如果你只先看名为'pungki'用户的信息**,你可以使用下面的命令: - - $ watch -n 1 ‘ps -aux -U pungki u --sort -pmem, -pcpu | head 20’ - -![combine ps with watch](http://blog.linoxide.com/wp-content/uploads/2014/10/ps_watch_3.png) - -### 结论 ### - -你可能会使用ps命令来监控你的Linux系统。但是事实上,你可以通过ps命令的参数来生成各种你需要的报表。 - -ps命令的另一个优势是ps是系统默认安装的。因此你只要用就行了。 - -可以通过 man ps来查看更多的参数。 - --------------------------------------------------------------------------------- - -via: http://linoxide.com/how-tos/linux-ps-command-examples/ - -作者:[Pungki Arianto][a] -译者:[johnhoow](https://github.com/johnhoow) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://linoxide.com/author/pungki/ 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/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/20150128 Docker-1 Moving to Docker.md b/translated/tech/20150128 Docker-1 Moving to Docker.md new file mode 100644 index 0000000000..36c8f16506 --- /dev/null +++ b/translated/tech/20150128 Docker-1 Moving to Docker.md @@ -0,0 +1,81 @@ +Moving to 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 powered mini-Heroku in around 100 lines of Bash + +我们启用的[DigitalOcean][4]上的很多台机器,都预装了Dokku。Dokku非常像Heroku,但是当你有复杂的项目需要调整配置参数或者是需要特殊的依赖时,它就不能胜任了。我们有一个应用,它需要对图片进行多次转换,我们无法安装一个适合版本的imagemagick到托管我们Rails应用的基于Dokku的Docker容器内。尽管我们还有很多应用运行在Dokku上,但我们还是不得不把一些迁移回Heroku。 + +### 第3步 - Docker ### + +几个月前,由于开发环境和生产环境的问题重新出现,我决定试试Docker。简单来说,Docker让开发者容器化应用,简化部署。由于一个Docker容器本质上已经包含项目运行所需要的所有依赖,只要它能在你的笔记本上运行地很好,你就能确保它将也能在任何一个别的远程服务器的生产环境上运行,包括Amazon的EC2和DigitalOcean上的VPS。 + +Docker IMHO特别有意思的原因是: + +- 它促进了模块化和分离关注点:你只需要去考虑应用的逻辑部分(负载均衡:1个容器;数据库:1个容器;web服务器:1个容器); +- 在部署的配置上非常灵活:容器可以被部署在大量的HW上,也可以容易地重新部署在不同的服务器或者提供商那; +- 它允许非常细粒度地优化应用的运行环境:你可以利用你的容器来创建镜像,所以你有很多选择来配置环境。 + +它也有一些缺点: + +- 它的学习曲线非常的陡峭(这是从一个软件开发者的角度来看,而不是经验丰富的运维人员); +- 搭建环境不简单,尤其是还需要自己搭建一个私有的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) +校对:[校对者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/translated/tech/20150202 tespeed - Python Tool To Test Your Internet Speed.md b/translated/tech/20150202 tespeed - Python Tool To Test Your Internet Speed.md new file mode 100644 index 0000000000..99bfab9842 --- /dev/null +++ b/translated/tech/20150202 tespeed - Python Tool To Test Your Internet Speed.md @@ -0,0 +1,76 @@ +tespeed - 测试网速的Python工具 +================================================================================ +许多电脑呆子知道可以用**speedtest.net**测试网速,但是这个不能在测试中给你足够的控制。Linux用户喜欢在终端中输入命令来完成任务,至少对我是这样的。 + +tespeed是一款有很多特性的python工具,可以在终端在测试网速。根据文档,它利用了speedtest.net的服务器,但是用户可以手动指定。 + +最初作者用php语言写了tespeed工具,并且证明了ISP提供的网络远低于它广告中所说的那样。但是事情并不是一直如它们想的那样,因此作者移植他的php脚本到python中并且他的工具在github中已经有180个star了。 + +这意味着**alot**。 + +### 如何在linux中测试tespeed ### + +在你电脑上运行这个python程序前先确保系统已经满足了这个工具的依赖。tespeed依赖下面两个包: + +- lxml +- SocksiPy + +你可以用pip包管理系统来安装lxml,只要用下面的命令就行。 + + pip install lxml + +现在我们需要输入下面的命令来下载安装SocksiPy。 + + wget http://sourceforge.net/projects/socksipy/files/socksipy/SocksiPy%201.00/SocksiPy.zip/ + +下载完成后 解压**SocksiPy.zip**病运行下面的命令来克隆tespeed仓库到你本地机器中。 + + git clone https://github.com/Janhouse/tespeed.git + +接着把SocksiPy文件夹放到你克隆下来的tespeed项目中。现在我们要像截图那样在SocksPy中的**__init__.py**下面创建一个空文件。 + +![simple trick to make tespeed work](http://blog.linoxide.com/wp-content/uploads/2015/01/tespeed1.png) + +现在我们已经解决了项目的依赖问题,我们可以用下面的命令运行了。 + + python tespeed.py + +接下来就会发生一些神奇的事了。程序会测试你的下载和上传速度并且在你的终端中用漂亮的颜色显示出来。 + +![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)输出, 还有很多我们会在本教程中探索。 + +如果你想要结果现实成MB,你可以在**python tespeed.py** 后面接上选项 **-mib**。 + + python tespeed.py -mib + +在你使用了-mib选项后你可以看到计量网速的单位改变了。 + +![testing internet speed with tespeed python application](http://blog.linoxide.com/wp-content/uploads/2015/01/tespeed3.png) + +我非常喜欢用的一个选项是-w,它可以把标准输出转化成CSV格式。 + + python tespeed.py -w + +使用下面的命令来列出服务器。 + + python tespeed -ls + +运行上面的命令后,你会看到可以用于测试上传和下载速度的服务器列表。我的列表非常长,所以我不会在教程中共享了。 + +### 总结 ### + +=tespeed的确是一款帮助用户在终端中测试上传和下载速度的高性能python脚本。它支持很多的选项并且你可以指定列表中你想使用的服务器。继续使用tespeed并在留言区写下你们的体验吧。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/tools/tespeed-python-tool-test-internet-speed/ + +作者:[Oltjano Terpollari][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/oltjano/ \ No newline at end of file diff --git a/translated/tech/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md b/translated/tech/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md new file mode 100644 index 0000000000..2c83a1b808 --- /dev/null +++ b/translated/tech/20150203 How To Install Linux-dash Web Based Monitoring System In CentOS or RHEL.md @@ -0,0 +1,112 @@ +如何在CentOS/RHEL中安装机遇Web监控的Linux-dash +================================================================================ +**Linux-dash**是一款为Linux设计的基于web的轻量级监控面板。这个程序会显示实时时间、不同的系统属性,比如CPU负载、RAM使用率、磁盘使用率、网速、网络连接、RX/TX带宽、登录用户、运行的进程等等。它不会存储长期的统计。因为它没有后端数据库。 + +本篇文章将会向你展示如何安装和设置Linux dash,这里的web服务器是**Nginx**. + +### 安装 ### + +首先我们要启用[EPEL 仓库][1]。 + +**接下来,我们需要用下面的命令安装nginx。** + + sudo yum install nginx + +**安装 php-fpm 组件** + + sudo yum install git php-common php-fpm + +现在我们要在nginx中配置Linux-dash。我们如下创建 /etc/nginx/conf.d/linuxdash.conf。 + + sudo vim /etc/nginx/conf.d/linuxdash.conf + +---------- + + server { + server_name $domain_name; + listen 8080; + root /var/www; + index index.html index.php; + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ { + try_files $uri =404; + expires max; + access_log off; + add_header Pragma public; + add_header Cache-Control "public, must-revalidate, proxy-revalidate"; + } + + location /linux-dash { + index index.html index.php; + } + + # PHP-FPM via sockets + location ~ \.php(/|$) { + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php-fpm.sock; + if (!-f $document_root$fastcgi_script_name) { + return 404; + } + try_files $uri $uri/ /index.php?$args; + include fastcgi_params; + } + } + +**下一步是配置php-fpm。用编辑器打开/etc/php-fpm.d/www.conf。** + + sudo vim /etc/php-fpm.d/www.conf + +**确保设置了“listn”,“user”和“group”字段。你可以保留下面的配置不变。** + + . . . + listen = /var/run/php-fpm.sock + user = nginx + group = nginx + . . . + +**现在,我们要在/var/www中下载并安装linux-dash。** + + git clone https://github.com/afaqurk/linux-dash.git + sudo cp -r linux-dash/ /var/www/ + sudo chown -R nginx:nginx /var/www + +**接下来,重启 Nginx和php-fpm** + + sudo service nginx restart + sudo service php-fpm restart + +**设置nginx和php-fpm开机自动启动** + + sudo chkconfig nginx on + sudo chkconfig php-fpm on + +在本例中,我们使用TCP端口8080配置linux-dash。因此确保防火墙没有阻止8080 TCP端口。 + +### 用linux-dash监控Linux服务器 ### + +你现在可以在浏览器中输入**http://:8080/linux-dash/**来访问Linux-dash。 + +web面板包含了不同的组件,每个都显示独特的系统属性。你可以自定义web面板的外观也可以关闭一些组件。 + +![](http://180016988.r.cdn77.net/wp-content/uploads/2015/01/Lin-dash.png) + +美好的一天! + + +下篇文章中再见。 + +-------------------------------------------------------------------------------- + +via: http://www.unixmen.com/install-linux-dash-web-based-monitoring-system-centosrhel/ + +作者:[Jijo][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/ diff --git a/translated/tech/20150205 25 Linux Shell Scripting interview Questions & Answers.md b/translated/tech/20150205 25 Linux Shell Scripting interview Questions & Answers.md new file mode 100644 index 0000000000..9a131bee9d --- /dev/null +++ b/translated/tech/20150205 25 Linux Shell Scripting interview Questions & Answers.md @@ -0,0 +1,388 @@ +Linux Shell脚本 入门25问 +================================================================================ +### Q:1 Shell脚本是什么、为什么它是必需的吗? ### + +答:一个Shell脚本是一个文本文件,包含一个或多个命令。作为系统管理员,我们经常需要发出多个命令来完成一项任务,我们可以添加这些所有命令在一个文本文件(Shell脚本)来完成日常工作任务。 + +### Q:2 什么是默认登录shell,如何改变指定用户的登录shell ### + +答:在Linux操作系统,“/ bin / bash”是默认登录shell,在用户创建时被分配的。使用chsh命令可以改变默认的shell。示例如下所示: + + # chsh -s + # chsh linuxtechi -s /bin/sh + +### Q:3 有什么不同的类型在shell脚本中使用? ### + +答:在shell脚本,我们可以使用两个类型变量: + +- 系统定义变量 +- 用户定义变量 + + +系统变量是由系统系统自己创建的。这些变量由大写字母组成,可以通过“**set**”命令查看。 + +用户变量由系统用户来生成,变量的值可以通过命令“`echo $<变量名>`”查看 + +### Q:4 如何同时重定向标准输出和错误输出到同一位置? ### + +答:这里有两个方法来实现: + +方法1: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来比较两个数,例子如下: + + #!/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 [ 条件 ] + do + 命令… + done + +### Q:12 如何使脚本成为可执行状态 ? ### + +答:使用chmod命令来使脚本可执行。例子如下: + + # chmod a+x myscript.sh + +### Q:13 “#!/bin/bash”的作用 ? ### + +答:#!/bin/bash是shell脚本的第一行,总所周知,#符号调用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命令可以用来比较字符串。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语句,但检查条件语句之前先执行命令。下面是用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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.linuxtechi.com/author/pradeep/ diff --git a/translated/tech/20150205 How To Install or Configure VNC Server On CentOS 7.0.md b/translated/tech/20150205 How To Install or Configure VNC Server On CentOS 7.0.md new file mode 100644 index 0000000000..58c846e4d6 --- /dev/null +++ b/translated/tech/20150205 How To Install or Configure VNC Server On CentOS 7.0.md @@ -0,0 +1,167 @@ +===>> boredivan翻译中 <<=== +怎样在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 + +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** . +最后还要设置一下用户的 VNC 密码。要设置某个用户的密码,必须要获得该用户的权限,这里我用 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 和端口号(例如 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] 的客户端来连接到服务器。 + +要用其他用户和端口连接 VNC 服务器,请回到第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 地址。 + + # curl -s checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//' + +### 总结 ### + +好了,现在我们已经在运行 CentOS 7 / RHEL 7 (Red Hat Enterprises Linux)的服务器上安装配置好了 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) +校对:[校对者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/ diff --git a/translated/tech/20150209 Install the Gnome Flashback classical desktop on Ubuntu 14.10 or Linux Mint 17.md b/translated/tech/20150209 Install the Gnome Flashback classical desktop on Ubuntu 14.10 or Linux Mint 17.md new file mode 100644 index 0000000000..ae7968afd0 --- /dev/null +++ b/translated/tech/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 classical桌面 +================================================================================ +如果你不喜欢现在的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] +译者:[译者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/117145272367995638274/posts +[1]:https://wiki.gnome.org/action/show/Projects/GnomeFlashback?action=show&redirect=GnomeFlashback diff --git a/translated/tech/20150209 Linux FAQs with Answers--How to fix 'fatal error--x264.h--No such file or directory' on Linux.md b/translated/tech/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..2ecacac6b1 --- /dev/null +++ b/translated/tech/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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150211 25 Tips for Intermediate Git Users.md b/translated/tech/20150211 25 Tips for Intermediate Git Users.md new file mode 100644 index 0000000000..a1c1dd8328 --- /dev/null +++ b/translated/tech/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.. + # 注意:..后面没有结束的refspec + +#### 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 log’来查看最近的提交你git用不了多久。不过,有一些技巧来更好地应用。比如,你可以使用下面的命令来查看每次提交的具体改动: + + $ 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。 + +### Rewinding Time & Fixing Mistakes ### + +#### 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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150211 Install Mumble in Ubuntu an Opensource VoIP Apps.md b/translated/tech/20150211 Install Mumble in Ubuntu an Opensource VoIP Apps.md new file mode 100644 index 0000000000..762e363beb --- /dev/null +++ b/translated/tech/20150211 Install Mumble in Ubuntu an Opensource VoIP Apps.md @@ -0,0 +1,78 @@ +Ubuntu上的一个开源VoIP应用——Mumble +================================================================================ +Mumble是一个自由开源的VoIP应用,遵守New BSD License,主要面向的用户群体是玩家。运行起来类似于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] +译者:[译者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/adriand/ +[1]:http://wiki.mumble.info/wiki/Main_Page diff --git a/translated/tech/20150215 How to analyze and view Apache web server logs interactively on Linux.md b/translated/tech/20150215 How to analyze and view Apache web server logs interactively on Linux.md new file mode 100644 index 0000000000..51ad96d272 --- /dev/null +++ b/translated/tech/20150215 How to analyze and view Apache web server logs interactively on Linux.md @@ -0,0 +1,167 @@ +如何在Linux中以交互方式分析和查看Apache web服务器日志? +================================================================================ + +无论你是在网站托管业务,还是在自己的VPS上运行几个网站,你总会有机会想要显示访客数量例如前几的房客,请求使用的文件(无论是动态或者是静态),带宽的使用,客户端的浏览器,和相关的网站,等等。 + + +[GoAccess][1] 是一款用于Apache或者Nginx命令行日志分析和交互式查看器。有了这款工具,你不仅可以浏览到之前提及的相关数据,还可以分析网站服务器日志来进一步挖掘数据 - 然而 **这一切都可以在一个终端窗口实时输出**.由于今天的[大多数web服务器][2]使用一个Debian的衍生版或者基于红帽发行版来作为底层操作系统,我将会告诉你如何在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]来刷新你的记忆。 + + +在这个例子中,选择常见日志格式(CLI): + +![](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地址所在的位置以及显示web服务器的请求。 + + +![](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视频 + + + +正如我们通过这篇文章讨论,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/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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://xmodulo.com/how-to-set-up-epel-repository-on-centos.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/translated/tech/20150225 Linux FAQs with Answers--How to fix 'fatal error--lame or lame.h--No such file or directory' on Linux.md b/translated/tech/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..685e637072 --- /dev/null +++ b/translated/tech/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,98 @@ +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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150225 Linux FAQs with Answers--How to install a USB webcam in Raspberry Pi.md b/translated/tech/20150225 Linux FAQs with Answers--How to install a USB webcam in Raspberry Pi.md new file mode 100644 index 0000000000..805a0aaca4 --- /dev/null +++ b/translated/tech/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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150227 Bringing a Bunch of Best Known Linux Network Tools.md b/translated/tech/20150227 Bringing a Bunch of Best Known Linux Network Tools.md new file mode 100644 index 0000000000..112147414a --- /dev/null +++ b/translated/tech/20150227 Bringing a Bunch of Best Known Linux Network Tools.md @@ -0,0 +1,443 @@ +领略一些最著名的 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 并深入探索它,那么请毫不犹豫地阅读我们做的关于这个网络带宽监控工具的整个教程。 + +### 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 信息的老手。 + +### 3) slurm ### + +slurm 是另一个 Linux 网络负载监控工具,它以一个不错的 ASCII 图来显示结果,它还支持许多键值用以交互,例如 **c** 用来切换到经典模式, **s** 切换到分图模式, **r** 用来重绘屏幕, **L** 用来启用 TX/RX(注:TX,发送流量;RX,接收流量) LED,**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 + +我们已经在一个教程中对 slurm 的使用做了介绍,所以请访问相关网页( 注:应该指的是[这篇文章](http://linoxide.com/ubuntu-how-to/monitor-network-load-slurm-tool/) ),并不要忘记和其它使用 Linux 的朋友分享这些知识。 + +### 4) iftop ### + +当你想在一个接口上按照主机来展示带宽使用情况时,iftop 是一个非常有用的工具。根据 man 手册,**iftop** 在一个已命名的接口或在它可以找到的第一个接口(假如没有任何特殊情况,它就像一个外部的接口)上监听网络流量,并且展示出一个表格来显示当前一对主机间的带宽使用情况。 + +通过在虚拟终端中使用下面的命令,Ubuntu 和 Debian 用户可以在他们的机器中轻易地安装 iftop: + + sudo apt-get install iftop + +在你的机器上,可以使用下面的命令通过 yum 来安装 iftop: + + yum -y install iftop + +### 5) collectl ### + +collectl 可以被用来收集描述当前系统状态的数据,并且它支持如下两种模式: + +- 记录模式 +- 回放模式 + +**记录模式** 允许从一个正在运行的系统中读取数据,然后将这些数据要么显示在终端中,要么写入一个或多个文件或套接字中。 + +**回放模式** + +根据 man 手册,在这种模式下,数据从一个或多个由记录模式生成的数据文件中读取。 + +Ubuntu 和 Debian 用户可以在他们的机器上使用他们默认的包管理器来安装 colletcl。下面的命令将为他们做这个工作: + + sudo apt-get install collectl + +还可以使用下面的命令来安装 collectl, 因为对于这些发行版本(注:这里指的是用 yum 作为包管理器的发行版本),在它们官方的软件仓库中也含有 collectl: + + yum install collectl + +### 6) Netstat ### + +Netstat 是一个用来监控**传入和传出的网络数据包统计数据**和接口统计数据的命令行工具。它为传输控制协议 TCP (包括上传和下行),路由表,及一系列的网络接口(网络接口控制器或者软件定义的网络接口) 和网络协议统计数据展示网络连接情况。 + +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) + +### 7) Netload ### + +netload 命令只展示一个关于当前网络荷载和自从程序运行之后传输数据总的字节数目的简要报告,它没有更多的功能。它是 netdiag 软件的一部分。 + +我们可以在 fedora 中使用 yum 来安装 Netload,因为它在 fedora 的默认软件仓库中。但假如你运行的是 CentOS 或 RHEL,则我们需要安装 [rpmforge 软件仓库][1]。 + + # yum install netdiag + +Netload 在默认仓库中作为 netdiag 的一部分可以被找到,我们可以轻易地使用下面的命令来利用 **apt** 包管理器安装 **netdiag**: + + $ sudo apt-get install netdiag (注:这里原文为 sudo install netdiag,应该加上 apt-get) + +为了运行 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) + +### 9) EtherApe ### + +EtherApe 是一个针对 Unix 的图形化网络监控工具,它仿照了 etherman 软件。它具有链路层,IP 和 TCP 模式并支持 Ethernet, FDDI, Token Ring, 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 流量故障以及 LAN 状态包和字节的数目。 + +在默认的软件仓库中可以找到 IPTraf,所以我们可以使用下面的命令通过 **apt** 包管理器轻松地安装 IPTraf: + + $ sudo apt-get install iptraf + +在默认的软件仓库中可以找到 IPTraf,所以我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 IPTraf: + + # yum install iptraf + +我们需要以管理员权限来运行 IPTraf(注:这里原文写错为 TPTraf),并带有一个可用的网络接口名。这里,我们的网络接口名为 wlan2,所以我们使用 wlan2 来作为接口的名称: + + $ sudo iptraf wlan2 (注:这里原文为 sudo iptraf,应该加上 wlan2) + +![IPTraf](http://blog.linoxide.com/wp-content/uploads/2015/02/iptraf.png) + +开始一般的网络接口统计,键入: + + # iptraf -g + +为了在一个名为 eth0 的接口设备上看详细的统计信息,使用: + + # iptraf -d wlan2 (注:这里的 wlan2 和 上面的 eth0 不一致,下面的几句也是这种情况,请相应地改正) + +为了看一个名为 eth0 的接口的 TCP 和 UDP 监控,使用: + + # iptraf -z wlan2 + +为了展示在一个名为 eth0 的接口上的包的大小和数目,使用: + + # iptraf -z wlan2 + +注意:请将上面的 wlan2 替换为你的接口名称。你可以通过运行`ip link show`命令来检查你的接口。 + +### 12) Speedometer ### + +Speedometer 是一个小巧且简单的工具,它只绘出一幅包含有通过某个给定端口的上行、下行流量的好看的图。 + +在默认的软件仓库中可以找到 Speedometer ,所以我们可以使用下面的命令通过 **yum** 包管理器轻松地安装 Speedometer: + + # yum install speedometer + +在默认的软件仓库中可以找到 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(注:这里应该加上 apt-get + +为了运行 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(注:这里原文中多了一个 trafshow)一样,可以报告当前激活的连接里使用的协议和每个连接中数据传输的速率。它可以使用 pcap 类型的滤波器来筛选出特定的连接。 + +我们可以使用 yum 在 fedora 中安装 trafshow(注:这里原文为 Netwatch,应该为 trafshow),因为它在 fedora 的默认软件仓库中。但若你正运行着 CentOS 或 RHEL , 我们需要安装 [rpmforge 软件仓库][4]。 + + # yum install trafshow + +Trafshow 在默认仓库中可以找到,所以我们可以轻松地使用下面的命令来利用 **apt** 包管理器安装它: + + $ sudo apt-get install trafshow(注:原文少了 apt-get) + +为了使用 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’ 选项(实时模式)。然后它将以一种非常精确的方式来展示被上行和下行数据所使用的带宽总量,但不会显示任何有关主机连接或进程的内部细节。 + + $ 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 的知识。 + +### 结论 ### + +在第一部分中(注:我认为原文多了 first 这个单词,总之是前后文的内容有些不连贯),我们介绍了一些在 Linux 下的网络负载监控工具,这对于系统管理员甚至是新手来说,都是很有帮助的。在这篇文章中介绍的每一个工具都有其特点,不同的选项等,但最终它们都可以帮助你来监控你的网络流量。 +-------------------------------------------------------------------------------- + +via: http://linoxide.com/monitoring-2/network-monitoring-tools-linux/ + +作者:[Bobbin Zachariah][a] +译者:[FSSlc](https://github.com/FSSlc) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150227 How To Fix--Failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs.md b/translated/tech/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..77c4c05d63 --- /dev/null +++ b/translated/tech/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] +译者:[译者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/fix-update-errors-ubuntu-1404/ diff --git a/translated/tech/20150227 How to Install Lightweight Budgie v8 Desktop in Ubuntu 14.04.md b/translated/tech/20150227 How to Install Lightweight Budgie v8 Desktop in Ubuntu 14.04.md new file mode 100644 index 0000000000..10bb779e71 --- /dev/null +++ b/translated/tech/20150227 How to Install Lightweight Budgie v8 Desktop in Ubuntu 14.04.md @@ -0,0 +1,97 @@ +如何在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 + +### 结论 ### + +Hurray! We have successfully installed our Lightweight Budgie Desktop Environment in our Ubuntu 14.04 LTS "Trusty" box. As we know, Budgie Desktop is still underdevelopment which makes it a lot of stuffs missing. Though it’s based on Gnome’s GTK3, it’s not a fork. The desktop is written completely from scratch, and the design is elegant and well thought out. 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 Budgie Desktop 0.8 :-) +Budgie桌面当前正在开发过程中,因此有目前有很多功能的缺失。虽然它是基于Gnome,但不是完全的复制。Budgie是完全从零开始实现,它的设计是优雅的并且正在不断的完善。 + +-------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/install-lightweight-budgie-v8-desktop-ubuntu/ + +作者:[Arun Pyasi][a] +译者:[johnhoow](https://github.com/johnhoow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150302 How to Manage KVM Virtual Environment using Commandline Tools in Linux.md b/translated/tech/20150302 How to Manage KVM Virtual Environment using Commandline Tools in Linux.md new file mode 100644 index 0000000000..3ece220dd5 --- /dev/null +++ b/translated/tech/20150302 How to Manage KVM Virtual Environment using Commandline Tools in Linux.md @@ -0,0 +1,153 @@ +如何在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. 用virsh带pool-start的命令来激活并启动我们刚才创建并构造完成的存储池。** + + # 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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150302 How to Setup Passwordless SSH Logon to Ubuntu 14.04.md b/translated/tech/20150302 How to Setup Passwordless SSH Logon to Ubuntu 14.04.md new file mode 100644 index 0000000000..a3020446ee --- /dev/null +++ b/translated/tech/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服务端的密要验证文件中去。在访问被授予前,服务器及客户端电脑互验密钥对。如果服务器上的公钥与客服端提交的私钥匹配访问开始,否则访问被拒绝。 + +这是获取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 + +OR + + $ 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 + +OR + + $ 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] +译者:[译者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/ diff --git a/translated/tech/20150304 How To Fix 'Not Enough Free Disk Space On boot' In Ubuntu.md b/translated/tech/20150304 How To Fix 'Not Enough Free Disk Space On boot' In Ubuntu.md new file mode 100644 index 0000000000..41318dd5fc --- /dev/null +++ b/translated/tech/20150304 How To Fix 'Not Enough Free Disk Space On boot' In Ubuntu.md @@ -0,0 +1,64 @@ +如何在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” + +![](https://www.unixmen.com/wp-content/uploads/2015/02/Software-Updater_002.png) + +这是因为我的启动分区超出了不再要的旧内核与包等。 + +### 回答: ### + +我听说**Computer Janitor**这个特性可以在Ubuntu Tweak中删除不想要的垃圾文件。使用Computer Janitor,你可以将你的系统清理成像新安装的那样。Janitor会删除: + +- 程序缓存(Firefox/Chrome 缓存、软件中心缓存); +- 略缩图缓存; +- apt缓存; +- 旧内核; +- 包的配置; +- 不再需要的包。 + +If you haven’t install this tool, look at the following link. +如果你还没有安装这个工具,参考下面的链接 + +- **[如何安装和使用Ubuntu Tweak][1]** + +要删除不需要的垃圾文件,打开Ubuntu Tweak,点击 **Janitor** 选项。 + +![](https://www.unixmen.com/wp-content/uploads/2015/02/Ubuntu-Tweak_006.png) + +选择你想要删除的文件的选框,并点击 **Clean** 按钮。 + +![](https://www.unixmen.com/wp-content/uploads/2015/02/Ubuntu-Tweak_007.png) + +Janitor现在就开始清理你的系统了。 + +![](https://www.unixmen.com/wp-content/uploads/2015/02/Ubuntu-Tweak_003.png) + +真酷!系统清理完成了。 + +![](https://www.unixmen.com/wp-content/uploads/2015/02/Ubuntu-Tweak_008.png) + +我重启启动了软件更新。这个没再遇到问题了。 + +![](https://www.unixmen.com/wp-content/uploads/2015/02/Software-Updater_009.png) + +就是这样。当然也有其他的方法可以清理系统。但是,这个方法很容易学。我们可以只点击几次鼠标就可以清理系统。 + +干杯! + +-------------------------------------------------------------------------------- + +via: https://www.unixmen.com/how-to-fix-not-enough-free-disk-space-on-boot-in-ubuntu/ + +作者:[SK][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.unixmen.com/author/sk/ +[1]:http://www.unixmen.com/after-a-fresh-install-of-ubuntu-1010-maverick-meerkat-configuration-made-easy-with-ubuntu-tweak/ diff --git a/translated/tech/20150304 How To Fix Windows Updates Stuck At 0%.md b/translated/tech/20150304 How To Fix Windows Updates Stuck At 0%.md new file mode 100644 index 0000000000..ca09f61d1c --- /dev/null +++ b/translated/tech/20150304 How To Fix Windows Updates Stuck At 0%.md @@ -0,0 +1,54 @@ +如何修复Windows更新在0%卡住 +================================================================================ +当你在一个月后登录Windows,发现有一些更新需要安装, 你选择安装这些更新但是**Windows更新卡在0%**时你感觉怎么样? + +为什么我在Linux和开源专属的博客上谈论Windows更新呢?因为我喜欢[双启动Windows和Linux][1]。当我使用Linux作为我的主桌面时,过了一段时间我登录到Windows中。登录Windows后最烦人的事情是Windows更新。我偶尔遇到了几次**Windows更新不能工作**的情况。我选择安装更新而且Windows更新卡在了0%和0KB上,就像这样: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Windows_Updates_stuck_at_zero.jpeg) + +本教程中,我们会让Windows更新再次可用。这个教程应该同样适用于Windows 7、Windows 8和Windows 8.1。 + +### 修复Windows更新卡在0% ### + +请注意Windows更新可能卡在任何地方,我们将会使用的这个技巧需要你重新安装这些更新。我希望你不要觉得太麻烦。如果你准备好了,就让我们开始修复这个Windows更新问题。 + +#### 步骤 1: #### + +按下Windows+R。这时会弹出运行窗口。在这里我们输入services.msc: + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Updates_3.png) + +#### 步骤 2: #### + +这里会显示Windows上安装的所有服务。这些服务以字母排序。向下拉到**Windows Update Service**。右击并停止服务。 + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Windows_Updates_stuck_1.jpeg) + +#### 步骤 3: #### + +现在进入**C:\Windows\SoftwareDistribution并删除这里所有的内容**。实际上,这个文件夹是下载和保存安装文件的地方。但是由于Windows更新卡住了,所以这里的某个安装文件存在一些问题。 + +#### 步骤 4: #### + +回到前面的服务(第一步中提到的)并右击重新启动Windows更新服务。再重新试一下Windows更新,这次应该可以用了。 + +当系统更新可以工作时,你或许会发现在下次启动时会有很多更新要安装。这时打个电话: + + +![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/03/Windows_update_suck.jpg) + +玩笑之余,我希望这个贴士能够帮助你拜托Windows更新卡在0%的情况。我希望Linux中的更新也能够含在[Windows 10从Linux复制的特性][2]列表中。这只是我的希望。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/fix-windows-updates-stuck-0/ + +作者:[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://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ +[2]:http://itsfoss.com/windows-10-inspired-linux/ diff --git a/translated/tech/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/translated/tech/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..b086684614 --- /dev/null +++ b/translated/tech/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 @@ +Linux 基础:如何修复Ubuntu上“E: /var/cache/apt/archives/ subprocess new pre-removal 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 + +![](https://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: https://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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150304 Monitoring Your Network And Servers With Observium.md b/translated/tech/20150304 Monitoring Your Network And Servers With Observium.md new file mode 100644 index 0000000000..9c78793904 --- /dev/null +++ b/translated/tech/20150304 Monitoring Your Network And Servers With Observium.md @@ -0,0 +1,172 @@ + +使用Observium来监控你的网络和服务器 +================================================================================ +### 简介### + +在监控你的服务器,交换机或者物理机器时有过问题吗?, **Observium**可以满足你的需求.作为一个免费的监控系统,可以帮助你远程监控你的服务器.它是一个由PHP编写的基于自动发现SNMP的网络监控平台,支持非常广泛的网络硬件和操作系统,包括 Cisco,Windows,Linux,HP,NetApp等.在此我会通过在Ubuntu12.04上设置一个**Observium**服务器的同时提供相应的步骤. + +![](https://www.unixmen.com/wp-content/uploads/2015/03/Capture1.png) + +目前存在两种不同的**observium**版本. + +- Observium 社区版本是一个在QPL开源许可证下的免费工具,这个版本时对于较小部署的最好解决方案. 该版本每6个月得到一次安全性更新. +- 第2个版本是Observium Professional, 该版本在基于SVN的发布机制下的发行版. 会得到每日安全性更新. 该工具适用于服务提供商和企业级部署. + +更多信息可以通过其官网获得[website of Observium][1]. + +### 系统需求### + +为了安装 **Observium**, 需要具有一个最新安装的服务器。**Observium**是在Ubuntu LTS和Debian系统上进行开发的,所以推荐在Ubuntu或Debian上安装**Observium**,因为可能在别的平台上会有一些小问题。 + +该文章会知道你如何在Ubuntu12.04上进行安装**Observium**。对于小型的**Observium**安装,推荐的基础配置要有256MB内存和双核处理器。 + +### 安装需求 ### + +在安装**Observuim**之前,你需要确认安装所有的依赖关系包。 + +首先,使用下面的命令更新的服务器: + + sudo apt-get update + +然后你需要安装运行Observuim 所需的全部包。 + +Observium需要使用下面所列出的软件才能正确的运行: + +- LAMP server +- 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### + +在登入网络接口之前,你需要为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://**,然后上路巴。 + +![](https://www.unixmen.com/wp-content/uploads/2015/03/Capture.png) + +尽情享受吧! + +-------------------------------------------------------------------------------- + +via: https://www.unixmen.com/monitoring-network-servers-observium/ + +作者:[anismaj][a] +译者:[theo-l](https://github.com/theo-l) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://www.unixmen.com/author/anis/ +[1]:http://www.observium.org/ diff --git a/translated/tech/20150304 Share Folders On Local Network Between Ubuntu And Windows.md b/translated/tech/20150304 Share Folders On Local Network Between Ubuntu And Windows.md new file mode 100644 index 0000000000..972486fbf0 --- /dev/null +++ b/translated/tech/20150304 Share Folders On Local Network Between Ubuntu And Windows.md @@ -0,0 +1,176 @@ +局域网中实现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”变成可用了。你也可以允许其他用户在共享文件夹中编辑文件。选项“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)或者域名成员。它也可以作为Active Directory域名的一部分。 + +#### 在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**使其可用,以及+(**plus**)图标。 +- 点击+(plus)图标,创建一个新的系统用户。 + +![](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界面已经解锁。点击Account disabled。输入一个新密码,然后确认密码,点击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共享文件是很简单的。点击Plus图标,会看到如图所示的对话框: + +![](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之间共享文件**。如果你有任何问题或建议,请再评论里说出来。 + +这篇教程是在Kalc的请求下写出的。如果你也想,你可以[请求你自己的教程][2]。我们很乐意帮助你和面临同样问题的读者解决问题。 + +-------------------------------------------------------------------------------- + +via: http://itsfoss.com/share-folders-local-network-ubuntu-windows/ + +作者:[Mohd Sohail][a] +译者:[KayGuoWhu](https://github.com/KayGuoWhu) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150306 How to Setup lftp--A Simple Command line FTP Program.md b/translated/tech/20150306 How to Setup lftp--A Simple Command line FTP Program.md new file mode 100644 index 0000000000..df90008704 --- /dev/null +++ b/translated/tech/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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://linoxide.com/author/arunp/ +[1]:http://lftp.yar.ru/ diff --git a/translated/tech/20150309 10 Useful 'ls' Command Interview Questions--Part 2.md b/translated/tech/20150309 10 Useful 'ls' Command Interview Questions--Part 2.md new file mode 100644 index 0000000000..f2cd020692 --- /dev/null +++ b/translated/tech/20150309 10 Useful 'ls' Command Interview Questions--Part 2.md @@ -0,0 +1,164 @@ +10个有用的‘ls’命令面试问题-第二部分 +================================================================================ +这是关于文件列表命令的第二篇文章,继续探讨‘ls’命令的其他方面。该系列的第一篇文章收到了Tecmint社区的高度关注,如果你错过了该系列的第一部分,你可能会访问以下地址: + +- [15 Interview Questions on “ls” Command – Part 1][1] + +这篇文章通过样例来很好地展现‘ls’命令的深入应用,我们加倍小心地来写这篇文章来保持其简洁可理解性,同时又能提供最全面的服务。 + +![10 Interview Questions on ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/ls-Command-Interview-Questions.jpg) +10 Interview Questions on ls Command + +### 1. 假如你想要以长列表的形式列出目录中的内容,但是不打印文件创建者名称以及文件所属组。同时在输出中显示其不同之处。### + +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) +List Files in- Long List Format + +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) +List Files By Author + +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) +List Files Without Printing Owner Name + +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) +List Files Without Printing Group + +### 2. 使用用户友好的格式打印出当前目录中的文件以及文件夹的大小,你会如何做?### + +这里我们需要使用'-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) +List Files in Human Readable Format + + # 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) +List File Sizes in Long List Format + +**注意**: ‘-h’选项使用1024(计算机中的标准)的幂,文件或文件夹的大小分别以K,M和G作为输出单位。 + +### 3. 既然‘-h’选项是使用1024的幂作为标准来输出大小,那么ls命令还支持其他的幂值呢?### + +存在一个选项 ‘-si’与选项‘-h’相似,不同之处在于前者以使用1000的幂,后者使用1024的幂。 + + # ls -si + +![Supported Power Values of ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/ls-supported-power-values.gif) +Supported Power Values of ls Command + +所以'-si'也可以与‘-l’选项一起使用来按照1000的幂来输出文件夹的大小,并且以长列表格式显示。 + + # ls -si -l + +![List Files by Power Values](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-by-Power-Values.gif) +List Files by Power Values + +### 4. 假如要你使用逗号‘,’作为分隔符来打印一个目录中的内容,可以吗? 对于长列表形式也可行吗?### + +当然!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) +Print Contents of Directory by Comma + +当使用长列表格式时,‘-m’选项就没有什么效果了。 + + # ls -ml + +![Listing Content Horizontally](http://www.tecmint.com/wp-content/uploads/2015/03/Listing-Content-Horizentally.gif) +Listing Content Horizontally + +### 5. 有办法将目录的内容逆序打印出来吗?### + +可以!上面的情形可以轻松地通过'-r'选项搞定,该选项将输出顺序倒置。这个选项也可以与‘-l’选项一起使用。 + + # ls -r + +![List Content in Reverse Order](http://www.tecmint.com/wp-content/uploads/2015/03/List-Content-in-Reverse-Order.gif) +List Content in Reverse Order + + # ls -rl + +![Long List Content in Reverse Order](http://www.tecmint.com/wp-content/uploads/2015/03/Long-List-Content-in-Reverse-Order.gif) +Long List Content in Reverse Order + +### 6. 如果你被分配一个任务,来递归地打印各个子目录,你会如何应付?注意哟,只针对子目录而不是文件哦。### + +小意思!使用“-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) +Print Sub Directories in Recursively + +### 7. 如何按照文件大小对其进行排序?### + +linux命令行选项'-S'赋予了ls命令这个超能力。按照文件大小从大到小的顺序排序: + + # ls -S + +![Sort Files with ls Command](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Files-in-Linux.gif) +Sort Files with ls Command + +按照文件大小从小到大的顺序排序。 + + # ls -Sr + +![Sort Files in Descending Order](http://www.tecmint.com/wp-content/uploads/2015/03/Sort-Files-in-Descending-Order.gif) +Sort Files in Descending Order + +### 8. 列出目录中的内容按照一行一个文件并且不带额外信息的方式 ### + +选项‘-l’在此可以解决这个问题,使用‘-l’选项来使用ls命令可以将目录中的内容按照一行一个文件并且不带额外信息的方式进行输出。 + + # ls -1 + +![List Files Without Information](http://www.tecmint.com/wp-content/uploads/2015/03/List-Files-Without-Information.gif) +List Files Without Information + +### 9. 现在委派给你一个任务,你必须将目录中的内容输出到终端而且需要使用双引号引起来,你会如何做?### + +存在一个选项‘-Q’会将ls命令的输出内容用双引号引起来。 + + # ls -Q + +![Print Files with Double Quotes](http://www.tecmint.com/wp-content/uploads/2015/03/Print-Files-with-Double-Quotes.gif) +Print Files with Double Quotes + +### 10. 想象一下你正在与一个包含有很多文件和文件夹的目录打交道,你需要使目录名显示在文件名之前,你如何做?### + + # ls --group-directories-first + +![Print Directories First](http://www.tecmint.com/wp-content/uploads/2015/03/Print-Directories-First.gif) +Print Directories First + +先点到为止,我们会马上提供该系列文章的下一部分。别换频道,关注Tecmint。 另外别忘了在下面的评论中提出你们宝贵的反馈信息,喜欢就分享,帮助我们得到更好的传播吧! + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/ls-interview-questions/ + +作者:[Ravi Saive][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/admin/ +[1]:http://www.tecmint.com/ls-command-interview-questions/ diff --git a/translated/tech/20150309 15 Interview Questions on Linux 'ls ' Command--Part 1.md b/translated/tech/20150309 15 Interview Questions on Linux 'ls ' Command--Part 1.md new file mode 100644 index 0000000000..77e42ff9e9 --- /dev/null +++ b/translated/tech/20150309 15 Interview Questions on Linux 'ls ' Command--Part 1.md @@ -0,0 +1,190 @@ +关于linux中的“ls”命令的15个面试问题 - 第一部分 +================================================================================ +Unix或类Unix系统中的“文件列表”命令“ls”是最基础并且使用的最广泛的命令行中工具之一。 +它是一个在GNU基本工具集以及BSD各种变体上可用的与POSIX兼容的工具。 +“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. 你会怎样列出一个目录中的所有文件, 包括隐藏的dot文件?### + +答:我们需要将“-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'表示符号链接 +- 文件 Binary归属于用户 “avi”以及用户组 "tecmint" +- Sep 30 11:31 表示文件最后一次的访问日期与时间。 + +### 6. 假如让你来将目录中的内容以长格式列表打印,并且显示出隐藏的“点文件”,你会如何实现?### + +答: 我们需要同时将"-a"和"-l"选项与“ls”命令一起使用。 + + # 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’一起使用来对文件使用修改时间排序,最新的修改时间排在最前。 + + # ls -ltc + +![Sort Files by Modification](http://www.tecmint.com/wp-content/uploads/2014/09/Sort-Files-by-Modification.gif) +按照修改时间对文件排序。 + +### 13. 如何控制‘ls’命令的输出颜色的有无?### + +答: 需要使用选项‘--color=parameter’,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://www.tecmint.com/15-basic-ls-command-examples-in-linux/ diff --git a/translated/tech/20150309 List Of Free Windows SSH Client Tools To Connect To Your Linux Server .md b/translated/tech/20150309 List Of Free Windows SSH Client Tools To Connect To Your Linux Server .md new file mode 100644 index 0000000000..ccb4bc2fec --- /dev/null +++ b/translated/tech/20150309 List Of Free Windows SSH Client Tools To Connect To Your Linux Server .md @@ -0,0 +1,81 @@ +在windows下,连接你的Linux服务器的ssh免费客户端工具列举\ +================================================================================ +你的操作系统是Windows,而你想要连接Linux服务器相互传送文件.于是你需要一个Secure Shell,简称SSH.实际上,SSH是一个网络协议,允许你通过网络连接到Linux和Unix服务器.SSH使用公钥加密来认证远程的计算机.你可以有多种途径使用SSH,要么自动地连接,或者使用密码认证登录. + +本篇文章讲述了几种SSH客户端,供选择使用来连接你的Linux服务器. + +我们开始. + +### Putty ### + +**Putty**是最有名的SSH和telnet客户端,最初由Simon Tatham为Windows平台开发.Putty是一款开源软件,有可用的源代码,和一群志愿者的发展和支持. + +![](https://www.unixmen.com/wp-content/uploads/2015/03/putty.png) + +Putty非常易于安装和使用,通常你不需要改大部分的配置选项.你只需要输入少量基本的参赛,就可以开始最简单的对话连接[here][1]. + +### Bitvise SSH Client ### + +**Bitvise SSH **是一款支持SSH和SFTP的Windows客户端.由Bitvise专业地提供支持和发展.这款SSH客户端性能强悍,易于安装和使用.Bitvise SSH客户端功能丰富,拥有图形界面,通过一个有自动重连能力的内置代理允许用户动态端口运行. + +![](https://www.unixmen.com/wp-content/uploads/2015/03/bitvise.png) + +Bitvise SSH客户端对个人用户使用**是**免费的,同时对于在组织内部的单独商业使用也一样.你可以[在这里下载Bitvise SSH客户端][2] + +### MobaXterm ### + +**M偶吧Xterm**是你的**终极工具箱,解决远程计算**.在单一的Windows应用里,它提供了许多裁剪过的的功能,针对程序员,网络管理者,IT管理员和相当一部分需要在更简单界面(此处原文为in a more simple fashion,有点费解)远程作业的用户. + +![](https://www.unixmen.com/wp-content/uploads/2015/03/mobaxterm.png) + +MobaXterm提供了所有重要的**远程网络工具** (如SSH, X11, RDP, VNC, FTP, MOSH 等等),和**Unix 命令**(bash, ls, cat, sed, grep, awk, rsync等等)适用于Windows桌面,在一个**单独便于携带的可执行文件里**,其工作独立于工具箱.MobaXterm对**个人使用免费**.你可以下载MobaXterm[在这里][3]. + +### DameWare SSH ### + +我认为**DameWare SSH**是最好的免费SSH客户端. + +![](https://www.unixmen.com/wp-content/uploads/2015/03/ssh.png) + +这个免费工具是一个终端模拟器,可以让你实现从一个易用控制台的多种telnet和SSH连接. + +-用一个带标签的控制台界面管理多方会话 +-在Windows文件系统中保存喜欢的会话 +-获取多个保存的证书集合,用于轻松登录不同的设备 +-使用telnet,SSH1和SSH2协议连接计算机和设备 + +你可以从[这个链接][4]下载 **DameWare SSH** + +### SmarTTY ### +  +SmarTTY是一款免费的多标签SSH客户端,支持使用SCP命令及时复制文件和目录 + +![](https://www.unixmen.com/wp-content/uploads/2015/03/smart.png) + +大多数SSH服务器每次连接支持最多10个子会话.SmarTTY在这方面做得很好:没有烦人的多个窗口,不需要重新登录,仅仅打开一个新的标签页就可以开始了! + +### Cygwin ### + +Cygwin是一款GNU和开源工具的大杂烩,提供的功能近似一个Windows平台下的Linux. + +![](https://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: https://www.unixmen.com/list-free-windows-ssh-client-tools-connect-linux-server/ + +作者:[anismaj][a] +译者:[wi-cuckoo](https://github.com/wi-cuckoo) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:https://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/translated/tech/20150310 How To Get Email Alerts for SSH Login on Linux Server.md b/translated/tech/20150310 How To Get Email Alerts for SSH Login on Linux Server.md new file mode 100644 index 0000000000..7c7e556f31 --- /dev/null +++ b/translated/tech/20150310 How To Get Email Alerts for SSH Login on Linux Server.md @@ -0,0 +1,58 @@ +在Linux服务器上如何为SSH登陆获取Email警告 +================================================================================ +![](http://www.ehowstuff.com/wp-content/uploads/2015/03/fail2ban-security.jpg) + +让SSH服务器在虚拟私有服务器(VPS)上生效会使得该服务器暴露到互联网中并为黑客活动提供了机会,尤其时当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@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@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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ehowstuff.com/author/mhstar/ diff --git a/translated/tech/20150310 [Fixed] Keyboard And Mouse Freeze After Suspend In Ubuntu 14.04 [Quick Tip].md b/translated/tech/20150310 [Fixed] Keyboard And Mouse Freeze After Suspend In Ubuntu 14.04 [Quick Tip].md new file mode 100644 index 0000000000..0e766f4f66 --- /dev/null +++ b/translated/tech/20150310 [Fixed] Keyboard And Mouse Freeze After Suspend In Ubuntu 14.04 [Quick Tip].md @@ -0,0 +1,28 @@ +[已解决] 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] +译者:[译者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/how-to-fix-no-unity-no-launcher-no-dash-in-ubuntu-12-10-quick-tip/ \ No newline at end of file diff --git a/translated/tech/20150316 How to access Gmail from the command line on Linux with Alpine.md b/translated/tech/20150316 How to access Gmail from the command line on Linux with Alpine.md new file mode 100644 index 0000000000..ce347ad4e6 --- /dev/null +++ b/translated/tech/20150316 How to access Gmail from the command line on Linux with Alpine.md @@ -0,0 +1,103 @@ +如何在 Linux 中使用 Alpine 在命令行里获取 Gmail +================================================================================ +假如你是一个命令行爱好者,我很确信你将张开双臂欢迎任何可以使你使用这个强大的工作环境来执行哪怕一项日常任务的工具,例如从 [安排日程][1] 、 [管理财务][2] 到 获取 [Facebook][3] 、[Twitter][4]等任务。 + +在这个帖子中,我将为你展示 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`),并显现出主界面,正如下面的截屏所显示的那样: + +注:youtube视频,发布的时候做个链接吧(注:这里我不知道该如何操作,不过我已经下载了该视频,如有需要,可以发送) + + +它的用户界面有下列几个模块: + +![](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' 来新建一个文件夹并填写必要的信息: + +- **昵称**: 填写任何你想写的名字; +- **服务器**: 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 吧。 + +### 总结 ### + +在这个帖子里,我们讨论了在终端环境中如何通过一个名为 Alpha 的轻量且强大的命令行邮件客户端来获取 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) +校对:[校对者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/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]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html diff --git a/translated/tech/20150316 Install Mate desktop in FreeBSD 10.1.md b/translated/tech/20150316 Install Mate desktop in FreeBSD 10.1.md new file mode 100644 index 0000000000..76d05da5ab --- /dev/null +++ b/translated/tech/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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.unixmen.com/author/pirat9/ diff --git a/translated/tech/20150316 Linux FAQs with Answers--How to convert between local time and UNIX timestamp in Perl.md b/translated/tech/20150316 Linux FAQs with Answers--How to convert between local time and UNIX timestamp in Perl.md new file mode 100644 index 0000000000..34b8bf4629 --- /dev/null +++ b/translated/tech/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时间戳,反之亦然。你可以给我一些Perl代码例子吗?关于日期及时间转换到UNIX时间戳,或者相反,转换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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni diff --git a/translated/tech/20150316 Systemd Boot Process a Close Look in Linux.md b/translated/tech/20150316 Systemd Boot Process a Close Look in Linux.md new file mode 100644 index 0000000000..a2c2ea28be --- /dev/null +++ b/translated/tech/20150316 Systemd Boot Process a Close Look in Linux.md @@ -0,0 +1,150 @@ +走进Linux之systemd启动过程 +================================================================================ +Linux系统的启动方式有点复杂,而且总是有需要优化的地方。传统的Linux系统启动过程主要由著名的init进程(也被称为SysV init启动系统)处理,而基于init的启动系统也被确认会有效率不足的问题,systemd是Linux系统机器的另一种启动方式,宣称弥补了以[传统Linux SysV init][2]为基础的系统的缺点。在这里我们将着重讨论systemd的特性和争议,但是为了更好地理解它,也会看一下通过传统的以SysV init为基础的系统的Linux启动过程是什么样的。友情提醒一下systemd仍然处在测试阶段,而未来发布的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会创建新进程并为每个进程分配一个控制组。处于不同控制组的进程之间可以通过内核来互相通信。[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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150318 11 Linux Terminal Commands That Will Rock Your World.md b/translated/tech/20150318 11 Linux Terminal Commands That Will Rock Your World.md new file mode 100644 index 0000000000..fce6ed5c80 --- /dev/null +++ b/translated/tech/20150318 11 Linux Terminal Commands That Will Rock Your World.md @@ -0,0 +1,266 @@ +11个Linux终端命令,让你的世界摇滚起来 +================================================================================ +我已经用了十年的Linux了,通过今天这篇文章我将向大家展示一系列的,我希望一开始就有人教导而不是曾在我成长道路上绊住我的Linux命令、工具和花招。 + +![Linux Keyboard Shortcuts.](http://f.tqn.com/y/linux/1/L/m/J/1/keyboardshortcuts.png) +Linux的快捷键。 + +### 1. 命令行日常系快捷键 ### + +如下的快捷方式非常有用,能够极大的提升你的工作效率: + +- 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"。 + +![](http://f.tqn.com/y/linux/1/L/n/J/1/sudotricks2.png) + +### 2. SUDO !! ### + +这个命令如果你还不知道我觉得你应该好好感谢我,因为如果你不知道那每次你在输入长串命令后看到“permission denied”后一定会痛恼不堪。 + +- sudo !! + +如何使用sudo !!?很简单。试想你刚输入了如下命令: + + apt-get install ranger + +一定会出现"Permission denied"除非你的登录了足够高权限的账户。 + +sudo !!就会用sudo的形式运行上一条命令。所以上一条命令可以看成是这样: + + sudo apt-get install ranger + +如果你不知道什么是sudo[戳这里][1]。 + +![Pause Terminal Applications.](http://f.tqn.com/y/linux/1/L/o/J/1/pauseapps.png) +暂停终端运行的应用程序。 + +### 3. 暂停并在后台运行命令 ### + +我曾经写过一篇如何在终端后台运行命令的指南。 + +- CTRL + Z - 暂停应用程序 +- fg - 重新将程序唤到前台 + +如何使用这个技巧呢? + +试想你正用nano编辑一个文件: + + sudo nano abc.txt + +文件编辑到一半你意识到你需要马上在终端输入些命令,但是nano在前台运行让你不能输入。 + +你可能觉得唯一的方法就是保存文件,推出nano,运行命令以后在重新打开nano。 + +其实你只要按CTRL + Z前台的命令就会暂停,画面就切回到命令行了。然后你就能运行你想要运行命令,等命令运行完后在终端窗口输入“fg”就可以回到先前暂停的任务。 + +有一个尝试非常有趣就是用nano打开文件,输入一些东西然后暂停会话。再用nano打开另一个文件,输入一些什么后再暂停会话。如果你输入“fg”你将回到第二个用nano打开的文件。只有退出nano再输入“fg”,你才会回到第一个用nano打开的文件。 + +![nohup.](http://f.tqn.com/y/linux/1/L/p/J/1/nohup3.png) +nohup. + +### 4. 使用nohup在登出SSH会话后仍运行命令 ### + +如果你用ssh登录别的机器时,[nohup命令]真的非常有用。 + +那么怎么使用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 & + +![Schedule tasks with at.](http://f.tqn.com/y/linux/1/L/q/J/1/at.png) +At管理任务日程 + +### 5. ‘在’特定的时间运行Linux命令 ### + +‘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手册来找到更多的使用方式。 + +![](http://f.tqn.com/y/linux/1/L/l/J/1/manmost.png) + +### 6. Man手册 ### + +Man手册会为你列出命令和参数的使用大纲,教你如何使用她们。 + +Man手册看起开沉闷呆板。(我思忖她们也不是被设计来娱乐我们的)。 + +不过这不代表你不能做些什么来使她们变得性感点。 + + export PAGER=most + +你需要 ‘most’;她会使你的你的man手册的色彩更加绚丽。 + +你可以用一下命令给man手册设定指定的行长: + + export MANWIDTH=80 + +最后,如果你有浏览器,你可以使用-H在默认浏览器中打开任意的man页。 + + man -H + +注意啦,以上的命令只有在你将默认的浏览器已经设置到环境变量$BROWSER中了之后才效果哟。 + +![View Processes With htop.](http://f.tqn.com/y/linux/1/L/r/J/1/nohup2.png) +使用htop查看进程。 + +### 7. 使用htop查看和管理进程 ### + +你用哪个命令找出电脑上正在运行的进程的呢?我敢打赌是‘[ps][6]’并在其后加不同的参数来得到你所想要的不同输出。 + +安装‘[htop][7]’吧!绝对让你相见恨晚。 + +htop在终端中将进程以列表的方式呈现,有点类似于Windows中的任务管理器。 + +你可以使用功能键的组合来切换排列的方式和展示出来的项。你也可以在htop中直接杀死进程。 + +在终端中简单的输入htop即可运行。 + + htop + +![Command Line File Manager - Ranger.](http://f.tqn.com/y/linux/1/L/s/J/1/ranger.png) +命令行文件管理 - Ranger. + +### 8. 使用ranger浏览文件系统 ### + +如果说htop是命令行进程控制的好帮手那么[ranger][8]就是命令行浏览文件系统的好帮手。 + +你在用之前可能需要先安装,不过一旦安装了以后就可以在命令行输入以下命令启动她: + + ranger + +在命令行窗口中ranger和一些别的文件管理器很像,但是她是左右结构的比起上下的来意味着你按左方向键你将前进到上一个文件夹结构而右方向键则会切换到下一个。 + +在使用前ranger的man手册还是值得一读的,这样你就可以用快捷键操作ranger了。 + +![Cancel Linux Shutdown.](http://f.tqn.com/y/linux/1/L/t/J/1/shutdown.png) +Linux取消关机。 + +### 9. 取消关机 ### + +无论是在命令行还是图形用户界面[关机][9]后发现自己不是真的想要关机。 + + shutdown -c + +需要注意的是,如果关机已经开始则有可能来不及停止关机。 + +以下是另一个可以尝试命令: + +- [pkill][10] shutdown + +![Kill Hung Processes With XKill.](http://f.tqn.com/y/linux/1/L/u/J/1/killhungprocesses.png) +使用XKill杀死挂起进程。 + +### 10. 杀死挂起进程的简单方法 ### + +想象一下,你正在运行的应用程序不明原因的僵死了。 + +你可以使用‘ps -ef’来找到该进程后杀掉或者使用‘htop’。 + +有一个更快、更容易的命令叫做[xkill][11]。 + +简单的在终端中输入以下命令并在窗口中点击你想杀死的应用程序。 + + xkill + +那如果整个系统挂掉了怎么办呢? + +按住键盘上的‘alt’和‘sysrq’同时输入: + +- [REISUB][12] + +这样不按电源键你的计算机也能重启了。 + +![youtube-dl.](http://f.tqn.com/y/linux/1/L/v/J/1/youtubedl2.png) +youtube-dl. + +### 11. 下载Youtube视频 ### + +一般来说我们大多数人都喜欢看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] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/ diff --git a/translated/tech/20150318 Install And Use 'Go For It!' To Do App In Linux.md b/translated/tech/20150318 Install And Use 'Go For It!' To Do App In Linux.md new file mode 100644 index 0000000000..6fa5899404 --- /dev/null +++ b/translated/tech/20150318 Install And Use 'Go For It!' To Do App In Linux.md @@ -0,0 +1,94 @@ +在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视频,发布的时候可做成一个链接 + + +### 安装 Go For It!### + +为在Ubuntu 15.04,14.04和其他基于Linux内核的Ubuntu版本,如Linux Mint,初级操作系统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) +校对:[校对者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/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/translated/tech/20150320 Locate Stolen laptops and Smart phones Using Prey Tool in Ubuntu.md b/translated/tech/20150320 Locate Stolen laptops and Smart phones Using Prey Tool in Ubuntu.md new file mode 100644 index 0000000000..2d9a5e4485 --- /dev/null +++ b/translated/tech/20150320 Locate Stolen laptops and Smart phones Using Prey Tool in Ubuntu.md @@ -0,0 +1,70 @@ +Ubuntu中,使用Prey定位被盗的笔记本与手机 +=============================================================================== +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完整使用的所有细节。 + +------------------------------------------------------------------------------- + +via: http://linoxide.com/ubuntu-how-to/anti-theft-application-prey-ubuntu/ + +作者:[Aun Raza][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://linoxide.com/author/arunrz/ +[1]:https://preyproject.com/ diff --git a/translated/tech/20150323 How to enable ssh login without entering password.md b/translated/tech/20150323 How to enable ssh login without entering password.md new file mode 100644 index 0000000000..4f9a4c317d --- /dev/null +++ b/translated/tech/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上再也不需要输入密码。 + +### 疑难解答 ### + +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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150323 Linux FAQs with Answers--How to compress JPEG images from the command line on Linux.md b/translated/tech/20150323 Linux FAQs with Answers--How to compress JPEG images from the command line on Linux.md new file mode 100644 index 0000000000..6d72a9f5d9 --- /dev/null +++ b/translated/tech/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图像,参考[this guideline][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/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html diff --git a/translated/tech/20150324 4 Tools to Securely Delete Files from Linux.md b/translated/tech/20150324 4 Tools to Securely Delete Files from Linux.md new file mode 100644 index 0000000000..bbf0dcb3bf --- /dev/null +++ b/translated/tech/20150324 4 Tools to Securely Delete Files from Linux.md @@ -0,0 +1,130 @@ +# 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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150324 How to Interactively Create a Docker Container.md b/translated/tech/20150324 How to Interactively Create a Docker Container.md new file mode 100644 index 0000000000..9661e8d3f2 --- /dev/null +++ b/translated/tech/20150324 How to Interactively Create a Docker Container.md @@ -0,0 +1,99 @@ +如何交互式地创建一个Docker容器 +=============================================================================== +大家好,今天我们来学习如何使用一个docker镜像交互式地创建一个Docker容器。一旦我们从镜像中启动一个Docker进程,Docker就会在父镜像与子镜像间来回搬运,重复工作,直到到达子镜像。然后联合文件系统会在顶层添加一个读写层。读写层又叫一个 **Container** 包含一些信息,关于它的父镜像和一些其他的信息,如单独的ID,网络配置和资源限制。容器已经声明,他们可以从 **running** 切换到 **exited** 状态。一个处于 **running** 状态的容器包含了很多分支在CPU上面运行,独立于其他在主机上运行的进程,而主机上 **exited** 是文件系统的状态,它的退出变量值是保留的。你可以使用读写层来启动,停止和重启一个容器。 + +Docker技术为IT界带来了巨大的改变,它使得云服务可以用来共享应用和工作流程自动化,使得应用可以从组件快速组合,消除了开发与品质保证和产品环境间的摩擦。在这篇文章中,我们将会建立CentOS环境,然后维护一个网站,在Apache网络服务器下运行。 + +这是快速且容易的教程,讨论我们怎样使用一个交互的shell,以一个交互的方式来创建一个容器。 + +### 1. 运行一个Docker实例 ### + +Docker一开始尝试从本地取得和运行所需的镜像,如果在本地主机上没有发现,它就会从[Docker公共注册中心][1]拉取。这里,我们将会在一个DOcker容器里取得并创建一个fedora实例,附加一个bash shell到tty + + # 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.Saving the Image ### + +现在,我们要去保存在Fedora实例里做的修改。要做到这个,我们首先需要知道实例的容器ID。而为了得到ID,我们又需要运行以下命令。 + + # 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里的网页内容会自动解压到/temp/文件夹里。然后,整个文件会被转移到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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [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/translated/tech/20150324 Prips--Print IP address on a given range.md b/translated/tech/20150324 Prips--Print IP address on a given range.md new file mode 100644 index 0000000000..a628c1e122 --- /dev/null +++ b/translated/tech/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 delim -- 用ASCII码作为分隔符,0 <= delim <= 255。 +- -e -- 排除输出的范围。 +- -f format -- 设置地址格式 (16进制, 10进制, 或者dot). +- -i incr -- 设置增长上限 + +### 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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://www.ubuntugeek.com/author/ubuntufix diff --git a/translated/tech/20150330 Linux FAQs with Answers--How to upgrade Docker on Ubuntu.md b/translated/tech/20150330 Linux FAQs with Answers--How to upgrade Docker on Ubuntu.md new file mode 100644 index 0000000000..8d993c1c47 --- /dev/null +++ b/translated/tech/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.5.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) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://ask.xmodulo.com/author/nanni