id
int64
2.05k
16.6k
title
stringlengths
5
75
fromurl
stringlengths
19
185
date
timestamp[s]
tags
sequencelengths
0
11
permalink
stringlengths
20
37
content
stringlengths
342
82.2k
fromurl_status
int64
200
526
status_msg
stringclasses
339 values
from_content
stringlengths
0
229k
6,366
[新手技巧] 如何在Ubuntu中添加和删除书签
http://itsfoss.com/add-remove-bookmarks-ubuntu/
2015-10-08T08:10:44
[ "Ubuntu" ]
https://linux.cn/article-6366-1.html
![](/data/attachment/album/201510/08/081045jie0yg0ed0mso5ty.jpg) 这是一篇对完全是新手的一篇技巧,我将向你展示如何在Ubuntu文件管理器中添加书签。 现在如果你想知道为什么要这么做,答案很简单。它可以让你可以快速地在左边栏中访问。比如,我[在Ubuntu中安装了Copy 云服务](http://itsfoss.com/install-copy-in-ubuntu-14-04/)。它创建在/Home/Copy。先进入Home目录再进入Copy目录并不是很麻烦,但是我想要更快地访问它。因此我添加了一个书签这样我就可以直接从侧边栏访问了。 ### 在Ubuntu中添加书签 打开Files。进入你想要保存快速访问的目录。你需要在标记书签的目录里面。 现在,你有两种方法: #### 方法1: 当你在Files(Ubuntu中的文件管理器)中时,查看顶部菜单。你会看到书签按钮。点击它你会看到将当前路径保存为书签的选项。 ![](/data/attachment/album/201510/08/081045tfo2wjo9olw2mkrw.jpg) #### 方法 2: 你可以直接按下Ctrl+D就可以将当前位置保存为书签。 如你所见,这里左边栏就有一个新添加的Copy目录: ![](/data/attachment/album/201510/08/081045avg9bp2h5ht4nzdk.jpg) ### 管理书签 如果你不想要太多的书签或者你错误地添加了一个书签,你可以很简单地删除它。按下Ctrl+B查看所有的书签。现在选择想要删除的书签并点击删除。 ![](/data/attachment/album/201510/08/081045tkvn2qlcq44mqd9s.png) 这就是在Ubuntu中管理书签需要做的。我知道这对于大多数用户而言很简单,但是这也许多Ubuntu的新手而言或许还有用。 --- via: <http://itsfoss.com/add-remove-bookmarks-ubuntu/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,367
5 个在 Linux 中管理文件类型和系统时间的有用命令
http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
2015-10-08T08:28:00
[ "命令行", "Linux" ]
https://linux.cn/article-6367-1.html
对于想学习 Linux 的初学者来说要适应使用命令行或者终端可能非常困难。由于终端比图形用户界面程序更能帮助用户控制 Linux 系统,我们必须习惯在终端中运行命令。因此为了有效记忆 Linux 不同的命令,你应该每天使用终端并明白怎样将命令和不同选项以及参数一同使用。 ![在 Linux 中管理文件类型和设置时间](/data/attachment/album/201510/08/082829ag3g3ajnm8ft2emz.jpg) *在 Linux 中管理文件类型和设置时间* 请先查看我们 Linux 小技巧系列之前的文章: * [5 个有趣的 Linux 命令行技巧](/article-5485-1.html) * [给新手的 10 个有用 Linux 命令行技巧](/article-6314-1.html) 在这篇文章中,我们打算看看终端中 5 个和文件以及时间相关的提示和技巧。 ### Linux 中的文件类型 在 Linux 中,一切皆文件,你的设备、目录以及普通文件都认为是文件。 Linux 系统中文件有不同的类型: * 普通文件:可能包含命令、文档、音频文件、视频、图像,归档文件等。 * 设备文件:系统用于访问你硬件组件。 这里有两种表示存储设备的设备文件:块文件,例如硬盘,它们以块读取数据;字符文件,以逐个字符读取数据。 * 硬链接和软链接:用于在 Linux 文件系统的任意地方访问文件。 * 命名管道和套接字:允许不同的进程之间进行交互。 #### 1. 用 ‘file’ 命令确定文件类型 你可以像下面这样使用 file 命令确定文件的类型。下面的截图显示了用 file 命令确定不同文件类型的例子。 ``` tecmint@tecmint ~/Linux-Tricks $ dir BACKUP master.zip crossroads-stable.tar.gz num.txt EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 reggea.xspf Linux-Security-Optimization-Book.gif tmp-link tecmint@tecmint ~/Linux-Tricks $ file BACKUP/ BACKUP/: directory tecmint@tecmint ~/Linux-Tricks $ file master.zip master.zip: Zip archive data, at least v1.0 to extract tecmint@tecmint ~/Linux-Tricks $ file crossroads-stable.tar.gz crossroads-stable.tar.gz: gzip compressed data, from Unix, last modified: Tue Apr 5 15:15:20 2011 tecmint@tecmint ~/Linux-Tricks $ file Linux-Security-Optimization-Book.gif Linux-Security-Optimization-Book.gif: GIF image data, version 89a, 200 x 259 tecmint@tecmint ~/Linux-Tricks $ file EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3: Audio file with ID3 version 2.3.0, contains: MPEG ADTS, layer III, v1, 192 kbps, 44.1 kHz, JntStereo tecmint@tecmint ~/Linux-Tricks $ file /dev/sda1 /dev/sda1: block special tecmint@tecmint ~/Linux-Tricks $ file /dev/tty1 /dev/tty1: character special ``` #### 2. 用 ‘ls’ 和 ‘dir’ 命令确定文件类型 确定文件类型的另一种方式是用 ls 和 [dir](http://www.tecmint.com/linux-dir-command-usage-with-examples/) 命令显示一长串结果。 用 ls -l 确定一个文件的类型。 当你查看文件权限时,第一个字符显示了文件类型,其它字符显示文件权限。 ``` tecmint@tecmint ~/Linux-Tricks $ ls -l total 6908 drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP -rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz -rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 -rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif -rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt -rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link ``` 使用 ls -l 确定块和字符文件 ``` tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/sda1 brw-rw---- 1 root disk 8, 1 Sep 9 10:53 /dev/sda1 tecmint@tecmint ~/Linux-Tricks $ ls -l /dev/tty1 crw-rw---- 1 root tty 4, 1 Sep 9 10:54 /dev/tty1 ``` 使用 dir -l 确定一个文件的类型。 ``` tecmint@tecmint ~/Linux-Tricks $ dir -l total 6908 drwxr-xr-x 2 tecmint tecmint 4096 Sep 9 11:46 BACKUP -rw-r--r-- 1 tecmint tecmint 1075620 Sep 9 11:47 crossroads-stable.tar.gz -rwxr----- 1 tecmint tecmint 5916085 Sep 9 11:49 EDWARD-MAYA-2011-2012-NEW-REMIX.mp3 -rw-r--r-- 1 tecmint tecmint 42122 Sep 9 11:49 Linux-Security-Optimization-Book.gif -rw-r--r-- 1 tecmint tecmint 17627 Sep 9 11:46 master.zip -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:48 num.txt -rw-r--r-- 1 tecmint tecmint 0 Sep 9 11:46 reggea.xspf -rw-r--r-- 1 tecmint tecmint 5 Sep 9 11:47 tmp-link ``` #### 3. 统计指定类型文件的数目 下面我们来看看在一个目录中用 ls,[grep](/article-2250-1.html) 和 [wc](http://www.tecmint.com/wc-command-examples/) 命令统计指定类型文件数目的技巧。命令之间的交互通过命名管道完成。 * grep – 用户根据给定模式或正则表达式进行搜索的命令。 * wc – 用于统计行、字和字符的命令。 **统计普通文件的数目** 在 Linux 中,普通文件用符号 `-` 表示。 ``` tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^- | wc -l 7 ``` **统计目录的数目** 在 Linux 中,目录用符号 `d` 表示。 ``` tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^d | wc -l 1 ``` **统计符号链接和硬链接的数目** 在 Linux 中,符号链接和硬链接用符号 `l` 表示。 ``` tecmint@tecmint ~/Linux-Tricks $ ls -l | grep ^l | wc -l 0 ``` **统计块文件和字符文件的数目** 在 Linux 中,块和字符文件用符号 `b` 和 `c` 表示。 ``` tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^b | wc -l 37 tecmint@tecmint ~/Linux-Tricks $ ls -l /dev | grep ^c | wc -l 159 ``` #### 4. 在 Linux 系统中查找文件 下面我们来看看在 Linux 系统中查找文件一些命令,它们包括 locate、find、whatis 和 which 命令。 **用 locate 命令查找文件** 在下面的输出中,我想要定位系统中的 [Samba 服务器配置文件](http://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/) ``` tecmint@tecmint ~/Linux-Tricks $ locate samba.conf /usr/lib/tmpfiles.d/samba.conf /var/lib/dpkg/info/samba.conffiles ``` **用 find 命令查找文件** 想要学习如何在 Linux 中使用 find 命令,你可以阅读我们以下的文章,里面列出了 find 命令的 30 多个例子和使用方法。 * [Linux 中 35 个 ‘find’ 命令示例](http://www.tecmint.com/35-practical-examples-of-linux-find-command/) **用 whatis 命令定位命令** whatis 命令通常用于定位命令,它很特殊,因为它给出关于一个命令的信息,它还能查找配置文件和命令的帮助手册条目。 ``` tecmint@tecmint ~/Linux-Tricks $ whatis bash bash (1) - GNU Bourne-Again SHell tecmint@tecmint ~/Linux-Tricks $ whatis find find (1) - search for files in a directory hierarchy tecmint@tecmint ~/Linux-Tricks $ whatis ls ls (1) - list directory contents ``` **用 which 命令定位命令** which 命令用于定位文件系统中的命令。 ``` tecmint@tecmint ~/Linux-Tricks $ which mkdir /bin/mkdir tecmint@tecmint ~/Linux-Tricks $ which bash /bin/bash tecmint@tecmint ~/Linux-Tricks $ which find /usr/bin/find tecmint@tecmint ~/Linux-Tricks $ $ which ls /bin/ls ``` #### 5.处理 Linux 系统的时间 在联网环境中,保持你 Linux 系统时间准确是一个好的习惯。Linux 系统中有很多服务要求时间正确才能在联网条件下正常工作。 让我们来看看你可以用来管理你机器时间的命令。在 Linux 中,有两种方式管理时间:系统时间和硬件时间。 系统时间由系统时钟管理,硬件时间由硬件时钟管理。 要查看你的系统时间、日期和时区,像下面这样使用 date 命令。 ``` tecmint@tecmint ~/Linux-Tricks $ date Wed Sep 9 12:25:40 IST 2015 ``` 像下面这样用 date -s 或 date -set=“STRING” 设置系统时间。 ``` tecmint@tecmint ~/Linux-Tricks $ sudo date -s "12:27:00" Wed Sep 9 12:27:00 IST 2015 tecmint@tecmint ~/Linux-Tricks $ sudo date --set="12:27:00" Wed Sep 9 12:27:00 IST 2015 ``` 你也可以像下面这样设置时间和日期。 ``` tecmint@tecmint ~/Linux-Tricks $ sudo date 090912302015 Wed Sep 9 12:30:00 IST 2015 ``` 使用 cal 命令从日历中查看当前日期。 ``` tecmint@tecmint ~/Linux-Tricks $ cal September 2015 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ``` 使用 hwclock 命令查看硬件时钟时间。 ``` tecmint@tecmint ~/Linux-Tricks $ sudo hwclock Wednesday 09 September 2015 06:02:58 PM IST -0.200081 seconds ``` 要设置硬件时钟时间,像下面这样使用 hwclock –set –date=“STRING” 命令。 ``` tecmint@tecmint ~/Linux-Tricks $ sudo hwclock --set --date="09/09/2015 12:33:00" tecmint@tecmint ~/Linux-Tricks $ sudo hwclock Wednesday 09 September 2015 12:33:11 PM IST -0.891163 seconds ``` 系统时间是由硬件时钟时间在启动时设置的,系统关闭时,硬件时间被重置为系统时间。 因此你查看系统时间和硬件时间时,它们是一样的,除非你更改了系统时间。当你的 CMOS 电量不足时,硬件时间可能不正确。 你也可以像下面这样使用硬件时钟的时间设置系统时间。 ``` $ sudo hwclock --hctosys ``` 也可以像下面这样用系统时钟时间设置硬件时钟时间。 ``` $ sudo hwclock --systohc ``` 要查看你的 Linux 系统已经运行了多长时间,可以使用 uptime 命令。 ``` tecmint@tecmint ~/Linux-Tricks $ uptime 12:36:27 up 1:43, 2 users, load average: 1.39, 1.34, 1.45 tecmint@tecmint ~/Linux-Tricks $ uptime -p up 1 hour, 43 minutes tecmint@tecmint ~/Linux-Tricks $ uptime -s 2015-09-09 10:52:47 ``` ### 总结 对于初学者来说理解 Linux 中的文件类型是一个好的尝试,同时时间管理也非常重要,尤其是在需要可靠有效地管理服务的服务器上。希望这篇指南能对你有所帮助。如果你有任何反馈,别忘了给我们写评论。和我们保持联系。 --- via: <http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/> 作者:[Aaron Kili](http://www.tecmint.com/author/aaronkili/) 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,368
NGINX Plus 现在完全支持 HTTP/2
https://www.nginx.com/blog/http2-r7/
2015-10-08T09:15:00
[ "nginx", "HTTP/2" ]
https://linux.cn/article-6368-1.html
早些时候,我们发布了支持 HTTP/2 协议的 [NGINX Plus R7](https://www.nginx.com/blog/nginx-plus-r7-released/)。作为 HTTP 协议的最新标准,HTTP/2 的设计为现在的 web 应用程序带来了更高的性能和安全性。(LCTT 译注: [开源版本的 NGINX 1.95 也支持 HTTP/2 了](http://mailman.nginx.org/pipermail/nginx-announce/2015/000162.html)。) NGINX Plus 所实现的 HTTP/2 协议可与现有的网站和应用程序进行无缝衔接。只需要一点改变,不管用户选择什么样的浏览器,NGINX Plus 都能为用户同时提供 HTTP/1.x 与HTTP/2 的最佳体验。 要支持 HTTP/2 仅需通过可选的 **nginx‑plus‑http2** 软件包。**nginx‑plus** 和 **nginx‑plus‑extras** 软件包支持 SPDY 协议,目前推荐用于生产站点,因为其被大多数浏览器所支持并且代码也是相当成熟了。 ### 为什么要使用 HTTP/2? HTTP/2 使数据传输更高效,对你的应用程序更安全。 HTTP/2 相比于 HTTP/1.x 有五个提高性能特点: * **完全复用** – 在一个保持激活(keepalive)的连接上,HTTP/1.1 强制按严格的顺序来处理请求。一个请求必须在下一个请求开始前结束。 HTTP/2 消除了这一要求,允许并行和乱序来处理请求。 * **单一,持久连接** – 由于 HTTP/2 允许请求完全复用,所以可以通过单一连接并行下载网页上的所有对象。在 HTTP/1.x 中,使用多个连接来并行下载资源,从而导致使用底层 TCP 协议效率很低。 * **二进制编码** – Header 信息使用紧凑的二进制格式发送,而不是纯文本格式,节省了传输字节。 * **Header 压缩** – Headers 使用专用的 HPACK 压缩算法来进行压缩,这进一步降低数据通过网络传输的字节。 * **SSL/TLS 加密** – 在 HTTP/2 中,强制使用 SSL/TLS。在 [RFC](https://tools.ietf.org/html/rfc7540) 中并没有强制,其允许纯文本的 HTTP/2,但是当前所有实现 HTTP/2的 Web 浏览器都只支持加密。 SSL/TLS 可以使你的网站更安全,并且使用 HTTP/2 各项性能会有提升,加密和解密过程的性能损失就减少了。 要了解更多关于 HTTP/2: * 请阅读我们的 [白皮书](https://www.nginx.com/wp-content/uploads/2015/09/NGINX_HTTP2_White_Paper_v4.pdf),它涵盖了你需要了解HTTP/2 的一切。 * 下载由 Google 的 Ilya Grigorik 编写的 [特别版的高性能浏览器网络电子书](https://www.nginx.com/http2-ebook/) ( LCTT 译注:涵盖 HTTP/2 的部分)。 ### NGINX Plus 如何实现 HTTP/2 我们的 HTTP/2 实现是基于 SPDY 支持的,它已经被广泛部署(使用了 NGINX 或 NGINX Plus 的网站近 75% 都使用了 SPDY)。使用 NGINX Plus 部署 HTTP/2 时,几乎不会改变你应用程序的配置。本节将讨论 NGINX Plus如何实现对 HTTP/2 的支持。 #### 一个 HTTP/2 网关 ![](/data/attachment/album/201510/08/091503qx6864ajaudyo6i6.png) NGINX Plus 作为一个 HTTP/2 网关。它与支持 HTTP/2 的客户端 Web 浏览器用 HTTP/2 通讯,而转换 HTTP/2 请求给后端服务器通信时使用 HTTP/1.x(或者 FastCGI, SCGI, uWSGI, 等等. – 取决于你目前正在使用的协议)。 #### 向后兼容性 ![](/data/attachment/album/201510/08/091504enuwwbbqaopwlwwk.png) 在一段时间内,你需要同时支持 HTTP/2 和 HTTP/1.x。在撰写本文时,超过50%的用户使用的 Web 浏览器已经[支持 HTTP/2](http://caniuse.com/#feat=http2),但这也意味着近50%的人还没有使用。 为了同时支持 HTTP/1.x 和 HTTP/2,NGINX Plus 实现了 TLS 上的 Next Protocol Negotiation (NPN)扩展。当 Web 浏览器连接到服务器时,其将所支持的协议列表发送到服务器端。如果浏览器支持的协议列表中包括 h2 - 即 HTTP/2,NGINX Plus 将使用 HTTP/2 连接到浏览器。如果浏览器不支持 NPN 或在发送支持的协议列表中没有 h2,NGINX Plus 将继续回落到 HTTP/1.x。 ### 转向 HTTP/2 NGINX 公司会尽可能帮助大家无缝过渡到使用 HTTP/2。本节介绍了通过对你应用进行改变来启用对 HTTP/2 支持,其中只需对 NGINX Plus 配置进行几个变化。 #### 前提条件 使用 **nginx‑plus‑http2** 软件包升级到 NGINX Plus R7。注意现在还没有支持 HTTP/2 版本的 **nginx‑plus‑extras** 软件包。 #### 重定向所有流量到 SSL/TLS 如果你的应用尚未使用 SSL/TLS 加密,现在启用它正是一个好的时机。加密你的应用程序可以保护你免受间谍以及来自其他中间人的攻击。一些搜索引擎甚至在搜索结果中对加密站点[提高排名](http://googlewebmastercentral.blogspot.co.uk/2014/08/https-as-ranking-signal.html)。下面的配置块重定向所有的普通 HTTP 请求到该网站的加密版本。 ``` server { listen 80; location / { return 301 https://$host$request_uri; } } ``` #### 启用 HTTP/2 要启用对 HTTP/2 的支持,只需将 http2 参数添加到所有的 [listen](http://nginx.org/en/docs/http/ngx_http_core_module.html#listen) 指令中,也要包括 SSL 参数,因为浏览器不支持不加密的 HTTP/2 请求。 ``` server { listen 443 ssl http2 default_server; ssl_certificate server.crt; ssl_certificate_key server.key; … } ``` 如果有必要,重启 NGINX Plus,例如通过运行 `nginx -s reload` 命令。要验证 HTTP/2 是否正常工作,你可以在 [Google Chrome](https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en) 和 [Firefox](https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/) 中使用 “HTTP/2 and SPDY indicator” 插件来检查。 ### 注意事项 * 在安装 **nginx‑plus‑http2** 包之前, 你必须删除配置文件中所有 listen 指令后的 SPDY 参数(使用 http2 和 ssl 参数来替换它以启用对 HTTP/2 的支持)。使用这个包后,如果 listen 指令后有 spdy 参数,NGINX Plus 将无法启动。 * 如果你在 NGINX Plus 前端使用了 Web 应用防火墙(WAF),请确保它能够解析 HTTP/2,或者把它移到 NGINX Plus 后面。 * 此版本不支持在 HTTP/2 RFC 中定义的 “Server Push” 特性。 NGINX Plus 以后的版本可能会支持它。 * NGINX Plus R7 同时支持 SPDY 和 HTTP/2(LCTT 译注:但是你只能同时使用其中一种)。在以后的版本中,我们将弃用对 SPDY 的支持。谷歌在2016年初将 [弃用 SPDY](http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html),因此同时支持这两种协议也非必要。 * 如果 [ssl\_prefer\_server\_ciphers](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers) 设置为 on 或者使用了定义在 [Appendix A: TLS 1.2 Ciper Suite Black List](https://tools.ietf.org/html/rfc7540#appendix-A) 中的 [ssl\_ciphers](http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers) 列表时,浏览器会出现 handshake-errors 而无法正常工作。详细内容请参阅 [section 9.2.2 of the HTTP/2 RFC](https://tools.ietf.org/html/rfc7540#section-9.2.2)。 ### 特别感谢 NGINX 公司要感谢 [Dropbox](http://dropbox.com/) 和 [Automattic](http://automattic.com/),他们是我们软件的重度使用者,并帮助我们实现 HTTP/2。他们的贡献帮助我们加速完成这个软件,我们希望你也能支持他们。 --- via: <https://www.nginx.com/blog/http2-r7/> 作者:[Faisal Memon](https://www.nginx.com/blog/author/fmemon/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,369
使用 ansible 安装 NGINX 和 NGINX Plus
https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/
2015-10-08T11:13:00
[ "Ansible", "NGINX" ]
https://linux.cn/article-6369-1.html
在生产环境中,我会更喜欢做与自动化相关的所有事情。如果计算机能完成你的任务,何必需要你亲自动手呢?但是,在不断变化并存在多种技术的环境中,创建和实施自动化是一项艰巨的任务。这就是为什么我喜欢 [Ansible](http://www.ansible.com/) 的原因。Ansible 是一个用于 IT 配置管理,部署和业务流程的开源工具,使用起来非常方便。 我最喜欢 Ansible 的一个特点是,它是完全无客户端的。要管理一个系统,通过 SSH 建立连接,它使用[Paramiko](http://www.paramiko.org/)(一个 Python 库)或本地的 [OpenSSH](http://www.openssh.com/)。Ansible 另一个吸引人的地方是它有许多可扩展的模块。这些模块可被系统管理员用于执行一些的常见任务。特别是,它们使用 Ansible 这个强有力的工具可以跨多个服务器、环境或操作系统安装和配置任何程序,只需要一个控制节点。 在本教程中,我将带你使用 Ansible 完成安装和部署开源 [NGINX](http://nginx.org/en/) 和我们的商业产品 [NGINX Plus](https://www.nginx.com/products/)。我将在 [CentOS](http://www.centos.org/) 服务器上演示,但我也在下面的“在 Ubuntu 上创建 Ansible Playbook 来安装 NGINX 和 NGINX Plus”小节中包含了在 Ubuntu 服务器上部署的细节。 ![](/data/attachment/album/201510/08/170019yk7ko23oxgoyxoyx.png) 在本教程中我将使用 Ansible 1.9.2 版本,并在 CentOS 7.1 服务器上部署运行。 ``` $ ansible --version ansible 1.9.2 $ cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) ``` 如果你还没有 Ansible,可以在 [Ansible 网站](http://docs.ansible.com/ansible/intro_installation.html#installing-the-control-machine) 查看说明并安装它。 如果你使用的是 CentOS,安装 Ansible 十分简单,只要输入以下命令。如果你想使用源码编译安装或使用其他发行版,请参阅上面 Ansible 链接中的说明。 ``` $ sudo yum install -y epel-release && sudo yum install -y ansible ``` 根据环境的不同,在本教程中的命令有的可能需要 sudo 权限。文件路径,用户名和目标服务器取决于你的环境的情况。 ### 创建一个 Ansible Playbook 来安装 NGINX (CentOS) 首先,我们要为 NGINX 的部署创建一个工作目录,包括子目录和部署配置文件。我通常建议在你的主目录中创建该目录,在文章的所有例子中都会有说明。 ``` $ cd $HOME $ mkdir -p ansible-nginx/tasks/ $ touch ansible-nginx/deploy.yml $ touch ansible-nginx/tasks/install_nginx.yml ``` 目录结构看起来是这样的。你可以使用 tree 命令来查看。 ``` $ tree $HOME/ansible-nginx/ /home/kjones/ansible-nginx/ ├── deploy.yml └── tasks └── install_nginx.yml 1 directory, 2 files ``` 如果你没有安装 tree 命令,使用以下命令去安装。 ``` $ sudo yum install -y tree ``` #### 创建主部署文件 接下来,我们在文本编辑器中打开 **deploy.yml**。我喜欢在命令行上使用 vim 来编辑配置文件,在整个教程中也都将使用它。 ``` $ vim $HOME/ansible-nginx/deploy.yml ``` **deploy.yml** 文件是 Ansible 部署的主要文件,在“使用 Ansible 部署 NGINX”小节中,我们运行 ansible‑playbook 命令时会使用此文件。在这个文件中,我们指定 Ansible 运行时使用的库以及其它配置文件。 在这个例子中,我使用 [include](http://docs.ansible.com/ansible/playbooks_roles.html#task-include-files-and-encouraging-reuse) 模块来指定配置文件一步一步来安装NGINX。虽然可以创建一个非常大的 playbook 文件,我建议你将其分割为小文件,让它们更有条理。include 的示例中可以复制静态内容,复制配置文件,为更高级的部署使用逻辑配置设定变量。 在文件中输入以下行。我在顶部的注释包含了文件名用于参考。 ``` # ./ansible-nginx/deploy.yml - hosts: nginx tasks: - include: 'tasks/install_nginx.yml' ``` hosts 语句说明 Ansible 部署 **nginx** 组的所有服务器,服务器在 **/etc/ansible/hosts** 中指定。我们会在下面的“创建 NGINX 服务器列表”小节编辑此文件。 include 语句说明 Ansible 在部署过程中从 **tasks** 目录下读取并执行 **install\_nginx.yml** 文件中的内容。该文件包括以下几步:下载,安装,并启动 NGINX。我们将在下一节创建此文件。 #### 为 NGINX 创建部署文件 现在,先保存 **deploy.yml** 文件,并在编辑器中打开 **install\_nginx.yml** 。 ``` $ vim $HOME/ansible-nginx/tasks/install_nginx.yml ``` 该文件包含有指令(使用 [YAML](http://docs.ansible.com/ansible/YAMLSyntax.html) 格式写的), Ansible 会按照指令安装和配置我们的 NGINX 部署过程。每个节(过程中的步骤)起始于一个描述此步骤的 `name` 语句(前面有连字符)。 `name` 后的字符串是 Ansible 部署过程中输出到标准输出的,可以根据你的意愿来修改。YAML 文件中的节的下一行是在部署过程中将使用的模块。在下面的配置中,使用了 [`yum`](http://docs.ansible.com/ansible/yum_module.html) 和 [`service`](http://docs.ansible.com/ansible/service_module.html) 模块。`yum` 模块用于在 CentOS 上安装软件包。`service` 模块用于管理 UNIX 的服务。在这个节的最后一行或几行指定了几个模块的参数(在本例中,这些行以 `name` 和 `state` 开始)。 在文件中输入以下行。就像 **deploy.yml**,在我们文件的第一行是用于参考的文件名的注释。第一个节告诉 Ansible 在CentOS 7 上从 NGINX 仓库安装该 **.rpm** 文件。这让软件包管理器直接从 NGINX 仓库安装最新最稳定的版本。根据你的 CentOS 版本修改路径。所有可用的包的列表可以在 [开源 NGINX 网站](http://nginx.org/en/linux_packages.html) 上找到。接下来的两节告诉 Ansible 使用 `yum` 模块安装最新的 NGINX 版本,然后使用 `service` 模块启动 NGINX。 **注意:** 在第一个节中,CentOS 包中的路径名可能由于宽度显示为连着的两行。请在一行上输入其完整路径。 ``` # ./ansible-nginx/tasks/install_nginx.yml - name: NGINX | Installing NGINX repo rpm yum: name: http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm - name: NGINX | Installing NGINX yum: name: nginx state: latest - name: NGINX | Starting NGINX service: name: nginx state: started ``` #### 创建 NGINX 服务器列表 现在,我们设置好了 Ansible 部署的所有配置文件,我们需要告诉 Ansible 部署哪个服务器。我们需要在 Ansible 中指定 **hosts** 文件。先备份现有的文件,并新建一个新文件来部署。 ``` $ sudo mv /etc/ansible/hosts /etc/ansible/hosts.backup $ sudo vim /etc/ansible/hosts ``` 在文件中输入(或编辑)以下行来创建一个名为 **nginx** 的组并列出安装 NGINX 的服务器。你可以通过主机名、IP 地址、或者在一个范围,例如 **server[1-3].domain.com** 来指定服务器。在这里,我通过 IP 地址指定一台服务器。 ``` # /etc/ansible/hosts [nginx] 172.16.239.140 ``` #### 设置安全性 接近完成了,但在部署之前,我们需要确保 Ansible 已被授权通过 SSH 访问我们的目标服务器。 首选并且最安全的方法是添加 Ansible 所要部署服务器的 RSA SSH 密钥到目标服务器的 **authorized\_keys** 文件中,这给予 Ansible 在目标服务器上的不受限制 SSH 权限。要了解更多关于此配置,请参阅 wiki.centos.org 上 [安全加固 OpenSSH](http://wiki.centos.org/HowTos/Network/SecuringSSH)。这样,你就可以自动部署而无需用户交互。 另外,你也可以在部署过程中要求输入密码。我强烈建议你只在测试过程中使用这种方法,因为它是不安全的,没有办法跟踪目标主机的身份(fingerprint)变化。如果你想这样做,将每个目标主机 **/etc/ssh/ssh\_config** 文件中 StrictHostKeyChecking 的默认值 yes 改为 no。然后在 ansible-playbook 命令中添加 --ask-pass 参数来让 Ansible 提示输入 SSH 密码。 在这里,我将举例说明如何编辑 **ssh\_config** 文件来禁用在目标服务器上严格的主机密钥检查。我们手动连接 SSH 到我们将部署 NGINX 的服务器,并将 StrictHostKeyChecking 的值更改为 no。 ``` $ ssh [email protected] [email protected]'s password:*********** [kjones@nginx ]$ sudo vim /etc/ssh/ssh_config ``` 当你更改后,保存 **ssh\_config**,并通过 SSH 连接到你的 Ansible 服务器。保存后的设置应该如下所示。 ``` # /etc/ssh/ssh_config StrictHostKeyChecking no ``` #### 运行 Ansible 部署 NGINX 如果你一直照本教程的步骤来做,你可以运行下面的命令来使用 Ansible 部署 NGINX。(再次提示,如果你设置了 RSA SSH 密钥认证,那么 --ask-pass 参数是不需要的。)在 Ansible 服务器运行命令,并使用我们上面创建的配置文件。 ``` $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx/deploy.yml ``` Ansible 提示输入 SSH 密码,输出如下。recap 中显示 failed=0 这条信息,意味着部署成功了。 ``` $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx/deploy.yml SSH password: PLAY [all] ******************************************************************** GATHERING FACTS *************************************************************** ok: [172.16.239.140] TASK: [NGINX | Installing NGINX repo rpm] ************************************* changed: [172.16.239.140] TASK: [NGINX | Installing NGINX] ********************************************** changed: [172.16.239.140] TASK: [NGINX | Starting NGINX] ************************************************ changed: [172.16.239.140] PLAY RECAP ******************************************************************** 172.16.239.140 : ok=4 changed=3 unreachable=0 failed=0 ``` 如果你没有得到一个成功的 play recap,你可以尝试用 -vvvv 参数(带连接调试的详细信息)再次运行 ansible-playbook 命令来解决部署过程的问题。 当部署成功(假如我们是第一次部署)后,你可以在远程服务器上运行基本的 [cURL](http://curl.haxx.se/) 命令验证 NGINX 。在这里,它会返回 200 OK。Yes!我们使用 Ansible 成功安装了 NGINX。 ``` $ curl -Is 172.16.239.140 | grep HTTP HTTP/1.1 200 OK ``` ### 创建 Ansible Playbook 来安装 NGINX Plus (CentOS) 现在,我已经展示了如何安装 NGINX 的开源版本,我将带你完成安装 NGINX Plus。这需要更改一些额外的部署配置,并展示了一些 Ansible 的其他功能。 #### 复制 NGINX Plus 上的证书和密钥到 Ansible 服务器 使用 Ansible 安装和配置 NGINX Plus 时,首先我们需要将 [NGINX Plus Customer Portal](https://cs.nginx.com/) NGINX Plus 订阅的密钥和证书复制到 Ansible 部署服务器上的标准位置。 购买了 NGINX Plus 或正在试用的客户也可以访问 NGINX Plus Customer Portal。如果你有兴趣测试 NGINX Plus,你可以申请免费试用30天,[点击这里](https://www.nginx.com/#free-trial)。在你注册后不久你将收到一个试用证书和密钥的链接。 在 Mac 或 Linux 主机上,我在这里使用 [scp](http://linux.die.net/man/1/scp) 工具演示。在 Microsoft Windows 主机,可以使用 [WinSCP](https://winscp.net/eng/download.php)。在本教程中,先下载文件到我的 Mac 笔记本电脑上,然后使用 scp 将其复制到 Ansible 服务器。密钥和证书的位置都在我的家目录下。 ``` $ cd /path/to/nginx-repo-files/ $ scp nginx-repo.* user@destination-server:. ``` 接下来,我们通过 SSH 连接到 Ansible 服务器,确保 NGINX Plus 的 SSL 目录存在,移动文件到这儿。 ``` $ ssh user@destination-server $ sudo mkdir -p /etc/ssl/nginx/ $ sudo mv nginx-repo.* /etc/ssl/nginx/ ``` 验证你的 **/etc/ssl/nginx** 目录包含了证书(**.crt**)和密钥(**.key**)文件。你可以使用 tree 命令检查。 ``` $ tree /etc/ssl/nginx /etc/ssl/nginx ├── nginx-repo.crt └── nginx-repo.key 0 directories, 2 files ``` 如果你没有安装 tree,可以使用下面的命令去安装。 ``` $ sudo yum install -y tree ``` #### 创建 Ansible 目录结构 以下执行的步骤和我们的“创建 Ansible Playbook 来安装 NGINX(CentOS)”小节中部署开源 NGINX 的非常相似。首先,我们建一个工作目录用于部署 NGINX Plus 使用。我喜欢将它创建为我主目录的子目录。 ``` $ cd $HOME $ mkdir -p ansible-nginx-plus/tasks/ $ touch ansible-nginx-plus/deploy.yml $ touch ansible-nginx-plus/tasks/install_nginx_plus.yml ``` 目录结构看起来像这样。 ``` $ tree $HOME/ansible-nginx-plus/ /home/kjones/ansible-nginx-plus/ ├── deploy.yml └── tasks └── install_nginx_plus.yml 1 directory, 2 files ``` #### 创建主部署文件 接下来,像开源的 NGINX 一样,我们使用 vim 创建 **deploy.yml** 文件。 ``` $ vim ansible-nginx-plus/deploy.yml ``` 和开源 NGINX 的部署唯一的区别是,我们将包含文件的名称修改为 **install\_nginx\_plus.yml**。该文件告诉 Ansible 在 **nginx** 组中的所有服务器(**/etc/ansible/hosts** 中定义的)上部署 NGINX Plus ,然后在部署过程中从 **tasks** 目录读取并执行 **install\_nginx\_plus.yml** 的内容。 ``` # ./ansible-nginx-plus/deploy.yml - hosts: nginx tasks: - include: 'tasks/install_nginx_plus.yml' ``` 如果你之前没有安装过的话,你需要创建 hosts 文件,详细说明在上面的“创建 NGINX 服务器的列表”小节。 #### 为 NGINX Plus 创建部署文件 在文本编辑器中打开 **install\_nginx\_plus.yml**。该文件包含了使用 Ansible 来安装和配置 NGINX Plus 部署过程中的指令。这些命令和模块仅针对 CentOS,有些是 NGINX Plus 独有的。 ``` $ vim ansible-nginx-plus/tasks/install_nginx_plus.yml ``` 第一节使用 [`file`](http://docs.ansible.com/ansible/file_module.html) 模块,告诉 Ansible 使用指定的`path`和`state`参数为 NGINX Plus 创建特定的 SSL 目录,设置属主为 root,将权限 `mode` 更改为0700。 ``` # ./ansible-nginx-plus/tasks/install_nginx_plus.yml - name: NGINX Plus | 创建 NGINX Plus ssl 证书目录 file: path=/etc/ssl/nginx state=directory group=root mode=0700 ``` 接下来的两节使用 [copy](http://docs.ansible.com/ansible/copy_module.html) 模块从 Ansible 部署服务器上将 NGINX Plus 的证书和密钥复制到 NGINX Plus 服务器上,再修改属主为 root,权限 `mode` 为0700。 ``` - name: NGINX Plus | 复制 NGINX Plus repo 证书 copy: src=/etc/ssl/nginx/nginx-repo.crt dest=/etc/ssl/nginx/nginx-repo.crt owner=root group=root mode=0700 - name: NGINX Plus | 复制 NGINX Plus 密钥 copy: src=/etc/ssl/nginx/nginx-repo.key dest=/etc/ssl/nginx/nginx-repo.key owner=root group=root mode=0700 ``` 接下来,我们告诉 Ansible 使用 [`get_url`](http://docs.ansible.com/ansible/get_url_module.html) 模块在 url 参数指定的远程位置从 NGINX Plus 仓库下载 CA 证书,通过 `dest` 参数把它放在指定的目录 `dest` ,并设置权限 `mode` 为 0700。 ``` - name: NGINX Plus | 下载 NGINX Plus CA 证书 get_url: url=https://cs.nginx.com/static/files/CA.crt dest=/etc/ssl/nginx/CA.crt mode=0700 ``` 同样,我们告诉 Ansible 使用 `get_url` 模块下载 NGINX Plus repo 文件,并将其复制到 NGINX Plus 服务器上的 **/etc/yum.repos.d** 目录下。 ``` - name: NGINX Plus | 下载 yum NGINX Plus 仓库 get_url: url=https://cs.nginx.com/static/files/nginx-plus-7.repo dest=/etc/yum.repos.d/nginx-plus-7.repo mode=0700 ``` 最后两节的 `name` 告诉 Ansible 使用 `yum` 和 `service` 模块下载并启动 NGINX Plus。 ``` - name: NGINX Plus | 安装 NGINX Plus yum: name: nginx-plus state: latest - name: NGINX Plus | 启动 NGINX Plus service: name: nginx state: started ``` #### 运行 Ansible 来部署 NGINX Plus 在保存 **install\_nginx\_plus.yml** 文件后,运行 ansible-playbook 命令来部署 NGINX Plus。同样在这里,我们使用 --ask-pass 参数使用 Ansible 提示输入 SSH 密码并把它传递给每个 NGINX Plus 服务器,并指定主配置文件路径 **deploy.yml** 文件。 ``` $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx-plus/deploy.yml PLAY [nginx] ****************************************************************** GATHERING FACTS *************************************************************** ok: [172.16.239.140] TASK: [NGINX Plus | Creating NGINX Plus ssl cert repo directory] ************** changed: [172.16.239.140] TASK: [NGINX Plus | Copying NGINX Plus repository certificate] **************** changed: [172.16.239.140] TASK: [NGINX Plus | Copying NGINX Plus repository key] ************************ changed: [172.16.239.140] TASK: [NGINX Plus | Downloading NGINX Plus CA certificate] ******************** changed: [172.16.239.140] TASK: [NGINX Plus | Downloading yum NGINX Plus repository] ******************** changed: [172.16.239.140] TASK: [NGINX Plus | Installing NGINX Plus] ************************************ changed: [172.16.239.140] TASK: [NGINX Plus | Starting NGINX Plus] ************************************** changed: [172.16.239.140] PLAY RECAP ******************************************************************** 172.16.239.140 : ok=8 changed=7 unreachable=0 failed=0 ``` playbook 的 recap 成功完成。现在,使用 curl 命令来验证 NGINX Plus 是否在运行。太好了,我们得到的是 200 OK!成功了!我们使用 Ansible 成功地安装了 NGINX Plus。 ``` $ curl -Is http://172.16.239.140 | grep HTTP HTTP/1.1 200 OK ``` ### 在 Ubuntu 上创建 Ansible Playbook 来安装 NGINX 和 NGINX Plus 在 [Ubuntu 服务器](http://www.ubuntu.com/) 上部署 NGINX 和 NGINX Plus 的过程与 CentOS 很相似,我将一步一步的指导来完成整个部署文件,并指出和 CentOS 的细微差异。 首先和 CentOS 一样,创建 Ansible 目录结构和 Ansible 主部署文件。也按“创建 NGINX 服务器的列表”小节的描述创建 **/etc/ansible/hosts** 文件。对于 NGINX Plus,你也需要安装“复制 NGINX Plus 证书和密钥到 Ansible 服务器”小节的描述复制证书和密钥。 下面是开源 NGINX 的 **install\_nginx.yml** 部署文件。在第一节,我们使用 [`apt_key`](http://docs.ansible.com/ansible/apt_key_module.html) 模块导入 NGINX 的签名密钥。接下来的两节使用 [`lineinfile`](http://docs.ansible.com/ansible/lineinfile_module.html) 模块来添加 Ubuntu 14.04 的软件包 URL 到 **sources.list** 文件中。最后,我们使用 [`apt`](http://docs.ansible.com/ansible/apt_module.html) 模块来更新缓存并安装 NGINX(`apt` 取代了我们在 CentOS 中部署时的 `yum` 模块)。 ``` # ./ansible-nginx/tasks/install_nginx.yml - name: NGINX | 添加 NGINX 签名密钥 apt_key: url=http://nginx.org/keys/nginx_signing.key state=present - name: NGINX | 为 NGINX 添加 sources.list deb url lineinfile: dest=/etc/apt/sources.list line="deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx" - name: NGINX Plus | 为 NGINX 添加 sources.list deb-src url lineinfile: dest=/etc/apt/sources.list line="deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx" - name: NGINX | 更新 apt 缓存 apt: update_cache: yes - name: NGINX | 安装 NGINX apt: pkg: nginx state: latest - name: NGINX | 启动 NGINX service: name: nginx state: started ``` 下面是 NGINX Plus 的部署文件 **install\_nginx.yml**。前四节设置了 NGINX Plus 密钥和证书。然后,我们像开源的 NGINX 一样用 `apt_key` 模块导入签名密钥,`get_url` 模块为 NGINX Plus 下载 `apt` 配置文件。[`shell`](http://docs.ansible.com/ansible/shell_module.html) 模块使用 `printf` 命令写下输出到 **sources.list.d** 目录中的 **nginx-plus.list** 文件。最终的 `name` 模块和开源 NGINX 一样。 ``` # ./ansible-nginx-plus/tasks/install_nginx_plus.yml - name: NGINX Plus | 创建 NGINX Plus ssl 证书 repo 目录 file: path=/etc/ssl/nginx state=directory group=root mode=0700 - name: NGINX Plus | 复制 NGINX Plus 仓库证书 copy: src=/etc/ssl/nginx/nginx-repo.crt dest=/etc/ssl/nginx/nginx-repo.crt owner=root group=root mode=0700 - name: NGINX Plus | 复制 NGINX Plus 仓库密钥 copy: src=/etc/ssl/nginx/nginx-repo.key dest=/etc/ssl/nginx/nginx-repo.key owner=root group=root mode=0700 - name: NGINX Plus | 安装 NGINX Plus CA 证书 get_url: url=https://cs.nginx.com/static/files/CA.crt dest=/etc/ssl/nginx/CA.crt mode=0700 - name: NGINX Plus | 添加 NGINX Plus 签名密钥 apt_key: url=http://nginx.org/keys/nginx_signing.key state=present - name: NGINX Plus | 安装 Apt-Get NGINX Plus 仓库 get_url: url=https://cs.nginx.com/static/files/90nginx dest=/etc/apt/apt.conf.d/90nginx mode=0700 - name: NGINX Plus | 为 NGINX Plus 添加 sources.list url shell: printf "deb https://plus-pkgs.nginx.com/ubuntu `lsb_release -cs` nginx-plus\n" >/etc/apt/sources.list.d/nginx-plus.list - name: NGINX Plus | 运行 apt-get update apt: update_cache: yes - name: NGINX Plus | 安装 NGINX Plus 通过 apt-get apt: pkg: nginx-plus state: latest - name: NGINX Plus | 启动 NGINX Plus service: name: nginx state: started ``` 现在我们已经准备好运行 ansible-playbook 命令: ``` $ sudo ansible-playbook --ask-pass $HOME/ansible-nginx-plus/deploy.yml ``` 你应该得到一个成功的 play recap。如果你没有成功,你可以使用冗余参数,以帮助你解决出现的问题。 ### 小结 我在这个教程中演示是什么是 Ansible,可以做些什么来帮助你自动部署 NGINX 或 NGINX Plus,这仅仅是个开始。还有许多有用的模块,包括从用户账号管理到自定义配置模板等。如果你有兴趣了解关于这些的更多信息,请访问 [Ansible 官方文档](http://docs.ansible.com/)。 --- via: <https://www.nginx.com/blog/installing-nginx-nginx-plus-ansible/> 作者:[Kevin Jones](https://www.nginx.com/blog/author/kjones/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,373
NetBSD 7.0 发布
http://www.netbsd.org/releases/formal-7/NetBSD-7.0.html
2015-10-09T07:29:00
[ "NetBSD" ]
https://linux.cn/article-6373-1.html
NetBSD 项目发布了 NetBSD 7.0,这是 NetBSD 操作系统发布的第五个主要版本。 ![](/data/attachment/album/201510/09/000644i4kg447p4vb46z66.png) 这次发布带来了稳定性的提升、几百个 bug 修复以及许多新功能。主要有: * DRM/KMS 支持为使用现代的 Intel 和 Radeon 显卡的 x86 系统带来了图形性能提升 * 支持 ARM 多处理器 * 支持许多新的 ARM 主板: + 树莓派 2 + ODROID-C1 + BeagleBoard, BeagleBone, BeagleBone Black + MiraBox + Allwinner A20, A31: Cubieboard2, Cubietruck, Banana Pi, etc. + Freescale i.MX50, i.MX51: Kobo Touch, Netwalker + Xilinx Zynq: Parallella, ZedBoard * NPF 的重要改进: + BPF 默认带有即时 (JIT) 编译功能 + 支持动态规则 + 支持静态(无状态)NAT + 支持 RFC 6296 的 IPv6-to-IPv6 网络前缀翻译 (NPTv6) + 支持基于 CDB 的表(使用完美哈希和可靠的无锁 O(1) 查找) * USB 子系统中支持多处理器 * 一个集成了包过滤器的新的守护进程 [blacklistd(8)](http://man.netbsd.org/7.0/usr/share/man/html8//blacklistd.html) 可以动态保护诸如 ssh, named 和 ftpd 等其它网络守护进程免受攻击 * 在磁盘 wedges 处理方面的几个改进(关于 wedges 参见 [dkctl(8)](http://man.netbsd.org/7.0/usr/share/man/html8//dkctl.html) ) * 在 sysinst 中通过扩展分区菜单支持 GPT * Lua 内核级脚本 * epoc32:一个支持 Psion EPOC PDA 的新移植 * GCC 4.8.4:支持 C++11 * 可选的完整 BSD 协议的 C/C++ 运行时环境: compiler\_rt, libc++, libcxxrt. NetBSD 7.0 的完整更新列表[见此](http://www.netbsd.org/releases/formal-7/NetBSD-7.0.html#major-changes)。 完整的 NetBSD 7.0 的源代码和二进制可以在全球的许多站点下载到。下载站点列表:<http://www.NetBSD.org/mirrors/>,支 FTP, AnonCVS, SUP 等服务。建议需要下载 ISO 或 USB 磁盘镜像的用户通过 BitTorrent 下载, [种子在此](http://www.netbsd.org/mirrors/torrents/) 。使用 PGP 签名的校验列表: [http://ftp.NetBSD.org/pub/NetBSD/security/hashes/NetBSD-7.0\_hashes.asc](http://ftp.netbsd.org/pub/NetBSD/security/hashes/NetBSD-7.0_hashes.asc) NetBSD 7.0 支持许多种架构,提供二进制发行版的有: | | | | --- | --- | | [NetBSD/acorn26](http://www.netbsd.org/ports/acorn26/) | Acorn Archimedes, A-series and R-series systems | | [NetBSD/acorn32](http://www.netbsd.org/ports/acorn32/) | Acorn RiscPC/A7000, VLSI RC7500 | | [NetBSD/algor](http://www.netbsd.org/ports/algor/) | Algorithmics, Ltd. MIPS evaluation boards | | [NetBSD/alpha](http://www.netbsd.org/ports/alpha/) | Digital/Compaq Alpha (64-bit) | | [NetBSD/amd64](http://www.netbsd.org/ports/amd64/) | AMD family processors like Opteron, Athlon64, and Intel CPUs with EM64T extension | | [NetBSD/amiga](http://www.netbsd.org/ports/amiga/) | Commodore Amiga and MacroSystem DraCo | | [NetBSD/amigappc](http://www.netbsd.org/ports/amigappc/) | PowerPC-based Amiga boards. | | [NetBSD/arc](http://www.netbsd.org/ports/arc/) | MIPS-based machines following the Advanced RISC Computing spec | | [NetBSD/atari](http://www.netbsd.org/ports/atari/) | Atari TT030, Falcon, Hades | | [NetBSD/bebox](http://www.netbsd.org/ports/bebox/) | Be Inc's BeBox | | [NetBSD/cats](http://www.netbsd.org/ports/cats/) | Chalice Technology's CATS and Intel's EBSA-285 evaluation boards | | [NetBSD/cesfic](http://www.netbsd.org/ports/cesfic/) | CES FIC8234 VME processor board | | [NetBSD/cobalt](http://www.netbsd.org/ports/cobalt/) | Cobalt Networks' MIPS-based Microservers | | [NetBSD/dreamcast](http://www.netbsd.org/ports/dreamcast/) | Sega Dreamcast game console | | [NetBSD/emips](http://www.netbsd.org/ports/emips/) | The Extensible MIPS architecture from Microsoft Research | | [NetBSD/epoc32](http://www.netbsd.org/ports/epoc32/) | Psion EPOC PDAs | | [NetBSD/evbarm](http://www.netbsd.org/ports/evbarm/) | Various ARM-based evaluation boards and appliances | | [NetBSD/evbmips](http://www.netbsd.org/ports/evbmips/) | Various MIPS-based evaluation boards and appliances | | [NetBSD/evbppc](http://www.netbsd.org/ports/evbppc/) | Various PowerPC-based evaluation boards and appliances | | [NetBSD/evbsh3](http://www.netbsd.org/ports/evbsh3/) | Various Hitachi Super-H SH3 and SH4-based evaluation boards and appliances | | [NetBSD/ews4800mips](http://www.netbsd.org/ports/ews4800mips/) | NEC's MIPS-based EWS4800 workstation | | [NetBSD/hp300](http://www.netbsd.org/ports/hp300/) | Hewlett-Packard 9000/300 and 400 series | | [NetBSD/hppa](http://www.netbsd.org/ports/hppa/) | Hewlett-Packard 9000 Series 700 workstations | | [NetBSD/hpcarm](http://www.netbsd.org/ports/hpcarm/) | StrongARM based Windows CE PDA machines | | [NetBSD/hpcmips](http://www.netbsd.org/ports/hpcmips/) | MIPS-based Windows CE PDA machines | | [NetBSD/hpcsh](http://www.netbsd.org/ports/hpcsh/) | Hitachi Super-H based Windows CE PDA machines | | [NetBSD/i386](http://www.netbsd.org/ports/i386/) | IBM PCs and PC clones with i486-family processors and up | | [NetBSD/ibmnws](http://www.netbsd.org/ports/ibmnws/) | IBM Network Station 1000 | | [NetBSD/iyonix](http://www.netbsd.org/ports/iyonix/) | Castle Technology's Iyonix ARM based PCs | | [NetBSD/landisk](http://www.netbsd.org/ports/landisk/) | SH4 processor based NAS appliances | | [NetBSD/luna68k](http://www.netbsd.org/ports/luna68k/) | OMRON Tateisi Electric's LUNA series | | [NetBSD/mac68k](http://www.netbsd.org/ports/mac68k/) | Apple Macintosh with Motorola 68k CPU | | [NetBSD/macppc](http://www.netbsd.org/ports/macppc/) | Apple PowerPC-based Macintosh and clones | | [NetBSD/mipsco](http://www.netbsd.org/ports/mipsco/) | MIPS Computer Systems Inc. family of workstations and servers | | [NetBSD/mmeye](http://www.netbsd.org/ports/mmeye/) | Brains mmEye multimedia server | | [NetBSD/mvme68k](http://www.netbsd.org/ports/mvme68k/) | Motorola MVME 68k Single Board Computers | | [NetBSD/mvmeppc](http://www.netbsd.org/ports/mvmeppc/) | Motorola PowerPC VME Single Board Computers | | [NetBSD/netwinder](http://www.netbsd.org/ports/netwinder/) | StrongARM based NetWinder machines | | [NetBSD/news68k](http://www.netbsd.org/ports/news68k/) | Sony's 68k-based “NET WORK STATION” series | | [NetBSD/newsmips](http://www.netbsd.org/ports/newsmips/) | Sony's MIPS-based “NET WORK STATION” series | | [NetBSD/next68k](http://www.netbsd.org/ports/next68k/) | NeXT 68k “black” hardware | | [NetBSD/ofppc](http://www.netbsd.org/ports/ofppc/) | OpenFirmware PowerPC machines | | [NetBSD/pmax](http://www.netbsd.org/ports/pmax/) | Digital MIPS-based DECstations and DECsystems | | [NetBSD/prep](http://www.netbsd.org/ports/prep/) | PReP (PowerPC Reference Platform) and CHRP machines | | [NetBSD/rs6000](http://www.netbsd.org/ports/rs6000/) | IBM RS/6000 MCA-based PowerPC machines. | | [NetBSD/sandpoint](http://www.netbsd.org/ports/sandpoint/) | Motorola Sandpoint reference platform, including many PPC-based NAS boxes | | [NetBSD/sbmips](http://www.netbsd.org/ports/sbmips/) | Broadcom SiByte evaluation boards | | [NetBSD/sgimips](http://www.netbsd.org/ports/sgimips/) | Silicon Graphics' MIPS-based workstations | | [NetBSD/shark](http://www.netbsd.org/ports/shark/) | Digital DNARD (“shark”) | | [NetBSD/sparc](http://www.netbsd.org/ports/sparc/) | Sun SPARC (32-bit) and UltraSPARC (in 32-bit mode) | | [NetBSD/sparc64](http://www.netbsd.org/ports/sparc64/) | Sun UltraSPARC (in native 64-bit mode) | | [NetBSD/sun2](http://www.netbsd.org/ports/sun2/) | Sun Microsystems Sun 2 machines with Motorola 68010 CPU | | [NetBSD/sun3](http://www.netbsd.org/ports/sun3/) | Motorola 68020 and 030 based Sun 3 and 3x machines | | [NetBSD/vax](http://www.netbsd.org/ports/vax/) | Digital VAX | | [NetBSD/x68k](http://www.netbsd.org/ports/x68k/) | Sharp X680x0 series | | [NetBSD/xen](http://www.netbsd.org/ports/xen/) | The Xen virtual machine monitor | | [NetBSD/zaurus](http://www.netbsd.org/ports/zaurus/) | Sharp ARM PDAs | 这个版本中只支持源代码格式的 port 的有: | | | | --- | --- | | [NetBSD/ia64](http://www.netbsd.org/ports/ia64/) | Itanium family of processors |
200
OK
# Announcing NetBSD 7.0 The NetBSD Project is pleased to announce NetBSD 7.0, the fifteenth major release of the NetBSD operating system. This release brings stability improvements, hundreds of bug fixes, and many new features. Some highlights of the NetBSD 7.0 release are: - DRM/KMS support brings accelerated graphics to x86 systems using modern Intel and Radeon devices. - Multiprocessor ARM support. - Support for many new ARM boards: - Raspberry Pi 2 - ODROID-C1 - BeagleBoard, BeagleBone, BeagleBone Black - MiraBox - Allwinner A20, A31: Cubieboard2, Cubietruck, Banana Pi, etc. - Freescale i.MX50, i.MX51: Kobo Touch, Netwalker - Xilinx Zynq: Parallella, ZedBoard - Major NPF improvements: - BPF with just-in-time (JIT) compilation by default. - Support for dynamic rules. - Support for static (stateless) NAT. - Support for IPv6-to-IPv6 Network Prefix Translation (NPTv6) as per RFC 6296. - Support for CDB based tables (uses perfect hashing and guarantees lock-free O(1) lookups). - Multiprocessor support in the USB subsystem. - [blacklistd(8)](//man.NetBSD.org/NetBSD-7.0/blacklistd.8), a new daemon that integrates with packet filters to dynamically protect other network daemons such as ssh, named, and ftpd from network break-in attempts. - Numerous improvements in the handling of disk wedges (see [dkctl(8)](//man.NetBSD.org/NetBSD-7.0/dkctl.8)for information about wedges). - GPT support in sysinst via the extended partitioning menu. - Lua kernel scripting. - epoc32, a new port which supports Psion EPOC PDAs. - GCC 4.8.4, which brings support for C++11. - Optional fully BSD-licensed C/C++ runtime env: compiler_rt, libc++, libcxxrt. [Please read below](#major-changes) for a full list of changes in NetBSD 7.0. Complete source and binaries for NetBSD 7.0 are available for download at many sites around the world. A list of download sites providing FTP, AnonCVS, SUP, and other services may be found at [https://www.NetBSD.org/mirrors/](https://www.NetBSD.org/mirrors/). We encourage users who wish to install via ISO or USB disk images to download via BitTorrent by using the [torrent files](../../mirrors/torrents/) supplied in the images area. A list of hashes for the NetBSD 7.0 distribution has been signed with the well-connected PGP key for the NetBSD Security Officer: [https://ftp.NetBSD.org/pub/NetBSD/security/hashes/NetBSD-7.0_hashes.asc](https://ftp.NetBSD.org/pub/NetBSD/security/hashes/NetBSD-7.0_hashes.asc) NetBSD is free. All of the code is under non-restrictive licenses, and may be used without paying royalties to anyone. Free support services are available via our mailing lists and website. Commercial support is available from a variety of sources. More extensive information on NetBSD is available from our website: The complete list of changes can be found in the [CHANGES](//ftp.NetBSD.org/pub/NetBSD/NetBSD-7.0/CHANGES) and [ CHANGES-7.0](//ftp.NetBSD.org/pub/NetBSD/NetBSD-7.0/CHANGES-7.0) files in the top level directory of the NetBSD 7.0 release tree. An abbreviated version is below: - Add [sendmmsg(2)](//man.NetBSD.org/NetBSD-7.0/sendmmsg.2)and[recvmmsg(2)](//man.NetBSD.org/NetBSD-7.0/recvmmsg.2)support. - Add BPF coprocessor support (BPF_COP/BPF_COPX instructions). - Add [fdiscard(2)](//man.NetBSD.org/NetBSD-7.0/fdiscard.2)and[posix_fallocate(2)](//man.NetBSD.org/NetBSD-7.0/posix_fallocate.2)system calls. - Add a new RLIMIT_NTHR limit to limit the number of processes per user and the corresponding kern.maxlwp sysctl. - Import sljit and add BPF JIT compiler. - Expose kern.uidinfo.* via sysctl. - Create an "options MODULAR_DEFAULT_AUTOLOAD" config option and add it to all kernel configs that contain "options MODULAR". This option turns on module autoloading by default (which is the current default). This allows people who don't want module autoloading on by default to disable it by simply removing/commenting this line. - [kqueue(2)](//man.NetBSD.org/NetBSD-7.0/kqueue.2): on NOTE_EXIT, put the exit code of the process in "data". - [sysmon_pswitch(9)](//man.NetBSD.org/NetBSD-7.0/sysmon_pswitch.9): Introduce a new switch type, PSWITCH_TYPE_RADIO, to be used to report to userland hardware radio switch changes.[powerd(8)](//man.NetBSD.org/NetBSD-7.0/powerd.8)will call a "radio_button" script to handle the event. - [envsys(4)](//man.NetBSD.org/NetBSD-7.0/envsys.4): Add %rH (relative Humidity) to sensor framework. - Add sysctls to avoid IPv6 DoS attacks (from OpenBSD): - net.inet6.ip6.neighborgcthresh = 2048 - net.inet6.ip6.maxifprefixes = 16 - net.inet6.ip6.maxifdefrouters = 16 - net.inet6.ip6.maxdynroutes = 4096 - Make [shmif(4)](//man.NetBSD.org/NetBSD-7.0/shmif.4)work with bridges. - Add net.inet6.ip6.prefer_tempaddr sysctl knob to prefer IPv6 temporary addresses as the source address. - Add support for the TCP_INFO socket option, which permits the caller to query certain information about a TCP connection. - ptyfs: Allow multiple mounts and support proper device visibility in chroots. - Enable support for UFS1 extended attributes in GENERIC and GENERIC-like kernels. - FFS: Don't fail mounting the root filesystem if the WAPBL log is corrupt. - Add experimental support for the (mostly SSD specific) "discard", or ATA "TRIM" command to [wd(4)](//man.NetBSD.org/NetBSD-7.0/wd.4)and FFS. - [rnd(4)](//man.NetBSD.org/NetBSD-7.0/rnd.4):- Sensors can now be a source of entropy. - Gather much more entropy early in boot and thereafter: autoconf timings, all sysctl settings (including hostname), contents of early network packets, environmental sensor values generically rather than as per-driver special cases. - [rnd(9)](//man.NetBSD.org/NetBSD-7.0/rnd.9):- Add explicit enable/disable hooks for callout-driven sources (be more power friendly). - Make "skew" source polled so it runs only when there is entropy demand. - Adjust entropy collection from polled sources so it's processed sooner. - Add [viornd(4)](//man.NetBSD.org/NetBSD-7.0/viornd.4), a driver for the VirtIO entropy source available on QEMU, KVM, and Google Compute Engine. - [cprng_fast(9)](//man.NetBSD.org/NetBSD-7.0/cprng_fast.9): Replace slow/broken mutex-protected kernel _arc4random() with new cprng_fast implementation using per-cpu instances of chacha8. - Audio: - [ess(4)](//man.NetBSD.org/NetBSD-7.0/ess.4): Add support for Spatializer, 3D audio effects embedded in ES1869 and ES1879. - - Graphics and Video: - Add accelerated support for modern Intel and Radeon devices on x86 through a port of the Linux 3.15 DRM/KMS code. - [genfb(4)](//man.NetBSD.org/NetBSD-7.0/genfb.4): Add support for 32bit framebuffers. - Add gffb, a driver for NVIDIA GeForce2 MX graphics controllers. - Add gmafb, a framebuffer driver for Intel Graphics - Add tifb, an experimental driver for the Texas Instruments AM335x SoC's graphic controller. - Add [tdvfb(4)](//man.NetBSD.org/NetBSD-7.0/tdvfb.4), a 3Dfx Voodoo1 and Voodoo2 driver. - udl(4): Add support for the BUFFALO GX-DVI/U2B DisplayLink USB-DVI box. - Storage: - Recognize the Apple disk partitioning scheme, and auto-discover wedges. Fix iPod disk mounting. - Add [mpii(4)](//man.NetBSD.org/NetBSD-7.0/mpii.4), a driver for LSI Logic Fusion-MPT Message Passing Interface II SAS controllers. - [ata(4)](//man.NetBSD.org/NetBSD-7.0/ata.4): Add support for SATA Port MultiPliers (PMP). - [mfi(4)](//man.NetBSD.org/NetBSD-7.0/mfi.4):- Add tagged queuing support. - Add support for LSI SAS2208-based controllers. - Make it possible to use the LSI MegaCLI Linux binary on NetBSD. - Add support for the [bio(4)](//man.NetBSD.org/NetBSD-7.0/bio.4)API to the[mpt(4)](//man.NetBSD.org/NetBSD-7.0/mpt.4)driver. - Make [ccd(4)](//man.NetBSD.org/NetBSD-7.0/ccd.4)work with component and total sizes greater than 2TB. - Networking: - Add [axen(4)](//man.NetBSD.org/NetBSD-7.0/axen.4), a driver for ASIX AX88178a and AX88179 Ethernet devices. Ported from OpenBSD. - Add [malo(4)](//man.NetBSD.org/NetBSD-7.0/malo.4), a driver for Marvell Libertas IEEE 802.11b/g wireless network devices. Ported from OpenBSD. - Add [run(4)](//man.NetBSD.org/NetBSD-7.0/run.4), a driver for Ralink Technology RT2700U/RT2800U/RT3000U USB IEEE 802.11a/b/g/n wireless network devices. Ported from OpenBSD. - Add [usmsc(4)](//man.NetBSD.org/NetBSD-7.0/usmsc.4), a driver for SMSC LAN95xx USB LAN devices. From FreeBSD/OpenBSD. - Add [vmx(4)](//man.NetBSD.org/NetBSD-7.0/x86/vmx.4), a VMware VMXNET3 driver. Ported from OpenBSD. - [alc(4)](//man.NetBSD.org/NetBSD-7.0/alc.4): Add support for AR816x/AR817x chipsets. - [bge(4)](//man.NetBSD.org/NetBSD-7.0/bge.4): Add support for Altima AC1003, Apple BCM5701, Broadcom BCM5787F, BCM5787G, BCM5787F, BCM5719, BCM5720, BCM57762 (Apple Thunderbolt Gigabit Ethernet Adapter), BCM57766, BCM57782 and BCM57786. - [brgphy(4)](//man.NetBSD.org/NetBSD-7.0/brgphy.4): Add support for BCM5756, BCM5717C, BCM5719C, BCM5720C and BCM57780. - [iwn(4)](//man.NetBSD.org/NetBSD-7.0/iwn.4): Add support for Centrino Wireless-N 100/105/130/135/1030/2200/2230 and Centrino Advanced-N 6230. - [ixg(4)](//man.NetBSD.org/NetBSD-7.0/ixg.4): Add support for X540, TSO6 and 100BaseTx. - [micphy(4)](//man.NetBSD.org/NetBSD-7.0/micphy.4): Add Micrel PHY (KSZ9021RN) support. - [rgephy(4)](//man.NetBSD.org/NetBSD-7.0/rgephy.4): Add support for RTL8211F and RTL8251. - [u3g(4)](//man.NetBSD.org/NetBSD-7.0/u3g.4): Add Huawei E353 support. - [urtwn(4)](//man.NetBSD.org/NetBSD-7.0/urtwn.4): Add support for Realtek RTL8188EUS and RTL8188ETV chipsets. - [wm(4)](//man.NetBSD.org/NetBSD-7.0/wm.4): Add support for I210, I211, I217, I218, and I354. - Add - USB: - Miscellaneous: - Add [hythygtemp(4)](//man.NetBSD.org/NetBSD-7.0/hythygtemp.4), a driver for HYT-221/271/939 humidity and temperature I2C sensors. - Add [ibmcd(4)](//man.NetBSD.org/NetBSD-7.0/ibmcd.4), a driver for the IBM 4810 BSP cash drawer port. - Add [mcp23s17gpio(4)](//man.NetBSD.org/NetBSD-7.0/mcp23s17gpio.4), a driver for Microchip MCP23S17 16-bit GPIO chips. - Add [mcp980x(4)](//man.NetBSD.org/NetBSD-7.0/mcp980x.4), a driver for Microchip MCP9800/1/2/3 I2C temperature sensors. - Add [mpl115a(4)](//man.NetBSD.org/NetBSD-7.0/mpl115a.4), a driver for Freescale MPL115A2 I2C absolute pressure sensors. - Add [msm6242b(4)](//man.NetBSD.org/NetBSD-7.0/msm6242b.4), a driver for MI OKI MSM6242B time-of-day clocks. - Add mcp48x1dac, a driver with preliminary support for the Microchip MCP48x1 family of Digital-to-Analog converters. - Add [ptcd(4)](//man.NetBSD.org/NetBSD-7.0/ptcd.4), a driver for the Protech PS3100 cash drawer port. - Add [rtsx(4)](//man.NetBSD.org/NetBSD-7.0/rtsx.4), a driver for Realtek RTL8402/RTL8411/RTL8411B/RTS5209/RTS5227/RTS5229 card readers. - [ubsec(4)](//man.NetBSD.org/NetBSD-7.0/ubsec.4): Add support for AES-CBC modes and BCM586x chips. - [vmt(4)](//man.NetBSD.org/NetBSD-7.0/x86/vmt.4): Synchronize the clock periodically to ensure it remains up-to-date even when the host is suspended. - [wskbd(4)](//man.NetBSD.org/NetBSD-7.0/wskbd.4): Add belgian keyboard layouts (KB_BE) to[pckbd(4)](//man.NetBSD.org/NetBSD-7.0/pckbd.4)and[ukbd(4)](//man.NetBSD.org/NetBSD-7.0/ukbd.4). - Add - [alpha](../../ports/alpha/):- Add support for AlphaStation DS15. - [amd64](../../ports/amd64/):- Add support for up to 256 CPUs. - Add drivers for the Apple System Management Controller. - [amiga](../../ports/amiga/):- Add [clockport(4)](//man.NetBSD.org/NetBSD-7.0/amiga/clockport.4)layer and a driver for A1200 on-board clockport[a1k2cp(4)](//man.NetBSD.org/NetBSD-7.0/amiga/a1k2cp.4). - Rework X-Surf driver as [xsurf(4)](//man.NetBSD.org/NetBSD-7.0/amiga/xsurf.4). Add support for[clockport(4)](//man.NetBSD.org/NetBSD-7.0/amiga/clockport.4)on top of xsurf. - A2000-style RTCs are now driven by the [msm6242b(4)](//man.NetBSD.org/NetBSD-7.0/msm6242b.4)driver. - Add empm, a driver for the power manager present on Mediator 1200 TX and SX bridges. - Support software power-off with empm(4). - Add initial support for Thylacine USB cards using [slhci(4)](//man.NetBSD.org/NetBSD-7.0/slhci.4). - gayle(4): Add support for newer 1200 models. - Add [xsh(4)](//man.NetBSD.org/NetBSD-7.0/amiga/xsh.4), a driver for the Individual Computers X-Surf 100 network interface card. - Add [empb(4)](//man.NetBSD.org/NetBSD-7.0/amiga/empb.4), an ELBOX Mediator PCI 1200 driver. - Add [z3rambd(4)](//man.NetBSD.org/NetBSD-7.0/amiga/z3rambd.4), a Zorro III RAM board driver. - Add [em4k(4)](//man.NetBSD.org/NetBSD-7.0/amiga/em4k.4), a Mediator 4000 PCI bridge driver. - Add [acafh(4)](//man.NetBSD.org/NetBSD-7.0/amiga/acafh.4), an Individual Computers ACA500 driver. - Add - ARM: - Add support for SMP. - Add Cortex-A9 support. - ARMFPE support has been removed. - Add NEON userland support. - Userland FPA support replaced with VFP. - All arm ports with a common MACHINE_ARCH now generate the same userspace. All sets are the same except for etc.tgz. - Switched to EABI. - [epoc32](../../ports/epoc32/):- Add a new port, epoc32, supporting 32bit Psion EPOC PDAs, primarily the Series 5 (CL PS-711x), Series 5mx (Windermere) and Series 7 (StrongARM) models. - [evbarm](../../ports/evbarm/):- Full Raspberry Pi support, including VideoCore IV GPU and audio support. - Add support for the Raspberry Pi 2. - Add support for the ODROID-C1. - Add support for the BeagleBone (TI AM335x-based) board. - Add support for the BeagleBoard-xM (TI DM37XX) board. - Add support for the Kobo Touch (Freescale i.MX50). - Add support for the BCM5301X SoC. - Add support for OMAP4430. - Add support for Freescale i.MX6. - Add support for Marvell Armada XP SoCs. - Add [tps65217pmic(4)](//man.NetBSD.org/NetBSD-7.0/tps65217pmic.4), a driver with support for TPS65217 PMIC, as found on BeagleBone and other AM335x based boards. - Add tiotg, a driver for the Texas Instruments AM335x SoC's USB OTG controller. - Add bcmgpio, a BCM2835 GPIO obio driver. - Add trng, an AM335x TRNG driver. - Add bcmdmac, a BCM2835 dma controller driver. - Add edma, a driver for the Enhanced Direct Memory Access controller found in the AM335x SoC. - Add Zynq (Xilinx) support. - [evbmips](../../ports/evbmips/):- Add support for Lemote Yeeloong Notebooks. - [hppa](../../ports/hppa/): - [hp300](../../ports/hp300/):- Add [arcofi(4)](//man.NetBSD.org/NetBSD-7.0/arcofi.4), which supports the HP "Audio1" device found on HP9000/425e machines. - Fixed broken apci console support in the bootloader. - Add [sti(4)](//man.NetBSD.org/NetBSD-7.0/sti.4)at sgc screen console support to bootloader. - Add HP9000/425e RTC support. - Add proper consinit(9) support for [sti(4)](//man.NetBSD.org/NetBSD-7.0/sti.4)at sgc framebuffer on HP9000/425e. - Add support for [sti(4)](//man.NetBSD.org/NetBSD-7.0/sti.4)framebuffer at sgc bus on some 425t. - The Apollo Domain keyboard now works. - Add - [i386](../../ports/i386/):- Add a soekrisgpio driver for Soekris net6501 machines. - Disable COMPAT_FREEBSD by default. - Remove vga@isa and pcdisplay@isa from GENERIC, and create a new LEGACY kernel config that includes them instead. - [luna68k](../../ports/luna68k/):- Add preliminary support for 4bpp framebuffers. - Add a native bootloader based on the 4.4BSD-Lite2/luna68k "Stinger" loader. - Add netboot support. - sysinst now creates a boot UFS partition and installs the native bootloader during installation. - Add ANSI text color support for 8bpp color framebuffers. - The [wsfb(4)](//man.NetBSD.org/NetBSD-7.0/wsfb.4)Xserver now works as monochrome server even with 4bpp/8bpp color framebuffers. - The console ANSI color palette is now reset properly after returning to WSDISPLAYIO_MODE_EMUL (e.g., when exiting the Xserver). - [macppc](../../ports/macppc/):- Add support for ppc601-based machines. - m68k: - Add inverse trigonometric functions, hyperbolic arctangent, exponential and power functions to m68k floating point emulation. - [sparc](../../ports/sparc/):- Add hardware acceleration for cgfourteen(4) using SX. - [sparc64](../../ports/sparc64/):- Switch to TOPDOWN_VM. - [x68k](../../ports/x68k/):- Add a network bootloader for Neptune-X and Nereid Ethernet. - The bootloader now probes the actual memory size and warns if the memory size value stored in SRAM is different. - Add a 'switch' command to the bootloader to display and modify SRAM parameters as NetBSD's memswitch(8) and Human68k's SWITCH.X commands. - Switched to X.Org, including the X68k monolithic server. - Add support for up to 1008 MB of extended memory on the XM6i emulator. - Add support for formatting floppies. - [xen](../../ports/xen/):- Add MODULAR infrastructure for Xen kernels. - Add [blacklistd(8)](//man.NetBSD.org/NetBSD-7.0/blacklistd.8), a daemon that integrates with packet filters to dynamically protect other network daemons such as ssh, named, and ftpd from network break-in attempts. - Add [ekermit(1)](//man.NetBSD.org/NetBSD-7.0/ekermit.1), which is BSD-licenced. Replaces gkermit. - Add [flock(1)](//man.NetBSD.org/NetBSD-7.0/flock.1), a utility to provide locks to shell scripts similar to[shlock(1)](//man.NetBSD.org/NetBSD-7.0/shlock.1). - Add [getaddrinfo(1)](//man.NetBSD.org/NetBSD-7.0/getaddrinfo.1), a utility for querying the system's name resolver. - Add [midirecord(1)](//man.NetBSD.org/NetBSD-7.0/midirecord.1), a program for recording MIDI files. - Add a [service(8)](//man.NetBSD.org/NetBSD-7.0/service.8)command, based on the FreeBSD script. - Add [timeout(1)](//man.NetBSD.org/NetBSD-7.0/timeout.1), a command to run a command with a time limit. - Add support for named wedges to the following commands: [ccdconfig(8)](//man.NetBSD.org/NetBSD-7.0/ccdconfig.8),[installboot(8)](//man.NetBSD.org/NetBSD-7.0/installboot.8),[fsck(8)](//man.NetBSD.org/NetBSD-7.0/fsck.8),[newfs(8)](//man.NetBSD.org/NetBSD-7.0/newfs.8). - [atactl(8)](//man.NetBSD.org/NetBSD-7.0/atactl.8): Add support for ATA SECURITY commands including setting firmware passwords and erasing disks. - [cksum(1)](//man.NetBSD.org/NetBSD-7.0/cksum.1): Add a -q option for quiet operation. - [dbsym(8)](//man.NetBSD.org/NetBSD-7.0/dbsym.8): Add the -p option, to report the size of the kernel symbol table and the size of the db_symtab space. - [dd(1)](//man.NetBSD.org/NetBSD-7.0/dd.1): Add iflag and oflag operands. - [dkctl(8)](//man.NetBSD.org/NetBSD-7.0/dkctl.8): Add makewedges option to autodiscover wedges from a changed label. - [etcupdate(8)](//man.NetBSD.org/NetBSD-7.0/etcupdate.8): A colon-separated list of tgz files is no longer accepted; you must use multiple -s options instead. - [etcupdate(8)](//man.NetBSD.org/NetBSD-7.0/etcupdate.8): Add destdir support. - [fstab(5)](//man.NetBSD.org/NetBSD-7.0/fstab.5): Add NAME=wedgename for fs_spec and routines to parse it. Now wedges can be used in /etc/fstab, even in dynamic environments where disks come and go and wedges get renumbered. - [ftp(1)](//man.NetBSD.org/NetBSD-7.0/ftp.1): Add HTTPS support. - [gpt(8)](//man.NetBSD.org/NetBSD-7.0/gpt.8): Complete overhaul, including adding following subcommands: type, resize, set, unset, backup, restore, and resizedisk. - [httpd(8)](//man.NetBSD.org/NetBSD-7.0/httpd.8): Add Lua scripting for content creation. - [indent(1)](//man.NetBSD.org/NetBSD-7.0/indent.1): Add -ut / -nut options for tab treatment, as in FreeBSD. - [makefs(8)](//man.NetBSD.org/NetBSD-7.0/makefs.8): Add support for msdos and UDF, creating file systems at an offset, and merging directories with common files. - [mkdep(1)](//man.NetBSD.org/NetBSD-7.0/mkdep.1): Add the -P option to prepend the string given to every target filename. - [netstat(1)](//man.NetBSD.org/NetBSD-7.0/netstat.1): Accept -faddress_family[,family ...]. - [patch(1)](//man.NetBSD.org/NetBSD-7.0/patch.1): Drop SCCS support. - [pcictl(8)](//man.NetBSD.org/NetBSD-7.0/pcictl.8): Add "read" and "write" subcommands. - [pr(1)](//man.NetBSD.org/NetBSD-7.0/pr.1): Add support for POSIX -f and -p options. - [resize_ffs(8)](//man.NetBSD.org/NetBSD-7.0/resize_ffs.8):- Add -c to check to see if grow/shrink is required. - Add a -p flag, which displays a progress bar. - [systat(1)](//man.NetBSD.org/NetBSD-7.0/systat.1): Accept shell patterns to select drives. - [tetris(6)](//man.NetBSD.org/NetBSD-7.0/tetris.6):- Add a 'down' key, defaulting to 'n'. It moves the block down a line, if it fits. - Add support for colors. - [tset(1)](//man.NetBSD.org/NetBSD-7.0/tset.1): Restore logic for setting the VERASE character. Use terminfo _unless_ the terminal does overstrike, and use terminfo data not only for an unset tty. - [units(1)](//man.NetBSD.org/NetBSD-7.0/units.1): Add -l and -L options to list known units. - [vndcompress(1)](//man.NetBSD.org/NetBSD-7.0/vndcompress.1)- Add support for restarting after interrupt. - Add support for constant memory, so 32-bit systems should be able to compress or uncompress multi-terabyte disks. - [zgrep(1)](//man.NetBSD.org/NetBSD-7.0/zgrep.1): suppress the prefixing of filename on output when only one file is specified, to match grep(1)'s output. - Libraries: - libc: - Add a murmurhash2 function. - Add [consttime_memequal(3)](//man.NetBSD.org/NetBSD-7.0/consttime_memequal.3)and[explicit_memset(3)](//man.NetBSD.org/NetBSD-7.0/explicit_memset.3)for crypto applications. - Add [strtoi(3)](//man.NetBSD.org/NetBSD-7.0/strtoi.3)and[strtou(3)](//man.NetBSD.org/NetBSD-7.0/strtou.3). - [arc4random(3)](//man.NetBSD.org/NetBSD-7.0/arc4random.3): Use ChaCha20 instead of RC4. - libm: Add basic long double support for elementary functions. Most transcendent functions are stubbed out. - librt: Add [shm_open(3)](//man.NetBSD.org/NetBSD-7.0/shm_open.3)and[shm_unlink(3)](//man.NetBSD.org/NetBSD-7.0/shm_unlink.3). - [ossaudio(3)](//man.NetBSD.org/NetBSD-7.0/ossaudio.3): Add initial OSSv4 support. - Implement FUSE direct I/O. - Add PUFFS support for fallocate and fdiscard operations, and add FUSE fallocate support. - [puffs(3)](//man.NetBSD.org/NetBSD-7.0/puffs.3): Add PUFFS_KFLAG_NOFLUSH_META to prevent sending metadata flush to FUSE. - libc: - 3rd party software updates: - BIND 9.10.2-P4 - IPFilter 5.1.1 - LLVM 3.6.1 - OpenLDAP 2.4.39 - OpenSSH 6.8 - OpenSSL 1.0.1p - SQLite 3.8.3.1 - [atf(7)](//man.NetBSD.org/NetBSD-7.0/atf.7)0.20 - binutils 2.23.2 - byacc 20130304 - [bzip2(1)](//man.NetBSD.org/NetBSD-7.0/bzip2.1)1.0.6 - dhcp 4.3.0 - [dhcpcd(8)](//man.NetBSD.org/NetBSD-7.0/dhcpcd.8)6.7.1 - [file(1)](//man.NetBSD.org/NetBSD-7.0/file.1)5.19 - flex 2.5.39 - [gcc(1)](//man.NetBSD.org/NetBSD-7.0/gcc.1)4.8.4 - [gdb(1)](//man.NetBSD.org/NetBSD-7.0/gdb.1)7.7.1 - [kerberos(8)](//man.NetBSD.org/NetBSD-7.0/kerberos.8)Heimdal-1-5-branch - [less(1)](//man.NetBSD.org/NetBSD-7.0/less.1)458 - libevent 2.0.22-stable - libpcap 1.5.2 - [lua(1)](//man.NetBSD.org/NetBSD-7.0/lua.1)5.3.0 - mDNSResponder 258.14 - ntp 4.2.8p2 - [openpam(3)](//man.NetBSD.org/NetBSD-7.0/openpam.3)20140912 (Ourouparia) - openresolv 3.6.0 - pcc 1.1.0.DEVEL 20120325 - pppd 2.4.7 - [pigz(1)](//man.NetBSD.org/NetBSD-7.0/pigz.1)2.3.1 - [postfix(1)](//man.NetBSD.org/NetBSD-7.0/postfix.1)2.11.4 - [tcpdump(8)](//man.NetBSD.org/NetBSD-7.0/tcpdump.8)4.5.1 - [tmux(1)](//man.NetBSD.org/NetBSD-7.0/tmux.1)1.9a - tzdata 2015f - wpa_supplicant/hostapd 2.4 - /usr/share/doc: Install formatted docs instead of nroff sources, and reorganize. - New BUILDINFO variable may be passed to build.sh, and exposed in /etc/release, as well as in sysctl kern.buildinfo. - Process /etc/modules.conf (if present) at startup, before securelevel is raised, to allow module loading on ports without a module aware bootloader. - Add a resize_root rc.d script. If resize_root=YES in rc.conf (the default is NO) then the system attempts to resize the root file system to fill its partition prior to mounting read-write. In this release of NetBSD, the following software components have been removed from the system. Some were not useful anymore, or their utility did not justify the maintenance overhead. Others were not working properly and there was a lack of interest in fixing them. - The window utility was removed in favor of tmux. window can be found in pkgsrc/misc/window. - OSI network stack support was removed. - FAST_IPSEC is now named IPSEC. The old KAME IPSEC code is gone. Please use a mirror site close to you. The NetBSD 7.0 release provides supported binary distributions for the following systems: | [NetBSD/acorn32](../../ports/acorn32/)[NetBSD/algor](../../ports/algor/)[NetBSD/alpha](../../ports/alpha/)[NetBSD/amd64](../../ports/amd64/)[NetBSD/amiga](../../ports/amiga/)[NetBSD/amigappc](../../ports/amigappc/)[NetBSD/arc](../../ports/arc/)[NetBSD/atari](../../ports/atari/)[NetBSD/bebox](../../ports/bebox/)[NetBSD/cats](../../ports/cats/)[NetBSD/cesfic](../../ports/cesfic/)[NetBSD/cobalt](../../ports/cobalt/)[NetBSD/dreamcast](../../ports/dreamcast/)[NetBSD/emips](../../ports/emips/)[NetBSD/epoc32](../../ports/epoc32/)[NetBSD/evbarm](../../ports/evbarm/)[NetBSD/evbmips](../../ports/evbmips/)[NetBSD/evbppc](../../ports/evbppc/)[NetBSD/evbsh3](../../ports/evbsh3/)[NetBSD/ews4800mips](../../ports/ews4800mips/)[NetBSD/hp300](../../ports/hp300/)[NetBSD/hppa](../../ports/hppa/)[NetBSD/hpcarm](../../ports/hpcarm/)[NetBSD/hpcmips](../../ports/hpcmips/)[NetBSD/hpcsh](../../ports/hpcsh/)[NetBSD/i386](../../ports/i386/)[NetBSD/ibmnws](../../ports/ibmnws/)[NetBSD/iyonix](../../ports/iyonix/)[NetBSD/landisk](../../ports/landisk/)[NetBSD/luna68k](../../ports/luna68k/)[NetBSD/mac68k](../../ports/mac68k/)[NetBSD/macppc](../../ports/macppc/)[NetBSD/mipsco](../../ports/mipsco/)[NetBSD/mmeye](../../ports/mmeye/)[NetBSD/mvme68k](../../ports/mvme68k/)[NetBSD/mvmeppc](../../ports/mvmeppc/)[NetBSD/netwinder](../../ports/netwinder/)[NetBSD/news68k](../../ports/news68k/)[NetBSD/newsmips](../../ports/newsmips/)[NetBSD/next68k](../../ports/next68k/)[NetBSD/ofppc](../../ports/ofppc/)[NetBSD/pmax](../../ports/pmax/)[NetBSD/prep](../../ports/prep/)[NetBSD/rs6000](../../ports/rs6000/)[NetBSD/sandpoint](../../ports/sandpoint/)[NetBSD/sbmips](../../ports/sbmips/)[NetBSD/sgimips](../../ports/sgimips/)[NetBSD/shark](../../ports/shark/)[NetBSD/sparc](../../ports/sparc/)[NetBSD/sparc64](../../ports/sparc64/)[NetBSD/sun2](../../ports/sun2/)[NetBSD/sun3](../../ports/sun3/)[NetBSD/vax](../../ports/vax/)[NetBSD/x68k](../../ports/x68k/)[NetBSD/xen](../../ports/xen/)[NetBSD/zaurus](../../ports/zaurus/) Ports available in source form only for this release include the following: | The NetBSD Foundation would like to thank all those who have contributed code, hardware, documentation, funds, colocation for our servers, web pages and other documentation, release engineering, and other resources over the years. More information on the people who make NetBSD happen is available at: We would like to especially thank the University of California at Berkeley and the GNU Project for particularly large subsets of code that we use. We would also like to thank the Internet Systems Consortium Inc. and the Network Security Lab at Columbia University's Computer Science Department for current colocation services. NetBSD is a free, fast, secure, and highly portable Unix-like Open Source operating system. It is available for a wide range of platforms, from large-scale servers and powerful desktop systems to handheld and embedded devices. Its clean design and advanced features make it excellent for use in both production and research environments, and the source code is freely available under a business-friendly license. NetBSD is developed and supported by a large and vibrant international community. Many applications are readily available through [pkgsrc, the NetBSD Packages Collection.](//pkgsrc.org) The [NetBSD Foundation](../../foundation/) was chartered in 1995, with the task of overseeing core NetBSD project services, promoting the project within industry and the open source community, and holding intellectual property rights on much of the NetBSD code base. Day-to-day operations of the project are handled by volunteers. As a non-profit organization with no commercial backing, the NetBSD Foundation depends on donations from its users, and we would like to ask you to consider [making a donation](../../donations/) to the NetBSD Foundation in support of continuing production of our fine operating system. Your generous donation would be particularly welcome to help with ongoing upgrades and maintenance, as well as with operating expenses for the NetBSD Foundation. Donations can be done via PayPal to `<` , or via Google Checkout and are fully tax-deductible in the US. See [[email protected]](mailto:[email protected])>[ www.NetBSD.org/donations/](//www.NetBSD.org/donations/#how-to-donate) for more information, or contact `<` directly. [[email protected]](mailto:[email protected])> Back to
6,377
在 Ubuntu 14.04/15.04 上配置 Node JS v4.0.0
http://linoxide.com/ubuntu-how-to/setup-node-js-4-0-ubuntu-14-04-15-04/
2015-10-09T14:12:51
[ "Node.js" ]
/article-6377-1.html
大家好,Node.JS 4.0 发布了,这个流行的服务器端 JS 平台合并了 Node.js 和 io.js 的代码,4.0 版就是这两个项目结合的产物——现在合并为一个代码库。这次最主要的变化是 Node.js 封装了4.5 版本的 Google V8 JS 引擎,与当前的 Chrome 所带的一致。所以,紧跟 V8 的发布可以让 Node.js 运行的更快、更安全,同时更好的利用 ES6 的很多语言特性。 ![Node JS](/data/attachment/album/201510/09/141254l9hs111sgbsk1tub.png) Node.js 4.0 发布的主要目标是为 io.js 用户提供一个简单的升级途径,所以这次并没有太多重要的 API 变更。下面的内容让我们来看看如何轻松的在 ubuntu server 上安装、配置 Node.js。 ### 基础系统安装 Node 在 Linux,Macintosh,Solaris 这几个系统上都可以完美的运行,linux 的发行版本当中使用 Ubuntu 相当适合。这也是我们为什么要尝试在 ubuntu 15.04 上安装 Node.js,当然了在 14.04 上也可以使用相同的步骤安装。 #### 1) 系统资源 Node.js 所需的基本的系统资源取决于你的架构需要。本教程我们会在一台 1GB 内存、 1GHz 处理器和 10GB 磁盘空间的服务器上进行,最小安装即可,不需要安装 Web 服务器或数据库服务器。 #### 2) 系统更新 在我们安装 Node.js 之前,推荐你将系统更新到最新的补丁和升级包,所以请登录到系统中使用超级用户运行如下命令: ``` # apt-get update ``` #### 3) 安装依赖 Node.js 仅需要你的服务器上有一些基本系统和软件功能,比如 'make'、'gcc'和'wget' 之类的。如果你还没有安装它们,运行如下命令安装: ``` # apt-get install python gcc make g++ wget ``` ### 下载最新版的Node JS v4.0.0 访问链接 [Node JS Download Page](https://nodejs.org/download/rc/v4.0.0-rc.1/) 下载源代码. ![nodejs download](/data/attachment/album/201510/09/141255uwulaa3uqzya0bqu.png) 复制其中的最新的源代码的链接,然后用`wget` 下载,命令如下: ``` # wget https://nodejs.org/download/rc/v4.0.0-rc.1/node-v4.0.0-rc.1.tar.gz ``` 下载完成后使用命令`tar` 解压缩: ``` # tar -zxvf node-v4.0.0-rc.1.tar.gz ``` ![wget nodejs](/data/attachment/album/201510/09/141256kqe1eeuc66lpquen.png) ### 安装 Node JS v4.0.0 现在可以开始使用下载好的源代码编译 Node.js。在开始编译前,你需要在 ubuntu server 上切换到源代码解压缩后的目录,运行 configure 脚本来配置源代码。 ``` root@ubuntu-15:~/node-v4.0.0-rc.1# ./configure ``` ![Installing NodeJS](/data/attachment/album/201510/09/141301bmeemhn9iemnzmie.png) 现在运行命令 'make install' 编译安装 Node.js: ``` root@ubuntu-15:~/node-v4.0.0-rc.1# make install ``` make 命令会花费几分钟完成编译,安静的等待一会。 ### 验证 Node.js 安装 一旦编译任务完成,我们就可以开始验证安装工作是否 OK。我们运行下列命令来确认 Node.js 的版本。 ``` root@ubuntu-15:~# node -v v4.0.0-pre ``` 在命令行下不带参数的运行`node` 就会进入 REPL(Read-Eval-Print-Loop,读-执行-输出-循环)模式,它有一个简化版的emacs 行编辑器,通过它你可以交互式的运行JS和查看运行结果。 ![node version](/data/attachment/album/201510/09/141302xxaxdrwh1rrrvva5.png) ### 编写测试程序 我们也可以写一个很简单的终端程序来测试安装是否成功,并且工作正常。要做这个,我们将会创建一个“test.js” 文件,包含以下代码,操作如下: ``` root@ubuntu-15:~# vim test.js var util = require("util"); console.log("Hello! This is a Node Test Program"); :wq! ``` 现在为了运行上面的程序,在命令行运行下面的命令。 ``` root@ubuntu-15:~# node test.js ``` ![Node Program](/data/attachment/album/201510/09/141303a2w32eyfedfcfdzw.png) 在一个成功安装了 Node JS 的环境下运行上面的程序就会在屏幕上得到上图所示的输出,这个程序加载类 “util” 到变量 “util” 中,接着用对象 “util” 运行终端任务,console.log 这个命令作用类似 C++ 里的cout ### 结论 就是这些了。如果你刚刚开始使用 Node.js 开发应用程序,希望本文能够通过在 ubuntu 上安装、运行 Node.js 让你了解一下Node.js 的大概。最后,我们可以认为我们可以期待 Node JS v4.0.0 能够取得显著性能提升。 --- via: <http://linoxide.com/ubuntu-how-to/setup-node-js-4-0-ubuntu-14-04-15-04/> 作者:[Kashif Siddique](http://linoxide.com/author/kashifs/) 译者:[osk874](https://github.com/osk874) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /ubuntu-how-to/setup-node-js-4-0-ubuntu-14-04-15-04/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b8327580fd0>, 'Connection to linoxide.com timed out. (connect timeout=10)'))
null
6,378
Xenlism WildFire: Linux 桌面的极简风格图标主题
http://itsfoss.com/xenlism-wildfire-theme/
2015-10-09T14:37:45
[ "主题" ]
https://linux.cn/article-6378-1.html
![](/data/attachment/album/201510/09/143748l7cjudzqinnues5n.png) 有那么一段时间我没更换主题了,可能最近的一段时间没有一款主题能让我眼前一亮了。我考虑过更换 [Ubuntu 上最好的图标主题](http://itsfoss.com/best-icon-themes-ubuntu-1404/),但是它们和 Numix 和 Moka 差不多,而且我觉得 Numix 也不错。 但是前几天我试了试 [Xenslim WildFire](http://xenlism.github.io/wildfire/),我必须承认,它看起来太棒了。极简风格是设计界当前的流行趋势,而 Xenlism 完美的表现了这种风格。平滑而美观,Xenlism 显然受到了诺基亚的 Meego 和苹果图标的影响。 让我们来看一下它的几个不同应用的图标: ![](/data/attachment/album/201510/09/143750zk2d2imm5ki3g96e.png) 文件夹图标看起来像这样: ![](/data/attachment/album/201510/09/143752o31b91bwbb1ynuqn.png) 主题开发者 [Nattapong Pullkhow](https://plus.google.com/+NattapongPullkhow) 说,这个图标主题最适合 GNOME,但是在 Unity 和 KDE,Mate 上也表现良好。 ### 安装 Xenlism Wildfire Xenlism Theme 大约有 230 MB, 对于一个主题来说确实很大,但是考虑到它所支持的庞大的软件数量,这个大小,确实也不是那么令人吃惊。 #### 在 Ubuntu/Debian 上安装 Xenlism 在 Ubuntu 系列中安装之前,用以下的命令添加 GPG 秘钥: ``` sudo apt-key adv --keyserver keys.gnupg.net --recv-keys 90127F5B ``` 添加完成之后,输入如下的命令进行安装: ``` echo "deb http://downloads.sourceforge.net/project/xenlism-wildfire/repo deb/" | sudo tee -a /etc/apt/sources.list sudo apt-get update sudo apt-get install xenlism-wildfire-icon-theme ``` 除了主题之外,你也可以选择是否下载配套的桌面背景图: ``` sudo apt-get install xenlism-artwork-wallpapers ``` #### 在 Arch 上安装 Xenlism 你需要编辑 Pacman 软件仓库。在终端中使用如下命令: ``` sudo nano /etc/pacman.conf ``` 添加如下的代码块,在配置文件中: ``` [xenlism-arch] SigLevel = Never Server = http://downloads.sourceforge.net/project/xenlism-wildfire/repo/arch ``` 更新系统并且安装: ``` sudo pacman -Syyu sudo pacman -S xenlism-wildfire ``` #### 使用 Xenlism 主题 在 Ubuntu Unity, [可以使用 Unity Tweak Tool 来改变主题](http://itsfoss.com/install-numix-ubuntu/)。 在 GNOME 中,[使用 Gnome Tweak Tool 改变主题](http://itsfoss.com/install-switch-themes-gnome-shell/)。 我确信你会接下来的步骤,如果你不会,请来信通知我,我会继续完善这篇文章。 这就是 Xenlism 在 Ubuntu 15.04 Unity 中的截图。同时也使用了 Xenlism 桌面背景。 ![](/data/attachment/album/201510/09/143756obqqu6luucney72f.png) 这看来真棒,不是吗?如果你试用了,并且喜欢它,你可以感谢它的开发者: > > [Xenlism 是一个用于 Linux 的、令人兴奋的极简风格的图标主题,感谢 @xenatt 做出这么漂亮的主题。](https://twitter.com/share?text=Xenlism+is+a+stunning+minimal+icon+theme+for+Linux.+Thanks+%40xenatt+for+this+beautiful+theme.&via=itsfoss&related=itsfoss&url=http://itsfoss.com/xenlism-wildfire-theme/) > > > 我希望你喜欢它。同时也希望你分享你对这个主题的看法,或者你喜欢的主题。Xenlism 真的很棒,可能会替换掉你最喜欢的主题。 --- via: <http://itsfoss.com/xenlism-wildfire-theme/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[MikeCoder](https://github.com/MikeCoder) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,380
为什么 Chrome 会说你的 SHA-2 证书链是“肯定不安全的”
https://sslmate.com/blog/post/chrome_cached_sha1_chains
2015-10-10T14:14:34
[ "SSL", "https" ]
https://linux.cn/article-6380-1.html
![](/data/attachment/album/201510/10/141423r5q1fzfkyfr8xxkk.png) 假如你已经完全配好了你的 SSL:使用了强加密算法、禁用了废弃的协议,而且你提供了 [100% SHA-2](http://googleonlinesecurity.blogspot.com/2014/09/gradually-sunsetting-sha-1.html) 的证书链。[SSL Labs](https://www.ssllabs.com/) 给了你一个 A+ 评分,[shaaaaaaaaaaaaa.com](https://shaaaaaaaaaaaaa.com/) 也没发现你使用了 SHA-1。但是,有些情况下,当你访问你的网站时,Chrome 仍旧会在 URL 栏处显示一个红叉,并且说你的网站提供了 SHA-1 证书,是“<ruby> 肯定不安全的 <rp> ( </rp> <rt> affirmatively insecure </rt> <rp> ) </rp></ruby>” 的: ![URL bar showing red cross through 'https'](/data/attachment/album/201510/10/141438xpfv69d65fxl7cfl.png) 这可能吗?不幸的是,有可能。你的服务器所发送的证书也许并不是你的浏览器所使用的。在迁移到 SHA-2 的过程中*不应该*是这样的,但是由于某些 CA 糟糕的做法和用户使用了老旧的软件,有时候会出现这样的问题。具体听我一一道来。 ### 背景知识:证书链如何工作 一个 SSL 证书必须被<ruby> 证书授权中心 <rp> ( </rp> <rt> certificate authority,CA </rt> <rp> ) </rp></ruby>签名才是可信的。在最简单的情况下,网站的证书(<ruby> 终端证书 <rp> ( </rp> <rt> end-entity certificate </rt> <rp> ) </rp></ruby>)是由浏览器所信任的 CA 的(<ruby> 根证书 <rp> ( </rp> <rt> root certificate </rt> <rp> ) </rp></ruby>)直接签名的。 ![](/data/attachment/album/201510/10/114416tcjicunz1vnncfjc.png) *简单 PKI: 终端证书由根证书直接签名* 浏览器校验直接由根证书签名的证书很简单:浏览器在它的根证书库里面查找终端证书的签发者,如果找到,就使用该根证书的公钥来校验终端证书的签名。 然而,终端证书很少会由根证书进行签名。相反的,终端证书是由一个“<ruby> 中间证书 <rp> ( </rp> <rt> intermediate certificate </rt> <rp> ) </rp></ruby>”(有时候也称之为<ruby> 下级 CA <rp> ( </rp> <rt> subordinate CA </rt> <rp> ) </rp></ruby>)进行签名的,而中间证书则由根证书进行签名。 ![](/data/attachment/album/201510/10/123450hrr1wg8h2dizzdcp.png) *典型的 PKI 是使用一个中间证书* 校验一个由中间证书签名的证书是困难的。浏览器不能简单地在它的根证书库中找到签发者,因为该证书并不是由根证书签名的。相反,浏览器需要找到签名该证书的中间证书,需要的话还得迭代这个过程(中间证书也许是由其它的中间证书签名的),直到沿着这个证书链找到根证书。而事实上更复杂,因为也许从终端证书到根证书有几种可能的链路。 让浏览器找到中间证书链的最简单的办法是,让服务器告诉它。这就是为什么[当你部署一个 SSL 证书时,不仅仅需要你自己的证书,还需要中间证书](https://whatsmychaincert.com/)。不过,浏览器通常会缓存中间证书,也许会使用一个缓存的证书而不是使用由你的服务器提供的证书。这就是为什么在你全部使用了 SHA-2 之后, Chrome 也许还会显示一个红叉的原因:它并没有使用你的证书链上提供的证书,而是使用了其所缓存的 SHA-1 的证书链。 理论上,这是可以避免的,如果 CA 可以正确操作、用户也运行最新的软件的话。不幸的是,现实并不总是这样,个别情况下已知导致这个问题的原因有两个。 (注意:澄清一下,生成证书链的并不是 Chrome ,而是 Chrome 交由操作系统的加密库构建证书链。加密库在 Windows 上是 CryptoAPI,Linux 上是 NSS。) ### 问题一:将 SHA-1 中间证书用 SHA-2 重用 当 CA 迁移到 SHA-2 时,它可以通过对已有的公钥用 SHA-2 重新签名,从而重用已有的中间证书,或者也可以生成一个带有新的公钥和<ruby> 主题名 <rp> ( </rp> <rt> subject name </rt> <rp> ) </rp></ruby>的新中间证书。 ![](/data/attachment/album/201510/10/125741pnne33nnv663goge.png) *两种新的 SHA-2 签名方式* 第一种方式是错误的。虽然 CA 可以用已有的中间证书使用 SHA-2 重新签名,但是浏览器也许会缓存着带有旧的 SHA-1 签名的中间证书。如上面解释的,浏览器可以忽略由服务器提供的链证书,即便服务器发送了带有新的 SHA-2 签名的中间证书,客户端依然会使用其所缓存的 SHA-1 中间证书来构建证书链。CryptoAPI 就是这样的。 ![](/data/attachment/album/201510/10/130338ufooj8o1q4jj14ot.png) *服务器发送了 SHA-2 证书,浏览器使用了缓存的 SHA-1 证书* 而第二个办法就避免了缓存证书链的问题。因为 CA 生成了一个新的中间证书,有新的名字和公钥,浏览器不可能有用 SHA-1 签名的旧版本。这就是为什么 [Ballot 118 在 CA/Browser Forum](https://cabforum.org/2014/10/16/ballot-118-sha-1-sunset/) 这样说: > > SHA-2 下级证书**绝不应该链**到 SHA-1 的 CA 下级证书上。 > > > 不幸的是,有些 CA 根本没在意这个忠告,比如某个 CA ,StartCom,[**仍然**使用 SHA-1 中间证书签发 SHA-2 终端证书](https://forum.startcom.org/viewtopic.php?f=15&t=15929&st=0&sk=t&sd=a)。虽然他们提供了一个 SHA-2 签名的中间证书,但是如果浏览器已经有一个缓存的 SHA-1 版本时就会有问题。 幸运的是,SSLMate 的两个 CA 都正确地从新的 SHA-2 中间证书签发证书,所以,SSLMate 的客户不需要担心这个。 ### 问题二:过期的 NSS 和交叉签名的根证书 有时候根证书自身也由其它的根证书签名,通常这称之为<ruby> 交叉签名 <rp> ( </rp> <rt> cross-signing </rt> <rp> ) </rp></ruby>。这提供了一个抵达可信根证书的另外一条路径,交叉签名可以让一个不在你的浏览器的可信证书库中的新根证书也可以工作。当浏览器开始信任一个根证书时,交叉签名的证书就不再需要了。然而,和中间证书一样,交叉签名的证书也是可以缓存的,而在 [NSS 中一个 bug](https://bugzilla.mozilla.org/show_bug.cgi?id=1112461) 会导致 Linux 上的 Chrome 使用缓存的交叉签名的根证书,即使有更短和更新的证书链存在。如果这个缓存的交叉签名证书正好使用 SHA-1,Chrome 就会使用这个有问题的证书链并显示一个红叉,而不管你的服务器是否发送了全都使用 SHA-2 的证书链。 ![](/data/attachment/album/201510/10/132911ly0nc0nsognjv90c.png) *NSS 使用缓存的交叉签名证书构建证书链* 这个 bug 在 [NSS 3.17.4](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_3.17.4_release_notes) 中修复,发布于1/28。不幸的是,Debian 更新 NSS 软件包非常缓慢。[这个 bug 在2014/12/30 就提交到了 Debian 的 bug tracker 上了](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774195),但是直到 5/13 都没在 Debian Unstable 中修复。同时,Debian Stable (Jessie)继续用着 NSS 3.17.2 。Debian 安全团队[排除](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774195#51)了会通过安全更新修复它,而且看起来包维护者也不像是会快速响应将这个修复加入到即将发布(本文写作时)的 Debian Stable 中。Ubuntu 则不同,[将此作为安全问题](https://bugs.launchpad.net/ubuntu/+source/nss/+bug/1423031),在 2/19 给其所有发行版发布了更新包。 不幸的是,CA 不能为使用过期 NSS 的用户做些什么。直到 Debian 为其稳定发行版发布更新的 NSS 包之前,Debian 上的 Chrome 用户会一直看到许多这样的红叉: ![URL bar showing red cross through 'https'](/data/attachment/album/201510/10/141438xpfv69d65fxl7cfl.png) 或者,如果证书在 2016 年失效的话是这样: ![URL bar for https://bugs.debian.org, with orange alert symbol](/data/attachment/album/201510/10/141438xs4sgac4sck9zn99.png) **更新:**由 SSLMate 的 Andrew Ayer 提供的 NSS 更新包,放到了 2015/9/5 发布的 Debian Jessie 8.2 中。
200
OK
[Why Chrome Thinks your SHA-2 Certificate Chain is "Affirmatively Insecure"](/blog/post/chrome_cached_sha1_chains) Let's say you're completely on top of your SSL configuration: you're using strong ciphers, disabling obsolete protocols, and in particular, you're serving a certificate chain that's [100% SHA-2](http://googleonlinesecurity.blogspot.com/2014/09/gradually-sunsetting-sha-1.html). [SSL Labs](https://www.ssllabs.com/) gives you an A+ and [shaaaaaaaaaaaaa.com](https://shaaaaaaaaaaaaa.com/) shows no trace of SHA-1. Yet, for some reason, Chrome is displaying a red cross in your URL bar when you visit your site, suggesting your site is "affirmatively insecure" for serving a SHA-1 certificate: Could this be possible? Unfortunately so. The certificates that your server sends might not be the certificates that your browser uses. This *shouldn't* be an issue when migrating to SHA-2, but due to bad practices by some certificate authorities and users running out-of-date software, it sometimes is. Read on to learn more. #### Background: how certificate chains work An SSL certificate must be signed by a certificate authority (CA) to be trusted. In the simplest case, a website's certificate (the "end-entity" certificate) is signed directly by a CA that is trusted by web browsers (a so-called "root" certificate). It's straightforward for a web browser to validate a certificate that's signed directly by a root: the browser looks up the end-entity certificate's issuer in its root certificate store, and if found, it validates the signature of the end-entity certificate using the public key of the root certificate. However, end-entity certificates are rarely signed directly by a root certificate. Instead, end-entity certificates are signed by an "intermediate" certificate (sometimes called a "subordinate CA"), which is in turn signed by a root: Validating a certificate signed by an intermediate is tricky. A browser can't simply look up the issuer in its root store, since the certificate isn't signed by a root. Instead, the browser must find the intermediate certificate that signed the certificate, recurring as necessary (intermediates may be signed by other intermediates) until it has constructed a chain of certificates that ends at a root certificate. This is actually rather complicated, because there may be more than one possible chain from an end-entity certificate to a root. The most basic way that browsers discover an intermediate certificate chain is by having the server tell them. This is why, [when you deploy an SSL certificate, you have to configure not only your own certificate, but also the intermediate certificates](https://whatsmychaincert.com/). However, browsers often cache intermediate certificates, and might use a cached certificate instead of the one offered by the server. This is why Chrome might show a red cross even when the chain you serve is entirely SHA-2: it's not using your chain, but a cached chain which uses SHA-1. In theory, this is avoidable, if CAs follow best practices and users run up-to-date software. Unfortunately, this isn't always the case, and there are two situations in particular that are known to cause issues. (Note: to be precise, it's not Chrome that generates the chain, but the operating system's cryptographic library, to which Chrome outsources chain building. On Windows, it's CryptoAPI, and on Linux, NSS.) #### Issue 1: Reusing a SHA-1 intermediate for SHA-2 When a certificate authority transitions to SHA-2, it can either reuse its existing intermediate certificates by re-signing the existing public keys with SHA-2 signatures, or it can generate brand new intermediate certificates with new public keys and subject names. The first way is wrong. Although a CA can take an existing intermediate and re-sign it with SHA-2, browsers might have the intermediate cached with the old SHA-1 signature. As explained above, browsers can ignore the chain presented by the server, so even if the server sends the intermediate with the new SHA-2 signature, the client may construct the chain using the cached SHA-1 intermediate certificate instead. This is exactly what CryptoAPI does. The second way avoids all problems with cached chains. Since the CA generates a brand new intermediate, with a new name and public key, browsers can't possibly have old versions cached with SHA-1 signatures. This is why [Ballot 118 from the CA/Browser Forum](https://cabforum.org/2014/10/16/ballot-118-sha-1-sunset/) states: SHA-2 Subscriber certificates SHOULD NOT chain up to a SHA-1 Subordinate CA Certificate. Unfortunately, some CAs ignored this advice at first, and one CA, StartCom, [is still issuing SHA-2 end-entity certificates that are signed by a SHA-1 intermediate](https://forum.startcom.org/viewtopic.php?f=15&t=15929&st=0&sk=t&sd=a). While they provide a version of the intermediate signed with SHA-2, it does no good if a browser already has the SHA-1 version cached. Fortunately, both of SSLMate's CAs correctly issue certificates from a brand new SHA-2 intermediate, so SSLMate customers need not worry about this issue. #### Issue 2: Out-of-date NSS and cross-signed roots Sometimes root certificates are themselves signed by other roots, a practice known as cross-signing. By providing an alternative path to a trusted root, cross-signing allows new roots to work in browsers that don't yet have the root in their trust store. Once browsers start trusting a root, the cross-signed certificate is no longer necessary. However, as with other intermediate certificates, cross-signed certificates can be cached, and a [bug in NSS](https://bugzilla.mozilla.org/show_bug.cgi?id=1112461) caused Chrome on Linux to use cached cross-signed roots even when a shorter and newer chain existed. If the cached cross-signed certificate happened to use SHA-1, Chrome would consider the chain weak and display the red cross, even if the chain sent by the server was entirely SHA-2. This bug has been fixed as of [NSS 3.17.4](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_3.17.4_release_notes), released on January 28. Unfortunately, Debian has been extremely sluggish in shipping an updated NSS package. A [bug was filed in Debian's bug tracker on December 30, 2014](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774195), but wasn't fixed in Debian Unstable until May 13. Meanwhile, Debian Stable (Jessie) continues to ship NSS 3.17.2. The Debian Security Team has [ruled out](https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=774195#51) fixing this through a security update, and it doesn't look like the package maintainer will respond quickly enough to get the fix into the upcoming point release of Debian Stable. Ubuntu, by contrast, [treated this as a security issue](https://bugs.launchpad.net/ubuntu/+source/nss/+bug/1423031) and released updated packages for all their distributions on February 19. Unfortunately, there's nothing certificate authorities can do about users with out-of-date versions of NSS. Until Debian releases an updated NSS package for their stable distribution, users of Chrome on Debian are going to see a lot of this: Or, if the certificate expires in 2016: **Update:** An updated NSS package, prepared by Andrew Ayer from SSLMate, shipped with the Debian Jessie 8.2 point release on September 5th, 2015!
6,384
自由软件基金会(FSF)30年
http://opensource.com/business/15/9/free-software-foundation-30-years
2015-10-11T09:00:00
[ "FSF", "开源" ]
https://linux.cn/article-6384-1.html
![](/data/attachment/album/201510/11/110735vct45wwwk4vvwkzz.png) 欢迎回到全新的 Six Degrees 专栏。和往常一样,请把你对此文的想法发到意见箱,把对专栏将来建设的建议发送到我的收件箱。 现在我坦诚的讲,这个专栏的走向和预期有些不同。 几周前当我思考要写些什么的时候,我详尽研究了<ruby> <a href="http://www.fsf.org/"> 自由软件基金会 </a> <rp> ( </rp> <rt> Free Software Foundation </rt> <rp> ) </rp></ruby><ruby> <rp> ) </rp></ruby>的30周年庆和它在当今计算机世界的相关影响。 为了给这个话题添些料,我想我应当采访一下 [John Sullivan](http://twitter.com/johns_fsf/),他是自由软件基金会(FSF)的首席执行官。我的计划和想法很典型,写一些叙述性的事实,然后插入采访片段以充实内容。而后,我收到了 John 发给我的一篇极具细节、内容丰富的采访稿,然后我最初的想法被全部抛到九霄云外。我决定把这篇稿子全篇呈现作为主线,再加入一些注释性的评论。所以这篇专栏会看起来很长,但我想它为这本极具观赏里的杂志增添了迷人的色彩。我建议你倒杯茶或者咖啡,然后坐下来细细品味。 ### 时光变幻 自由软件基金会成立于1985年。让我来描绘一下那时的计算机世界,[Amiga 1000](https://en.wikipedia.org/wiki/Amiga_1000)计算机已经问世,C++ 成为了那时主宰计算机的编程语言,[Aldus 的 PageMaker](https://en.wikipedia.org/wiki/Adobe_PageMaker) 刚刚发布,计算机网络开始萌芽。同一年,Wham! 的 [Careless Whisper](https://www.youtube.com/watch?v=izGwDsrQ1eQ) 风靡各地。 30年的时间世事大变。回到1985年其时,FSF 重点关注于主要给那些计算机高手们用的自由软件。而现在我们有了软件、服务、社交网络和很多很多。 我首先了解一下 John 认为会影响到现今的软件自由的突出问题的哪些。 “我认为电脑用户的自由所面临的巨大风险已经得到广泛的共识,只是也许说法不同。” “第一点是我们所谓的‘微型计算机无处不在’。在这一点上自由软件基金会算是成功的,因为完全自由的操作系统可在笔记本电脑、台式电脑和服务器上运行所有商用系统所能运行的一切。也许还有些需要修补,但它们最终可以解决。然后的挑战是我们如何越过上亿美金的市场和与我们针锋相对的法律制度,把这些系统交付于用户手中。” “然而,一个很严重的问题是那些以体积小为基本特征的计算机设备——即便目前汽车的体积并不算小,但其内置的计算机还是很小的——此类型计算机设备,与手机、平板电脑、智能眼镜、智能手表等都在此讨论之列,这些计算机设备通常都以自由软件为基础,比如说,使用 Linux 内核和一些自由软件,例如安卓或者 GNU,它们的主要作用是运行专有软件和服务支撑,由用户无法控制的远程服务器替代本地计算机完成处理。这些设备服务于关键功能,一些对大众通讯至关重要,还有一些就在我们身边发挥实际作用,另外一些则关系到我们的人身安全,这些软件应该运行在自由软件之上、完全掌控在用户自己手中。而现如今,尚还不是这样。” John 觉得危险并不仅仅是平台或形式,而是整合它们所运行的后台服务。 “我们面临的第二大威胁是这许多设备所涉及的服务。如果我们日常工作和休闲应用都运行于我们毫无掌控的服务上的话,那么转而使用自由软件则是有益无害。使用自由软件的关键在于,我们可以直接查看、修改和共享代码。这种自由相当于提供了一层保护膜,即便非技术人员也可以防止自己受制于人。而这种自由是 Facebook、Salesforce 或者 Google Docs 的使用者所感受不到的。更让人揪心的事,有种趋势就是人们为了享受到某些服务,似乎适应了安装于本地电脑的专有软件所带来的羁绊。浏览器,包含 Firefox,现如今都会自动安装一个 DRM 插件,从而方便 Netflix 及其他一些视频巨头的运作。我们需要更加努力的开发去中心化的自由软件来替换媒介分发,这样才可以真正的让用户、艺术家、或者用户艺术家有自主权,其他服务也一样。对于 Facebook 我们有 GNU social,[pump.io](http://pump.io/),Diaspora,Movim 和其它的一些,对 Salesforce 我们有 CiviCRM,对 Google Docs 我们有 Etherpad,对于媒体软件我们有 GNU MediaGoblin。但这所有的项目都需要帮助,而且还有许多服务我们尚没有可替换的竞争软件” 有趣的是,John 提到的关于找到如今常见应用软件和服务的替换。FSF 在维护着一个“高优先级项目”列表,设计用来弥补这些缺失。不幸的是这些项目的能力大相径庭,而我们又处于一个社交媒介所主宰的时代,软件只是问题的一部分,而真正的挑战是如何让人们知道并使用它们。这一切都取决于 FSF 如何适应当今的计算机世界。我本人是 FSF 粉丝,我认为他们所做的努力都非常有价值,我也在经济上支持它。他们是一个建立开放计算机环境的重要组织,但所有组织都需要成长、协调、调整,尤其是科技领域的。 我更希望了解关于 FSF 如今的作为与创建之初的不同。 “我们现在的听众相对于30年前有了很大增长,也扩大了受众领域。现在不止是只有黑客,或者程序员和研究人员需要了解自由软件,每一个使用计算机的人都需要,而如今几乎人人都拥有计算机” John 继续提供了关于这些努力方向的一些例子。 “我们针对自由软件运动的问题在协办一些公众倡议活动,早先,在这些事情上我们都会发表意见,然后酌情采取行动,但在过去的十年我们着意于制定规范和采取一系列活动。我们在一些领域获得了重大成就,比如 Design 的防缺陷数码限制管理(DRM),这当初曾让 iTunes 音乐下架(当然现在 Apple 已经将 DRM 应用于 Apple 音乐)。我们创建了对于自由软件的新用户有吸引力和实用的介绍资料,比如我们的[用户解放的动画视频](http://fsf.org/)和[电子邮件自防卫指南](http://emailselfdefense.fsf.org/)。 我们还推崇[尊重用户自由](http://fsf.org/ryf)的硬件。已经得到 FSF 认证的硬件提供商被要求只包含自由软件才可显示其认证。扩大自由软件用户量和自由软件运动分为两部分:获取人们的关心,然后使其行动成为可能。在创始期,我们鼓励生产商和零售商做同样的事情,让已经开始关注自由软件的用户轻松的买其所用,从而避免做决定前所采取的大量调查。我们已经通过认证了一种家庭 Wifi 路由器、3D 打印机、手提电脑和 USB 无线适配器,将来还会有更多。 我们收集了[自由软件目录](http://directory.fsf.org/)中能找到的所有自由软件,我们还有很长的路要走 —— 如今我们只有 15,500 个软件包,而我们可以预知到关于它们的设计和功能改进将要付出的努力 —— 但是我认为这个资源对于协助用户找到他们需要的自由软件有重大潜力,尤其是那些尚未使用完全 GNU/Linux 系统的用户。面对从网络下载未知程序的潜在危险,我们绝对需要这么一个清单。它还将成为用于用户研究的机器可识别的数据资源。 我们目前为几个特殊的软件项目扮演着经济资助者的角色,为它们募集资金来开发。它们中的大多数是 GNU 的组成部分(我们在持续提供着各种底层支持),但我们还资助着 [Replicant](http://www.replicant.us/),一个最大限度的提供用户自由的完全自由的安卓设计。 我们还帮助开发人员正确的使用自由软件许可证,我们还在持续跟进投诉不遵循 GPL 协议的公司。我们帮助他们纠正问题而后重新部署。RMS 曾是 GPL 的先驱,但如今是我们在继续着这项工作。 FSF 现在所做的一些事情是30年前所没有的,当然从最初的企划到如今有了一些变化 —— 我们的目标是创建一个用户能在任何计算机上使用自由软件完成一切的世界,一个绝无第二人而是用户自己完全掌控其个人电脑的世界。” ### 个人崇拜 每个人心中都会对 FSF 可能带来的价值存有疑惑,正如 John 所提到的,我们的努力不仅涵盖了自由软件的开发和许可,还有认知、证实和鼓吹一种技术自由文化。 FSF 的老大是无可替代的 Richard M. Stallman,我们都称呼他为 RMS。 RMS 拥有好奇的性格,他对于自己的主意、哲学思考和对软件自由的道德推崇都有不可思议的表现。 他偶尔会在网上自嘲其社交上的拙劣,相对于他演讲中所提之事,比如他蹩脚的旅行行头,或者其他囧事,他对于软件自由的见解则是坚定不移。他作为一个严谨的思考者对于软件自由拥有着超凡的信仰,不仅仅是如何实现自己的构想,还有针对他所领衔的活动的广泛思考。我唯一想批评的就是他偶尔在措辞上展现的诸如多加一个鸡蛋在布丁上的贪婪,但是,考虑到他对于当今世界的重要性,我宁愿多加一个鸡蛋在布丁上,也不想让布丁不足以满足每个人的需要,好吧,关于这个布丁的事情有些小题大做了。 所以说 RMS 是 FSF 的重要部分,但组织重要性则更重要。我们有雇员、董事和其他的捐助者。我很好奇 RMS 在当今的 FSF 扮演了一个什么角色。John 对我分享了他的观点。 “RMS 是 FSF 总裁,但从未自 FSF 拿过一分钱报酬。他拥护自由软件和计算机用户自由,并且满日程持续着每年20多个国家的巡回讲演。他联系社会运动,接受政要和各地区积极团体的接见,他还为 FSF 募集资金,鼓励人们做志愿者。” “在各种忙碌间歇,他对于软件自由运动中存在的问题做进一步思考,并且直面新的挑战。经常这样的举措都会有新的文章发布,今年初他为 Wired 写了关于自由软件和自由硬件设计的三篇文章,或通过与 FSF 员工交流讨论从而摸索将来项目的发展。” 既然我们讨论到了个人崇拜,我想针对 John 关于软件自由运动的发展宏图略谈一二。 我记得在<ruby> <a href="http://www.osthinktank.com/"> 开源智囊团 </a> <rp> ( </rp> <rt> Open Source Think Tank </rt> <rp> ) </rp></ruby>(一个聚集了各个开源组织的执行者的大会)上曾有一个关于在座人员推荐任意项目许可证的用例分析,大多数重要组织都推荐了Apache 软件许可(APL),而非 GNU 公众许可证(GPL)。 这让我记忆犹新,因为我也曾注意到许多公司看起来都选择了 GPL 之外的其他开源许可,我很好奇是否 John 也注意到了这个 与 GPL 相斥的 APL 的发展趋势。 “是这样子吗?我不清楚。几年前我为 FOSDEM 做了一个名为‘<ruby> 版权被陷害了吗? <rp> ( </rp> <rt> Is Copyleft Being Framed? </rt> <rp> ) </rp></ruby>’的专题,它揭示了一些有据可依的许可证接纳背后的问题,我也将很快为此发表一篇文章,在此列出了一些主要论点: * 自由软件的协议许可证的选择并不是空中楼阁。人们选择专有软件许可证也需要考虑各种后果,我发现人们更多是在宽松的许可证(如 APL 或三句版 BSD 许可证)与专有软件许可证之间做权衡,而不是 GPL。 * 令人感到讽刺的是,统计软件许可证的人通常不会把他们收集数据的软件以自由软件发布,这意味着我们无法研究它所使用的方法或重现其统计数据。一些人现在开始发布其使用的源代码,当然这不应该完全忽视。科学是讲究方法的。 * 按什么统计许可证?我们真的要将以 APL 发布的一个发出有趣声音的 App 和 GPLv3 下的 GNU Emacs 视同1:1吗?如果不是,我们如何计算同等?我们只计算有功能的软件吗?我们确定没有两倍或三倍计算那些在多宿主服务器上的应用吗?那么不同操作系统之间的移植呢? 每个问题都值得推敲,但每个结论在我看来都距事实很远。我宁愿给程序员做一个调查关于为什么他们在项目中直接选择那些特定的软件许可证,而不是尝试编程去探明程序的许可证的真相,然后把自己的臆想揉入这些数据中。 Copyleft 如它既往一般依旧必不可少,带许可证的软件仍是自由软件,这怎么说都是件好事,但它需要强有力的社会认可不要将其纳入到专有软件。如果自由软件主要的长期影响是让企业能够更有效地开发制约我们的产品的话,那么我们对计算机用户自由的贡献就微乎其微了。” ### 直面挑战 30年对于大多数组织都不算短,尤其是对于那些有重大目标又横跨各行业、专业、政府和文化的组织。 当我准备结束这次访问时,我希望自己对30岁的 FSF 现如今的发展有一个更好的理解。 “我想 FSF 现在处于一个非常有趣的位置,它同时做为一个坚硬的磐石和一个推动潮流的推动力。” “我们有核心文档比如 [Free Software Definition](http://www.fsf.org/about/what-is-free-software) 和 [GNU General Public License](http://www.gnu.org/licenses/gpl-3.0.en.html) ,还有[我们维护的自由和非自由软件的许可证列表](http://www.gnu.org/licenses/licenses.en.html),这是创建我们当今的自由软件世界的顶梁柱。人们非常信任这些文档中陈述的原则,在他们的新产品和将来的实践中正确明智的使用它们。从这个角色来说,我们为用户的成长架设了云梯。就好比 501(c)在法律层面为公益提供了保障,使得85%的资金募集自个人,我们也有如斯的运营架构。” “但我们还在推进改革,我们接受别人所认为的艰巨的挑战,我认为那说明了我们作为梯子的作用?或者我不应当用这种比喻的说法。” John可能不善于打比方(我看起来也是),FSF 着实是善于创始大事件,并且实践于任务的推进。而这一使命始于自由软件应该无处不在的信仰。 “我们并不满足于在笔记本上除了极少数组件外全部运行着自由软件,也并不满足于一个平板电脑多数运行着自由软件,而只用专有软件连接网络、加速视频加载,或照相、查询航班、使用Uber...好吧,我们对于这样的发展也是欣慰的,但对于仍要取悦其它软件却并非我们所希望的。因为系统上安装的任何一个专有软件,对于用户都既不公正,也在未来埋下了安全隐患。这些近乎自由的一切是步入自由世界的踏脚石,但这需要我们的脚步永不停歇。” “在 FSF 早些年,我们事实上一直致力于开发一个完全自由的操作系统。这现在已经被 GNU 和 Linux 和一些合作伙伴实现了,尽管总有新的软件要开发,总有缺陷要被处理。所以当 FSF 仍在某些领域资助自由软件开发时,令人欣喜的是很多其他组织也在做着同样的努力。” 面临的挑战中还有关键的一块,John 提到,就是让正确的人群掌控正确的硬件。 “我们目前专注于我上面提到的第一个问题的推进。对于一些特别应用,我们急需一些硬件来支持自由软件的运行。在 FSF 我们基本尝试了我们能尝试做的一切,我期待一方面对我们进行中的项目提供更多的支持,另一方面通过我们的<ruby> 尊重你的自由 <rp> ( </rp> <rt> Respects Your Freedom </rt> <rp> ) </rp></ruby>认证活动得以对项目进行扩展,从而开发出一些我们自己的项目。同样的问题存在于网络服务问题。我想我们需要把它们综合处理,因为对手机组件的完全掌控很可能会改变服务需求,而服务的分散也将更好的使手机组件化。” “我希望人们能一直支持 FSF 的工作,尤其是当我们所面临的这些挑战的时候。制造提供可用的、分散而关联的替代网络服务的硬件是昂贵而复杂的。我们需要很多资源和有创造力的人们。但是,这在30年前,我们还只是一个围绕在 RMS 身边和以Copyleft 理念开发整个操作系统的社区。我过去的12年时间留给了 FSF,因为我坚信我们总会直面新的挑战。” ### 写在最后 在阅读 John 对于我的提问所做出的回答,和认识一些 FSF 的成员时,我有一个深切的感受,这是一个活力十足的社区。这绝非一个无聊的组织,也没有愧对其使命,其激情和承诺一如既往的旺盛。 当然我也不总是赞同 FSF,甚至有时我觉得它所用的方法太过执拗,但我将一如既往的做它死忠粉来支持它的工作。FSF 还代表了相当一部分自由软件和全球开展的开源工作的道德水准。它代表了一种很难舍弃的世界观,我相信它的热情和信条帮助人们从著作权接近了著佐权(双关语,further to the right a little closer to the left too。right/copyright 和 left/copyleft 分别代表左右和著作权/著佐权 )。 当然,RMS 有些古怪,有还有些强硬,一点敏感,但它却是一个包容整合了技术、伦理和文化的运动的坚定的领导者。我们需要一个 RMS ,从某种程度讲就如我们需要 Torvalds、Shuttleworth、Whitehurst 和 Zemlin 一样。这些不同的人将各种远见整合,并将技术灵活分配运用于各种不同个例、道德准则和前景发展。 所以,在完成这次采访的时候,我想借此机会感谢 FSF 所做出的巨大贡献,我希望 FSF 和它的勇往直前的领导者们,Richard M. Stallman 和 John Sullivan,在未来的30年有更长足的发展。加油! *此文章为Jono Bacon的Six Degrees专栏的一部分,此专栏用来分享他关于文化,交流和开源新趋势的想法和见解。*
301
Moved Permanently
null
6,387
Debian 拋弃 Linux 标准规范(LSB)
https://lwn.net/Articles/658809/
2015-10-12T10:31:00
[ "LSB", "Debian" ]
https://linux.cn/article-6387-1.html
<ruby> Linux 标准规范 <rp> ( </rp> <rt> LSB,Linux Standard Base </rt> <rp> ) </rp></ruby>是一个意图定义 Linux 发行版为第三方程序所提供的服务和应用层<ruby> 程序二进制接口 <rp> ( </rp> <rt> ABI,Application Binary Interfaces </rt> <rp> ) </rp></ruby> 的[规范](http://refspecs.linuxfoundation.org/lsb.shtml)。但 Debian 项目内的某些人正在质疑是否值得维持兼容 LSB,他们认为,该项工作的工作量巨大,但好处有限。 ![](/data/attachment/album/201510/12/103118rdprw2lwcf2f7hxp.jpg) LSB 于2001年首次公布,其模型建立在 [POSIX](https://en.wikipedia.org/wiki/POSIX) 和<ruby> <a href="https://en.wikipedia.org/wiki/Single_UNIX_Specification"> 单一 UNIX 规范 </a> <rp> ( </rp> <rt> Single UNIX Specification </rt> <rp> ) </rp></ruby>的基础之上。目前,LSB 由 Linux 基金会的一个[工作小组](http://www.linuxfoundation.org/collaborate/workgroups/lsb)维护。最新的版本是于2015年6月发布的 [LSB 5.0](http://www.linuxfoundation.org/collaborate/workgroups/lsb/lsb-50)。它定义了五个 LSB 模块(<ruby> 核芯 <rp> ( </rp> <rt> core </rt> <rp> ) </rp></ruby>、桌面、语言、<ruby> 成像 <rp> ( </rp> <rt> imaging </rt> <rp> ) </rp></ruby>和试用)。 每个模块都包含了一系列所需的库及其强制性版本,外加对每个库的公共函数和数据定义的描述。这些模块还包括命名和组织规范,如<ruby> <a href="http://www.linuxfoundation.org/collaborate/workgroups/lsb/fhs"> 文件系统层次标准 </a> <rp> ( </rp> <rt> FHS,Filesystem Hierarchy Standard </rt> <rp> ) </rp></ruby>中的文件系统布局或象 Freedesktop 的<ruby> <a href="http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html"> XDG 基础目录 </a> <rp> ( </rp> <rt> XDG Base Directory </rt> <rp> ) </rp></ruby>规范这样的目录规范。 似乎只是一个巧合,就在 LSB 5.0 发布的同一周,Debian 项目内部针对其是否值得保持兼容 LSB 进行了一次讨论。在另一个贴子中,在提及兼容 LSB 后,Didier Raboud 顺势[提议](https://lwn.net/Articles/658838/)将 Debian 的兼容工作维持在最低水平。他说,目前的情况是,Debian 的“lsb-\*” <ruby> 元包 <rp> ( </rp> <rt> meta-packages </rt> <rp> ) </rp></ruby>试图规定该标准中提及的库的正确版本,但事实上却没有人去检查所有的符号和数据定义是否满足要求。 另外,LSB 还不断在膨胀;他说, LSB 4.1 版(接近 Debian “jessie” 发布时的最新版本)包含“**1493个组件、1672个库、38491条命令、30176个类和716202个接口**”。似乎没有人有兴趣检查 Debian 包中的这些细节,他解释道,又补充说,“**去年在 DebConf 上我举行过一次 LSB BoF,后来又与很多人讨论过 src:lsb,我收回自己的‘几乎没有人在意’的说法**”。但,重要的是,Debian 似乎并不仅局限于兴趣的缺乏: ``` 我认为,这个问题的关键在于是否值得去玩这整个游戏:我还没听说有哪个软件通过 LSB 包来发行。LSB 认证的应用清单上只有 6个公司的_8_个应用,其中仅有一个是针对不低于 LSB 4 的。 ``` Raboud 提议 Debian 摈弃除了 [lsb-base](https://packages.debian.org/sid/lsb-base) 包(目前包括一个用于启动系统所需的小的 shell 函数集合)和 [lsb-release](https://packages.debian.org/sid/lsb-release) 包(提供一个简单工具,用户可用它查询发行版的身份以及该发行版宣称的与哪个 LSB 级别兼容)之外的所有内容。 [后来](https://lwn.net/Articles/658842/),他又称,将 LSB 基本上改变为“**Debian 和 FLOSS 世界中的所有的其它人所实际做的任何事**”可能会使得该标准(以及在 Debian 为支持它所做的工作)更有价值。但此时他再次质疑是否有人会对推动这个目标有兴趣。 如果说他最初称 LSB 中缺乏兴趣没有足够的证据,随后整整三个月之内没有任何人对维持 LSB 兼容的包提供支持,并进行了两次拋弃它们的投票。最后,9月17日,Raboud [宣布](https://lwn.net/Articles/658843/)他已经抽掉 `src:lsb` 包(如前所述,保留了`lsb-base` 和 `lsb-release`),将将其上载到 “unstable” 归档中。这个最小的工具集可以让感兴趣的用户在启动了下一个 Debian 版本后查询它是否兼容 LSB:结果将为“否”。 Raboud 补充说,即便摈弃了兼容 LSB,Debian 仍计划继续兼容 FHS: ``` 但 Debian 并没有放弃所有的 LSB:我们仍将严格遵守 FHS(直到 Debian Policy 版本 2.3;虽然今年8月已经发布了3.0),而且我们的 SysV 启动脚本几乎全部遵循 VIII.22.{2-8}。但请不要误解,此次 src:lsb 上载明确说明我们将离开 LSB。 ``` 在该宣告之后,Nikolaus Rath [回应](https://lwn.net/Articles/658846/)称某些私有应用依赖`/lib`和`/lib64`中的符号链接`ld-lsb.so*`,而这些符号链接由`lsb-*`包提供。Raboud 则[建议](https://lwn.net/Articles/658847/)应改由`libc6`包提供;该包维护人员Aurelien Jarno [称](https://lwn.net/Articles/658848/),如果提供这样一个补丁,他将会接受它。 似乎唯一的遗留问题只是某些打印机驱动包会依赖 LSB 兼容。Raboud 称,在其首个贴子中已经说明,据他所知,实际发布的唯一一个依赖 LSB 兼容的包为 [OpenPrinting](http://www.linuxfoundation.org/collaborate/workgroups/openprinting/) 驱动程序。Michael Biebl [称](https://lwn.net/Articles/658844/),主归档中有这样一个驱动包;Raboud 则[回应](https://lwn.net/Articles/658845/)说,他认为这个有问题的包应该被移到非自由仓库,因其包括了一个二进制驱动。 于是,这个问题看上去已经尘埃落定,至少对于目前的 Debian 开发周期来说是如此的状况。很自然的是,未来让人更感兴趣的是,如果该决定存在一些影响的话,那么人们将会看到它对更广泛的 LSB 接受度有何影响。正如 Raboud 所说的那样,被认证为 LSB 兼容的发行版数量很[少](https://www.linuxbase.org/lsb-cert/productdir.php?by_lsb)。人们很难不会注意到这些发行版很大程度上是“企业”的变种。 也许,对某些商业领域来说,LSB 仍很重要,但很难知道有多少那些企业发行版的客户真正关心 LSB 认证标签。然而,如果 Debian 的经验靠得住的话,对这种认证的一般兴趣可能会急剧下降。 --- via:<https://lwn.net/Articles/658809/> 作者:Nathan Willis 译者:[Yuking](https://github.com/Yuking-net) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译, [Linux中国](https://linux.cn/) 荣誉推出
200
OK
# Debian dropping the Linux Standard Base LWN.net needs you!Without subscribers, LWN would simply not exist. Please consider [signing up for a subscription]and helping to keep LWN publishing. The Linux Standard Base (LSB) is a [specification](http://refspecs.linuxfoundation.org/lsb.shtml) that purports to define the services and application-level ABIs that a Linux distribution will provide for use by third-party programs. But some in the Debian project are questioning the value of maintaining LSB compliance—it has become, they say, a considerable amount of work for little measurable benefit. The LSB was first released in 2001, and was modeled to a degree on the [POSIX](https://en.wikipedia.org/wiki/POSIX) and [Single UNIX Specification](https://en.wikipedia.org/wiki/Single_UNIX_Specification) standards. Today, the LSB is maintained by a [working group](http://www.linuxfoundation.org/collaborate/workgroups/lsb) at the Linux Foundation. The most recent release was [LSB 5.0](http://www.linuxfoundation.org/collaborate/workgroups/lsb/lsb-50) in June 2015. It defines five LSB modules (Core, Desktop, Languages, Imaging, and Trial Use). The bulk of each module consists of a list of required libraries and the mandatory version for each, plus a description of the public functions and data definitions for each library. Other contents of the modules include naming and organizational specifications, such as the filesystem layout in the [Filesystem Hierarchy Standard](http://www.linuxfoundation.org/collaborate/workgroups/lsb/fhs) (FHS) or directory specifications like the Freedesktop [XDG Base Directory](http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html) specification. In what appears to be sheer coincidence, during the same week that LSB 5.0 was released, a discussion arose within the Debian project as to whether or not maintaining LSB compliance was a worthwhile pursuit for Debian. After LSB compliance was mentioned in passing in another thread, Didier Raboud took the opportunity to [propose](/Articles/658838/) scaling back Debian's compliance efforts to the bare minimum. As it stands today, he said, Debian's `lsb-*` meta-packages attempt to require the correct versions of the libraries mentioned in the standard, but no one is actually checking that all of the symbols and data definitions are met as a result. Furthermore, the LSB continues to grow; the 4.1 release (the most recent when Debian "jessie" was released) consisted of " Raboud proposed that Debian drop everything except for the 1493 components, 1672 libs, 38491 commands, 30176 classes and 716202 interfaces ", he said. No one seems interested in checking those details in the Debian packages, he noted, adding that " I've held an LSB BoF last year at DebConf, and discussed src:lsb with various people back then, and what I took back was 'roughly no one cares'. " Just as importantly, though, the lack of interest does not seem to be limited to Debian: [ lsb-base](https://packages.debian.org/sid/lsb-base) package (which currently includes a small set of shell functions for use by the init system) and the [package (which provides a simple tool that users can use to query the identity of the distribution and what level of LSB compliance it advertises).](https://packages.debian.org/sid/lsb-release) `lsb-release`In a follow-up [message](/Articles/658842/), he noted that changing the LSB to be, essentially, "whatever Debian as well as all other actors in the FLOSS world are _actually _doing " might make the standard—and the effort to support it in Debian—more valuable. But here again, he questioned whether anyone was interested in pursuing that objective. If his initial comments about lack of interest in LSB were not evidence enough, a full three months then went by with no one offering any support for maintaining the LSB-compliance packages and two terse votes in favor of dropping them. Consequently, on September 17, Raboud [announced](/Articles/658843/) that he had gutted the `src:lsb` package (leaving just `lsb-base` and `lsb-release` as described) and uploaded it to the "unstable" archive. That minimalist set of tools will allow an interested user to start up the next Debian release and query whether or not it is LSB-compliant—and the answer will be "no." Raboud added that Debian does still plan to maintain FHS compliance, even though it is dropping LSB compliance: After the announcement, Nikolaus Rath [replied](/Articles/658846/) that some proprietary applications expect `ld-lsb.so*` symbolic links to be present in `/lib` and `/lib64`, and that those symbolic links had been provided by the `lsb-*` package set. Raboud [suggested](/Articles/658847/) that the links should be provided by the `libc6` package instead; package maintainer Aurelien Jarno [said](/Articles/658848/) he would accept such a patch if it was provided. The only remaining wrinkle, it seems, is that there are some printer-driver packages that expect some measure of LSB compliance. Raboud had noted in his first message that [OpenPrinting](http://www.linuxfoundation.org/collaborate/workgroups/openprinting/) drivers were the only example of LSB-compliant packages he had seen actually distributed. Michael Biebl [noted](/Articles/658844/) that there was one such driver package in the main archive; Raboud [replied](/Articles/658845/) that he believed the package in question ought to be moved to the non-free repository anyway, since it contained a binary driver. With that, the issue appears to be settled, at least for the current Debian development cycle. What will be more interesting, naturally, will be to see what effect, if any, the decision has on broader LSB acceptance. As Raboud alluded to, the number of distributions that are certified as LSB-compliant is [small](https://www.linuxbase.org/lsb-cert/productdir.php?by_lsb). It is hard not to notice that those distributions are largely of the "enterprise" variety. Perhaps, then, LSB compliance is still important to some business sectors, but it is hard to know how many customers of those enterprise distributions genuinely care about the LSB certification stamp. If Debian's experience is anything to go by, however, general interest in such certification may be in steep decline. Posted Oct 1, 2015 8:12 UTC (Thu) by Posted Oct 1, 2015 8:45 UTC (Thu) by Posted Oct 1, 2015 10:14 UTC (Thu) by Posted Oct 2, 2015 9:34 UTC (Fri) by Posted Oct 8, 2015 14:58 UTC (Thu) by Posted Oct 9, 2015 3:29 UTC (Fri) by Short list of Oracle's Sun acquisitions and what's happened since: So, of those six OSS projects, Oracle has managed to alienate the communities of three and unsuccessfully attempted to outright kill one. Good job, Oracle. Oracle OSS is dying. Java and VirtualBox are all that remains. Red ink flows like a river of blood ;) But, Java and VirtualBox are probably still around because Oracle pays most of the developers. So, if we want those projects to be better governed, someone will need to step forward to hire those guys away or hire new guys to replace them. Java is likely recognized as "too big to fail" by Oracle, so their funding is why they're in control, and VirtualBox is probably just basically on ice and no one has cared enough to fork it yet. Both of those situations could change in time -- but, without some catalyst, probably won't change any time soon. Posted Oct 9, 2015 15:43 UTC (Fri) by The fact that the standards process still involves Oracle in any significant fashion I think is largely a red herring, if OpenJDK decided to deviate from Oracle I suspect most developers would go with it and abandon Oracle JDK. The only really troubling part there is the recent court case between Google and Oracle over the copyright-abiltity of the Java API, which might prove troublesome for OpenJDK should they decide to part ways with Oracle entirely. Posted Oct 1, 2015 8:52 UTC (Thu) by It's easy enough to find the release number, but I'm always having trouble finding the mapping between release numbers and codenames. I haven't found an overview on Debian's website; I need to resort to Wikipedia or the source of the lsb-release package. Posted Oct 1, 2015 9:01 UTC (Thu) by Posted Oct 1, 2015 9:17 UTC (Thu) by Posted Oct 1, 2015 9:22 UTC (Thu) by The lsb-release package containing the lsb_release command is going to stay, as mentioned in the article. Posted Oct 1, 2015 9:25 UTC (Thu) by « Raboud proposed that Debian drop everything except for the lsb-base […] and the lsb-release package » In addition to /etc/os-release, /etc/debian_version also contains some codename information, but I'd advise against using anythin Posted Oct 1, 2015 9:48 UTC (Thu) by Posted Oct 8, 2015 14:59 UTC (Thu) by Posted Oct 8, 2015 18:59 UTC (Thu) by Posted Oct 9, 2015 13:17 UTC (Fri) by The problems the Debian developers point out are nothing new. The LSB has had these problems for years. The crux of the problem is that the LSB is a trailing standard and that it has (or had, I honestly can't say for certain if this is still the case) a heavy corporate interest. This creates a situation where the LSB is always REACTING to the changing Linux distro universe, which means it can never, really, be relevant as it is always just a bit out of date. In turn, this creates problems for distros wanting to be LSB compliant as they, essentially, have to have these backwards shims in place to keep the LSB checkers happy. The LSB's modus operandi is to debate and reach consensus on each and every change. On paper, this sounds good. However, in practice it's absolutely miserable. It means that discussions drag on forever and things are added, updated, or removed long after they've ceased to be relevant in mainstream distros. Additionally, you have corporations (or had, again, it could be different) which would lobby for particular technologies and often get them included in the LSB not based upon technical merit but instead upon how much noise the company was able to generate with the LSB and the Linux Foundation. Personally, I butted against this problem back in my day at the LSB as a major change I thought was absolutely stupid (allowing non-root users to modify package management DBs like the RPM DB- a feature MANY companies trying to make packages for Linux wanted at the time) kept being brought up again and again largely because the companies in question were also Linux Foundation contributors. (This change never made it in, of course, as doing so would have made every distro in the world reject it, but it didn't change the fact that the stupid suggestion kept getting proposed and shot down on a nearly monthly basis and that there was pressure from management in the LF to keep these companies happy since they were giving so much money.) The only solution to these problems is to ditch the "LSB by committee" approach and, instead, have the LSB be semi auto-magickally generated based upon what REAL distros are doing. We had this tool at the time (which was made by researchers at a major computer science academy) which could analyze the ABI interfaces available in a given distro (the tool was intended to be used as a way to easily determine LSB compliance). That tool could have easily been used to determine ABI commonality among major distros, which could have then been used to defined the LSB in a very relevant and real way. Re-running this tool every 6 months or so, and generating the LSB based upon what the distros were actually doing, would have kept the LSB current. This was something I advocated for at the time, but was ultimately rejected (again, largely because of the corporate interests involved that had very specific agendas for the LSB). Anyway, while it makes me sad to see the LSB fall further into obscurity (it really was a good idea and had noble goals) this doesn't exactly surprise me Posted Oct 9, 2015 16:19 UTC (Fri) by such a tool (and a report like you are describing) would do wonders to deal with the "linux is fragmented, every distro requires it's own build" meme. It would either confirm that this is the case (and point at what distros or upstream projects are the cause of breakage), or provide very solid information to combat the meme. Posted Oct 11, 2015 10:28 UTC (Sun) by As a keen WordPerfect user, I wanted some way of specifying "these are the requirements to run commercial program X", and the LSB just seemed to me to be completely missing the point. If we want to install commercial programs on linux, it would make life so much easier if the LSB just defined a bunch of pseudo-packages the distribution installers all understood, that would make sure the pre-requisites are installed on the system so the commercial installer "just runs". And it looked reasonably easy to me back then - except I just got the feel that the LSB was intent on going in a different direction :-( Cheers, Posted Oct 10, 2015 15:30 UTC (Sat) by Instead, I proposed using the Technical Support Alliance ( I saw this as the best way for Ubuntu to be taken seriously on servers. Most of the ISVs we wanted were already part of TSANet, so I felt pretty confident in our ability to bring them on over a few years, starting with smaller ones. Unfortunately, between Murdock doing his Champagne Supernova and me leaving Canonical, the idea never went any further. Posted Oct 28, 2015 9:54 UTC (Wed) by Most of the products require specific distro and major version, some relax to more distros and versions. The point is once the vendor claim which platform is supported, they need to support until EOL. Claiming to support "LSB" is just too uncertain and risky to the vendor, as stated by jbailey. [ ][ ]## Debian dropping the Linux Standard Base **mjthayer** (guest, #39183) [[Link](/Articles/658884/)] (6 responses) [ ]## Debian dropping the Linux Standard Base **pabs** (subscriber, #43278) [[Link](/Articles/658890/)] (5 responses) [ ]## Debian dropping the Linux Standard Base **mjthayer** (guest, #39183) [[Link](/Articles/658900/)] (4 responses) [ ]## Debian dropping the Linux Standard Base **ewan** (subscriber, #5533) [[Link](/Articles/658998/)] [ ]## Debian dropping the Linux Standard Base **pabs** (subscriber, #43278) [[Link](/Articles/659957/)] (2 responses) [ ]## Debian dropping the Linux Standard Base **linuxrocks123** (subscriber, #34648) [[Link](/Articles/660068/)] (1 responses) 1. Java: Main distribution still under Oracle's control 2. Solaris: un-open-sourced by Oracle; IllumOS fork "won" by virtue of being only remaining option 3. MySQL: developer revolt; MariaDB fork won 4. OpenOffice: developer revolt; LibreOffice fork won 5. Hudson: developer revolt; Jenkins fork won 6. VirtualBox: Oracle still in control [ ]## Debian dropping the Linux Standard Base **orclev** (guest, #104847) [[Link](/Articles/660139/)] [ ]## How to find out the system's codename without lsb_release? **rschroev** (subscriber, #4164) [[Link](/Articles/658887/)] (7 responses) [ ]## How to find out the system's codename without lsb_release? **cortana** (subscriber, #24596) [[Link](/Articles/658891/)] (1 responses) [ ]## How to find out the system's codename without lsb_release? **rschroev** (subscriber, #4164) [[Link](/Articles/658897/)] [ ]## How to find out the system's codename without lsb_release? **zwenna** (guest, #64777) [[Link](/Articles/658898/)] [ ]## How to find out the system's codename without lsb_release? **noirbee** (subscriber, #61940) [[Link](/Articles/658896/)] (1 responses) [ ]## How to find out the system's codename without lsb_release? **rschroev** (subscriber, #4164) [[Link](/Articles/658899/)] [ ]## How to find out the system's codename without lsb_release? **pabs** (subscriber, #43278) [[Link](/Articles/659958/)] (1 responses) [ ]## How to find out the system's codename without lsb_release? **rschroev** (subscriber, #4164) [[Link](/Articles/660008/)] [ ]## Debian dropping the Linux Standard Base **criswell** (guest, #40091) [[Link](/Articles/660102/)] (2 responses) because it was something easily predictable as far back as 2008. [ ]## Debian dropping the Linux Standard Base **dlang** (guest, #313) [[Link](/Articles/660146/)] [ ]## Debian dropping the Linux Standard Base **Wol** (subscriber, #4433) [[Link](/Articles/660312/)] Wol [ ]## Debian dropping the Linux Standard Base **jbailey** (subscriber, #16890) [[Link](/Articles/660253/)] [https://www.tsanet.org/](https://www.tsanet.org/)) to build a partnership for ISVs to work with distros. The idea being that if someone has a support contract with OEM, OS vendor and ISV, the support ticket can be placed to whomever, and the vendors have means to talk to one another and actually resolve problems on behalf of the customer. This provides appropriate incentives to everyone in support of their mutual customer and encourages recurring revenue through support contracts to involved vendors. [ ]## Debian dropping the Linux Standard Base **dbp** (guest, #105070) [[Link](/Articles/662239/)]
6,398
TPP 协定可能是对互联网最可怕的事
http://fossbytes.com/tpp-agreement-could-be-the-worst-possible-thing-to-the-internet/
2015-10-14T08:20:00
[ "TPP", "隐私", "版权" ]
https://linux.cn/article-6398-1.html
![](/data/attachment/album/201510/13/233238bk3un3333d3sui6i.jpg) > > 简述:里程碑式的 TPP 协定已经由美国商务部长在亚特兰大正式公布。但是这个协定引发了一系列的关于其侵犯互联网原则的严重关注。 > > > <ruby> 跨太平洋伙伴关系协定 <rp> ( </rp> <rt> The Trans-Pacific Partnership deal </rt> <rp> ) </rp></ruby>,也被称为 TPP,已经推出了几年的时间,其被称为二十一世纪的将贸易自由化推向巅峰之作,它被指威胁到互联网主权以及万维网的自由。TPP 的反对者们质疑在该协议的所有领域,包括信息共享原则在内都贯穿了秘密谈判。 周一在亚特兰大新闻发布会正式宣布的 TPP 协定据说将涵盖全球40%的经济体量,且其宣称将创建全球统一的经济阵营。 在该协定中提议,**企业通过电脑系统违反信息披露将视为违法**,这意味着在这个方面,不会有更多的泄密消息,也不会有任何负责任的新闻报道了。 对于初创公司和个人而言,最头痛的是 TPP 要求内容提供商,比如 Youtube 或者 Facebook 即便收到一条投诉也要对内容进行下架处理。这将在网络上加大一部分企业的垄断砝码,和在最少120年内让内容拥有者可以因为侵犯版权扼杀掉短期革新者。 而且,ISP 也被要求在 TPP 协定之下监控用户活动,以在新的网络法之下侦查非法举动,从而让你不能随便说话。 大多数严格的条款都来自美国产权保护法,从而会成为协定加入国的噩梦。 美国国会曾再三的被技术专家要求要协定透明化,但并未起效。 请持续关注 fossBytes 关于<ruby> 网络侵犯法律 <rp> ( </rp> <rt> Internet infringement laws </rt> <rp> ) </rp></ruby>方面的内容。在下面的留言栏告诉我们你关于 TPP 协定的看法。
301
Moved Permanently
null
6,406
KDE 桌面环境已迎来 19 岁生日
http://linux.softpedia.com/blog/the-kool-desktop-environment-kde-turns-19-happy-birthday-494577.shtml
2015-10-15T17:27:00
[ "KDE" ]
https://linux.cn/article-6406-1.html
![KDE Plasma 5](/data/attachment/album/201510/15/172725spzpm0nzrsh2ar4p.jpg) 也许你不敢相信,到今天(2015/10/14) KDE 桌面环境已经 19 岁了。 在 19 年前的这一天, Matthias Ettrich 发布了他的新项目: [Kool Desktop Environment (KDE)](https://www.kde.org/)。 带着怀旧的感觉读一下 KDE 当时的 [初次发布公告](https://www.kde.org/announcements/announcement.php),那个时候我们许多人还是第一次接触电脑,我记得 1996 年我还在我的 ZX Spectrum 计算机上玩一些游戏,那是一台运行 DOS 的33/66 MHz 主频的 PC。 在那时,我还没听说过 Linux,而 [Matthias Ettrich](https://en.wikipedia.org/wiki/Matthias_Ettrich) 已经准备要改变世界,并想要为 Linux 操作系统开发一个有史以来最好的图形用户界面,于是,KDE 就于 1996 年 10 月 14 日诞生了。KDE 名字全称是 K Desktop Environment 或 Kool Desktop Environment,随便你喜欢哪个。 > > "Unix popularity grows thanks to the free variants, mostly Linux. But still a consistent, nice looking free desktop-environment is missing. There are several nice either free or low-priced applications available so that Linux/X11 would almost fit everybody needs if we could offer a real GUI." > > > Matthias Ettrich 在当时写道:“得益于以 Linux 为主的自由变体,Unix 变得越来越流行了。但是还缺少一个一致而漂亮的自由桌面环境。如果我们能提供一个真正的图形用户界面,有几个自由或便宜的应用程序, Linux/X11 就可以适合每个人的需求了。” ![KDE 1.1](/data/attachment/album/201510/15/172754vqh49v8u5zmj1h9p.jpg) 世界上有几十万人在使用 KDE,各种基于 Linux 内核的操作系统也都支持它,如果你也在使用 KDE,那么让我们来庆祝这个令人称赞的桌面环境的生日吧! **生日快乐,KDE !**
301
Moved Permanently
null
6,408
在 SSD 上使用 btrfs 文件系统的相关优化
https://memo.ink/btrfs-on-ssd/
2015-10-16T07:41:00
[ "SSD", "btrfs" ]
/article-6408-1.html
![](/data/attachment/album/201510/15/230357ybnq0nw0bjyjni9i.jpg) ### 优化挂载参数 在 Linux 中挂载 SSD 上的 btrfs,可以采用各种参数进行优化: ``` # <file system> <mount point> <type> <options> <dump> <pass> UUID=<略> / btrfs defaults,ssd,discard,noatime,compress=lzo,subvol=@ 0 1 ``` 这些参数各有优缺点,酌情添加。 #### ssd btrfs 文件系统有对 SSD 进行优化,在挂载参数中加入 `ssd` 即可。该参数不会自动启用 TRIM/discard。 #### discard 可以通过以下命令**确认 SSD 是否支持 TRIM**: ``` sudo hdparm -I /dev/sdX | grep TRIM * Data Set Management TRIM supported (limit 8 blocks) ``` 若 SSD 支持 TRIM 命令,可以在 **/etc/fstab** 中启用 `discard` 参数。建议将 `discard` 挂载参数作为首选。据 debian wiki 所述,包括三星,镁光,英睿达在内的一些 SSD 在 [discard/TRIM 上有问题,不能合适地处理 TRIM 命令](https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/ata/libata-core.c#n4227)。以下是 linux 内核相关处源代码 (2015/10/15): ``` /* devices that don't properly handle queued TRIM commands */ { "Micron_M500_*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Micron_M5[15]0_*"," MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*M550*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Crucial_CT*MX100*", "MU01", ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "Samsung SSD 8*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, { "FCCT*M500*", NULL, ATA_HORKAGE_NO_NCQ_TRIM | ATA_HORKAGE_ZERO_AFTER_TRIM, }, /* devices that don't properly handle TRIM commands */ { "SuperSSpeed S238*", NULL, ATA_HORKAGE_NOTRIM, }, ``` 该参数不是必需的,也可以自定义周期性运行 `fstrim` 命令来取代该参数,使用该命令前**要确认 SSD 支持 TRIM**,否则可能造成数据丢失。当 SSD 有足够的空余空间或(未分配的)可用空间时不需要该参数。 #### noatime 挂载参数可以加入 `noatime`,通过禁止更新访问记录来减少不必要的写操作以提高性能。该选项对 HDD 同样有性能提升。btrfs 的默认配置为 `relatime`。 #### compress 打开压缩功能在通常情况下有利于提高传输性能(并非绝对),也可以节省存储空间。加入以下挂载参数: ``` compress=lzo 或 compress=zlib ``` lzo 速度更快,zlib 压缩率更高。注意确认 SSD 主控是否是非压缩主控,若为压缩主控不建议加入该参数。 ### 写缓存 若 SSD 带有缓存,启用 Write Cache 可以提高性能:Disks -> Drive Setting -> Enable Write Cache,但在突然断电的情况下可能造成数据丢失。 ### I/O 调度 SSD 结构不同于传统硬盘,寻址时间短,I/O 调度算法可选择 `noop` 以降低延迟。以下命令可查看与修改调度器: ``` cat /sys/block/sdX/queue/scheduler # sdX 指你的设备 sudo tee /sys/block/sdX/queue/scheduler <<< noop ``` 注意以上方法并不持久,重启后会重置。如果 SSD 是系统唯一的存储设备,可考虑通过 `elevator=noop` 内核参数设置 I/O 调度器。也可使用 udev 规则来修改调度器,对多存储设备同样有效: ``` /etc/udev/rules.d/60-ssd-scheduler.rules # 创建该文件 ``` 文件内容如下: ``` # set deadline scheduler for non-rotating disks ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="noop" ``` ### 参考: 1. [关于在SSD上使用btrfs文件系统需要做的优化 - akarin.cn](http://www.akarin.cn/archives-73.html) 2. [Solid State Drives - Arch wiki](https://wiki.archlinux.org/index.php/Solid_State_Drives_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)) 3. [SSD Optimization - debian wiki](https://wiki.debian.org/SSDOptimization) 4. [Btrfs wiki](https://btrfs.wiki.kernel.org/index.php/FAQ)
null
HTTPSConnectionPool(host='memo.ink', port=443): Max retries exceeded with url: /btrfs-on-ssd/ (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'memo.ink'. (_ssl.c:1007)")))
null
6,409
树莓派介绍与“食用”方法
http://locez.com/Linux/raspberry-pi/
2015-10-16T10:05:00
[ "树莓派" ]
https://linux.cn/article-6409-1.html
![](/data/attachment/album/201510/15/230711a38c36kbkb6to242.jpg) <ruby> 树莓派 <rp> ( </rp> <rt> Raspberry Pi </rt> <rp> ) </rp></ruby>是 Raspberry Pi Foundation 推出的迷你电脑,它只有信用卡大小,但可以完成一台普通 PC 能完成的大部分工作,并且价格很便宜,是电脑爱好者的不二选择,如果你是一名 Linuxer 更应该拥有一台这样的迷你电脑。 ### 发展 Raspberry Pi 自 2012 年发布以来,依次发布了 Raspberry Pi 1 A , Raspberry Pi 1 B ,Raspberry Pi 1 B+ ,Raspberry Pi 1 A+ ,Raspberry 2 B 五个版本,这些版本硬件上有不少变化,具体可以查阅 Wikipedia [Raspberry Pi](https://en.wikipedia.org/wiki/Raspberry_Pi) ,另外 Raspberry Pi 2 B 将支持 Windows 10 iot ,这对非 Linux 用户来说也是一个福音,因为你可以完全把 Raspberry Pi 2 B 当成你的另一台 Windows PC ,详情可以查看 [Raspberry Pi Windows 10 iot](http://ms-iot.github.io/content/en-US/Downloads.htm)。 ### Raspberry Pi 的用途 Raspberry Pi 到底能拿来做什么呢?它的玩法多的数不清了,因为这取决于我们的创意,作为一块开发板,它给我们提供了很大的自由。 * [树莓派构建的超级计算机](/article-1402-1.html) * [作为家用服务器](/article-4092-1.html) * [我拿树莓派来做什么](/article-1618-1.html) * [Raspberry Pi 五种有趣玩法](/article-681-1.html) * 微型个人电脑 (笔者也就只是当作个人微型电脑而已) 下面是几张引用文章内的图: ![](/data/attachment/album/201305/31/100902rmu4rm3uemxruw55.jpg) ![](/data/attachment/album/201305/31/100904mgrbvrgafragqcfj.jpg) ![](/data/attachment/album/201311/07/230232hzveaaihvovvbbl8.jpg) ### 操作系统的选择 由于 Raspberry Pi 几乎是为 Linux 而生的,所以 Raspberry Pi 的操作系统也是多样的,为此以下介绍几个操作系统。 * [Raspbian](https://www.raspberrypi.org/downloads/raspbian/) 基于 debian 的 Raspberry Pi 官方操作系统,如果是当开发板使用,最建议使用此系统 * [Ubuntu Mate](https://ubuntu-mate.org/raspberry-pi/) * [Snappy Ubuntu Core](https://developer.ubuntu.com/en/snappy/start/#snappy-raspi2) * [Windows 10 Iot Core](http://ms-iot.github.io/content/en-US/Downloads.htm) * [OPENELEC](http://openelec.tv/get-openelec) * [PINET](http://pinet.org.uk/) * [RISC OS](https://www.riscosopen.org/content/downloads/raspberry-pi) 以上操作系统都可以在 [Raspberry Pi 主页](https://www.raspberrypi.org/downloads/) 找到相关信息。 * [Arch Arm](http://archlinuxarm.org/) * [Gentoo Arm](https://www.gentoo.org/downloads/) ### 个人电脑 笔者只是将 Raspberry Pi 当成个人电脑使用而已,因此,未选择 Raspbian 而是选择了 Arch Arm。 下面是我选择的配件 * Raspberry Pi 2 B * 8 G 闪迪内存卡 * USB Wi-Fi 模块(可选) * 亚克力外壳(可选) * 散热铝片或铜片 * 电源线 * 键盘鼠标(可选) #### 安装系统 首先参照 [Arch Arm Installation](http://archlinuxarm.org/platforms/armv7/broadcom/raspberry-pi-2) 安装系统。 为 SD 卡分区(用你 Linux 上的 sd 卡设备代替 sdX ): ``` fdisk /dev/sdX ``` 第一步请先删除原来的分区并重新创建: * 输入 o 清除所有分区。 * 输入 p 列出所有分区,此时应该没有分区。 * 输入 n , 然后输入 p 选择主分区,1 是第一个分区 ,输入 ENTER 确定第一个扇区,然后输入 +100M 。 * 输入 t , 然后输入 c 设置第一个分区类型为 W95 FAT32 (LBA)。 * 输入 n , 然后输入 p 选择主分区, 2 是第二个分区, 直接输入 ENTER 确定默认的扇区和最后的扇区(剩下的所有容量作为第二个分区) * 输入 w 写入分区表并退出。 创建和挂载 vfat 文件系统(用你 Linux 上的 sd 卡设备代替 sdX ): ``` mkfs.vfat /dev/sdX1 mkdir boot mount /dev/sdX1 boot ``` 创建个挂载 ext4 文件系统(用你 Linux 上的 sd 卡设备代替 sdX ): ``` mkfs.ext4 /dev/sdX2 mkdir root mount /dev/sdX2 root ``` 使用 root 用户下载和解压 根文件系统: ``` wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root sync ``` 移动启动文件到第一分区: ``` mv root/boot/* boot ``` 卸载挂载点: ``` umount boot root ``` 将 SD 卡插入 Raspberry Pi ,连接以太网和 5v 电源。 #### 使用 SSH 登录 默认用户是 alarm 密码 alarm。(ssh 请先用此用户登录,再修改 ssh 配置允许 root 登录) root 的默认密码是 root。 **注意** :以下用到 `sudo` 命令的,若你未配置 `sudo` 请直接用 `root` 用户执行。 首次使用应该按如下格式 `ssh` 登录: ``` $ ssh -p 22 alarm@地址 ``` 进去后使用 `su` 切换到 `root` ,并修改密码: ``` $ sudo su - # password ``` 为了能使 `root` 通过 `ssh` 登录,编辑 `/etc/ssh/sshd_config` ``` $ sudo nano /etc/ssh/sshd_config ``` 将 `#PermitRootLogin` 这行去掉注释,并将值设置为 `yes` : ``` PermitRootLogin yes ``` #### 配置源与更新系统 编辑 `/etc/pacman.d/mirrorlist` ``` $ sudo nano /etc/pacman.d/mirrorlist ``` 在顶部增加以下代码,这是中科大的源 ``` ## USTC Server = http://mirrors.ustc.edu.cn/archlinuxarm/armv7h/$repo ``` 编辑好后按 `ctrl +x` ,然后按 `y` 保存,然后升级整个系统: ``` $ sudo pacman -Syu ``` #### 桌面化 Raspberry Pi 首先安装 `xorg` ``` $ sudo pacman -S xorg $ sudo pacman -S xorg-xinit ``` 然后安装 `lxqt` 桌面: ``` $ sudo pacman -S lxqt ``` #### 使用 vncviewer 访问 Raspberry Pi 首先配置 vncviewer,本机与 Raspberry Pi 都需要安装 `tigervnc` ``` $ sudo pacman -S tigervnc ``` 在 Raspberry Pi 中执行 `vncserver` ``` $ vncserver You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n New 'ArchRaspi:1 (locez)' desktop is ArchRaspi:1 Creating default startup script /home/locez/.vnc/xstartup Starting applications specified in /home/locez/.vnc/xstartup Log file is /home/locez/.vnc/ArchRaspi:1.log ``` 然后编辑 `~/.vnc/xstartup` ,将原来的内容替换为以下内容,你也可以直接删除原文件,再新建一个同名文件: ``` #!/bin/sh unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS exec startlxqt ``` 然后杀掉 vnc 服务,并重启它: ``` $ vncserver -kill :1 Killing Xvnc process ID 400 $ vncserver New 'ArchRaspi:1 (locez)' desktop is ArchRaspi:1 Starting applications specified in /home/locez/.vnc/xstartup Log file is /home/locez/.vnc/ArchRaspi:1.log ``` 记住上面的 `:1` 可能根据实际情况不同,这个端口是你用 `vncviewer` 连接时用的端口。 然后本机中执行: ``` $ vncviewer address:port ``` 然后输入密码就可以了 ![小屏幕显示](/data/attachment/album/201510/15/232811muvzziuutsrzvuz2.png) 现在我们看见这个不是全屏的,但是可以在启动 vncserver 的时候增加参数,来指定分辨率: ``` $ vncserver -kill :1 $ vcnserver -geometry 1920x1000 ``` 这下就全屏了 ![全屏](/data/attachment/album/201510/15/232811u2lm290omldlel12.png) ### 其它用途 然后你可以在不另外配显示屏的情况下正常使用 Raspberry Pi ,将它配置成一个 `samba` 服务器,或者做成一个下载器,这仅仅取决于,你想将 Raspberry Pi 拿来干什么。 笔者还尝试将 Raspberry Pi 直接连入手机 Wi-Fi ,把手机当成路由器使用,获取手机内网 IP 后,直接在手机上 `ssh` 内网登录,从而实现 Raspberry Pi 使用手机流量上网,并且不用借助路由器就可以连接 Raspberry Pi。 这里笔者推荐的是 **juiceSSH** ,手机上简单实用的一款 ssh 工具。由于篇幅原因,此处不再详述如何使用手机直连 Raspberry Pi,动手能力强的同学可以参看上面我给的思路,自行折腾。 后来笔者,买了键盘以后,又利用 `tmux` 将手机纯粹当屏幕使用。 首先 手机先 `ssh` 登陆 Raspberry Pi,执行 ``` tmux ``` 然后在看不见屏幕的情况下,使用键盘盲打输入 **用户名** 、 **密码** 进行登录,然后执行 ``` tmux attach ``` 此时键盘与手机屏幕的输入已经是同步的,一台个人作品就此完成! ### 成果展示 下面几张图,是笔者在学校折腾的时候拍的: ![](/data/attachment/album/201510/15/232812aszabccsqyppspar.jpg) ![](/data/attachment/album/201510/15/232812yjsu5nkjub4u4d6n.jpg) ![](/data/attachment/album/201510/15/232813w8e86oazo66b5065.jpg) ### 参考资料 * [Linux.中国](https://linux.cn/) * [Wikipedia Raspberry Pi](https://en.wikipedia.org/wiki/Raspberry_Pi) * [RaspberryPi](https://www.raspberrypi.org/)
301
Moved Permanently
null
6,410
pyinfo():一个像 phpinfo 一样的 Python 脚本
http://bran.name/articles/pyinfo-a-good-looking-phpinfo-like-python-script/
2015-10-16T07:59:00
[ "python" ]
https://linux.cn/article-6410-1.html
![](/data/attachment/album/201510/16/000334en7p54ggks870bgh.gif) 作为一个热衷于 php 的家伙,我已经习惯了使用 `phpinfo()` 函数来让我轻松访问 php.ini 里的配置和加载的模块等信息。当然我也想要使用一个不存在的 `pyinfo()` 函数,但没有成功。按下 CTRL-E,google 一下是否有人实现了它? 是的,有人已经实现了。但是,对我来说它非常难看。荒谬!因为我无法忍受丑陋的布局,*咳咳*,我不得不亲自动手来改改。我用找到的代码,并重新进行布局使之更好看点。Python 官方网站的布局看起来不错,那么何不借用他们的颜色和背景图片呢?是的,这听起来像一个计划。 * [Gist 代码地址](https://gist.github.com/951825#file_pyinfo.py) * [下载地址](http://bran.name/dump/pyinfo.zip) * [例子](http://bran.name/dump/pyinfo/index.py) 提醒你下,我仅仅在 Python 2.6.4 上运行过它,所以在别的版本上可能有风险(将它移植到任何其他版本它应该是没有问题的)。要使用它,只需要导入该文件, 并调用`pyinfo()`函数得到它的返回值打印到屏幕上。好嘞! 如果你在使用 [mod\_wsgi](http://code.google.com/p/modwsgi/) 时没有得到正确的返回结果,你可以如下运行它(当然得替换路径): ``` def application(environ, start_response): import sys path = 'YOUR_WWW_ROOT_DIRECTORY' if path not in sys.path: sys.path.append(path) from pyinfo import pyinfo output = pyinfo() start_response('200 OK', [('Content-type', 'text/html')]) return [output] ``` --- via:<http://bran.name/articles/pyinfo-a-good-looking-phpinfo-like-python-script/> 作者:[Bran van der Meer](http://bran.name/resume/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译, [Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,411
在 Ubuntu 15.04 上安装 Justniffer
http://www.unixmen.com/install-justniffer-ubuntu-15-04/
2015-10-16T09:21:00
[ "Justniffer", "snort" ]
https://linux.cn/article-6411-1.html
### 简介 ![](/data/attachment/album/201510/16/002405jrg6rbehvta9h2vt.jpg) [Justniffer](http://sourceforge.net/projects/justniffer/?source=directory) 是一个可用于替代 Snort 的网络协议分析器。它非常流行,可交互式地跟踪/探测一个网络连接。它能从实时环境中抓取流量,支持 “lipcap” 和 “tcpdump” 文件格式。它可以帮助用户分析一个用 wireshark 难以抓包的复杂网络。尤其是它可以有效的帮助你分析应用层流量,能提取类似图像、脚本、HTML 等 http 内容。Justniffer 有助于理解不同组件之间是如何通信的。 ### 功能 Justniffer 可以收集一个复杂网络的所有流量而不影响系统性能,这是 Justniffer 的一个优势,它还可以保存日志用于之后的分析,Justniffer 其它一些重要功能包括: 1. 可靠的 TCP 流重建 它可以使用主机 Linux 内核的一部分用于记录并重现 TCP 片段和 IP 片段。 2. 日志 保存日志用于之后的分析,并能自定义保存内容和时间。 3. 可扩展 可以通过外部的 python、 perl 和 bash 脚本扩展来从分析报告中获取一些额外的结果。 4. 性能管理 基于连接时间、关闭时间、响应时间或请求时间等提取信息。 ### 安装 Justniffer 可以通过 PPA 安装: 运行下面命令添加库: ``` $ sudo add-apt-repository ppa:oreste-notelli/ppa ``` 更新系统: ``` $ sudo apt-get update ``` 安装 Justniffer 工具: ``` $ sudo apt-get install justniffer ``` make 的时候失败了,然后我运行下面的命令并尝试重新安装服务 ``` $ sudo apt-get -f install ``` ### 示例 首先用 -v 选项验证安装的 Justniffer 版本,你需要用超级用户权限来使用这个工具。 ``` $ sudo justniffer -V ``` 示例输出: ![j](/data/attachment/album/201510/16/002408znape0qa04evvanw.png) **1、 以类似 apache 的格式导出 eth1 接口流量,显示到终端** ``` $ sudo justniffer -i eth1 ``` 示例输出: ![Selection_001](/data/attachment/album/201510/16/002409l77gd079jd9x5umg.png) **2、 可以用下面的选项跟踪正在运行的 tcp 流** ``` $ sudo justniffer -i eth1 -r ``` 示例输出: ![Selection_002](/data/attachment/album/201510/16/002410pukt5ry5zb7bydbd.png) **3、 获取 web 服务器的响应时长** ``` $ sudo justniffer -i eth1 -a " %response.time" ``` 示例输出: ![Selection_003](/data/attachment/album/201510/16/002412rlg2iex66gaowjng.png) **4、 使用 Justniffer 读取一个 tcpdump 抓取的文件** 首先,用 tcpdump 抓取流量。 ``` $ sudo tcpdump -w /tmp/file.cap -s0 -i eth0 ``` 然后用 Justniffer 访问数据 ``` $ justniffer -f file.cap ``` 示例输出: ![Selection_005](/data/attachment/album/201510/16/002413wzuol0j2q11u12lq.png) **5、 只抓取 http 数据** ``` $ sudo justniffer -i eth1 -r -p "port 80 or port 8080" ``` 示例输出: ![Selection_006](/data/attachment/album/201510/16/002413zkx1w0s14dlx4w1w.png) **6、 获取一个指定主机的 http 数据** ``` $ justniffer -i eth1 -r -p "host 192.168.1.250 and tcp port 80" ``` 示例输出: ![Selection_007](/data/attachment/album/201510/16/002415bnxhonxn0q5nxhmv.png) **7、 以更精确的格式抓取数据** 当你输入 **justniffer -h** 的时候你可以看到很多用于以更精确的方式获取数据的格式关键字 ``` $ justniffer -h ``` 示例输出: ![Selection_008](/data/attachment/album/201510/16/002416q0xxsn7r76x950ts.png) 让我们用 Justniffer 根据预先定义的参数提取数据 ``` $ justniffer -i eth1 -l "%request.timestamp %request.header.host %request.url %response.time" ``` 示例输出: ![Selection_009](/data/attachment/album/201510/16/002417ma4k94904111zmsx.png) 其中还有很多你可以探索的选项。 ### 总结 Justniffer 是一个很好的用于网络测试的工具。在我看来对于那些用 Snort 来进行网络探测的用户来说,Justniffer 是一个更简单的工具。它提供了很多 **格式关键字** 用于按照你的需要精确地提取数据。你可以用 .cap 文件格式记录网络信息,之后用于分析监视网络服务性能。 **参考资料:** * [Justniffer 官网](http://justniffer.sourceforge.net/) --- via: <http://www.unixmen.com/install-justniffer-ubuntu-15-04/> 作者:[Rajneesh Upadhyay](http://www.unixmen.com/author/rajneesh/) 译者:[ictlyh](http://mutouxiaogui.cn/blog) 校对:[校对者ID](https://github.com/%E6%A0%A1%E5%AF%B9%E8%80%85ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,421
开源媒体播放器 MPlayer 1.2 发布
http://itsfoss.com/mplayer-1-2-released/
2015-10-18T09:06:00
[ "MPlayer", "媒体播放器" ]
https://linux.cn/article-6421-1.html
![](/data/attachment/album/201510/18/090610wjx3gjv4efr4xrj4.jpg) 在 [MPlayer](https://www.mplayerhq.hu/) 1.1 发布将近3年后,新版 MPlayer 终于在上周发布了。在新版本 MPlayer 1.2 中带来了对许多新编码的解码支持。 MPlayer 是一款跨平台的开源媒体播放器。它的名字是“Movie Player”的缩写。MPlayer 是 Linux 上最老牌的媒体播放器之一,在过去的15年里,它还带动出现了许多其他媒体播放器。著名的基于 MPlayer 的媒体播放器有: * [MPV](http://mpv.io/) * SMPlayer * KPlayer * GNOME MPlayer * Deepin Player(深度影音) #### MPlayer 1.2 更新了些什么? * 兼容 FFmpeg 2.8 * 对 H.265/HEVC 的 VDPAU 硬件加速 * 通过 FFmpeg 支持一些新的编码解码 * 改善电视与数字视频广播支持 * 界面优化 * libdvdcss/libdvdnav 包外部依赖 #### 在 Linux 安装 MPlayer 1.2 大多数 Linux 发行版仓库中还是 MPlayer 1.1 版本。如果你想使用新的 MPlayer 1.2 版本,你需要从源码手动编译,这对新手来说可能有点棘手。 我是在 Ubuntu 15.04 上安装的 MPlayer 1.2。除了需要安装 yasm 的地方以外,对所有 Linux 发行版来说安装说明都是一样的。 打开一个终端,运行下列命令: ``` wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.2.tar.xz tar xvf MPlayer-1.2.tar.xz cd MPlayer-1.2 sudo apt-get install yasm ./configure ``` 在你运行 make 的时候,在你的终端屏幕上会显示一些东西,并且你需要一些时间来编译它。保持耐心。 ``` make sudo make install ``` 如果你觉得从源码编译不大习惯的话,我建议你等待 MPlayer 1.2 提交到你的 Linux 发行版仓库中,或者用其它的播放器替代,比如 MPV。 --- via: <http://itsfoss.com/mplayer-1-2-released/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,423
Linux 有问必答:如何在 Linux 命令行下浏览天气预报
http://ask.xmodulo.com/weather-forecasts-command-line-linux.html
2015-10-18T09:19:49
[ "wego", "天气" ]
/article-6423-1.html
> > **Q**: 我经常在 Linux 桌面查看天气预报。然而,是否有一种在终端环境下,不通过桌面小插件或者浏览器查询天气预报的方法? > > > 对于 Linux 桌面用户来说,有很多办法获取天气预报,比如使用专门的天气应用、桌面小插件,或者面板小程序。但是如果你的工作环境是基于终端的,这里也有一些在命令行下获取天气的手段。 其中有一个就是 [wego](https://github.com/schachmat/wego),**一个终端下的小巧程序**。使用基于 ncurses 的接口,这个命令行程序允许你查看当前的天气情况和之后的预报。它也会通过一个天气预报的 API 收集接下来 5 天的天气预报。 ![](/data/attachment/album/201510/18/091951wq5akgr42o1dgdkc.jpg) ### 在 Linux 下安装 wego 安装 wego 相当简单。wego 是用 Go 编写的,引起第一个步骤就是安装 [Go 语言](http://ask.xmodulo.com/install-go-language-linux.html)。然后再安装 wego。 ``` $ go get github.com/schachmat/wego ``` wego 会被安装到 $GOPATH/bin,所以要将 $GOPATH/bin 添加到 $PATH 环境变量。 ``` $ echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.bashrc $ source ~/.bashrc ``` 现在就可与直接从命令行启动 wego 了。 ``` $ wego ``` 第一次运行 weg 会生成一个配置文件(`~/.wegorc`),你需要指定一个天气 API key。 你可以从 [worldweatheronline.com](https://developer.worldweatheronline.com/auth/register) 获取一个免费的 API key。免费注册和使用。你只需要提供一个有效的邮箱地址。 ![](/data/attachment/album/201510/18/091951ngjeu3nqpguq0gg1.jpg) 你的 .wegorc 配置文件看起来会这样: ![](/data/attachment/album/201510/18/091952ba4rfq56law6wduk.jpg) 除了 API key,你还可以把你想要查询天气的地方、使用的城市/国家名称、语言配置在 `~/.wegorc` 中。 注意,这个天气 API 的使用有限制:每秒最多 5 次查询,每天最多 250 次查询。 当你重新执行 wego 命令,你将会看到最新的天气预报(当然是你的指定地方),如题图显示。 显示出来的天气信息包括:(1)温度,(2)风速和风向,(3)可视距离,(4)降水量和降水概率 默认情况下会显示3 天的天气预报。如果要进行修改,可以通过参数改变天气范围(最多5天),比如要查看 5 天的天气预报: ``` $ wego 5 ``` 如果你想检查另一个地方的天气,只需要提供城市名即可: ``` $ wego Seattle ``` ### 问题解决 1. 可能会遇到下面的错误: ``` user: Current not implemented on linux/amd64 ``` 当你在一个不支持原生 Go 编译器的环境下运行 wego 时就会出现这个错误。在这种情况下你只需要使用 gccgo ——一个 Go 的编译器前端来编译程序即可。这一步可以通过下面的命令完成。 ``` $ sudo yum install gcc-go $ go get -compiler=gccgo github.com/schachmat/wego ``` --- via: <http://ask.xmodulo.com/weather-forecasts-command-line-linux.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[oska874](https://github.com/oska874) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /weather-forecasts-command-line-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275820e0>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,424
如何使用 GRUB 2 直接从硬盘运行 ISO 文件
https://www.maketecheasier.com/run-iso-files-hdd-grub2/
2015-10-18T09:44:33
[ "grub", "iso", "启动" ]
https://linux.cn/article-6424-1.html
![](/data/attachment/album/201510/18/094435clq6dy8jsvceze6l.png) 大多数 Linux 发行版都会提供一个可以从 USB 启动的 live 环境,以便用户无需安装即可测试系统。我们可以用它来评测这个发行版或仅仅是当成一个一次性系统,并且很容易将这些文件复制到一个 U 盘上,在某些情况下,我们可能需要经常运行同一个或不同的 ISO 镜像。GRUB 2 可以配置成直接从启动菜单运行一个 live 环境,而不需要烧录这些 ISO 到硬盘或 USB 设备。 ### 获取和检查可启动的 ISO 镜像 为了获取 ISO 镜像,我们通常应该访问所需的发行版的网站下载与我们架构兼容的镜像文件。如果这个镜像可以从 U 盘启动,那它也应该可以从 GRUB 菜单启动。 当镜像下载完后,我们应该通过 MD5 校验检查它的完整性。这会输出一大串数字与字母合成的序列。 ![](/data/attachment/album/201510/18/094435jfzdcd1otefsdj1o.png) 将这个序列与下载页提供的 MD5 校验码进行比较,两者应该完全相同。 ### 配置 GRUB 2 ISO 镜像文件包含了整个系统。我们要做的仅仅是告诉 GRUB 2 哪里可以找到 kernel 和 initramdisk 或 initram 文件系统(这取决于我们所使用的发行版)。 在下面的例子中,一个 Kubuntu 15.04 live 环境将被配置到 Ubuntu 14.04 机器的 Grub 启动菜单项。这应该能在大多数新的以 Ubuntu 为基础的系统上运行。如果你是其它系统并且想实现一些其它的东西,你可以从[这些文件](http://git.marmotte.net/git/glim/tree/grub2)了解更多细节,但这会要求你拥有一点 GRUB 使用经验。 这个例子的文件 `kubuntu-15.04-desktop-amd64.iso` 放在位于 `/dev/sda1` 的 `/home/maketecheasier/TempISOs/` 上。 为了使 GRUB 2 能正确找到它,我们应该编辑 ``` /etc/grub.d40-custom ``` ![](/data/attachment/album/201510/18/094436h1yhby1hhxyozfh8.png) ``` menuentry "Kubuntu 15.04 ISO" { set isofile="/home/maketecheasier/TempISOs/kubuntu-15.04-desktop-amd64.iso" loopback loop (hd0,1)$isofile echo "Starting $isofile..." linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash initrd (loop)/casper/initrd.lz } ``` ![](/data/attachment/album/201510/18/094436m1k6oicxcod5w6iw.png) ### 分析上述代码 首先设置了一个变量名 `$menuentry` ,这是 ISO 文件的所在位置 。如果你想换一个 ISO ,你应该修改 `isofile="/path/to/file/name-of-iso-file-.iso"`. 下一行是指定回环设备,且必须给出正确的分区号码。 ``` loopback loop (hd0,1)$isofile ``` 注意 hd0,1 这里非常重要,它的意思是第一硬盘,第一分区 (`/dev/sda1`)。 GRUB 的命名在这里稍微有点困惑,对于硬盘来说,它从 “0” 开始计数,第一块硬盘为 #0 ,第二块为 #1 ,第三块为 #2 ,依此类推。但是对于分区来说,它从 “1” 开始计数,第一个分区为 #1 ,第二个分区为 #2 ,依此类推。也许这里有一个很好的原因,但肯定不是明智的(明显用户体验很糟糕).. 在 Linux 中第一块硬盘,第一个分区是 `/dev/sda1` ,但在 GRUB2 中则是 `hd0,1` 。第二块硬盘,第三个分区则是 `hd1,3`, 依此类推. 下一个重要的行是: ``` linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash ``` 这会载入内核镜像,在新的 Ubuntu Live CD 中,内核被存放在 `/casper` 目录,并且命名为 `vmlinuz.efi` 。如果你使用的是其它系统,可能会没有 `.efi` 扩展名或内核被存放在其它地方 (可以使用归档管理器打开 ISO 文件在 `/casper` 中查找确认)。最后一个选项, `quiet splash` ,是一个常规的 GRUB 选项,改不改无所谓。 最后 ``` initrd (loop)/casper/initrd.lz ``` 这会载入 `initrd` ,它负责载入 RAMDisk 到内存用于启动。 ### 启动 live 系统 做完上面所有的步骤后,需要更新 GRUB2: ``` sudo update-grub ``` ![](/data/attachment/album/201510/18/094436h5zl1nvplhlommm7.png) 当重启系统后,应该可以看见一个新的、并且允许我们启动刚刚配置的 ISO 镜像的 GRUB 条目: ![](/data/attachment/album/201510/18/094437n49lir14269ab692.png) 选择这个新条目就允许我们像从 DVD 或 U 盘中启动一个 live 环境一样。 --- via: <https://www.maketecheasier.com/run-iso-files-hdd-grub2/> 作者:[Attila Orosz](https://www.maketecheasier.com/author/attilaorosz/) 译者:[Locez](https://github.com/locez) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Most Linux distros offer a live environment, which you can boot up from a USB drive, for you to test the system without installing. You can either use it to evaluate the distro or as a disposable OS. While it is easy to copy these onto a USB disk, in certain cases one might want to run the same ISO image often or run different ones regularly. GRUB 2 can be configured so that you do not need to burn the ISOs to disk or use a USB drive, but need to run a live environment directly form the boot menu. ## Obtaining and checking bootable ISO images To obtain an ISO image, you should usually visit the website of the desired distribution and download any image that is compatible with your setup. If the image can be started from a USB, it should be able to start from the GRUB menu as well. Once the image has finished downloading, you should check its integrity by running a simple md5 check on it. This will output a long combination of numbers and alphanumeric characters which you can compare against the MD5 checksum provided on the download page. The two should be identical. ## Setting up GRUB 2 ISO images contain full systems. All you need to do is direct GRUB2 to the appropriate file, and tell it where it can find the kernel and the initramdisk or initram filesystem (depending on which one your distribution uses). In this example, a Kubuntu 15.04 live environment will be set up to run on an Ubuntu 14.04 box as a Grub menu item. It should work for most newer Ubuntu-based systems and derivatives. In this example the file `kubuntu-15.04-desktop-amd64.iso` lives in `/home/maketecheasier/TempISOs/` on `/dev/sda1` . To make GRUB2 look for it in the right place, you need to edit the /etc/grub.d/40_custom file which allows you to add your own menu entries. The file should already exist and contain a few lines. To start Kubuntu from the above location, add the following code (after adjusting it to your needs) below the commented section, without modifying the original content. menuentry "Kubuntu 15.04 ISO" { set isofile="/home/maketecheasier/TempISOs/kubuntu-15.04-desktop-amd64.iso" loopback loop (hd0,1)$isofile echo "Starting $isofile..." linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash initrd (loop)/casper/initrd.lz } ## Breaking down the above code First set up a variable named `$menuentry` . This is where the ISO file is located. If you want to change to a different ISO, you need to change the bit where it says set `isofile="/path/to/file/name-of-iso-file-.iso"` . The next line is where you specify the loopback device; you also need to give it the right partition number. This is the bit where it says loopback loop (hd0,1)$isofile Note the `hd0,1` bit; it is important. This means first HDD, first partition (`/dev/sda1` ). GRUB’s naming here is slightly confusing. For HDDs, it starts counting from “0”, making the first HDD #0, the second one #1, the third one #2, etc. However, for partitions, it will start counting from 1. First partition is #1, second is #2, etc. There might be a good reason for this but not necessarily a sane one (UX-wise it is a disaster, to be sure).. This makes fist disk, first partition, which in Linux would usually look something like `/dev/sda1` become `hd0,1` in GRUB2. The second disk, third partition would be `hd1,3` , and so on. The next important line is linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash It will load the kernel image. On newer Ubuntu Live CDs, this would be in the `/casper` directory and called `vmlinuz.efi` . If you use a different system, your kernel might be missing the `.efi` extension or be located somewhere else entirely (You can easily check this by opening the ISO file with an archive manager and looking inside `/casper.` ). The last options, `quiet splash,` would be your regular GRUB options, if you care to change them. Finally initrd (loop)/casper/initrd.lz will load `initrd` , which is responsible to load a RAMDisk into memory for bootup. ## Booting into your live system To make it all work, you will only need to update GRUB2 `sudo update-grub` When you reboot your system, you should be presented with a new GRUB entry which will allow you to load into the ISO image you’ve just set up. Selecting the new entry should boot you into the live environment, just like booting from a DVD or USB would. Our latest tutorials delivered straight to your inbox
6,425
Linux 产能工具及其使用技巧
http://itsfoss.com/productivity-tips-ubuntu/
2015-10-18T10:31:35
[ "生产力" ]
https://linux.cn/article-6425-1.html
![](/data/attachment/album/201510/18/102624gaaiv0ddgspcm3v0.jpg) 由于生产力本身是一个主观术语,我不打算详细解释我这里要讲到的“生产力”是什么。我打算给你们展示一些工具及其使用技巧,希望这会帮助你在Linux中工作时能更专注、更高效,并且能节省时间。 ### Linux产能工具及其使用技巧 再次说明,我在写下本文时正在使用的是Ubuntu。但是,我将要在这里展示给大家产能工具及其使用技巧却适用于市面上的大多数Linux发行版。 #### 外界的音乐 ![](/data/attachment/album/201510/18/103103q49m2h1cg97am1ic.jpg) [音乐影响生产力](http://www.helpscout.net/blog/music-productivity/),这已经是一个公开的秘密了。从心理学家到管理大师,他们都一直在建议使用外界的杂音来让自己放松并专注于工作。我不打算就此进行辩论,因为这对于我确实有效。我戴上耳机,然后倾听着鸟叫声和风声,这确实让我很放松。 在Linux中,我使用ANoise播放器来播放外界的杂音。多亏了官方提供的PPA,你可以很容易地[安装Ambient Noise播放器到Ubuntu中](/article-5233-1.html),以及其它基于Ubuntu的Linux发行版中。安装它,也可以让它离线播放外界的音乐。 另外,你也总可以在线听外界杂音。我最喜欢的在线外界音乐站点是[Noisli](http://www.noisli.com/)。强烈推荐你试试这个。 #### 任务管理应用 ![](/data/attachment/album/201510/18/103104x3v3cdc3xclgytxc.jpg) 一个良好的生产习惯,就是制订一个任务列表。如果你将它和[番茄工作法](https://en.wikipedia.org/wiki/Pomodoro_Technique)组合使用,那就可能创造奇迹了。这里我所说的是,创建一个任务列表,如果可能,将这些任务分配到特定的某个时间。这将会帮助你跟踪一天中计划好的任务。 对于此,我推荐[Go For It!](http://manuel-kehl.de/projects/go-for-it/)应用。你可以将它安装到所有主流Linux发行版中,由于它基于[ToDo.txt](http://todotxt.com/),你也可以很容易地同步到你的智能手机中。我已经为此写了一个详尽的指南[如何使用Go For It!](/article-5337-1.html)。 此外,你可以使用[Sticky Notes](http://itsfoss.com/indicator-stickynotes-windows-like-sticky-note-app-for-ubuntu/)或者[Google Keep](/article-2634-1.html)。如果你需要某些更类似[Evernote](https://evernote.com/)的功能,你可以使用这些[Evernote的开源替代品](http://itsfoss.com/5-evernote-alternatives-linux/)。 #### 剪贴板管理器 ![](/data/attachment/album/201510/18/103105cvpnm10ecjf1wm0a.jpg) Ctrl+ C和Ctrl+V是我们日常计算机生活中不可缺少的一部分,它们唯一的不足之处在于,这些重要的活动不会被记住(默认情况下)。假如你拷贝了一些重要的东西,然后你意外地又拷贝了一些其它东西,你将丢失先前拷贝的东西。 剪贴板管理器在这种情况下会派上用场,它可以显示你最近拷贝(到剪贴板的)内容的历史记录,你可以从它这里将文本拷贝回到剪贴板中。 对于该目的,我更偏好[Diodon剪贴板管理器](https://esite.ch/tag/diodon/)。它处于活跃开发中,并且在Ubuntu的仓库中可以得到它。 #### 最近通知 ![](/data/attachment/album/201510/18/103108l0v0azvnd2av6xg2.jpg) 如果你正忙着处理其它事情,而此时一个桌面通知闪了出来又逐渐消失了,你会怎么做?你会想要看看通知都说了什么,不是吗?最近通知指示器就是用于处理此项工作,它会保留一个最近所有通知的历史记录。这样,你就永远不会错过桌面通知了。 你可以在此阅读[最近通知指示器](http://itsfoss.com/7-best-indicator-applets-for-ubuntu-13-10/)。 #### 终端技巧 ![](/data/attachment/album/201510/18/103108eycrzyt6tddacy66.png) 不,我不打算给你们展示所有那些Linux命令技巧和快捷方法,那会写满整个博客了。我打算给你们展示一些终端黑技巧,你可以用它们来提高你的生产力。 * **修改**sudo**密码超时**:默认情况下,sudo命令要求你在15分钟后再次输入密码,这真是让人讨厌。实际上,你可以修改默认的sudo密码超时。[此教程](http://itsfoss.com/change-sudo-password-timeout-ubuntu/)会给你展示如何来实现。 * **获取命令完成的桌面通知**:这是IT朋友们之间的一个常见的玩笑——开发者们花费大量时间来等待程序编译完成——然而这不完全是正确的。但是,它确实影响到了生产力,因为在你等待程序编译完成时,你可以做其它事情,并忘了你在终端中运行的命令。一个更好的途径,就是在一个命令完成时,让它显示桌面通知。这样,你就不会长时间被打断,并且可以回到之前想要做的事情上。请阅读[如何获取命令完成的桌面通知](http://itsfoss.com/notification-terminal-command-completion-ubuntu/)。 我知道,这不是一篇全面涵盖了**提升生产力**的文章。但是,这些小应用和小技巧可以在实际生活中帮助你在你宝贵的时间中做得更多。 现在,该轮到你们了。在Linux中,你使用了什么程序或者技巧来提高生产力呢?有哪些东西你想要和社区分享呢? --- via: <http://itsfoss.com/productivity-tips-ubuntu/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[GOLinux](https://github.com/GOLinux) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,427
Linux 4.3 内核增加了 MOST 驱动子系统
http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.3-Staging-Pull
2015-10-19T09:03:06
[ "内核", "Linux" ]
https://linux.cn/article-6427-1.html
当 4.2 内核还没有正式发布的时候,Greg Kroah-Hartman 就为他维护的各种子系统模块打开了4.3 的合并窗口。 之前 Greg KH 发起的<ruby> 拉取请求 <rp> ( </rp> <rt> pull request </rt> <rp> ) </rp></ruby>里包含了 linux 4.3 的合并窗口更新,内容涉及驱动核心、TTY/串口、USB 驱动、字符/杂项以及暂存区内容。这些拉取申请没有提供任何震撼性的改变,大部分都是改进/附加/修改bug。暂存区内容又是大量的修正和清理,但是还是有一个新的驱动子系统。 Greg 提到了[4.3 的暂存区改变](http://lkml.iu.edu/hypermail/linux/kernel/1508.2/02604.html),“这里的很多东西,几乎全部都是细小的修改和改变。通常的 IIO 更新和新驱动,以及我们已经添加了的 MOST 驱动子系统,已经在源码树里整理了。ozwpan 驱动最终还是被删掉,因为它很明显被废弃了而且也没有人关心它。” MOST 驱动子系统是<ruby> 面向媒体的系统传输 <rp> ( </rp> <rt> Media Oriented Systems Transport </rt> <rp> ) </rp></ruby>的简称。在 linux 4.3 新增的文档里面解释道,“MOST 驱动支持 LInux 应用程序访问 MOST 网络:<ruby> 汽车信息骨干网 <rp> ( </rp> <rt> Automotive Information Backbone </rt> <rp> ) </rp></ruby>,高速汽车多媒体网络的事实上的标准。MOST 定义了必要的协议、硬件和软件层,提供高效且低消耗的传输控制,实时的数据包传输,而只需要使用一个媒介(物理层)。目前使用的媒介是光线、非屏蔽双绞线(UTP)和同轴电缆。MOST 也支持多种传输速度,最高支持150Mbps。”如文档解释的,MOST 主要是关于 Linux 在汽车上的应用。 ![](/data/attachment/album/201510/19/090310f4t29qffa73az27a.jpg) 当 Greg KH 发出了他为 Linux 4.3 多个子系统做出的更新,但是他还没有打算提交 [KDBUS](http://www.phoronix.com/scan.php?page=search&q=KDBUS) 的内核代码。他之前已经放出了 [linux 4.3 的 KDBUS] 的开发计划,所以我们将需要等待官方的4.3 合并窗口,看看会发生什么。 --- via: <http://www.phoronix.com/scan.php?page=news_item&px=Linux-4.3-Staging-Pull> 作者:[Michael Larabel](http://www.michaellarabel.com/) 译者:[oska874](https://github.com/oska874) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,428
Larry Wall 专访——语言学、Perl 6 的设计和发布
http://www.linuxvoice.com/interview-larry-wall/
2015-10-20T08:00:00
[ "Perl", "Perl 6", "Larry Wall" ]
https://linux.cn/article-6428-1.html
> > 经历了15年的打造,Perl 6 终将在年底与大家见面。我们预先采访了它的作者了解一下新特性。 > > > Larry Wall 是个相当有趣的人。他是编程语言 Perl 的创造者,这种语言被广泛的誉为将互联网粘在一起的胶水,也由于大量地在各种地方使用非字母的符号被嘲笑为‘只写’语言——以难以阅读著称。Larry 本人具有语言学背景,以其介绍 Perl 未来发展的演讲“<ruby> <a href="https://en.wikipedia.org/wiki/Perl#State_of_the_Onion"> 洋葱的状态 </a> <rp> ( </rp> <rt> State of the Onion </rt> <rp> ) </rp></ruby>”而闻名。(LCTT 译注:“洋葱的状态”是 Larry Wall 的年度演讲的主题,洋葱也是 Perl 基金会的标志。) 在2015年布鲁塞尔的 FOSDEM 上,我们赶上了 Larry,问了问他为什么 Perl 6 花了如此长的时间(Perl 5 的发布时间是1994年),了解当项目中的每个人都各执己见时是多么的难以管理,以及他的语言学背景自始至终究竟给 Perl 带来了怎样的影响。做好准备,让我们来领略其中的奥妙…… ![](/data/attachment/album/201510/19/231000ff1l2z1tloo7w8al.jpg) **Linux Voice:你曾经有过计划去寻找世界上某个地方的某种不见经传的语言,然后为它创造书写的文字,但你从未有机会去实现它。如果你能回到过去,你会去做么?** Larry Wall:你首先得是个年轻人才能搞得定!做这些事需要投入很大的努力和人力,以至于已经不适合那些上了年纪的人了。健康、活力是其中的一部分,同样也因为人们在年轻的时候更容易学习一门新的语言,只有在你学会了语言之后你才能写呀。 我自学了日语十年,由于我的音系学和语音学的训练我能说的比较流利——但要理解别人的意思对我来说还十分困难。所以到了日本我会问路,但我听不懂他们的回答! 通常需要一门语言学习得足够好才能开发一个文字体系,并可以使用这种语言进行少量的交流。在你能够实际推广它和用本土人自己的文化教育他们前,那还需要一些年。最后才可以教授本土人如何以他们的文明书写。 当然如果在语言方面你有帮手 —— 经过别人的提醒我们不再使用“语言线人”来称呼他们了,那样显得我们像是在 CIA 工作的一样!—— 你可以通过他们的帮助来学习外语。他们不是老师,但他们会以另一种方式来启发你学习 —— 当然他们也能教你如何说。他们会拿着一根棍子,指着它说“这是一根棍子”,然后丢掉同时说“棒子掉下去了”。然后,你就可以记下一些东西并将其系统化。 大多数让人们有这样做的动力是翻译圣经。但是这只是其中的一方面;另一方面也是为了文化保护。传教士在这方面臭名昭著,因为人类学家认为人们应该基于自己的文明来做这件事。但有些人注定会改变他们的文化——他们可能是军队、或是商业侵入,如可口可乐或者缝纫机,或传教士。在这三者之间,传教士相对来讲伤害最小的了,如果他们恪守本职的话。 **LV:许多文字系统有本可依,相较而言你的发明就像是格林兰语…** 印第安人照搬字母就发明了他们自己的语言,而且没有在这些字母上施加太多我们给这些字母赋予的涵义,这种做法相当随性。它们只要能够表达出人们的所思所想,使交流顺畅就行。经常是有些<ruby> 声调语言 <rp> ( </rp> <rt> Tonal language </rt> <rp> ) </rp></ruby>使用的是西方文字拼写,并尽可能的使用拉丁文的字符变化,然后用重音符或数字标注出音调。 在你开始学习如何使用语音和语调表示之后,你也开始变得迷糊——或者你的书写就不如从前准确。或者你对话的时候像在讲英文,但发音开始无法匹配拼写。 **LV:当你在开发 Perl 的时候,你的语言学背景会不会使你认为:“这对程序设计语言真的非常重要”?** LW:我在人们是如何使用语言上想了很多。在现实的语言中,你有一套名词、动词和形容词的体系,并且你知道这些单词的词性。在现实的自然语言中,你时常将一个单词放到不同的位置。我所学的语言学理论也被称为<ruby> 法位学 <rp> ( </rp> <rt> phoenetic </rt> <rp> ) </rp></ruby>,它解释了这些在自然语言中工作的原理 —— 也就是有些你当做名词的东西,有时候你可以将它用作动词,并且人们总是这样做。 你能很好的将任何单词放在任何位置而进行沟通。我比较喜欢的例子是将一个整句用作为一个形容词。这句话会是这样的:“我不喜欢你的[我可以用任何东西来取代这个形容词的]态度”! 所以自然语言非常灵活,因为聆听者非常聪明 —— 至少,相对于电脑而言 —— 你相信他们会理解你最想表达的意思,即使存在歧义。当然对电脑而言,你必须保证歧义不大。 > > “在 Perl 6 中,我们试图让电脑更准确的了解我们。” > > > 可以说在 Perl 1到5上,我们针对歧义方面处理做得还不够。有时电脑会在不应该的时候迷惑。在 Perl 6上,我们找了许多方法,使得电脑对你所说的话能更准确的理解,就算用户并不清楚这底是字符串还是数字,电脑也能准确的知道它的类型。我们找到了内部以强类型存储,而仍然可以无视类型的“以此即彼”的方法。 ![](/data/attachment/album/201510/19/231001t9t9r6z92l08s9zb.jpg) **LV:Perl 被视作互联网上的“<ruby> 胶水 <rp> ( </rp> <rt> glue </rt> <rp> ) </rp></ruby>”语言已久,能将点点滴滴组合在一起。在你看来 Perl 6 的发布是否符合当前用户的需要,或者旨在招揽更多新用户,能使它重获新生吗?** LW:最初的设想是为 Perl 程序员带来更好的 Perl。但在看到了 Perl 5 上的不足后,很明显改掉这些不足会使 Perl 6更易用,就像我在讨论中提到过 —— 类似于 [托尔金(J. R. R. Tolkien) 在《指环王》前言中谈到的适用性一样](http://tinyurl.com/nhpr8g2)。 重点是“简单的东西应该简单,而困难的东西应该可以实现”。让我们回顾一下,在 Perl 2和3之间的那段时间。在 Perl 2上我们不能处理二进制数据或嵌入的 null 值 —— 只支持 C 语言风格的字符串。我曾说过“Perl 只是文本处理语言 —— 在文本处理语言里你并不需要这些功能”。 但当时发生了一大堆的问题,因为大多数的文本中会包含少量的二进制数据 —— 如<ruby> 网络地址 <rp> ( </rp> <rt> network addresses </rt> <rp> ) </rp></ruby>及类似的东西。你使用二进制数据打开套接字,然后处理文本。所以通过支持二进制数据,语言的<ruby> 适用性 <rp> ( </rp> <rt> applicability </rt> <rp> ) </rp></ruby>翻了一倍。 这让我们开始探讨在语言中什么应该简单。现在的 Perl 中有一条原则,是我们偷师了<ruby> 哈夫曼编码 <rp> ( </rp> <rt> Huffman coding </rt> <rp> ) </rp></ruby>的做法,它在位编码系统中为字符采取了不同的尺寸,常用的字符占用的位数较少,不常用的字符占用的位数更多。 我们偷师了这种想法并将它作为 Perl 的一般原则,针对常用的或者说常输入的 —— 这些常用的东西必须简单或简洁。不过,另一方面,也显得更加的<ruby> 不规则 <rp> ( </rp> <rt> irregular </rt> <rp> ) </rp></ruby>。在自然语言中也是这样的,最常用的动词实际上往往是最不规则的。 所以在这样的情况下需要更多的差异存在。我很喜欢的一本书是 Umberto Eco 写的《<ruby> 探寻完美的语言 <rp> ( </rp> <rt> The Search for the Perfect Language </rt> <rp> ) </rp></ruby>》,说的并不是计算机语言;而是哲学语言,大体的意思是古代的语言也许是完美的,我们应该将它们带回来。 所有的这类语言错误的认为类似的事物其编码也应该总是类似的。但这并不是我们沟通的方式。如果你的农场中有许多动物,他们都有相近的名字,当你想杀一只鸡的时候说“走,去把 Blerfoo 宰了”,你的真实想法是宰了 Blerfee,但有可能最后死的是一头牛(LCTT 译注:这是杀鸡用牛刀的意思吗?哈哈)。 所以在这种时候我们其实更需要好好的将单词区分开,使沟通信道的冗余增加。常用的单词应该有更多的差异。为了达到更有效的通讯,还有一种自足(LCTT 译注:self-clocking ,自同步,[概念](http://en.wikipedia.org/wiki/Self-clocking_signal)来自电信和电子行业,此处译为“自足”更能体现涵义)编码。如果你在一个货物上看到过 UPC 标签(条形码),它就是一个自足编码,每对“条”和“空”总是以七个列宽为单位,据此你就知道“条”的宽度加起来总是这么宽。这就是自足。 在电子产品中还有另一种自足编码。在老式的串行传输协议中有停止和启动位,来保持同步。自然语言中也会包含这些。比如说,在写日语时,不用使用空格。由于书写方式的原因,他们会在每个词组的开头使用中文中的汉字字符,然后用<ruby> 音节表 <rp> ( </rp> <rt> syllabary </rt> <rp> ) </rp></ruby>中的字符来结尾。 **LV:是平假名,对吗?** LW: 是的,平假名。所以在这一系统,每个词组的开头就自然就很重要了。同样的,在古希腊,大多数的动词都是搭配好的(declined 或 conjugated),所以它们的标准结尾是一种自足机制。在他们的书写体系中空格也是可有可无的 —— 引入空格是更近代的发明。 所以在计算机语言上也要如此,有的值也可以自足编码。在 Perl 上我们重度依赖这种方法,而且在 Perl 6 上相较于前几代这种依赖更重。当你使用表达式时,你要么得到的是一个词,要么得到的是<ruby> 插值 <rp> ( </rp> <rt> infix </rt> <rp> ) </rp></ruby>操作符。当你想要得到一个词,你有可能得到的是一个前缀操作符,它也在相同的位置;同样当你想要得到一个插值操作符,你也可能得到的是前一个词的后缀。 但是反过来。如果编译器准确的知道它想要什么,你可以稍微<ruby> 重载 <rp> ( </rp> <rt> overload </rt> <rp> ) </rp></ruby>它们,其它的让 Perl 来完成。所以在斜线“/”后面是单词时它会当成正则表达式,而斜线“/”在字串中时视作除法。而我们并不会重载所有东西,因为那只会使你失去自足冗余。 多数情况下我们提示的比较好的语法错误消息,是出于发现了一行中出现了两个关键词,然后我们尝试找出为什么一行会出现两个关键字 —— “哦,你一定漏掉了上一行的分号”,所以我们相较于很多其他的按步照班的解析器可以生成更好的错误消息。 ![](/data/attachment/album/201510/19/231002lm4w4rvzwvzu6cvr.jpg) **LV:为什么 Perl 6 花了15年?当每个人对事物有不同看法时一定十分难于管理,而且正确和错误并不是绝对的。** LW:这必须要非常小心地平衡。刚开始会有许多的好的想法 —— 好吧,我并不是说那些全是好的想法。也有很多令人烦恼的地方,就像有361条 RFC [功能建议文件],而我也许只想要20条。我们需要坐下来,将它们全部看完,并忽略其中的解决方案,因为它们通常流于表象、视野狭隘。几乎每一条只针对一样事物,如若我们将它们全部拼凑起来,那简直是一堆垃圾。 > > “掌握平衡时需要格外小心。毕竟在刚开始的时候总会有许多的好主意。” > > > 所以我们必须基于人们在使用 Perl 5 时的真实感受重新整理,寻找统一、深层的解决方案。这些 RFC 文档许多都提到了一个事实,就是类型系统的不足。通过引入更条理分明的类型系统,我们可以解决很多问题并且即聪明又紧凑。 同时我们开始关注其他方面:如何统一特征集并开始重用不同领域的想法,这并不需要它们在下层相同。我们有一种标准的书写<ruby> 配对 <rp> ( </rp> <rt> pair </rt> <rp> ) </rp></ruby>的方式——好吧,在 Perl 里面有两种!但使用冒号书写配对的方法同样可以用于基数计数法或是任何进制的文本编号。同样也可以用于其他形式的<ruby> 引用 <rp> ( </rp> <rt> quoting </rt> <rp> ) </rp></ruby>。在 Perl 里我们称它为“奇妙的一致”。 > > “做了 Perl 6 的早期实现的朋友们,握着我的手说:“我们真的很需要一位语言的设计者。”” > > > 同样的想法涌现出来,你说“我已经熟悉了语法如何运作,但是我看见它也被用在别处”,所以说视角相同才能找出这种一致。那些提出各种想法和做了 Perl 6 的早期实现的人们回来看我,握着我的手说:“我们真的需要一位语言的设计者。您能作为我们的<ruby> <a href="https://en.wikipedia.org/wiki/Benevolent_dictator_for_life"> 仁慈独裁者 </a> <rp> ( </rp> <rt> benevolent dictator </rt> <rp> ) </rp></ruby>吗?”(LCTT 译注:Benevolent Dictator For Life,或 BDFL,指开源领袖,通常指对社区争议拥有最终裁决权的领袖,典故来自 Python 创始人 Guido van Rossum, 具体参考维基条目[解释](https://en.wikipedia.org/wiki/Benevolent_dictator_for_life))。 所以我是语言的设计者,但总是听到:“不要管具体<ruby> 实现 <rp> ( </rp> <rt> implementation </rt> <rp> ) </rp></ruby>!我们目睹了你对 Perl 5 做的那些,我们不想历史重演!”真是让我忍俊不禁,因为他们作为起步的核心和原先 Perl 5 的内部结构上几乎别无二致,也许这就是为什么一些早期的实现做的并不好的原因。 因为我们仍然在摸索我们的整个设计,其实现在做了许多 VM (虚拟机)该做什么和不该做什么的假设,所以最终这个东西就像面向对象的汇编语言一样。类似的问题在伊始阶段无处不在。然后 Pugs 这家伙走过来说:“用用看 Haskell 吧,它能让你们清醒的认识自己正在干什么,让我们用它来弄清楚下层的<ruby> 语义模型 <rp> ( </rp> <rt> semantic model </rt> <rp> ) </rp></ruby>。” 因此,我们明确了其中的一些语义模型,但更重要的是,我们开始建立符合那些语义模型的测试套件。在这之后,Parrot VM 继续进行开发,并且出现了另一个实现 Niecza ,它基于 .Net,是由一个年轻的家伙搞出来的。他很聪明,实现了 Perl 6 的一个很大的子集。不过他还是一个人干,并没有找到什么好方法让别人介入他的项目。 同时 Parrot 项目变得过于庞大,以至于任何人都不能真正的深入掌控它,并且很难重构。同时,开发 Rakudo 的人们觉得我们可能需要在更多平台上运行它,而不只是在 Parrot VM 上。 于是他们发明了所谓的可移植层 NQP ,即 “Not Quite Perl”。他们一开始将它移植到 JVM(Java虚拟机)上运行,与此同时,他们还秘密的开发了一个叫做 MoarVM 的 VM ,它去年才刚刚为人知晓。 无论 MoarVM 还是 JVM 在<ruby> 回归测试 <rp> ( </rp> <rt> regression test </rt> <rp> ) </rp></ruby>中表现得十分接近 —— 在许多方面 Parrot 算是尾随其后。这样不挑剔 VM 真的很棒,我们也能开始考虑将 NQP 发扬光大。<ruby> 谷歌夏季编码大赛 <rp> ( </rp> <rt> Google Summer of Code project </rt> <rp> ) </rp></ruby>的目标就是针对 JavaScript 的 NQP,这应该靠谱,因为 MoarVM 也同样使用 Node.js 作为日常处理。 我们可能要将今年余下的时光投在 MoarVM 上,直到 6.0 发布,方可休息片刻。 **LV:去年英国,政府开展<ruby> 编程年活动 <rp> ( </rp> <rt> Year of Code </rt> <rp> ) </rp></ruby>,来激发年轻人对编程的兴趣。针对活动的建议五花八门——类似为了让人们准确的认识到内存的使用你是否应该从低阶语言开始讲授,或是一门高阶语言。你对此作何看法?** LW:到现在为止,Python 社区在低阶方面的教学工作做得比我们要好。我们也很想在这一方面做点什么,这也是我们有蝴蝶 logo 的部分原因,以此来吸引七岁大小的女孩子! ![Perl 6 : Camelia](/data/attachment/album/201510/19/231006ycxctieklmkevthk.png) > > “到现在为止,Python 社区在低阶方面的教学工作做得比我们要好。” > > > 我们认为将 Perl 6 作为第一门语言来学习是可行的。一大堆的将 Perl 5 作为第一门语言学习的人让我们吃惊。你知道,在 Perl 5 中有许多相当大的概念,如闭包,词法范围,和一些你通常在函数式编程中见到的特性。甚至在 Perl 6 中更是如此。 Perl 6 花了这么长时间的部分原因是我们尝试去坚持将近 50 种互不相同的原则,在设计语言的最后对于“哪点是最重要的规则”这个问题还是悬而未决。有太多的问题需要讨论。有时我们做出了决定,并已经工作了一段时间,才发现这个决定并不很正确。 之前我们并未针对并发程序设计或指定很多东西,直到 Jonathan Worthington 的出现,他非常巧妙的权衡了各个方面。他结合了一些其他语言诸如 Go 和 C# 的想法,将并发原语写的非常好。<ruby> 可组合性 <rp> ( </rp> <rt> Composability </rt> <rp> ) </rp></ruby>是一个语言至关重要的一部分。 有很多的程序设计系统的并发和并行写的并不好 —— 比如线程和锁,不良的操作方式有很多。所以在我看来,额外花点时间看一下 Go 或者 C# 这种高阶原语的开发是很值得的 —— 那是一种关键字上的矛盾 —— 写的相当棒。 --- via: <http://www.linuxvoice.com/interview-larry-wall/> 作者:[Mike Saunders](http://www.linuxvoice.com/author/mike/) 译者:[martin2011qi](https://github.com/martin2011qi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
500
Internal Server Error
null
6,445
Let's Encrypt 已被所有主流浏览器所信任
https://letsencrypt.org/2015/10/19/lets-encrypt-is-trusted.html
2015-10-21T19:35:53
[ "Let’s Encrypt", "HTTPS" ]
https://linux.cn/article-6445-1.html
旨在让每个网站都能使用 HTTPS 加密的非赢利组织 Let’s Encrypt 已经得了 [IdenTrust](https://identrustssl.com/) 的交叉签名,这意味着其证书现在已经可以被所有主流的浏览器所信任。从这个里程碑事件开始,访问者访问使用了 Let’s Encrypt 证书的网站不再需要特别配置就可以得到 HTTPS 安全保护了。 ![](/data/attachment/album/201510/21/193557zacu8jp6xu9jxppj.png) Let’s Encrypt 的两个中级证书 Let’s Encrypt Authority X1 和 Let’s Encrypt Authority X2 得到了交叉签名。Web 服务器需要在证书链中配置交叉签名,客户端会自动处理好其它的一切。 你现在可以[在此](https://helloworld.letsencrypt.org/)体验一下使用新的交叉签名的中级证书所签发证书的服务器。 ![https://helloworld.letsencrypt.org/](/data/attachment/album/201510/21/192558yf9wg9uglwfyg969.jpg) 越来越多的重要的个人和商业信息在互联网上传递着,对它们的加密需求也越来越迫切。这就是创建 Let’s Encrypt 的目的,这次迈进的一大步将会把安全连接带到 web 世界的每一个角落。 Let’s Encrypt 项目获得了 Mozilla、思科、Akamai、IdenTrust 和 EFF 等组织的支持,由 Linux 基金会托管。它在9月中旬颁发了第一个证书,计划于11月16日向公众开放免费签名服务。
200
OK
null
6,448
在 Linux 下使用 RAID(八):当软件 RAID 故障时如何恢复和重建数据
http://www.tecmint.com/recover-data-and-rebuild-failed-software-raid/
2015-10-22T08:03:00
[ "RAID" ]
https://linux.cn/article-6448-1.html
在阅读过 [RAID 系列](/article-6085-1.html) 前面的文章后你已经对 RAID 比较熟悉了。回顾前面几个软件 RAID 的配置,我们对每一个都做了详细的解释,使用哪一个取决与你的具体情况。 ![Recover Rebuild Failed Software RAID's](/data/attachment/album/201510/21/220530txqez0qxqzv3iqpe.png) *恢复并重建故障的软件 RAID - 第8部分* 在本文中,我们将讨论当一个磁盘发生故障时如何重建软件 RAID 阵列并且不会丢失数据。为方便起见,我们仅考虑RAID 1 的配置 - 但其方法和概念适用于所有情况。 #### RAID 测试方案 在进一步讨论之前,请确保你已经配置好了 RAID 1 阵列,可以按照本系列第3部分提供的方法:[在 Linux 中如何创建 RAID 1(镜像)](/article-6093-1.html)。 在目前的情况下,仅有的变化是: 1. 使用不同版本 CentOS(v7),而不是前面文章中的(v6.5)。 2. 磁盘容量发生改变, /dev/sdb 和 /dev/sdc(各8GB)。 此外,如果 SELinux 设置为 enforcing 模式,你需要将相应的标签添加到挂载 RAID 设备的目录中。否则,当你试图挂载时,你会碰到这样的警告信息: ![SELinux RAID Mount Error](/data/attachment/album/201510/21/220530i228220gdy5zpj7v.png) *启用 SELinux 时 RAID 挂载错误* 通过以下命令来解决: ``` # restorecon -R /mnt/raid1 ``` ### 配置 RAID 监控 存储设备损坏的原因很多(尽管固态硬盘大大减少了这种情况发生的可能性),但不管是什么原因,可以肯定问题随时可能发生,你需要准备好替换发生故障的部分,并确保数据的可用性和完整性。 首先建议是。虽然你可以查看 `/proc/mdstat` 来检查 RAID 的状态,但有一个更好的和节省时间的方法,使用监控 + 扫描模式运行 mdadm,它将警报通过电子邮件发送到一个预定义的收件人。 要这样设置,在 `/etc/mdadm.conf` 添加以下行: ``` MAILADDR user@<domain or localhost> ``` 我自己的设置如下: ``` MAILADDR gacanepa@localhost ``` ![RAID Monitoring Email Alerts](/data/attachment/album/201510/21/220531o48bcu84uussjoow.png) *监控 RAID 并使用电子邮件进行报警* 要让 mdadm 运行在监控 + 扫描模式中,以 root 用户添加以下 crontab 条目: ``` @reboot /sbin/mdadm --monitor --scan --oneshot ``` 默认情况下,mdadm 每隔60秒会检查 RAID 阵列,如果发现问题将发出警报。你可以通过添加 `--delay` 选项到crontab 条目上面,后面跟上秒数,来修改默认行为(例如,`--delay` 1800意味着30分钟)。 最后,确保你已经安装了一个邮件用户代理(MUA),如[mutt 或 mailx](http://www.tecmint.com/send-mail-from-command-line-using-mutt-command/)。否则,你将不会收到任何警报。 在一分钟内,我们就会看到 mdadm 发送的警报。 ### 模拟和更换发生故障的 RAID 存储设备 为了给 RAID 阵列中的存储设备模拟一个故障,我们将使用 `--manage` 和 `--set-faulty` 选项,如下所示: ``` # mdadm --manage --set-faulty /dev/md0 /dev/sdc1 ``` 这将导致 /dev/sdc1 被标记为 faulty,我们可以在 /proc/mdstat 看到: ![Stimulate Issue with RAID Storage](/data/attachment/album/201510/21/220532wgrcgnf4bontrgcj.png) *在 RAID 存储设备上模拟问题* 更重要的是,让我们看看是不是收到了同样的警报邮件: ![Email Alert on Failed RAID Device](/data/attachment/album/201510/21/220539bq20doix82juz702.png) *RAID 设备故障时发送邮件警报* 在这种情况下,你需要从软件 RAID 阵列中删除该设备: ``` # mdadm /dev/md0 --remove /dev/sdc1 ``` 然后,你可以直接从机器中取出,并将其使用备用设备来取代(/dev/sdd 中类型为 fd 的分区是以前创建的): ``` # mdadm --manage /dev/md0 --add /dev/sdd1 ``` 幸运的是,该系统会使用我们刚才添加的磁盘自动重建阵列。我们可以通过标记 /dev/sdb1 为 faulty 来进行测试,从阵列中取出后,并确认 tecmint.txt 文件仍然在 /mnt/raid1 是可访问的: ``` # mdadm --detail /dev/md0 # mount | grep raid1 # ls -l /mnt/raid1 | grep tecmint # cat /mnt/raid1/tecmint.txt ``` ![Confirm Rebuilding RAID Array](/data/attachment/album/201510/21/220544z2caprz2rshh8apm.png) *确认 RAID 重建* 上面图片清楚的显示,添加 /dev/sdd1 到阵列中来替代 /dev/sdc1,数据的重建是系统自动完成的,不需要干预。 虽然要求不是很严格,有一个备用设备是个好主意,这样更换故障的设备就可以在瞬间完成了。要做到这一点,先让我们重新添加 /dev/sdb1 和 /dev/sdc1: ``` # mdadm --manage /dev/md0 --add /dev/sdb1 # mdadm --manage /dev/md0 --add /dev/sdc1 ``` ![Replace Failed Raid Device](/data/attachment/album/201510/21/220550c1ttlm6xe9e8tzj2.png) *取代故障的 Raid 设备* ### 从冗余丢失中恢复数据 如前所述,当一个磁盘发生故障时, mdadm 将自动重建数据。但是,如果阵列中的2个磁盘都故障时会发生什么?让我们来模拟这种情况,通过标记 /dev/sdb1 和 /dev/sdd1 为 faulty: ``` # umount /mnt/raid1 # mdadm --manage --set-faulty /dev/md0 /dev/sdb1 # mdadm --stop /dev/md0 # mdadm --manage --set-faulty /dev/md0 /dev/sdd1 ``` 此时尝试以同样的方式重新创建阵列就(或使用 `--assume-clean` 选项)可能会导致数据丢失,因此不到万不得已不要使用。 让我们试着从 /dev/sdb1 恢复数据,例如,在一个类似的磁盘分区(/dev/sde1 - 注意,这需要你执行前在/dev/sde 上创建一个 fd 类型的分区)上使用 `ddrescue`: ``` # ddrescue -r 2 /dev/sdb1 /dev/sde1 ``` ![Recovering Raid Array](/data/attachment/album/201510/21/220553k26neoo162ewkuy1.png) *恢复 Raid 阵列* 请注意,到现在为止,我们还没有触及 /dev/sdb 和 /dev/sdd,它们的分区是 RAID 阵列的一部分。 现在,让我们使用 /dev/sde1 和 /dev/sdf1 来重建阵列: ``` # mdadm --create /dev/md0 --level=mirror --raid-devices=2 /dev/sd[e-f]1 ``` 请注意,在真实的情况下,你需要使用与原来的阵列中相同的设备名称,即设备失效后替换的磁盘的名称应该是 /dev/sdb1 和 /dev/sdc1。 在本文中,我选择了使用额外的设备来重新创建全新的磁盘阵列,是为了避免与原来的故障磁盘混淆。 当被问及是否继续写入阵列时,键入 Y,然后按 Enter。阵列被启动,你也可以查看它的进展: ``` # watch -n 1 cat /proc/mdstat ``` 当这个过程完成后,你就应该能够访问 RAID 的数据: ![Confirm Raid Content](/data/attachment/album/201510/21/220556czeliti301lkb1ee.png) *确认 Raid 数据* ### 总结 在本文中,我们回顾了从 RAID 故障和冗余丢失中恢复数据。但是,你要记住,这种技术是一种存储解决方案,不能取代备份。 本文中介绍的方法适用于所有 RAID 中,其中的概念我将在本系列的最后一篇(RAID 管理)中涵盖它。 如果你对本文有任何疑问,随时给我们以评论的形式说明。我们期待倾听阁下的心声! --- via: <http://www.tecmint.com/recover-data-and-rebuild-failed-software-raid/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,449
Linux 有问必答:如何在 Linux 中永久修改 USB 设备权限
http://ask.xmodulo.com/change-usb-device-permission-linux.html
2015-10-22T09:14:00
[ "USB", "udev" ]
/article-6449-1.html
> > **提问**:当我尝试在 Linux 中运行 USB GPS 接收器时我遇到了下面来自 gpsd 的错误。 > > > > ``` > gpsd[377]: gpsd:ERROR: read-only device open failed: Permission denied > gpsd[377]: gpsd:ERROR: /dev/ttyUSB0: device activation failed. > gpsd[377]: gpsd:ERROR: device open failed: Permission denied - retrying read-only > > ``` > > 看上去 gpsd 没有权限访问 USB 设备(/dev/ttyUSB0)。我该如何永久修改它在Linux上的权限? > > > ![](/data/attachment/album/201510/21/221907buuu7yy6ebay7r9b.png) 当你在运行一个会读取或者写入USB设备的进程时,进程的用户/组必须有权限这么做才行。当然你可以手动用`chmod`命令改变 USB 设备的权限,但是手动的权限改变只是暂时的。USB 设备会在下次重启时恢复它的默认权限。 ![](/data/attachment/album/201510/21/221921ukoi2kjbzm8irnom.jpg) 作为一个永久的方式,你可以创建一个基于 udev 的 USB 权限规则,它可以根据你的选择分配任何权限模式。下面是该如何做。 首先,你需要找出 USB 设备的 vendorID 和 productID。使用`lsusb`命令。 ``` $ lsusb -vvv ``` ![](/data/attachment/album/201510/21/221927xf9d70089b0idzbb.jpg) 上面`lsusb`的输出中,找出你的 USB 设备,并找出"idVendor"和"idProduct"字段。本例中,我们的结果是`idVendor (0x067b)`和 `idProduct (0x2303)` 下面创建一个新的udev规则。 ``` $ sudo vi /etc/udev/rules.d/50-myusb.rules ``` --- ``` SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", GROUP="users", MODE="0666" ``` 用你自己的"idVendor"和"idProduct"来替换。**MODE="0666"**表示USB设备的权限。 现在重启电脑并重新加载 udev 规则: ``` $ sudo udevadm control --reload ``` 接着验证下 USB 设备的权限。 ![](/data/attachment/album/201510/21/221928zdfdryz1tud01mfd.jpg) --- via: <http://ask.xmodulo.com/change-usb-device-permission-linux.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /change-usb-device-permission-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275812d0>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,450
如何在 Ubuntu 中设置 IonCube Loaders
http://linoxide.com/ubuntu-how-to/setup-ioncube-loaders-ubuntu-14-04-15-04/
2015-10-22T10:19:00
[ "PHP", "ionCube Loaders" ]
/article-6450-1.html
IonCube Loaders是一个PHP中用于加解密的工具,并带有加速页面运行的功能。它也可以保护你的PHP代码不会查看和运行在未授权的计算机上。要使用ionCube编码、加密的PHP文件,需要在web服务器上安装一个叫ionCube Loader的文件,并需要让 PHP 可以访问到,很多 PHP 应用都在用它。它可以在运行时读取并执行编码过后的代码。PHP只需在‘php.ini’中添加一行就可以使用这个loader。 ![](/data/attachment/album/201510/21/233055hi9wb1mxui9mu9r3.jpg) ### 前提条件 在这篇文章中,我们将在Ubuntu14.04/15.04安装Ioncube Loaders ,以便它可以在所有PHP模式中使用。本教程的唯一要求就是你系统安装了LEMP,并有“php.ini”文件。 ### 下载 IonCube Loader 根据你系统的架构是32位或者64位来下载最新的IonCube loader包。你可以用超级用户权限或者root用户运行下面的命令。 ``` # wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz ``` ![download ioncube](/data/attachment/album/201510/21/233122n66rbpdb1tdbpgeb.png) 下载完成后用下面的命令解压到“/usr/local/src/"。 ``` # tar -zxvf ioncube_loaders_lin_x86-64.tar.gz -C /usr/local/src/ ``` ![extracting archive](/data/attachment/album/201510/21/233123ixy4xf3nzjxjddnx.png) 解压完成后我们就可以看到所有提供的模块。但是我们只需要我们所安装的PHP版本的对应模块。 要检查PHP版本,你可以运行下面的命令来找出相应的模块。 ``` # php -v ``` ![ioncube modules](/data/attachment/album/201510/21/233123kh5x5h5k3sdhfehm.png) 根据上面的命令我们知道我们安装的是PHP 5.6.4,因此我们需要拷贝合适的模块到PHP模块目录下。 首先我们在“/usr/local/”创建一个叫“ioncube”的目录并复制所需的ioncube loader到这里。 ``` root@ubuntu-15:/usr/local/src/ioncube# mkdir /usr/local/ioncube root@ubuntu-15:/usr/local/src/ioncube# cp ioncube_loader_lin_5.6.so ioncube_loader_lin_5.6_ts.so /usr/local/ioncube/ ``` ### PHP 配置 我们要在位于"/etc/php5/cli/"文件夹下的"php.ini"中加入如下的配置行并重启web服务和php模块。 ``` # vim /etc/php5/cli/php.ini ``` ![ioncube zend extension](/data/attachment/album/201510/21/233124nkidkbm1vv1wkdmk.png) 此时我们安装的是nginx,因此我们用下面的命令来重启服务。 ``` # service php5-fpm restart # service nginx restart ``` ![web services](/data/attachment/album/201510/21/233124zuxx06ucguxx61z0.png) ### 测试 IonCube Loader 要为我们的网站测试ioncube loader。用下面的内容创建一个"info.php"文件并放在网站的web目录下。 ``` # vim /usr/share/nginx/html/info.php ``` 加入phpinfo的脚本后重启web服务后用域名或者ip地址访问“info.php”。 你会在最下面的php模块信息里看到下面这段。 ![php info](/data/attachment/album/201510/21/233125vbcu5c88wf0nkws5.png) 在终端中运行下面的命令来验证php版本并显示PHP Loader已经启用了。 ``` # php -v ``` ![php ioncube loader](/data/attachment/album/201510/21/233125ccebe5kezkcn3kek.png) 上面的php版本输出明显地显示了IonCube loader已经成功与PHP集成了。 ### 总结 教程的最后你已经了解了如何在安装有nginx的Ubuntu中安装和配置ionCube Loader,如果你正在使用其他的web服务,这与其他服务没有明显的差别。因此安装Loader是很简单的,并且在大多数服务器上的安装都不会有问题。然而并没有一个所谓的“标准PHP安装”,服务可以通过许多方式安装,并启用或者禁用功能。 如果你是在共享服务器上,那么确保运行了ioncube-loader-helper.php脚本,并点击链接来测试运行时安装。如果安装时你仍然遇到了问题,欢迎联系我们及给我们留下评论。 --- via: <http://linoxide.com/ubuntu-how-to/setup-ioncube-loaders-ubuntu-14-04-15-04/> 作者:[Kashif Siddique](http://linoxide.com/author/kashifs/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /ubuntu-how-to/setup-ioncube-loaders-ubuntu-14-04-15-04/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b8327581990>, 'Connection to linoxide.com timed out. (connect timeout=10)'))
null
6,451
RHCE 系列(一):如何设置和测试静态网络路由
http://www.tecmint.com/how-to-setup-and-configure-static-network-routing-in-rhel/
2015-10-22T12:37:00
[ "RHCE", "路由" ]
https://linux.cn/article-6451-1.html
RHCE(Red Hat Certified Engineer,红帽认证工程师)是红帽公司的一个认证,红帽向企业社区贡献开源操作系统和软件,同时它还给公司提供训练、支持和咨询服务。 ![RHCE 考试准备指南](/data/attachment/album/201510/22/123748megczmyifomw2yto.jpg) *RHCE 考试准备指南* 这个 RHCE 是一个绩效考试(代号 EX300),面向那些拥有更多的技能、知识和能力的红帽企业版 Linux(RHEL)系统高级系统管理员。 **重要**: 获得RHCE 认证前需要先有 <ruby> <a href="/article-6133-1.html"> 红帽认证系统管理员认证 </a> <rp> ( </rp> <rt> Red Hat Certified System Administrator,RHCSA </rt> <rp> ) </rp></ruby>。 以下是基于红帽企业版 Linux 7 考试的考试目标,我们会在该 RHCE 系列中分别介绍: * 第一部分:[如何在 RHEL 7 中设置和测试静态路由](/article-6451-1.html) * 第二部分:[如何进行包过滤、网络地址转换和设置内核运行时参数](/article-6458-1.html) * 第三部分:如何使用 Linux 工具集产生和发送系统活动报告 * 第四部分:使用 Shell 脚本进行自动化系统维护 * 第五部分:如何在 RHEL 7 中管理系统日志(配置、轮换和导入到数据库) * 第六部分:设置 Samba 服务器并配置 FirewallD 和 SELinux 支持客户端文件共享 * 第七部分:设置 NFS 服务器及基于 Kerberos 认证的客户端 * 第八部分:在 Apache 上使用网络安全服务(NSS)通过 TLS 提供 HTTPS 服务 * 第九部分:如何使用无客户端配置来设置 Postfix 邮件服务器(SMTP) * 第十部分:在 RHEL/CentOS 7 中设置网络时间协议(NTP)服务器 * 第十一部分:如何配置一个只缓存的 DNS 服务器 在你的国家查看考试费用和注册考试,可以到 [RHCE 认证](https://www.redhat.com/en/services/certification/rhce) 网页。 在 RHCE 的第一和第二部分,我们会介绍一些基本的但典型的情形,也就是静态路由原理、包过滤和网络地址转换。 ![在 RHEL 中设置静态网络路由](/data/attachment/album/201510/22/123749zusdyymdzdzbmtqz.jpg) *RHCE 系列第一部分:设置和测试网络静态路由* 请注意我们不会作深入的介绍,但以这种方式组织内容能帮助你开始第一步并继续后面的内容。 ### 红帽企业版 Linux 7 中的静态路由 现代网络的一个奇迹就是有很多可用设备能将一组计算机连接起来,不管是在一个房间里少量的机器还是在一栋建筑物、城市、国家或者大洲之间的多台机器。 然而,为了能在任意情形下有效的实现这些,需要对网络包进行路由,或者换句话说,它们从源到目的地的路径需要按照某种规则。 静态路由是为网络包指定一个路由的过程,而不是使用网络设备提供的默认网关。除非另有指定静态路由,网络包会被导向默认网关;而静态路由则基于预定义标准所定义的其它路径,例如数据包目的地。 我们在该篇指南中会考虑以下场景。我们有一台 RHEL 7,连接到 1号路由器 [192.168.0.1] 以访问因特网以及 192.168.0.0/24 中的其它机器。 第二个路由器(2号路由器)有两个网卡:enp0s3 同样连接到路由器1号以访问互联网,及与 RHEL 7 和同一网络中的其它机器通讯,另外一个网卡(enp0s8)用于授权访问内部服务所在的 10.0.0.0/24 网络,例如 web 或数据库服务器。 该场景可以用下面的示意图表示: ![静态路由网络示意图](/data/attachment/album/201510/22/123750fgsyjazjr3shzux5.png) *静态路由网络示意图* 在这篇文章中我们会集中介绍在 RHEL 7 中设置路由表,确保它能通过1号路由器访问因特网以及通过2号路由器访问内部网络。 在 RHEL 7 中,你可以通过命令行用 [ip 命令](http://www.tecmint.com/ip-command-examples/) 配置和显示设备和路由。这些更改能在运行的系统中及时生效,但由于重启后不会保存,我们会使用 `/etc/sysconfig/network-scripts` 目录下的 `ifcfg-enp0sX` 和 `route-enp0sX` 文件永久保存我们的配置。 首先,让我们打印出当前的路由表: ``` # ip route show ``` ![在 Linux 中检查路由表](/data/attachment/album/201510/22/123751mvm1bttqtfhfvt13.png) *检查当前路由表* 从上面的输出中,我们可以得出以下结论: * 默认网关的 IP 是 192.168.0.1,可以通过网卡 enp0s3 访问。 * 系统启动的时候,它启用了到 169.254.0.0/16 的 zeroconf 路由(只是在本例中)。也就是说,如果机器设置通过 DHCP 获取 IP 地址,但是由于某些原因失败了,它就会在上述网段中自动分配到一个地址。这一行的意思是,该路由会允许我们通过 enp0s3 和其它没有从 DHCP 服务器中成功获得 IP 地址的机器机器相连接。 * 最后,但同样重要的是,我们也可以通过 IP 地址是 192.168.0.18 的 enp0s3 与 192.168.0.0/24 网络中的其它机器连接。 下面是这样的配置中你需要做的一些典型任务。除非另有说明,下面的任务都在2号路由器上进行。 确保正确安装了所有网卡: ``` # ip link show ``` 如果有某块网卡停用了,启动它: ``` # ip link set dev enp0s8 up ``` 分配 10.0.0.0/24 网络中的一个 IP 地址给它: ``` # ip addr add 10.0.0.17 dev enp0s8 ``` 噢!我们分配了一个错误的 IP 地址。我们需要删除之前分配的那个并添加正确的地址(10.0.0.18): ``` # ip addr del 10.0.0.17 dev enp0s8 # ip addr add 10.0.0.18 dev enp0s8 ``` 现在,请注意你只能添加一个通过网关到目标网络的路由,网关需要可以访问到。因为这个原因,我们需要在 192.168.0.0/24 范围中给 enp0s3 分配一个 IP 地址,这样我们的 RHEL 7 才能连接到它: ``` # ip addr add 192.168.0.19 dev enp0s3 ``` 最后,我们需要启用包转发: ``` # echo "1" > /proc/sys/net/ipv4/ip_forward ``` 并停用/取消防火墙(从现在开始,直到下一篇文章中我们介绍了包过滤): ``` # systemctl stop firewalld # systemctl disable firewalld ``` 回到我们的 RHEL 7(192.168.0.18),让我们配置一个通过 192.168.0.19(2号路由器的 enp0s3)到 10.0.0.0/24 的路由: ``` # ip route add 10.0.0.0/24 via 192.168.0.19 ``` 之后,路由表看起来像下面这样: ``` # ip route show ``` ![显示网络路由表](/data/attachment/album/201510/22/123751znezexl1eddx0j51.png) *确认网络路由表* 同样,在你尝试连接的 10.0.0.0/24 网络的机器中添加对应的路由: ``` # ip route add 192.168.0.0/24 via 10.0.0.18 ``` 你可以使用 ping 测试基本连接: 在 RHEL 7 中运行: ``` # ping -c 4 10.0.0.20 ``` 10.0.0.20 是 10.0.0.0/24 网络中一个 web 服务器的 IP 地址。 在 web 服务器(10.0.0.20)中运行 ``` # ping -c 192.168.0.18 ``` 192.168.0.18 也就是我们的 RHEL 7 机器的 IP 地址。 另外,我们还可以使用 [tcpdump](http://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/)(需要通过 `yum install tcpdump` 安装)来检查我们 RHEL 7 和 10.0.0.20 中 web 服务器之间的 TCP 双向通信。 首先在第一台机器中启用日志: ``` # tcpdump -qnnvvv -i enp0s3 host 10.0.0.20 ``` 在同一个系统上的另一个终端,让我们通过 telnet 连接到 web 服务器的 80 号端口(假设 Apache 正在监听该端口;否则应在下面命令中使用正确的监听端口): ``` # telnet 10.0.0.20 80 ``` tcpdump 日志看起来像下面这样: ![检查服务器之间的网络连接](/data/attachment/album/201510/22/123752m3uuqld1cvf4k1qp.png) *检查服务器之间的网络连接* 通过查看我们 RHEL 7(192.168.0.18)和 web 服务器(10.0.0.20)之间的双向通信,可以看出已经正确地初始化了连接。 请注意你重启系统后会丢失这些更改。如果你想把它们永久保存下来,你需要在我们运行上面的命令的相同系统中编辑(如果不存在的话就创建)以下的文件。 尽管对于我们的测试例子不是严格要求,你需要知道 /etc/sysconfig/network 包含了一些系统范围的网络参数。一个典型的 `/etc/sysconfig/network` 看起来类似下面这样: ``` # Enable networking on this system? NETWORKING=yes # Hostname. Should match the value in /etc/hostname HOSTNAME=yourhostnamehere # Default gateway GATEWAY=XXX.XXX.XXX.XXX # Device used to connect to default gateway. Replace X with the appropriate number. GATEWAYDEV=enp0sX ``` 当需要为每个网卡设置特定的变量和值时(正如我们在2号路由器上面做的),你需要编辑 `/etc/sysconfig/network-scripts/ifcfg-enp0s3` 和 `/etc/sysconfig/network-scripts/ifcfg-enp0s8` 文件。 下面是我们的例子, ``` TYPE=Ethernet BOOTPROTO=static IPADDR=192.168.0.19 NETMASK=255.255.255.0 GATEWAY=192.168.0.1 NAME=enp0s3 ONBOOT=yes ``` 以及 ``` TYPE=Ethernet BOOTPROTO=static IPADDR=10.0.0.18 NETMASK=255.255.255.0 GATEWAY=10.0.0.1 NAME=enp0s8 ONBOOT=yes ``` 其分别对应 enp0s3 和 enp0s8。 由于要为我们的客户端机器(192.168.0.18)进行路由,我们需要编辑 `/etc/sysconfig/network-scripts/route-enp0s3`: ``` 10.0.0.0/24 via 192.168.0.19 dev enp0s3 ``` 现在`reboot`你的系统,就可以在路由表中看到该路由规则。 ### 总结 在这篇文章中我们介绍了红帽企业版 Linux 7 的静态路由。尽管场景可能不同,这里介绍的例子说明了所需的原理以及进行该任务的步骤。结束之前,我还建议你看一下 <ruby> <a href="http://www.tldp.org/"> Linux 文档项目 </a> <rp> ( </rp> <rt> The Linux Documentation Project </rt> <rp> ) </rp></ruby>网站上的《<ruby> <a href="http://www.tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/"> 安全加固和优化 Linux </a> <rp> ( </rp> <rt> Securing and Optimizing Linux </rt> <rp> ) </rp></ruby>》的[第四章](http://www.tldp.org/LDP/solrhe/Securing-Optimizing-Linux-RH-Edition-v1.3/net-manage.html),以了解这里介绍主题的更详细内容。 在下篇文章中我们会介绍数据包过滤和网络地址转换,结束 RHCE 验证需要的网络基本技巧。 如往常一样,我们期望听到你的回复,用下面的表格留下你的疑问、评论和建议吧。 --- via: <http://www.tecmint.com/how-to-setup-and-configure-static-network-routing-in-rhel/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](https://github.com/ictlyh) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,456
Mytodo:为 DIY 爱好者准备的待办事项管理软件
http://itsfoss.com/mytodo-list-manager/
2015-10-23T08:00:00
[ "TODO" ]
https://linux.cn/article-6456-1.html
![](/data/attachment/album/201510/22/233114lru8rre117e58nj7.jpg) 通常我关注的软件都是那些不用折腾并且易用的(对图形界面而言)。这就是我把 [Go For It](http://itsfoss.com/go-for-it-to-do-app-in-linux/) 待办事项程序归到 [Linux 产能工具](/article-6425-1.html) 列表的原因。今天,我要向你们展示另一款待办事项列表应用,和其它的待办事项软件有点不一样。 [Mytodo](https://github.com/mohamed-aziz/mytodo) 是个开源的待办事项列表程序,让你能够掌管一切。与其它类似的程序不同的是,Mytodo 更加面向 DIY 爱好者,因为它允许你配置服务器(如果你想在多台电脑上使用的话),除了主要的功能外还提供一个命令行界面。 它是用 Python 编写的,因此可以在所有 Linux 发行版以及其它操作系统,比如 Windows 上使用。 Mytodo 的一些主要特性: * 同时拥有图形界面和命令行界面 * 配置你自己的服务器 * 添加用户/密码 * Python 编写 * 可根据标签搜索 * 待办事项可以在 [Conky](http://itsfoss.com/conky-gui-ubuntu-1304/) 显示 ![](/data/attachment/album/201510/22/233116qwy02ws332806w63.jpg) *图形界面* ![](/data/attachment/album/201510/22/233118o89xyzex8l824y7w.jpg) *命令行* ![](/data/attachment/album/201510/22/233120z833x3rs134tr1zt.jpg) *Conky 显示着待办事项* 你可以在下面的 Github 链接里找到源码和配置介绍: * [下载和配置 Mytodo](https://github.com/mohamed-aziz/mytodo) 尽管有些人可能不大喜欢命令行和配置部分的内容,但它自然有它的乐趣所在。我建议你自己尝试一下,看看 Mytodo 是否符合我们的需求和口味。 图片致谢: <https://pixabay.com/en/to-do-list-task-list-notes-written-734587> --- via: <http://itsfoss.com/mytodo-list-manager/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,457
在 Ubuntu 和 Linux Mint 上安装 Terminator 0.98
http://www.ewikitech.com/articles/linux/terminator-install-ubuntu-linux-mint/
2015-10-23T13:49:00
[ "Terminator" ]
/article-6457-1.html
[Terminator](https://launchpad.net/terminator),它可以在一个窗口内打开多个终端。该项目的目标之一是为摆放终端提供一个有用的工具。它的灵感来自于类似 gnome-multi-term,quankonsole 等程序,这些程序关注于按网格摆放终端。 Terminator 0.98 带来了更完美的标签功能,更好的布局保存/恢复,改进了偏好用户界面和多处 bug 修复。 ![](/data/attachment/album/201510/22/235122i0ujhpwpqwy4hjl5.png) ### TERMINATOR 0.98 的更改和新特性 * 添加了一个布局启动器,允许在不用布局之间简单切换(用 Alt + L 打开一个新的布局切换器); * 添加了一个新的手册(使用 F1 打开); * 保存的时候,布局现在会记住: + 最大化和全屏状态 + 窗口标题 + 激活的标签 + 激活的终端 + 每个终端的工作目录 * 添加选项用于启用/停用<ruby> 非同类 <rp> ( </rp> <rt> non-homogenous </rt> <rp> ) </rp></ruby>标签和滚动箭头; * 添加快捷键用于按行/半页/一页向上/下滚动; * 添加使用 Ctrl+鼠标滚轮来放大/缩小,Shift+鼠标滚轮向上/下滚动页面; * 为下一个/上一个<ruby> 配置文件 <rp> ( </rp> <rt> profile </rt> <rp> ) </rp></ruby>添加快捷键 * 改进自定义命令菜单的一致性 * 新增快捷方式/代码来切换所有/标签分组; * 改进监视插件 * 增加搜索栏切换; * 清理和重新组织<ruby> 偏好 <rp> ( </rp> <rt> preferences </rt> <rp> ) </rp></ruby>窗口,包括一个完整的全局便签更新 * 添加选项用于设置 ActivityWatcher 插件静默时间 * 其它一些改进和 bug 修复 * [点击此处查看完整更新日志](http://bazaar.launchpad.net/%7Egnome-terminator/terminator/trunk/view/head:/ChangeLog) ### 安装 Terminator 0.98: Terminator 0.98 有可用的 PPA,首先我们需要在 Ubuntu/Linux Mint 上添加库。在终端里运行下面的命令来安装 Terminator 0.98。 ``` $ sudo add-apt-repository ppa:gnome-terminator/nightly $ sudo apt-get update $ sudo apt-get install terminator ``` 如果你想要移除 Terminator,只需要在终端中运行下面的命令(可选) ``` $ sudo apt-get remove terminator ``` --- via: <http://www.ewikitech.com/articles/linux/terminator-install-ubuntu-linux-mint/> 作者:[admin](http://www.ewikitech.com/author/admin/) 译者:[ictlyh](http://mutouxiaogui.cn/blog) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='www.ewikitech.com', port=80): Max retries exceeded with url: /articles/linux/terminator-install-ubuntu-linux-mint/ (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327580be0>: Failed to resolve 'www.ewikitech.com' ([Errno -2] Name or service not known)"))
null
6,458
RHCE 系列(二):如何进行包过滤、网络地址转换和设置内核运行时参数
http://www.tecmint.com/perform-packet-filtering-network-address-translation-and-set-kernel-runtime-parameters-in-rhel/
2015-10-23T10:24:00
[ "RHCE" ]
https://linux.cn/article-6458-1.html
正如第一部分(“[设置静态网络路由](/article-6451-1.html)”)提到的,在这篇文章(RHCE 系列第二部分),我们首先介绍红帽企业版 Linux 7(RHEL)中包过滤和网络地址转换(NAT)的原理,然后再介绍在某些条件发生变化或者需要变动时设置运行时内核参数以改变运行时内核行为。 ![RHEL 中的网络包过滤](/data/attachment/album/201510/23/002719hl4wgarug71nwfgu.jpg) *RHCE 第二部分:网络包过滤* ### RHEL 7 中的网络包过滤 当我们讨论数据包过滤的时候,我们指防火墙读取每个试图通过它的数据包的包头所进行的处理。然后,根据系统管理员之前定义的规则,通过采取所要求的动作过滤数据包。 正如你可能知道的,从 RHEL 7 开始,管理防火墙的默认服务是 [firewalld](http://www.tecmint.com/firewalld-rules-for-centos-7/)。类似 iptables,它和 Linux 内核的 netfilter 模块交互以便检查和操作网络数据包。但不像 iptables,Firewalld 的更新可以立即生效,而不用中断活跃的连接 - 你甚至不需要重启服务。 Firewalld 的另一个优势是它允许我们定义基于预配置服务名称的规则(之后会详细介绍)。 在第一部分,我们用了下面的场景: ![静态路由网络示意图](/data/attachment/album/201510/23/002721q6grtow794perp7m.png) *静态路由网络示意图* 然而,你应该记得,由于还没有介绍包过滤,为了简化例子,我们停用了2号路由器的防火墙。现在让我们来看看如何使接收的数据包发送到目的地的特定服务或端口。 首先,让我们添加一条永久规则允许从 enp0s3 (192.168.0.19) 到 enp0s8 (10.0.0.18) 的入站流量: ``` # firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i enp0s3 -o enp0s8 -j ACCEPT ``` 上面的命令会把规则保存到 `/etc/firewalld/direct.xml` 中: ``` # cat /etc/firewalld/direct.xml ``` ![在 CentOS 7 中检查 Firewalld 保存的规则](/data/attachment/album/201510/23/002723n6qhu77pz1npye11.png) *检查 Firewalld 保存的规则* 然后启用规则使其立即生效: ``` # firewall-cmd --direct --add-rule ipv4 filter FORWARD 0 -i enp0s3 -o enp0s8 -j ACCEPT ``` 现在你可以从 RHEL 7 中通过 telnet 到 web 服务器并再次运行 [tcpdump](http://www.tecmint.com/12-tcpdump-commands-a-network-sniffer-tool/) 监视两台机器之间的 TCP 流量,这次2号路由器已经启用了防火墙。 ``` # telnet 10.0.0.20 80 # tcpdump -qnnvvv -i enp0s3 host 10.0.0.20 ``` 如果你想只允许从 192.168.0.18 到 web 服务器(80 号端口)的连接而阻塞 192.168.0.0/24 网络中的其它来源呢? 在 web 服务器的防火墙中添加以下规则: ``` # firewall-cmd --add-rich-rule 'rule family="ipv4" source address="192.168.0.18/24" service name="http" accept' # firewall-cmd --add-rich-rule 'rule family="ipv4" source address="192.168.0.18/24" service name="http" accept' --permanent # firewall-cmd --add-rich-rule 'rule family="ipv4" source address="192.168.0.0/24" service name="http" drop' # firewall-cmd --add-rich-rule 'rule family="ipv4" source address="192.168.0.0/24" service name="http" drop' --permanent ``` 现在你可以从 192.168.0.18 和 192.168.0.0/24 中的其它机器发送到 web 服务器的 HTTP 请求。第一种情况连接会成功完成,但第二种情况最终会超时。 任何下面的命令可以验证这个结果: ``` # telnet 10.0.0.20 80 # wget 10.0.0.20 ``` 我强烈建议你看看 Fedora Project Wiki 中的 [Firewalld Rich Language](https://fedoraproject.org/wiki/Features/FirewalldRichLanguage) 文档更详细地了解关于富规则的内容。 ### RHEL 7 中的网络地址转换(NAT) 网络地址转换(NAT)是为专用网络中的一组计算机(也可能是其中的一台)分配一个独立的公共 IP 地址的过程。这样,在内部网络中仍然可以用它们自己的私有 IP 地址来区别,但外部“看来”它们是一样的。 另外,网络地址转换使得内部网络中的计算机发送请求到外部资源(例如因特网),然后只有源系统能接收到对应的响应成为可能。 现在让我们考虑下面的场景: ![RHEL 中的网络地址转换](/data/attachment/album/201510/23/002725fyy2qs9q2spopl5l.png) *网络地址转换* 在2号路由器中,我们会把 enp0s3 接口移动到外部区域(external),enp0s8 到内部区域(external),伪装(masquerading)或者说 NAT 默认是启用的: ``` # firewall-cmd --list-all --zone=external # firewall-cmd --change-interface=enp0s3 --zone=external # firewall-cmd --change-interface=enp0s3 --zone=external --permanent # firewall-cmd --change-interface=enp0s8 --zone=internal # firewall-cmd --change-interface=enp0s8 --zone=internal --permanent ``` 对于我们当前的设置,内部区域(internal) - 以及和它一起启用的任何东西都是默认区域: ``` # firewall-cmd --set-default-zone=internal ``` 下一步,让我们重载防火墙规则并保持状态信息: ``` # firewall-cmd --reload ``` 最后,在 web 服务器中添加2号路由器为默认网关: ``` # ip route add default via 10.0.0.18 ``` 现在你会发现在 web 服务器中你可以 ping 1号路由器和外部网站(例如 tecmint.com): ``` # ping -c 2 192.168.0.1 # ping -c 2 tecmint.com ``` ![验证网络路由](/data/attachment/album/201510/23/002726hc8yn8iz1n5bvhcb.png) *验证网络路由* ### 在 RHEL 7 中设置内核运行时参数 在 Linux 中,允许你更改、启用以及停用内核运行时参数,RHEL 也不例外。当操作条件发生变化时,`/proc/sys` 接口(sysctl)允许你实时设置运行时参数改变系统行为,而不需太多麻烦。 为了实现这个目的,会用 shell 内建的 echo 写 `/proc/sys/<category>` 中的文件,其中 `<category>` 一般是以下目录中的一个: * dev: 连接到机器中的特定设备的参数。 * fs: 文件系统配置(例如 quotas 和 inodes)。 * kernel: 内核配置。 * net: 网络配置。 * vm: 内核的虚拟内存的使用。 要显示所有当前可用值的列表,运行 ``` # sysctl -a | less ``` 在第一部分中,我们通过以下命令改变了 `net.ipv4.ip_forward` 参数的值以允许 Linux 机器作为一个路由器。 ``` # echo 1 > /proc/sys/net/ipv4/ip_forward ``` 另一个你可能想要设置的运行时参数是 `kernel.sysrq`,它会启用你键盘上的 `Sysrq` 键,以使系统更好的运行一些底层功能,例如如果由于某些原因冻结了后重启系统: ``` # echo 1 > /proc/sys/kernel/sysrq ``` 要显示特定参数的值,可以按照下面方式使用 `sysctl`: ``` # sysctl <parameter.name> ``` 例如, ``` # sysctl net.ipv4.ip_forward # sysctl kernel.sysrq ``` 有些参数,例如上面提到的某个,只需要一个值,而其它一些(例如 `fs.inode-state`)要求多个值: ![在 Linux 中查看内核参数](/data/attachment/album/201510/23/002730d23s84e866essh46.png) *查看内核参数* 不管什么情况下,做任何更改之前你都需要阅读内核文档。 请注意系统重启后这些设置会丢失。要使这些更改永久生效,我们需要添加内容到 `/etc/sysctl.d` 目录的 .conf 文件,像下面这样: ``` # echo "net.ipv4.ip_forward = 1" > /etc/sysctl.d/10-forward.conf ``` (其中数字 10 表示相对同一个目录中其它文件的处理顺序)。 并用下面命令启用更改: ``` # sysctl -p /etc/sysctl.d/10-forward.conf ``` ### 总结 在这篇指南中我们解释了基本的包过滤、网络地址变换和在运行的系统中设置内核运行时参数并使重启后能持久化。我希望这些信息能对你有用,如往常一样,我们期望收到你的回复! 别犹豫,在下面的表单中和我们分享你的疑问、评论和建议吧。 --- via: <http://www.tecmint.com/perform-packet-filtering-network-address-translation-and-set-kernel-runtime-parameters-in-rhel/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](https://github.com/ictlyh) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,463
在 Linux 下使用 RAID(九):如何使用 ‘Mdadm’ 工具管理软件 RAID
http://www.tecmint.com/manage-software-raid-devices-in-linux-with-mdadm/
2015-10-24T10:15:00
[ "RAID" ]
https://linux.cn/article-6463-1.html
无论你以前有没有使用 RAID 阵列的经验,以及是否完成了 [此 RAID 系列](/article-6085-1.html) 的所有教程,一旦你在 Linux 中熟悉了 `mdadm --manage` 命令的使用,管理软件 RAID 将不是很复杂的任务。 ![在 Linux 中使用 mdadm 管理 RAID 设备 - 第9部分](/data/attachment/album/201510/25/201458vaugnvlr7gj5fa5v.png) *在 Linux 中使用 mdadm 管理 RAID 设备 - 第9部分* 在本教程中,我们会再介绍此工具提供的功能,这样当你需要它,就可以派上用场。 #### RAID 测试方案 在本系列的最后一篇文章中,我们将使用一个简单的 RAID 1(镜像)阵列,它由两个 8GB 的磁盘(/dev/sdb 和 /dev/sdc)和一个备用设备(/dev/sdd)来演示,但在此使用的方法也适用于其他类型的配置。也就是说,放心去用吧,把这个页面添加到浏览器的书签,然后让我们开始吧。 ### 了解 mdadm 的选项和使用方法 幸运的是,mdadm 有一个内建的 `--help` 参数来对每个主要的选项提供说明文档。 因此,让我们开始输入: ``` # mdadm --manage --help ``` 就会使我们看到 `mdadm --manage` 能够执行哪些任务: ![Manage RAID with mdadm Tool](/data/attachment/album/201510/23/231705xffac8m8a1wdwa9z.png) *使用 mdadm 工具来管理 RAID* 正如我们在上面的图片看到,管理一个 RAID 阵列可以在任意时间执行以下任务: * (重新)将设备添加到阵列中 * 把设备标记为故障 * 从阵列中删除故障设备 * 使用备用设备更换故障设备 * 先创建部分阵列 * 停止阵列 * 标记阵列为 ro(只读)或 rw(读写) ### 使用 mdadm 工具管理 RAID 设备 需要注意的是,如果用户忽略 `--manage` 选项,mdadm 默认使用管理模式。请记住这一点,以避免出现最坏的情况。 上图中的高亮文本显示了管理 RAID 的基本语法: ``` # mdadm --manage RAID options devices ``` 让我们来演示几个例子。 #### ​例1:为 RAID 阵列添加设备 你通常会添加新设备来更换故障的设备,或者使用空闲的分区以便在出现故障时能及时替换: ``` # mdadm --manage /dev/md0 --add /dev/sdd1 ``` ![Add Device to Raid Array](/data/attachment/album/201510/23/231707tq4hp5elzgz5msoh.png) *添加设备到 Raid 阵列* #### ​例2:把一个 RAID 设备标记为故障并从阵列中移除 在从逻辑阵列中删除该设备前,这是强制性的步骤,然后才能从机器中取出它 - 注意顺序(如果弄错了这些步骤,最终可能会造成实际设备的损害): ``` # mdadm --manage /dev/md0 --fail /dev/sdb1 ``` 请注意在前面的例子中,知道如何添加备用设备来自动更换出现故障的磁盘。在此之后,[恢复和重建 raid 数据](/article-6448-1.html) 就开始了: ![Recover and Rebuild Raid Data](/data/attachment/album/201510/23/231708kzclq63u006rtg6q.png) *恢复和重建 raid 数据* 一旦设备已被手动标记为故障,你就可以安全地从阵列中删除它: ``` # mdadm --manage /dev/md0 --remove /dev/sdb1 ``` #### 例3:重新添加设备,来替代阵列中已经移除的设备 到现在为止,我们有一个工作的 RAID 1 阵列,它包含了2个活动的设备:/dev/sdc1 和 /dev/sdd1。现在让我们试试重新添加 /dev/sdb1 到/dev/md0: ``` # mdadm --manage /dev/md0 --re-add /dev/sdb1 ``` 我们会碰到一个错误: ``` # mdadm: --re-add for /dev/sdb1 to /dev/md0 is not possible ``` 因为阵列中的磁盘已经达到了最大的数量。因此,我们有两个选择:a)将 /dev/sdb1 添加为备用的,如例1;或 b)从阵列中删除 /dev/sdd1 然后重新添加 /dev/sdb1。 我们选择选项 b),先停止阵列然后重新启动: ``` # mdadm --stop /dev/md0 # mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 ``` 如果上面的命令不能成功添加 /dev/sdb1 到阵列中,使用例1中的命令来完成。 mdadm 能检测到新添加的设备并将其作为备用设备,当添加完成后它会开始重建数据,它也被认为是 RAID 中的活动设备: ![Raid Rebuild Status](/data/attachment/album/201510/23/231708v2azltciiahr2ejj.png) *重建 Raid 的状态* #### 例4:使用特定磁盘更换 RAID 设备 在阵列中使用备用磁盘更换磁盘很简单: ``` # mdadm --manage /dev/md0 --replace /dev/sdb1 --with /dev/sdd1 ``` ![Replace Raid Device](/data/attachment/album/201510/23/231708bw2b6k9wvzr9bkrj.png) *更换 Raid 设备* 这会导致 `--replace` 指定的设备被标记为故障,而 `--with`指定的设备添加到 RAID 中来替代它: ![Check Raid Rebuild Status](/data/attachment/album/201510/23/231709h3bh88f8c8dfhnnm.png) *检查 Raid 重建状态* #### ​例5:标记 RAID 阵列为 ro 或 rw 创建阵列后,你必须在它上面创建一个文件系统并将其挂载到一个目录下才能使用它。你可能不知道,RAID 也可以被设置为 ro,使其只读;或者设置为 rw,就可以同时写入了。 要标记该设备为 ro,首先需要将其卸载: ``` # umount /mnt/raid1 # mdadm --manage /dev/md0 --readonly # mount /mnt/raid1 # touch /mnt/raid1/test1 ``` ![Set Permissions on Raid Array](/data/attachment/album/201510/23/231709p7r4r2ehkjhkuk2k.png) *在 RAID 阵列上设置权限* 要配置阵列允许写入操作需要使用 `--readwrite` 选项。请注意,在设置 rw 标志前,你需要先卸载设备并停止它: ``` # umount /mnt/raid1 # mdadm --manage /dev/md0 --stop # mdadm --assemble /dev/md0 /dev/sdc1 /dev/sdd1 # mdadm --manage /dev/md0 --readwrite # touch /mnt/raid1/test2 ``` ![Allow Read Write Permission on Raid](/data/attachment/album/201510/23/231710m88xdcxcf6o8r6ck.png) *配置 Raid 允许读写操作* ### 总结 在本系列中,我们已经解释了如何建立一个在企业环境中使用的软件 RAID 阵列。如果你按照这些文章所提供的例子进行配置,在 Linux 中你会充分领会到软件 RAID 的价值。 如果你碰巧任何问题或有建议,请随时使用下面的方式与我们联系。 --- via: <http://www.tecmint.com/manage-software-raid-devices-in-linux-with-mdadm/> 作者:[GABRIEL CÁNEPA](http://www.tecmint.com/author/gacanepa/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,466
Linux 中 df 命令的11个例子
http://www.linuxtechi.com/11-df-command-examples-in-linux/
2015-10-26T07:56:00
[ "df", "磁盘" ]
https://linux.cn/article-6466-1.html
![](/data/attachment/album/201510/25/210056y7ssivvkvd37fx8g.jpg) df 即<ruby> “可用磁盘” <rp> ( </rp> <rt> disk free </rt> <rp> ) </rp></ruby>,用于显示文件系统的磁盘使用情况。默认情况下 df 命令将以每块 1K 的单位进行显示所有当前已挂载的文件系统,如果你想以人类易读的格式显示 df 命令的输出,像这样“df -h”使用 -h 选项。 在这篇文章中,我们将讨论 `df` 命令在 Linux 下11种不同的实例。 在 Linux 下 df 命令的基本格式为: ``` # df {options} {mount_point_of_filesystem} ``` 在 df 命令中可用的选项有: ![](/data/attachment/album/201510/25/210104ct411sswytmnu41s.jpg) df 的样例输出 : ``` [root@linux-world ~]# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg00-root 17003304 804668 15311852 5% / devtmpfs 771876 0 771876 0% /dev tmpfs 777928 0 777928 0% /dev/shm tmpfs 777928 8532 769396 2% /run tmpfs 777928 0 777928 0% /sys/fs/cgroup /dev/mapper/vg00-home 14987616 41000 14162232 1% /home /dev/sda1 487652 62593 395363 14% /boot /dev/mapper/vg00-var 9948012 48692 9370936 1% /var /dev/mapper/vg00-sap 14987656 37636 14165636 1% /sap [root@linux-world ~]# ``` ### 例1:使用 -a 选项列出所有文件系统的磁盘使用量 当我们在 df 命令中使用 `-a` 选项时,它会显示所有文件系统的磁盘使用情况。 ``` [root@linux-world ~]# df -a Filesystem 1K-blocks Used Available Use% Mounted on rootfs 17003304 804668 15311852 5% / proc 0 0 0 - /proc sysfs 0 0 0 - /sys devtmpfs 771876 0 771876 0% /dev securityfs 0 0 0 - /sys/kernel/security tmpfs 777928 0 777928 0% /dev/shm devpts 0 0 0 - /dev/pts tmpfs 777928 8532 769396 2% /run tmpfs 777928 0 777928 0% /sys/fs/cgroup cgroup 0 0 0 - /sys/fs/cgroup/systemd pstore 0 0 0 - /sys/fs/pstore cgroup 0 0 0 - /sys/fs/cgroup/cpuset cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct cgroup 0 0 0 - /sys/fs/cgroup/memory cgroup 0 0 0 - /sys/fs/cgroup/devices cgroup 0 0 0 - /sys/fs/cgroup/freezer cgroup 0 0 0 - /sys/fs/cgroup/net_cls cgroup 0 0 0 - /sys/fs/cgroup/blkio cgroup 0 0 0 - /sys/fs/cgroup/perf_event cgroup 0 0 0 - /sys/fs/cgroup/hugetlb configfs 0 0 0 - /sys/kernel/config /dev/mapper/vg00-root 17003304 804668 15311852 5% / selinuxfs 0 0 0 - /sys/fs/selinux systemd-1 0 0 0 - /proc/sys/fs/binfmt_misc debugfs 0 0 0 - /sys/kernel/debug hugetlbfs 0 0 0 - /dev/hugepages mqueue 0 0 0 - /dev/mqueue /dev/mapper/vg00-home 14987616 41000 14162232 1% /home /dev/sda1 487652 62593 395363 14% /boot /dev/mapper/vg00-var 9948012 48692 9370936 1% /var /dev/mapper/vg00-sap 14987656 37636 14165636 1% /sap [root@linux-world ~]# ``` ### 例2:以人类易读的格式显示 df 命令的输出 在 df 命令中使用`-h`选项,以人类易读的格式输出(例如,5K,500M 及 5G) ``` [root@linux-world ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-root 17G 786M 15G 5% / devtmpfs 754M 0 754M 0% /dev tmpfs 760M 0 760M 0% /dev/shm tmpfs 760M 8.4M 752M 2% /run tmpfs 760M 0 760M 0% /sys/fs/cgroup /dev/mapper/vg00-home 15G 41M 14G 1% /home /dev/sda1 477M 62M 387M 14% /boot /dev/mapper/vg00-var 9.5G 48M 9.0G 1% /var /dev/mapper/vg00-sap 15G 37M 14G 1% /sap [root@linux-world ~]# ``` ### 例3:显示特定文件系统已使用的空间 假如我们想显示 /sap 文件系统空间的使用情况。 ``` [root@linux-world ~]# df -h /sap/ Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-sap 15G 37M 14G 1% /sap [root@linux-world ~]# ``` ### 例4:输出所有已挂载文件系统的类型 `-T` 选项用在 df 命令中用来显示文件系统的类型。 ``` [root@linux-world ~]# df -T Filesystem Type 1K-blocks Used Available Use% Mounted on /dev/mapper/vg00-root ext4 17003304 804668 15311852 5% / devtmpfs devtmpfs 771876 0 771876 0% /dev tmpfs tmpfs 777928 0 777928 0% /dev/shm tmpfs tmpfs 777928 8532 769396 2% /run tmpfs tmpfs 777928 0 777928 0% /sys/fs/cgroup /dev/mapper/vg00-home ext4 14987616 41000 14162232 1% /home /dev/sda1 ext3 487652 62593 395363 14% /boot /dev/mapper/vg00-var ext3 9948012 48696 9370932 1% /var /dev/mapper/vg00-sap ext3 14987656 37636 14165636 1% /sap [root@linux-world ~]# ``` ### 例5:按块大小输出文件系统磁盘使用情况 ``` [root@linux-world ~]# df -k Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg00-root 17003304 804668 15311852 5% / devtmpfs 771876 0 771876 0% /dev tmpfs 777928 0 777928 0% /dev/shm tmpfs 777928 8532 769396 2% /run tmpfs 777928 0 777928 0% /sys/fs/cgroup /dev/mapper/vg00-home 14987616 41000 14162232 1% /home /dev/sda1 487652 62593 395363 14% /boot /dev/mapper/vg00-var 9948012 48696 9370932 1% /var /dev/mapper/vg00-sap 14987656 37636 14165636 1% /sap [root@linux-world ~]# ``` ### 例6:输出文件系统的 inode 信息 `-i` 选项用在 df 命令用于显示文件系统的 inode 信息。 所有文件系统的 inode 信息: ``` [root@linux-world ~]# df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/vg00-root 1089536 22031 1067505 3% / devtmpfs 192969 357 192612 1% /dev tmpfs 194482 1 194481 1% /dev/shm tmpfs 194482 420 194062 1% /run tmpfs 194482 13 194469 1% /sys/fs/cgroup /dev/mapper/vg00-home 960992 15 960977 1% /home /dev/sda1 128016 337 127679 1% /boot /dev/mapper/vg00-var 640848 1235 639613 1% /var /dev/mapper/vg00-sap 960992 11 960981 1% /sap [root@linux-world ~]# ``` 特定文件系统的 inode 信息: ``` [root@linux-world ~]# df -i /sap/ Filesystem Inodes IUsed IFree IUse% Mounted on /dev/mapper/vg00-sap 960992 11 960981 1% /sap [root@linux-world ~]# ``` ### 例7:输出所有文件系统使用情况汇总 `-total` 选项在 df 命令中用于显示所有文件系统的磁盘使用情况汇总。 ``` [root@linux-world ~]# df -h --total Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg00-root 17G 786M 15G 5% / devtmpfs 754M 0 754M 0% /dev tmpfs 760M 0 760M 0% /dev/shm tmpfs 760M 8.4M 752M 2% /run tmpfs 760M 0 760M 0% /sys/fs/cgroup /dev/mapper/vg00-home 15G 41M 14G 1% /home /dev/sda1 477M 62M 387M 14% /boot /dev/mapper/vg00-var 9.5G 48M 9.0G 1% /var /dev/mapper/vg00-sap 15G 37M 14G 1% /sap total 58G 980M 54G 2% - [root@linux-world ~]# ``` ### 例8:只打印本地文件系统磁盘的使用情况 假设网络文件系统也挂载在 Linux 上,但我们只想显示本地文件系统的信息,这可以通过使用 df 命令的 `-l` 选项来实现。 ![](/data/attachment/album/201510/25/210106gn3v55j8o3f5oicz.jpg) 只打印本地文件系统: ``` [root@linux-world ~]# df -Thl Filesystem Type Size Used Avail Use% Mounted on /dev/mapper/vg00-root ext4 17G 791M 15G 6% / devtmpfs devtmpfs 754M 0 754M 0% /dev tmpfs tmpfs 760M 0 760M 0% /dev/shm tmpfs tmpfs 760M 8.4M 752M 2% /run tmpfs tmpfs 760M 0 760M 0% /sys/fs/cgroup /dev/mapper/vg00-home ext4 15G 41M 14G 1% /home /dev/sda1 ext3 477M 62M 387M 14% /boot /dev/mapper/vg00-var ext3 9.5G 105M 8.9G 2% /var /dev/mapper/vg00-sap ext3 15G 37M 14G 1% /sap [root@linux-world ~]# ``` ### 例9:打印特定文件系统类型的磁盘使用情况 `-t` 选项在 df 命令中用来打印特定文件系统类型的信息,用 `-t` 指定文件系统的类型,如下所示: 对于 ext4 : ``` [root@linux-world ~]# df -t ext4 Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg00-root 17003304 809492 15307028 6% / /dev/mapper/vg00-home 14987616 41000 14162232 1% /home [root@linux-world ~]# ``` 对于 nfs4 : ``` [root@linux-world ~]# df -t nfs4 Filesystem 1K-blocks Used Available Use% Mounted on 192.168.1.5:/opensuse 301545472 266833920 19371008 94% /data [root@linux-world ~]# ``` ### 例10:使用 -x 选项排除特定的文件系统类型 `-x` 或 `–exclude-type` 在 df 命令中用来在输出中排出某些文件系统类型。 假设我们想打印除 ext3 外所有的文件系统。 ``` [root@linux-world ~]# df -x ext3 Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/vg00-root 17003304 809492 15307028 6% / devtmpfs 771876 0 771876 0% /dev tmpfs 777928 0 777928 0% /dev/shm tmpfs 777928 8540 769388 2% /run tmpfs 777928 0 777928 0% /sys/fs/cgroup /dev/mapper/vg00-home 14987616 41000 14162232 1% /home 192.168.1.5:/opensuse 301545472 266834944 19369984 94% /data [root@linux-world ~]# ``` ### 例11:在 df 命令的输出中只打印特定的字段 `-output={field_name1,field_name2...}` 选项用于显示 df 命令某些字段的输出。 可用的字段名有: `source`, `fstype`, `itotal`, `iused`, `iavail`, `ipcent`, `size`, `used`, `avail`, `pcent` 和 `target` ``` [root@linux-world ~]# df --output=fstype,size,iused Type 1K-blocks IUsed ext4 17003304 22275 devtmpfs 771876 357 tmpfs 777928 1 tmpfs 777928 423 tmpfs 777928 13 ext4 14987616 15 ext3 487652 337 ext3 9948012 1373 ext3 14987656 11 nfs4 301545472 451099 [root@linux-world ~]# ``` --- via: <http://www.linuxtechi.com/11-df-command-examples-in-linux/> 作者:[Pradeep Kumar](http://www.linuxtechi.com/author/pradeep/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,467
10 个给 Linux 用户的有用工具
http://www.unixmen.com/10-useful-utilities-linux-users/
2015-10-26T08:26:00
[ "工具", "命令行" ]
https://linux.cn/article-6467-1.html
![](/data/attachment/album/201510/25/213053smh9raz1crdcxhxn.png) ### 引言 在本教程中,我已经收集了10个给 Linux 用户的有用工具,其中包括各种网络监控,系统审计和一些其它实用的命令,它可以帮助用户提高工作效率。我希望你会喜欢他们。 #### 1. w 显示谁登录了系统并执行了哪些程序。 ``` $ w ``` ![](/data/attachment/album/201510/25/213054zxz7ymhb0hqp27im.png) 不显示头部信息(LCTT译注:原文此处有误) ``` $ w -h ``` 显示指定用户的信息 ``` $ w <username> ``` ![](/data/attachment/album/201510/25/213055w0ci5sj4w66jzvvx.png) #### 2. nmon Nmon(nigel’s monitor 的简写)是一个显示系统性能信息的工具。 ``` $ sudo apt-get install nmon ``` --- ``` $ nmon ``` ![](/data/attachment/album/201510/25/213058ceu5qhx85kkui83q.png) nmon 可以显示与 netwrok,cpu, memory 和磁盘使用情况的信息。 **nmon 显示 cpu 信息 (按 c)** ![](/data/attachment/album/201510/25/213100w2zlbbqjlrkjbja8.png) **nmon 显示 network 信息 (按 n)** ![](/data/attachment/album/201510/25/213103e6z0pl7m6mzr6xlx.png) **nman 显示 disk 信息 (按 d)** ![](/data/attachment/album/201510/25/213107wlzt138x0cff03sw.png) #### 3. ncdu 是一个支持光标的`du`程序,这个命令是用来分析各种目录占用的磁盘空间。 ``` $ apt-get install ncdu ``` --- ``` $ ncdu / ``` ![](/data/attachment/album/201510/25/213110i7oowmiwuowmxrns.png) 最终的输出: ![](/data/attachment/album/201510/25/213112vx0kh36dzldwd49l.png) 按 n 则通过文件名来排序,按 s 则按文件大小来排序(默认的)。 #### 4. slurm 一个基于网络接口的带宽监控命令行程序,它会用字符来显示文本图形。 ``` $ apt-get install slurm ``` 例如: ``` $ slurm -i <interface> ``` --- ``` $ slurm -i eth1 ``` ![](/data/attachment/album/201510/25/213115qy1h2h0zpxxg20sy.png) **选项** * 按 **l** 显示 lx/tx 指示灯. * 按 **c** 切换到经典模式. * 按 **r** 刷新屏幕. * 按 **q** 退出. #### 5.findmnt Findmnt 命令用于查找挂载的文件系统。它用来列出安装设备,当需要时也可以挂载或卸载设备,它是 util-linux 软件包的一部分。 例子: ``` $ findmnt ``` ![](/data/attachment/album/201510/25/213123rm60r7dm1u10dhk1.png) 以列表格式输出。 ``` $ findmnt -l ``` ![](/data/attachment/album/201510/25/213131bdd2zjxpanqaopzj.png) 列出在 fstab 中挂载的文件系统。 ``` $ findmnt -s ``` ![](/data/attachment/album/201510/25/213135lgnrmxhgttmx6nrh.png) 按文件类型列出已挂载的文件系统。 ``` $ findmnt -t ext4 ``` ![](/data/attachment/album/201510/25/213137e3633933dd99j3jf.png) #### 6. dstat 一种灵活的组合工具,它可用于监控内存,进程,网络和磁盘性能,它可以用来取代 ifstat, iostat, dmstat 等。 ``` $ apt-get install dstat ``` 例如: 查看有关 cpu,硬盘和网络的详细信息。 ``` $ dstat ``` ![](/data/attachment/album/201510/25/213142ctmaqi6fmdzxr5jq.png) **-c** cpu ``` $ dstat -c ``` ![](/data/attachment/album/201510/25/213143z2e03n353mcontdr.png) **-d** 磁盘 ``` $ dstat -d ``` ![](/data/attachment/album/201510/25/213144l0j9mbdr00j4vb1n.png) 显示 cpu、磁盘等的详细信息。 ``` $ dstat -cdl -D sda1 ``` ![](/data/attachment/album/201510/25/213146bvvp9f4ovvl228vo.png) #### 7. saidar 另一种基于命令行的系统统计数据监控工具,提供了有关磁盘使用,网络,内存,交换分区等信息。 ``` $ sudo apt-get install saidar ``` 例如: ``` $ saidar ``` ![](/data/attachment/album/201510/25/213153ke9zptqdytqp4el7.png) 启用彩色输出 ``` $ saider -c ``` ![](/data/attachment/album/201510/25/213203tb3pbpkukllb3xx0.png) #### 8. ss ss(socket statistics)是一个很好的替代 netstat 的选择,它从内核空间收集信息,比 netstat 的性能更好。 例如: 列出所有的连接 ``` $ ss |less ``` ![](/data/attachment/album/201510/25/213208fcnyymcow2yc2wcm.png) 列出 tcp 流量 ``` $ ss -A tcp ``` ![](/data/attachment/album/201510/25/213210fkn6aa05djtbjsn6.png) 列出进程名和 pid ``` $ ss -ltp ``` ![](/data/attachment/album/201510/25/213212xvwzr62n3virhtft.png) #### 9. ccze 一个美化日志显示的工具 :). ``` $ apt-get install ccze ``` 例如: ``` $ tailf /var/log/syslog | ccze ``` ![](/data/attachment/album/201510/25/213215ozciuov66ggivv9u.png) 列出 ccze 模块: ``` $ ccze -l ``` ![](/data/attachment/album/201510/25/213218x4h8585w5yddf64l.png) 将日志保存为 html 文件。 ``` tailf /var/log/syslog | ccze -h > /home/tux/Desktop/rajneesh.html ``` ![](/data/attachment/album/201510/25/213223clfig6jgzjr3l38i.png) #### 10. ranwhen.py 一种基于 Python 的终端工具,它可以用来以图形方式显示系统活动状态。详细信息以一个丰富多彩的柱状图来展示。 安装 python(LCTT 译注:一般来说,你应该已经有了 python,不需要此步): ``` $ sudo apt-add-repository ppa:fkrull/deadsnakes ``` 更新系统: ``` $ sudo apt-get update ``` 下载 python: ``` $ sudo apt-get install python3.2 ``` [点此下载 ranwhen.py](https://github.com/p-e-w/ranwhen/archive/master.zip) ``` $ unzip ranwhen-master.zip && cd ranwhen-master ``` 运行工具。 ``` $ python3.2 ranwhen.py ``` ![](/data/attachment/album/201510/25/213226zl1vb8el8bnbbc1z.png) ### 结论 这都是些不常见但重要的 Linux 管理工具。他们可以在日常生活中帮助用户。在我们即将发表的文章中,我们会尽量多带来些管理员/用户工具。 玩得愉快! --- via: <http://www.unixmen.com/10-useful-utilities-linux-users/> 作者:[Rajneesh Upadhyay](http://www.unixmen.com/author/rajneesh/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,468
如何使用 Quagga BGP(边界网关协议)路由器来过滤 BGP 路由
http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html
2015-10-26T13:53:00
[ "Quagga", "BGP", "路由器" ]
https://linux.cn/article-6468-1.html
在[之前的文章](/article-4609-1.html)中,我们介绍了如何使用 Quagga 将 CentOS 服务器变成一个 BGP 路由器,也介绍了 BGP 对等体和前缀交换设置。在本教程中,我们将重点放在如何使用<ruby> 前缀列表 <rp> ( </rp> <rt> prefix-list </rt> <rp> ) </rp></ruby>和<ruby> 路由映射 <rp> ( </rp> <rt> route-map </rt> <rp> ) </rp></ruby>来分别控制数据注入和数据输出。 之前的文章已经说过,BGP 的路由判定是基于前缀的收取和前缀的广播。为避免错误的路由,你需要使用一些过滤机制来控制这些前缀的收发。举个例子,如果你的一个 BGP 邻居开始广播一个本不属于它们的前缀,而你也将错就错地接收了这些不正常前缀,并且也将它转发到网络上,这个转发过程会不断进行下去,永不停止(所谓的“黑洞”就这样产生了)。所以确保这样的前缀不会被收到,或者不会转发到任何网络,要达到这个目的,你可以使用前缀列表和路由映射。前者是基于前缀的过滤机制,后者是更为常用的基于前缀的策略,可用于精调过滤机制。 本文会向你展示如何在 Quagga 中使用前缀列表和路由映射。 ### 拓扑和需求 本教程使用下面的拓扑结构。 ![](/data/attachment/album/201510/26/055640mui6p1lzki84l6lj.jpg) 服务供应商A和供应商B已经将对方设置成为 eBGP 对等体,实现互相通信。他们的自治系统号和前缀分别如下所示。 * **对等区段**: 192.168.1.0/24 * **服务供应商A**: 自治系统号 100, 前缀 10.10.0.0/16 * **服务供应商B**: 自治系统号 200, 前缀 10.20.0.0/16 在这个场景中,供应商B只想从A接收 10.10.10.0/23, 10.10.10.0/24 和 10.10.11.0/24 三个前缀。 ### 安装 Quagga 和设置 BGP 对等体 在[之前的教程](/article-4609-1.html)中,我们已经写了安装 Quagga 和设置 BGP 对等体的方法,所以这里就不再详细说明了,只简单介绍下 BGP 配置和前缀广播: ![](/data/attachment/album/201510/26/055641w2yaqq1y0zsje2y4.jpg) 上图说明 BGP 对等体已经开启。Router-A 在向 router-B 广播多个前缀,而 Router-B 也在向 router-A 广播一个前缀 10.20.0.0/16。两个路由器都能正确无误地收发前缀。 ### 创建前缀列表 路由器可以使用 ACL 或前缀列表来过滤一个前缀。前缀列表比 ACL 更常用,因为前者处理步骤少,而且易于创建和维护。 ``` ip prefix-list DEMO-PRFX permit 192.168.0.0/23 ``` 上面的命令创建了名为“DEMO-FRFX”的前缀列表,只允许存在 192.168.0.0/23 这个前缀。 前缀列表的另一个强大功能是支持子网掩码区间,请看下面的例子: ``` ip prefix-list DEMO-PRFX permit 192.168.0.0/23 le 24 ``` 这个命令创建的前缀列表包含在 192.168.0.0/23 和 /24 之间的前缀,分别是 192.168.0.0/23, 192.168.0.0/24 和 192.168.1.0/24。运算符“le”表示小于等于,你也可以使用“ge”表示大于等于。 一个前缀列表语句可以有多个允许或拒绝操作。每个语句都自动或手动地分配有一个序列号。 如果存在多个前缀列表语句,则这些语句会按序列号顺序被依次执行。在配置前缀列表的时候,我们需要注意在所有前缀列表语句之后是**隐性拒绝**语句,就是说凡是不被明显允许的,都会被拒绝。 如果要设置成允许所有前缀,前缀列表语句设置如下: ``` ip prefix-list DEMO-PRFX permit 0.0.0.0/0 le 32 ``` 我们已经知道如何创建前缀列表语句了,现在我们要创建一个名为“PRFX-LST”的前缀列表,来满足我们实验场景的需求。 ``` router-b# conf t router-b(config)# ip prefix-list PRFX-LST permit 10.10.10.0/23 le 24 ``` ### 创建路由映射 除了前缀列表和 ACL,这里还有另一种机制,叫做路由映射,也可以在 BGP 路由器中控制前缀。事实上,路由映射针对前缀匹配的微调效果比前缀列表和 ACL 都强。 与前缀列表类似,路由映射语句也可以指定允许和拒绝操作,也需要分配一个序列号。每个路由匹配可以有多个允许或拒绝操作。例如: ``` route-map DEMO-RMAP permit 10 ``` 上面的语句创建了名为“DEMO-RMAP”的路由映射,添加序列号为10的允许操作。现在我们在这个序列号所对应的路由映射下使用 match 命令进行匹配。 ``` 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 ``` 如你所见,路由映射可以匹配很多属性,在本教程中匹配的是前缀。 ``` route-map DEMO-RMAP permit 10 match ip address prefix-list DEMO-PRFX ``` 这个 match 命令会匹配之前建好的前缀列表中允许的 IP 地址(也就是前缀 192.168.0.0/23, 192.168.0.0/24 和 192.168.1.0/24)。 接下来,我们可以使用 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 ``` 如你所见,set 命令也可以修改很多属性。为了作个示范,我们修改一下 BGP 的 local-preference 这个属性。 ``` route-map DEMO-RMAP permit 10 match ip address prefix-list DEMO-PRFX set local-preference 500 ``` 如同前缀列表,路由映射语句的末尾也有隐性拒绝操作。所以我们需要添加另外一个允许语句(使用序列号20)来允许所有前缀。 ``` route-map DEMO-RMAP permit 10 match ip address prefix-list DEMO-PRFX set local-preference 500 ! route-map DEMO-RMAP permit 20 ``` 序列号20未指定任何匹配命令,所以默认匹配所有前缀。在这个路由映射语句中,所有的前缀都被允许。 回想一下,我们的需求是只允许或只拒绝一些前缀,所以上面的 set 命令不应该存在于这个场景中。我们只需要一个允许语句,如下如示: ``` router-b# conf t router-b(config)# route-map RMAP permit 10 router-b(config-route-map)# match ip address prefix-list PRFX-LST ``` 这个路由映射才是我们需要的效果。 ### 应用路由映射 注意,在被应用于一个接口或一个 BGP 邻居之前,ACL、前缀列表和路由映射都不会生效。与 ACL 和前缀列表一样,一条路由映射语句也能被多个接口或邻居使用。然而,一个接口或一个邻居只能有一条路由映射语句应用于输入端,以及一条路由映射语句应用于输出端。 下面我们将这条路由映射语句应用于 router-B 的 BGP 配置,为 router-B 的邻居 192.168.1.1 设置输入前缀广播。 ``` router-b# conf terminal router-b(config)# router bgp 200 router-b(config-router)# neighbor 192.168.1.1 route-map RMAP in ``` 现在检查下广播路由和收取路由。 显示广播路由的命令: ``` show ip bgp neighbor-IP advertised-routes ``` 显示收取路由的命令: ``` show ip bgp neighbor-IP routes ``` ![](/data/attachment/album/201510/26/055642iktf8lljmvet076t.jpg) 可以看到,router-A 有4条路由前缀到达 router-B,而 router-B 只接收3条。查看一下范围,我们就能知道只有被路由映射允许的前缀才能在 router-B 上显示出来,其他的前缀一概丢弃。 **小提示**:如果接收前缀内容没有刷新,试试重置下 BGP 会话,使用这个命令:`clear ip bgp neighbor-IP`。本教程中命令如下: ``` clear ip bgp 192.168.1.1 ``` 我们能看到系统已经满足我们的要求了。接下来我们可以在 router-A 和 router-B 上创建相似的前缀列表和路由映射语句来更好地控制输入输出的前缀。 这里把配置过程总结一下,方便查看。 ``` 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 ``` ### 总结 在本教程中我们演示了如何在 Quagga 中设置前缀列表和路由映射来过滤 BGP 路由。我们也展示了如何将前缀列表结合进路由映射来进行输入前缀的微调功能。你可以参考这些方法来设置满足自己需求的前缀列表和路由映射。这些工具是保护网络免受路由毒化和来自 bogon 路由(LCTT 译注:指不该出现在internet路由表中的地址)的广播。 希望本文对你有帮助。 --- via: <http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html> 作者:[Sarmed Rahman](http://xmodulo.com/author/sarmed) 译者:[bazz2](https://github.com/bazz2) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,469
老照片:Linux 的 24 年历史,一步一个脚印
https://tlhp.cf/linux-history/
2015-10-26T09:00:00
[ "Linux", "历史" ]
/article-6469-1.html
![](/data/attachment/album/201510/26/070656lkczrx32h226z4d3.jpg) ### 史前 没有 [C 编程语言](https://en.wikipedia.org/wiki/C_(programming_language)) 和 [GNU 项目](https://en.wikipedia.org/wiki/GNU_Project) 构成 Linux 环境,也就不可能有 Linux 的成功。 ![](/data/attachment/album/201510/26/070743r4d1whhnwtuw4ul6.jpg) *Ken Thompson 和 Dennis Ritchie* [Ken Thompson](https://en.wikipedia.org/wiki/C_(programming_language)) 和 [Dennis Ritchie](https://en.wikipedia.org/wiki/GNU_Project) 在 1969-1970 创造了 Unix 操作系统。之后发布了新的 [C 编程语言](https://en.wikipedia.org/wiki/Ken_Thompson),它是一种高级的、可移植的编程语言。 Linux 内核用 C 和一些汇编代码写成。 ![Richard Matthew Stallman](/data/attachment/album/201510/26/070744btetqj95mf4j554j.jpg) *Richard Matthew Stallman* [Richard Matthew Stallman](https://en.wikipedia.org/wiki/Dennis_Ritchie) 在 1984 年启动了 [GNU 项目](https://en.wikipedia.org/wiki/Linus_Torvalds)。最大的一个目标 - 完全自由的类-Unix 操作系统。 ### 1991 – 元年 ![](/data/attachment/album/201510/26/070745plvuggvl94dvex7v.jpg) *Linus Torvalds, 1991* [Linus Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds) 在芬兰赫尔辛基开始了 Linux 内核开发,他是为他的硬件 - Intel 30386 CPU 编写的程序。他也使用 Minix 和 GNU C 编译器。下面是 Linus Torvalds 给 Minix 新闻组的历史消息: > > From: [[email protected]](mailto:[email protected]) (Linus Benedict Torvalds) Newsgroups: comp.os.minix Subject: What would you like to see most in minix? Summary: small poll for my new operating system Message-ID: Date: 25 Aug 91 20:57:08 GMT Organization: University of Helsinki > > > Hello everybody out there using minix - > > > I'm doing a (free) operating system (just a hobby, won't be big and professional like gnu) for 386(486) AT clones. This has been brewing since april, and is starting to get ready. I'd like any feedback on things people like/dislike in minix, as my OS resembles it somewhat (same physical layout of the file-system (due to practical reasons) among other things). > > > I've currently ported bash(1.08) and gcc(1.40), and things seem to work. This implies that I'll get something practical within a few months, and I'd like to know what features most people would want. Any suggestions are welcome, but I won't promise I'll implement them :-) > > > Linus ([email protected]) > > > 从此之后,Linux 开始得到了世界范围志愿者和专业专家的支持。Linus 的同事 Ari Lemmke 把它命名为 “Linux” - 这其实是他们的大学 ftp 服务器上的项目目录名称。 ### 1992 ![](/data/attachment/album/201510/26/070745j939sahnks0sszmi.jpg) 在 GPLv2 协议下发布了 0.12 版 Linux 内核。 ### 1993 ![Slackware 1.0 ](/data/attachment/album/201510/26/070746ywb79rfnr59nhndc.png) Slackware 首次发布(LCTT 译注:Slackware Linux 是一个高度技术性的、干净的发行版,只有少量非常有限的个人设置) – 最早的 Linux 发行版,其领导者 Patrick Volkerding 也是最早的。其时,Linux 内核有 100 多个开发者。 ![](/data/attachment/album/201510/26/070747ffzzl1r3d86mtdua.png) *Debian* Debian – 最大的 Linux 社区之一也创立于 1991 年。 ### 1994 Linux 1.0 发布了,多亏了 XFree 86 项目,第一次有了 GUI。 ![](/data/attachment/album/201510/26/070748aninh1iy5xy996tt.png) *Red Hat Linux* 发布了 Red Hat Linux 1.0 ![](/data/attachment/album/201510/26/070749lz1ap1ll6pdpi1zr.png) *S.u.S.E Linux* 和 [S.u.S.E. Linux](https://en.wikipedia.org/wiki/SUSE_Linux_distributions) 1.0。 ### 1995 ![](/data/attachment/album/201510/26/070750ecj3zj3ylyny6p3i.png) *Red Hat Inc.* Bob Young 和 Marc Ewing 合并他们的本地业务为 [Red Hat Software](https://en.wikipedia.org/wiki/Red_Hat)。Linux 移植到了很多硬件平台。 ### 1996 ![](/data/attachment/album/201510/26/070750v33gcu66wbieccoo.png) *Tux* 企鹅 Tux 是 Linux 官方吉祥物,Linus Torvalds 参观了堪培拉国家动物园和水族馆之后有了这个想法。发布了 Linux 2.0,支持对称多处理器。开始开发 KDE。 ### 1997 ![](/data/attachment/album/201510/26/070751vtsgtb1wtt9nytn1.jpg) *Miguel de Icaza* Miguel de Icaza 和 Federico Mena 开始开发 GNOME - 自由桌面环境和应用程序。Linus Torvalds 赢得了 Linux 商标冲突官司,Linux 成为了 Linus Torvalds 的注册商标。 ### 1998 ![](/data/attachment/album/201510/26/070752kq87vg1dkv5usd5v.jpg) *大教堂和集市* Eric S. Raymond 出版了文章 [The Cathedral and the Bazaar(大教堂和集市)](https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar) - 高度推荐阅读。Linux 得到了大公司的支持: IBM、Oracle、康柏。 ![](/data/attachment/album/201510/26/070754brr272mr9jj77489.png) *Mandrake Linux* Mandrake Linux 首次发布 - 基于红帽 Linux 的发行版,带有 KDE 桌面环境。 ### 1999 ![](/data/attachment/album/201510/26/070759fmt5zcs7ctemev49.jpg) 第一个主要的 KDE 版本。 ### 2000 ![](/data/attachment/album/201510/26/070801uvqvujivuuvuoj5j.jpg) Dell 支持 Linux - 这是第一个支持的大硬件供应商。 ### 2001 ![](/data/attachment/album/201510/26/070801drfq9bfnf8hp88d7.jpg) *Revolution OS* 纪录片 “Revolution OS(操作系统革命)” - GNU、Linux、开源、自由软件的 20 年历史,以及对 Linux 和开源界顶级黑客的采访。 ### 2002 ![](/data/attachment/album/201510/26/070802biwaiyruhuyyislw.jpg) *BitKeeper* Linux 开始使用 BitKeeper,这是一种商业版的分布式版本控制软件。 ### 2003 ![](/data/attachment/album/201510/26/070803i0wip5h0jkiptpri.png) *SUSE* Novell 用 2.1 亿美元购买了 SUSE Linux AG。同年 SCO 集团 也开始了同 IBM 以及 Linux 社区关于 Unix 版权的艰难的法律诉讼。 ![](/data/attachment/album/201510/26/070804taa2n9gxgm1ykgha.png) *Fedora* 红帽和 Linux 社区首次发布了 Fedora Linux。 ### 2004 ![](/data/attachment/album/201510/26/070806q5lm1gllynln0o9p.png) *X.ORG 基金会* XFree86 解散了并加入到 [X.Org 基金会](http://www.x.org/), X 的开发更快了。 ![](/data/attachment/album/201510/26/070807pzaapxrnjajvz8pj.jpg) Ubuntu 4.10 – Ubuntu 首次发布 ### 2005 ![](/data/attachment/album/201510/26/070807mkmbi5mm55bljxbz.png) *openSUSE* [openSUSE](https://en.opensuse.org/Main_Page) 开始了,这是企业版 Novell’s OS 的免费版本。OpenOffice.org 开始支持 OpenDocument 标准。 ### 2006 ![](/data/attachment/album/201510/26/070808qb6znwgnh3glar35.png) 一个新的 Linux 发行版,基于红帽企业版 Linux 的 Oracle Linux。微软和 Novell 开始在 IT 和专利保护方面进行合作。 ### 2007 ![](/data/attachment/album/201510/26/070809bwm5wbh661edwwwz.jpg) *Dell Linux 笔记本* Dell 发布了第一个预装 Linux 的笔记本。 ### 2008 ![](/data/attachment/album/201510/26/070810tbjbjb8psoyjsqyb.jpg) *KDE 4.0* KDE 4 发布了,但是不稳定,很多用户开始迁移到 GNOME。 ### 2009 ![](/data/attachment/album/201510/26/070812nmmu88puziji48b9.jpg) *Red Hat* 红帽 Linux 取得了成功 - 市值达 26亿2千万美元。 2009 年微软在 GPLv2 协议下向 Linux 内核提交了第一个补丁。 ### 2010 ![](/data/attachment/album/201510/26/070813t1260scjdl1uvusq.png) *Novell -> Attachmate* Novell 已 22亿美元卖给了 Attachmate Group, Inc。SUSE 和 Novell 成为了新公司的两款独立的产品。 [systemd](https://en.wikipedia.org/wiki/Systemd) 首次发布,开始了 Linux 系统的革命。 ### 2011 ![](/data/attachment/album/201510/26/070815hkloo10w6zosrzz7.png) *Unity 桌面,2011* Ubuntu Unity 发布,遭到很多用户的批评。 ![](/data/attachment/album/201510/26/070818k0yr7my72nl7no7e.png) *GNOME 3.0,2011* GNOME 3.0 发布, Linus Torvalds 评论为 “unholy mess” ,有很多负面评论。Linux 内核 3.0 发布。 ### 2012 ![](/data/attachment/album/201510/26/070819np1gu4jixbixjvbi.png) *1500 万行代码* Linux 内核达到 1500 万行代码。微软成为主要贡献者之一。 ### 2013 ![](/data/attachment/album/201510/26/070820pqtlpmdiil4ildjq.png) Kali Linux 1.0 发布, 用于渗透测试和数字取证,基于 Debian 的 Linux 发行版。2014 年 CentOS 及其代码开发者加入到了红帽公司。 ### 2014 ![](/data/attachment/album/201510/26/070821qqfbql6g0klk0rlq.jpg) *Lennart Poettering 和 Kay Sievers* systemd 成为 Ubuntu 和所有主流 Linux 发行版的默认初始化程序。Ubuntu 有 2200 万用户。安卓的大进步 - 占了所有移动设备的 75% 份额。 ### 2015 ![](/data/attachment/album/201510/26/070822vxybqvzxyvyqxpy7.jpg) 发布了 Linux 4.0。Mandriva 公司清算,但还有很多分支,其中最流行的一个是 Mageia。 带着对 Linux 的热爱而执笔。 --- via: <https://tlhp.cf/linux-history/> 作者:[Pavlo Rudyi](https://tlhp.cf/author/paul/) 译者:[ictlyh](http://mutouxiaogui.cn/blog) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPSConnectionPool(host='tlhp.cf', port=443): Max retries exceeded with url: /linux-history/ (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7b8327581b40>: Failed to resolve 'tlhp.cf' ([Errno -2] Name or service not known)"))
null
6,472
红帽 CEO 对 OpenStack 收益表示乐观
http://www.serverwatch.com/server-news/red-hat-ceo-optimistic-on-openstack-revenue-opportunity.html
2015-10-27T07:30:00
[ "RedHat", "OpenStack" ]
https://linux.cn/article-6472-1.html
得益于围绕 Linux 和云不断发展的平台与基础设施技术,红帽正在持续快速发展。红帽宣布在九月二十一日完成了 2016 财年第二季度的财务业绩,再次超过预期。 ![](/data/attachment/album/201510/27/000728jbe9po7e99ikfw4i.jpg) 这一季度,红帽的收入为 5 亿 4 百万美元,和去年同比增长 13%。净收入为 5 千 1 百万美元,超过了 2015 财年第二季度的 4 千 7 百万美元。 展望未来,红帽为下一季度和全年提供了积极的目标。对于第三季度,红帽希望指导收益能在 5亿1千9百万美元和5亿2千3百万美元之间,和去年同期相比增长 15%。 对于 2016 财年,红帽的全年指导目标是 20亿4千4百万美元,和去年相比增长 14%。 红帽 CFO Frank Calderoni 在电话会议上指出,红帽最高的 30 个订单差不多甚至超过了 1 百万美元。其中有 4 个订单超过 5 百万美元,还有一个超过 1 千万美元。 从近几年的经验来看,红帽产品的交叉销售非常成功,全部订单中有超过 65% 的订单包括了一个或多个红帽应用和新兴技术产品组件。 Calderoni 说 “我们希望这些技术,例如中间件、RHEL OpenStack 平台、OpenShift、云管理和存储能持续推动收益增长。” ### OpenStack 在电话会议中,红帽 CEO Jim Whitehurst 多次问到 OpenStack 的预期收入。Whitehurst 说得益于安装程序的改进,最近发布的 Red Hat OpenStack Platform 7.0 向前垮了一大步。 Whitehurst 提到:“在识别硬件和使用方面它做的很好,当然,这也意味着在硬件识别并正确使用它们方便还有很多工作要做。” Whitehurst 说他已经开始注意到很多的生产应用程序开始迁移到 OpenStack 云上来。他也警告说在产业化方面迁移到 OpenStack 大部分只是尝鲜,还并没有成为主流。 对于竞争对手, Whitehurst 尤其提到了微软、惠普和 Mirantis。在他看来,很多组织仍然会使用多种操作系统,如果他们部分使用了微软产品,会更倾向于开源方案作为替代选项。Whitehurst 说在云方面他还没有看到太多和惠普面对面的竞争,但和 Mirantis 则确实如此。 Whitehurst 说 “我们也有几次胜利,客户从 Mirantis 转到了 RHEL。” --- via: <http://www.serverwatch.com/server-news/red-hat-ceo-optimistic-on-openstack-revenue-opportunity.html> 作者:[Sean Michael Kerner](http://www.serverwatch.com/author/Sean-Michael-Kerner-101580.htm) 译者:[ictlyh](http://mutouxiaogui.cn/blog) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,473
如何在 Linux 中使用 youtube-dl 下载视频
http://itsfoss.com/download-youtube-linux/
2015-10-27T08:17:00
[ "youtube-dl", "视频" ]
https://linux.cn/article-6473-1.html
![](/data/attachment/album/201510/27/001920mu5bkgbg5u97o5hu.jpg) 我知道你已经看过[如何下载 YouTube 视频](http://itsfoss.com/download-youtube-videos-ubuntu/)。但那些工具大部分都采用图形用户界面的方式。我会向你展示如何通过终端使用 youtube-dl 下载 YouTube 视频。 ### youtube-dl [youtube-dl](https://rg3.github.io/youtube-dl/) 是基于 Python 的命令行小工具,允许你从 YouTube.com、Dailymotion、Google Video、Photobucket、Facebook、Yahoo、Metacafe、Depositfiles 以及其它一些类似网站中下载视频。它是用 pygtk 编写的,需要 Python 解析器来运行,对平台要求并不严格。它能够在 Unix、Windows 或者 Mac OS X 系统上运行。 youtube-dl 支持断点续传。如果在下载的过程中 youtube-dl 被杀死了(例如通过 Ctrl-C 或者丢失网络连接),你只需要使用相同的 YouTube 视频 URL 再次运行它。只要当前目录中有下载的部分文件,它就会自动恢复没有完成的下载,也就是说,你不需要[下载管理器](/article-6209-1.html)来恢复下载。 #### 安装 youtube-dl 如果你运行的是基于 Ubuntu 的 Linux 发行版,你可以使用下面的命令安装: ``` sudo apt-get install youtube-dl ``` 对于任何 Linux 发行版,你都可以通过下面的命令行在你的系统上快速安装 youtube-dl: ``` sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O/usr/local/bin/youtube-dl ``` 获取到该文件后,为了能正常执行你需要给脚本设置可执行权限。 ``` sudo chmod a+rx /usr/local/bin/youtube-dl ``` #### 使用 youtube-dl 下载视频: 要下载一个视频文件,只需要运行下面的命令。其中 “VIDEO\_URL” 是你想要下载视频的 url。 ``` youtube-dl VIDEO_URL ``` #### 以多种格式下载 YouTube 视频: 现在 YouTube 视频有不同的分辨率,首先你需要检查指定的 YouTube 视频可用的视频格式。可以使用 “-F” 选项运行 youtube-dl。它会向你显示出可用的格式。 ``` youtube-dl -F http://www.youtube.com/watch?v=BlXaGWbFVKY ``` 它的输出类似于: ``` Setting language BlXaGWbFVKY: Downloading video webpage BlXaGWbFVKY: Downloading video info webpage BlXaGWbFVKY: Extracting video information Available formats: 37 : mp4 [1080×1920] 46 : webm [1080×1920] 22 : mp4 [720×1280] 45 : webm [720×1280] 35 : flv [480×854] 44 : webm [480×854] 34 : flv [360×640] 18 : mp4 [360×640] 43 : webm [360×640] 5 : flv [240×400] 17 : mp4 [144×176] ``` 在可用的视频格式中,选择你需要的一种。例如,如果你想下载 MP4 格式的,你可以: ``` youtube-dl -f 17 http://www.youtube.com/watch?v=BlXaGWbFVKY ``` #### 使用 youtube-dl 下载视频字幕 首先检查是否有可用的视频字幕。使用下面的命令列出视频所有可用的字幕: ``` youtube-dl --list-subs https://www.youtube.com/watch?v=Ye8mB6VsUHw ``` 下载所有字幕,但不包括视频: ``` youtube-dl --all-subs --skip-download https://www.youtube.com/watch?v=Ye8mB6VsUHw ``` #### 下载整个播放列表 运行下面的命令下载整个播放列表。其中 “playlist\_url” 是你希望下载的播放列表的 url。 ``` youtube-dl -cit playlist_url ``` youtube-dl 是一个多功能的命令行工具,它提供了很多功能。难怪这个命令行工具这么流行。 --- via: <http://itsfoss.com/download-youtube-linux/> 作者:[alimiracle](http://itsfoss.com/author/ali/) 译者:[ictlyh](http://mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,474
如何在 64 位 Ubuntu 15.10 中编译最新版 32 位 Wine
http://www.tuxarena.com/2015/10/how-to-compile-latest-wine-32-bit-on-64-bit-ubuntu-15-10/
2015-10-27T13:26:00
[ "Wine" ]
https://linux.cn/article-6474-1.html
Wine 发布了最新的1.7.53版本。此版本带来的大量性能提升,包括**XAudio**,**Direct3D**代码清理,改善**OLE对象嵌入**技术,更好的 **Web Services** DLL的实现,还有其他大量更新。 ![](/data/attachment/album/201510/27/002909ygxio1g1ab5gxfb0.jpg) 虽然有一个官方 [Wine](https://launchpad.net/%7Eubuntu-wine/+archive/ubuntu/ppa) PPA,但目前只提供1.7.44版本,所以安装最新版本可以从源码编译安装。 [下载源码包](https://www.winehq.org/announce/1.7.53)([直接下载地址在此](http://prdownloads.sourceforge.net/wine/wine-1.7.53.tar.bz2))并解压 `tar -xf wine-1.7.53`。然后,安装如下依赖。 ``` sudo apt-get install build-essential gcc-multilib libx11-dev:i386 libfreetype6-dev:i386 libxcursor-dev:i386 libxi-dev:i386 libxshmfence-dev:i386 libxxf86vm-dev:i386 libxrandr-dev:i386 libxinerama-dev:i386 libxcomposite-dev:i386 libglu1-mesa-dev:i386 libosmesa6-dev:i386 libpcap0.8-dev:i386 libdbus-1-dev:i386 libncurses5-dev:i386 libsane-dev:i386 libv4l-dev:i386 libgphoto2-dev:i386 liblcms2-dev:i386 gstreamer0.10-plugins-base:i386 libcapi20-dev:i386 libcups2-dev:i386 libfontconfig1-dev:i386 libgsm1-dev:i386 libtiff5-dev:i386 libmpg123-dev:i386 libopenal-dev:i386 libldap2-dev:i386 libgnutls-dev:i386 libjpeg-dev:i386 ``` 现在切换到 wine-1.7.53 解压后的文件夹,并输入: ``` ./configure make sudo make install ``` 同样地,你也可以给配置脚本指定 prefix 参数。以普通用户安装 wine: ``` ./configure --prefix=$HOME/usr/bin make make install ``` 这种情况下,Wine 将会安装在`$HOME/usr/bin/wine`,所以请检查`$HOME/usr/bin`在你的`PATH`变量中。 --- via: <http://www.tuxarena.com/2015/10/how-to-compile-latest-wine-32-bit-on-64-bit-ubuntu-15-10/> 作者:Craciun Dan 译者:[VicYu/Vic020](http://vicyu.net) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,484
10 个 Linux 中的 passwd 命令示例
http://www.linuxtechi.com/10-passwd-command-examples-in-linux/
2015-10-29T08:39:00
[ "passwd", "密码", "口令" ]
https://linux.cn/article-6484-1.html
正如 **passwd** 命令的名称所示,其用于改变系统用户的密码。如果 passwd 命令由非 root 用户执行,那么它会询问当前用户的密码,然后设置调用该命令的用户的新密码。当此命令由超级用户 root 执行的话,就可以重新设置任何用户的密码,包括不知道当前密码的用户。 ![](/data/attachment/album/201510/28/234554zi555tj65jxis56x.jpg) 在这篇文章中,我们将用实例来介绍 passwd 命令。 #### 语法 : ``` # passwd {options} {user_name} ``` 可以在 passwd 命令使用不同的选项,列表如下: ![](/data/attachment/album/201510/28/234620a4bbv9bb4zs0qlp4.jpg) ### 例1:更改系统用户的密码 当你使用非 root 用户登录时,比如我使用 ‘linuxtechi’ 登录的情况下,运行 passwd 命令它会重置当前登录用户的密码。 ``` [linuxtechi@linuxworld ~]$ passwd Changing password for user linuxtechi. Changing password for linuxtechi. (current) UNIX password: New password: Retype new password: passwd: all authentication tokens updated successfully. [linuxtechi@linuxworld ~]$ ``` 当你作为 root 用户登录后并运行 **passwd** 命令时,它默认情况下会重新设置 root 的密码,如果你在 passwd 命令后指定了用户名,它会重置该用户的密码。 ``` [root@linuxworld ~]# passwd [root@linuxworld ~]# passwd linuxtechi ``` ![](/data/attachment/album/201510/28/234620jx0xc6ceogcs0e0m.jpg) **注意** : 系统用户的密码以加密的形式保存在 /etc/shadow 文件中。 ### 例2:显示密码状态信息 要显示用户密码的状态信息,请在 passwd 命令后使用 **-S** 选项。 ``` [root@linuxworld ~]# passwd -S linuxtechi linuxtechi PS 2015-09-20 0 99999 7 -1 (Password set, SHA512 crypt.) [root@linuxworld ~]# ``` 在上面的输出中,第一个字段显示的用户名,第二个字段显示密码状态(**PS = 密码设置,LK = 密码锁定,NP = 无密码**),第三个字段显示了上次修改密码的时间,后面四个字段分别显示了密码能更改的最小期限和最大期限,警告期限和没有使用该口令的时长。 ### 例3:显示所有账号的密码状态信息 为了显示所有用户密码的状态信息需要使用 “**-aS**”选项在passwd 命令中,示例如下所示: ``` root@localhost:~# passwd -Sa ``` ![](/data/attachment/album/201510/28/234622x3z1aede83ntexgj.jpg) (LCTT译注:不同发行版/passwd 的行为不同。CentOS6.6 没有测试成功,但 Ubuntu 可以。) ### 例4:使用 -d 选项删除用户的密码 用我做例子,删除 ‘**linuxtechi**‘ 用户的密码。 ``` [root@linuxworld ~]# passwd -d linuxtechi Removing password for user linuxtechi. passwd: Success [root@linuxworld ~]# [root@linuxworld ~]# passwd -S linuxtechi linuxtechi NP 2015-09-20 0 99999 7 -1 (Empty password.) [root@linuxworld ~]# ``` “**-d**” 选项将清空用户密码,并禁用用户登录。 ### 例5:设置密码立即过期 在 passwd 命令中使用 '-e' 选项会立即使用户的密码过期,这将强制用户在下次登录时更改密码。 ``` [root@linuxworld ~]# passwd -e linuxtechi Expiring password for user linuxtechi. passwd: Success [root@linuxworld ~]# passwd -S linuxtechi linuxtechi PS 1970-01-01 0 99999 7 -1 (Password set, SHA512 crypt.) [root@linuxworld ~]# ``` 现在尝试用 linuxtechi 用户 SSH 连接到主机。 ![](/data/attachment/album/201510/28/234624aijgn53kdh153du0.jpg) ### 例6:锁定系统用户的密码 在 passwd 命令中使用 ‘**-l**‘ 选项能锁定用户的密码,它会在密码的起始位置加上“!”。当他/她的密码被锁定时,用户将不能更改它的密码。 ``` [root@linuxworld ~]# passwd -l linuxtechi Locking password for user linuxtechi. passwd: Success [root@linuxworld ~]# passwd -S linuxtechi linuxtechi LK 2015-09-20 0 99999 7 -1 (Password locked.) [root@linuxworld ~]# ``` ### 例7:使用 -u 选项解锁用户密码 ``` [root@linuxworld ~]# passwd -u linuxtechi Unlocking password for user linuxtechi. passwd: Success [root@linuxworld ~]# ``` ### 例8:使用 -i 选项设置非活动时间 在 passwd 命令中使用 -i 选项用于设系统用户的非活动时间。当用户(我使用的是linuxtechi用户)密码过期后,用户再经过 ‘**n**‘ 天后(在我的情况下是10天)没有更改其密码,用户将不能登录。 ``` [root@linuxworld ~]# passwd -i 10 linuxtechi Adjusting aging data for user linuxtechi. passwd: Success [root@linuxworld ~]# [root@linuxworld ~]# passwd -S linuxtechi linuxtechi PS 2015-09-20 0 99999 7 10 (Password set, SHA512 crypt.) [root@linuxworld ~]# ``` ### 例9:使用 -n 选项设置密码更改的最短时间 在下面的例子中,linuxtechi用户必须在90天内更改密码。0表示用户可以在任何时候更改它的密码。 ``` [root@linuxworld ~]# passwd -n 90 linuxtechi Adjusting aging data for user linuxtechi. passwd: Success [root@linuxworld ~]# passwd -S linuxtechi linuxtechi PS 2015-09-20 90 99999 7 10 (Password set, SHA512 crypt.) [root@linuxworld ~]# ``` ### 例10:使用 -w 选项设置密码过期前的警告期限 ‘**-w**’ 选项在 passwd 命令中用于设置用户的警告期限。这意味着,n天之后,他/她的密码将过期。 ``` [root@linuxworld ~]# passwd -w 12 linuxtechi Adjusting aging data for user linuxtechi. passwd: Success [root@linuxworld ~]# passwd -S linuxtechi linuxtechi PS 2015-09-20 90 99999 12 10 (Password set, SHA512 crypt.) [root@linuxworld ~]# ``` --- via: <http://www.linuxtechi.com/10-passwd-command-examples-in-linux/> 作者:[Pradeep Kumar](http://www.linuxtechi.com/author/pradeep/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,489
Linux有问必答:如何强制在下次登录Linux时更换密码
http://ask.xmodulo.com/force-password-change-next-login-linux.html
2015-10-29T13:31:19
[ "passwd", "chage", "密码" ]
/article-6489-1.html
> > **提问**:我管理着一台多人共享的Linux服务器。我刚使用默认密码创建了一个新用户,但是我想用户在第一次登录时更换密码。有没有什么方法可以让他/她在下次登录时修改密码呢? > > > 在多用户Linux环境中,标准实践是使用一个默认的随机密码创建一个用户账户。成功登录后,新用户自己改变默认密码。出于安全考虑,经常建议“强制”用户在第一次登录时修改密码来确保这个一次性使用的密码不会再被使用。 下面是**如何强制用户在下次登录时修改他/她的密码**。 ![](/data/attachment/album/201510/29/133114zroc75r1hr7oyqqr.jpeg) 每个Linux用户都关联这不同的密码相关配置和信息。比如,记录着上次密码更改的日期、最小/最大的修改密码的天数、密码何时过期等等。 一个叫chage的命令行工具可以访问并调整密码过期相关配置。你可以使用这个工具来强制用户在下次登录修改密码、 要查看特定用户的过期信息(比如:alice),运行下面的命令。注意的是除了你自己之外查看其他任何用户的密码信息都需要root权限。 ``` $ sudo chage -l alice ``` ![](/data/attachment/album/201510/29/133123htznf6z3yesedzzi.jpg) ### 强制用户修改密码 如果你想要强制用户去修改他/她的密码,使用下面的命令。 ``` $ sudo chage -d0 <user-name> ``` 原本“-d ”参数是用来设置密码的“年龄”(也就是上次修改密码起到1970/1/1起的天数)。因此“-d0”的意思是上次密码修改的时间是1970/1/1,这就让当前的密码过期了,也就强制让他在下次登录的时候修改密码了。 另外一个过期当前密码的方式是用passwd命令。 ``` $ sudo passwd -e <user-name> ``` 上面的命令和“chage -d0”作用一样,让当前用户的密码立即过期。 现在检查用户的信息,你会发现: ![](/data/attachment/album/201510/29/133124fffnkkngnqjn44cr.jpg) 当你再次登录时候,你会被要求修改密码。你会在修改前被要求再验证一次当前密码。 ![](/data/attachment/album/201510/29/133125td8aldxlqh8cdchc.jpg) 要设置更全面的密码策略(如密码复杂性,防止重复使用),则可以使用PAM。参见[这篇文章](http://xmodulo.com/set-password-policy-linux.html)了解更多详情。 --- via: <http://ask.xmodulo.com/force-password-change-next-login-linux.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /force-password-change-next-login-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327581f30>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,490
如何将 Oracle 11g 升级到 Orcale 12c
http://www.unixmen.com/upgrade-from-oracle-11g-to-oracle-12c/
2015-10-29T13:51:43
[ "Oracle" ]
https://linux.cn/article-6490-1.html
![](/data/attachment/album/201510/29/135146vmafav6226gz77zm.jpg) 大家好。今天我们来学习一下如何将 Oracle 11g 升级到 Oracle 12c。开始吧。 在此,我使用的是 CentOS 7 64 位 Linux 发行版。我假设你已经在你的系统上安装了 Oracle 11g。 ### 这里我会展示一下安装 Oracle 11g 时我的操作步骤。 我在 Oracle 11g 上选择 “Create and configure a database”,如下图所示。 ![](/data/attachment/album/201510/29/135149vtfto8rnozizt7oi.png) 然后我选择安装 Oracle 11g “Decktop Class”。如果是生产环境,你必须选择 “Server Class”。 ![](/data/attachment/album/201510/29/135150yd3cuhii9uzn7hdz.png) 然后你输入安装 Oracle 11g 的各种路径以及密码。下面是我自己的 Oracle 11g 安装配置。确保你正确输入了 Oracle 的密码。 ![](/data/attachment/album/201510/29/135152wgv5vb1v4ry548cs.png) 下一步,我按照如下设置 Inventory Directory。 ![](/data/attachment/album/201510/29/135155q7rfz4h6so9kucks.png) 到这里,我已经向你展示了我安装 Oracle 11g 所做的工作,因为我们开始想升级到 12c。 ### 让我们将 Oracle 11g 升级到 Oracle 12c 吧。 你需要从该[链接](http://www.oracle.com/technetwork/database/enterprise-edition/downloads/database12c-linux-download-1959253.html)上下载两个 zip 文件。下载并解压两个文件到相同目录。文件名为 **linuxamd64*12c*database\_1of2.zip** & **linuxamd64*12c*database\_2of2.zip**。提取或解压完后,它会创建一个名为 database 的文件夹。 注意:升级到 12c 之前,请确保在你的 CentOS 上已经安装了所有必须的软件包,并且所有的路径变量也已经正确配置,还有其它前提条件也已经满足。 下面是必须使用正确版本安装的一些软件包 * binutils * compat-libstdc++ * gcc * glibc * libaio * libgcc * libstdc++ * make * sysstat * unixodbc 在因特网上搜索正确的 rpm 版本。 你也可以用一个查询处理多个软件包,然后在输出中查找正确版本。例如,在终端中输入下面的命令: ``` rpm -q binutils compat-libstdc++ gcc glibc libaio libgcc libstdc++ make sysstat unixodbc ``` 你的系统中必须安装了以下软件包(版本可能或新或旧) * binutils-2.23.52.0.1-12.el7.x86\_64 * compat-libcap1-1.10-3.el7.x86\_64 * gcc-4.8.2-3.el7.x86\_64 * gcc-c++-4.8.2-3.el7.x86\_64 * glibc-2.17-36.el7.i686 * glibc-2.17-36.el7.x86\_64 * glibc-devel-2.17-36.el7.i686 * glibc-devel-2.17-36.el7.x86\_64 * ksh * libaio-0.3.109-9.el7.i686 * libaio-0.3.109-9.el7.x86\_64 * libaio-devel-0.3.109-9.el7.i686 * libaio-devel-0.3.109-9.el7.x86\_64 * libgcc-4.8.2-3.el7.i686 * libgcc-4.8.2-3.el7.x86\_64 * libstdc++-4.8.2-3.el7.i686 * libstdc++-4.8.2-3.el7.x86\_64 * libstdc++-devel-4.8.2-3.el7.i686 * libstdc++-devel-4.8.2-3.el7.x86\_64 * libXi-1.7.2-1.el7.i686 * libXi-1.7.2-1.el7.x86\_64 * libXtst-1.2.2-1.el7.i686 * libXtst-1.2.2-1.el7.x86\_64 * make-3.82-19.el7.x86\_64 * sysstat-10.1.5-1.el7.x86\_64 你也需要 unixODBC-2.3.1 或更新版本的驱动。 我希望你安装 Oracle 11g 的时候已经在你的 CentOS 7 上创建了名为 oracle 的用户。让我们以用户 oracle 登录 CentOS。以用户 oracle 登录到 CentOS 之后,在你的 CentOS上打开一个终端。 使用终端更改工作目录并导航到你解压两个 zip 文件的目录。在终端中输入以下命令开始安装 12c。 ``` ./runInstaller ``` ![](/data/attachment/album/201510/29/135156da0rzp0qb0p00906.png) 如果一切顺利,你会看到类似下面的截图,已经开始安装 12c。 ![](/data/attachment/album/201510/29/135204y6q7vv4jdmyqv361.png) 然后你可以选择跳过更新或者下载最近更新。如果是生产服务器,建议你必须更新。我这里选择跳过。 ![](/data/attachment/album/201510/29/135207vwf8ffozlfpnojfx.png) 现在,选择升级现有数据库。 ![](/data/attachment/album/201510/29/135209f39lc7c7c47zq177.png) 对于语言,这里已经有 English。点击下一步继续,或者你可以根据你的需要添加语言。 ![](/data/attachment/album/201510/29/135212njjn2jpqww2y0zsc.png) 现在,选择企业版。你可以根据你的需求选择。 ![](/data/attachment/album/201510/29/135214k6cn65iqcfwchdl7.png) 然后选择软件位置路径,这些都是不言自明的。 ![](/data/attachment/album/201510/29/135217l8nk23yfxx82cik3.png) 对于第七步,像下面这样使用默认的选择继续下一步。 ![](/data/attachment/album/201510/29/135220lecnb9lebr0buzze.png) 在第九步中,你会看到一个类似下面这样的总结报告。 ![](/data/attachment/album/201510/29/135222hbu00ob52p22d0bg.png) 如果一切正常,你可以点击第九步中的 install 开始安装,进入第十步。 ![](/data/attachment/album/201510/29/135224rrkrzkik91n5z39w.png) 其中你可能会遇到一些错误,你需要通过谷歌找到这些错误的解决方法。你可能遇到的问题会有很多,因此我没有在这里详细介绍。 要有耐心,一步一步走下来最后它会告诉你成功了。否则,在谷歌上搜索做必要的操作解决问题。再一次说明,由于你可能会遇到的错误有很多,我无法在这里提供所有详细介绍。 现在,只需要按照下面屏幕指令配置监听器。 ### 数据库升级助手 配置完监听器之后,它会启动<ruby> 数据库升级助手 <rp> ( </rp> <rt> Database Upgrade Assistant </rt> <rp> ) </rp></ruby>。选择 Upgrade Oracle Database。 ![](/data/attachment/album/201510/29/135227rqbqhh5zbfos8ra6.png) 在第二步,你会发现它显示了 11g 的位置路径以及 12c 的位置路径。同时你也会发现它指示说从原来的 Oracle Home Release 11 安装 Oracle Home Release 12.点击下一步进入步骤三。 ![](/data/attachment/album/201510/29/135230knppskpp78aiw7rp.png) 按照屏幕上的说明完成安装。 在最后一步,你会看到一个成功窗口,其中你会看到成功升级了 oracle 数据库。 **一个忠告**:对于你的生产服务器,在升级到 12c 之前,请确保你已经在其它平台上测试过,以便你能修复升级过程中遇到的所有错误。永远不要尝试一无所知的时候就升级生产服务器。 --- via: <http://www.unixmen.com/upgrade-from-oracle-11g-to-oracle-12c/> 作者:[Mohammad Forhad Iftekher](http://www.unixmen.com/author/forhad/) 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,498
使用 openssl 命令行构建 CA 及证书
https://raymii.org/s/tutorials/OpenSSL_command_line_Root_and_Intermediate_CA_including_OCSP_CRL%20and_revocation.html
2015-10-30T17:51:55
[ "SSL", "CA", "证书", "openssl" ]
https://linux.cn/article-6498-1.html
这是一篇快速指南,使用 OpenSSL 来生成 CA (<ruby> 证书授权中心 <rp> ( </rp> <rt> certificate authority </rt> <rp> ) </rp></ruby>)、 <ruby> 中级 CA <rp> ( </rp> <rt> intermediate CA </rt> <rp> ) </rp></ruby> 和<ruby> 末端证书 <rp> ( </rp> <rt> end certificate </rt> <rp> ) </rp></ruby>。包括 OCSP、CRL 和 CA <ruby> 颁发者 <rp> ( </rp> <rt> Issuer </rt> <rp> ) </rp></ruby>信息、具体颁发和失效日期。 我们将设置我们自己的<ruby> 根 CA <rp> ( </rp> <rt> root CA </rt> <rp> ) </rp></ruby>,然后使用根 CA 生成一个示例的中级 CA,并使用中级 CA 签发最终用户证书。 ![](/data/attachment/album/201510/30/175138m6djbdllr5y7v6r6.jpg) ### 根 CA 为根 CA 创建一个目录,并进入: ``` mkdir -p ~/SSLCA/root/ cd ~/SSLCA/root/ ``` 生成根 CA 的 8192 位长的 RSA 密钥: ``` openssl genrsa -out rootca.key 8192 ``` 输出类似如下: ``` Generating RSA private key, 8192 bit long modulus .........++ ....................................................................................................................++ e is 65537 (0x10001) ``` 如果你要用密码保护这个密钥,在命令行添加选项 `-aes256`。 创建 SHA-256 自签名的根 CA 证书 `ca.crt`;你需要为你的根 CA 提供识别信息: ``` openssl req -sha256 -new -x509 -days 1826 -key rootca.key -out rootca.crt ``` 输出类似如下: ``` You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:CN State or Province Name (full name) [Some-State]:Beijing Locality Name (eg, city) []:Chaoyang dist. Organization Name (eg, company) [Internet Widgits Pty Ltd]:Linux.CN Organizational Unit Name (eg, section) []:Linux.CN CA Common Name (e.g. server FQDN or YOUR name) []:Linux.CN Root CA Email Address []:[email protected] ``` 创建几个文件, 用于该 CA 存储其序列号: ``` touch certindex echo 1000 > certserial echo 1000 > crlnumber ``` 创建 CA 的配置文件,该文件包含 CRL 和 OCSP 终端的存根。 ``` # vim ca.conf [ ca ] default_ca = myca [ crl_ext ] issuerAltName=issuer:copy authorityKeyIdentifier=keyid:always [ myca ] dir = ./ new_certs_dir = $dir unique_subject = no certificate = $dir/rootca.crt database = $dir/certindex private_key = $dir/rootca.key serial = $dir/certserial default_days = 730 default_md = sha1 policy = myca_policy x509_extensions = myca_extensions crlnumber = $dir/crlnumber default_crl_days = 730 [ myca_policy ] commonName = supplied stateOrProvinceName = supplied countryName = optional emailAddress = optional organizationName = supplied organizationalUnitName = optional [ myca_extensions ] basicConstraints = critical,CA:TRUE keyUsage = critical,any subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer keyUsage = digitalSignature,keyEncipherment,cRLSign,keyCertSign extendedKeyUsage = serverAuth crlDistributionPoints = @crl_section subjectAltName = @alt_names authorityInfoAccess = @ocsp_section [ v3_ca ] basicConstraints = critical,CA:TRUE,pathlen:0 keyUsage = critical,any subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer keyUsage = digitalSignature,keyEncipherment,cRLSign,keyCertSign extendedKeyUsage = serverAuth crlDistributionPoints = @crl_section subjectAltName = @alt_names authorityInfoAccess = @ocsp_section [ alt_names ] DNS.0 = Linux.CN Root CA DNS.1 = Linux.CN CA Root [crl_section] URI.0 = http://pki.linux.cn/rootca.crl URI.1 = http://pki2.linux.cn/rootca.crl [ ocsp_section ] caIssuers;URI.0 = http://pki.linux.cn/rootca.crt caIssuers;URI.1 = http://pki2.linux.cn/rootca.crt OCSP;URI.0 = http://pki.linux.cn/ocsp/ OCSP;URI.1 = http://pki2.linux.cn/ocsp/ ``` 如果你要设置一个特定的证书起止时间,添加下述内容到 `[myca]`。 ``` # format: YYYYMMDDHHMMSS default_enddate = 20191222035911 default_startdate = 20181222035911 ``` ### 创建1号中级 CA 生成中级 CA 的私钥 ``` openssl genrsa -out intermediate1.key 4096 ``` 生成其 CSR: ``` openssl req -new -sha256 -key intermediate1.key -out intermediate1.csr ``` 输出类似如下: ``` You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:CN State or Province Name (full name) [Some-State]:Beijing Locality Name (eg, city) []:Chaoyang dist. Organization Name (eg, company) [Internet Widgits Pty Ltd]:Linux.CN Organizational Unit Name (eg, section) []:Linux.CN CA Common Name (e.g. server FQDN or YOUR name) []:Linux.CN Intermediate CA Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: ``` 请确保中级 CA 的主题名(CN,Common Name)和根 CA 的不同。 使用根 CA 为你创建的中级 CA 的 CSR 签名: ``` openssl ca -batch -config ca.conf -notext -in intermediate1.csr -out intermediate1.crt ``` 输出类似如下: ``` Using configuration from ca.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'CN' stateOrProvinceName :ASN.1 12:'Beijing' localityName :ASN.1 12:'chaoyang dist.' organizationName :ASN.1 12:'Linux.CN' organizationalUnitName:ASN.1 12:'Linux.CN CA' commonName :ASN.1 12:'Linux.CN Intermediate CA' Certificate is to be certified until Mar 30 15:07:43 2017 GMT (730 days) Write out database with 1 new entries Data Base Updated ``` 生成 CRL (包括 PEM 和 DER 两种格式): ``` openssl ca -config ca.conf -gencrl -keyfile rootca.key -cert rootca.crt -out rootca.crl.pem openssl crl -inform PEM -in rootca.crl.pem -outform DER -out rootca.crl ``` 每次使用该 CA 签名证书后都需要生成 CRL。 如果需要的话,你可以<ruby> 撤销 <rp> ( </rp> <rt> revoke </rt> <rp> ) </rp></ruby>这个中级证书: ``` openssl ca -config ca.conf -revoke intermediate1.crt -keyfile rootca.key -cert rootca.crt ``` ### 配置1号中级 CA 给该中级 CA 创建新目录,并进入: ``` mkdir ~/SSLCA/intermediate1/ cd ~/SSLCA/intermediate1/ ``` 从根 CA 那边复制这个中级 CA 的证书和私钥: ``` cp ../root/intermediate1.key ./ cp ../root/intermediate1.crt ./ ``` 创建索引文件: ``` touch certindex echo 1000 > certserial echo 1000 > crlnumber ``` 创建一个新的 `ca.conf` : ``` # vim ca.conf [ ca ] default_ca = myca [ crl_ext ] issuerAltName=issuer:copy authorityKeyIdentifier=keyid:always [ myca ] dir = ./ new_certs_dir = $dir unique_subject = no certificate = $dir/intermediate1.crt database = $dir/certindex private_key = $dir/intermediate1.key serial = $dir/certserial default_days = 365 default_md = sha1 policy = myca_policy x509_extensions = myca_extensions crlnumber = $dir/crlnumber default_crl_days = 365 [ myca_policy ] commonName = supplied stateOrProvinceName = supplied countryName = optional emailAddress = optional organizationName = supplied organizationalUnitName = optional [ myca_extensions ] basicConstraints = critical,CA:FALSE keyUsage = critical,any subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer keyUsage = digitalSignature,keyEncipherment extendedKeyUsage = serverAuth crlDistributionPoints = @crl_section subjectAltName = @alt_names authorityInfoAccess = @ocsp_section [ alt_names ] DNS.0 = Linux.CN Intermidiate CA 1 DNS.1 = Linux.CN CA Intermidiate 1 [ crl_section ] URI.0 = http://pki.linux.cn/intermediate1.crl URI.1 = http://pki2.linux.cn/intermediate1.crl [ ocsp_section ] caIssuers;URI.0 = http://pki.linux.cn/intermediate1.crt caIssuers;URI.1 = http://pki2.linux.cn/intermediate1.crt OCSP;URI.0 = http://pki.linux.cn/ocsp/ OCSP;URI.1 = http://pki2.linux.cn/ocsp/ ``` 修改 `[alt_names]` 小节为你所需的<ruby> 替代主题名 <rp> ( </rp> <rt> Subject Alternative names </rt> <rp> ) </rp></ruby>。如果不需要就删除引入它的 `subjectAltName = @alt_names` 行。 如果你需要指定起止时间,添加如下行到 `[myca]` 中。 ``` # format: YYYYMMDDHHMMSS default_enddate = 20191222035911 default_startdate = 20181222035911 ``` 生成一个空的 CRL (包括 PEM 和 DER 两种格式): ``` openssl ca -config ca.conf -gencrl -keyfile intermediate1.key -cert intermediate1.crt -out intermediate1.crl.pem openssl crl -inform PEM -in intermediate1.crl.pem -outform DER -out intermediate1.crl ``` ### 创建最终用户证书 我们使用新的中级 CA 来生成最终用户的证书。为每个你需要用此 CA 签名的最终用户证书重复这些步骤。 ``` mkdir ~/enduser-certs cd ~/enduser-certs ``` 生成最终用户的私钥: ``` openssl genrsa -out enduser-example.com.key 4096 ``` 生成最终用户的 CSR: ``` openssl req -new -sha256 -key enduser-example.com.key -out enduser-example.com.csr ``` 输出类似如下: ``` You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:CN State or Province Name (full name) [Some-State]:Shanghai Locality Name (eg, city) []:Xuhui dist. Organization Name (eg, company) [Internet Widgits Pty Ltd]:Example Inc Organizational Unit Name (eg, section) []:IT Dept Common Name (e.g. server FQDN or YOUR name) []:example.com Email Address []: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []: An optional company name []: ``` 用1号中级 CA 签名最终用户的证书: ``` cd ~/SSLCA/intermediate1 openssl ca -batch -config ca.conf -notext -in ~/enduser-certs/enduser-example.com.csr -out ~/enduser-certs/enduser-example.com.crt ``` 输出类似如下: ``` Using configuration from ca.conf Check that the request matches the signature Signature ok The Subject's Distinguished Name is as follows countryName :PRINTABLE:'CN' stateOrProvinceName :ASN.1 12:'Shanghai' localityName :ASN.1 12:'Xuhui dist.' organizationName :ASN.1 12:'Example Inc' organizationalUnitName:ASN.1 12:'IT Dept' commonName :ASN.1 12:'example.com' Certificate is to be certified until Mar 30 15:18:26 2016 GMT (365 days) Write out database with 1 new entries Data Base Updated ``` 生成 CRL (包括 PEM 和 DER 两种格式): ``` cd ~/SSLCA/intermediate1/ openssl ca -config ca.conf -gencrl -keyfile intermediate1.key -cert intermediate1.crt -out intermediate1.crl.pem openssl crl -inform PEM -in intermediate1.crl.pem -outform DER -out intermediate1.crl ``` 每次使用该 CA 签名证书后都需要生成 CRL。 如果需要的话,你可以撤销revoke这个最终用户证书: ``` cd ~/SSLCA/intermediate1/ openssl ca -config ca.conf -revoke ~/enduser-certs/enduser-example.com.crt -keyfile intermediate1.key -cert intermediate1.crt ``` 输出类似如下: ``` Using configuration from ca.conf Revoking Certificate 1000. Data Base Updated ``` 将根证书和中级证书连接起来创建证书链文件: ``` cat ../root/rootca.crt intermediate1.crt > ~/enduser-certs/enduser-example.com.chain ``` 将这些文件发送给最终用户: ``` enduser-example.com.crt enduser-example.com.key enduser-example.com.chain ``` 你也可以让最终用户提供他们中级的 CSR 文件,而只发回给他们 这个 `.crt` 文件。不要从服务器上删除它们,否则就不能撤销了。 ### 校验证书 你可以通过如下命令使用证书链来验证最终用户证书: ``` cd ~/enduser-certs openssl verify -CAfile enduser-example.com.chain enduser-example.com.crt enduser-example.com.crt: OK ``` 你也可以用 CRL 来校验它。首先将 PEM CRL 连接到证书链文件: ``` cd ~/SSLCA/intermediate1 cat ../root/rootca.crt intermediate1.crt intermediate1.crl.pem > ~/enduser-certs/enduser-example.com.crl.chain ``` 校验证书: ``` cd ~/enduser-certs openssl verify -crl_check -CAfile enduser-example.com.crl.chain enduser-example.com.crt ``` 如果该证书未撤销,输出如下: ``` enduser-example.com.crt: OK ``` 如果撤销了,输出如下: ``` enduser-example.com.crt: CN = example.com, ST = Beijing, C = CN, O = Example Inc, OU = IT Dept error 23 at 0 depth lookup:certificate revoked ```
404
Not Found
null
6,501
多图:LibreOffice 这五年(2010-2015)
https://tlhp.cf/libreoffice-5years-evolution/
2015-10-31T09:23:00
[ "LibreOffice" ]
/article-6501-1.html
[LibreOffice](http://www.libreoffice.org/),来自<ruby> 文档基金会 <rp> ( </rp> <rt> The Document Foundation </rt> <rp> ) </rp></ruby>一个自由开源的令人惊叹的办公套件。LO (LibreOffice)在2010年9月28日由 [OpenOffice.org](https://www.openoffice.org/) 分支出来;而 OOo (OpenOffice.org)则是早期的 [StarOffice](http://www.staroffice.org/) 开源版本。LibreOffice 支持文字处理,创建与编辑电子表格,幻灯片,图表和图形,数据库,数学公式的创建和编辑等。 ### 核心应用: * **Writer** – 文字处理器 * **Calc** – 电子表格应用程序,类似于 Excel * **Impress** – 应用演示,支持 Microsoft PowerPoint 的格式 * **Draw** – 矢量图形编辑器 * **Math** – 用于编写和​​编辑数学公式的特殊应用 * **Base** – 数据库管理 ![LibreOffice 3.3, 2011](/data/attachment/album/201510/30/204544esmu7epnsmz2mux7.png) *LibreOffice 3.3, 2011* 这是LibreOffice 的第一个版本 - 分支自 OpenOffice.org ![LibreOffice 3.4](/data/attachment/album/201510/30/204547r45zraia395vq9rh.png) *LibreOffice 3.4* ![LibreOffice 3.5](/data/attachment/album/201510/30/204548jzstpeaqoz1lgs1l.jpg) *LibreOffice 3.5* ![LibreOffice 3.6](/data/attachment/album/201510/30/204550ugme5zh1ppqohaga.png) *LibreOffice 3.6* ![Libre Office 4.0](/data/attachment/album/201510/30/204552f49sived527s23ci.png) *LibreOffice 4.0* ![Libre Office 4.1](/data/attachment/album/201510/30/204555uzbba3q4u5qbaugx.png) *LibreOffice 4.1* ![Libre Office 4.2](/data/attachment/album/201510/30/204557b8k4a4zs2wz3zr00.png) *Libre Office 4.2* ![LibreOffice 4.3](/data/attachment/album/201510/30/204600mtxzk9mb3f8fsmf3.jpg) *LibreOffice 4.3* ![LibreOffice 4.4](/data/attachment/album/201510/30/204601ydq8co8v0zieq28a.png) *LibreOffice 4.4* ![Libre Office 5.0](/data/attachment/album/201510/30/204603whlpmngpwwhpbpl7.png) *LibreOffice 5.0* ### Libre Office 的发展,出自 Wikipedia ![StarOffice major derivatives](/data/attachment/album/201510/30/204608csdnliisshnqsa2n.png) ### LibreOffice 5.0 预览 (这个视频长达半个小时。配音太魔性了,已被击败了~) --- via: <https://tlhp.cf/libreoffice-5years-evolution/> 作者:[Pavlo Rudyi](https://tlhp.cf/author/paul/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPSConnectionPool(host='tlhp.cf', port=443): Max retries exceeded with url: /libreoffice-5years-evolution/ (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7b8327582b60>: Failed to resolve 'tlhp.cf' ([Errno -2] Name or service not known)"))
null
6,504
新的 RTL 协作组将加速实时 Linux 的发展
http://www.linux.com/news/software/applications/858828-new-collaborative-group-to-speed-real-time-linux
2015-10-31T19:22:30
[ "RTL", "实时Linux" ]
https://linux.cn/article-6504-1.html
在不久前的 <ruby> Linux 大会活动 <rp> ( </rp> <rt> LinuxCon </rt> <rp> ) </rp></ruby>上 <ruby> Linux 基金会 <rp> ( </rp> <rt> Linux Foundation </rt> <rp> ) </rp></ruby>[宣称](http://www.linuxfoundation.org/news-media/announcements/2015/10/linux-foundation-announces-project-advance-real-time-linux),<ruby> 实时Linux操作系统项目 <rp> ( </rp> <rt> RTL,Real-Time Linux </rt> <rp> ) </rp></ruby>得到了新的资金支持,并预期这将促进该项目,使其自成立15年来第一次有机会在实时操作性上和其他的<ruby> 实时操作系统 <rp> ( </rp> <rt> RTOS,Real Time Operation System </rt> <rp> ) </rp></ruby>一较高下。Linux 基金会将 RTL 组重组为一个新的项目,并命名为<ruby> RTL协作组 <rp> ( </rp> <rt> Real-Time Linux Collaborative Project </rt> <rp> ) </rp></ruby>,该项目将获得更有力的资金支持,更多的开发人员将投入其中,并更加紧密地集成到 Linux 内核主线开发中。 ![新的 RTL 协作组将加速实时 Linux 的发展](/data/attachment/album/201510/31/192204vdlzwrn63rornlu1.jpg) 根据 Linux 基金会的说法,RTL 项目并入 Linux基金会旗下后,“在研发方面将为业界节省数百万美元的费用。”同时此举也将“通过强有力的上游内核测试体系而改善本项目的代码质量”。 在过去的十几年中,RTL 项目的开发管理和经费资助主要由<ruby> <a href="http://archive.linuxgizmos.com/celebrating-the-open-source-automation-development-labs-first-birthday/"> 开源自动化开发实验室 </a> <rp> ( </rp> <rt> OSADL,Open Source Automation Development Lab </rt> <rp> ) </rp></ruby>承担,OSADL 将继续作为新合作项目的金牌成员之一,但其原来承担的资金资助工作将会在一月份移交给 Linux 基金会。RTL 项目和 [OSADL](https://www.osadl.org/) 长久以来一直负责维护<ruby> 内核的实时抢占 <rp> ( </rp> <rt> RT-Preempt 或 Preempt-RT </rt> <rp> ) </rp></ruby>补丁,并定期将其更新到 Linux 内核的主线上。 据长期以来一直担任 OSADL 总经理的 Carsten Emde 博士介绍,支持内核实时特性的工作已经完成了将近 90%。 “这就像盖房子,”他解释说。 “主要的部件,如墙壁,窗户和门都已经安装到位,就实时内核来说,类似的主要部件包括:<ruby> 高精度定时器 <rp> ( </rp> <rt> high-resolution timers </rt> <rp> ) </rp></ruby>,<ruby> 中断线程化机制 <rp> ( </rp> <rt> interrupt threads </rt> <rp> ) </rp></ruby>和<ruby> 优先级可继承的互斥量 <rp> ( </rp> <rt> priority-inheritance mutexes </rt> <rp> ) </rp></ruby>等。然后所剩下的就是需要一些边边角角的工作,就如同装修房子过程中还剩下铺设如地毯和墙纸等来完成最终的工程。” 以 Emde 观点来看,从技术的角度来说,实时 Linux 的性能已经可以媲美绝大多数其他的实时操作系统 - 但前提是你要不厌其烦地把所有的补丁都打上。 Emde 的原话如下:“该项目(LCTT 译注,指 RTL)的唯一目标就是提供一个满足实时性要求的 Linux 系统,使其无论运行状况如何恶劣都可以保证在确定的、可以预先定义的时间期限内对外界处理做出响应。这个目标已经实现,但需要你手动地将 RTL 提供的补丁添加到 Linux 内核主线的版本代码上,但将来的不用打补丁的实时 Linux 内核也能实现这个目标。唯一的,当然也是最重要的区别就是相应的维护工作将少得多,因为我们再也不用一次又一次移植那些独立于内核主线的补丁代码了。” 新的 RTL 协作组将继续在 Thomas Gleixner 的指导下工作,Thomas Gleixner 在过去的十多年里一直是 RTL 的核心维护人员。本周,Gleixner 被任命为 Linux 基金会成员,并加入了一个特别的小组,小组成员包括 Linux 稳定内核维护者Greg Kroah-Hartman,Yocto 项目维护者 Richard Purdie 和 Linus Torvalds 本人。 据 Emde 介绍,RTL 的第二维护人 Steven Rostedt 来自 Red Hat 公司,他负责“维护旧的,但尚保持维护的内核版本”,他将和同样来自 Red Hat 的 Ingo Molnàr 继续参与该项目,Ingo 是 RTL 的关键开发人员,但近年来更多地从事咨询方面的工作。有些令人惊讶的是,Red Hat 竟然不是 RTL 协作组的成员之一。相反,谷歌作为唯一的白金会员占据了头把交椅,其他黄金会员包括<ruby> 国家仪器公司 <rp> ( </rp> <rt> NI,National Instruments </rt> <rp> ) </rp></ruby>,OSADL 和德州仪器(TI)。银卡会员包括Altera 公司,ARM,Intel 和 IBM。 ### 走向实时内核的漫长道路 当15年前 Linux 第一次出现在嵌入式设备上的时候,它所面临的嵌入式计算市场已经被其他的实时操作系统,譬如<ruby> 风河公司 <rp> ( </rp> <rt> WindRiver </rt> <rp> ) </rp></ruby>的 VxWorks,所牢牢占据。VxWorks 从那时起到现在,一直在为众多的工控设备、航空电子设备以及交通运输应用提供着工业级别的高确定性的,硬实时的内核。微软后来也提供了一个支持实时性的操作系统版本- Windows CE,当时的 Linux 所面临的是来自潜在工业客户的公开嘲讽和层层阻力。他们认为那些从桌面系统改进来的 Linux 发行版本顶多适合要求不高的轻量级消费类电子产品,而不适合那些对硬实时要求更高的设备。 对于嵌入式 Linux 的先行者如 [MontaVista 公司](http://www.linux.com/news/embedded-mobile/mobile-linux/841651-embedded-linux-pioneer-montavista-spins-iot-linux-distribution)来说,其[早期的目标](http://archive.linuxgizmos.com/real-time-linux-what-is-it-why-do-you-want-it-how-do-you-do-it-a/)很明确就是要改进 Linux 的实时能力。多年以来,对 Linux 的实时性能开发发展迅速,得到各种组织的支持,如[成立于2006年](http://archive.linuxgizmos.com/industry-group-aims-linux-at-automation-apps/)的 OSADL,以及<ruby> 实时 Linux 基金会 <rp> ( </rp> <rt> RTLF,Real-Time Linux Foundation </rt> <rp> ) </rp></ruby>。在2009年 [OSADL 与 RTLF 合并](http://archive.linuxgizmos.com/industrial-linux-groups-merge/),OSADL 及其 RTL 组承担了所有的<ruby> 抢占式实时内核 <rp> ( </rp> <rt> Preempt-RT </rt> <rp> ) </rp></ruby>补丁的维护工作和将补丁提交到上游内核主线的工作。除此之外 OSADL 还负责监管其他自动化相关的项目,例如<ruby> <a href="https://www.osadl.org/Safety-Critical-Linux.safety-critical-linux.0.html"> 高可靠性 Linux </a> <rp> ( </rp> <rt> Safety Critical Linux </rt> <rp> ) </rp></ruby>(译者注:指研究如何在关键系统上可靠安全地运行Linux)。 OSADL 对 RTL 的支持经历了三个阶段:拥护和推广,测试和质量评估,以及最后的资金支持。Emde 表示,在早期,OSADL 的角色仅限于写写推广的文章,制作专题报告,组织相关培训,以及“宣传” RTL 的优点。他说:“要让一个相当保守的工控行业接受象 Linux 之类的新技术及其基于社区的那种开发模式,首先就需要建立其对新事物的信任。从使用专有的实时操作系统转向改用 Linux 对公司意味着必须引入新的战略和流程,才能与社区进行互动。” 后来,OSADL 改而提供技术性能数据,建立[质量评估和测试中心](http://www.osadl.org/QA-Farm-Realtime.qa-farm-about.0.html),并在和开源相关的法律事务问题和安全认证方面向行业成员提供帮助。 当 RTL 在实时性上变得愈加成熟的同时,相反地 Windows CE 却是江河日下,[其市场份额正在快速地被 RTL 所蚕食](http://www.linux.com/news/embedded-mobile/mobile-linux/818011-embedded-linux-keeps-growing-amid-iot-disruption-says-study),一些与 RTL 竞争的实时 Linux 项目,主要是 [Xenomai](http://xenomai.org/) 也已开始集成 RTL。 “伴随 RTL 补丁的成功,以及明确的预期其最终会被完整集成到 Linux 内核主线代码中,导致 Xenomai 关注的重心发生了变化,”Emde 说。 “Xenomai 3.0 可与 RT 补丁结合起来使用,并提供了所谓的‘皮肤’,(LCTT 译注:一个封装层),使我们可以复用为其他系统编写的代码。不过,它们还没有完全统一起来,因为 Xenomai 使用了双内核方法,而RT 补丁只适用于单一的 Linux 内核。“ 近些年来,RTL 组的资助来源越来越少,所以最终 OSADL 接过了这个重任。Emde 说:“当最近开发工作因缺少资金而陷入停滞时,OSADL 对 RTL 的支持进入到第三个重大阶段:开始直接资助 Thomas Gleixner 的工作。” 正如 Emde 在其[10月5日的一篇博文](https://www.osadl.org/Single-View.111+M5dee6946dab.0.html)中所描述的那样,实时 Linux 的应用领域正在日益扩大,由其原来主要服务的工业控制扩大到了汽车行业和电信业等领域,这表明资助的来源也应该得到拓宽。Emde 原文写道:“仅仅靠来自工控行业的资金来支撑全部的工作是不合理的,因为电信等其他行业也在享用实时 Linux 内核。” 当 Linux 基金会表明有兴趣提供资金支持时,OSADL 认为“单一的资助和控制渠道要有效得多”(LCTT 译注:指最终由Linux 基金会全盘接手了 RTL 项目),Emde 如是说。不过,他补充说,作为黄金级成员,OSADL 仍参与监管项目的工作,会继续从事其宣传和质量保证方面的活动。 ### 汽车行业期待 RTL 的崛起 Emde 表示,RTL 会继续在工业应用领域飞速发展并逐渐取代其他实时操作系统。而且,他补充说,RTL 在汽车行业发展也很迅猛,以后会扩大并应用到铁路和航空电子设备上。 的确,Linux 在汽车行业将扮演越来越重要的角色,这也是 Linux 基金对 RTL 所寄予厚望的原因之所在。RTL 工作组可能会与 Linux 基金会旗下的<ruby> <a href="http://www.linux.com/news/embedded-mobile/mobile-linux/833358-first-open-automotive-grade-linux-spec-released"> 车载Linux </a> <rp> ( </rp> <rt> AGL,Automotive Grade Linux </rt> <rp> ) </rp></ruby>工作组展开合作。Emde 猜测,Google 高调参与的主要动因可能也是希望将 RTL 用于汽车控制。此外,德州仪器(TI)也非常期望将其 Jacinto 处理器应用于汽车行业。 面向车载 Linux 的项目(比如AGL)的目标是要扩大 Linux 在车载设备上的应用范围,其应用不是仅限于<ruby> 车载信息娱乐 <rp> ( </rp> <rt> IVI,In-Vehicle Infotainment </rt> <rp> ) </rp></ruby>,而是要进入到譬如集群控制和车载通讯领域,而这些领域目前主要使用的是 QNX 之类的实时操作系统。无人驾驶汽车在实时性上对操作系统也有很高的要求。 Emde 特别指出,OSADL 的 [SIL2LinuxMP](http://www.osadl.org/SIL2LinuxMP.sil2-linux-project.0.html) 项目可能会在将 RTL 引入到汽车工业领域上扮演重要的角色。SIL2LinuxMP 并不是专门针对汽车工业的项目,但随着 BMW 公司参与其中,汽车行业成为其很重要的应用领域之一。该项目的目标在于验证 RTL 在采用单核或多核 CPU 的<ruby> 标准化商用 <rp> ( </rp> <rt> COTS,Commercial Off-The-Shelf </rt> <rp> ) </rp></ruby>板卡上运行所需的基本组件。它定义了引导程序、根文件系统、Linux 内核以及对应支持 RTL 的 C 库。 无人机和机器人使用实时 Linux 的时机也已成熟,Xenomai 系统早已用在许多机器人以及一些无人机中。不过,在更广泛的嵌入式 Linux 世界,包括了消费电子产品和物联网应用中,RTL 可以扮演的角色很有限。主要的障碍在于,无线通信和互联网本身会带来延迟。 Emde 说:“目前实时 Linux 主要还是应用于系统内部控制以及系统与周边外设之间的控制,在远程控制机器上作用不大。企图通过互联网实现实时控制恐怕不是一件可行的事情。” --- via: <http://www.linux.com/news/software/applications/858828-new-collaborative-group-to-speed-real-time-linux> 作者:[Eric Brown](http://www.linux.com/community/forums/person/42808) 译者:[unicornx](https://github.com/unicornx) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,506
前所未有的神速,仅半年后就推出了 GNU Hurd 0.7
https://www.gnu.org/software/hurd/news/2015-10-31-releases.html
2015-11-01T08:22:49
[ "Hurd" ]
https://linux.cn/article-6506-1.html
[GNU Hurd](https://www.gnu.org/software/hurd/hurd.html) 是 GNU 工程中取代 [Unix](https://www.gnu.org/software/hurd/unix.html) 的核心。 Hurd 是一组运行在 Mach 微内核上的[服务器](https://www.gnu.org/software/hurd/hurd/translator.html),用来实现 Unix 或其他核心(如 Linux)实现了的文件系统、网络协议、及文件访问控制等其他功能。 ![GNU Hurd](/data/attachment/album/201504/16/090220kblgie5lljbb3wmk.png) Hurd 内核向来因其开发缓慢而被吐槽,不过,这次的0.7版本发布居然距离上次的0.6发布才仅仅半年!看来…… GNU Hurd 0.7 于 2015/10/31 发布,主要更新内容有: * 改进了 ext2fs 中的节点缓存功能 * 极大的改进了原生的 fackroot 工具,现在它可以处理命令套接字,以及修复了一些权限问题 * 引入新的功能 rpcscan,用于扫描 Mach 服务器并显示关联到 demuxer 的 RPC * 代码可以工作在更新版本的编译器和 libc 下 下载地址: * <ftp://ftp.gnu.org/gnu/hurd/> * <http://ftp.gnu.org/gnu/hurd/> * <http://git.savannah.gnu.org/cgit/hurd/hurd.git> 与之同时发布的还有 GNU Mach 1.6 、GNU MIG 1.6。[GNU Mach](https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html) 是 [Mach 微内核](https://www.gnu.org/software/hurd/microkernel/mach.html)的 GNU 版本,它是 GNU Hurd 系统的基础。该[微内核](https://www.gnu.org/software/hurd/microkernel.html)提供了 [IPC](https://www.gnu.org/software/hurd/ipc.html) 机制,用于定义一个接口,以实现传统的操作系统内核所提供的分布式的多服务器功能。[GNU MIG](https://www.gnu.org/software/hurd/microkernel/mach/mig/gnu_mig.html) 是 [Mach 3.0 接口生成器 (MIG)](https://www.gnu.org/software/hurd/microkernel/mach/mig.html) 的 GNU 版本。它用来将 [RPC](https://www.gnu.org/software/hurd/rpc.html) 定义的文件翻译为 C 代码,主要用于编译 Hurd 时 RPC 相关的软件包。 以下是 Hurd 发布历史: * [hurd-announce](http://www.gnu.org/software/hurd/history/hurd-announce) -- GNU Hurd announcement, May 91 * [hurd-announce2](http://www.gnu.org/software/hurd/history/hurd-announce2) -- GNU Hurd announcement, Nov 93 * [hurd-flash](http://www.gnu.org/software/hurd/history/hurd-flash) -- News flash, Apr 94 -- it boots! * [hurd-flash2](http://www.gnu.org/software/hurd/history/hurd-flash2) -- News flash, May 94 * [hurd-flash3](http://www.gnu.org/software/hurd/history/hurd-flash3) -- News flash, Jul 94 -- emacs runs! * [hurd-flash4](http://www.gnu.org/software/hurd/history/hurd-flash4) -- News flash, Aug 94 * [hurd-flash5](http://www.gnu.org/software/hurd/history/hurd-flash5) -- News flash, Sep 94 -- gcc runs! * [hurd-flash6](http://www.gnu.org/software/hurd/history/hurd-flash6) -- News flash, Nov 94 * [hurd-flash7](http://www.gnu.org/software/hurd/history/hurd-flash7) -- New Snapshot, Apr 95 * [hurd-flash8](http://www.gnu.org/software/hurd/history/hurd-flash8) -- New Snapshot, Jul 95 -- ext2fs support * [hurd-flash9](http://www.gnu.org/software/hurd/history/hurd-flash9) -- News Flash, Nov 95 -- ftp works! * [hurd-flash10](http://www.gnu.org/software/hurd/history/hurd-flash10) -- New Snapshot, Apr 96 -- NFS and lots else works! * [hurd-flash11](http://www.gnu.org/software/hurd/history/hurd-flash11) -- Binary image available, Apr 96 This and [NetBSD](http://www.netbsd.org/) boot flopies should be enough to get a working GNU/Hurd system! * [hurd-flash12](http://www.gnu.org/software/hurd/history/hurd-flash12) -- Test release status (Jul 96) * [hurd-flash13](http://www.gnu.org/software/hurd/history/hurd-flash13) -- Test release announcement (Aug 96) * [GNU Hurd 0.1](http://news.gmane.org/find-root.php?message_id=%3c199609070249%2EWAA24297%40geech%2Egnu%2Eai%2Emit%2Eedu%3e) (1996-09-06) * [GNU Mach 1.0](http://news.gmane.org/find-root.php?message_id=%3c199704142043%2EQAA01894%40churchy%2Egnu%2Eai%2Emit%2Eedu%3e) (1997-04-14) * [GNU Mach 1.1](http://news.gmane.org/find-root.php?message_id=%3c199705091753%2ENAA15557%40sugar%2Dbombs%2Egnu%2Eai%2Emit%2Eedu%3e) (1997-05-09) * [GNU Mach 1.1.1](http://news.gmane.org/find-root.php?message_id=%3c199705121633%2EMAA26409%40sugar%2Dbombs%2Egnu%2Eai%2Emit%2Eedu%3e) (1997-05-12) * [GNU Mach 1.1.2](http://news.gmane.org/find-root.php?message_id=%3c199706102159%2ERAA13943%40churchy%2Egnu%2Eai%2Emit%2Eedu%3e) (1997-06-10?) * [hurd-flash14](http://www.gnu.org/software/hurd/history/hurd-flash14) -- Release 0.2 announcement (Hurd) * [hurd-flash15](http://www.gnu.org/software/hurd/history/hurd-flash15) -- Release 0.2 announcement (complete GNU system) + [GNU 0.2](http://news.gmane.org/find-root.php?message_id=%3c199706162021%2EQAA18370%40sugar%2Dbombs%2Egnu%2Eai%2Emit%2Eedu%3e) (1997-06-16) * [GNU MIG 1.0.1](http://news.gmane.org/find-root.php?message_id=%3c199812040849%2EDAA07660%40baalperazim%2Efrob%2Ecom%3e) (1998-12-04) * [GNU Mach 1.2](http://news.gmane.org/find-root.php?message_id=%3c199906211918%2EPAA26822%40x15%2Dcruise%2Dbasselope%2Emit%2Eedu%3e) (1999-06-21) * [GNU MIG 1.1](http://news.gmane.org/find-root.php?message_id=%3c199906231741%2ENAA46739%40pusey%2Emit%2Eedu%3e) (1999-06-23) * [GNU MIG 1.2](http://news.gmane.org/find-root.php?message_id=%3c20010622215446%2EI6130%40212%2E23%2E136%2E22%3e) (2001-06-22) * [GNU MIG 1.3](http://news.gmane.org/find-root.php?message_id=%3c20020308220603%2EA90E61B9C4%40perdition%2Elinnaean%2Eorg%3e) (2002-03-08) * [GNU Mach 1.3](http://news.gmane.org/find-root.php?message_id=%3c20020527203155%2E88DBE1BA15%40perdition%2Elinnaean%2Eorg%3e) (2002-05-27) * [GNU MIG 1.3.1](http://news.gmane.org/find-root.php?message_id=%3c20020830194413%2EGA6819%40outpost%2Ednsalias%2Eorg%3e) (2002-08-30) * [GNU Hurd 0.5, GNU Mach 1.4, GNU MIG 1.4 released](http://www.gnu.org/software/hurd/news/2013-09-27.html) (2013-09-27) * [GNU Hurd 0.6, GNU Mach 1.5, GNU MIG 1.5 released](http://www.gnu.org/software/hurd/news/2015-04-10-releases.html) (2015-04-10) * [GNU Hurd 0.7, GNU Mach 1.6, GNU MIG 1.6 released](http://www.gnu.org/software/hurd/news/2015-10-31-releases.html) (2015-10-31)
200
OK
GNU Hurd 0.7, GNU Mach 1.6, GNU MIG 1.6 released. We're pleased to announce new releases! **GNU Hurd 0.7**,[NEWS](https://git.savannah.gnu.org/cgit/hurd/hurd.git/tree/NEWS?id=v0.7):`Version 0.7 (2015-10-31) The node cache in ext2fs has been improved, generalized, and moved to libdiskfs. It is now also used by isofs and fatfs. The native fakeroot tool has been greatly improved. It now handles named sockets, and multiple corner cases related to permissions were identified and fixed. A new utility `rpcscan' has been introduced. It scans Mach servers and displays the RPCs handled by the associated demuxer. A long-standing synchronization issue involving the filesystem translators, libdiskfs, and libpager has been identified and fixed. The code has been updated to work with newer versions of the compiler and libc, and numerous bugs have been fixed throughout the code.` Release tarballs may be downloaded from [ftp://ftp.gnu.org/gnu/hurd/](ftp://ftp.gnu.org/gnu/hurd/),[http://ftp.gnu.org/gnu/hurd/](http://ftp.gnu.org/gnu/hurd/), or checked out of Git,[https://git.savannah.gnu.org/cgit/hurd/hurd.git](https://git.savannah.gnu.org/cgit/hurd/hurd.git). SHA1 checksums:`a735a07687f7996face3bd310af2254192a02f40 hurd-0.7.tar.bz2 d10b3c1de191ac88425aa30a03c4130e2a883b14 hurd-0.7.tar.bz2.sig 62032e04bf6b22e4c874772f1f77d5678d916054 hurd-0.7.tar.gz 7fafd66e0003ea3768f76bd597e617bdc202e312 hurd-0.7.tar.gz.sig` The is the GNU project's replacement for the**GNU Hurd**[Unix](../unix.html)kernel. It is a collection of[servers](../hurd/translator.html)that run on the Mach microkernel to implement file systems, network protocols, file access control, and other features that are implemented by the Unix kernel or similar kernels (such as Linux). More detailed:[documentation](../hurd/documentation.html),[what is the GNU Hurd](../hurd/what_is_the_gnu_hurd.html).**GNU Mach 1.6**,[NEWS](https://git.savannah.gnu.org/cgit/hurd/gnumach.git/tree/NEWS?id=v1.6):`Version 1.6 (2015-10-31) The code has been updated to work with newer versions of the compiler, and numerous bugs have been fixed throughout the code. The lock debugging infrastructure has been revived and improved, and many locking issues have been fixed. The IPC tables and the hash table mapping objects to IPC entries have been replaced by radix trees. This addresses a scalability issue, as IPC tables required huge amounts of continuous virtual kernel memory. The kernel now allows non-privileged users to wire a small amount of memory. A bug hindering the eviction of inactive pages by the pageout daemon has been identified and fixed. The kernel now keeps timestamps relative to the system boot time. Among other things this fixes bogus uptime readings if the system time is altered. A reference leak in the exception handling mechanism has been identified and fixed. ANSI escape sequences are now handled when using `printf'. This fixes the formatting of messages printed by various Linux drivers.` Release tarballs may be downloaded from [ftp://ftp.gnu.org/gnu/gnumach/](ftp://ftp.gnu.org/gnu/gnumach/),[http://ftp.gnu.org/gnu/gnumach/](http://ftp.gnu.org/gnu/gnumach/), or checked out of Git,[https://git.savannah.gnu.org/cgit/hurd/gnumach.git](https://git.savannah.gnu.org/cgit/hurd/gnumach.git). SHA1 checksums:`73e09c43955ef2e3459b2877b5e6d6bbe517b8c3 gnumach-1.6.tar.bz2 96ff426b3b94acf327a88f25c80ab5b5f26ed94a gnumach-1.6.tar.bz2.sig 448cd88974a5264736c900691c9ab62a810aff28 gnumach-1.6.tar.gz e06e733ad11f2e048dd9ad3348c2d3100be26078 gnumach-1.6.tar.gz.sig` is the GNU distribution of the**GNU Mach**[Mach microkernel](../microkernel/mach.html), upon which a GNU Hurd system is based. The[microkernel](../microkernel.html)provides an[Inter Process Communication (IPC)](../ipc.html)mechanism that the Hurd uses to define interfaces for implementing in a distributed multi-server fashion the services a traditional operating system kernel provides. More detailed:[documentation](../microkernel/mach/documentation.html).**GNU MIG 1.6**,[NEWS](https://git.savannah.gnu.org/cgit/hurd/mig.git/tree/NEWS?id=v1.6):`Version 1.6 (2015-10-31) MIG now emits RPC lookup functions that are declared `static inline' improving compatibility with newer dialects of C.` Release tarballs may be downloaded from [ftp://ftp.gnu.org/gnu/mig/](ftp://ftp.gnu.org/gnu/mig/),[http://ftp.gnu.org/gnu/mig/](http://ftp.gnu.org/gnu/mig/), or checked out of Git,[https://git.savannah.gnu.org/cgit/hurd/mig.git](https://git.savannah.gnu.org/cgit/hurd/mig.git). SHA1 checksums:`a9a4b5666834afe8fb861453c5b3ef324201f1d3 mig-1.6.tar.bz2 93562c45bbda40ad31f74f6f2fd0c064ef8f0ec5 mig-1.6.tar.bz2.sig 6e937a35229da02e9e739d75a03020e24a1b5297 mig-1.6.tar.gz fc25bb9652406675fed63c4581493a6fc39d9690 mig-1.6.tar.gz.sig` is the GNU distribution of the**GNU MIG**[Mach 3.0 Interface Generator (MIG)](../microkernel/mach/mig.html). This tool translates[Remote Procedure Call (RPC)](../rpc.html)definition files to C code, and is required to compile any packages that are receiving or invoking RPCs, such as GNU Mach, GNU Hurd, and the GNU C Library (glibc) when compiled for the Hurd. More detailed:[documentation](../microkernel/mach/mig/documentation.html).**glibc-2.19-hurd+libpthread-20151031**Snapshot tarballs may be downloaded from [ftp://alpha.gnu.org/gnu/hurd/](ftp://alpha.gnu.org/gnu/hurd/),[http://alpha.gnu.org/gnu/hurd/](http://alpha.gnu.org/gnu/hurd/), or checked out of Git,[https://git.savannah.gnu.org/cgit/hurd/glibc.git](https://git.savannah.gnu.org/cgit/hurd/glibc.git)and[https://git.savannah.gnu.org/cgit/hurd/libpthread.git](https://git.savannah.gnu.org/cgit/hurd/libpthread.git). SHA1 checksums:`5b709297f8622444695f13723f77dfc8754b8ed9 glibc-2.19-hurd+libpthread-20151031.tar.bz2 b970e604368fd80420ef029bb1c86fc2f7b2c382 glibc-2.19-hurd+libpthread-20151031.tar.bz2.sig 68f02cd3890654588183539428253a12ff98ea0d glibc-2.19-hurd+libpthread-20151031.tar.gz da8b38a9a9914a2dedba82a0cf353a4ce0ea30e7 glibc-2.19-hurd+libpthread-20151031.tar.gz.sig` The implements a system's standard library functions (as described by ISO C, and POSIX, for example). An important part of the Hurd actually resides in glibc: here, the system interfaces are implemented on top of the**GNU C Library**(glibc)[Hurd IPC protocols](../hurd/interface.html). This is different to the Linux port, where most simple system interfaces are in fact simply forwarded to/implemented as[system call](../system_call.html)s. Many thanks to all the people who are helping! If you want to give the Hurd a try, you may easily do so with [Debian GNU/Hurd](../hurd/running/debian.html). The GNU Hurd system currently runs on 32-bit x86 machines. To compile the Hurd, you need a toolchain configured to target `i?86-gnu` ; you cannot use a toolchain targeting GNU/Linux. Please read the [FAQ](../faq.html). Bug reports should be sent to [bug-hurd](../mailing_lists/bug-hurd.html) or filed on [http://savannah.gnu.org/bugs/?group=hurd](http://savannah.gnu.org/bugs/?group=hurd). Requests for assistance should be sent to [help-hurd](../mailing_lists/help-hurd.html) or filed on [http://savannah.gnu.org/support/?group=hurd](http://savannah.gnu.org/support/?group=hurd). You can also find us on the Freenode IRC network in the [#hurd](../irc.html) channel.
6,508
Linux 上好用的 R 语言 IDE
http://xmodulo.com/good-ide-for-r-on-linux.html
2015-11-01T15:44:39
[ "R语言", "编辑器", "IDE" ]
https://linux.cn/article-6508-1.html
前一段时间,我已经介绍过 [Linux 上针对 C/C++ 语言的最好 IDE](http://xmodulo.com/good-ide-for-c-cpp-linux.html)。很显然 C 或 C++ 并不是现存的唯一的编程语言,是时间讨论某些更加特别的语言了。 假如你做过一些统计工作,很可能你已经见识过 [R 语言](https://www.r-project.org/) 了。假如你还没有,我真的非常推荐这门专为统计和数据挖掘而生的开源编程语言。若你拥有编程背景,它的语法可能会使你感到有些不适应,但希望它的向量化操作所带来的快速能够吸引到你。简而言之,请尝试使用一下这门语言。而要做到这一点,使用一个好的 IDE 来入门或许会更好。R 作为一门跨平台的语言,有着一大把好用的 IDE,它们使得用 R 语言进行数据分析变得更惬意。假如你非常钟意一个特定的编辑器,这里也有一些好用的插件来将它转变为一个成熟的 R 语言的 IDE。 ![](/data/attachment/album/201511/01/154432z0dnxs5z0zawzdad.jpg) 下面就让我们见识一下 Linux 环境下 5 个针对 R 语言的好用 IDE吧。 ### 1. RStudio ![](/data/attachment/album/201511/01/154443pqssfbzi63zmg088.jpg) 就让我们以或许是最为人们喜爱的 R IDE —— [RStudio](https://www.rstudio.com/) 来开始我们的介绍吧。除了一般 IDE 所提供的诸如语法高亮、代码补全等功能,RStudio 还因其集成了 R 语言帮助文档、强大的调试器、多视图系统而突出。如果你准备入门 R 语言,我只建议你将 RStudio 作为你的 R 语言控制台,一方面用它来实时测试代码是很完美的,另外对象浏览器可以帮助你理解你正在处理的是哪类数据。最后,真正征服我的是它集成了图形显示器,使得你能够更轻松地将图形输出为图片文件。至于它不好的方面, RStudio 缺乏快捷键和高级设置来使得它成为一个完美的 IDE。然而,它有一个以 AGPL 协议发布的免费版本, Linux 用户没有借口不去试试这个 IDE。 ### 2. 带有 ESS 插件的 Emacs ![](/data/attachment/album/201511/01/154445gze3intmqteg3ejz.jpg) 在我的前一个有关 IDE 的文章中,很多朋友对我所给出的清单中没有 Emacs 而感到失望。对于这个,我的主要理由是 Emacs 可以说是 IDE 里面的“通配符”:你可以将它放到任意语言的 IDE 清单中。但对于 [带有 ESS 插件的 R](http://ess.r-project.org/) 来说,事情就变得有些不同了。Emacs Speaks Statistics (ESS) 是一个令人惊异的插件,它将完全改变你使用 Emacs 编辑器的方式,真的非常适合 R 编程者的需求。与 RStudio 类似,带有 ESS 的 Emacs 拥有多视图,它有两个面板:一个显示代码,另一个则是一个 R 控制台,使得实时地测试代码和探索数据对象变得更加容易。但 ESS 真正的长处是可以和你已安装的其他 Emacs 插件无缝集成,以及它的高级配置选项。简而言之,如果你喜欢你的 Emacs 快捷键,你将能够在 R 语言开发环境下使用它们。然而,当你在 ESS 中处理大量数据时,我已经听闻并经历了一些效率低下的问题。尽管这个问题不是很重大,但足以让我更偏好 RStudio。 ### 3. Vim 及 Vim-R-plugin ![](/data/attachment/album/201511/01/154445xmuo3lutb3bxtbt7.jpg) 在谈论完 Emacs 后,因为我不想去讨论 Emacs 和 Vim 的优劣,所以我尽力给予 Vim 同样的待遇,下面介绍 [Vim R 插件](http://www.vim.org/scripts/script.php?script_id=2628)。使用名为 tmux 的终端工具,这个工具使得在开启一个 R 控制台的同时,又书写 R 代码成为可能。但最为重要的是,它还为 Vim 带来了 R 语言的语法高亮和自动补全。你还可以轻易地获取 R 帮助文档和浏览数据对象。但再次强调,这些强大的功能来源于它大量的自定义选项和 Vim 的速度。假如你被这些功能所诱惑,我希望你能够通读有关介绍如何安装这个插件并设置相关环境的[文档](http://www.lepem.ufc.br/jaa/r-plugin.html)。 ### 4. 带有 RGedit 的 Gedit ![](/data/attachment/album/201511/01/154445halo2xex2llng9x4.jpg) 若 Emacs 和 Vim 都不是你的菜,而你恰好喜欢默认的 Gnome 编辑器,则 [RGedit](http://rgedit.sourceforge.net/) 就是专门为你而生的:它是 Gedit 的一个专门编辑 R 代码的插件。Gedit 比你以为的更强大,配上大量的插件,就有可能用它来做许许多多的事情。而 RGedit 恰好就是你编辑 R 代码所需要的那款插件。它支持传统的语法高亮并在屏幕下方集成了 R 控制台,但它还有一大类独特的功能,例如多文件编辑、代码折叠、文件查看器,甚至还有一个 GUI 的向导用来从 snippets 产生代码。尽管我对 Gedit 并不感冒,但我必须承认这些功能比一般插件的功能更好,并且在你花费很长时间去分析数据时它会有很大的帮助。唯一的不足是它的最后一次更新是 2013 年。我真的希望这个项目能够被重新焕发新生。 ### 5. RKWard ![](/data/attachment/album/201511/01/154445ra0ecfi36snceqwn.jpg) 最后的并不意味着最不重要,作为这个清单的最后,[RKWard](https://rkward.kde.org/) 是一个 KDE 环境下的 R 语言 IDE。我最喜爱它的一点是它的名称。但说老实话,它的包管理系统和类似电子表格的数据编辑器排在我最喜欢它的理由的第二位。除了这些,它还包含一个简单的用来画图和导入数据的系统,另外它还可以使用插件来扩展功能。假如你不是一个 KDE 迷,或许你有点不喜欢这个,但若你是,我真的建议你考虑使用它。 总的来说,无论你是否刚入门 R 语言,这些 IDE 对你或许都有些帮助。假如你更偏好某个软件它自身所代表的东西或者是偏好针对你喜爱的编辑器的插件,这些都没有什么问题,我确信你将感激这些软件所提供的某些功能。同时我还确信我遗漏了很多好的针对 R 语言的 IDE,或许它们值得罗列在这个清单上。鉴于你们在上一篇针对 C/C++ 的最好 IDE 这个话题中陈述了很多非常有用的评论,我也邀请你们在这里做出同样精彩的评论并分享出你的知识。 关于 Linux 下针对 R 语言的好用编辑器,你有什么看法呢?请在下面的评论中让我们知晓。 --- via: <http://xmodulo.com/good-ide-for-r-on-linux.html> 作者:[Adrien Brochard](http://xmodulo.com/author/adrien) 译者:[FSSlc](https://github.com/FSSlc) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,510
用 screenfetch 和 linux_logo 显示带有酷炫 Linux 标志的基本硬件信息
http://www.cyberciti.biz/hardware/howto-display-linux-logo-in-bash-terminal-using-screenfetch-linux_logo/
2015-11-02T09:52:00
[ "screenfetch", "linux_logo" ]
https://linux.cn/article-6510-1.html
想在屏幕上显示出你的 Linux 发行版的酷炫标志和基本硬件信息吗?不用找了,来试试超赞的 screenfetch 和 linux\_logo 工具。 ![Linux Logo](/data/attachment/album/201511/01/230001y3s98ro26295ta9f.jpg) ### 来看看 screenfetch 吧 screenFetch 是一个能够在截屏中显示系统/主题信息的命令行脚本。它可以在 Linux,OS X,FreeBSD 以及其它的许多类Unix系统上使用。来自 man 手册的说明: > > 这个方便的 Bash 脚本可以用来生成那些漂亮的终端主题信息和用 ASCII 构成的发行版标志,就像如今你在别人的截屏里看到的那样。它会自动检测你的发行版并显示 ASCII 版的发行版标志,并且在右边显示一些有价值的信息。 > > > #### 在 Linux 上安装 screenfetch 打开终端应用。在基于 Debian 或 Ubuntu 或 Mint 的系统上只需要输入下列 [apt-get 命令](http://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html): ``` $ sudo apt-get install screenfetch ``` ![](/data/attachment/album/201511/01/230228p7if3cl27nh9zzf0.jpg) *图一:用 apt-get 安装 screenfetch* 如果源里面没有这个软件,可以采用如下方法: ``` wget https://github.com/KittyKatt/screenFetch/archive/master.zip unzip master.zip sudo mv screenFetch-master/screenfetch-dev /usr/bin/screenfetch ``` #### 在 Mac OS X 上安装 screenfetch 输入下列命令: ``` $ brew install screenfetch ``` ![](/data/attachment/album/201511/01/230229fs635gs5505w5k0g.jpg) *图二:用 brew 命令安装 screenfetch* #### 在 FreeBSD 上安装 screenfetch 输入下列 pkg 命令: ``` $ sudo pkg install sysutils/screenfetch ``` ![](/data/attachment/album/201511/01/230231kl87dwsl750m0wal.jpg) *图三:在 FreeBSD 用 pkg 安装 screenfetch* #### 在 Fedora 上安装 screenfetch 输入下列 dnf 命令: ``` $ sudo dnf install screenfetch ``` ![](/data/attachment/album/201511/01/230232ln4v994fu1fqvp2q.jpg) *图四:在 Fedora 22 用 dnf 安装 screenfetch* #### 我该怎么使用 screefetch 工具? 只需输入以下命令: ``` $ screenfetch ``` 这是不同系统的输出: ![](/data/attachment/album/201511/01/230233w92d45x9bbtb7x21.jpg) *Fedora 上的 Screenfetch* ![](/data/attachment/album/201511/01/230235x5ihd1qrq7e8hj1i.jpg) *OS X 上的 Screenfetch* ![](/data/attachment/album/201511/01/230236b5ayn5uas6646yae.jpg) *FreeBSD 上的 Screenfetch* ![](/data/attachment/album/201511/01/230237d3ru6tpt620640t6.jpg) *Debian 上的 Screenfetch* #### 获取截屏 要获取截屏并保存成文件,输入: ``` $ screenfetch -s ``` 你会看到一个文件 ~/Desktop/screenFetch-\*.jpg。获取截屏并直接上传到 imgur,输入: ``` $ screenfetch -su imgur ``` **输出示例:** ``` -/+:. veryv@Viveks-MacBook-Pro :++++. OS: 64bit Mac OS X 10.10.5 14F27 /+++/. Kernel: x86_64 Darwin 14.5.0 .:-::- .+/:-``.::- Uptime: 3d 1h 36m .:/++++++/::::/++++++/:` Packages: 56 .:///////////////////////:` Shell: bash 3.2.57 ////////////////////////` Resolution: 2560x1600 1920x1200 -+++++++++++++++++++++++` DE: Aqua /++++++++++++++++++++++/ WM: Quartz Compositor /sssssssssssssssssssssss. WM Theme: Blue :ssssssssssssssssssssssss- Font: Not Found osssssssssssssssssssssssso/` CPU: Intel Core i5-4288U CPU @ 2.60GHz `syyyyyyyyyyyyyyyyyyyyyyyy+` GPU: Intel Iris `ossssssssssssssssssssss/ RAM: 6405MB / 8192MB :ooooooooooooooooooo+. `:+oo+/:-..-:/+o+/- Taking shot in 3.. 2.. 1.. 0. ==> Uploading your screenshot now...your screenshot can be viewed at http://imgur.com/HKIUznn ``` 你可以访问 <http://imgur.com/HKIUznn> 来查看上传的截屏。 ### 再来看看 linux\_logo linux\_logo 程序生成一个彩色的 ANSI 版企鹅图片,还包含一些来自 /proc 的系统信息。 #### 安装 只需按照你的 Linux 发行版输入对应的命令: #### Debian/Ubutnu/Mint ``` # apt-get install linuxlogo ### 注意名字略微不同 ``` #### CentOS/RHEL/旧版 Fedora ``` # yum install linux_logo ``` #### Fedora Linux v22+ 或更新版本 ``` # dnf install linux_logo ``` #### 运行它 只需输入下列命令: ``` $ linux_logo ``` ![](/data/attachment/album/201511/01/230238zgh6gy2aoirkh4e6.jpg) *运行 linux\_logo* #### 等等,还有更多! 你可以用这个命令查看内置的标志列表: ``` $ linux_logo -f -L list ``` **输出示例:** ``` Available Built-in Logos: Num Type Ascii Name Description 1 Classic Yes aix AIX Logo 2 Banner Yes bsd_banner FreeBSD Logo 3 Classic Yes bsd FreeBSD Logo 4 Classic Yes irix Irix Logo 5 Banner Yes openbsd_banner OpenBSD Logo 6 Classic Yes openbsd OpenBSD Logo 7 Banner Yes solaris The Default Banner Logos 8 Banner Yes banner The Default Banner Logo 9 Banner Yes banner-simp Simplified Banner Logo 10 Classic Yes classic The Default Classic Logo 11 Classic Yes classic-nodots The Classic Logo, No Periods 12 Classic Yes classic-simp Classic No Dots Or Letters 13 Classic Yes core Core Linux Logo 14 Banner Yes debian_banner_2 Debian Banner 2 15 Banner Yes debian_banner Debian Banner (white) 16 Classic Yes debian Debian Swirl Logos 17 Classic Yes debian_old Debian Old Penguin Logos 18 Classic Yes gnu_linux Classic GNU/Linux 19 Banner Yes mandrake Mandrakelinux(TM) Banner 20 Banner Yes mandrake_banner Mandrake(TM) Linux Banner 21 Banner Yes mandriva Mandriva(TM) Linux Banner 22 Banner Yes pld PLD Linux banner 23 Classic Yes raspi An ASCII Raspberry Pi logo 24 Banner Yes redhat RedHat Banner (white) 25 Banner Yes slackware Slackware Logo 26 Banner Yes sme SME Server Banner Logo 27 Banner Yes sourcemage_ban Source Mage GNU/Linux banner 28 Banner Yes sourcemage Source Mage GNU/Linux large 29 Banner Yes suse SUSE Logo 30 Banner Yes ubuntu Ubuntu Logo Do "linux_logo -L num" where num is from above to get the appropriate logo. Remember to also use -a to get ascii version. ``` 查看 aix 的标志,输入: ``` $ linux_logo -f -L aix ``` 查看 openbsd 的标志: ``` $ linux_logo -f -L openbsd ``` 或者只是随机看看一些 Linux 标志: ``` $ linux_logo -f -L random_xy ``` 你[可以像下面那样结合 bash 的循环来显示不同的标志](http://www.cyberciti.biz/faq/bash-for-loop/),输入: ![](/data/attachment/album/201511/01/230241p2ut2tyjjzrtcqq8.gif) *动图1: linux\_logo 和 bash 循环,既有趣又能发朋友圈耍酷* ### 获取帮助 输入下列命令: ``` $ screefetch -h $ linux_logo -h ``` **参考** * [screenFetch 主页](https://github.com/KittyKatt/screenFetch) * [linux\_logo 主页](https://github.com/deater/linux_logo) --- via: <http://www.cyberciti.biz/hardware/howto-display-linux-logo-in-bash-terminal-using-screenfetch-linux_logo/> 作者:Vivek Gite 译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,511
Linux有问必答:如何找出Linux中内置模块的信息
http://ask.xmodulo.com/find-information-builtin-kernel-modules-linux.html
2015-11-02T08:00:00
[ "内核", "模块", "LKM" ]
/article-6511-1.html
> > **提问**:我想要知道Linux系统中内核内置的模块,以及每个模块有哪些参数。有什么方法可以得到内置模块和设备驱动的列表,以及它们的详细信息呢? > > > 现代Linux内核正在随着时间变化而迅速增长,以支持大量的硬件、文件系统和网络功能。在此期间,“可加载模块(loadable kernel modules,[LKM])”的引入防止内核变得越来越臃肿,以及在不同的环境中灵活地扩展功能及硬件支持,而不必重新构建内核。 最新的Linux发行版的内核只带了相对较小的“内置模块(built-in modules)”,其余的特定硬件驱动或者自定义功能作为“可加载模块”来让你选择地加载或卸载。 内置模块被静态地编译进了内核。不像可加载内核模块可以动态地使用`modprobe`、`insmod`、`rmmod`、`modinfo`或者`lsmod`等命令地加载、卸载、查询模块,内置的模块总是在启动时就加载进了内核,不会被这些命令管理。 ### 找出内置模块列表 要得到内置模块列表,运行下面的命令。 ``` $ cat /lib/modules/$(uname -r)/modules.builtin ``` ![](/data/attachment/album/201511/01/232711yq6p65ccibc9cyxp.jpg) 你也可以用下面的命令来查看有哪些内置模块: ![](/data/attachment/album/201511/01/232714azzxxj4lj7mmqltm.jpg) ### 找出内置模块参数 每个内核模块无论是内置的还是可加载的都有一系列的参数。对于可加载模块,`modinfo`命令可以显示它们的参数信息。然而这个命令对内置模块没有用。你会得到下面的错误。 ``` modinfo: ERROR: Module XXXXXX not found. ``` 如果你想要查看内置模块的参数,以及它们的值,你可以在 **/sys/module** 下检查它们的内容。 在 /sys/module目录下,你可以找到内核模块(包含内置和可加载的)命名的子目录。进入每个模块目录,这里有个“parameters”目录,列出了这个模块所有的参数。 比如你要找出tcp\_cubic(内核默认的TCP实现)模块的参数。你可以这么做: ``` $ ls /sys/module/tcp_cubic/parameters ``` 接着阅读这个文件查看每个参数的值。 ``` $ cat /sys/module/tcp_cubic/parameters/tcp_friendliness ``` ![](/data/attachment/album/201511/01/232716riqyd474ir934iq4.jpg) --- via: <http://ask.xmodulo.com/find-information-builtin-kernel-modules-linux.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /find-information-builtin-kernel-modules-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327582590>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,512
RHCE 系列(三):如何使用 Linux 工具集生成和发送系统活动报告
http://www.tecmint.com/linux-performance-monitoring-and-file-system-statistics-reports/
2015-11-03T08:15:00
[ "RHCE", "sysstat", "dstat" ]
https://linux.cn/article-6512-1.html
作为一个系统工程师,你经常需要生成一些显示系统资源利用率的报告,以便确保:1)正在合理利用系统,2)防止出现瓶颈,3)确保可扩展性,以及其它原因。 ![监视 Linux 性能活动报告](/data/attachment/album/201511/02/231737aynkjyjd8zlhmysz.jpg) *RHCE 第三部分:监视 Linux 性能活动报告* 除了著名的用于检测磁盘、内存和 CPU 使用率的原生 Linux 工具 - 可以给出很多例子,红帽企业版 Linux 7 还提供了另外两个可以为你的报告更多数据的工具套装:sysstat 和 dstat。 在这篇文章中,我们会介绍两者,但首先让我们来回顾一下传统工具的使用。 ### 原生 Linux 工具 使用 df,你可以报告磁盘空间以及文件系统的 inode 使用情况。你需要监视这两者,因为缺少磁盘空间会阻止你保存更多文件(甚至会导致系统崩溃),就像耗尽 inode 意味着你不能将文件链接到对应的数据结构,从而导致同样的结果:你不能将那些文件保存到磁盘中。 ``` # df -h [以人类可读形式显示输出] # df -h --total [生成总计] ``` ![检查 Linux 总的磁盘使用](/data/attachment/album/201511/02/231739ozt4jzmccgpz3tzp.png) *检查 Linux 总的磁盘使用* ``` # df -i [显示文件系统的 inode 数目] # df -i --total [生成总计] ``` ![检查 Linux 总的 inode 数目](/data/attachment/album/201511/02/231740vslc6rayybrvofa3.png) *检查 Linux 总的 inode 数目* 用 du,你可以估计文件、目录或文件系统的文件空间使用。 举个例子,让我们来看看 /home 目录使用了多少空间,它包括了所有用户的个人文件。第一条命令会返回整个 /home 目录当前使用的所有空间,第二条命令会显示子目录的分类列表: ``` # du -sch /home # du -sch /home/* ``` ![检查 Linux 目录磁盘大小](/data/attachment/album/201511/02/231741r33uhlr43bucla3w.png) *检查 Linux 目录磁盘大小* 别错过了: * [检查 Linux 磁盘空间使用的 12 个 ‘df’ 命令例子](/article-6466-1.html) * [查看文件/目录磁盘使用的 10 个 ‘du’ 命令例子](http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/) 另一个你工具集中不容忽视的工具就是 vmstat。它允许你查看进程、CPU 和 内存使用、磁盘活动以及其它的大概信息。 如果不带参数运行,vmstat 会返回自从上一次启动后的平均信息。尽管你可能以这种方式使用该命令有一段时间了,再看一些系统使用率的例子会有更多帮助,例如在例子中定义了时间间隔。 例如 ``` # vmstat 5 10 ``` 会每个 5 秒返回 10 个事例: ![检查 Linux 系统性能](/data/attachment/album/201511/02/231743ybuuc14eqjvzk13s.png) *检查 Linux 系统性能* 正如你从上面图片看到的,vmstat 的输出分为很多列:proc(process)、memory、swap、io、system、和 CPU。每个字段的意义可以在 vmstat man 手册的 FIELD DESCRIPTION 部分找到。 在哪里 vmstat 可以派上用场呢?让我们在 yum 升级之前和升级时检查系统行为: ``` # vmstat -a 1 5 ``` ![Vmstat Linux 性能监视](/data/attachment/album/201511/02/231755h927jth6ton2h9c2.png) *Vmstat Linux 性能监视* 请注意当磁盘上的文件被更改时,活跃内存的数量增加,写到磁盘的块数目(bo)和属于用户进程的 CPU 时间(us)也是这样。 或者直接保存一个大文件到磁盘时(由 dsync 标志引发): ``` # vmstat -a 1 5 # dd if=/dev/zero of=dummy.out bs=1M count=1000 oflag=dsync ``` ![Vmstat Linux 磁盘性能监视](/data/attachment/album/201511/02/231758n7giw2g9nzp478i7.png) *Vmstat Linux 磁盘性能监视* 在这个例子中,我们可以看到大量的块被写入到磁盘(bo),这正如预期的那样,同时 CPU 处理任务之前等待 IO 操作完成的时间(wa)也增加了。 **别错过**: [Vmstat – Linux 性能监视](/article-4024-1.html) ### 其它 Linux 工具 正如本文介绍部分提到的,这里有其它的工具你可以用来检测系统状态和利用率(不仅红帽,其它主流发行版的官方支持库中也提供了这些工具)。 sysstat 软件包包含以下工具: * sar (收集、报告、或者保存系统活动信息)。 * sadf (以多种方式显示 sar 收集的数据)。 * mpstat (报告处理器相关的统计信息)。 * iostat (报告 CPU 统计信息和设备以及分区的 IO统计信息)。 * pidstat (报告 Linux 任务统计信息)。 * nfsiostat (报告 NFS 的输出/输出统计信息)。 * cifsiostat (报告 CIFS 统计信息) * sa1 (收集并保存二进制数据到系统活动每日数据文件中)。 * sa2 (在 /var/log/sa 目录写入每日报告)。 dstat 比这些工具所提供的功能更多一些,并且提供了更多的计数器和更大的灵活性。你可以通过运行 yum info sysstat 或者 yum info dstat 找到每个工具完整的介绍,或者安装完成后分别查看每个工具的 man 手册。 安装两个软件包: ``` # yum update && yum install sysstat dstat ``` sysstat 主要的配置文件是 `/etc/sysconfig/sysstat`。你可以在该文件中找到下面的参数: ``` # How long to keep log files (in days). # If value is greater than 28, then log files are kept in # multiple directories, one for each month. HISTORY=28 # Compress (using gzip or bzip2) sa and sar files older than (in days): COMPRESSAFTER=31 # Parameters for the system activity data collector (see sadc manual page) # which are used for the generation of log files. SADC_OPTIONS="-S DISK" # Compression program to use. ZIP="bzip2" ``` sysstat 安装完成后,`/etc/cron.d/sysstat` 中会添加和启用两个 cron 任务。第一个任务每 10 分钟运行系统活动计数工具,并在 `/var/log/sa/saXX` 中保存报告,其中 XX 是该月的一天。 因此,`/var/log/sa/sa05` 会包括该月份第 5 天所有的系统活动报告。这里假设我们在上面的配置文件中对 HISTORY 变量使用默认的值: ``` */10 * * * * root /usr/lib64/sa/sa1 1 1 ``` 第二个任务在每天夜间 11:53 生成每日进程计数总结并把它保存到 `/var/log/sa/sarXX` 文件,其中 XX 和之前例子中的含义相同: ``` 53 23 * * * root /usr/lib64/sa/sa2 -A ``` 例如,你可能想要输出该月份第 6 天从上午 9:30 到晚上 5:30 的系统统计信息到一个 LibreOffice Calc 或 Microsoft Excel 可以查看的 .csv 文件(这样就可以让你创建表格和图片了): ``` # sadf -s 09:30:00 -e 17:30:00 -dh /var/log/sa/sa06 -- | sed 's/;/,/g' > system_stats20150806.csv ``` 你可以在上面的 sadf 命令中用 -j 标记代替 -d 以 JSON 格式输出系统统计信息,这当你在 web 应用中使用这些数据的时候非常有用。 ![Linux 系统统计信息](/data/attachment/album/201511/02/231804b9wq9s5vwmz5ft5v.png) *Linux 系统统计信息* 最后,让我们看看 dstat 提供什么功能。请注意如果不带参数运行,dstat 默认使用 -cdngy(表示 CPU、磁盘、网络、内存页、和系统统计信息),并每秒添加一行(可以在任何时候用 Ctrl + C 中断执行): ``` # dstat ``` ![Linux 磁盘统计检测](/data/attachment/album/201511/02/231805zlrfz0v1lt400r1r.png) *Linux 磁盘统计检测* 要输出统计信息到 .csv 文件,可以用 -output 标记后面跟一个文件名称。让我们来看看在 LibreOffice Calc 中该文件看起来是怎样的: ![检测 Linux 统计信息输出](/data/attachment/album/201511/02/231808t1d5u0720qa5793t.png) *检测 Linux 统计信息输出* 为了更多的阅读体验,我强烈建议你查看 [dstat](http://www.tecmint.com/wp-content/pdf/dstat.pdf) 和 [sysstat](http://www.tecmint.com/wp-content/pdf/sysstat.pdf) 的 pdf 格式 man 手册。你会找到其它能帮助你创建自定义的详细系统活动报告的选项。 **别错过**: [Sysstat – Linux 的使用活动检测工具](/article-4028-1.html) ### 总结 在该指南中我们解释了如何使用 Linux 原生工具以及 RHEL 7 提供的特定工具来生成系统使用报告。在某种情况下,你可能像依赖最好的朋友那样依赖这些报告。 你很可能使用过这篇指南中我们没有介绍到的其它工具。如果真是这样的话,用下面的表单和社区中的其他成员一起分享吧,也可以是任何其它的建议/疑问/或者评论。 我们期待你的回复。 --- via: <http://www.tecmint.com/linux-performance-monitoring-and-file-system-statistics-reports/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](https://github.com/ictlyh) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,513
推荐新手使用 Arch Linux 入门
http://locez.com/Linux/mylinuxroad/
2015-11-03T12:53:00
[ "Arch" ]
https://linux.cn/article-6513-1.html
就前面的几篇文章来说,我一直是[以 Ubuntu 与 Fedora 作为新手入门的系统](/article-5893-1.html),但是其实我真正想推荐的是 Arch ,经过前面的学习,或许你对 Linux 已经有了一个大致的了解,现在如果你想加速你的步伐,也许可以看看本文。如果要问为什么学习 Linux ,我也只能回答 Just for fun 。 本文基本上是我个人见解,有不正确的地方恳请批评指正,另外本文只是推荐 Arch ,并没有说 Arch 是最适合新手的。 ![Arch Linux](/data/attachment/album/201511/03/125335ssqoqh2qjqbsk9h2.png) *Arch Linux* ### 我的 Linux 学习之路 谈起我的 Linux 学习之路,时间其实并不长,2014 年的 5 月份左右才加入 [Linux 中国](https://linux.cn/)的群,才开始了解这个系统,并且因为是高三了,我也不可能花太多时间在学习 Linux 这个系统上的,但是我的经验却使我花了相对很少的时间,已经能达到把 Linux 当作自己的桌面系统的程度了。 一切的起因只因为我电脑仅有 512 Mb 的内存,这使得我这个一直以来的 xp 用户,最后连上个 QQ 都能卡死,这样忍受了很久,终于我去寻找解决的方法了。或许是因为我的想法的原因,解决方法并不是去为电脑升级硬件,而是寻找代替 xp 的系统,这时候 Linux 进入了我的眼球,到处都在说 Linux 轻便简洁,以及只需几十兆内存便可流畅运行。当然这时候我搜索出来的肯定是传说中的对新手最友好的 Ubuntu 了,最后我怀着激动的心情安装了它,当时是很开心的,觉得自己终于能换个系统玩了,可以摆脱过去卡机了。但事实是证明我天真了,Ubuntu 的 Unity 桌面,我的老古董机子根本吃不消,玩起来更卡了,甚至后来装 XUbuntu 也无济于事,遇到问题的时候,我去搜索答案能搜出来,但是答案却是基本是无效的,面对这种情况,我当时玩 Ubuntu 是什么东西也没学到的。 Ubuntu 的体验令我有点沮丧,再者它也不适合我机子。后来我又知道了 Debian ,这个发行版据称稳定健壮。我这次怀着犹豫的心情去安装了,安装过程不像 Ubuntu 那样顺利,记得应该遇到过一点问题,但还是解决了。这次的 Debian 安装让我很满意,我的电脑像复活了一样,再也不会卡顿了。然而面对 Debian 我能干什么?我后来发现我什么也没干,我不了解任何东西,我也只会用鼠标点点,右键查看一下属性,双击点个**可执行文件** 。就这样过了一两个星期(我是只有周末才有半天从学校回来碰个电脑的),有一天,我看到 Linux 中国的群里在讨论一个名为 **Arch** 的发行版,出于好奇我去搜索了一番,这便是我与 Arch 相遇的开始。 Arch Linux 的设计理念是 **轻量** 、 **简洁。**这点正符合我心意,二话不说我就开始了我的 Arch 之旅。当时我还不懂什么是命令行,安装过程完全是参照 Arch Wiki 的过程,虽然不懂为什么,但是我却是一次安装成功,看着自己一步一步敲命令安装的系统当时特有成就感。 Arch Wiki 提供了一条龙服务,刚安装完系统的 Arch 是不带桌面的,但是 Arch Wiki 提供了详细的桌面配置过程,以及输入法配置过程。查看自己的内存使用情况, LXDE + 32 位的 Arch Linux,我的内存占用才 70 M 左右,我知道我这次找到了真爱,于是一直使用 Arch 至今,也感谢我的电脑配置低,不然我很可能就停留在 Ubuntu 了。 ### 使用 Arch Linux 的优势 至于我为什么要推荐 Arch Linux ?对于一个新手,它相对其他发行版有哪些优势呢? 不少人会说 Arch 太难了,不适合新手,对新手并不友好。可我却不这么认为,难是因为你站在了一个较高的起点,而这个高的起点会使你更快地进步,更快地了解 Linux 。Arch 所带给我的就是这样一种学习体验。我从不会到会,再到教别人所用的时间并不长,也许有人会说我只是个特例,那么这篇文章就是写给那些想成为特例的人。学习是靠自己的,只要自己有心,又有什么学不会呢?最近 “Linux 中国-新手村” QQ 群里的许多新人,总是自己一上来就要答案,但是却不曾想过,自己为这个问题做了什么尝试,自己是否有毅力去坚持学习 Linux ? 下面是自己认为推荐 Arch 的一些理由,仅代表我个人的观点: * Arch 使你站在一个较高的起点入门,但相应地,你会需要付出一点耐心去学习,并且你会学的更快 * Arch Wiki 非常丰富,就是我们遇到问题时解决的利器。在遇到问题时先去 Arch Wiki 搜索一下,基本可以解决,这比搜索引擎搜索出来的 Blog 或别人写的一点笔记要靠谱的多 * Arch 采用滚动更新的方式,因此你不用再考虑以后升级系统需要重装的问题 * Arch 除了基础的软件包外,不会附加一些多余的东西,所以你的系统基本上是你所需要的东西 * Arch 的 pacman 是非常简单高效的包管理工具,帮助你轻松管理系统 * Arch 的 AUR 仓库包含大量软件包,只需一个 makepkg 命令即可构建,非常方便 基于上面的一些原因,我认为 Arch 其实是适合新手的。 首先它比其他大多数发行版要自由;其次它没有预先安装的图形包管理工具,这使得我们必须在终端下完成我们的大部分操作,这将是我们从 Windows 鼠标模式逃离出来的一种动力与压力,因为你拿着鼠标没什么可干的;最后便是 Arch Wiki 对于绝大多数软件包要如何配置,遇到问题怎么去解决,都有详细的说明,这对于新手来说肯定是一个福音。 我推荐 Arch 其实是把自己置于一个相对的窘迫的境地(但是其实笔者不觉得这是困境,我当时对 Arch 是一见钟情的,怀着极大的兴趣把 Arch 收下了),只有这样才会激活你的动力,战胜它,你就赢了自己,收获了技能,如果选择放弃,那么可能你不适合这种学习方式。 ### 结束 可以说我学习 Linux 基本都得益于 Arch 的 Wiki ,是它为我解决了很多问题,再也不用像无头苍蝇一样去搜索答案,当然你使用其他发行版也可以参照 Arch Wiki ,不要浪费了这份宝贵的资源。另外如果你是真心想学习 Linux ,我推荐你看看 Linus 的自传 《just for fun》,还有鸟哥的 《鸟哥的 Linux 私房菜》。Linus 的自传会使你明白一小部分关于 Linux 的故事,我所做的也只是 just for fun ;而鸟哥的书则可以作为一本入门的书籍,鸟哥写的太详细了,选读部分内容就好。最后祝各位能在接下来的学习之路,奋勇向前。
301
Moved Permanently
null
6,516
学习数据结构与算法分析如何帮助您成为更优秀的开发人员
http://www.happybearsoftware.com/how-learning-data-structures-and-algorithms-makes-you-a-better-developer
2015-11-04T10:00:00
[ "算法", "数据结构", "编程", "程序员" ]
https://linux.cn/article-6516-1.html
> > "相较于其它方式,我一直热衷于推崇围绕数据设计代码,我想这也是Git能够如此成功的一大原因[…]在我看来,区别程序员优劣的一大标准就在于他是否认为自己设计的代码还是数据结构更为重要。" > > > -- Linus Torvalds > > > --- > > "优秀的数据结构与简陋的代码组合远比反之的组合更好。" > > > -- Eric S. Raymond, The Cathedral and The Bazaar > > > ![数据结构与算法分析](/data/attachment/album/201511/04/105841baudirudadtaajn6.jpg) 学习数据结构与算法分析会让您成为一名出色的程序员。 **数据结构与算法分析是一种解决问题的思维模式。** 在您的个人知识库中,数据结构与算法分析的相关知识储备越多,您将越多具备应对并解决各类繁杂问题的能力。掌握了这种思维模式,您还将有能力针对新问题提出更多以前想不到的漂亮的解决方案。 您将*更深入地*了解,计算机如何完成各项操作。无论您是否是直接使用给定的算法,它都影响着您作出的各种技术决定。从计算机操作系统的内存分配到RDBMS的内在工作机制,以及网络协议如何实现将数据从地球的一个角落发送至另一个角落,这些大大小小的工作的完成,都离不开基础的数据结构与算法,理解并掌握它将会让您更了解计算机的运作机理。 对算法广泛深入的学习能为您储备解决方案来应对大体系的问题。之前建模困难时遇到的问题如今通常都能融合进经典的数据结构中得到很好地解决。即使是最基础的数据结构,只要对它进行足够深入的钻研,您将会发现在每天的编程任务中都能经常用到这些知识。 有了这种思维模式,在遇到磨棱两可的问题时,您将能够想出新奇的解决方案。即使最初并没有打算用数据结构与算法解决相应问题的情况,当真正用它们解决这些问题时您会发现它们将非常有用。要意识到这一点,您至少要对数据结构与算法分析的基础知识有深入直观的认识。 理论认识就讲到这里,让我们一起看看下面几个例子。 ### 最短路径问题 我们想要开发一个软件来计算从一个国际机场出发到另一个国际机场的最短距离。假设我们受限于以下路线: ![Dijkstra 算法](/data/attachment/album/201511/03/225616qjhyblzb2j7xtvuv.svg) 从这张画出机场各自之间的距离以及目的地的图中,我们如何才能找到最短距离,比方说从赫尔辛基到伦敦?**[Dijkstra算法](http://en.wikipedia.org/wiki/Dijkstra's_algorithm)**是能让我们在最短的时间得到正确答案的适用算法。 在所有可能的解法中,如果您曾经遇到过这类问题,知道可以用Dijkstra算法求解,您大可不必从零开始实现它,只需***知道***该算法的代码库能帮助您解决相关的实现问题。 如果你深入到该算法的实现中,您将深入理解一项著名的重要图论算法。您会发现实际上该算法比较消耗资源,因此名为[A\*](http://en.wikipedia.org/wiki/A*_search_algorithm)的扩展经常用于代替该算法。这个算法应用广泛,从机器人寻路的功能实现到TCP数据包路由,以及GPS寻径问题都能应用到这个算法。 ### 先后排序问题 您想要在<ruby> 开放式在线课程 <rp> ( </rp> <rt> MOOC,Massive Open Online Courses </rt> <rp> ) </rp></ruby>平台上(如Udemy或Khan学院)学习某课程,有些课程之间彼此依赖。例如,用户学习<ruby> 牛顿力学 <rp> ( </rp> <rt> Newtonian Mechanics </rt> <rp> ) </rp></ruby>课程前必须先修<ruby> 微积分 <rp> ( </rp> <rt> Calculus </rt> <rp> ) </rp></ruby>课程,课程之间可以有多种依赖关系。用YAML表述举例如下: ``` # Mapping from course name to requirements # # If you're a physcist or a mathematicisn and you're reading this, sincere # apologies for the completely made-up dependency tree :) courses: arithmetic: [] algebra: [arithmetic] trigonometry: [algebra] calculus: [algebra, trigonometry] geometry: [algebra] mechanics: [calculus, trigonometry] atomic_physics: [mechanics, calculus] electromagnetism: [calculus, atomic_physics] radioactivity: [algebra, atomic_physics] astrophysics: [radioactivity, calculus] quantumn_mechanics: [atomic_physics, radioactivity, calculus] ``` 鉴于以上这些依赖关系,作为一名用户,我希望系统能帮我列出必修课列表,让我在之后可以选择任意一门课程学习。如果我选择了微积分(calculus)课程,我希望系统能返回以下列表: ``` arithmetic -> algebra -> trigonometry -> calculus ``` 这里有两个潜在的重要约束条件: * 返回的必修课列表中,每门课都与下一门课存在依赖关系 * 我们不希望列表中有任何重复课程 这是解决数据间依赖关系的例子,解决该问题的排序算法称作<ruby> 拓扑排序算法 <rp> ( </rp> <rt> tsort,topological sort </rt> <rp> ) </rp></ruby>。它适用于解决上述我们用YAML列出的依赖关系图的情况,以下是在图中显示的相关结果(其中箭头代表`需要先修的课程`): ![拓扑排序算法](/data/attachment/album/201511/03/225617kzd8zlnvooiabno9.svg) 拓扑排序算法的实现就是从如上所示的图中找到满足各层次要求的依赖关系。因此如果我们只列出包含`radioactivity`和与它有依赖关系的子图,运行tsort排序,会得到如下的顺序表: ``` arithmetic algebra trigonometry calculus mechanics atomic_physics radioactivity ``` 这符合我们上面描述的需求,用户只需选出`radioactivity`,就能得到在此之前所有必修课程的有序列表。 在运用该排序算法之前,我们甚至不需要深入了解算法的实现细节。一般来说,你可能选择的各种编程语言在其标准库中都会有相应的算法实现。即使最坏的情况,Unix也会默认安装`tsort`程序,运行`man tsort` 来了解该程序。 ### 其它拓扑排序适用场合 * **类似`make`的工具** 可以让您声明任务之间的依赖关系,这里拓扑排序算法将从底层实现具有依赖关系的任务顺序执行的功能。 * **具有`require`指令的编程语言**适用于要运行当前文件需先运行另一个文件的情况。这里拓扑排序用于识别文件运行顺序以保证每个文件只加载一次,且满足所有文件间的依赖关系要求。 * **带有甘特图的项目管理工具**。甘特图能直观列出给定任务的所有依赖关系,在这些依赖关系之上能提供给用户任务完成的预估时间。我不常用到甘特图,但这些绘制甘特图的工具很可能会用到拓扑排序算法。 ### 霍夫曼编码实现数据压缩 <ruby> <a href="http://en.wikipedia.org/wiki/Huffman_coding"> 霍夫曼编码 </a> <rp> ( </rp> <rt> Huffman coding </rt> <rp> ) </rp></ruby>是一种用于无损数据压缩的编码算法。它的工作原理是先分析要压缩的数据,再为每个字符创建一个二进制编码。字符出现的越频繁,编码赋值越小。因此在一个数据集中`e`可能会编码为`111`,而`x`会编码为`10010`。创建了这种编码模式,就可以串联无定界符,也能正确地进行解码。 在gzip中使用的DEFLATE算法就结合了霍夫曼编码与LZ77一同用于实现数据压缩功能。gzip应用领域很广,特别适用于文件压缩(以`.gz`为扩展名的文件)以及用于数据传输中的http请求与应答。 学会实现并使用霍夫曼编码有如下益处: * 您会理解为什么较大的压缩文件会获得较好的整体压缩效果(如压缩的越多,压缩率也越高)。这也是SPDY协议得以推崇的原因之一:在复杂的HTTP请求/响应过程数据有更好的压缩效果。 * 您会了解数据传输过程中如果想要压缩JavaScript/CSS文件,运行压缩软件是完全没有意义的。PNG文件也是类似,因为它们已经使用DEFLATE算法完成了压缩。 * 如果您试图强行破译加密的信息,您可能会发现由于重复数据压缩质量更好,密文给定位的数据压缩率将帮助您确定相关的<ruby> <a href="http://en.wikipedia.org/wiki/Block_cipher_mode_of_operation"> 分组密码工作模式 </a> <rp> ( </rp> <rt> block cipher mode of operation </rt> <rp> ) </rp></ruby>。 ### 下一步选择学习什么是困难的 作为一名程序员应当做好持续学习的准备。为了成为一名web开发人员,您需要了解标记语言以及Ruby/Python、正则表达式、SQL、JavaScript等高级编程语言,还需要了解HTTP的工作原理,如何运行UNIX终端以及面向对象的编程艺术。您很难有效地预览到未来的职业全景,因此选择下一步要学习哪些知识是困难的。 我没有快速学习的能力,因此我不得不在时间花费上非常谨慎。我希望尽可能地学习到有持久生命力的技能,即不会在几年内就过时的技术。这意味着我也会犹豫这周是要学习JavaScript框架还是那些新的编程语言。 只要占主导地位的计算模型体系不变,我们如今使用的数据结构与算法在未来也必定会以另外的形式继续适用。您可以放心地将时间投入到深入掌握数据结构与算法知识中,它们将会成为您作为一名程序员的职业生涯中一笔长期巨大的财富。 --- via: <http://www.happybearsoftware.com/how-learning-data-structures-and-algorithms-makes-you-a-better-developer> 作者:[Happy Bear](http://www.happybearsoftware.com/) 译者:[icybreaker](https://github.com/icybreaker) 校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
404
Not Found
null
6,524
如何在 GNOME 3 中显示桌面
http://itsfoss.com/show-desktop-gnome-3/
2015-11-05T08:00:00
[ "Gnome", "桌面", "快捷键" ]
https://linux.cn/article-6524-1.html
![How to show desktop in GNOME 3](/data/attachment/album/201511/04/214531giqo7wf0k004nb44.jpg) 你**如何在 GNOME 3 中显示桌面**?GNOME是一个很棒的桌面环境但是它更加专注于在程序间切换。如果你想关闭所有运行中的窗口,仅仅显示桌面呢? 在Windows中,你可以按下Windows+D。在Ubuntu Unity中,可以用Ctrl+Super+D快捷键。不过由于一些原因,GNOME禁用了显示桌面的快捷键。 当你按下Super+D或者Ctrl+Super+D,什么都不会发生。如果你想要看到桌面,你得一个个最小化窗口。如果你有好几个打开的窗口那么这会非常不方便。 在本教程中,我将会向你展示在[GNOME 3](https://www.gnome.org/gnome-3/)中添加显示桌面的快捷键。 ### 在GNOME 3 中添加显示桌面的快捷键 我在本教程的使用的是带有GNOME 3.18的[Antergos Linux](http://itsfoss.com/tag/antergos/),但是这些步骤对于任何GNOME 3版本的Linux发行版都适用。同时,Antergos也使用了[Numix主题](/article-3281-1.html)作为默认主题。因此你也许不会看到平常的GNOME图标。但是我相信步骤是一目了然的,很容易就能理解。 #### 第一步 进入系统设置。点击右上角,在下拉列表中,点击系统设置图标。 ![System Settings in GNOME Antergos Linux](/data/attachment/album/201511/04/214532a51tz8rygh1yb1ga.png) #### 第二步 当你在系统设置中时,寻找Keyboard设置。 ![Keyboard settings in GNOME 3](/data/attachment/album/201511/04/214533l5jfyfncvut5dtn8.png) #### 第三步 在这里,选择**Shortcuts**标签并在左边拦选择**Navigation**。向下滚动一点查找**Hide all normal windows**。你会看见它已经被禁用了。 ![Shortcut keys in GNOME 3](/data/attachment/album/201511/04/214535y5dmpd8ugp3capyl.jpg) #### 第四步 在“Hide all normla windows”上面点击一下。你会看到它变成了**New accelerator**。现在无论你按下哪个键,它都会被指定为显示桌面的快捷键。 如果你不小心按下了错误的组合键,只要按下退格它就会被禁用。再次点击并使用需要的组合键。 ![Shortcut key edit in GNOME 3](/data/attachment/album/201511/04/214539waz4e4tne4ij9jut.jpg) #### 第五步 一旦设置了组合键,只要关闭系统设置。不用保存设置因为更改是立即生效的。在本例中,我使用Ctrl+Super+D来与我在Ubuntu Unity中的使用习惯保持一致。 ![Keyboard shortcut edit in GNOME](/data/attachment/album/201511/04/214542vb22b737yx22bdlb.jpg) 就是这样。享受GNOME 3中的显示桌面快捷键吧。我希望这篇教程对你们有用。有任何问题、建议或者留言都欢迎:) --- via: <http://itsfoss.com/show-desktop-gnome-3/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,525
如何在 Antergos/Arch Linux 中使用 iPhone
http://itsfoss.com/iphone-antergos-linux/
2015-11-06T08:32:00
[ "iPhone" ]
https://linux.cn/article-6525-1.html
![](/data/attachment/album/201511/04/223435xdp04bscjuu0tddb.jpg) 在Arch Linux中使用iPhone遇到麻烦了么?iPhone和Linux从来都没有很好地集成。本教程中,我会向你展示如何在Antergos Linux中使用iPhone,对于同样基于Arch的的Linux发行版如Manjaro也应该同样管用。 我最近购买了一台全新的iPhone 6S,当我连接到Antergos Linux中要拷贝一些照片时,它完全没有检测到它。我看见iPhone正在被充电并且我已经允许了iPhone“信任这台电脑”,但是还是完全没有检测到。我尝试运行`dmseg`但是没有关于iPhone或者Apple的信息。有趣的是我当我安装好了[libimobiledevice](http://www.libimobiledevice.org/),这个就可以解决[iPhone在Ubuntu中的挂载问题](http://itsfoss.com/mount-iphone-ipad-ios-7-ubuntu-13-10/)。 我会向你展示如何在Antergos中使用运行iOS 9的iPhone 6S。这会有更多的命令行,但是我假设你用的是ArchLinux,并不惧怕使用终端(也不应该惧怕)。 ### 在Arch Linux中挂载iPhone **第一步**:如果已经插入,请拔下你的iPhone。 **第二步**:现在,打开终端输入下面的命令来安装必要的包。如果它们已经安装过了也没有关系。 ``` sudo pacman -Sy ifuse usbmuxd libplist libimobiledevice ``` **第三步**: 这些库和程序安装完成后,重启系统。 ``` sudo reboot ``` **第四步**:创建一个iPhone的挂载目录,我建议在家目录中创建一个iPhone目录。 ``` mkdir ~/iPhone ``` **第五步**:解锁你的手机并插入,如果询问是否信任该计算机,请允许信任。 ![](/data/attachment/album/201511/04/223437bwsc6i67lowd0bx9.jpg) **第六步**: 看看这时iPhone是否已经被机器识别了。 ``` dmesg | grep -i iphone ``` 这时就该显示iPhone和Apple的结果了。就像这样: ``` [ 31.003392] ipheth 2-1:4.2: Apple iPhone USB Ethernet device attached [ 40.950883] ipheth 2-1:4.2: Apple iPhone USB Ethernet now disconnected [ 47.471897] ipheth 2-1:4.2: Apple iPhone USB Ethernet device attached [ 82.967116] ipheth 2-1:4.2: Apple iPhone USB Ethernet now disconnected [ 106.735932] ipheth 2-1:4.2: Apple iPhone USB Ethernet device attached ``` 这意味着这时iPhone已经被Antergos/Arch成功地识别了。 **第七步**: 设置完成后是时候挂载iPhone了,使用下面的命令: ``` ifuse ~/iPhone ``` 由于我们在家目录中创建了挂载目录,你不需要root权限就可以在家目录中看见。如果命令成功了,你就不会看见任何输出。 回到Files看下iPhone是否已经识别。对于我而言,在Antergos中看上去这样: ![](/data/attachment/album/201511/04/223439jweu7uxz0k2oq2og.jpg) 你可以在这个目录中访问文件。从这里复制文件或者复制到里面。 ![](/data/attachment/album/201511/04/223440e5grq35hjchiivgl.jpg) **第八步**: 当你想要卸载的时候,使用这个命令: ``` sudo umount ~/iPhone ``` ### 对你有用么? 我知道这并不是非常方便和理想,iPhone应该像其他USB设备那样工作,但是事情并不总是像人们想的那样。好的是一点小的DIY就能解决这个问题带来了一点成就感(至少对我而言)。我必须要说的是Antergos应该修复这个问题让iPhone可以默认挂载。 这个技巧对你有用么?如果你有任何问题或者建议,欢迎留下评论。 --- via: <http://itsfoss.com/iphone-antergos-linux/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,526
RHCE 系列(四): 使用 Shell 脚本自动化 Linux 系统维护任务
http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintenance-tasks/
2015-11-05T09:48:00
[ "RHCE" ]
https://linux.cn/article-6526-1.html
之前我听说高效的系统管理员的一个特点是懒惰。一开始看起来很矛盾,但作者接下来解释了其中的原因: ![自动化 Linux 系统维护任务](/data/attachment/album/201511/04/225001vtqsnzkwsiibqtln.png) *RHCE 系列:第四部分 - 自动化 Linux 系统维护任务* 如果一个系统管理员花费大量的时间解决问题以及做重复的工作,你就应该怀疑他这么做是否正确。换句话说,一个高效的系统管理员/工程师应该制定一个计划使得其尽量花费少的时间去做重复的工作,以及通过使用本系列中第三部分 [使用 Linux 工具集监视系统活动报告](/article-6512-1.html) 介绍的工具来预见问题。因此,尽管看起来他/她没有做很多的工作,但那是因为 shell 脚本帮助完成了他的/她的大部分任务,这也就是本章我们将要探讨的东西。 ### 什么是 shell 脚本? 简单的说,shell 脚本就是一个由 shell 一步一步执行的程序,而 shell 是在 Linux 内核和最终用户之间提供接口的另一个程序。 默认情况下,RHEL 7 中用户使用的 shell 是 bash(/bin/bash)。如果你想知道详细的信息和历史背景,你可以查看这个[维基页面](https://en.wikipedia.org/wiki/Bash_%28Unix_shell%29)。 关于这个 shell 提供的众多功能的介绍,可以查看 **man 手册**,也可以从 ([Bash 命令](http://www.tecmint.com/wp-content/pdf/bash.pdf))处下载 PDF 格式。除此之外,假设你已经熟悉 Linux 命令(否则我强烈建议你首先看一下 **Tecmint.com** 中的文章 [从新手到系统管理员指南](http://www.tecmint.com/60-commands-of-linux-a-guide-from-newbies-to-system-administrator/) )。现在让我们开始吧。 ### 写一个脚本显示系统信息 为了方便,首先让我们新建一个目录用于保存我们的 shell 脚本: ``` # mkdir scripts # cd scripts ``` 然后用喜欢的文本编辑器打开新的文本文件 `system_info.sh`。我们首先在头部插入一些注释以及一些命令: ``` #!/bin/bash # RHCE 系列第四部分示例脚本 # 该脚本会返回以下这些系统信息: # -主机名称: echo -e "\e[31;43m***** HOSTNAME INFORMATION *****\e[0m" hostnamectl echo "" # -文件系统磁盘空间使用: echo -e "\e[31;43m***** FILE SYSTEM DISK SPACE USAGE *****\e[0m" df -h echo "" # -系统空闲和使用中的内存: echo -e "\e[31;43m ***** FREE AND USED MEMORY *****\e[0m" free echo "" # -系统启动时间: echo -e "\e[31;43m***** SYSTEM UPTIME AND LOAD *****\e[0m" uptime echo "" # -登录的用户: echo -e "\e[31;43m***** CURRENTLY LOGGED-IN USERS *****\e[0m" who echo "" # -使用内存最多的 5 个进程 echo -e "\e[31;43m***** TOP 5 MEMORY-CONSUMING PROCESSES *****\e[0m" ps -eo %mem,%cpu,comm --sort=-%mem | head -n 6 echo "" echo -e "\e[1;32mDone.\e[0m" ``` 然后,给脚本可执行权限: ``` # chmod +x system_info.sh ``` 运行脚本: ``` ./system_info.sh ``` 注意为了更好的可视化效果各部分标题都用颜色显示: ![服务器监视 Shell 脚本](/data/attachment/album/201511/04/225004xk7aapo8odn1pdd7.png) *服务器监视 Shell 脚本* 颜色功能是由以下命令提供的: ``` echo -e "\e[COLOR1;COLOR2m<YOUR TEXT HERE>\e[0m" ``` 其中 COLOR1 和 COLOR2 是前景色和背景色([Arch Linux Wiki](https://wiki.archlinux.org/index.php/Color_Bash_Prompt) 有更多的信息和选项解释), 是你想用颜色显示的字符串。 ### 使任务自动化 你想使其自动化的任务可能因情况而不同。因此,我们不可能在一篇文章中覆盖所有可能的场景,但是我们会介绍使用 shell 脚本可以使其自动化的三种典型任务: 1) 更新本地文件数据库, 2) 查找(或者删除)有 777 权限的文件, 以及 3) 文件系统使用超过定义的阀值时发出警告。 让我们在脚本目录中新建一个名为 `auto_tasks.sh` 的文件并添加以下内容: ``` #!/bin/bash # 自动化任务示例脚本: # -更新本地文件数据库: echo -e "\e[4;32mUPDATING LOCAL FILE DATABASE\e[0m" updatedb if [ $? == 0 ]; then echo "The local file database was updated correctly." else echo "The local file database was not updated correctly." fi echo "" # -查找 和/或 删除有 777 权限的文件。 echo -e "\e[4;32mLOOKING FOR FILES WITH 777 PERMISSIONS\e[0m" # Enable either option (comment out the other line), but not both. # Option 1: Delete files without prompting for confirmation. Assumes GNU version of find. #find -type f -perm 0777 -delete # Option 2: Ask for confirmation before deleting files. More portable across systems. find -type f -perm 0777 -exec rm -i {} +; echo "" # -文件系统使用率超过定义的阀值时发出警告 echo -e "\e[4;32mCHECKING FILE SYSTEM USAGE\e[0m" THRESHOLD=30 while read line; do # This variable stores the file system path as a string FILESYSTEM=$(echo $line | awk '{print $1}') # This variable stores the use percentage (XX%) PERCENTAGE=$(echo $line | awk '{print $5}') # Use percentage without the % sign. USAGE=${PERCENTAGE%?} if [ $USAGE -gt $THRESHOLD ]; then echo "The remaining available space in $FILESYSTEM is critically low. Used: $PERCENTAGE" fi done < <(df -h --total | grep -vi filesystem) ``` 请注意该脚本最后一行两个 `<` 符号之间有个空格。 ![查找 777 权限文件的 Shell 脚本](/data/attachment/album/201511/04/225005dyi8as23sg2aylzj.png) *查找 777 权限文件的 Shell 脚本* ### 使用 Cron 想更进一步提高效率,你不会想只是坐在你的电脑前手动执行这些脚本。相反,你会使用 cron 来调度这些任务周期性地执行,并把结果通过邮件发动给预先指定的接收者,或者将它们保存到使用 web 浏览器可以查看的文件中。 下面的脚本(filesystem\_usage.sh)会运行有名的 **df -h** 命令,格式化输出到 HTML 表格并保存到 **report.html** 文件中: ``` #!/bin/bash # 演示使用 shell 脚本创建 HTML 报告的示例脚本 # Web directory WEB_DIR=/var/www/html # A little CSS and table layout to make the report look a little nicer echo "<HTML> <HEAD> <style> .titulo{font-size: 1em; color: white; background:#0863CE; padding: 0.1em 0.2em;} table { border-collapse:collapse; } table, td, th { border:1px solid black; } </style> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' /> </HEAD> <BODY>" > $WEB_DIR/report.html # View hostname and insert it at the top of the html body HOST=$(hostname) echo "Filesystem usage for host <strong>$HOST</strong><br> Last updated: <strong>$(date)</strong><br><br> <table border='1'> <tr><th class='titulo'>Filesystem</td> <th class='titulo'>Size</td> <th class='titulo'>Use %</td> </tr>" >> $WEB_DIR/report.html # Read the output of df -h line by line while read line; do echo "<tr><td align='center'>" >> $WEB_DIR/report.html echo $line | awk '{print $1}' >> $WEB_DIR/report.html echo "</td><td align='center'>" >> $WEB_DIR/report.html echo $line | awk '{print $2}' >> $WEB_DIR/report.html echo "</td><td align='center'>" >> $WEB_DIR/report.html echo $line | awk '{print $5}' >> $WEB_DIR/report.html echo "</td></tr>" >> $WEB_DIR/report.html done < <(df -h | grep -vi filesystem) echo "</table></BODY></HTML>" >> $WEB_DIR/report.html ``` 在我们的 **RHEL 7** 服务器(**192.168.0.18**)中,看起来像下面这样: ![服务器监视报告](/data/attachment/album/201511/04/225008za1cii1ni12cwg1e.png) *服务器监视报告* 你可以添加任何你想要的信息到那个报告中。添加下面的 crontab 条目在每天下午的 1:30 运行该脚本: ``` 30 13 * * * /root/scripts/filesystem_usage.sh ``` ### 总结 你很可能想起各种其他想要自动化的任务;正如你看到的,使用 shell 脚本能极大的简化任务。如果你觉得这篇文章对你有所帮助就告诉我们吧,别犹豫在下面的表格中添加你自己的想法或评论。 --- via: <http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintenance-tasks/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](https://github.com/ictlyh) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,527
安卓编年史(6):安卓1.0——谷歌系app和实体硬件的引入
http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-history-of-googles-mobile-os/6/
2015-11-05T14:07:00
[ "Android", "安卓编年史" ]
https://linux.cn/article-6527-1.html
![](/data/attachment/album/201611/27/201348qcqsqn6t7ba4qc6a.jpg) ![T-Mobile G1](/data/attachment/album/201511/05/000908f8jrf2muzj0zt280.jpg) *T-Mobile G1 [T-Mobile 供图]* ### 安卓 1.0——谷歌系 app 和实体硬件的引入 到了 2008 年 10 月,安卓 1.0 已经准备好发布,这个系统在 [T-Mobile G1](http://arstechnica.com/gadgets/2008/10/android-g1-review/)(又以 HTC Dream 为人周知)上初次登台。G1 进入了被 iPhone 3G 和 [Nokia 1680 classic](http://en.wikipedia.org/wiki/Nokia_1680_classic) 所主宰的市场。(这些手机并列获得了 2008 年[销量最佳手机](http://en.wikipedia.org/wiki/List_of_best-selling_mobile_phones#2008)称号,各自卖出了 350 万台。)G1 的具体销量数字已难以获得,但 T-Mobile 宣称截至 2009 年 4 月该设备的销量突破了 100 万台。无论从哪方面来说这在竞争中都处于落后地位。 G1 拥有单核 528Mhz 的 ARM 11 处理器,一个 Adreno 130 的 GPU,192MB 内存,以及多达 256MB 的存储空间提供给系统以及应用使用。它有一块 3.2 英寸、320x480 分辨率的显示屏,被布置在一个含有实体全键盘的滑动结构之上。所以尽管安卓软件的确走过了很长的一段路,硬件也是的。时至今日,我们可以在一个厂商提供手表中得到比这更好的参数:最新的[三星智能手表](http://arstechnica.com/gadgets/2014/04/review-we-wear-samsungs-galaxy-gear-and-galaxy-fit-so-you-dont-have-to/)拥有 512MB 内存以及 1GHz 的双核处理器。 当 iPhone 有着最少数量的按键的时候,G1 确实完全相反的,按键几乎支持每个硬件控制。它有拨通和挂断按钮,home 键,后退,以及菜单键,一个相机快门键,音量控制键,一个轨迹球,当然,还有 50 个键盘按键。未来安卓设备将会慢慢离开按键多多的界面设计,几乎每部新旗舰都在减少按键的数量。 但是这是第一次,人们见到了运行在实机上的安卓,而不是跑在一个令人沮丧的慢吞吞的模拟器上。安卓 1.0 没有 iPhone 那样顺滑流畅,闪亮耀眼,或拥有那么多的新闻报道。它也不像 Windows Mobile 6.5 那样才华横溢。但这仍然是个好的开始。 ![安卓1.0和0.9的默认应用列表。](/data/attachment/album/201511/05/000909pb0bg0570p5k5k6b.png) *安卓 1.0 和 0.9 的默认应用列表。[Ron Amadeo供图]* 安卓 1.0 的核心与两个月前发布的 beta 版本相比看起来并没有什么引人注目的不同,但这个消费产品带来了不少应用,包括一套完整的谷歌系应用。日历,电子邮件,Gmail,即时通讯,市场,设置,语音拨号,以及 YouTube 都是全新登场。那时候,音乐是智能手机上占据主宰地位的媒体类型,其王者是 iTunes 音乐商店。谷歌没有自家的音乐服务,所以它选择了亚马逊并绑定了亚马逊 MP3 商店。 安卓最重要的新增内容是首次登场的谷歌商店,叫做“安卓市场 Beta”。与此同时大部分公司满足于将它们的软件目录称作各种“应用商店”——意思是一个出售应用的商店,并且只出售应用——谷歌明显有着更大的野心。它搭配了一个更为通用的名字,“安卓市场”。这个名字的想法是安卓市场不仅仅拥有应用,还拥有一切你的安卓设备所需要的东西。 ![第一个安卓市场客户端。截图展示了主页,“我的下载”,一个应用页面,以及一个应用权限页面。](/data/attachment/album/201511/05/000911be4off7je13fjl7f.png) *第一个安卓市场客户端。截图展示了主页,“我的下载”,一个应用页面,以及一个应用权限页面。[[Google](http://android-developers.blogspot.com/2008/08/android-market-user-driven-content.html)供图]* 那时候,安卓市场只提供应用和游戏,开发者们甚至还不能为它们收费。苹果的 App Store 相对与安卓市场有 4 个月的先发优势,但是谷歌的主要差异化在于安卓的商店几乎是完全开放的。在 iPhone 上,应用受制于苹果的审查,必须遵循设计和技术指南。潜在的新应用不允许在功能上复制已有应用。在安卓市场,开发者可以自由地做任何想做的,包括开发替代已有的应用。控制的缺失导致福祸相依。它允许开发者革新已有的功能,但同时意味着甚至是毫无价值的垃圾应用也被允许进入市场。 时至今日,这个安卓市场的客户端是又一个不再能够和谷歌服务器通讯的应用。幸运的是,它也是在因特网上被[真正记录](http://android-developers.blogspot.com/2008/08/android-market-user-driven-content.html)的为数不多的早期安卓应用之一。主页提供了通向一般区域的连接,像应用,游戏,搜索,以及下载,顶部有横向滚动显示的特色应用图标。搜索结果和“我的下载”页面以滚动列表的方式显示应用,显示应用名,开发者,费用(在那时都是免费的),以及评分。单独的应用页面展示了一个简短的描述、安装数、用户评论和评分,以及最重要的安装按钮。早期的安卓市场不支持图片,开发者唯一能使用的区域是应用描述,还有着 500 字的限制。这使得类似维护一个更新日志变的十分困难,因为只有描述的位置可以供其使用。 就在安装之前,安卓市场显示了应用所需要的权限。这是苹果直至 2012 年之前都避免做的,那年一个 iOS 应用被发现在用户不知情的情况下[将完整的通讯录上传](http://arstechnica.com/gadgets/2012/02/path-addresses-privacy-controversy-but-social-apps-remain-a-risk-to-users/)到云端。权限显示给出了一个完整的应用用到的权限列表,尽管这个版本强迫用户同意应用权限。界面有个“OK”按钮,但是除了后退按钮没有办法取消。 ![Gmail展示收件箱,打开菜单的收件箱。 ](/data/attachment/album/201511/05/000911q3h2il05agf8r84h.png) *Gmail 展示收件箱,打开菜单的收件箱。[Ron Amadeo供图]* 下一个重要的应用也许就是 Gmail。大多数基本的功能此时已经准备好了。未读邮件以加粗显示,标签是个有颜色的标记。在收件箱中每封独立邮件显示着主题,发件人,以及一个会话中的回复数。Gmail 加星标志也在这里——快速点击即可给邮件加星或取消。一如往常,对于早期版本的安卓,菜单里有收件箱视图应有的所有按钮。但是,一旦打开了一封邮件,界面看起来就更加的现代了,“回复”和“转发”按钮永久固定在了屏幕底部。单独回复可以点击它们来展开和收缩。 圆角,阴影,以及气泡图标给了整个应用“卡通”的外表,但是这是个好的开始。安卓的功能第一哲学真正从此开始:Gmail 支持标签,邮件会话,搜索,以及邮件推送。 ![Gmail在安卓1.0的标签视图,写邮件界面,以及设置。](/data/attachment/album/201511/05/000912mclul0uoqtpuqlyg.png) *Gmail 在安卓 1.0 的标签视图,写邮件界面,以及设置。[Ron Amadeo 供图]* 但是如果你认为 Gmail 很丑,电子邮件应用又拉低了下限。它没有分离的收件箱或文件夹视图——所有东西都糊在一个界面。应用呈现给你一个文件夹列表,点击一个文件夹会以内嵌的方式展开内容。未读邮件左侧有条绿色的线指示,这就是电子邮件应用的界面。这个应用支持 IMAP 和 POP3,但是没有 Exchange。 --- ![](/data/attachment/album/201511/05/000912ftzpb8bj71pq4b7a.jpg) [Ron Amadeo](http://arstechnica.com/author/ronamadeo) / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。[@RonAmadeo](https://twitter.com/RonAmadeo) --- via: <http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/6/> 译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,531
RHCE 系列(五):如何在 RHEL 7 中管理系统日志(配置、轮换以及导入到数据库)
http://www.tecmint.com/manage-linux-system-logs-using-rsyslogd-and-logrotate/
2015-11-06T09:53:00
[ "RHCE" ]
https://linux.cn/article-6531-1.html
为了确保你的 RHEL 7 系统安全,你需要通过查看日志文件来监控系统中发生的所有活动。这样,你就可以检测到任何不正常或有潜在破坏的活动并进行系统故障排除或者其它恰当的操作。 ![Linux 中使用 Rsyslog 和 Logrotate 轮换日志文件](/data/attachment/album/201511/05/125611y2uyy9mmozzuyv7m.jpg) *RHCE 考试 - 第五部分:使用 Rsyslog 和 Logrotate 管理系统日志* 在 RHEL 7 中,[rsyslogd](http://www.tecmint.com/wp-content/pdf/rsyslogd.pdf) 守护进程负责系统日志,它从 /etc/rsyslog.conf(该文件指定所有系统日志的默认路径)和 /etc/rsyslog.d 中的所有文件(如果有的话)读取配置信息。 ### Rsyslogd 配置 快速浏览一下 [rsyslog.conf](http://www.tecmint.com/wp-content/pdf/rsyslog.conf.pdf) 会是一个好的开端。该文件分为 3 个主要部分:模块(rsyslong 按照模块化设计),全局指令(用于设置 rsyslogd 守护进程的全局属性),以及规则。正如你可能猜想的,最后一个部分指示记录或显示什么以及在哪里保存(也称为<ruby> 选择子 <rp> ( </rp> <rt> selector </rt> <rp> ) </rp></ruby>),这也是这篇文章关注的重点。 rsyslog.conf 中典型的一行如下所示: ![Rsyslogd 配置](/data/attachment/album/201511/05/125612ccuxx237l1lbmaxj.png) *Rsyslogd 配置* 在上面的图片中,我们可以看到一个选择子包括了一个或多个用分号分隔的<ruby> “设备:优先级” <rp> ( </rp> <rt> Facility:Priority </rt> <rp> ) </rp></ruby>对,其中设备描述了消息类型(参考 [RFC 3164 4.1.1 章节](https://tools.ietf.org/html/rfc3164#section-4.1.1),查看 rsyslog 可用的完整设备列表),优先级指示它的严重性,这可能是以下几种之一: * debug * info * notice * warning * err * crit * alert * emerg 尽管 none 并不是一个优先级,不过它意味着指定设备没有任何优先级。 **注意**:给定一个优先级表示该优先级以及之上的消息都应该记录到日志中。因此,上面例子中的行指示 rsyslogd 守护进程记录所有优先级为 info 以及以上(不管是什么设备)的除了属于 mail、authpriv、以及 cron 服务(不考虑来自这些设备的消息)的消息到 /var/log/messages。 你也可以使用逗号将多个设备分为一组,对同组中的设备使用相同的优先级。例如下面这行: ``` *.info;mail.none;authpriv.none;cron.none /var/log/messages ``` 也可以这样写: ``` *.info;mail,authpriv,cron.none /var/log/messages ``` 换句话说,mail、authpriv 以及 cron 被分为一组,并使用关键字 none。 #### 创建自定义日志文件 要把所有的守护进程消息记录到 /var/log/tecmint.log,我们需要在 rsyslog.conf 或者 /etc/rsyslog.d 目录中的单独文件(这样易于管理)添加下面一行: ``` daemon.* /var/log/tecmint.log ``` 然后重启守护进程(注意服务名称不以 d 结尾): ``` # systemctl restart rsyslog ``` 在随便重启两个守护进程之前和之后查看下自定义日志的内容: ![Linux 创建自定义日志文件](/data/attachment/album/201511/05/125616hozb920700x1wbou.png) *创建自定义日志文件* 作为一个自学练习,我建议你重点关注设备和优先级,添加额外的消息到已有的日志文件或者像上面那样创建一个新的日志文件。 ### 使用 Logrotate 轮换日志 为了防止日志文件无限制增长,logrotate 工具用于轮换、压缩、移除或者通过电子邮件发送日志,从而减轻管理会产生大量日志文件系统的困难。(译者注:[日志轮换](https://en.wikipedia.org/wiki/Log_rotation)(rotate)是系统管理中归档每天产生的日志文件的自动化过程) Logrotate 作为一个 cron 任务(/etc/cron.daily/logrotate)每天运行,并从 /etc/logrotate.conf 和 /etc/logrotate.d 中的文件(如果有的话)读取配置信息。 对于 rsyslog,即使你可以在主文件中为指定服务包含设置,为每个服务创建单独的配置文件能帮助你更好地组织设置。 让我们来看一个典型的 logrotate.conf: ![Logrotate 配置](/data/attachment/album/201511/05/125622lti103gx7kk33pgi.png) *Logrotate 配置* 在上面的例子中,logrotate 会为 /var/log/wtmp 进行以下操作:尝试每个月轮换一次,但至少文件要大于 1MB,然后用 0664 权限、用户 root、组 utmp 创建一个新的日志文件。下一步只保存一个归档日志,正如轮换指令指定的: ![每月 Logrotate 日志](/data/attachment/album/201511/05/125623lraxnglzd2d32d62.png) *每月 Logrotate 日志* 让我们再来看看 /etc/logrotate.d/httpd 中的另一个例子: ![轮换 Apache 日志文件](/data/attachment/album/201511/05/125627v2ghs5p1pppp1pi1.png) *轮换 Apache 日志文件* 你可以在 logrotate 的 man 手册([man logrotate](http://www.tecmint.com/wp-content/pdf/logrotate.pdf) 和 [man logrotate.conf](http://www.tecmint.com/wp-content/pdf/logrotate.conf.pdf))中阅读更多有关它的设置。为了方便你的阅读,本文还提供了两篇文章的 PDF 格式。 作为一个系统工程师,很可能由你决定多久按照什么格式保存一次日志,这取决于你是否有一个单独的分区/逻辑卷给 `/var`。否则,你真的要考虑删除旧日志以节省存储空间。另一方面,根据你公司和客户内部的政策,为了以后的安全审核,你可能必须要保留多个日志。 #### 保存日志到数据库 当然检查日志可能是一个很繁琐的工作(即使有类似 grep 工具和正则表达式的帮助)。因为这个原因,rsyslog 允许我们把它们导出到数据库(OTB 支持的关系数据库管理系统包括 MySQL、MariaDB、PostgreSQL 和 Oracle 等)。 指南的这部分假设你已经在要管理日志的 RHEL 7 上安装了 MariaDB 服务器和客户端: ``` # yum update && yum install mariadb mariadb-server mariadb-client rsyslog-mysql # systemctl enable mariadb && systemctl start mariadb ``` 然后使用 `mysql_secure_installation` 工具为 root 用户设置密码以及其它安全考量: ![保证 MySQL 数据库安全](/data/attachment/album/201511/05/125629xsi14yo1k12y4mi5.png) *保证 MySQL 数据库安全* 注意:如果你不想用 MariaDB root 用户插入日志消息到数据库,你也可以配置用另一个用户账户。如何实现的介绍已经超出了本文的范围,但在 [MariaDB 知识](https://mariadb.com/kb/en/mariadb/create-user/) 中有详细解析。为了简单在这篇指南中我们会使用 root 账户。 下一步,从 [GitHub](https://github.com/sematext/rsyslog/blob/master/plugins/ommysql/createDB.sql) 下载 createDB.sql 脚本并导入到你的数据库服务器: ``` # mysql -u root -p < createDB.sql ``` ![保存服务器日志到数据库](/data/attachment/album/201511/05/125633a2ad02ldaab2hppp.png) *保存服务器日志到数据库* 最后,添加下面的行到 /etc/rsyslog.conf: ``` $ModLoad ommysql $ActionOmmysqlServerPort 3306 *.* :ommysql:localhost,Syslog,root,YourPasswordHere ``` 重启 rsyslog 和数据库服务器: ``` # systemctl restart rsyslog # systemctl restart mariadb ``` #### 使用 SQL 语法查询日志 现在执行一些会改变日志的操作(例如停止和启动服务),然后登录到你的数据库服务器并使用标准的 SQL 命令显示和查询日志: ``` USE Syslog; SELECT ReceivedAt, Message FROM SystemEvents; ``` ![在数据库中查询日志](/data/attachment/album/201511/05/125637h5dmcmpi5aomeum4.png) *在数据库中查询日志* ### 总结 在这篇文章中我们介绍了如何设置系统日志,如果轮换日志以及为了简化查询如何重定向消息到数据库。我们希望这些技巧能对你准备 [RHCE 考试](/article-6451-1.html) 和日常工作有所帮助。 正如往常,非常欢迎你的反馈。用下面的表单和我们联系吧。 --- via: <http://www.tecmint.com/manage-linux-system-logs-using-rsyslogd-and-logrotate/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,542
安卓编年史(7):Android 1.1——第一个真正的增量更新
http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-history-of-googles-mobile-os/7/
2015-11-06T15:23:00
[ "Android", "安卓编年史" ]
https://linux.cn/article-6542-1.html
![](/data/attachment/album/201611/27/201413kfjjro616aszedof.jpg) ![电子邮件应用的所有界面。前两张截图展示了标签/收件箱结合的视图,最后一张截图展示了一封邮件。](/data/attachment/album/201511/06/152333l0h8ry8hbz7ede8w.png) *电子邮件应用的所有界面。前两张截图展示了标签/收件箱结合的视图,最后一张截图展示了一封邮件。 [Ron Amadeo供图]* 邮件视图是——令人惊讶的!居然是白色。安卓的电子邮件应用从历史角度来说算是个打了折扣的 Gmail 应用,你可以在这里看到紧密的联系。读邮件以及写邮件视图几乎没有任何修改地就从 Gmail 那里直接取过来使用。 ![即时通讯应用。截图展示了服务提供商选择界面,朋友列表,以及一个对话。](/data/attachment/album/201511/06/152334tjz259gqlqafqa29.png) *即时通讯应用。截图展示了服务提供商选择界面,朋友列表,以及一个对话。[Ron Amadeo供图]* 在 Google Hangouts 之前,甚至是 Google Talk 之前,就有了“IM”——安卓1.0带来的唯一一个即时通讯客户端。令人惊奇的是,它支持多种 IM 服务:用户可以从 AIM、Google Talk、Windows Live Messenger 以及 Yahoo 中挑选。还记得操作系统开发者什么时候关心过互通性吗? 朋友列表是黑色背景界面,如果在聊天中则带有白色聊天气泡。状态用一个带颜色的圆形来指示,右侧的小安卓机器人指示出某人正在使用移动设备。IM 应用相比 Google Hangouts 远比它有沟通性,这真是十分神奇的。绿色代表着某人正在使用设备并且已经登录,黄色代表着他们登录了但处于空闲状态,红色代表他们手动设置状态为忙,不想被打扰,灰色表示离线。现在 Hangouts 只显示用户是否打开了应用。 聊天对话界面明显基于信息应用,聊天的背景从白色和蓝色被换成了白色和绿色。但是没人更改信息输入框的颜色,所以加上橙色的高亮效果,界面共使用了白色,绿色,蓝色和橙色。 ![安卓1.0上的YouTube。截图展示了主界面,打开菜单的主界面,分类界面,视频播放界面。](/data/attachment/album/201511/06/152335v1wuz4gke5aku535.png) *安卓1.0上的 YouTube。截图展示了主界面,打开菜单的主界面,分类界面,视频播放界面。[Ron Amadeo供图]* 以 G1 的 320p 屏幕和 3G 网络速度,YouTube 可能不会有今天这样的手机上的表现,但谷歌的视频服务在安卓 1.0 上就被置入发布了。主界面看起来就像是安卓市场调整过的版本,顶部带有一个横向滚动选择部分,下面有垂直滚动分类列表。谷歌的一些分类选择还真是奇怪:“最热门”和“最多观看”有什么区别? 这是一个谷歌没有意识到 YouTube 最终能达到多庞大的标志——有一个视频分类是“最近更新”。在今天,每分钟有[100 小时时长的视频](http://www.youtube.com/yt/press/statistics.html)上传到 Youtube 上,如果这个分类能正常工作的话,它会是一个快速滚动的视频列表,快到以至于变为一片无法阅读的模糊。 菜单含有搜索,喜爱,分类,设置。设置(没有该图片)是有史以来最简陋的,只有个清除搜索历史的选项。分类都是一样的平淡,仅仅是个黑色的文本列表。 最后一张截图展示了视频播放界面,只支持横屏模式。尽管自动隐藏的播放控制有个进度条,但它还是很奇怪地包含了后退和前进按钮。 ![YouTube的视频菜单,描述页面,评论。](/data/attachment/album/201511/06/152336oyqhdxe3bxz5qx8n.png) *YouTube 的视频菜单,描述页面,评论。[Ron Amadeo供图]* 每个视频的更多选项可以通过点击菜单按钮来打开。在这里你可以把视频标记为“喜爱”,查看详细信息,以及阅读评论。所有的这些界面,和视频播放一样,是锁定横屏模式的。 然而“共享”不会打开一个对话框,它只是向 Gmail 邮件中加入了视频的链接。想要把链接通过短信或即时消息发送给别人是不可能的。你可以阅读评论,但是没办法评价他们或发表自己的评论。你同样无法给视频评分或赞。 ![相机应用的拍照界面,菜单,照片浏览模式。](/data/attachment/album/201511/06/152336bvy8bbsll8q8lq6e.png) *相机应用的拍照界面,菜单,照片浏览模式。[Ron Amadeo供图]* 在实体机上跑真正的安卓意味着相机功能可以正常运作,即便那里没什么太多可关注的。左边的黑色方块是相机的界面,原本应该显示取景器图像,但 SDK 的截图工具没办法捕捉下来。G1 有个硬件实体的拍照键(还记得吗?),所以相机没必要有个屏幕上的快门键。相机没有曝光,白平衡,或 HDR 设置——你可以拍摄照片,仅此而已。 菜单按钮显示两个选项:跳转到相册应用和带有两个选项的设置界面。第一个设置选项是是否给照片加上地理标记,第二个是在每次拍摄后显示提示菜单,你可以在上面右边看到截图。同样的,你目前还只能拍照——还不支持视频拍摄。 ![日历的月视图,打开菜单的周视图,日视图,以及日程。](/data/attachment/album/201511/06/152337b97wgr079blkx0xr.png) *日历的月视图,打开菜单的周视图,日视图,以及日程。[Ron Amadeo供图]* 就像这个时期的大多数应用一样,日历的主命令界面是菜单。菜单用来切换视图,添加新事件,导航至当天,选择要显示的日程,以及打开设置。菜单扮演着每个单独按钮的入口的作用。 月视图不能显示约会事件的文字。每个日期旁边有个侧边,约会会显示为侧边上的绿色部分,通过位置来表示约会是在一天中的什么时候。周视图同样不能显示预约文字——G1 的 320×480 的显示屏像素还不够密——所以你会在日历中看到一个带有颜色指示条的白块。唯一一个显示文字的是日程和日视图。你可以用滑动来切换日期——左右滑动切换周和日,上下滑动切换月份和日程。 ![设置主界面,无线设置,关于页面的底部。](/data/attachment/album/201511/06/152338rsdsbkaxx8askt7s.png) *设置主界面,无线设置,关于页面的底部。[Ron Amadeo供图]* 安卓 1.0 最终带来了设置界面。这个界面是个带有文字的黑白界面,粗略地分为各个部分。每个列表项边上的下箭头让人误以为点击它会展开折叠的更多东西,但是触摸列表项的任何位置只会加载下一屏幕。所有的界面看起来确实无趣,都差不多一样,但是,嘿,这可是设置啊。 任何带有开/关状态的选项都使用了卡通风格的复选框。安卓 1.0 最初的复选框真是奇怪——就算是在“未选中”状态时,它们还是有个灰色的勾选标记在里面。安卓把勾选标记当作了灯泡,打开时亮起来,关闭的时候变得黯淡,但这不是复选框的工作方式。然而我们最终还是见到了“关于”页面。安卓 1.0 运行 Linux 内核 2.6.25 版本。 设置界面意味着我们终于可以打开安全设置并更改锁屏。安卓 1.0 只有两种风格,安卓 0.9 那样的灰色方形锁屏,以及需要你在 9 个点组成的网格中画出图案的图形解锁。像这样的滑动图案相比 PIN 码更加容易记忆和输入,尽管它没有增加多少安全性。 ![语音拨号,图形锁屏,电池低电量警告,时间设置。](/data/attachment/album/201511/06/152338qqhhlqwifhz10aau.png) *语音拨号,图形锁屏,电池低电量警告,时间设置。[Ron Amadeo供图]* 语音功能和语音拨号一同来到了 1.0。这个特性以各种功能实现在 AOSP 徘徊了一段时间,然而它是一个简单的拨打号码和联系人的语音命令应用。语音拨号是个和谷歌未来的语音产品完全无关的应用,它的工作方式和非智能机上的语音拨号一样。 关于最后一个值得注意的,当电池电量低于百分之十五的时候会触发低电量弹窗。这是个有趣的图案,它把电源线错误的一端插入手机。谷歌,那可不是(现在依然不是)手机应该有的充电方式。 安卓 1.0 是个伟大的开端,但是功能上仍然有许多缺失。强制配备了实体键盘和大量硬件按钮,因为不带有十字方向键或轨迹球的安卓设备依然不被允许销售。另外,基本的智能手机功能比如自动旋转依然缺失。内置应用不可能像今天这样通过安卓市场来更新。所有的谷歌系应用和系统交织在一起。如果谷歌想要升级一个单独的应用,需要通过运营商推送整个系统的更新。安卓依然还有许多工作要做。 ### 安卓 1.1——第一个真正的增量更新 ![安卓1.1的所有新特性:语音搜索,安卓市场付费应用支持,谷歌纵横,设置中的新“系统更新”选项。](/data/attachment/album/201511/06/152339evx2ubh7vhyyx2bw.png) *安卓 1.1 的所有新特性:语音搜索,安卓市场付费应用支持,谷歌纵横,设置中的新“系统更新”选项。[Ron Amadeo供图]* 安卓 1.0 发布四个半月后,2009 年 2 月,安卓在安卓 1.1 中得到了它的第一个公开更新。系统方面没有太多变化,谷歌向 1.1 中添加的新东西现如今也都已被关闭。谷歌语音搜索是安卓向云端语音搜索的第一个突击,它在应用抽屉里有自己的图标。尽管这个应用已经不能与谷歌服务器通讯,你可以[在 iPhone 上](http://www.youtube.com/watch?v=y3z7Tw1K17A)看到它以前是怎么工作的。它还没有语音操作,但你可以说出想要搜索的,结果会显示在一个简单的谷歌搜索中。 安卓市场添加了对付费应用的支持,但是就像 beta 客户端中一样,这个版本的安卓市场已经不能连接 Google Play 服务器。我们最多能够看到分类界面,你可以在免费应用、付费应用和全部应用中选择。 地图添加了[谷歌纵横](http://arstechnica.com/information-technology/2009/02/google-tries-location-based-social-networking-with-latitude/),一个向朋友分享自己位置的方法。纵横在几个月前为了支持 Google+ 而被关闭并且不再能够工作。地图菜单里有个纵横的选项,但点击它现在只会打开一个带载入中圆圈的画面,并永远停留在这里。 安卓世界的系统更新来得更加迅速——或者至少是一条在运营商和OEM推送之前获得更新的途径——谷歌也在“关于手机”界面添加了检查系统更新按钮。 --- ![](/data/attachment/album/201511/06/152340t5s6xkob1i2bxi8s.jpg) [Ron Amadeo](http://arstechnica.com/author/ronamadeo) / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。[@RonAmadeo](https://twitter.com/RonAmadeo) --- via: <http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/7/> 译者:[alim0x](https://github.com/alim0x) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,546
与 Linux 一起学习:学习数学
https://www.maketecheasier.com/learn-linux-maths/
2015-11-07T09:29:00
[ "数学", "gnuplot", "maxima" ]
https://linux.cn/article-6546-1.html
![](/data/attachment/album/201511/07/003153s5q188d2l8zisi4d.png) “与 Linux 一起学习”的所有文章: * [与 Linux 一起学习:学习打字](/article-6902-1.html) * [与 Linux 一起学习:学习物理](/article-6903-1.html) * [与 Linux 一起学习:学习音乐](/article-6912-1.html) * [与 Linux 一起学习:学习地理](/article-6913-1.html) * [与 Linux 一起学习:学习数学](/article-6546-1.html) Linux 提供了大量的教育软件和许多优秀的工具来帮助各种年龄段和年级的学生学习和练习各种各样的习题,这通常是以交互的方式进行。“与 Linux 一起学习”这一系列的文章则为这些各种各样的教育软件和应用提供了一个介绍。 数学是计算机的核心。如果有人预期一个类如 GNU/ Linux 这样的伟大的操作系统精确而严格,那么这就是数学所起到的作用。如果你在寻求一些数学应用程序,那么你将不会感到失望。Linux 提供了很多优秀的工具使得数学看起来和你曾经做过的一样令人畏惧,但实际上他们会简化你使用它的方式。 ### Gnuplot Gnuplot 是一个适用于不同平台的命令行脚本化和多功能的图形工具。尽管它的名字中带有“GNU”,但是它并不是 GNU 操作系统的一部分。虽然不是自由授权,但它是免费软件(这意味着它受版权保护,但免费使用)。 要在 Ubuntu 系统(或者衍生系统)上安装 `gnuplot`,输入: ``` sudo apt-get install gnuplot gnuplot-x11 ``` 进入一个终端窗口。启动该程序,输入: ``` gnuplot ``` 你会看到一个简单的命令行界面: ![learnmath-gnuplot](/data/attachment/album/201511/07/003156r97hl7fwnfh33o3h.png) 在其中您可以直接输入函数开始。绘图命令将绘制一个曲线图。 输入内容,例如, ``` plot sin(x)/x ``` 随着`gnuplot的`提示,将会打开一个新的窗口,图像便会在里面呈现。 ![learnmath-gnuplot-plot1](/data/attachment/album/201511/07/003157e6sln6uflh5bi6db.png) 你也可以即时设置设置这个图的不同属性,比如像这样指定“title” ``` plot sin(x) title 'Sine Function', tan(x) title 'Tangent' ``` ![learnmath-gnuplot-plot2](/data/attachment/album/201511/07/003159lruo3mu3uuvlzy20.png) 你可以做的更深入一点,使用`splot`命令绘制3D图形: ``` splot sin(x*y/20) ``` ![learnmath-gnuplot-plot3](/data/attachment/album/201511/07/003201zyi07ytzzog7iwdn.png) 这个图形窗口有几个基本的配置选项, ![learnmath-gnuplot-options](/data/attachment/album/201511/07/003201hvxasx2ovkspbh3k.png) 但是`gnuplot`的真正力量在于在它的命令行和脚本功能,`gnuplot`更完整的文档在[Duke大学网站](http://people.duke.edu/%7Ehpgavin/gnuplot.html)上面[找到](http://www.gnuplot.info/documentation.html),带有这个了不起的教程的原始版本。 ### Maxima [Maxima](http://maxima.sourceforge.net/) 是一个源于 Macsyma 开发的一个计算机代数系统,根据它的 SourceForge 页面所述: > > “Maxima 是一个操作符号和数值表达式的系统,包括微分,积分,泰勒级数,拉普拉斯变换,常微分方程,线性方程组,多项式,集合,列表,向量,矩阵和张量等。Maxima 通过精确的分数,任意精度的整数和可变精度浮点数产生高精度的计算结果。Maxima 可以以二维和三维的方式绘制函数和数据。“ > > > 大多数Ubuntu衍生系统都有 Maxima 二进制包以及它的图形界面,要安装这些软件包,输入: ``` sudo apt-get install maxima xmaxima wxmaxima ``` 在终端窗口中,Maxima 是一个没有什么 UI 的命令行工具,但如果你开始 wxmaxima,你会进入一个简单但功能强大的图形用户界面。 ![learnmath-maxima](/data/attachment/album/201511/07/003202nmi9cdcvli5martw.png) 你可以通过简单的输入来开始。(提示:回车会增加更多的行,如果你想计算一个表达式,使用“Shift + Enter”。) Maxima 可以用于一些简单的问题,因此也可以作为一个计算器: ![learnmath-maxima-1and1](/data/attachment/album/201511/07/003202luk45znpup7m7an4.png) 以及一些更复杂的问题: ![learnmath-maxima-functions](/data/attachment/album/201511/07/003204iud689j38733bd79.png) 它使用`gnuplot`使得绘制简单: ![learnmath-maxima-plot](/data/attachment/album/201511/07/003205pez1fgersrassf9f.png) 或者绘制一些复杂的图形。 ![learnmath-maxima-plot2](/data/attachment/album/201511/07/003207v52y9nbysz9r69bq.png) (它需要 gnuplot-X11 的软件包来显示它们。) 除了将表达式表示为图形,Maxima 也可以用 latex 格式导出它们,或者通过右键快捷菜单进行一些常用操作. ![learnmath-maxima-menu](/data/attachment/album/201511/07/003207d37ny4o64roabcsy.png) 不过其主菜单还是提供了大量重磅功能,当然 Maxima 的功能远不止如此,这里也有一个广泛使用的[在线文档](http://maxima.sourceforge.net/documentation.html)。 ### 总结 数学不是一门容易的学科,这些在 Linux 上的优秀软件也没有使得数学更加容易,但是这些应用使得使用数学变得更加的简单和方便。以上两种应用都只是介绍一下 Linux 所提供的。如果你是认真从事数学和需要更多的功能与丰富的文档,那你更应该看看这些 [Mathbuntu](http://www.mathbuntu.org/) 项目。 --- via: <https://www.maketecheasier.com/learn-linux-maths/> 作者:[Attila Orosz](https://www.maketecheasier.com/author/attilaorosz/) 译者:[KnightJoker](https://github.com/KnightJoker/KnightJoker) 校对:[wxyD](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Linux offers great educational software and many excellent tools to aid students of all grades and ages in learning and practicing a variety of topics, often interactively. The “Learn with Linux” series of articles offers an introduction to a variety of educational apps and software. Mathematics is the core of computing. If one would expect a great operating system, such as GNU/Linux, to excel in and discipline, it would be Math. If you seek mathematical applications, you will not be disappointed. Linux offers many excellent tools that will make Mathematics look as intimidating as it ever did, but at least they will simplify your way of using it. ## Gnuplot Gnuplot is a command-line scriptable and versatile graphing utility for different platforms. Despite its name, it is not part of the GNU operating system. Although it is not freely licensed, it’s free-ware (meaning it’s copyrighted but free to use). To install `gnuplot` on an Ubuntu (or derivative) system, type sudo apt-get install gnuplot gnuplot-x11 into a terminal window. To start the program, type gnuplot You will be presented with a simple command line interface into which you can start typing functions directly. The plot command will draw a graph. Typing, for instance, plot sin(x)/x into the `gnuplot` prompt, will open another window, wherein the graph is presented. You can also set different attributes of the graphs in-line. For example, specifying “title” will give them just that. plot sin(x) title 'Sine Function', tan(x) title 'Tangent' You can give things a bit more depth and draw 3D graphs with the `splot` command. splot sin(x*y/20) The plot window has a few basic configuration options, but the true power of `gnuplot` lies within its command line and scripting capabilities. The extensive full documentation of `gnuplot` can be found [here](https://www.gnuplot.info/documentation.html) with a great tutorial for the previous version [on the Duke University’s website](https://people.duke.edu/~hpgavin/gnuplot.html). ## Maxima [Maxima](https://maxima.sourceforge.net/) is a computer algebra system developed from the original sources of Macsyma. According to its SourceForge page, “Maxima is a system for the manipulation of symbolic and numerical expressions, including differentiation, integration, Taylor series, Laplace transforms, ordinary differential equations, systems of linear equations, polynomials, sets, lists, vectors, matrices and tensors. Maxima yields high precision numerical results by using exact fractions, arbitrary-precision integers and variable-precision floating-point numbers. Maxima can plot functions and data in two and three dimensions.” You will have binary packages for Maxima in most Ubuntu derivatives as well as the Maxima graphical interface. To install them all, type sudo apt-get install maxima xmaxima wxmaxima into a terminal window. Maxima is a command line utility with not much of a UI, but if you start `wxmaxima` , you’ll get into a simple, yet powerful GUI. You can start using this by simply starting to type. (Hint: Enter will add more lines; if you want to evaluate an expression, use “Shift + Enter.”) Maxima can be used for very simple problems, as it also acts as a calculator, and much more complex ones as well. It uses `gnuplot` to draw simple and more elaborate graphs. (It needs the` gnuplot-x11` package to display them.) Besides beautifying the expressions, Maxima makes it possible to export them in latex format, or do some operations on the highlighted functions with a right-click context menu, while its main menus offer an overwhelming amount of functionality. Of course, Maxima is capable of much more than this. It has an extensive documentation [available online.](https://maxima.sourceforge.net/documentation.html) ## Conclusion Mathematics is not an easy subject, and the excellent math software on Linux does not make it look easier, yet these applications make using Mathematics much more straightforward and productive. The above two applications are just an introduction to what Linux has to offer. If you are seriously engaged in math and need even more functionality with great documentation, you should check out the [Mathbuntu project.](https://www.mathbuntu.org/) Our latest tutorials delivered straight to your inbox
6,549
Linux有问必答: 当使用代理服务器连接互联网时如何安装 Ubuntu 桌面版
http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html
2015-11-07T19:52:47
[ "Ubuntu", "代理服务器" ]
/article-6549-1.html
> > **提问:** 我的电脑连接到的公司网络是使用HTTP代理连上互联网的。当我想使用CD-ROM安装Ubuntu时,安装在尝试获取文件时被停滞了,可能是由于代理的原因。然而问题是Ubuntu的安装程序从来没有在安装过程中提示我配置代理。我该怎样通过代理服务器安装Ubuntu桌面版? > > > 不像Ubuntu服务器版,Ubuntu桌面版的安装非常自动化,没有留下太多的自定义空间,就像自定义磁盘分区,手动网络设置,包选择等等。虽然这种简单的,一键安装被认为是用户友好的,但却是那些寻找“高级安装模式”来定制自己的Ubuntu桌面安装的用户不希望的。 除此之外,默认的Ubuntu桌面版安装器的一个大问题是缺少代理设置。如果你电脑在代理后面,你会看到Ubuntu在准备下载文件的时候停滞了。 ![](/data/attachment/album/201511/07/195250sz4w0i413h1s3l4u.jpg) 这篇文章描述了如何解除Ubuntu安装限制以及**如何通过代理服务器安装Ubuntu桌面**。 基本的想法是这样的。首先启动到live Ubuntu桌面中而不是直接启动Ubuntu安装器,配置代理设置并且手动在live Ubuntu中启动Ubuntu安装器。下面是步骤。 从Ubuntu桌面版CD/DVD或者USB启动后,在欢迎页面点击“Try Ubuntu”。 ![](/data/attachment/album/201511/07/195251i9sz6olwsllllliu.jpg) 当你进入live Ubuntu后,点击左边的设置图标。 ![](/data/attachment/album/201511/07/195252f91141ef14ddv0vk.jpg) 进入网络菜单。 ![](/data/attachment/album/201511/07/195252q7jb5cevbfzbt3jv.jpg) 手动配置代理。 ![](/data/attachment/album/201511/07/195252elnhfzozls9n1hdh.jpg) 接下来,打开终端。 ![](/data/attachment/album/201511/07/195253vf9mmnrmyqpvwprp.jpg) 输入下面的命令进入root会话。 ``` $ sudo su ``` 最后以root权限输入下面的命令。 ``` # ubiquity gtk_ui ``` 它会启动基于GUI的Ubuntu安装器。 ![](/data/attachment/album/201511/07/195253a42t3p9sgjxjp33j.jpg) 接着完成剩余的安装。 ![](/data/attachment/album/201511/07/195254ctnp09njrrknmmbm.jpg) --- via: <http://ask.xmodulo.com/install-ubuntu-desktop-behind-proxy.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /install-ubuntu-desktop-behind-proxy.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327581960>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,553
在 Ubuntu 14.04 中配置 PXE 服务器
https://www.maketecheasier.com/configure-pxe-server-ubuntu/
2015-11-09T10:27:00
[ "PXE", "安装", "tftp" ]
https://linux.cn/article-6553-1.html
![](/data/attachment/album/201511/08/233125iu4dcjdgjs4mrgp8.jpg) PXE(<ruby> 预启动执行环境 <rp> ( </rp> <rt> Preboot Execution Environment </rt> <rp> ) </rp></ruby>)服务器允许用户从网络中启动 Linux 发行版并且可以不需要 Linux ISO 镜像就能同时在数百台 PC 中安装。如果你客户端的计算机没有 CD/DVD 或USB 引导盘,或者如果你想在大型企业中同时安装多台计算机,那么 PXE 服务器可以帮你节省时间和金钱。 在这篇文章中,我们将告诉你如何在 Ubuntu 14.04 配置 PXE 服务器。 ### 配置网络 开始前,你需要先设置 PXE 服务器使用静态 IP。在你的系统中要使用静态 IP 地址,需要编辑 “/etc/network/interfaces” 文件。 打开 “/etc/network/interfaces” 文件. ``` sudo nano /etc/network/interfaces ``` 作如下修改: ``` # 回环网络接口 auto lo iface lo inet loopback # 主网络接口 auto eth0 iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 ``` 保存文件并退出。这将设置其 IP 地址为“192.168.1.20”。然后重新启动网络服务。 ``` sudo /etc/init.d/networking restart ``` ### 安装 DHCP, TFTP 和 NFS: DHCP,TFTP 和 NFS 是 PXE 服务器的重要组成部分。首先,需要更新你的系统并安装所有需要的软件包。 为此,运行以下命令: ``` sudo apt-get update sudo apt-get install isc-dhcp-Server inetutils-inetd tftpd-hpa syslinux nfs-kernel-Server ``` ### 配置 DHCP 服务: DHCP 代表<ruby> 动态主机配置协议 <rp> ( </rp> <rt> Dynamic Host Configuration Protocol </rt> <rp> ) </rp></ruby>,它主要用于动态分配网络配置参数,如用于接口和服务的 IP 地址。在 PXE 环境中,DHCP 服务器允许客户端请求并自动获得一个 IP 地址来访问网络。 1、编辑 “/etc/default/dhcp3-server” 文件. ``` sudo nano /etc/default/dhcp3-server ``` 作如下修改: ``` INTERFACES="eth0" ``` 保存 (Ctrl + o) 并退出 (Ctrl + x) 文件. 2、编辑 “/etc/dhcp3/dhcpd.conf” 文件: ``` sudo nano /etc/dhcp/dhcpd.conf ``` 作如下修改: ``` default-lease-time 600; max-lease-time 7200; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.21 192.168.1.240; option subnet-mask 255.255.255.0; option routers 192.168.1.20; option broadcast-address 192.168.1.255; filename "pxelinux.0"; next-Server 192.168.1.20; } ``` 保存文件并退出。 3、启动 DHCP 服务. ``` sudo /etc/init.d/isc-dhcp-server start ``` ### 配置 TFTP 服务器: TFTP 是一种文件传输协议,类似于 FTP,但它不用进行用户认证也不能列出目录。TFTP 服务器总是监听网络上的 PXE 客户端的请求。当它检测到网络中有 PXE 客户端请求 PXE 服务时,它将提供包含引导菜单的网络数据包。 1、配置 TFTP 时,需要编辑 “/etc/inetd.conf” 文件. ``` sudo nano /etc/inetd.conf ``` 作如下修改: ``` tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot ``` 保存文件并退出。 2、编辑 “/etc/default/tftpd-hpa” 文件。 ``` sudo nano /etc/default/tftpd-hpa ``` 作如下修改: ``` TFTP_USERNAME="tftp" TFTP_DIRECTORY="/var/lib/tftpboot" TFTP_ADDRESS="[:0.0.0.0:]:69" TFTP_OPTIONS="--secure" RUN_DAEMON="yes" OPTIONS="-l -s /var/lib/tftpboot" ``` 保存文件并退出。 3、 使用 `xinetd` 让 boot 服务在每次系统开机时自动启动,并启动tftpd服务。 ``` sudo update-inetd --enable BOOT sudo service tftpd-hpa start ``` 4、检查状态。 ``` sudo netstat -lu ``` 它将如下所示: ``` Proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 *:tftp *:* ``` ### 配置 PXE 启动文件 现在,你需要将 PXE 引导文件 “pxelinux.0” 放在 TFTP 根目录下。为 TFTP 创建目录结构,并从 “/usr/lib/syslinux/” 复制 syslinux 提供的所有引导程序文件到 “/var/lib/tftpboot/” 下,操作如下: ``` sudo mkdir /var/lib/tftpboot sudo mkdir /var/lib/tftpboot/pxelinux.cfg sudo mkdir -p /var/lib/tftpboot/Ubuntu/14.04/amd64/ sudo cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot/ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/ ``` #### 设置 PXELINUX 配置文件 PXE 配置文件定义了 PXE 客户端启动时显示的菜单,它能引导并与 TFTP 服务器关联。默认情况下,当一个 PXE 客户端启动时,它会使用自己的 MAC 地址指定要读取的配置文件,所以我们需要创建一个包含可引导内核列表的默认文件。 编辑 PXE 服务器配置文件,使用有效的安装选项。 编辑 “/var/lib/tftpboot/pxelinux.cfg/default”: ``` sudo nano /var/lib/tftpboot/pxelinux.cfg/default ``` 作如下修改: ``` DEFAULT vesamenu.c32 TIMEOUT 100 PROMPT 0 MENU INCLUDE pxelinux.cfg/PXE.conf NOESCAPE 1 LABEL Try Ubuntu 14.04 Desktop MENU LABEL Try Ubuntu 14.04 Desktop kernel Ubuntu/vmlinuz append boot=casper netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/Ubuntu/14.04/amd64 initrd=Ubuntu/initrd.lz quiet splash ENDTEXT LABEL Install Ubuntu 14.04 Desktop MENU LABEL Install Ubuntu 14.04 Desktop kernel Ubuntu/vmlinuz append boot=casper automatic-ubiquity netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/Ubuntu/14.04/amd64 initrd=Ubuntu/initrd.lz quiet splash ENDTEXT ``` 保存文件并退出。 编辑 “/var/lib/tftpboot/pxelinux.cfg/pxe.conf” 文件。 ``` sudo nano /var/lib/tftpboot/pxelinux.cfg/pxe.conf ``` 作如下修改: ``` MENU TITLE PXE Server NOESCAPE 1 ALLOWOPTIONS 1 PROMPT 0 MENU WIDTH 80 MENU ROWS 14 MENU TABMSGROW 24 MENU MARGIN 10 MENU COLOR border 30;44 #ffffffff #00000000 std ``` 保存文件并退出。 ### 为 PXE 服务器添加 Ubuntu 14.04 桌面启动镜像 对于这一步需要 Ubuntu 内核和 initrd 文件。要获得这些文件,你需要 Ubuntu 14.04 桌面 ISO 镜像。你可以通过以下命令下载 Ubuntu 14.04 ISO 镜像到 /mnt 目录: ``` sudo cd /mnt sudo wget http://releases.ubuntu.com/14.04/ubuntu-14.04.3-desktop-amd64.iso ``` **注意**: 下载用的 URL 可能会改变,因为 ISO 镜像会进行更新。如果上面的网址无法访问,看看[这个网站](http://releases.ubuntu.com/14.04/),了解最新的下载链接。 挂载 ISO 文件,使用以下命令将所有文件复制到 TFTP文件夹中: ``` sudo mount -o loop /mnt/ubuntu-14.04.3-desktop-amd64.iso /media/ sudo cp -r /media/* /var/lib/tftpboot/Ubuntu/14.04/amd64/ sudo cp -r /media/.disk /var/lib/tftpboot/Ubuntu/14.04/amd64/ sudo cp /media/casper/initrd.lz /media/casper/vmlinuz /var/lib/tftpboot/Ubuntu/ ``` ### 将导出的 ISO 目录配置到 NFS 服务器上 现在,你需要通过 NFS 协议来设置“安装源镜像( Installation Source Mirrors)”。你还可以使用 HTTP 和 FTP 来安装源镜像。在这里,我已经使用 NFS 输出 ISO 内容。 要配置 NFS 服务器,你需要编辑 “/etc/exports” 文件。 ``` sudo nano /etc/exports ``` 作如下修改: ``` /var/lib/tftpboot/Ubuntu/14.04/amd64 *(ro,async,no_root_squash,no_subtree_check) ``` 保存文件并退出。为使更改生效,输出并启动 NFS 服务。 ``` sudo exportfs -a sudo /etc/init.d/nfs-kernel-server start ``` 现在,你的 PXE 服务器已经准备就绪。 ### 配置网络引导 PXE 客户端 PXE 客户端可以是任何支持 PXE 网络引导的计算机系统。现在,你的客户端只需要在系统的 BIOS 中设置 “从网络引导(Boot From Network)” 选项就可以启动并安装 Ubuntu 14.04 桌面。 现在准备出发吧 - 用网络引导启动你的 PXE 客户端计算机,你现在应该看到一个子菜单,显示了我们创建的 Ubuntu 14.04 桌面的菜单项。 ![pxe](/data/attachment/album/201511/08/233127m0lsvog6wk00solv.png) ### 结论 配置使用 PXE 服务器从网络启动安装能提高效率和节省时间。你可以在本地网络中同时安装数百个客户端。所有你需要的只是一个 PXE 服务器和能启动 PXE 的客户端。试试吧,如果这个对你有用请让我们知道。 参考: * [PXE Server wiki](https://en.wikipedia.org/wiki/Preboot_Execution_Environment) * [PXE Server Ubuntu](https://help.ubuntu.com/community/PXEInstallServer) 图片来源: [fupsol*unl*20](https://www.flickr.com/photos/jhcalderon/3681926417/) --- via: <https://www.maketecheasier.com/configure-pxe-server-ubuntu/> 作者:[Hitesh Jethva](https://www.maketecheasier.com/author/hiteshjethva/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
PXE (Preboot Execution Environment) Server allows the user to boot a Linux distribution from a network and install it on hundreds of PCs at a time without any Linux iso images. If your client’s computers don’t have CD/DVD or USB drives, or if you want to set up multiple computers at the same time in a large enterprise, then PXE server can be used to save money and time. In this article we will show you how you can configure a PXE server in Ubuntu 14.04. ## Configure Networking To get started, you need to first set up your PXE server to use a static IP. To set up a static IP address in your system, you need to edit the “/etc/network/interfaces” file. 1. Open the “/etc/network/interfaces” file. sudo nano /etc/network/interfaces Add/edit as described below: # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.1.20 netmask 255.255.255.0 gateway 192.168.1.1 dns-nameservers 8.8.8.8 Save the file and exit. This will set its IP address to “192.168.1.20”. Restart the network service. sudo /etc/init.d/networking restart ## Install DHCP, TFTP and NFS: DHCP, TFTP and NFS are essential components for configuring a PXE server. First you need to update your system and install all necessary packages. For this, run the following commands: sudo apt-get update sudo apt-get install isc-dhcp-Server inetutils-inetd tftpd-hpa syslinux nfs-kernel-Server ## Configure DHCP Server: DHCP stands for Dynamic Host Configuration Protocol, and it is used mainly for dynamically distributing network configuration parameters such as IP addresses for interfaces and services. A DHCP server in PXE environment allow clients to request and receive an IP address automatically to gain access to the network servers. 1. Edit the “/etc/default/dhcp3-server” file. sudo nano /etc/default/dhcp3-server Add/edit as described below: INTERFACES="eth0" Save (Ctrl + o) and exit (Ctrl + x) the file. 2. Edit the “/etc/dhcp3/dhcpd.conf” file: sudo nano /etc/dhcp/dhcpd.conf Add/edit as described below: default-lease-time 600; max-lease-time 7200; subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.21 192.168.1.240; option subnet-mask 255.255.255.0; option routers 192.168.1.20; option broadcast-address 192.168.1.255; filename "pxelinux.0"; next-Server 192.168.1.20; } Save the file and exit. 3. Start the DHCP service. sudo /etc/init.d/isc-dhcp-server start ## Configure TFTP Server: TFTP is a file-transfer protocol which is similar to FTP. It is used where user authentication and directory visibility are not required. The TFTP server is always listening for PXE clients on the network. When it detects any network PXE client asking for PXE services, then it provides a network package that contains the boot menu. 1. To configure TFTP, edit the “/etc/inetd.conf” file. sudo nano /etc/inetd.conf Add/edit as described below: tftp dgram udp wait root /usr/sbin/in.tftpd /usr/sbin/in.tftpd -s /var/lib/tftpboot Save and exit the file. 2. Edit the “/etc/default/tftpd-hpa” file. sudo nano /etc/default/tftpd-hpa Add/edit as described below: TFTP_USERNAME="tftp" TFTP_DIRECTORY="/var/lib/tftpboot" TFTP_ADDRESS="[:0.0.0.0:]:69" TFTP_OPTIONS="--secure" RUN_DAEMON="yes" OPTIONS="-l -s /var/lib/tftpboot" Save and exit the file. 3. Enable boot service for `inetd` to automatically start after every system reboot and start `tftpd` service. sudo update-inetd --enable BOOT sudo service tftpd-hpa start 4. Check status. sudo netstat -lu It will show the following output: Proto Recv-Q Send-Q Local Address Foreign Address State udp 0 0 *:tftp *:* ## Configure PXE boot files Now you need the PXE boot file “pxelinux.0” to be present in the TFTP root directory. Make a directory structure for TFTP, and copy all the bootloader files provided by syslinux from the “/usr/lib/syslinux/” to the “/var/lib/tftpboot/” path by issuing the following commands: sudo mkdir /var/lib/tftpboot sudo mkdir /var/lib/tftpboot/pxelinux.cfg sudo mkdir -p /var/lib/tftpboot/Ubuntu/14.04/amd64/ sudo cp /usr/lib/syslinux/vesamenu.c32 /var/lib/tftpboot/ sudo cp /usr/lib/syslinux/pxelinux.0 /var/lib/tftpboot/ **Set up PXELINUX configuration file** The PXE configuration file defines the boot menu displayed to the PXE client when it boots up and contacts the TFTP server. By default, when a PXE client boots up, it will use its own MAC address to specify which configuration file to read, so we need to create that default file that contains the list of kernels which are available to boot. Edit the PXE Server configuration file with valid installation options. To edit “/var/lib/tftpboot/pxelinux.cfg/default,” sudo nano /var/lib/tftpboot/pxelinux.cfg/default Add/edit as described below: DEFAULT vesamenu.c32 TIMEOUT 100 PROMPT 0 MENU INCLUDE pxelinux.cfg/PXE.conf NOESCAPE 1 LABEL Try Ubuntu 14.04 Desktop MENU LABEL Try Ubuntu 14.04 Desktop kernel Ubuntu/vmlinuz append boot=casper netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/Ubuntu/14.04/amd64 initrd=Ubuntu/initrd.lz quiet splash ENDTEXT LABEL Install Ubuntu 14.04 Desktop MENU LABEL Install Ubuntu 14.04 Desktop kernel Ubuntu/vmlinuz append boot=casper automatic-ubiquity netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/Ubuntu/14.04/amd64 initrd=Ubuntu/initrd.lz quiet splash ENDTEXT Save and exit the file. Edit the “/var/lib/tftpboot/pxelinux.cfg/pxe.conf” file. sudo nano /var/lib/tftpboot/pxelinux.cfg/pxe.conf Add/edit as described below: MENU TITLE PXE Server NOESCAPE 1 ALLOWOPTIONS 1 PROMPT 0 MENU WIDTH 80 MENU ROWS 14 MENU TABMSGROW 24 MENU MARGIN 10 MENU COLOR border 30;44 #ffffffff #00000000 std Save and exit the file. ## Add Ubuntu 14.04 Desktop Boot Images to PXE Server For this, Ubuntu kernel and initrd files are required. To get those files, you need the Ubuntu 14.04 Desktop ISO Image. You can download the Ubuntu 14.04 ISO image in the /mnt folder by issuing the following command: sudo cd /mnt sudo wget http://releases.ubuntu.com/14.04/ubuntu-14.04.3-desktop-amd64.iso **Note**: the download URL might change as the ISO image is updated. Check out this [website](https://releases.ubuntu.com/14.04/) for the latest download link if the above URL is not working. Mount the ISO file, and copy all the files to the TFTP folder by issuing the following commands: sudo mount -o loop /mnt/ubuntu-14.04.3-desktop-amd64.iso /media/ sudo cp -r /media/* /var/lib/tftpboot/Ubuntu/14.04/amd64/ sudo cp -r /media/.disk /var/lib/tftpboot/Ubuntu/14.04/amd64/ sudo cp /media/casper/initrd.lz /media/casper/vmlinuz /var/lib/tftpboot/Ubuntu/ ## Configure NFS Server to Export ISO Contents Now you need to setup Installation Source Mirrors via NFS protocol. You can also use `http` and `ftp` for Installation Source Mirrors. Here I have used NFS to export ISO contents. To configure the NFS server, you need to edit the “/etc/exports” file. sudo nano /etc/exports Add/edit as described below: /var/lib/tftpboot/Ubuntu/14.04/amd64 *(ro,async,no_root_squash,no_subtree_check) Save and exit the file. For the changes to take effect, export and start NFS service. sudo exportfs -a sudo /etc/init.d/nfs-kernel-server start Now your PXE Server is ready. ## Configure Network Boot PXE Client A PXE client can be any computer system with a PXE network boot enable option. Now your clients can boot and install Ubuntu 14.04 Desktop by enabling “Boot From Network” options from their systems BIOS. You’re now ready to go – start your PXE Client Machine with the network boot enable option, and you should now see a sub-menu showing for your Ubuntu 14.04 Desktop that we created. ## Conclusion Configuring network boot installation using PXE server is efficient and a time-saving method. You can install hundreds of client at a time in your local network. All you need is a PXE server and PXE enabled clients. Try it out, and let us know if this works for you. Reference: [PXE Server wiki](https://en.wikipedia.org/wiki/Preboot_Execution_Environment) [PXE Server Ubuntu](https://help.ubuntu.com/community/PXEInstallServer) Image credit: [fupsol_unl_20](https://www.flickr.com/photos/jhcalderon/3681926417/) Our latest tutorials delivered straight to your inbox
6,565
SSL/TLS 加密新纪元 - Let's Encrypt
https://github.com/vizv
2015-11-11T08:40:00
[ "https", "ssl" ]
https://linux.cn/article-6565-1.html
根据 Let's Encrypt 官方博客消息,Let's Encrypt 服务将在下周(11 月 16 日)正式对外开放。 Let's Encrypt 项目是由<ruby> 互联网安全研究小组 <rp> ( </rp> <rt> ISRG,Internet Security Research Group </rt> <rp> ) </rp></ruby>主导并开发的一个新型<ruby> 数字证书认证机构 <rp> ( </rp> <rt> CA,Certificate Authority </rt> <rp> ) </rp></ruby>。该项目旨在开发一个自由且开放的自动化 CA 套件,并向公众提供相关的证书**免费签发服务**以降低安全通讯的财务、技术和教育成本。在过去的一年中,互联网安全研究小组拟定了 [ACME 协议草案](https://github.com/letsencrypt/acme-spec),并首次实现了使用该协议的应用套件:服务端 [Boulder](https://github.com/letsencrypt/boulder) 和客户端 [letsencrypt](https://github.com/letsencrypt/letsencrypt)。 至于为什么 Let's Encrypt 让我们如此激动,以及 HTTPS 协议如何保护我们的通讯请参考[浅谈 HTTPS 和 SSL/TLS 协议的背景与基础](/article-5175-1.html)。 ![Let's Encrypt](/data/attachment/album/201511/11/083937alelmdbkrmweezwt.jpg) (题图来自:muylinux.com) ### ACME 协议 Let's Encrypt 的诞生离不开 ACME(<ruby> <a href="https://github.com/letsencrypt/acme-spec"> 自动证书管理环境 </a> <rp> ( </rp> <rt> Automated Certificate Management Environment </rt> <rp> ) </rp></ruby>)协议的拟定。 说到 ACME 协议,我们不得不提一下传统 CA 的认证方式。Let's Encrypt 服务所签发的证书为<ruby> 域名认证证书 <rp> ( </rp> <rt> DV,Domain-validated Certificate </rt> <rp> ) </rp></ruby>,签发这类证书需要域名所有者完成以下至少一种<ruby> 挑战 <rp> ( </rp> <rt> Challenge </rt> <rp> ) </rp></ruby>以证明自己对域名的所有权: * 验证申请人对域名的 Whois 信息中邮箱的控制权; * 验证申请人对域名的常见管理员邮箱(如以 `admin@`、`postmaster@` 开头的邮箱等)的控制权; * 在 DNS 的 TXT 记录中发布一条 CA 提供的字符串; * 在包含域名的网址中特定路径发布一条 CA 提供的字符串。 不难发现,其中最容易实现自动化的一种操作必然为最后一条,ACME 协议中的 [Simple HTTP](https://letsencrypt.github.io/acme-spec/#simple-http) 认证即是用一种类似的方法对从未签发过任何证书的域名进行认证。该协议要求在访问 `http://域名/.well-known/acme-challenge/指定字符串` 时返回特定的字符串。 然而实现该协议的客户端 [letsencrypt](https://github.com/letsencrypt/letsencrypt) 做了更多——它不仅可以通过 ACME 协议配合服务端 [Boulder](https://github.com/letsencrypt/boulder) 的域名进行<ruby> 独立 <rp> ( </rp> <rt> standalone </rt> <rp> ) </rp></ruby>的认证工作,同时还可以自动配置常见的服务器软件(目前支持 Nginx 和 Apache)以完成认证。 ### Let's Encrypt 免费证书签发服务 对于大多数网站管理员来讲,想要对自己的 Web 服务器进行加密需要一笔不小的支出进行证书签发并且难以配置。根据早些年 SSL Labs 公布的 [2010 年互联网 SSL 调查报告(PDF)](https://community.qualys.com/servlet/JiveServlet/download/38-1636/Qualys_SSL_Labs-State_of_SSL_2010-v1.6.pdf) 指出超过半数的 Web 服务器没能正确使用 Web 服务器证书,主要的问题有证书不被浏览器信任、证书和域名不匹配、证书过期、证书信任链没有正确配置、使用已知有缺陷的协议和算法等。而且证书过期后的续签和泄漏后的吊销仍需进行繁琐的人工操作。 幸运的是 Let's Encrypt 免费证书签发服务在经历了漫长的开发和测试之后终于来临,在 Let's Encrypt 官方 CA 被广泛信任之前,IdenTrust 的根证书对 Let's Encrypt 的二级 CA 进行了交叉签名使得大部分浏览器已经信任 Let's Encrypt 签发的证书。 ### 使用 letsencrypt 由于当前 Let's Encrypt 官方的证书签发服务还未公开,你只能尝试开发版本。这个版本会签发一个 CA 标识为 `happy hacker fake CA` 的测试证书,注意这个证书不受信任。 要获取开发版本请直接: ``` $ git clone https://github.com/letsencrypt/letsencrypt ``` 以下的[使用方法](https://letsencrypt.org/howitworks/)摘自 Let's Encrypt 官方网站。 #### 签发证书 `letsencrypt` 工具可以协助你处理证书请求和验证工作。 **自动配置 Web 服务器** 下面的操作将会自动帮你将新证书配置到 Nginx 和 Apache 中。 ``` $ letsencrypt run ``` **独立签发证书** 下面的操作将会将新证书置于当前目录下。 ``` $ letsencrypt -d example.com auth ``` #### 续签证书 默认情况下 `letsencrypt` 工具将协助你跟踪当前证书的有效期限并在需要时自动帮你续签。如果需要手动续签,执行下面的操作。 ``` $ letsencrypt renew --cert-path example-cert.pem ``` #### 吊销证书 列出当前托管的证书菜单以吊销。 ``` $ letsencrypt revoke ``` 你也可以吊销某一个证书或者属于某个私钥的所有证书。 ``` $ letsencrypt revoke --cert-path example-cert.pem ``` ``` $ letsencrypt revoke --key-path example-key.pem ``` ### Docker 化 letsencrypt 如果你不想让 letsencrypt 自动配置你的 Web 服务器的话,使用 Docker 跑一份独立的版本将是一个不错的选择。你所要做的只是在装有 Docker 的系统中执行: ``` $ sudo docker run -it --rm -p 443:443 -p 80:80 --name letsencrypt \ -v "/etc/letsencrypt:/etc/letsencrypt" \ -v "/var/lib/letsencrypt:/var/lib/letsencrypt" \ quay.io/letsencrypt/letsencrypt:latest auth ``` 你就可以快速的为自己的 Web 服务器签发一个免费而且受信任的 DV 证书啦! ### Let's Encrypt 的注意事项 * Let's Encrypt 当前发行的 DV 证书仅能验证域名的所有权,并不能验证其所有者身份; * Let's Encrypt 不像其他 CA 那样对安全事故有保险赔付; * Let's Encrypt 目前不提供 Wildcard 证书; * Let's Encrypt 的有效时间仅为 90 天,逾期需要续签(可自动续签)。 对于 Let's Encrypt 的介绍就到这里,让我们一起目睹这场互联网的安全革命吧。
200
OK
## Pinned Loading - [df-steam-hook-rs](/vizv/df-steam-hook-rs)df-steam-hook-rs PublicForked from [dfint/df-steam-hook-rs](/dfint/df-steam-hook-rs)Experimantal crossplatform implementation of df-steam-hook in Rust Something went wrong, please refresh the page to try again. If the problem persists, check the If the problem persists, check the
6,570
Ubuntu 软件中心将在 16.04 LTS 中被替换
http://www.omgubuntu.co.uk/2015/11/the-ubuntu-software-centre-is-being-replace-in-16-04-lts
2015-11-13T07:11:00
[ "Ubuntu", "软件中心" ]
https://linux.cn/article-6570-1.html
![The USC Will Be Replaced](/wp-content/uploads/2011/09/usc1.jpg) *Ubuntu 软件中心将在 Ubuntu 16.04 LTS 中被替换。* Ubuntu Xenial Xerus 桌面用户将会发现,这个熟悉的(并有些繁琐的)Ubuntu 软件中心将不再可用。 按照目前的计划,GNOME 的<ruby> <a href="https://wiki.gnome.org/Apps/Software"> 软件应用 </a> <rp> ( </rp> <rt> Software application </rt> <rp> ) </rp></ruby>将作为基于 Unity 7 的桌面的默认包管理工具。 ![GNOME Software](/data/attachment/album/201511/12/221244xqqsyrkbqmmskfs9.jpg) *GNOME 软件应用* 作为这次变化的一个结果是,会新开发插件来支持软件中心的评级、评论和应用程序付费的功能。 该决定是在伦敦的 Canonical 总部最近举行的一次桌面峰会中通过的。 “相对于 Ubuntu 软件中心,我们认为我们在 GNOME 软件中心(sic)添加 Snaps 支持上能做的更好。所以,现在看起来我们将使用 GNOME 软件中心来取代 [Ubuntu 软件中心]”,Ubuntu 桌面经理 Will Cooke 在 Ubuntu 在线峰会解释说。 GNOME 3.18 架构与也将出现在 Ubuntu 16.04 中,其中一些应用程序将更新到 GNOME 3.20 , ‘这么做也是有道理的’,Will Cooke 补充说。 我们最近在 Twitter 上做了一项民意调查,询问如何在 Ubuntu 上安装软件。结果表明,只有少数人怀念现在的软件中心... 你使用什么方式在 Ubuntu 上安装软件? * 软件中心 * 终端 ### 在 Ubuntu 16.04 其他应用程序也将会减少 Ubuntu 软件中心并不是唯一一个在 Xenial Xerus 中被丢弃的。 光盘刻录工具 Brasero 和即时通讯工具 Empathy 也将从默认镜像中删除。 虽然这些应用程序还在不断的开发,但随着笔记本减少了光驱以及基于移动网络的聊天服务,它们看起来越来越过时了。 如果你还在使用它们请不要惊慌:Brasero 和 Empathy 将 **仍然可以通过存档在 Ubuntu 上安装**。 也并不全是丢弃和替换,默认还包括了一个新的桌面应用程序:GNOME 日历。 --- via: <http://www.omgubuntu.co.uk/2015/11/the-ubuntu-software-centre-is-being-replace-in-16-04-lts> 作者:[Sam Tran](https://plus.google.com/111008502832304483939?rel=author) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,572
那些奇特的 Linux 发行版本
http://www.techdrivein.com/2015/08/the-strangest-most-unique-linux-distros.html
2015-11-13T08:10:00
[ "Linux", "发行版" ]
https://linux.cn/article-6572-1.html
从大多数消费者所关注的诸如 Ubuntu,Fedora,Mint 或 elementary OS 到更加复杂、轻量级和企业级的诸如 Slackware,Arch Linux 或 RHEL,这些发行版本我都已经见识过了。除了这些,难道没有其他别的了吗?其实 Linux 的生态系统是非常多样化的,对每个人来说,总有一款适合你。下面就让我们讨论一些稀奇古怪的小众 Linux 发行版本吧,它们代表着开源平台真正的多样性。 ### Puppy Linux ![Puppy Linux](/data/attachment/album/201511/12/231139azolqtc551cn7l6n.png) 它是一个仅有一个普通 DVD 光盘容量十分之一大小的操作系统,这就是 Puppy Linux。整个操作系统仅有 100MB 大小!并且它还可以从内存中运行,这使得它运行极快,即便是在老式的 PC 机上。 在操作系统启动后,你甚至可以移除启动介质!还有什么比这个更好的吗? 系统所需的资源极小,大多数的硬件都会被自动检测到,并且它预装了能够满足你基本需求的软件。[在这里体验 Puppy Linux 吧](http://puppylinux.org/main/Overview%20and%20Getting%20Started.htm). ### Suicide Linux(自杀 Linux) ![Suicide Linux(自杀 Linux)](/data/attachment/album/201511/12/231304wbyxb9ru5h8esnz0.jpg) 这个名字吓到你了吗?我想应该是。 ‘任何时候 -注意是任何时候-一旦你远程输入不正确的命令,解释器都会创造性地将它重定向为 `rm -rf /` 命令,然后擦除你的硬盘’。它就是这么简单。我真的很想知道谁自信到将[Suicide Linux](http://qntm.org/suicide) 安装到生产机上。 **警告:千万不要在生产机上尝试这个!** 假如你感兴趣的话,现在可以通过一个简洁的[DEB 包](http://sourceforge.net/projects/suicide-linux/files/)来获取到它。 ### PapyrOS ![PapyrOS](/data/attachment/album/201511/12/231335gs8sbz3200c6nqon.png) 它的 “奇怪”是好的方面。PapyrOS 正尝试着将 Android 的 material 设计语言引入到新的 Linux 发行版本上。尽管这个项目还处于早期阶段,看起来它已经很有前景。该项目的网页上说该系统已经完成了 80%,随后人们可以期待它的第一个 Alpha 发行版本。在该项目被宣告提出时,我们做了 [PapyrOS](http://www.techdrivein.com/2015/02/papyros-material-design-linux-coming-soon.html) 的小幅报道,从它的外观上看,它甚至可能会引领潮流。假如你感兴趣的话,可在 [Google+](https://plus.google.com/communities/109966288908859324845/stream/3262a3d3-0797-4344-bbe0-56c3adaacb69) 上关注该项目并可通过 [BountySource](https://www.bountysource.com/teams/papyros) 来贡献出你的力量。 ### Qubes OS ![Qubes OS](/data/attachment/album/201511/12/231400q4uudpdud990uu4y.png) Qubes 是一个开源的操作系统,其设计通过使用<ruby> <a href="https://en.wikipedia.org/wiki/Compartmentalization_(information_security)"> 安全分级 </a> <rp> ( </rp> <rt> Security by Compartmentalization </rt> <rp> ) </rp></ruby>的方法,来提供强安全性。其前提假设是不存在完美的没有 bug 的桌面环境。并通过实现一个‘<ruby> 安全隔离 <rp> ( </rp> <rt> Security by Isolation </rt> <rp> ) </rp></ruby>’ 的方法,[Qubes Linux](https://www.qubes-os.org/)试图去解决这些问题。Qubes 基于 Xen、X 视窗系统和 Linux,并可运行大多数的 Linux 应用,支持大多数的 Linux 驱动。Qubes 入选了 Access Innovation Prize 2014 for Endpoint Security Solution 决赛名单。 ### Ubuntu Satanic Edition ![Ubuntu Satanic Edition](/data/attachment/album/201511/12/231742w9wfv39cucnvjnuf.jpg) Ubuntu SE 是一个基于 Ubuntu 的发行版本。通过一个含有主题、壁纸甚至来源于某些天才新晋艺术家的重金属音乐的综合软件包,“它同时带来了最好的自由软件和免费的金属音乐” 。尽管这个项目看起来不再积极开发了, Ubuntu Satanic Edition 甚至在其名字上都显得奇异。 [Ubuntu SE (Slightly NSFW)](http://ubuntusatanic.org/)。 ### Tiny Core Linux ![Tiny Core Linux](/data/attachment/album/201511/12/231622p07a0rkdkfdkeafc.png) Puppy Linux 还不够小?试试这个吧。 Tiny Core Linux 是一个 12MB 大小的图形化 Linux 桌面!是的,你没有看错。一个主要的补充说明:它不是一个完整的桌面,也并不完全支持所有的硬件。它只含有能够启动进入一个非常小巧的 X 桌面,支持有线网络连接的核心部件。它甚至还有一个名为 Micro Core Linux 的没有 GUI 的版本,仅有 9MB 大小。[Tiny Core Linux](http://tinycorelinux.net/)。 ### NixOS ![NixOS](/data/attachment/album/201511/12/231808rr2rek8eg89je39v.png) 它是一个资深用户所关注的 Linux 发行版本,有着独特的打包和配置管理方式。在其他的发行版本中,诸如升级的操作可能是非常危险的。升级一个软件包可能会引起其他包无法使用,而升级整个系统感觉还不如重新安装一个。在那些你不能安全地测试由一个配置的改变所带来的结果的更改之上,它们通常没有“重来”这个选项。在 NixOS 中,整个系统由 Nix 包管理器按照一个纯功能性的构建语言的描述来构建。这意味着构建一个新的配置并不会重写先前的配置。大多数其他的特色功能也遵循着这个模式。Nix 相互隔离地存储所有的软件包。有关 NixOS 的更多内容请看[这里](https://nixos.org/)。 ### GoboLinux ![GoboLinux](/data/attachment/album/201511/12/231825rteo7d4171tzo1zt.jpg) 这是另一个非常奇特的 Linux 发行版本。它与其他系统如此不同的原因是它有着独特的重新整理的文件系统。它有着自己独特的子目录树,其中存储着所有的文件和程序。GoboLinux 没有专门的包数据库,因为其文件系统就是它的数据库。在某些方面,这类重整有些类似于 OS X 上所看到的功能。 ### Hannah Montana Linux ![Hannah Montana Linux](/data/attachment/album/201511/12/231841j7d4z4nsaxzagzr7.jpg) 它是一个基于 Kubuntu 的 Linux 发行版本,它有着<ruby> 汉娜·蒙塔娜 <rp> ( </rp> <rt> Hannah Montana </rt> <rp> ) </rp></ruby> 主题的开机启动界面、KDM(KDE Display Manager)、图标集、ksplash、plasma、颜色主题和壁纸(I'm so sorry)。[这是它的链接](http://hannahmontana.sourceforge.net/)。这个项目现在不再活跃了。 ### RLSD Linux 它是一个极其精简、小巧、轻量和安全可靠的,基于 Linux 文本的操作系统。开发者称 “它是一个独特的发行版本,提供一系列的控制台应用和自带的安全特性,对黑客或许有吸引力。” [RLSD Linux](http://rlsd2.dimakrasner.com/). 我们还错过了某些更加奇特的发行版本吗?请让我们知晓吧。 --- via: <http://www.techdrivein.com/2015/08/the-strangest-most-unique-linux-distros.html> 作者:Manuel Jose 译者:[FSSlc](https://github.com/FSSlc) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,585
Linux 有问必答:如何在debian及其衍生发行版中改变默认的 Java 版本
http://ask.xmodulo.com/change-default-java-version-linux.html
2015-11-16T08:05:00
[ "java" ]
/article-6585-1.html
> > **提问**:当我尝试在Linux中运行一个Java程序时,我遇到了一个错误。看上去像程序编译所使用的Java版本与我本地的不同。我该如何在Linux上切换默认的Java版本? > > > 当Java程序编译时,编译环境会设置一个“target”变量来设置程序可以运行的最低Java版本。如果你Linux系统上运行的程序不能满足最低的JRE版本要求,那么你会在运行的时候遇到下面的错误。 ``` Exception in thread "main" java.lang.UnsupportedClassVersionError: com/xmodulo/hmon/gui/NetConf : Unsupported major.minor version 51.0 ``` 比如,程序在Java JRE 1.7下编译,但是系统只有Java JRE 1.6。 ![](/data/attachment/album/201511/16/001124yixixswnwri0kryr.jpg) 要解决这个问题,你需要改变默认的Java版本到Java JRE 1.7或者更高(假设JRE已经安装了)。 首先,试用下面的update-alternatives命令**检查你系统上可用的Java版本**: ``` $ sudo update-alternatives --display java ``` ![](/data/attachment/album/201511/16/001134bkktx3x859cscu5f.jpg) 本例中,总共安装了4个不同的Java版本:OpenJDK JRE 1.6、Oracle Java JRE 1.6、OpenJDK JRE 1.7 和 Oracle Java JRE 1.7。现在默认的Java版本是OpenJDK JRE 1.6。 如果没有安装需要的Java JRE,你可以参考[这些指导](http://ask.xmodulo.com/install-java-runtime-linux.html)来完成安装。 现在有可用的候选版本,你可以用下面的命令在可用的Java JRE之间**切换默认的Java版本**: ``` $ sudo update-alternatives --config java ``` 看到提示的时候,选择你想试用的Java版本。本例中,我们选择Oracle Java JRE 1.7。 ![](/data/attachment/album/201511/16/001134edxwy2dd9l9ya2tw.jpg) 现在用下面的命令验证默认的Java版本。 ``` $ java -version ``` ![](/data/attachment/album/201511/16/001135i0aq1cwjxt5wj9qj.jpg) 最后,如果你定义了JAVA\_HOME环境变量,根据你设置的Java版本更新变量。 --- via: <http://ask.xmodulo.com/change-default-java-version-linux.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /change-default-java-version-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327580c10>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,586
如何在 Linux 上使用 SSHfs 挂载一个远程文件系统
https://www.maketecheasier.com/sshfs-mount-remote-filesystem-linux/
2015-11-16T09:49:00
[ "SSHfs", "ssh" ]
https://linux.cn/article-6586-1.html
你曾经想过用安全 shell 挂载一个远程文件系统到本地吗?如果有的话,SSHfs 也许就是你所需要的。它通过使用 SSH 和 Fuse(LCTT 译注:Filesystem in Userspace,用户态文件系统,是 Linux 中用于挂载某些网络空间,如 SSH,到本地文件系统的模块) 允许你挂载远程计算机(或者服务器)到本地。 **注意**: 这篇文章假设你明白[SSH 如何工作并在你的系统中配置 SSH](https://www.maketecheasier.com/setup-ssh-ubuntu/)。 ![](/data/attachment/album/201511/16/010840b4jipb9sursbj6ir.jpg) ### 准备 在使用 SSHfs 挂载之前,需要进行一些设置 - 在你的系统上安装 SSHfs 以及 fuse 软件包。你还需要为 fuse 创建一个组,添加用户到组,并创建远程文件系统将会驻留的目录。 要在 Ubuntu Linux 上安装两个软件包,只需要在终端窗口输入以下命令: ``` sudo apt-get install sshfs fuse ``` ![ubuntu 安装 sshfs-fuse](/data/attachment/album/201511/16/010935gjnjcrc6rztc86t8.jpg) 如果你使用的不是 Ubuntu,那就在你的发行版软件包管理器中搜索软件包名称。最好搜索和 fuse 或 SSHfs 相关的关键字,因为取决于你运行的系统,软件包名称可能稍微有些不同。 在你的系统上安装完软件包之后,就该创建好 fuse 组了。在你安装 fuse 的时候,应该会在你的系统上创建一个组。如果没有的话,在终端窗口中输入以下命令以便在你的 Linux 系统中创建组: ``` sudo groupadd fuse ``` 添加了组之后,把你的用户添加到这个组。 ``` sudo gpasswd -a "$USER" fuse ``` ![sshfs 添加用户到组 fuse](/data/attachment/album/201511/16/010936rvva653999996125.png) 别担心上面命令的 `$USER`。shell 会自动用你自己的用户名替换。处理了和组相关的工作之后,就是时候创建要挂载远程文件的目录了。 ``` mkdir ~/remote_folder ``` 在你的系统上创建了本地目录之后,就可以通过 SSHfs 挂载远程文件系统了。 ### 挂载远程文件系统 要在你的机器上挂载远程文件系统,你需要在终端窗口中输入一段较长的命令。 ``` sshfs -o idmap=user [email protected]:/remote/file/system/ ~/remote ``` ![sshfs 挂载文件系统到本地目录1](/data/attachment/album/201511/16/010936wz1qe2555tzqlzik.png) **注意**: 也可以通过 SSH 密钥文件挂载 SSHfs 文件系统。只需要在上面的命中用 `sshfs -o IdentityFile=~/.ssh/keyfile`, 替换 `sshfs -o idmap=user` 部分。 输入这个命令之后,会提示你输入远程用户的密码。如果登录成功了,你的远程文件系统就会被挂载到之前创建的 `~/remote_folder` 目录。 ![sshfs挂载文件系统到本地目录2](/data/attachment/album/201511/16/010937toiotinelfoohxuy.jpg) 使用完了你的远程文件系统,想要卸载它?容易吗?只需要在终端输入下面的命令: ``` sudo umount ~/remote_folder ``` 这个简单的命令会断开远程连接同时清空 remote\_folder 目录。 ### 总结 在 Linux 上有很多工具可以用于访问远程文件并挂载到本地。但是如之前所说,如果有的话,也只有很少的工具能充分利用 SSH 的强大功能。我希望在这篇指南的帮助下,也能认识到 SSHfs 是一个多么强大的工具。 你觉得 SSHfs 怎么样呢?在下面的评论框里告诉我们吧! --- via: <https://www.maketecheasier.com/sshfs-mount-remote-filesystem-linux/> 作者:[Derrik Diener](https://www.maketecheasier.com/author/derrikdiener/) 译者:[ictlyh](http://mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![Sshfs Featured](https://www.maketecheasier.com/assets/uploads/2019/06/sshfs-featured.png) There’s certainly no shortage of solutions when it comes to syncing files between two devices. While Google Drive and Microsoft OneDrive may not give you official Linux clients, NextCloud and others do. But maybe you don’t trust a big corporation to store your files. Or, maybe, you want more security than NextCloud offers. With all the components that go into building something like NextCloud, chances are it has more undiscovered security holes than simpler solutions. ## Why Use SSHFS? From the end-user perspective, this is very easy to use, clean and simple. It’s also incredibly secure since it relies on the battle-hardened and proven OpenSSH server. Encryption is also top notch, so you can rest assured that no one can steal your files while they are in transit. A correctly configured up-to-date server that only listens for SSH connections is usually impossible to crack for all but the most skilled attackers (think NSA, security specialists, etc.). And they probably don’t want your files. ## Why You Wouldn’t Want to Use SSHFS If you want the best possible transfer speed, you might want to use other solutions such as NFS. SSHFS is not the slowest if your Internet connection is of high quality, but it’s not the fastest either. And if you want to transfer directories that contain hundreds of small files, it becomes horrible. Also, if you want to fine-tune file sharing settings, based on individual users or other factors, you might want to use other software. To summarize, if all you need is an easy, secure way to synchronize a remote directory with a local one and aren’t in a huge hurry, you will probably be satisfied with this solution. ## Install SSHFS On Arch Linux based installations, use this command: sudo pacman -S sshfs If you’re on a Fedora-based distro, use: sudo dnf install sshfs On Debian, Ubuntu and family, use: sudo apt install sshfs For those of you that use OpenSUSE, enter this command: sudo zypper install sshfs ## Server Configuration If you rent a server or VPS, the OpenSSH server daemon is already configured. Follow the steps recommended by your cloud service provider to configure a regular user (non-root). Some let you do this directly from their web control panel and even let you import the public key to allow SSH access. In this case, [generate the key pairs locally](https://www.maketecheasier.com/generate-public-private-ssh-key/), with the `ssh-keygen` command. After, import the public key from “/home/your_username/.ssh/id_rsa.pub.” If the cloud provider doesn’t offer a tool to easily import SSH public keys, do it manually. At the very least, disallow root login and disable password logins. [Use SSH keys exclusively instead](https://www.maketecheasier.com/enable-passwordless-ssh-logins-linux/): they are impossible to brute-force, as is the case with passwords. If you want to sync files between two computers at home, just treat one as the server (install `openssh-server` package and configure) and the other one as the client. The same steps apply. ## Mount a Remote Directory Locally with SSHFS First, create a directory that will be synced with the remote side. mkdir $HOME/sshfs Next, mount the remote directory locally through SSHFS. Replace “user” with the actual username created on your server and “203.0.113.1” with the actual IP address of your remote instance. sshfs [email protected]:/home/user $HOME/sshfs Of course, if you don’t want to sync the entire home directory of the user on the server side, just replace “/home/user” with “/home/user/some_other_directory” after you create it on the server. When you want to unmount, use this command: cd && fusermount -u $HOME/sshfs ## Conclusion If you want a directory to permanently sync to the remote side, add a command like `sshfs [email protected]:/home/user $HOME/sshfs` in your autostart manager. Each graphical manager has a different autostart configuration manager, so consult your desktop environment help manual(s). Some sources recommend adding an entry to “/etc/fstab,” but we advise you to avoid that, as failure to mount the directory may result in your system failing to boot entirely. Hopefully this covers all your needs. But, if it doesn’t, you can read about more command line options in the [online SSHFS manual](https://linux.die.net/man/1/sshfs). Our latest tutorials delivered straight to your inbox
6,589
LastPass 的开源替代品
http://www.linuxlinks.com/article/20151108125950773/LastPassAlternatives.html
2015-11-16T23:53:33
[ "LastPass", "密码" ]
https://linux.cn/article-6589-1.html
LastPass是一个跨平台的密码管理程序。在Linux平台中,它可作为Firefox, Chrome和Opera浏览器的插件使用。LastPass Sesame支持Ubuntu/Debian与Fedora系统。此外,LastPass还有安装在Firefox Portable的便携版,可将其安装在USB设备上。再加上适用于Ubuntu/Debian, Fedora和openSUSE的LastPass Pocket, 其具有良好的跨平台覆盖性。虽然LastPass备受好评,但它是一个专有软件。此外,LastPass最近被LogMeIn收购。如果你在找一个开源的替代品,这篇文章可能会对你有所帮助。 ![](/data/attachment/album/201511/16/233826bg12i1ym4pg6ut8z.jpg) 我们正面临着信息大爆炸。无论你是要在线经营生意,找工作,还是只为了休闲来进行阅读,互联网都是一个海量的信息源。在这种情况下,长期保留信息是很困难的。然而,及时地获取某些特定信息非常重要。密码就是这样的一个例子。 作为一个电脑用户,你可能会面临在不同服务或网站使用相同或不同密码的困境。这个事情非常复杂,因为有些网站会限制你对密码的选择。比如,一个网站可能会限制密码的最小位数,大写字母,数字或者特殊字符,这使得在所有网站使用统一密码变得不可能。更重要的是,不在不同网站中使用同一密码有安全方面的原因。这样就不可避免地意味着人们经常会有很多密码要记。一个解决方案是将所有的密码写下来。然而,这种做法也极度的不安全。 为了解决需要记忆无穷多串密码的问题,目前比较流行的解决方案是使用密码管理软件。事实上,这类软件对于活跃的互联网用户来说极为实用。它使得你获取、管理和安全保存所有密码变得极为容易,而大多数密码都是用软件或文件系统加密过的。因此,用户只需要记住一个简单的密码就可以获取到其它所有密码。密码管理软件鼓励用户对于不同服务去采用独一无二的,非直观的高强度的密码。 为了让大家更深入地了解Linux软件的质量,我将介绍4款优秀的、可替代LastPass的开源软件。 ### KeePassX ![KeePassX](/data/attachment/album/201511/16/235131rfrvvg6ur9rarlqv.png) KeePassX是KeePass的多平台移植,是一款开源、跨平台的密码管理软件。这款软件可以帮助你以安全的方式保管密码。你可以将所有密码保存在一个数据库中,而这个数据库被一个主密码或密码盘来保管。这使得用户只需要记住一个单一的主密码或插入密码盘即可解锁整个数据库。 密码数据库使用AES(即Rijndael)或者TwoFish算法进行加密,密钥长度为256位。 该软件功能包括: * 管理模式丰富 + 通过标题使每条密码更容易被识别 - 可设置密码过期时间 - 可插入附件 - 可为不同分组或密码自定义标志 - 在分组中对密码排序 * 搜索功能:可在特定分组或整个数据库中搜索 * 自动键入: 这个功能允许你在登录网站时只需要按下几个键。KeePassX可以帮助你输入剩下的密码。自动键入通过读取当前窗口的标题,对密码数据库进行搜索来获取相应的密码 * 数据库安全性强,用户可通过密码或一个密钥文件(可存储在CD或U盘中)访问数据库(或两者) * 安全密码自动生成 * 具有预防措施,获取用星号隐藏的密码并检查其安全性 * 加密 - 用256位密钥,通过AES(高级加密标准)或TwoFish算法加密数据库, * 密码可以导入或导出。可从PwManager文件(*.pwm)或KWallet文件(*.xml)中导入密码,可导出为文本(\*.txt)格式。 --- * 软件官网:[www.keepassx.org](http://www.keepassx.org/) * 开发者:KeepassX Team * 软件许可证:GNU GPL V2 * 版本号:0.4.3 ### Encryptr ![Encryptr](/data/attachment/album/201511/16/235210fatu4u4izk4ah6fw.png) Encryptr是一个开源的、零知识(zero-knowledge)的、基于云端的密码管理/电子钱包软件,以Crypton为基础开发。Crypton是一个Javascript库,允许开发者利用其开发应用来上传文件至服务器,而服务器无法知道用户所存储的文件内容。 Encryptr可将你的敏感信息,比如密码、信用卡数据、PIN码、或认证码存储在云端。然而,由于它基于零知识的Cypton框架开发,Encryptr可保证只有用户才拥有访问或读取秘密信息的权限。 由于其跨平台的特性,Encryptr允许用户随时随地、安全地通过一个账户从云端获取机密信息。 软件特性包括: * 使用非常安全的零知识Crypton框架,只在你的本地加密/解密数据 * 易于使用 * 基于云端 * 可存储三种类型的数据:密码、信用卡账号以及通用的键值对 * 可对每条密码设置“备注”项 * 过滤和搜索密码 * 对密码进行本地加密缓存,以节省载入时间 --- * 软件官网: [encryptr.org](https://encryptr.org/) * 开发者: Tommy Williams * 软件许可证: GNU GPL v3 * 版本号: 1.2.0 ### RatticDB ![RatticDB](/data/attachment/album/201511/16/235237rbwaul5av3xbiwsl.png) RatticDB是一个开源的、基于Django的密码管理服务。 RatticDB被设计为一个“密码生命周期管理工具”而不是单单一个“密码存储工具”。RatticDB致力于及时提醒用户哪些密码在何时需要更改。它不提供应用层面的密码加密。 软件特性包括: * 简洁的ACL设计 * 可改变队列功能,可让用户知晓何时需要更改某应用的密码 * 支持Ansible配置 --- * 软件官网: [rattic.org](http://rattic.org/) * 开发者: Daniel Hall * 软件许可证: GNU GPL v2 * 版本号: 1.3.1 ### Seahorse ![Seahorse](/data/attachment/album/201511/16/235322oz746z47nq47onn4.png) Seahorse是一个GnuPG(GNU隐私保护软件)的Gnome前端界面。它的目标是提供一个易于使用密钥管理工具,以及一个易于使用的界面来控制加密操作。 Seahorse是一个工具,用来提供安全传输和数据存储服务。数据加密和数字密钥生成操作可以轻易通过GUI来操作,密钥管理操作也可以轻易通过直观的界面来进行。 此外,Seahorse包含一个Gedit插件,可以使用鹦鹉螺文件管理器管理文件,一个管理剪贴板中事物的小程序,一个存储私密密码的代理,还有一个GnuPG和OpenSSH的密钥管理工具。 软件特性包括: * 对文本进行加密/解密/签名 * 管理密钥及密钥环 * 将密钥及密钥环与密钥服务器同步 * 密码签名及发布 * 将密码缓存起来,无需多次重复键入 * 对密钥及密钥环进行备份 * 可添加一个GDK支持格式的图片作为OpenGPG图片ID * 生成SSH密钥,对其进行验证及储存 * 多语言支持 --- * 软件官网: [www.gnome.org/projects/seahorse](http://www.gnome.org/projects/seahorse/) * 开发者: Jacob Perkins, Jose Carlos, Garcia Sogo, Jean Schurger, Stef Walter, Adam Schreiber * 软件许可证: GNU GPL v2 * 版本号: 3.18.0 --- via: <http://www.linuxlinks.com/article/20151108125950773/LastPassAlternatives.html> 译者:[StdioA](https://github.com/StdioA) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,592
Linux 有问必答:如何在 Linux 上自动设置 JAVA_HOME 环境变量
http://ask.xmodulo.com/set-java_home-environment-variable-linux.html
2015-11-17T13:19:40
[ "java", "JAVA_HOME" ]
/article-6592-1.html
> > **问题**:我需要在我的 Linux 机器上编译 Java 程序。为此我已经安装了 JDK (Java Development Kit),而现在我正试图设置 JAVA\_HOME 环境变量使其指向安装好的 JDK 。关于在 Linux 上设置 JAVA\_HOME 环境变量,最受推崇的办法是什么? > > > 许多 Java 程序或基于 Java 的*集成开发环境* (IDE)都需要设置好 JAVA\_HOME 环境变量。该变量应指向 *Java 开发工具包* (JDK)或 *Java 运行时环境* (JRE)的安装目录。JDK 不仅包含了 JRE 提供的一切,还带有用于编译 Java 程序的额外的二进制代码和库文件(例如编译器,调试器及 JavaDoc 文档生成器)。JDK 是用来构建 Java 程序的,如果只是运行已经构建好的 Java 程序,单独一份 JRE 就足够了。 当您正试图设置 JAVA\_HOME 环境变量时,麻烦的事情在于 JAVA\_HOME 变量需要根据以下几点而改变:(1) 您是否安装了 JDK 或 JRE;(2) 您安装了哪个版本;(3) 您安装的是 Oracle JDK 还是 Open JDK。 因此每当您的开发环境或运行时环境发生改变(例如为 JDK 更新版本)时,您需要根据实际情况调整 JAVA\_HOME 变量,而这种做法是繁重且缺乏效率的。 以下 `export` 命令能为您**自动设置** JAVA\_HOME 环境变量,而无须顾及上述的因素。 ![](/data/attachment/album/201511/17/131929scdx6dsxsweeawqj.png) 若您安装的是 JRE: ``` export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java)))) ``` 若您安装的是 JDK: ``` export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) ``` 根据您的情况,将上述命令中的一条写入 ~/.bashrc(或 /etc/profile)文件中,它就会永久地设置好 JAVA\_HOME 变量。 注意,由于 java 或 javac 可以建立起多个层次的符号链接,为此"readlink -f"命令是用来获取它们真正的执行路径的。 举个例子,假如您安装的是 Oracle JRE 7,那么上述的第一条 export 命令将自动设置 JAVA\_HOME 为: ``` /usr/lib/jvm/java-7-oracle/jre ``` 若您安装的是 Open JDK 第8版,那么第二条 export 命令将设置 JAVA\_HOME 为: ``` /usr/lib/jvm/java-8-openjdk-amd64 ``` ![](/data/attachment/album/201511/17/131941nki1kf7gv9g5nkcg.jpg) 简而言之,这些 export 命令会在您重装/升级您的JDK/JRE,或[更换默认 Java 版本](http://ask.xmodulo.com/change-default-java-version-linux.html)时自动更新 JAVA\_HOME 变量。您不再需要手动调整它。 --- via: <http://ask.xmodulo.com/set-java_home-environment-variable-linux.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[Ricky-Gong](https://github.com/Ricky-Gong) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /set-java_home-environment-variable-linux.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327581000>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,593
RHCE 系列(七):在 Linux 客户端配置基于 Kerberos 身份验证的 NFS 服务器
http://www.tecmint.com/setting-up-nfs-server-with-kerberos-based-authentication/
2015-11-17T13:38:59
[ "RHCE" ]
https://linux.cn/article-6593-1.html
在本系列的前一篇文章,我们回顾了[如何在可能包括多种类型操作系统的网络上配置 Samba 共享](/article-6550-1.html)。现在,如果你需要为一组类 Unix 客户端配置文件共享,很自然的你会想到网络文件系统,或简称 NFS。 ![设置使用 Kerberos 进行身份验证的 NFS 服务器](/data/attachment/album/201511/17/133903qgfa1npbdfaqanye.jpg) *RHCE 系列:第七部分 - 设置使用 Kerberos 进行身份验证的 NFS 服务器* 在这篇文章中我们会介绍配置基于 Kerberos 身份验证的 NFS 共享的整个流程。假设你已经配置好了一个 NFS 服务器和一个客户端。如果还没有,可以参考 [安装和配置 NFS 服务器](http://www.tecmint.com/configure-nfs-server/) - 它列出了需要安装的依赖软件包并解释了在进行下一步之前如何在服务器上进行初始化配置。 另外,你可能还需要配置 [SELinux](http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/) 和 [firewalld](http://www.tecmint.com/firewalld-rules-for-centos-7/) 以允许通过 NFS 进行文件共享。 下面的例子假设你的 NFS 共享目录在 box2 的 /nfs: ``` # semanage fcontext -a -t public_content_rw_t "/nfs(/.*)?" # restorecon -R /nfs # setsebool -P nfs_export_all_rw on # setsebool -P nfs_export_all_ro on ``` (其中 -P 标记指示重启持久有效)。 最后,别忘了: #### 创建 NFS 组并配置 NFS 共享目录 1、 新建一个名为 nfs 的组并给它添加用户 nfsnobody,然后更改 /nfs 目录的权限为 0770,组属主为 nfs。于是,nfsnobody(对应请求用户)在共享目录有写的权限,你就不需要在 /etc/exports 文件中使用 no*root*squash(LCTT 译注:设为 root\_squash 意味着在访问 NFS 服务器上的文件时,客户机上的 root 用户不会被当作 root 用户来对待)。 ``` # groupadd nfs # usermod -a -G nfs nfsnobody # chmod 0770 /nfs # chgrp nfs /nfs ``` 2、 像下面那样更改 export 文件(/etc/exports)只允许从 box1 使用 Kerberos 安全验证的访问(sec=krb5)。 **注意**:anongid 的值设置为之前新建的组 nfs 的 GID: **exports – 添加 NFS 共享** ``` /nfs box1(rw,sec=krb5,anongid=1004) ``` 3、 再次 exprot(-r)所有(-a)NFS 共享。为输出添加详情(-v)是个好主意,因为它提供了发生错误时解决问题的有用信息: ``` # exportfs -arv ``` 4、 重启并启用 NFS 服务器以及相关服务。注意你不需要启动 nfs-lock 和 nfs-idmapd,因为系统启动时其它服务会自动启动它们: ``` # systemctl restart rpcbind nfs-server nfs-lock nfs-idmap # systemctl enable rpcbind nfs-server ``` #### 测试环境和其它前提要求 在这篇指南中我们使用下面的测试环境: * 客户端机器 [box1: 192.168.0.18] * NFS / Kerberos 服务器 [box2: 192.168.0.20] (也称为密钥分发中心,简称 KDC)。 **注意**:Kerberos 服务是至关重要的认证方案。 正如你看到的,为了简便,NFS 服务器和 KDC 在同一台机器上,当然如果你有更多可用机器你也可以把它们安装在不同的机器上。两台机器都在 `mydomain.com` 域。 最后同样重要的是,Kerberos 要求客户端和服务器中至少有一个域名解析的基本方式和[网络时间协议](http://www.tecmint.com/install-ntp-server-in-centos/)服务,因为 Kerberos 身份验证的安全一部分基于时间戳。 为了配置域名解析,我们在客户端和服务器中编辑 /etc/hosts 文件: **host 文件 – 为域添加 DNS** ``` 192.168.0.18 box1.mydomain.com box1 192.168.0.20 box2.mydomain.com box2 ``` 在 RHEL 7 中,chrony 是用于 NTP 同步的默认软件: ``` # yum install chrony # systemctl start chronyd # systemctl enable chronyd ``` 为了确保 chrony 确实在和时间服务器同步你系统的时间,你可能要输入下面的命令两到三次,确保时间偏差尽可能接近 0: ``` # chronyc tracking ``` ![用 Chrony 同步服务器时间](/data/attachment/album/201511/17/133905jvmlzzmjv3s0j3sj.png) *用 Chrony 同步服务器时间* ### 安装和配置 Kerberos 要设置 KDC,首先在客户端和服务器安装下面的软件包(客户端不需要 server 软件包): ``` # yum update && yum install krb5-server krb5-workstation pam_krb5 ``` 安装完成后,编辑配置文件(/etc/krb5.conf 和 /var/kerberos/krb5kdc/kadm5.acl),像下面那样用 `mydomain.com` 替换所有 example.com。 下一步,确保 Kerberos 能功过防火墙并启动/启用相关服务。 **重要**:客户端也必须启动和启用 nfs-secure: ``` # firewall-cmd --permanent --add-service=kerberos # systemctl start krb5kdc kadmin nfs-secure # systemctl enable krb5kdc kadmin nfs-secure ``` 现在创建 Kerberos 数据库(请注意这可能会需要一点时间,因为它会和你的系统进行多次交互)。为了加速这个过程,我打开了另一个终端并运行了 `ping -f localhost` 30 到 45 秒): ``` # kdb5_util create -s ``` ![创建 Kerberos 数据库](/data/attachment/album/201511/17/133906kky7dpmvvbbopzb7.png) *创建 Kerberos 数据库* 下一步,使用 kadmin.local 工具为 root 创建管理权限: ``` # kadmin.local # addprinc root/admin ``` 添加 Kerberos 服务器到数据库: ``` # addprinc -randkey host/box2.mydomain.com ``` 在客户端(box1)和服务器(box2)上对 NFS 服务同样操作。请注意下面的截图中在退出前我忘了在 box1 上进行操作: ``` # addprinc -randkey nfs/box2.mydomain.com # addprinc -randkey nfs/box1.mydomain.com ``` 输入 quit 和回车键退出: ![添加 Kerberos 到 NFS 服务器](/data/attachment/album/201511/17/133907ftbi4zib2ha45z5r.png) *添加 Kerberos 到 NFS 服务器* 为 root/admin 获取和缓存<ruby> 票据授权票据 <rp> ( </rp> <rt> ticket-granting ticket </rt> <rp> ) </rp></ruby>: ``` # kinit root/admin # klist ``` ![缓存 Kerberos](/data/attachment/album/201511/17/133909gngoug2k0uyy27jg.png) *缓存 Kerberos* 真正使用 Kerberos 之前的最后一步是保存被授权使用 Kerberos 身份验证的规则到一个密钥表文件(在服务器中): ``` # kdadmin.local # ktadd host/box2.mydomain.com # ktadd nfs/box2.mydomain.com # ktadd nfs/box1.mydomain.com ``` 最后,挂载共享目录并进行一个写测试: ``` # mount -t nfs4 -o sec=krb5 box2:/nfs /mnt # echo "Hello from Tecmint.com" > /mnt/greeting.txt ``` ![挂载 NFS 共享](/data/attachment/album/201511/17/133909k17nngefyg7yqspg.png) *挂载 NFS 共享* 现在让我们卸载共享,在客户端中重命名密钥表文件(模拟它不存在)然后试着再次挂载共享目录: ``` # umount /mnt # mv /etc/krb5.keytab /etc/krb5.keytab.orig ``` ![挂载/卸载 Kerberos NFS 共享](/data/attachment/album/201511/17/133911w8o8ptp6jqzj3tpo.png) *挂载/卸载 Kerberos NFS 共享* 现在你可以使用基于 Kerberos 身份验证的 NFS 共享了。 ### 总结 在这篇文章中我们介绍了如何设置带 Kerberos 身份验证的 NFS。和我们在这篇指南中介绍的相比,该主题还有很多相关内容,可以在 [Kerberos 手册](http://web.mit.edu/kerberos/krb5-1.12/doc/admin/admin_commands/) 查看,另外至少可以说 Kerberos 有一点棘手,如果你在测试或实现中遇到了任何问题或需要帮助,别犹豫在下面的评论框中告诉我们吧。 --- via: <http://www.tecmint.com/setting-up-nfs-server-with-kerberos-based-authentication/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,594
一位开发者的 Linux 容器之旅
https://deis.com/blog/2015/developer-journey-linux-containers
2015-11-17T16:31:00
[ "容器", "Deis" ]
/article-6594-1.html
![](/data/attachment/album/201511/17/163121admm2d8mdmssmizz.jpg) 我告诉你一个秘密:DevOps 云计算之类的东西可以把我的程序运行在世界上任何一个地方,这对我来说仍然有一点神秘。但随着时间流逝,我意识到理解大规模的机器增减和应用程序部署的来龙去脉对一个开发者来说是非常重要的知识。这类似于成为一个专业的音乐家,当然你肯定需要知道如何使用你的乐器,但是,如果你不知道一个录音棚是如何工作的,或者如何适应一个交响乐团,那么你在这样的环境中工作会变得非常困难。 在软件开发的世界里,使你的代码进入我们的更大的世界如同把它编写出来一样重要。DevOps 重要,而且是很重要。 因此,为了弥合<ruby> 开发 <rp> ( </rp> <rt> Dev </rt> <rp> ) </rp></ruby>和<ruby> 部署 <rp> ( </rp> <rt> Ops </rt> <rp> ) </rp></ruby>之间的空隙,我会从头开始介绍容器技术。为什么是容器?因为有强力的证据表明,容器是机器抽象的下一步:使计算机成为场所而不再是一个东西。理解容器是我们共同的旅程。 在这篇文章中,我会介绍<ruby> 容器化 <rp> ( </rp> <rt> containerization </rt> <rp> ) </rp></ruby>背后的概念。包括容器和虚拟机的区别,以及容器构建背后的逻辑以及它是如何适应应用程序架构的。我会探讨轻量级的 Linux 操作系统是如何适应容器生态系统。我还会讨论使用镜像创建可重用的容器。最后我会介绍容器集群如何使你的应用程序可以快速扩展。 在后面的文章中,我会一步一步向你介绍容器化一个示例应用程序的过程,以及如何为你的应用程序容器创建一个托管集群。同时,我会向你展示如何使用 Deis 将你的示例应用程序部署到你本地系统以及多种云供应商的虚拟机上。 让我们开始吧。 ### 虚拟机的好处 为了理解容器如何适应事物发展,你首先要了解容器的前任:虚拟机。 <ruby> <a href="https://en.wikipedia.org/wiki/Virtual_machine"> 虚拟机 </a> <rp> ( </rp> <rt> virtual machine(VM) </rt> <rp> ) </rp></ruby>是运行在物理宿主机上的软件抽象。配置一个虚拟机就像是购买一台计算机:你需要定义你想要的 CPU 数目、RAM 和磁盘存储容量。配置好了机器后,你为它加载操作系统,以及你想让虚拟机支持的任何服务器或者应用程序。 虚拟机允许你在一台硬件主机上运行多个模拟计算机。这是一个简单的示意图: ![](/data/attachment/album/201511/17/163123u069dqy8rqxb70xq.png) 虚拟机可以让你能充分利用你的硬件资源。你可以购买一台巨大的、轰隆作响的机器,然后在上面运行多个虚拟机。你可以有一个数据库虚拟机以及很多运行相同版本的定制应用程序的虚拟机所构成的集群。你可以在有限的硬件资源获得很多的扩展能力。如果你觉得你需要更多的虚拟机而且你的宿主硬件还有容量,你可以添加任何你需要的虚拟机。或者,如果你不再需要一个虚拟机,你可以关闭该虚拟机并删除虚拟机镜像。 ### 虚拟机的局限 但是,虚拟机确实有局限。 如上面所示,假如你在一个主机上创建了三个虚拟机。主机有 12 个 CPU,48 GB 内存和 3TB 的存储空间。每个虚拟机配置为有 4 个 CPU,16 GB 内存和 1TB 存储空间。到现在为止,一切都还好。主机有这个容量。 但这里有个缺陷。所有分配给一个虚拟机的资源,无论是什么,都是专有的。每台机器都分配了 16 GB 的内存。但是,如果第一个虚拟机永不会使用超过 1GB 分配的内存,剩余的 15 GB 就会被浪费在那里。如果第三个虚拟机只使用分配的 1TB 存储空间中的 100GB,其余的 900GB 就成为浪费空间。 这里没有资源的流动。每台虚拟机拥有分配给它的所有资源。因此,在某种方式上我们又回到了虚拟机之前,把大部分金钱花费在未使用的资源上。 虚拟机还有*另一个*缺陷。让它们跑起来需要很长时间。如果你处于基础设施需要快速增长的情形,即使增加虚拟机是自动的,你仍然会发现你的很多时间都浪费在等待机器上线。 ### 来到:容器 概念上来说,容器是一个 Linux 进程,Linux 认为它只是一个运行中的进程。该进程只知道它被告知的东西。另外,在容器化方面,该容器进程也分配了它自己的 IP 地址。这点很重要,重要的事情讲三遍,这是第二遍。**在容器化方面,容器进程有它自己的 IP 地址。**一旦给予了一个 IP 地址,该进程就是宿主网络中可识别的资源。然后,你可以在容器管理器上运行命令,使容器 IP 映射到主机中能访问公网的 IP 地址。建立了该映射,无论出于什么意图和目的,容器就是网络上一个可访问的独立机器,从概念上类似于虚拟机。 这是第三遍,容器是拥有不同 IP 地址从而使其成为网络上可识别的独立 Linux 进程。下面是一个示意图: ![](/data/attachment/album/201511/17/163124ws3kgoeuownwgnw8.png) 容器/进程以动态、合作的方式共享主机上的资源。如果容器只需要 1GB 内存,它就只会使用 1GB。如果它需要 4GB,就会使用 4GB。CPU 和存储空间利用也是如此。CPU、内存和存储空间的分配是动态的,和典型虚拟机的静态方式不同。所有这些资源的共享都由容器管理器来管理。 最后,容器能非常快速地启动。 因此,容器的好处是:**你获得了虚拟机独立和封装的好处,而抛弃了静态资源专有的缺陷**。另外,由于容器能快速加载到内存,在扩展到多个容器时你能获得更好的性能。 ### 容器托管、配置和管理 托管容器的计算机运行着被剥离的只剩下主要部分的某个 Linux 版本。现在,宿主计算机流行的底层操作系统是之前提到的 [CoreOS](https://coreos.com/using-coreos/)。当然还有其它,例如 [Red Hat Atomic Host](http://www.projectatomic.io/) 和 [Ubuntu Snappy](https://developer.ubuntu.com/en/snappy/)。 该 Linux 操作系统被所有容器所共享,减少了容器足迹的重复和冗余。每个容器只包括该容器特有的部分。下面是一个示意图: ![](/data/attachment/album/201511/17/163128imddsxrrbsg7lus4.png) 你可以用它所需的组件来配置容器。一个容器组件被称为<ruby> 层 <rp> ( </rp> <rt> layer </rt> <rp> ) </rp></ruby>。层是一个容器镜像,(你会在后面的部分看到更多关于容器镜像的介绍)。你从一个基本层开始,这通常是你想在容器中使用的操作系统。(容器管理器只提供你所要的操作系统在宿主操作系统中不存在的部分。)当你构建你的容器配置时,你需要添加层,例如你想要添加网络服务器时这个层就是 Apache,如果容器要运行脚本,则需要添加 PHP 或 Python 运行时环境。 分层非常灵活。如果应用程序或者服务容器需要 PHP 5.2 版本,你相应地配置该容器即可。如果你有另一个应用程序或者服务需要 PHP 5.6 版本,没问题,你可以使用 PHP 5.6 配置该容器。不像虚拟机,更改一个版本的运行时依赖时你需要经过大量的配置和安装过程;对于容器你只需要在容器配置文件中重新定义层。 所有上面描述的容器的各种功能都由一个称为<ruby> 容器管理器 <rp> ( </rp> <rt> container manager </rt> <rp> ) </rp></ruby>的软件控制。现在,最流行的容器管理器是 [Docker](https://www.docker.com/) 和 [Rocket](https://coreos.com/blog/rocket/)。上面的示意图展示了容器管理器是 Docker,宿主操作系统是 CentOS 的主机情景。 ### 容器由镜像构成 当你需要将我们的应用程序构建到容器时,你就要编译镜像。镜像代表了你的容器需要完成其工作的容器模板。(容器里可以在容器里面,如下图)。镜像存储在<ruby> 注册库 <rp> ( </rp> <rt> registry </rt> <rp> ) </rp></ruby>中,注册库通过网络访问。 从概念上讲,注册库类似于一个使用 Java 的人眼中的 [Maven](https://en.wikipedia.org/wiki/Apache_Maven) 仓库、使用 .NET 的人眼中的 [NuGet](https://www.nuget.org/) 服务器。你会创建一个列出了你应用程序所需镜像的容器配置文件。然后你使用容器管理器创建一个包括了你的应用程序代码以及从容器注册库中下载的部分资源。例如,如果你的应用程序包括了一些 PHP 文件,你的容器配置文件会声明你会从注册库中获取 PHP 运行时环境。另外,你还要使用容器配置文件声明需要复制到容器文件系统中的 .php 文件。容器管理器会封装你应用程序的所有东西为一个独立容器,该容器将会在容器管理器的管理下运行在宿主计算机上。 这是一个容器创建背后概念的示意图: ![](/data/attachment/album/201511/17/163130wo0cago8xdxz08md.png) 让我们仔细看看这个示意图。 (1)代表一个定义了你容器所需东西以及你容器如何构建的容器配置文件。当你在主机上运行容器时,容器管理器会读取该配置文件,从云上的注册库中获取你需要的容器镜像,(2)将镜像作为层添加到你的容器中。 另外,如果组成镜像需要其它镜像,容器管理器也会获取这些镜像并把它们作为层添加进来。(3)容器管理器会将需要的文件复制到容器中。 如果你使用了<ruby> 配置 <rp> ( </rp> <rt> provisioning </rt> <rp> ) </rp></ruby>服务,例如 [Deis](http://deis.com/learn),你刚刚创建的应用程序容器做成镜像,(4)配置服务会将它部署到你选择的云供应商上,比如类似 AWS 和 Rackspace 云供应商。 ### 集群中的容器 好了。这里有一个很好的例子说明了容器比虚拟机提供了更好的配置灵活性和资源利用率。但是,这并不是全部。 容器真正的灵活是在集群中。记住,每个容器有一个独立的 IP 地址。因此,能把它放到负载均衡器后面。将容器放到负载均衡器后面,这就上升了一个层面。 你可以在一个负载均衡容器后运行容器集群以获得更高的性能和高可用计算。这是一个例子: ![](/data/attachment/album/201511/17/163131r17c16mk6hhkmbyq.png) 假如你开发了一个资源密集型的应用程序,例如图片处理。使用类似 [Deis](http://deis.com/learn) 的容器配置技术,你可以创建一个包括了你图片处理程序以及你图片处理程序需要的所有资源的容器镜像。然后,你可以部署一个或多个容器镜像到主机上的负载均衡器下。一旦创建了容器镜像,你可以随时使用它。当系统繁忙时可以添加更多的容器实例来满足手中的工作。 这里还有更多好消息。每次添加实例到环境中时,你不需要手动配置负载均衡器以便接受你的容器镜像。你可以使用服务发现技术让容器告知均衡器它可用。然后,一旦获知,均衡器就会将流量分发到新的结点。 ### 全部放在一起 容器技术完善了虚拟机缺失的部分。类似 CoreOS、RHEL Atomic、和 Ubuntu 的 Snappy 宿主操作系统,和类似 Docker 和 Rocket 的容器管理技术结合起来,使得容器变得日益流行。 尽管容器变得更加越来越普遍,掌握它们还是需要一段时间。但是,一旦你懂得了它们的窍门,你可以使用类似 [Deis](http://deis.com/learn) 这样的配置技术使容器创建和部署变得更加简单。 从概念上理解容器和进一步实际使用它们完成工作一样重要。但我认为不实际动手把想法付诸实践,概念也难以理解。因此,我们该系列的下一阶段就是:创建一些容器。 --- via: <https://deis.com/blog/2015/developer-journey-linux-containers> 作者:[Bob Reselman](https://deis.com/blog) 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPSConnectionPool(host='deis.com', port=443): Max retries exceeded with url: /blog/2015/developer-journey-linux-containers (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Hostname mismatch, certificate is not valid for 'deis.com'. (_ssl.c:1007)")))
null
6,599
在 Linux 下安装复古终端
http://itsfoss.com/cool-retro-term/
2015-11-18T15:01:00
[ "终端" ]
https://linux.cn/article-6599-1.html
![Retro Terminal in Linux](/data/attachment/album/201511/18/150218h6zi9ii2i50k0k9k.jpg) 你有怀旧情节?那就试试 **安装复古终端应用** [cool-retro-term](https://github.com/Swordfish90/cool-retro-term) 来一瞥过去的时光吧。顾名思义,`cool-retro-term` 是一个兼具酷炫和怀旧的终端。 你还记得那段遍地都是 CRT 显示器、终端屏幕闪烁不停的时光吗?现在你并不需要穿越到过去来见证那段时光。假如你观看背景设置在上世纪 90 年代的电影,你就可以看到大量带有绿色或黑底白字的显像管显示器。这种极客光环让它们看起来非常酷! 若你已经厌倦了你机器中终端的外表,正寻找某些炫酷且‘新奇’的东西,则 `cool-retro-term` 将会带给你一个复古的终端外表,使你可以重温过去。你也可以改变它的颜色、动画类型并添加一些额外的特效。 下面是不同外观下 `cool-retro-term` 的一些截图: ![Retro Terminal](/data/attachment/album/201511/18/150224uywndz244di4gf4p.jpg) ![Retro Terminal Linux](/data/attachment/album/201511/18/150235d1cqt8htftxeutws.jpg) ![Vintage Terminal](/data/attachment/album/201511/18/150240eoeiriretqicjaej.jpg) ### 在基于 Ubuntu 的 Linux 发行版本下安装 cool-retro-term 如果想在基于 Ubuntu 的 Linux 发行版本下安装 cool-retro-term,例如 Linux Mint,elementary OS, Linux Lite 等,可以使用下面的 PPA: ``` sudo add-apt-repository ppa:noobslab/apps sudo apt-get update sudo apt-get install cool-retro-term ``` ### 在基于 Arch 的 Linux 发行版本下安装 cool-retro-term 若你想在诸如 [Antergos](http://itsfoss.com/tag/antergos/) 和 [Manjaro](https://manjaro.github.io/) 等基于 Arch 的 Linux 发行版本下安装 cool-retro-term ,则可以使用下面的命令: ``` sudo pacman -S cool-retro-term ``` ### 从源代码安装 cool-retro-term 如果你想从源代码安装这个应用,那么首先你需要安装一些依赖。在基于 Ubuntu 的发行版本中,已知的依赖有: ``` sudo apt-get install git build-essential qmlscene qt5-qmake qt5-default qtdeclarative5-dev qtdeclarative5-controls-plugin qtdeclarative5-qtquick2-plugin libqt5qml-graphicaleffects qtdeclarative5-dialogs-plugin qtdeclarative5-localstorage-plugin qtdeclarative5-window-plugin ``` 对于其他发行版本,已知的依赖可以在 [cool-retro-term 的 github 页面](https://github.com/Swordfish90/cool-retro-term) 中找到。 现在使用下面的命令来编译这个程序吧: ``` git clone https://github.com/Swordfish90/cool-retro-term.git cd cool-retro-term qmake && make ``` 一旦程序编译成功,你就可以使用下面的命令来运行它了: ``` ./cool-retro-term ``` 假如你想把这个应用放在程序菜单中以便快速找到,这样你就不用再每次手动地用命令来启动它,则你可以使用下面的命令: ``` sudo cp cool-retro-term.desktop /usr/share/applications ``` 在这里你可以学到更多的终端技巧。在 Linux 中享受这个复古的终端吧 :) 稿件来自: [Abhishek Prakash](http://itsfoss.com/author/abhishek/) --- via: <http://itsfoss.com/cool-retro-term/> 作者:[Abhishek Prakash](http://itsfoss.com/author/abhishek/) 译者:[FSSlc](https://github.com/FSSlc) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,617
在 Linux 命令行下使用 Mop 监视股票价格
https://www.maketecheasier.com/monitor-stock-prices-ubuntu-command-line/
2015-11-21T10:55:00
[ "股票" ]
https://linux.cn/article-6617-1.html
![](/data/attachment/album/201511/20/225639ozw2app34cphg22a.jpg) 有一份隐性收入通常很不错,特别是当你可以轻松的协调业余和全职工作。如果你的日常工作使用了联网的电脑,交易股票就是一个获取额外收入的很流行的选项。 但是目前只有很少的股票监视软件可以运行在 linux 上,其中大多数还是基于图形界面的。如果你是一个 Linux 专家,并且大量的工作时间是在没有图形界面的电脑上呢?你是不是就没办法了?不,还是有一些命令行下的股票追踪工具,包括Mop,也就是本文要聊一聊的工具。 ### Mop Mop,如上所述,是一个命令行下连续显示和更新美股和独立股票信息的工具。使用 GO 语言实现的,是 Michael Dvorkin 的智慧结晶。 ### 下载安装 因为这个项目使用 GO 实现的,所以你要做的第一步是在你的计算机上安装这种编程语言,下面就是在 Debian 系的系统,比如 Ubuntu 上安装 GO 的步骤: ``` sudo apt-get install golang mkdir ~/workspace echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc source ~/.bashrc ``` GO 安装好后的下一步是安装 Mop 工具和配置环境,你要做的是运行下面的命令: ``` sudo apt-get install git go get github.com/michaeldv/mop cd $GOPATH/src/github.com/michaeldv/mop make install export PATH="$PATH:$GOPATH/bin" ``` 完成之后就可以运行下面的命令执行 Mop: ``` cmd ``` ### 特性 当你第一次运行 Mop 时,你会看到类似下面的输出信息: ![](/data/attachment/album/201511/20/225641q99im99ma0w9mrmf.jpg) 如你所见,这些输出信息—— 周期性自动刷新 ——包含了主要几个交易所和个股的信息。 ### 添加删除股票 Mop 允许你轻松的从输出列表上添加/删除个股信息。要添加,你全部要做的是按“+”和输入股票名称。举个例子,下图就是添加 Facebook (FB) 到列表里。 ![](/data/attachment/album/201511/20/225643lukfeu4yen82nn8z.png) 我按下了“+”键,就出现了包含文本“Add tickers:”的一列,提示我添加股票名称—— 我添加了 FB 然后按下回车。输出列表更新了,我添加的新股票也出现在列表了: ![](/data/attachment/album/201511/20/225644bj3rqfns93n9wre1.png) 类似的,你可以使用“-”键和提供股票名称删除一个股票。 #### 根据价格分组 还有一个把股票分组的办法:依据他们的股价升跌,你所要做的就是按下“g”键。接下来,股票会分组显示:升的在一起使用绿色字体显示,而下跌的股票会黑色字体显示。 如下所示: ![](/data/attachment/album/201511/20/225645a2uaemnhdrthue2l.png) #### 列排序 Mop 同时也允许你根据不同的列类型改变排序规则。这种用法需要你按下“o”(这个命令默认使用第一列的值来排序),然后使用左右键来选择你要排序的列。完成之后按下回车对内容重新排序。 举个例子,下面的截图就是根据输出内容的第一列、按照字母表排序之后的结果。 ![](/data/attachment/album/201511/20/225645xzokt5bce1yv78o8.png) **注意**: 为了更好的理解,和前面的截屏对比一下。 #### 其他选项 其它的可用选项包括“p”:暂停市场和股票信息更新,“q”或者“esc” 来退出命令行程序,“?”显示帮助页。 ![](/data/attachment/album/201511/20/225646itvwsvs67crs4rtr.png) ### 结论 Mop 是一个基础的股票监控工具,并没有提供太多的特性,只提供了它所声称的功能。很明显,这个工具并不是为专业股票交易者提供的,而仅仅为你在只有命令行的机器上得体的提供了一个跟踪股票信息的选择。 --- via: <https://www.maketecheasier.com/monitor-stock-prices-ubuntu-command-line/> 作者:[Himanshu Arora](https://www.maketecheasier.com/author/himanshu/) 译者:[oska874](https://github.com/oska874) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Having a side income is always good, especially when you can easily manage the work along with your full time job. If your regular work involves working on an Internet-connected computer, trading stocks is a popular option to earn a few extra bucks. While there are quite a few stock-monitoring applications available for Linux, most of them are GUI-based. What if you’re a Linux professional who spends a lot (or all) of your time working on machines that do not have any GUI installed? Are you out of luck? Well, no, there are some command line stock-tracking tools, including Mop, which we’ll be discussing in this article. ## Mop Mop, as already mentioned in the introduction above, is a command line tool that displays continuous and updated information about the US stock markets and individual stocks. Implemented in the GO programming language, [the project](https://github.com/michaeldv/mop) is the brain child of Michael Dvorkin. ## Download and Install Since the project is implemented in GO, before installing the tool, you’ll first have to make sure that the programming language is installed on your machine. Following are the steps required to install GO on a Debian-based system like Ubuntu: sudo apt-get install golang mkdir ~/workspace echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc source ~/.bashrc Once GO is installed, the next step is to install the Mop tool and set the environment, something which you can do by running the following commands: sudo apt-get install git go get github.com/michaeldv/mop cd $GOPATH/src/github.com/michaeldv/mop make install export PATH="$PATH:$GOPATH/bin" Once done, just run the following command to execute Mop: cmd ## Features When you run the Mop command for the first time, you’ll see an output similar to the following. As you can see in the image above, the output – which auto-refreshes frequently – contains information related to various popular stock exchanges around the world as well as individual stocks. ## Add/remove stocks Mop allows you to easily add/remove individual stocks to and from the output list. To add a stock, all you have to do is to press “+” and mention the stock listing name when prompted. For example, the following screenshot was taken while adding Facebook (FB) to the list. As I pressed the “+” key, a row containing text “Add tickers:” appeared, prompting me to add the stock listing name – I added FB for Facebook and pressed Enter. The output refreshed, and the new stock was added to the list: Similarly, you can delete a stock listing by pressing “-” and mentioning its name. ### Group stocks based on value There is a way to group stocks based on whether their value is going up or down – all you have to do is to press the “g” key. Following this, the stocks which are advancing will be grouped together and shown in green, while those whose value is going down will be represented in black. Here is an example screenshot. ### Column sort Mop also allows you to change the sort order of individual columns. For this you first need to press “o” (this will select the first column by default), and then use the left and right arrow keys to select the column you want to sort. Once done, press enter to sort the column contents. For example, the following screenshot shows the output after the contents of the first column were sorted in descending alphabetical order. **Note**: to better understand, compare it with the previous screenshot. ### Other options Other available options include “p” for pausing market data and stock updates, “q” or “esc” for quitting the command line application, and “?” for displaying the help page. ## Conclusion Mop is a basic stock monitoring tool that doesn’t offer a plethora of features, but does what it promises. It’s quite obvious that the tool is not for stock trading professionals but is still a decent choice if all you want to do is some basic stock tracking on a command line-only machine. Our latest tutorials delivered straight to your inbox
6,618
Nautilus 的文件搜索将迎来巨大提升
http://www.omgubuntu.co.uk/2015/10/new-nautilus-search-filter-ui
2015-11-22T09:18:00
[ "Nautilus" ]
https://linux.cn/article-6618-1.html
![](/data/attachment/album/201511/20/231943wz6hmrm36nqwvvov.jpg) *在Nautilus中搜索零散文件和文件夹将会将会变得相当简单。* [GNOME文件管理器](https://wiki.gnome.org/Apps/Nautilus)中正在开发一个新的**搜索过滤器**。它大量使用 GNOME 漂亮的弹出式菜单,以通过简单的方法来缩小搜索结果并精确地找到你所需要的。 开发者Georges Stavracas正致力于开发新的UI,他[说](http://feaneron.com/2015/10/12/the-new-search-for-gnome-files-aka-nautilus/)这个新的界面“更干净、更合理、更直观”。 根据他[上传到Youtube](https://www.youtube.com/watch?v=X2sPRXDzmUw)的视频来展示的新方式-他还没有嵌入它-他没有错。 > > 他在他的博客中写到:“ Nautilus 有非常复杂但是强大的内部组成,它允许我们做很多事情。事实上在代码上存在各种可能。那么,为何它曾经看上去这么糟糕?” > > > 这个问题的部分原因比较令人吃惊:新的搜索过滤器界面向用户展示了“强大的内部组成”。搜索结果可以根据类型、名字或者日期范围来进行过滤。 对于像 Nautilus 这类 app 的任何修改有可能让一些用户不安,因此像这样帮助性的、直接的新UI会带来一些争议。 虽然对于不满的担心貌似会影响进度(毫无疑问,虽然像[移除类型优先搜索](http://www.omgubuntu.co.uk/2014/01/ubuntu-14-04-nautilus-type-ahead-patch)的争议自2014年以来一直在争论)。GNOME 3.18 在[上个月发布了](http://www.omgubuntu.co.uk/2015/09/gnome-3-18-release-new-features),给 Nautilus 引入了新的文件进度对话框,以及远程共享的更好整合,包括 Google Drive。 Stavracas 的搜索过滤器还没被合并进 Files 的 trunk 中,但是复刻的搜索 UI 已经初步计划在明年春天的 GNOME 3.20 中实现。 --- via: <http://www.omgubuntu.co.uk/2015/10/new-nautilus-search-filter-ui> 作者:[Joey-Elijah Sneddon](https://plus.google.com/117485690627814051450/?rel=author) 译者:[geekpi](https://github.com/geekpi) 校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,619
Nmap 7 发布
https://nmap.org/7/
2015-11-21T10:26:04
[ "Nmap" ]
https://linux.cn/article-6619-1.html
![](/data/attachment/album/201511/21/101847jkev3vl9mwydysly.jpg) [Nmap](https://nmap.org/) 是一款历史悠久的网络扫描工具,已经有18年的历史了。它由 Gordon Lyon 所设计,可以用来快速探测网络上的计算机主机及其服务。Nmap 会发送特定的数据包给目标主机/网络,然后根据返回的数据结果进行分析,从而探知目标主机是否存活、操作系统类型、网络协议细节、网络服务特性和安全缺陷等。 ![](/data/attachment/album/201511/21/102608euf2yjyfi11r1fh1.png) Nmap 6是在2012年5月发布的,[最新版本](https://nmap.org/7/)历时3年半时间的开发,包含将近3200个代码递交。主要更新如下: ### **1. Nmap Scripting Engine (NSE) 增加了很多功能** Nmap 核心已经稳定,NSE 子系统中增加了越来越多的新功能。相比 Nmap 6 增加了171个新脚本和20个库,比如 [firewall-bypass](https://nmap.org/nsedoc/scripts/firewall-bypass.html)、 [supermicro-ipmi-conf](https://nmap.org/nsedoc/scripts/supermicro-ipmi-conf.html)、 [oracle-brute-stealth](https://nmap.org/nsedoc/scripts/oracle-brute-stealth.html) 和 [ssl-heartbleed](https://nmap.org/nsedoc/scripts/ssl-heartbleed.html) 等。NSE 现在功能更加强大了,脚本可以通过它使用更强力的核心功能,比如主机发现([dns-ip6-arpa-scan](https://nmap.org/nsedoc/scripts/dns-ip6-arpa-scan.html))、版本扫描([ike-version](https://nmap.org/nsedoc/scripts/ike-version.html)、 [snmp-info](https://nmap.org/nsedoc/scripts/snmp-info.html) 等)和 RPC grinding ([rpc-grind](https://nmap.org/nsedoc/scripts/rpc-grind.html))。 ### **2. 成熟的 IPv6 支持** Nmap 6 中的重大提升之一是 IPv6 扫描的改进 ,而在 Nmap 7 中对此支持就更加完善了,包括支持 CIDR 风格的地址范围、空余扫描、并发的反向 DNS 解析、更多的 NSE 脚本支持 IPv6。 ### **3. 基础架构升级** 虽然已经是有18年历史的项目,但是我们并不固步自封地守着残破的基础架构不放。Nmap 项目持续地跟进最新的技术,加强开发过程以服务日益增多的用户。比如说,我们将 nmap.org 网站全部转换到 SSL 上来避免二进制程序被木马感染和减少窥探风险。我们在大部分工作流中使用了 [Git 版本控制系统](https://git-scm.com/),并在 [Github 上建立了官方的 Nmap subversion 版本库镜像](https://github.com/nmap/nmap) ,我们鼓励大家提交代码补丁到 Github 上去。我们也创建了一个 [官方的 bug 跟踪系统](https://github.com/nmap/nmap/issues/),也放在 Github 上。通过这样的跟踪 bug 和接受功能请求的方式降低了缺陷的数量。 ### **4. 扫描更快** 18年来,Nmap 不断刷新了网络同步扫描的速度上限,这个版本也不例外。新的 Nsock 引擎极大提升了在 Windows 和 BSD 系统上的性能,<ruby> 目标重排 <rp> ( </rp> <rt> target reordering </rt> <rp> ) </rp></ruby>防止了多宿主系统上的隐蔽死角,NSE 优化带来了更快的 -sV 扫描。 ### **5. SSL/TLS 扫描解决方案的选择** TLS 及其前身 SSL 是网站安全的基础,所以当类似心脏流血、 POODLE 和 FREAK 这样的大漏洞出现时,Nmap 的应对就是 NSE 漏洞检测脚本。整个重写了的 [ssl-enum-ciphers](https://nmap.org/nsedoc/scripts/ssl-enum-ciphers.html) 脚本可以更快地进行 TLS 部署问题的分析,也优化了版本探测功能,可以更快的检测最新的 TLS 握手的版本。 ### **6. 增强 Ncat** 我们非常兴奋而自豪地宣布:Ncat 在 RedHat/Fedora 系列的发行版中成为了默认提供“netcat” 和“nc”命令的软件包!这是我们大量修正了错误和增强了对 netcat 选项兼容性的结果。另一个让人兴奋的地方是增加了一个嵌入式的 Lua 接口,可以创建简单的跨平台的守护进程和流量的过滤器。 ### **7. 无与伦比的可移植性** Nmap 在跨平台方面做的非常棒,它可以运行在各种高深的、古老的系统上。而我们的二进制程序则对最新的流行操作系统保持紧密更新。Nmap 可以完全运行在从 Windows 10 到 Windows Vista 的操作系统上,根据大家的需求,我们甚至在 Windows XP 上也可以运行——虽然我们建议他们升级系统。 Mac OS X 则支持从 10.8 Mountain Lion 到 10.11 El Capitan。此外,我们更新了 Solaris 和 AIX 的支持。当然,Linux 用户,那就更没的说了。
200
OK
Nmap 7 Released **November 19, 2015**—The Nmap Project is pleased to announce the immediate, free availability of the Nmap Security Scanner version 7.00 from [https://nmap.org/](https://nmap.org/). It is the product of three and a half years of work, nearly 3200 code commits, and more than a dozen point releases since the big [Nmap 6 release](https://nmap.org/6/) in May 2012. Nmap turned 18 years old in September this year and celebrates its birthday with 171 new NSE scripts, expanded IPv6 support, world-class SSL/TLS analysis, and more user-requested features than ever. We recommend that all current users [upgrade](#download). **Contents:** [About Nmap](#about)[Top 7 Improvements in Nmap 7](#7changes)[Press](#press)[Screen Shots](#screenshots)[Detailed Improvements](#changes)[Moving Forward (Future Plans)](#future)[Acknowledgments](#acknowledgments)[Download and updates](#download) ## About Nmap Nmap (“Network Mapper”) is a free and open source ([license](https://nmap.org/data/COPYING)) utility for network discovery and security auditing. Many systems and network administrators also find it useful for network inventory, managing service upgrade schedules, monitoring host or service uptime, and many other tasks. 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. It was designed to rapidly scan large networks, but works fine against single hosts. Nmap runs on all major computer operating systems, and official binary packages are available for Linux, Windows, and Mac OS X. In addition to the classic command-line Nmap executable, the Nmap suite includes an advanced GUI and results viewer ([Zenmap](https://nmap.org/zenmap/)), a flexible data transfer, redirection, and debugging tool ([Ncat](https://nmap.org/ncat/)), a utility for comparing scan results ([Ndiff](https://nmap.org/ndiff/)), and a packet generation and response analysis tool ([Nping](https://nmap.org/nping/)). Nmap was named “Security Product of the Year” by Linux Journal, Info World, LinuxQuestions.Org, and Codetalker Digest. It was even featured in [nineteen movies and TV series](https://nmap.org/movies/), including [The Matrix Reloaded](https://nmap.org/movies/#matrix), [The Bourne Ultimatum](https://nmap.org/movies/#bourne). [Girl with the Dragon Tattoo](https://nmap.org/movies/#gwtdt), [Dredd](https://nmap.org/movies/#dredd), [Elysium](https://nmap.org/movies/#elysium), and [Die Hard 4](https://nmap.org/movies/#diehard4). Nmap was released to the public in 1997 and has earned the trust of millions of users. As free software, we don't have any sort of advertising budget. So please spread the word that Nmap 7 is now available! ## Top 7 Improvements in Nmap 7 Before we get into the [detailed changes](#changes), here are the top 7 improvements in Nmap 7: **1. Major Nmap Scripting Engine (NSE) Expansion**As the Nmap core has matured, more and more new functionality is developed as part of our NSE subsystem instead. In fact, we've added 171 new scripts and 20 libraries since Nmap 6. Examples include [firewall-bypass](https://nmap.org/nsedoc/scripts/firewall-bypass.html),[supermicro-ipmi-conf](https://nmap.org/nsedoc/scripts/supermicro-ipmi-conf.html),[oracle-brute-stealth](https://nmap.org/nsedoc/scripts/oracle-brute-stealth.html), and[ssl-heartbleed](https://nmap.org/nsedoc/scripts/ssl-heartbleed.html). And NSE is now powerful enough that scripts can take on core functions such as host discovery ([dns-ip6-arpa-scan](https://nmap.org/nsedoc/scripts/dns-ip6-arpa-scan.html)), version scanning ([ike-version](https://nmap.org/nsedoc/scripts/ike-version.html),[snmp-info](https://nmap.org/nsedoc/scripts/snmp-info.html), etc.), and RPC grinding ([rpc-grind](https://nmap.org/nsedoc/scripts/rpc-grind.html)). There's even a proposal to[implement port scanning in NSE](https://secwiki.org/w/GSoC_community_ideas#Exploring_port_scanning_from_within_NSE). [[More Details](#changes-nse)]**2. Mature IPv6 support**IPv6 scanning improvements were a big item in the Nmap 6 release, but Nmap 7 outdoes them all with full IPv6 support for CIDR-style address ranges, Idle Scan, parallel reverse-DNS, and more NSE script coverage. [ [More Details](#changes-ipv6)]**3. Infrastructure Upgrades**We may be an 18-year-old project, but that doesn't mean we'll stick with old, crumbling infrastructure! The Nmap Project continues to adopt the latest technologies to enhance the development process and serve a growing user base. For example, we converted all of Nmap.Org to SSL to reduce the risk of trojan binaries and reduce snooping in general. We've also been using the [Git version control system](https://git-scm.com/)as a larger part of our workflow and have an official[Github mirror of the Nmap Subversion source repository](https://github.com/nmap/nmap)and we encourage code submissions to be made as Github pull requests. We also created an[official bug tracker](https://github.com/nmap/nmap/issues/)which is also hosted on Github. Tracking bugs and enhancement requests this way has already reduced the number which fall through the cracks. [[More Details](#changes-infrastructure)]**4. Faster Scans**Nmap has continually pushed the speed boundaries of synchronous network scanning for 18 years, and this release is no exception. New Nsock engines give a performance boost to Windows and BSD systems, target reordering prevents a nasty edge case on multihomed systems, and NSE tweaks lead to much faster -sV scans. [ [More Details](#changes-performance)]**5. SSL/TLS scanning solution of choice**Transport Layer Security (TLS) and its predecessor, SSL, are the security underpinning of the web, so when big vulnerabilities like Heartbleed, POODLE, and FREAK come calling, Nmap answers with vulnerability detection NSE scripts. The [ssl-enum-ciphers](https://nmap.org/nsedoc/scripts/ssl-enum-ciphers.html)script has been entirely revamped to perform fast analysis of TLS deployment problems, and version scanning probes have been tweaked to quickly detect the newest TLS handshake versions. [[More Details](#changes-ssl)]**6. Ncat Enhanced**We are excited and proud to announce that Ncat has been adopted by the Red Hat/Fedora family of distributions as the default package to provide the "netcat" and "nc" commands! This cooperation has resulted in a lot of squashed bugs and enhanced compatibility with Netcat's options. Also very exciting is the addition of an embedded Lua interpreter for creating simple, cross-platform daemons and traffic filters. **7. Extreme Portability**Nmap is proudly cross-platform and runs on all sorts of esoteric and archaic systems. But our binary distributions have to be kept up-to-date with the latest popular operating systems. Nmap 7 runs cleanly on Windows 10 all the way back to Windows Vista. By popular request, we even built it to run on Windows XP, though we suggest those users upgrade their systems. Mac OS X is supported from 10.8 Mountain Lion through 10.11 El Capitan. Plus, we updated support for Solaris and AIX. And Linux users—you have it easy. ## Press Please [mail Fyodor](mailto:[email protected]) if you see (or write) reviews/articles on the Nmap 7 release. Here are the ones seen so far: Reasonably detailed (or with many comments) English articles: - Reddit: [Nmap 7 Released!](https://www.reddit.com/r/netsec/comments/3the8j/nmap_7_released/) - Hacker News: [Nmap 7 Release Notes](https://news.ycombinator.com/item?id=10597563) - The Register: [New Wireshark, Nmap releases bring pre-Xmas cheer to infosec types](http://www.theregister.co.uk/2015/11/23/wireshark_20_nmap/) - Softpedia: [After Wireshark 2.0, Nmap 7 Free Network Scanner Is Finally Here](http://linux.softpedia.com/blog/after-wireshark-2-0-nmap-7-free-network-scanner-is-finally-here-496455.shtml) - n0where.net: [Network Exploration with Nmap: Nmap v7 Released.](https://n0where.net/network-exploration-with-nmap/) - SecurityWeek: [Nmap 7 Brings Faster Scans, Other Improvements](http://www.securityweek.com/nmap-7-brings-faster-scans-other-improvements) - SD Times: [Nmap 7 is released](http://sdtimes.com/nmap-7-is-released/) - InfoWorld: [Nmap 7 brings faster scanning and improved IPv6 support](http://www.infoworld.com/article/3007301/network-security/nmap-7-brings-faster-scanning-and-improved-ipv6-support.html) - Help Net Security: [The top 7 improvements in Nmap 7](http://www.net-security.org/secworld.php?id=19142) - eSecurity Planet: [5 Key New Features in Nmap Network Security Tool](http://www.esecurityplanet.com/network-security/5-key-new-features-in-nmap-network-security-tool.html) Brief English mentions: [Linux Weekly News (LWN)](https://lwn.net/Articles/665170/), [SANS Internet Storm Center (ISC)](https://isc.sans.edu/forums/diary/Nmap+700+is+out/20403/). Permission is granted for journalists (or anyone writing about this Nmap release) to use any of the text or screen shots on this page. For quotes, you can email [Fyodor](http://insecure.org/fyodor/) at [[email protected]](mailto:[email protected]). Leave your phone number if you want a callback. ## Screen Shots Nmap 7 provides a wealth of information about remote systems, as shown in this sample scan against a machine we maintain for scan testing purposes ([scanme.nmap.org](http://scanme.nmap.org)). ![Screenshot of OS X terminal window running 'nmap -6 -A scanme.nmap.org'](screenshots/nmap7-scanme-terminal-717x575.png) Here is an example using Zenmap on Windows 8.1 against a couple of production web servers ([Nmap.org](https://nmap.org) and [Reddit](http://reddit.com)). ![Screenshot of Zenmap 7 on Windows 8.1 showing Nmap text output](screenshots/zenmap7-example-785x746.png) Perhaps the most visually appealing aspect of Zenmap is its [network topology mapper](https://nmap.org/book/zenmap-topology.html). Here it is being used to interactively explore the routes between a source machine and a handful of interesting web sites, using the Chinese translation. ![Screenshot of Zenmap 7 in XFCE4 showing the Topology tab in the Chinese language](screenshots/zenmap7-topology-example-796x727.png) ## Detailed Improvements The [Nmap Changelog](https://nmap.org/changelog.html) describes more than 330 significant improvements since our last major release ([6.00](https://nmap.org/6) in May 2012). Here are the highlights: ### NSE Improvements The [Nmap Scripting Engine (NSE)](https://nmap.org/book/nse.html) is one of Nmap's most powerful and flexible features. It allows users to write (and share) simple [Lua](http://www.lua.org/) scripts to automate a wide variety of networking tasks. Those scripts are then executed in parallel with the speed and efficiency you expect from Nmap. The low learning curve and powerful networking libraries of NSE make it ideal for rapid development of security scanning and service probing scripts. Script count has jumped from 348 to 515 scripts! That is 171 new scripts, minus four deletions. Of these, 109 will run by default when you use -sC, and another 35 will run with -sV for version detection. The list of new scripts is so long that we can't even include the summaries here, but each script is linked to it's own page on the [NSE Documentation Portal](https://nmap.org/nsedoc/)for full details:[ajp-auth](https://nmap.org/nsedoc/scripts/ajp-auth.html),[ajp-brute](https://nmap.org/nsedoc/scripts/ajp-brute.html),[ajp-headers](https://nmap.org/nsedoc/scripts/ajp-headers.html),[ajp-methods](https://nmap.org/nsedoc/scripts/ajp-methods.html),[ajp-request](https://nmap.org/nsedoc/scripts/ajp-request.html),[allseeingeye-info](https://nmap.org/nsedoc/scripts/allseeingeye-info.html),[bacnet-info](https://nmap.org/nsedoc/scripts/bacnet-info.html),[bjnp-discover](https://nmap.org/nsedoc/scripts/bjnp-discover.html),[broadcast-ataoe-discover](https://nmap.org/nsedoc/scripts/broadcast-ataoe-discover.html),[broadcast-bjnp-discover](https://nmap.org/nsedoc/scripts/broadcast-bjnp-discover.html),[broadcast-eigrp-discovery](https://nmap.org/nsedoc/scripts/broadcast-eigrp-discovery.html),[broadcast-igmp-discovery](https://nmap.org/nsedoc/scripts/broadcast-igmp-discovery.html),[broadcast-pim-discovery](https://nmap.org/nsedoc/scripts/broadcast-pim-discovery.html),[broadcast-sonicwall-discover](https://nmap.org/nsedoc/scripts/broadcast-sonicwall-discover.html),[broadcast-tellstick-discover](https://nmap.org/nsedoc/scripts/broadcast-tellstick-discover.html),[cassandra-brute](https://nmap.org/nsedoc/scripts/cassandra-brute.html),[cassandra-info](https://nmap.org/nsedoc/scripts/cassandra-info.html),[cups-info](https://nmap.org/nsedoc/scripts/cups-info.html),[cups-queue-info](https://nmap.org/nsedoc/scripts/cups-queue-info.html),[dict-info](https://nmap.org/nsedoc/scripts/dict-info.html),[distcc-cve2004-2687](https://nmap.org/nsedoc/scripts/distcc-cve2004-2687.html),[dns-check-zone](https://nmap.org/nsedoc/scripts/dns-check-zone.html),[dns-ip6-arpa-scan](https://nmap.org/nsedoc/scripts/dns-ip6-arpa-scan.html),[dns-nsec3-enum](https://nmap.org/nsedoc/scripts/dns-nsec3-enum.html),[docker-version](https://nmap.org/nsedoc/scripts/docker-version.html),[enip-info](https://nmap.org/nsedoc/scripts/enip-info.html),[eppc-enum-processes](https://nmap.org/nsedoc/scripts/eppc-enum-processes.html),[fcrdns](https://nmap.org/nsedoc/scripts/fcrdns.html),[firewall-bypass](https://nmap.org/nsedoc/scripts/firewall-bypass.html),[flume-master-info](https://nmap.org/nsedoc/scripts/flume-master-info.html),[freelancer-info](https://nmap.org/nsedoc/scripts/freelancer-info.html),[gkrellm-info](https://nmap.org/nsedoc/scripts/gkrellm-info.html),[gpsd-info](https://nmap.org/nsedoc/scripts/gpsd-info.html),[hnap-info](https://nmap.org/nsedoc/scripts/hnap-info.html),[hostmap-ip2hosts](https://nmap.org/nsedoc/scripts/hostmap-ip2hosts.html),[hostmap-robtex](https://nmap.org/nsedoc/scripts/hostmap-robtex.html),[http-adobe-coldfusion-apsa1301](https://nmap.org/nsedoc/scripts/http-adobe-coldfusion-apsa1301.html),[http-avaya-ipoffice-users](https://nmap.org/nsedoc/scripts/http-avaya-ipoffice-users.html),[http-cisco-anyconnect](https://nmap.org/nsedoc/scripts/http-cisco-anyconnect.html),[http-coldfusion-subzero](https://nmap.org/nsedoc/scripts/http-coldfusion-subzero.html),[http-comments-displayer](https://nmap.org/nsedoc/scripts/http-comments-displayer.html),[http-cross-domain-policy](https://nmap.org/nsedoc/scripts/http-cross-domain-policy.html),[http-csrf](https://nmap.org/nsedoc/scripts/http-csrf.html),[http-devframework](https://nmap.org/nsedoc/scripts/http-devframework.html),[http-dlink-backdoor](https://nmap.org/nsedoc/scripts/http-dlink-backdoor.html),[http-dombased-xss](https://nmap.org/nsedoc/scripts/http-dombased-xss.html),[http-drupal-enum](https://nmap.org/nsedoc/scripts/http-drupal-enum.html),[http-drupal-enum-users](https://nmap.org/nsedoc/scripts/http-drupal-enum-users.html),[http-errors](https://nmap.org/nsedoc/scripts/http-errors.html),[http-exif-spider](https://nmap.org/nsedoc/scripts/http-exif-spider.html),[http-feed](https://nmap.org/nsedoc/scripts/http-feed.html),[http-fetch](https://nmap.org/nsedoc/scripts/http-fetch.html),[http-fileupload-exploiter](https://nmap.org/nsedoc/scripts/http-fileupload-exploiter.html),[http-form-fuzzer](https://nmap.org/nsedoc/scripts/http-form-fuzzer.html),[http-frontpage-login](https://nmap.org/nsedoc/scripts/http-frontpage-login.html),[http-git](https://nmap.org/nsedoc/scripts/http-git.html),[http-gitweb-projects-enum](https://nmap.org/nsedoc/scripts/http-gitweb-projects-enum.html),[http-huawei-hg5xx-vuln](https://nmap.org/nsedoc/scripts/http-huawei-hg5xx-vuln.html),[http-icloud-findmyiphone](https://nmap.org/nsedoc/scripts/http-icloud-findmyiphone.html),[http-icloud-sendmsg](https://nmap.org/nsedoc/scripts/http-icloud-sendmsg.html),[http-iis-short-name-brute](https://nmap.org/nsedoc/scripts/http-iis-short-name-brute.html),[http-ls](https://nmap.org/nsedoc/scripts/http-ls.html),[http-mobileversion-checker](https://nmap.org/nsedoc/scripts/http-mobileversion-checker.html),[http-ntlm-info](https://nmap.org/nsedoc/scripts/http-ntlm-info.html),[http-phpmyadmin-dir-traversal](https://nmap.org/nsedoc/scripts/http-phpmyadmin-dir-traversal.html),[http-phpself-xss](https://nmap.org/nsedoc/scripts/http-phpself-xss.html),[http-referer-checker](https://nmap.org/nsedoc/scripts/http-referer-checker.html),[http-rfi-spider](https://nmap.org/nsedoc/scripts/http-rfi-spider.html),[http-robtex-shared-ns](https://nmap.org/nsedoc/scripts/http-robtex-shared-ns.html),[http-server-header](https://nmap.org/nsedoc/scripts/http-server-header.html),[http-shellshock](https://nmap.org/nsedoc/scripts/http-shellshock.html),[http-sitemap-generator](https://nmap.org/nsedoc/scripts/http-sitemap-generator.html),[http-slowloris-check](https://nmap.org/nsedoc/scripts/http-slowloris-check.html),[http-slowloris](https://nmap.org/nsedoc/scripts/http-slowloris.html),[http-stored-xss](https://nmap.org/nsedoc/scripts/http-stored-xss.html),[http-svn-enum](https://nmap.org/nsedoc/scripts/http-svn-enum.html),[http-svn-info](https://nmap.org/nsedoc/scripts/http-svn-info.html),[http-tplink-dir-traversal](https://nmap.org/nsedoc/scripts/http-tplink-dir-traversal.html),[http-traceroute](https://nmap.org/nsedoc/scripts/http-traceroute.html),[http-useragent-tester](https://nmap.org/nsedoc/scripts/http-useragent-tester.html),[http-virustotal](https://nmap.org/nsedoc/scripts/http-virustotal.html),[http-vlcstreamer-ls](https://nmap.org/nsedoc/scripts/http-vlcstreamer-ls.html),[http-vuln-cve2006-3392](https://nmap.org/nsedoc/scripts/http-vuln-cve2006-3392.html),[http-vuln-cve2010-0738](https://nmap.org/nsedoc/scripts/http-vuln-cve2010-0738.html),[http-vuln-cve2013-0156](https://nmap.org/nsedoc/scripts/http-vuln-cve2013-0156.html),[http-vuln-cve2013-7091](https://nmap.org/nsedoc/scripts/http-vuln-cve2013-7091.html),[http-vuln-cve2014-2126](https://nmap.org/nsedoc/scripts/http-vuln-cve2014-2126.html),[http-vuln-cve2014-2127](https://nmap.org/nsedoc/scripts/http-vuln-cve2014-2127.html),[http-vuln-cve2014-2128](https://nmap.org/nsedoc/scripts/http-vuln-cve2014-2128.html),[http-vuln-cve2014-2129](https://nmap.org/nsedoc/scripts/http-vuln-cve2014-2129.html),[http-vuln-cve2014-8877](https://nmap.org/nsedoc/scripts/http-vuln-cve2014-8877.html),[http-vuln-cve2015-1427](https://nmap.org/nsedoc/scripts/http-vuln-cve2015-1427.html),[http-vuln-cve2015-1635](https://nmap.org/nsedoc/scripts/http-vuln-cve2015-1635.html),[http-vuln-misfortune-cookie](https://nmap.org/nsedoc/scripts/http-vuln-misfortune-cookie.html),[http-vuln-wnr1000-creds](https://nmap.org/nsedoc/scripts/http-vuln-wnr1000-creds.html),[http-waf-fingerprint](https://nmap.org/nsedoc/scripts/http-waf-fingerprint.html),[http-webdav-scan](https://nmap.org/nsedoc/scripts/http-webdav-scan.html),[http-wordpress-users](https://nmap.org/nsedoc/scripts/http-wordpress-users.html),[http-xssed](https://nmap.org/nsedoc/scripts/http-xssed.html),[icap-info](https://nmap.org/nsedoc/scripts/icap-info.html),[ike-version](https://nmap.org/nsedoc/scripts/ike-version.html),[ip-forwarding](https://nmap.org/nsedoc/scripts/ip-forwarding.html),[ip-https-discover](https://nmap.org/nsedoc/scripts/ip-https-discover.html),[ipv6-ra-flood](https://nmap.org/nsedoc/scripts/ipv6-ra-flood.html),[irc-sasl-brute](https://nmap.org/nsedoc/scripts/irc-sasl-brute.html),[isns-info](https://nmap.org/nsedoc/scripts/isns-info.html),[jdwp-exec](https://nmap.org/nsedoc/scripts/jdwp-exec.html),[jdwp-info](https://nmap.org/nsedoc/scripts/jdwp-info.html),[jdwp-inject](https://nmap.org/nsedoc/scripts/jdwp-inject.html),[knx-gateway-discover](https://nmap.org/nsedoc/scripts/knx-gateway-discover.html),[knx-gateway-info](https://nmap.org/nsedoc/scripts/knx-gateway-info.html),[llmnr-resolve](https://nmap.org/nsedoc/scripts/llmnr-resolve.html),[mcafee-epo-agent](https://nmap.org/nsedoc/scripts/mcafee-epo-agent.html),[metasploit-info](https://nmap.org/nsedoc/scripts/metasploit-info.html),[metasploit-msgrpc-brute](https://nmap.org/nsedoc/scripts/metasploit-msgrpc-brute.html),[mikrotik-routeros-brute](https://nmap.org/nsedoc/scripts/mikrotik-routeros-brute.html),[mmouse-brute](https://nmap.org/nsedoc/scripts/mmouse-brute.html),[mmouse-exec](https://nmap.org/nsedoc/scripts/mmouse-exec.html),[mrinfo](https://nmap.org/nsedoc/scripts/mrinfo.html),[msrpc-enum](https://nmap.org/nsedoc/scripts/msrpc-enum.html),[ms-sql-dac](https://nmap.org/nsedoc/scripts/ms-sql-dac.html),[mtrace](https://nmap.org/nsedoc/scripts/mtrace.html),[murmur-version](https://nmap.org/nsedoc/scripts/murmur-version.html),[mysql-dump-hashes](https://nmap.org/nsedoc/scripts/mysql-dump-hashes.html),[mysql-enum](https://nmap.org/nsedoc/scripts/mysql-enum.html),[mysql-query](https://nmap.org/nsedoc/scripts/mysql-query.html),[mysql-vuln-cve2012-2122](https://nmap.org/nsedoc/scripts/mysql-vuln-cve2012-2122.html),[nje-node-brute](https://nmap.org/nsedoc/scripts/nje-node-brute.html),[omron-info](https://nmap.org/nsedoc/scripts/omron-info.html),[oracle-brute-stealth](https://nmap.org/nsedoc/scripts/oracle-brute-stealth.html),[pcanywhere-brute](https://nmap.org/nsedoc/scripts/pcanywhere-brute.html),[qconn-exec](https://nmap.org/nsedoc/scripts/qconn-exec.html),[quake1-info](https://nmap.org/nsedoc/scripts/quake1-info.html),[rdp-enum-encryption](https://nmap.org/nsedoc/scripts/rdp-enum-encryption.html),[rfc868-time](https://nmap.org/nsedoc/scripts/rfc868-time.html),[rmi-vuln-classloader](https://nmap.org/nsedoc/scripts/rmi-vuln-classloader.html),[rpc-grind](https://nmap.org/nsedoc/scripts/rpc-grind.html),[s7-info](https://nmap.org/nsedoc/scripts/s7-info.html),[sip-call-spoof](https://nmap.org/nsedoc/scripts/sip-call-spoof.html),[sip-methods](https://nmap.org/nsedoc/scripts/sip-methods.html),[smb-ls](https://nmap.org/nsedoc/scripts/smb-ls.html),[smb-print-text](https://nmap.org/nsedoc/scripts/smb-print-text.html),[smb-vuln-conficker](https://nmap.org/nsedoc/scripts/smb-vuln-conficker.html),[smb-vuln-cve2009-3103](https://nmap.org/nsedoc/scripts/smb-vuln-cve2009-3103.html),[smb-vuln-ms06-025](https://nmap.org/nsedoc/scripts/smb-vuln-ms06-025.html),[smb-vuln-ms07-029](https://nmap.org/nsedoc/scripts/smb-vuln-ms07-029.html),[smb-vuln-ms08-067](https://nmap.org/nsedoc/scripts/smb-vuln-ms08-067.html),[smb-vuln-ms10-054](https://nmap.org/nsedoc/scripts/smb-vuln-ms10-054.html),[smb-vuln-ms10-061](https://nmap.org/nsedoc/scripts/smb-vuln-ms10-061.html),[smb-vuln-regsvc-dos](https://nmap.org/nsedoc/scripts/smb-vuln-regsvc-dos.html),[snmp-hh3c-logins](https://nmap.org/nsedoc/scripts/snmp-hh3c-logins.html),[snmp-info](https://nmap.org/nsedoc/scripts/snmp-info.html),[ssl-ccs-injection](https://nmap.org/nsedoc/scripts/ssl-ccs-injection.html),[ssl-date](https://nmap.org/nsedoc/scripts/ssl-date.html),[ssl-dh-params](https://nmap.org/nsedoc/scripts/ssl-dh-params.html),[ssl-heartbleed](https://nmap.org/nsedoc/scripts/ssl-heartbleed.html),[ssl-poodle](https://nmap.org/nsedoc/scripts/ssl-poodle.html),[sstp-discover](https://nmap.org/nsedoc/scripts/sstp-discover.html),[supermicro-ipmi-conf](https://nmap.org/nsedoc/scripts/supermicro-ipmi-conf.html),[targets-ipv6-map4to6](https://nmap.org/nsedoc/scripts/targets-ipv6-map4to6.html),[targets-ipv6-wordlist](https://nmap.org/nsedoc/scripts/targets-ipv6-wordlist.html),[targets-xml](https://nmap.org/nsedoc/scripts/targets-xml.html),[teamspeak2-version](https://nmap.org/nsedoc/scripts/teamspeak2-version.html),[tls-nextprotoneg](https://nmap.org/nsedoc/scripts/tls-nextprotoneg.html),[tor-consensus-checker](https://nmap.org/nsedoc/scripts/tor-consensus-checker.html),[traceroute-geolocation](https://nmap.org/nsedoc/scripts/traceroute-geolocation.html),[unittest](https://nmap.org/nsedoc/scripts/unittest.html),[ventrilo-info](https://nmap.org/nsedoc/scripts/ventrilo-info.html),[weblogic-t3-info](https://nmap.org/nsedoc/scripts/weblogic-t3-info.html),[whois-domain](https://nmap.org/nsedoc/scripts/whois-domain.html),[xmlrpc-methods](https://nmap.org/nsedoc/scripts/xmlrpc-methods.html)NSE became the tool of choice for rapid vulnerability scanning with the advent of celebrity vulnerabilities in 2014. NSE scripts have you covered for Heartbleed ( [ssl-heartbleed](https://nmap.org/nsedoc/scripts/ssl-heartbleed.html)), Shellshock ([http-shellshock](https://nmap.org/nsedoc/scripts/http-shellshock.html)), POODLE ([ssl-poodle](https://nmap.org/nsedoc/scripts/ssl-poodle.html)), Misfortune Cookie ([http-vuln-misfortune-cookie](https://nmap.org/nsedoc/scripts/http-vuln-misfortune-cookie.html)), LOGJAM ([ssl-dh-params](https://nmap.org/nsedoc/scripts/ssl-dh-params.html)), Stuxnet ([smb-vuln-ms10-061](https://nmap.org/nsedoc/scripts/smb-vuln-ms10-061.html)), and even Slowloris ([http-slowloris-check](https://nmap.org/nsedoc/scripts/http-slowloris-check.html)). Of course if you're also worried about less-celebrated vulnerabilities, the other 41 new["vuln"-category](https://nmap.org/nsedoc/categories/vuln.html)scripts should keep you busy.NSE joins the rest of Nmap in being able to output parseable XML. Instead of just a text blob in [Nmap's XML output](https://nmap.org/book/output-formats-xml-output.html), scripts can now return[structured information](https://nmap.org/book/nse-api.html#nse-structured-output)that can be quickly extracted with an XML parser. All new scripts produce structured output, most older scripts have been converted, and any script using the[vulns library](https://nmap.org/nsedoc/lib/vulns.html)is automatically upgraded.The venerable RPC grinder which used to run with -sV is now an NSE script: [rpc-grind](https://nmap.org/nsedoc/scripts/rpc-grind.html). This allowed us to cull a bunch of old C code in favor of more maintainable Lua, as well as make a noticeable improvement in scanning speed, all while using a fifth of the number of code lines.HTTP and web scanning continued to dominate our NSE development. Over a third (57) of our new scripts were HTTP-related. Exceptionally exciting is the addition of NTLM authentication to the http library, which means [http-brute](https://nmap.org/nsedoc/scripts/http-brute.html)can bruteforce Windows passwords, too. Script highlights include:[http-slowloris](https://nmap.org/nsedoc/scripts/http-slowloris.html)exploits a resource exhaustion denial-of-service in Apache and similar webservers, based on the 6-year-old Slowloris attack script from RSnake.[http-fetch](https://nmap.org/nsedoc/scripts/http-fetch.html)acts a bit like a multi-target curl or wget, fetching the files you specify from every discovered webserver.[http-server-header](https://nmap.org/nsedoc/scripts/http-server-header.html)grabs the Server header from webservers and uses it to fill in service version information if -sV failed to find a match.[http-webdav-scan](https://nmap.org/nsedoc/scripts/http-webdav-scan.html)detects WebDAV servers and grabs a directory listing.- [http-cross-domain-policy](https://nmap.org/nsedoc/scripts/http-cross-domain-policy.html),[http-csrf](https://nmap.org/nsedoc/scripts/http-csrf.html),[http-dombased-xss](https://nmap.org/nsedoc/scripts/http-dombased-xss.html),[http-phpself-xss](https://nmap.org/nsedoc/scripts/http-phpself-xss.html), and[http-stored-xss](https://nmap.org/nsedoc/scripts/http-stored-xss.html)check for various generic Web vulnerabilities. Similarly,[http-errors](https://nmap.org/nsedoc/scripts/http-errors.html)checks for server-side bugs resulting in HTTP error codes. Oops, there was a vulnerability in one of our NSE scripts. If you ran the (fortunately non-default) [http-domino-enum-passwords](https://nmap.org/nsedoc/scripts/http-domino-enum-passwords.html)script with the (fortunately also non-default) domino-enum-passwords.idpath parameter against a malicious server, it could cause an arbitrarily named file to to be written to the client system. Thanks to Trustwave researcher Piotr Duszynski for discovering and reporting the problem. We've fixed that script, and also updated several other scripts to use a new stdnse.filename_escape function for extra safety. This broke our record of never having a vulnerability in the 16 years that Nmap has existed, but that's still a fairly good run!NSE libraries allow scripts to share code. In addition to the usual set of protocol helpers, some interesting additions include the LPeg parsing expression grammar library, a "ls" library for formatting directory listings, the "slaxml" XML parser, a pure-Lua Unicode library, and a unittest library currently used by 6 other libraries. [anyconnect](https://nmap.org/nsedoc/lib/anyconnect.html),[base32](https://nmap.org/nsedoc/lib/base32.html),[bjnp](https://nmap.org/nsedoc/lib/bjnp.html),[cassandra](https://nmap.org/nsedoc/lib/cassandra.html),[eigrp](https://nmap.org/nsedoc/lib/eigrp.html),[formulas](https://nmap.org/nsedoc/lib/formulas.html),[ike](https://nmap.org/nsedoc/lib/ike.html),[isns](https://nmap.org/nsedoc/lib/isns.html),[jdwp](https://nmap.org/nsedoc/lib/jdwp.html),[lfs](https://nmap.org/nsedoc/lib/lfs.html),[lpeg](https://nmap.org/nsedoc/lib/lpeg.html),[lpeg-utility](https://nmap.org/nsedoc/lib/lpeg-utility.html),[ls](https://nmap.org/nsedoc/lib/ls.html),[ospf](https://nmap.org/nsedoc/lib/ospf.html),[rdp](https://nmap.org/nsedoc/lib/rdp.html),[re](https://nmap.org/nsedoc/lib/re.html),[slaxml](https://nmap.org/nsedoc/lib/slaxml.html),[tls](https://nmap.org/nsedoc/lib/tls.html),[unicode](https://nmap.org/nsedoc/lib/unicode.html),[unittest](https://nmap.org/nsedoc/lib/unittest.html) ### Mature IPv6 Support It came as no surprise when ARIN ran out of IPv4 addresses this year, and Nmap was already riding the wave to full IPv6 deployment. Nmap has supported IPv6 in some way since 2002, but improvements keep coming: **Idle scan**is now supported with IPv6. IPv6 packets don't usually come with fragment identifiers like IPv4 packets do, so new techniques had to be developed to make idle scan possible. The implementation is by Mathias Morbitzer, who made it the subject of his master's thesis.Unicast **CIDR-style IPv6 range scanning**is now supported, so you can specify targets such as "en.wikipedia.org/120". Obviously it will take ages if you specify a huge space. For example, a /64 contains 18,446,744,073,709,551,616 addresses.In addition to ensuring IPv6 support in the majority of **NSE scripts**, Nmap 7 adds several IPv6-specific scripts for advanced host discovery and even denial-of-service:[dns-ip6-arpa-scan](https://nmap.org/nsedoc/scripts/dns-ip6-arpa-scan.html)performs a quick reverse-DNS lookup of an IPv6 network using a technique which analyzes DNS server response codes to dramatically reduce the number of queries needed to enumerate large networks.[targets-ipv6-wordlist](https://nmap.org/nsedoc/scripts/targets-ipv6-wordlist.html)preys on the tendency of human network operators to use the enormous IPv6 address space and the hexadecimal alphabet to assign addresses that form words like "dead:beef". The wordlist is configurable, and the results are surprising![targets-ipv6-map4to6](https://nmap.org/nsedoc/scripts/targets-ipv6-map4to6.html)similarly searches for manually configured addresses that correspond to a smaller range of IPv4 addresses that may be assigned to the same network.[ipv6-ra-flood](https://nmap.org/nsedoc/scripts/ipv6-ra-flood.html)generates a flood of Router Advertisements (RA) with random source MAC addresses and IPv6 prefixes. Computers, which have stateless autoconfiguration enabled by default (every major OS), will start to compute IPv6 suffix and update their routing table to reflect the accepted announcement. This will cause 100% CPU usage on Windows and platforms, preventing to process other application requests. Nmap's **parallel reverse-DNS resolver**now handles IPv6 addresses. GSoC 2015 student Gioacchino Mazzurco rewrote the old C-style DNS code in beautiful C++ and a test suite, then fuzzed the living daylights out of it with[afl](http://lcamtuf.coredump.cx/afl/). In addition to being very safe, this should result in faster -6 scans.**IPv6 OS fingerprinting**is improved, thanks to the efforts of Mathias Morbitzer and Alexandru Geana. Building on Mathias's research into new IPv6 OS fingerprinting methods, Alexandru spent the spring and summer of 2015 testing and adding features to our machine learning OS classifier. Using IPv6 guessed initial Hop Limit (analogous to IPv4's TTL) and the ratio of TCP initial window size to Maximum Segment Size (MSS), the classifier now matches with more confidence than ever. He also completed an extension of the classifier's training process to impute missing values from dropped or filtered packets, which lets Nmap make better guesses when network conditions are poor.Nmap's **advanced traceroute**is no longer limited to just using ICMP and TCP for tracing IPv6 hosts. The IPv6 --traceroute option is now equivalent to the IPv4 version and capable of using UDP, SCTP, and IPProto (Next Header) probes. ### SSL/TLS scanning *par excellence* SSL 3 deprecation, SHA-1 certificate deprecation, Heartbleed, CCS injection, POODLE, LOGJAM, FREAK, and RC4 deprecation—Secure Sockets Layer (SSL) and its successor, Transport Layer Security (TLS), have received a lot of attention in the past few years for security problems, and Nmap has emerged as the gold standard scanning tool for these issues. One of our most popular NSE scripts is [ssl-enum-ciphers](https://nmap.org/nsedoc/scripts/ssl-enum-ciphers.html), which enumerates SSL/TLS protocol versions (SSL 3 deprecation!) and ciphersuites (RC4 deprecation and weak export ciphers!). It has been enhanced beyond the old behavior of simply reporting "weak" or "strong" for each ciphersuite—it now scores each handshake using guidance from Qualys SSL Labs and taking into account server certificate strength, Diffie-Hellman parameter size, and encryption bit strength. It can safely scan the most finicky of SSL servers, safely negotiating long handshake intolerance issues and fragmented TLS messages. And it can run independently of version scan, since it is now capable of detecting TLS on unusual ports on its own.Detection of SSL and TLS by -sV [has been boosted](http://seclists.org/nmap-dev/2015/q2/17)by including more popular TLS ports in the default lists and adding a new TLS-only service probe. Also, NSE scripts can now do TLS checks against LDAP, IMAP, and POP3 services which support STARTTLS (FTP, SMTP, and XMPP were already supported).At the core of our TLS NSE scripts is the new [tls](https://nmap.org/nsedoc/lib/tls.html)library, which enables quick development of robust scripts for checking vulnerabilities ([ssl-heartbleed](https://nmap.org/nsedoc/scripts/ssl-heartbleed.html),[ssl-poodle](https://nmap.org/nsedoc/scripts/ssl-poodle.html),[ssl-ccs-injection](https://nmap.org/nsedoc/scripts/ssl-ccs-injection.html),[ssl-dh-params](https://nmap.org/nsedoc/scripts/ssl-dh-params.html)) or reporting configurations ([tls-nextprotoneg](https://nmap.org/nsedoc/scripts/tls-nextprotoneg.html),[ssl-date](https://nmap.org/nsedoc/scripts/ssl-date.html)). ### Zenmap graphical front-end and results viewer [Zenmap](https://nmap.org/zenmap/) is our cross-platform (Linux, Windows, Mac OS X, etc.) Nmap GUI and results viewer. It aims to provide advanced features for experienced Nmap users while also making Nmap easier for beginners to use. Frequently used scans can be saved as profiles to make them easy to run repeatedly. A command creator allows interactive creation of Nmap command lines. Scan results can be saved and viewed later, or even compared with one another to see how they differ. Our [network topology viewer](https://nmap.org/book/zenmap-topology.html) allows for interactive exploration of a network scanned with Nmap. Zenmap is now a mature tool, but it still got several enhancements since 6.00: Zenmap features a [full translation capability](https://nmap.org/book/zenmap-lang.html)for all menus, labels, buttons, and messages. Translations are available for 11 languages, including new Italian, Japanese, Polish, Chinese, and Hindi translations. The German and French translations were also updated.Support for large scans has drastically improved. We solved a CPU usage bug in opening large files and prevented the most common cause of out-of-memory problems by dropping the scrolling output window if it becomes a problem. Don't worry! The output is still saved to disk. Additionally, scans which have a lot of anonymous (unresponsive) traceroute hops will take up less space on the Topology page, since Zenmap will now assume hops at the same distance are the same device. Zenmap's display can filter hosts based on OS, ports, hostnames, and other criteria. Since 6.00 we also added negative matching, so you can exclude Windows systems for example with "os:!windows". Another sign of a maturing codebase, we've enabled unittest discovery in Zenmap, so running "make check" will run most of the existing Zenmap tests. Watch for more improvements in this area in upcoming versions! ### Ncat [Ncat](https://nmap.org/ncat/) is a feature-packed networking utility which reads and writes data across networks from the command line. Ncat was written for the Nmap Project as a much-improved reimplementation of the venerable [Netcat](http://sectools.org/tool/netcat/). It uses both TCP and UDP for communication and is designed to be a reliable back-end tool to instantly provide network connectivity to other applications and users. Ncat will not only work with IPv4 and IPv6 but provides the user with a virtually limitless number of potential uses. We are excited and proud to announce that Ncat has been adopted by the Red Hat/Fedora family of distributions as the default package to provide the "netcat" and "nc" commands! This cooperation has resulted in a lot of squashed bugs and enhanced compatibility with Netcat's options. Some of the most exciting changes in Ncat 7 are: Ncat now features an embedded Lua interpreter! Similar to the Nmap Scripting Engine, the "--lua-exec" option makes it easy to write simple traffic filters and daemons in easy-to-learn [Lua](http://www.lua.org/). A collection of example scripts, including a simple HTTP server, is included with the Ncat source.Ncat now supports Unix domain sockets (named pipes) on systems where those sockets are available. This is another Netcat compatibility enhancement, and it makes testing of Unix local services possible with Ncat. Ncat's proxy support was extended to support SOCKS5 with authentication. More compatibility corrections resulted in correct handling of EOF on all sockets, whether running as a client or as a server. The new --no-shutdown option keeps Ncat up and receiving network input after stdin is closed, just like traditional netcat's -d option. ### Infrastructure Improvements Keeping the Nmap project vibrant and productive (for developers and users) requires constant investment in our development. Improvements to Nmap's development and support infrastructure since Nmap 6 include: The [Nmap.org](https://nmap.org/)web site is now 100% HTTPS. This gives our users much-needed protection when downloading Nmap source and binary releases or submitting new service and OS fingerprints. Also, the GNU Mailman subscription pages for the[Nmap-Announce](https://nmap.org/mailman/listinfo/announce),[Nmap-Dev](https://nmap.org/mailman/listinfo/dev), and[Full Disclosure](https://nmap.org/mailman/listinfo/fulldisclosure)mailing lists are hosted on Nmap.org and HTTPS-protected, so your subscription settings are safe, too.The Nmap Project has fully embraced [Github Issues](https://github.com/nmap/nmap/issues/)as its bug tracking solution. The Nmap-Dev mailing list is still going strong for discussion of Nmap development issues, but for user-submitted bug reports and enhancement requests, Github is the place to be. We also encourage code submissions to be made as Github pull requests. Even though the Github repo is still a read-only mirror of our authoritative[Subversion repository](https://nmap.org/book/install.html#inst-svn), Github offers a great code review and discussion interface, as well as integrated code-quality-checking tools. As a convenience,[issues.nmap.org](http://issues.nmap.org)is a redirector for issue numbers:[http://issues.nmap.org/229](http://issues.nmap.org/229)for example.On the subject of code quality, Nmap now integrates with Travis CI for continuous integration testing. If the build breaks, Nmap developers are notified immediately. Code contributions made as Github pull requests are automatically checked for build breakage, too. This is made possible by a concerted effort to enable "make check" to actually check and test Nmap code. So far, "make check" enables: - Ncat test suite - Nsock test suite - Zenmap auto-discovered unit tests - NSE tests through the [unittest](https://nmap.org/nsedoc/scripts/unittest.html)NSE script - Ndiff tests - Nmap's reverse-DNS engine test suite Nmap's [changelog page](https://nmap.org/changelog.html)is now displayed in linked and cross-referenced HTML, instead of as a simple dump of the CHANGELOG text file. URLs, issue numbers, script names, and NSE library names are all linked to the appropriate pages.[SecWiki.org](https://secwiki.org/)continues to be used by the Nmap development team for documentation and collaboration on long-term projects. Some popular pages are[Nmap Code Standards](https://secwiki.org/w/Nmap/Code_Standards),[Nmap on Android](https://secwiki.org/w/Nmap/Android),[NSE Script Ideas](https://secwiki.org/w/Nmap/Script_Ideas), and the[Nmap FAQ pages](https://secwiki.org/w/Nmap_FAQ). ### IPv4 Operating System Detection Thanks to fingerprint submissions from thousands of Nmap users around the world, our [remote operating system detection system](https://nmap.org/book/osdetect.html) grew from 3572 signatures in Nmap 6 to 4985 now. These include the latest versions of Windows, Linux, and Mac OS X as well as more specialized entries such as PLCs, lightbulbs, televisions, mainframes, and much more. Some of the newest fingerprints are for Apple iOS 9, Android 5.1, OpenBSD 5.7, FreeBSD 11.0, and a ton of new WAPs, switches, printers, and other devices. In addition to more than 1400 new fingerprints, we made several important performance improvements and bug fixes to the system. Most notably, if version detection determines a port to be "tcpwrapped," OS detection will prefer to use a different port for probing, since there's a good chance this is the result of a firewall interfering with TCP connections on that port. ### Version Detection The days when we could assume what was running on an open port based on the port number are long gone. These days, folks commonly run services on the "wrong" port numbers in order to defeat filtering policies, hide traffic, or work around various networking problems. Fortunately, Nmap's [version detection system](https://nmap.org/book/vscan.html) is able to interrogate the service listening on the open port and tell you the service running as well as (in many cases) the application name and version number. Nmap 6 had an impressive 8165 signatures matching 862 protocols, but Nmap 7 improves that to a whopping 10299 signatures for 1091 protocols! Additionally, Nmap 7 has 23 more service probes to pull information from remote services and more than double the number of softmatch lines (103), which help short-circuit the probing process to send the most-likely probes for the detected service. ### Performance Improvements In Nmap's 18-year history, performance has always been a top priority. Whether scanning one target or 20 million, users want scans to run as fast as possible without sacrificing accuracy. Improvements since Nmap 6 include: For scans of targets that use different routes or interfaces, Nmap may now partially rearrange its target list for more efficient host groups. Previously, a single target with a different interface, or with an IP address the same as a that of a target already in the group, would cause the group to be broken off at whatever size it was. Now, we buffer a small number of such targets, and keep looking through the input for more targets to fill out the current group. Timeouts for many NSE scripts were reduced from tens of seconds to use a scaled timeout based on Nmap's portscan-phase timing determinations. A simple library function, [stdnse.get_timeout](https://nmap.org/nsedoc/lib/stdnse.html#get_timeout), makes it easy for new script authors to do the same.Version scan is quicker now because of 56 more softmatch lines that prevent Nmap from sending irrelevant probes to certain services. Also, NSE scripts in the [version category](https://nmap.org/nsedoc/categories/version.html)now obey the version intensity setting, so using an option like --version-light will prevent nearly all of these heavy-duty version probing scripts from running (unless you choose them by name).The old RPC Grinder, which used the original pos_scan engine from 1998, has been replaced by a much faster NSE script implementation. Scan times for version scanning (-sV) ought to improve greatly. New poll and kqueue Nsock engines allow for increased socket performance in Nsock-based scan phases (NSE and version scanning) on Windows, OS X, and BSD-derived systems that previously had to use the old select-based engine. Linux has had an epoll engine since Nmap 6.00. ### Even More Improvements In addition to the pages of changes listed above, we made many improvements which defy simple categorization: The oft-requested **--exclude-ports**option has now been implemented! Easily avoid scanning off-limits or troublesome ports, without constructing complicated port ranges to avoid them. Safely integrates with -p, -F, and --top-ports.Nsock (and by extension Nmap's -sV and NSE) now supports connecting through chained proxies. Nmap adds the **--proxies**option to specify this proxy chain. While port scanning is not yet included, GSoC student and mentor Jacek Wielemborek has done groundbreaking work towards implementing TCP Connect scan in Nsock, so stay tuned!Instead of simply appending random data to Nmap scan packets with --data-length, try sending a message with the **--data-string**or**--data**options. Safely attribute your research or taunt your foes—it's up to you.Though in most cases ARP ping is the stealthiest, fastest, and most reliable host discovery method, you can now force the usual layer-3 discovery probes with the **--disable-arp-ping**option. This is useful in networks using proxy ARP, which make all addresses appear to be up using ARP scan. The previously recommended workaround for this situation, --send-ip, didn't work on Windows it is still missing raw socket support.For raw packet scans (i.e. not -sT), Nmap now reports the TTL of recieved packets in the Normal output if the --reason option is used. This was previously only available in the XML output, but is useful for detecting interfering firewalls in some cases. Additionally, --reason is enabled at verbosity 2 and higher. Fixed a bug which caused Nmap to be unable to have any runtime interaction when called from sudo or from a shell script on Linux. This was especially appreciated on Debian-based systems where Nmap is usually invoked with sudo. The beloved Nmap ASCII Dragon configure art now shares its spot with two other ASCII art pieces. Which one you get when you run ./configure is randomly chosen. Immediately below the art is a summary of what configure options were chosen, including a warning if OpenSSL could not be found and you didn't explicitly disable it. [Nping](https://nmap.org/nping/)now checks for a matching ICMP ID to avoid colliding with other running ping processes. These are all just highlights from the full list of changes you can find in [our CHANGELOG](https://nmap.org/changelog.html). ## Moving Forward (Future Plans) With this stable version out of the way, we are diving headfirst into the next development cycle. Many exciting features are in the queue, including: A modern upgrade to the aging WinPcap is coming! We already have a working replacement called [Npcap](https://github.com/nmap/npcap)developed by GSoC student Yang Luo that is updated to use the NDIS 6 API and LWF. Cooperating with the WinPcap group, we can be sure that these improvements will be available in Nmap very soon.Nmap on mobile devices is already a reality for Android, but we want to expand support to other mobile platforms and perhaps develop a really useful app interface, since console applications tend to be difficult to use on those tiny screens. We are always working on improving performance, and you can expect we will deliver. Nmap's --min-rate option has the potential to scale to Internet-wide scans, and we intend to benchmark and demonstrate this ability. More large-scale scanning research should help us improve the port popularity rankings and fine-tune Nmap's internals for optimum performance. It doesn't take a Nostrodamus to predict that NSE will continue to expand at a blinding pace. We have dozens of NSE scripts waiting in the wings, and pages of ideas for new ones. Maybe your name will grace our CHANGELOG as a script author in the next release! You can read more of our short-term and longer-term plans from our [public TODO list](https://svn.nmap.org/nmap/todo/nmap.txt). For the latest Insecure.Org and Nmap announcements, join the 117,175-member Nmap-announce announcement list. Traffic rarely exceeds one message per month. [Subscribe here](https://nmap.org/mailman/listinfo/announce) or [read the archives at SecLists.Org](http://seclists.org). To participate in Nmap development, join the (high traffic) [nmap-dev list](https://nmap.org/mailman/listinfo/dev). You can also follow us on [Twitter](https://twitter.com/nmap), [Facebook](https://www.facebook.com/nmap), or [Google+](https://plus.google.com/+nmap). ## Acknowledgments A free open source scanner as powerful as Nmap is only possible thanks to the help of hundreds of developers and other contributors. We would like to acknowledge and thank the many people who contributed ideas and/or code since Nmap 6.00. Special thanks go out to: **Adam Saponara**, **Adam Števko**, **Aleksandar Nikolic**, **Alessandro Zanni**, **Alexandru Geana**, **Alexey Meshcheryakov**, **Alex Weber**, **Andreas Stieger**, **Andrew Farabee**, **Andrew Orr**, **Andrew Waters**, **Andrey Olkhin**, **Ange Gutek**, **Arturo Busleiman**, **Bill Parker**, **Brad Johnson**, **Brandon Paulsen**, **Brendan Coles**, **Chris Johnson**, **Chris Leick**, **Claudio Criscione**, **Claudiu Perta**, **Daniel Miller**, **Danila Poyarkov**, **David Fifield**, **David Matousek**, **Dhiru Kholia**, **Didier Stevens**, **Dillon Graham**, **Djalal Harouni**, **Dominik Schneider**, **Edward Napierała**, **Elon Natovich**, **Eric Davisson**, **Forrest B.**, **Fyodor**, **George Chatzisofroniou**, **Gioacchino Mazzurco** **Giovanni Bechis**, **Greg Bailey**, **Gyanendra Mishra**, **Hani Benhabiles**, **hejianet**, **Henri Doreau**, **Jacek Wielemborek**, **Jan Reister**, **Jacob Gajek**, **jah**, **Jay Bosamiya**, **Jesper Kückelhahn**, **Jiayi Ye**, **Joachim Henke**, **John Bond**, **John Spencer**, **Jonathan Daugherty**, **jrchamp**, **Justin Cacak**, **Kurt Grutzmacher**, **Marek Lukaszuk**, **Marek Majkowski**, **Marin Maržić**, **Mariusz Ziulek**, **Mathias Morbitzer**, **Michael McTernan**, **Michael Meyer**, **Michael Schierl**, **Michael Toecker**, **Michael Wallner**, **Michal Hlavinka**, **Nicolle Neulist**, **Niklaus Schiess**, **nnposter**, **Olli Hauer**, **Patrick Donnelly**, **Patrik Karlsson**, **Paul AMAR**, **Paul Hemberger**, **Paulino Calderon**, **Pavel Kankovsky**, **Peter Malecka**, **Petr Stodulka**, **Philip Pickering**, **Pierluigi Vittori**, **Pierre Lalet**, **Piotr Olma**, **Pontus Andersson**, **Quentin Glidic**, **Raphael Hoegger**, **Raúl Fuentes**, **riemann**, **Rob Nicholls**, **Robin Wood**, **Ron Bowes**, **Sean Rivera**, **Simon John**, **Soldier of Fortran**, **Stephen Hilt**, **Tilik Ammon**, **Tom Sellers**, **Tomas Hozza**, **Tyler Wagner**, **Ulrik Haugen**, **Vasily Kulikov**, and **Vlatko Kosturjak**. We would also like to thank the thousands of people who have submitted OS and service/version fingerprints, as well as everyone who has found and reported bugs or suggested features. Special thanks go to Google, who has sponsored 73 students (total over the last 11 years) to spend a summer working on Nmap as part of Google's [Summer of Code program](https://developers.google.com/open-source/gsoc/). This summer, we had a team of five amazing students who contributed mightily to make Nmap even more powerful. We encourage you to [read this year's project summary](http://seclists.org/nmap-announce/2015/4) to learn more. ## Download and Updates Nmap is available for download from [https://nmap.org/download.html](https://nmap.org/download.html) in source and binary form. Nmap is free, open source software ([license](https://nmap.org/data/COPYING)). To learn about Nmap announcements as they happen, subscribe to nmap-announce! It is a very low volume (7 messages so far in 2015), moderated list for announcements about Nmap, Insecure.org, and related projects. You can join the 117,175 current subscribers by submitting your e-mail address below. Nmap-announce is archived at [SecLists.org](http://seclists.org) and has an [RSS feed](http://seclists.org/rss/nmap-announce.rss). To participate in Nmap development, join the (high traffic) [nmap-dev list](https://nmap.org/mailman/listinfo/dev) as well. You are also encouraged to follow [@nmap on Twitter](http://twitter.com/nmap) and check out [our Facebook page](http://facebook.com/nmap): Direct questions or comments to Fyodor ([[email protected]](mailto:[email protected])). Report any bugs as [described here](https://nmap.org/man/man-bugs.html).
6,624
如何在 CentOS 7.0 上配置 Ceph 存储
http://linoxide.com/storage/setup-red-hat-ceph-storage-centos-7-0/
2015-11-22T17:22:36
[ "Ceph", "云存储" ]
/article-6624-1.html
Ceph 是一个将数据存储在单一分布式计算机集群上的开源软件平台。当你计划构建一个云时,你首先需要决定如何实现你的存储。开源的 Ceph 是红帽原生技术之一,它基于称为 RADOS 的对象存储系统,用一组网关 API 表示块、文件、和对象模式中的数据。由于它自身开源的特性,这种便携存储平台能在公有云和私有云上安装和使用。Ceph 集群的拓扑结构是按照备份和信息分布设计的,这种内在设计能提供数据完整性。它的设计目标就是容错、通过正确配置能运行于商业硬件和一些更高级的系统。 Ceph 能在任何 Linux 发行版上安装,但为了能正确运行,它需要最近的内核以及其它最新的库。在这篇指南中,我们会使用最小化安装的 CentOS-7.0。 ![](/data/attachment/album/201511/22/171650gqt6y2brqq8q4ty7.png) ### 系统资源 ``` **CEPH-STORAGE** OS: CentOS Linux 7 (Core) RAM:1 GB CPU:1 CPU DISK: 20 Network: 45.79.136.163 FQDN: ceph-storage.linoxide.com **CEPH-NODE** OS: CentOS Linux 7 (Core) RAM:1 GB CPU:1 CPU DISK: 20 Network: 45.79.171.138 FQDN: ceph-node.linoxide.com ``` ### 安装前的配置 在安装 Ceph 存储之前,我们要在每个节点上完成一些步骤。第一件事情就是确保每个节点的网络已经配置好并且能相互访问。 **配置 Hosts** 要在每个节点上配置 hosts 条目,要像下面这样打开默认的 hosts 配置文件(LCTT 译注:或者做相应的 DNS 解析)。 ``` # vi /etc/hosts ``` --- ``` 45.79.136.163 ceph-storage ceph-storage.linoxide.com 45.79.171.138 ceph-node ceph-node.linoxide.com ``` **安装 VMware 工具** 工作环境是 VMWare 虚拟环境时,推荐你安装它的 open VM 工具。你可以使用下面的命令安装。 ``` # yum install -y open-vm-tools ``` **配置防火墙** 如果你正在使用启用了防火墙的限制性环境,确保在你的 Ceph 存储管理节点和客户端节点中开放了以下的端口。 > > 你必须在你的 Admin Calamari 节点开放 80、2003、以及4505-4506 端口,并且允许通过 80 号端口访问到 Ceph 或 Calamari 管理节点,以便你网络中的客户端能访问 Calamari web 用户界面。 > > > 你可以使用下面的命令在 CentOS 7 中启动并启用防火墙。 ``` # systemctl start firewalld # systemctl enable firewalld ``` 运行以下命令使 Admin Calamari 节点开放上面提到的端口。 ``` # firewall-cmd --zone=public --add-port=80/tcp --permanent # firewall-cmd --zone=public --add-port=2003/tcp --permanent # firewall-cmd --zone=public --add-port=4505-4506/tcp --permanent # firewall-cmd --reload ``` 在 Ceph Monitor 节点,你要在防火墙中允许通过以下端口。 ``` # firewall-cmd --zone=public --add-port=6789/tcp --permanent ``` 然后允许以下默认端口列表,以便能和客户端以及监控节点交互,并发送数据到其它 OSD。 ``` # firewall-cmd --zone=public --add-port=6800-7300/tcp --permanent ``` 如果你工作在非生产环境,建议你停用防火墙以及 SELinux 设置,在我们的测试环境中我们会停用防火墙以及 SELinux。 ``` # systemctl stop firewalld # systemctl disable firewalld ``` **系统升级** 现在升级你的系统并重启使所需更改生效。 ``` # yum update # shutdown -r 0 ``` ### 设置 Ceph 用户 现在我们会新建一个单独的 sudo 用户用于在每个节点安装 ceph-deploy工具,并允许该用户无密码访问每个节点,因为它需要在 Ceph 节点上安装软件和配置文件而不会有输入密码提示。 运行下面的命令在 ceph-storage 主机上新建有独立 home 目录的新用户。 ``` [root@ceph-storage ~]# useradd -d /home/ceph -m ceph [root@ceph-storage ~]# passwd ceph ``` 节点中新建的每个用户都要有 sudo 权限,你可以使用下面展示的命令赋予 sudo 权限。 ``` [root@ceph-storage ~]# echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ceph ceph ALL = (root) NOPASSWD:ALL [root@ceph-storage ~]# sudo chmod 0440 /etc/sudoers.d/ceph ``` ### 设置 SSH 密钥 现在我们会在 Ceph 管理节点生成 ssh 密钥并把密钥复制到每个 Ceph 集群节点。 在 ceph-node 运行下面的命令复制它的 ssh 密钥到 ceph-storage。 ``` [root@ceph-node ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 5b:*:*:*:*:*:*:*:*:*:c9 root@ceph-node The key's randomart image is: +--[ RSA 2048]----+ ``` --- ``` [root@ceph-node ~]# ssh-copy-id ceph@ceph-storage ``` ![SSH key](/data/attachment/album/201511/22/172239jldoo6qay763zoo6.png) ### 配置 PID 数目 要配置 PID 数目的值,我们会使用下面的命令检查默认的内核值。默认情况下,是一个小的最大线程数 32768。 如下图所示通过编辑系统配置文件配置该值为一个更大的数。 ![更改 PID 值](/data/attachment/album/201511/22/172240uda7i37i8ggypv7p.png) ### 配置管理节点服务器 配置并验证了所有网络后,我们现在使用 ceph 用户安装 ceph-deploy。通过打开文件检查 hosts 条目(LCTT 译注:你也可以用 DNS 解析来完成)。 ``` # vim /etc/hosts ceph-storage 45.79.136.163 ceph-node 45.79.171.138 ``` 运行下面的命令添加它的库。 ``` # rpm -Uhv http://ceph.com/rpm-giant/el7/noarch/ceph-release-1-0.el7.noarch.rpm ``` ![添加 Ceph 仓仓库](/data/attachment/album/201511/22/172240c16xjn6bnqhyyq78.png) 或者创建一个新文件并更新 Ceph 库参数,别忘了替换你当前的 Release 和版本号。 ``` [root@ceph-storage ~]# vi /etc/yum.repos.d/ceph.repo ``` --- ``` [ceph-noarch] name=Ceph noarch packages baseurl=http://ceph.com/rpm-{ceph-release}/{distro}/noarch enabled=1 gpgcheck=1 type=rpm-md gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc ``` 之后更新你的系统并安装 ceph-deploy 软件包。 ### 安装 ceph-deploy 软件包 我们运行下面的命令以及 ceph-deploy 安装命令来更新系统以及最新的 ceph 库和其它软件包。 ``` #yum update -y && yum install ceph-deploy -y ``` ### 配置集群 使用下面的命令在 ceph 管理节点上新建一个目录并进入新目录,用于收集所有输出文件和日志。 ``` # mkdir ~/ceph-cluster # cd ~/ceph-cluster ``` --- ``` # ceph-deploy new storage ``` ![设置 ceph 集群](/data/attachment/album/201511/22/172241tchhr2fqtnjl5cnl.png) 如果成功执行了上面的命令,你会看到它新建了配置文件。 现在配置 Ceph 默认的配置文件,用任意编辑器打开它并在会影响你公共网络的 global 参数下面添加以下两行。 ``` # vim ceph.conf osd pool default size = 1 public network = 45.79.0.0/16 ``` ### 安装 Ceph 现在我们准备在和 Ceph 集群关联的每个节点上安装 Ceph。我们使用下面的命令在 ceph-storage 和 ceph-node 上安装 Ceph。 ``` # ceph-deploy install ceph-node ceph-storage ``` ![安装 ceph](/data/attachment/album/201511/22/172241jjgjbjbgbzbvvh5n.png) 处理所有所需仓库和安装所需软件包会需要一些时间。 当两个节点上的 ceph 安装过程都完成后,我们下一步会通过在相同节点上运行以下命令创建监视器并收集密钥。 ``` # ceph-deploy mon create-initial ``` ![Ceph 初始化监视器](/data/attachment/album/201511/22/172242hybyb9duf07afzc9.png) ### 设置 OSD 和 OSD 守护进程 现在我们会设置磁盘存储,首先运行下面的命令列出你所有可用的磁盘。 ``` # ceph-deploy disk list ceph-storage ``` 结果中会列出你存储节点中使用的磁盘,你会用它们来创建 OSD。让我们运行以下命令,请使用你的磁盘名称。 ``` # ceph-deploy disk zap storage:sda # ceph-deploy disk zap storage:sdb ``` 为了最后完成 OSD 配置,运行下面的命令配置日志磁盘以及数据磁盘。 ``` # ceph-deploy osd prepare storage:sdb:/dev/sda # ceph-deploy osd activate storage:/dev/sdb1:/dev/sda1 ``` 你需要在所有节点上运行相同的命令,它会清除你磁盘上的所有东西。之后为了集群能运转起来,我们需要使用以下命令从 ceph 管理节点复制不同的密钥和配置文件到所有相关节点。 ``` # ceph-deploy admin ceph-node ceph-storage ``` ### 测试 Ceph 我们快完成了 Ceph 集群设置,让我们在 ceph 管理节点上运行下面的命令检查正在运行的 ceph 状态。 ``` # ceph status # ceph health HEALTH_OK ``` 如果你在 ceph status 中没有看到任何错误信息,就意味着你成功地在 CentOS 7 上安装了 ceph 存储集群。 ### 总结 在这篇详细的文章中我们学习了如何使用两台安装了 CentOS 7 的虚拟机设置 Ceph 存储集群,这能用于备份或者作为用于其它虚拟机的本地存储。我们希望这篇文章能对你有所帮助。当你试着安装的时候记得分享你的经验。 --- via: <http://linoxide.com/storage/setup-red-hat-ceph-storage-centos-7-0/> 作者:[Kashif Siddique](http://linoxide.com/author/kashifs/) 译者:[ictlyh](http://mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /storage/setup-red-hat-ceph-storage-centos-7-0/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b8327582b30>, 'Connection to linoxide.com timed out. (connect timeout=10)'))
null
6,625
修复 Shell 脚本在 Ubuntu 中的默认打开方式
http://itsfoss.com/shell-script-opens-text-editor/
2015-11-22T17:58:16
[ "shell", "脚本" ]
https://linux.cn/article-6625-1.html
![](/data/attachment/album/201511/22/175818bng2njj12j1nm3g2.jpg) 当你双击一个脚本(.sh文件)的时候,你想要做的是什么?通常的想法是执行它。但是在Ubuntu下面却不是这样,或者我应该更确切地说是在Files(Nautilus)中。你可能会疯狂地大叫“运行文件,运行文件”,但是文件没有运行而是用Gedit打开了。 我知道你也许会说文件有可执行权限么?我会说是的。脚本有可执行权限但是当我双击它的时候,它还是用文本编辑器打开了。我不希望这样,如果你遇到了同样的问题,我想你也许也想要这样。 我知道你或许已经被建议在终端下面执行,我知道这个可行,但是这不是一个在GUI下不能运行的借口是么? 这篇教程中,我们会看到**如何在双击后运行shell脚本。** #### 修复在Ubuntu中shell脚本用文本编辑器打开的方式 shell脚本用文件编辑器打开的原因是Files(Ubuntu中的文件管理器)中的默认行为设置。在更早的版本中,它或许会询问你是否运行文件或者用编辑器打开。默认的行为在新的版本中被修改了。 要修复这个,进入文件管理器,并在菜单中点击**选项**: ![](/data/attachment/album/201511/22/175819v5mj0tk4mmebwnuk.png) 接下来在<ruby> 文件选项 <rp> ( </rp> <rt> Files Preferences </rt> <rp> ) </rp></ruby>中进入<ruby> 行为 <rp> ( </rp> <rt> Behavior </rt> <rp> ) </rp></ruby>标签中,你会看到<ruby> 可执行的文本文件 <rp> ( </rp> <rt> Executable Text Files </rt> <rp> ) </rp></ruby>选项。 默认情况下,它被设置成“<ruby> 在打开时显示文本文件 <rp> ( </rp> <rt> View executable text files when they are opend </rt> <rp> ) </rp></ruby>”。我建议你把它改成“<ruby> 每次询问 <rp> ( </rp> <rt> Ask each time </rt> <rp> ) </rp></ruby>”,这样你可以选择是执行还是编辑了,当然了你也可以选择“<ruby> 在打开时云可执行文本文件 <rp> ( </rp> <rt> Run executable text files when they are opend </rt> <rp> ) </rp></ruby>”。你可以自行选择。 ![](/data/attachment/album/201511/22/175819y0egonhccdg34bpn.png) 我希望这个贴士可以帮你修复这个小“问题”。欢迎提出问题和建议。 --- via: <http://itsfoss.com/shell-script-opens-text-editor/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,627
如何在 Ubuntu 上用 Go For It 管理您的待办清单
https://www.maketecheasier.com/to-do-lists-ubuntu-go-for-it/
2015-11-23T08:30:00
[ "生产力" ]
https://linux.cn/article-6627-1.html
![](/data/attachment/album/201511/22/225913zndscf1h9kd9111y.jpg) 任务管理可以说是工作及日常生活中最重要也最具挑战性的事情之一。当您在工作中承担越来越多的责任时,您的表现将与您管理任务的能力直接挂钩。 若您的工作有部分需要在电脑上完成,那么您一定很乐意知道,有多款应用软件自称可以为您减轻任务管理的负担。即便这些软件中的大多数都是为 Windows 用户服务的,在 Linux 系统中仍然有不少选择。在本文中,我们就来讨论这样一款软件:Go For It. ### Go For It [Go For It](http://manuel-kehl.de/projects/go-for-it/) (GFI) 由 Manuel Kehl 开发,他声称:“这是款简单易用且时尚优雅的生产力软件,以<ruby> 待办清单 <rp> ( </rp> <rt> To-Do List </rt> <rp> ) </rp></ruby>为主打特色,并整合了一个能让你专注于当前事务的定时器。”这款软件的定时器功能尤其有趣,它还可以让您在继续工作之前暂停下来,放松一段时间。 ### 下载并安装 使用基于 Debian 系统(如Ubuntu)的用户可以通过运行以下终端命令轻松地安装这款软件: ``` sudo add-apt-repository ppa:mank319/go-for-it sudo apt-get update sudo apt-get install go-for-it ``` 以上命令执行完毕后,您就可以使用这条命令运行这款应用软件了: ``` go-for-it ``` ### 使用及配置 当你第一次运行 GFI 时,它的界面是长这样的: ![gfi-first-run](/data/attachment/album/201511/22/225914gecamjzqrwg48sh3.png) 可以看到,界面由三个标签页组成,分别是<ruby> 待办 <rp> ( </rp> <rt> To-Do </rt> <rp> ) </rp></ruby>,<ruby> 定时器 <rp> ( </rp> <rt> Timer </rt> <rp> ) </rp></ruby>和<ruby> 完成 <rp> ( </rp> <rt> Done </rt> <rp> ) </rp></ruby>。*待办*页是一个任务列表(上图所示的4个任务是默认生成的——您可以点击头部的方框删除它们),*定时器*页内含有任务定时器,而*完成*页则是已完成任务的列表。底部有个文本框,您可以在此输入任务描述,并点击“+”号将任务添加到上面的列表中。 举个例子,我将一个名为“MTE-research-work”的任务添加到了列表中,并点击选中了它,如下图所示: ![gfi-task-added](/data/attachment/album/201511/22/225914leapgwzo4du97sp4.png) 然后我进入*定时器*页,在这里我可以看到一个为当前“MTE-reaserch-work”任务设定的定时器,定时25分钟。 ![gfi-active-task-timer](/data/attachment/album/201511/22/225914i4suqv4v4zrvo4ov.png) 当然,您可以将定时器设定为你喜欢的任何值。然而我并没有修改,而是直接点击下方的“<ruby> 开始 <rp> ( </rp> <rt> Start </rt> <rp> ) </rp></ruby>”按钮启动定时器。一旦剩余时间为60秒,GFI 就会给出一个提示。 ![gfi-first-notification-new](/data/attachment/album/201511/22/225914t0gmd38tkwdjmgd8.jpg) 一旦时间到,它会提醒我休息5分钟。 ![gfi-time-up-notification-new](/data/attachment/album/201511/22/225915n3vdk6v33dhhvvvq.jpg) 5分钟过后,我可以为我的任务再次开启定时器。 ![gfi-break-time-up-new](/data/attachment/album/201511/22/225915b0cuhhuz8ucm6k6r.jpg) 任务完成以后,您可以点击*定时器*页中的“<ruby> 完成 <rp> ( </rp> <rt> Done </rt> <rp> ) </rp></ruby>”按钮,然后这个任务就会从*待办*页被转移到*完成*页。 ![gfi-task-done](/data/attachment/album/201511/22/225915kgs48tjjqqjb8wns.png) GFI 也能让您稍微调整一些它的设置。例如,下图所示的设置窗口就包含了一些选项,让您修改默认的任务时长,休息时长和提示时刻。 ![gfi-settings](/data/attachment/album/201511/22/225916tn1se3ayj7mya3zg.png) 值得一提的是,GFI 是以 TODO.txt 格式保存待办清单的,这种格式方便了移动设备之间的同步,也让您能使用其他前端程序来编辑任务——更多详情请阅读[这里](http://todotxt.com/)。 您还可以通过[视频]("http://www.youtube.com/mnw556C9FZQ)观看 GFI 的动态展示。 ### 结论 正如您所看到的,GFI 是一款简洁明了且易于使用的任务管理软件。虽然它没有提供非常丰富的功能,但它实现了它的承诺,定时器的整合特别有用。如果您正在寻找一款实现了基础功能,并且开源的 Linux 任务管理软件,Go For It 值得您一试。 --- via: <https://www.maketecheasier.com/to-do-lists-ubuntu-go-for-it/> 作者:[Himanshu Arora](https://www.maketecheasier.com/author/himanshu/) 译者:[Ricky-Gong](https://github.com/Ricky-Gong) 校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
Task management is arguably one of the most important and challenging part of professional as well as personal life. Professionally, as you assume more and more responsibility, your performance is directly related to or affected with your ability to manage the tasks you’re assigned. If your job involves working on a computer, then you’ll be happy to know that there are various applications available that claim to make task management easy for you. While most of them cater to Windows users, there are many options available on Linux, too. In this article we will discuss one such application: Go For It. ## Go For It Go For It (GFI) is developed by Manuel Kehl, who describes it as a “a simple and stylish productivity app, featuring a to-do list, merged with a timer that keeps your focus on the current task.” The timer feature, specifically, is interesting, as it also makes sure that you take a break from your current task and relax for sometime before proceeding further. ## Download and Installation Users of Debian-based systems, like Ubuntu, can easily install the app by running the following commands in terminal: sudo add-apt-repository ppa:mank319/go-for-it sudo apt-get update sudo apt-get install go-for-it Once done, you can execute the application by running the following command: go-for-it ## Usage and Configuration Here is how the GFI interface looks when you run the app for the very first time: As you can see, the interface consists of three tabs: To-Do, Timer, and Done. While the To-Do tab contains a list of tasks (the 4 tasks shown in the image above are there by default – you can delete them by clicking on the rectangular box in front of them), the Timer tab contains task timer, while Done contains a list of tasks that you’ve finished successfully. Right at the bottom is a text box where you can enter the task text and click “+” to add it to the list above. For example, I added a task named “MTE-research-work” to the list and selected it by clicking on it in the list – see the screenshot below: Then I selected the Timer tab. Here I could see a 25-minute timer for the active task which was “MTE-reaserch-work.” Of course, you can change the timer value and set to any time you want. I, however, didn’t change the value and clicked the Start button present below to start the task timer. Once 60 seconds were left, GFI issued a notification indicating the same. And once the time was up, I was asked to take a break of five minutes. Once those five minutes were over, I could again start the task timer for my task. When you’re done with your task, you can click the Done button in the Timer tab. The task is then removed from the To-Do tab and listed in the Done tab. GFI also allows you to tweak some of its settings. For example, the settings window shown below contains options to tweak the default task duration, break duration, and reminder time. It’s worth mentioning that GFI stores the to-do lists in the Todo.txt format which simplifies synchronization with mobile devices and makes it possible for you to edit tasks using other frontends – read more about it [here](https://todotxt.com/). You can also see the GFI app in action in the video below. ![mnw556C9FZQ maxresdefault](https://i.ytimg.com/vi/mnw556C9FZQ/maxresdefault.jpg) ## Conclusion As you have observed, GFI is an easy to understand and simple to use task management application. Although it doesn’t offer a plethora of features, it does what it claims – the timer integration is especially useful. If you’re looking for a basic, open-source task management tool for Linux, Go For It is worth trying. Our latest tutorials delivered straight to your inbox
6,628
N1:下一代开源邮件客户端
http://itsfoss.com/n1-open-source-email-client/
2015-11-24T08:20:00
[ "邮件", "客户端" ]
https://linux.cn/article-6628-1.html
![N1 Open Source email client](/data/attachment/album/201511/22/232152bodvx3nh4atdub7b.png) 当我们谈论到Linux中的邮件客户端,通常 Thunderbird、Geary 和 [Evolution](https://help.gnome.org/users/evolution/stable/) 就会出现在我们的脑海。作为对这些大咖们的挑战,一款新的开源邮件客户端正在涌入市场。 ### 设计和功能 [N1](https://nylas.com/N1/)是一个设计与功能并重的新一代开源邮件客户端。作为一个开源软件,N1目前支持 Linux 和 Mac OS X,Windows的版本还在开发中。 N1宣传它自己为“可扩展的开源邮件客户端”,因为它包含了 Javascript 插件框架,任何人都可以为它创建强大的新功能。可扩展是一个非常流行的功能,它帮助[开源编辑器Atom](http://itsfoss.com/atom-stable-released/)变得流行。N1同样把重点放在了可扩展上面。 除了可扩展性,N1同样着重设计了程序的外观。下面N1的截图就是个很好的例子: ![N1 Open Source email client on Mac OS X](/data/attachment/album/201511/22/232153vv10gu0g7n37vvjn.jpg) *Mac OS X上的N1客户端。图片来自:N1* 除了这个功能,N1兼容上百个邮件服务提供商,包括Gmail、Yahoo、iCloud、Microsoft Exchange等等,这个桌面应用提供了离线功能。 ### 目前只能邀请使用 我不知道为什么每个人都选择了 OnePlus 的‘只能邀请使用’的市场策略。目前,N1桌面端只能被邀请才能下载。你可以用下面的链接请求一个邀请。N1团队会在几天内邮件给你下载链接。 * [请求N1邀请](https://invite.nylas.com/download) ### 感兴趣了么? 我并不是桌面邮件客户端的粉丝,但是 N1 的确引起了我的兴趣,让我想要试一试。你呢? --- via: <http://itsfoss.com/n1-open-source-email-client/> 作者:[Abhishek](http://itsfoss.com/author/abhishek/) 译者:[geekpi](https://github.com/geekpi) 校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,629
如何在 Linux 上从 NetworkManager 切换为 systemd-network
http://xmodulo.com/switch-from-networkmanager-to-systemd-networkd.html
2015-11-23T10:45:00
[ "systemd", "网络" ]
https://linux.cn/article-6629-1.html
在 Linux 世界里,对 [systemd](http://xmodulo.com/use-systemd-system-administration-debian.html) 的采用一直是激烈争论的主题,它的支持者和反对者之间的战火仍然在燃烧。到了今天,大部分主流 Linux 发行版都已经采用了 systemd 作为默认的<ruby> 初始化 <rp> ( </rp> <rt> init </rt> <rp> ) </rp></ruby>系统。 正如其作者所说,作为一个 “从未完成、从未完善、但一直追随技术进步” 的系统,systemd 已经不只是一个初始化进程,它被设计为一个更广泛的系统以及服务管理平台,这个平台是一个包含了不断增长的核心系统进程、库和工具的生态系统。 ![](/data/attachment/album/201511/22/234939mvxpgfanhaftwtbw.jpg) **systemd** 的其中一部分是 **systemd-networkd**,它负责 systemd 生态中的网络配置。使用 systemd-networkd,你可以为网络设备配置基础的 DHCP/静态 IP 网络。它还可以配置虚拟网络功能,例如网桥、隧道和 VLAN。systemd-networkd 目前还不能直接支持无线网络,但你可以使用 wpa\_supplicant 服务配置无线适配器,然后把它和 **systemd-networkd** 联系起来。 在很多 Linux 发行版中,NetworkManager 仍然作为默认的网络配置管理器。和 NetworkManager 相比,**systemd-networkd** 仍处于积极的开发状态,还缺少一些功能。例如,它还不能像 NetworkManager 那样能让你的计算机在任何时候通过多种接口保持连接。它还没有为更高层面的脚本编程提供 ifup/ifdown 钩子函数。但是,systemd-networkd 和其它 systemd 组件(例如用于域名解析的 **resolved**、NTP 的**timesyncd**,用于命名的 udevd)结合的非常好。随着时间增长,**systemd-networkd**只会在 systemd 环境中扮演越来越重要的角色。 如果你对 **systemd-networkd** 的进步感到高兴,从 NetworkManager 切换到 systemd-networkd 是值得你考虑的一件事。如果你强烈反对 systemd,对 NetworkManager 或[基础网络服务](http://xmodulo.com/disable-network-manager-linux.html)感到很满意,那也很好。 但对于那些想尝试 systemd-networkd 的人,可以继续看下去,在这篇指南中学会在 Linux 中怎么从 NetworkManager 切换到 systemd-networkd。 ### 需求 systemd 210 及其更高版本提供了 systemd-networkd。因此诸如 Debian 8 "Jessie" (systemd 215)、 Fedora 21 (systemd 217)、 Ubuntu 15.04 (systemd 219) 或更高版本的 Linux 发行版和 systemd-networkd 兼容。 对于其它发行版,在开始下一步之前先检查一下你的 systemd 版本。 ``` $ systemctl --version ``` ### 从 NetworkManager 切换到 Systemd-networkd 从 NetworkManager 切换到 systemd-networkd 其实非常简答(反过来也一样)。 首先,按照下面这样先停用 NetworkManager 服务,然后启用 systemd-networkd。 ``` $ sudo systemctl disable NetworkManager $ sudo systemctl enable systemd-networkd ``` 你还要启用 **systemd-resolved** 服务,systemd-networkd用它来进行域名解析。该服务还实现了一个缓存式 DNS 服务器。 ``` $ sudo systemctl enable systemd-resolved $ sudo systemctl start systemd-resolved ``` 当启动后,**systemd-resolved** 就会在 /run/systemd 目录下某个地方创建它自己的 resolv.conf。但是,把 DNS 解析信息存放在 /etc/resolv.conf 是更普遍的做法,很多应用程序也会依赖于 /etc/resolv.conf。因此为了兼容性,按照下面的方式创建一个到 /etc/resolv.conf 的符号链接。 ``` $ sudo rm /etc/resolv.conf $ sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf ``` ### 用 systemd-networkd 配置网络连接 要用 systemd-networkd 配置网络服务,你必须指定带.network 扩展名的配置信息文本文件。这些网络配置文件保存到 /etc/systemd/network 并从这里加载。当有多个文件时,systemd-networkd 会按照字母顺序一个个加载并处理。 首先创建 /etc/systemd/network 目录。 ``` $ sudo mkdir /etc/systemd/network ``` #### DHCP 网络 首先来配置 DHCP 网络。对于此,先要创建下面的配置文件。文件名可以任意,但记住文件是按照字母顺序处理的。 ``` $ sudo vi /etc/systemd/network/20-dhcp.network ``` --- ``` [Match] Name=enp3* [Network] DHCP=yes ``` 正如你上面看到的,每个网络配置文件包括了一个或多个 “sections”,每个 “section”都用 [XXX] 开头。每个 section 包括了一个或多个键值对。`[Match]` 部分决定这个配置文件配置哪个(些)网络设备。例如,这个文件匹配所有名称以 ens3 开头的网络设备(例如 enp3s0、 enp3s1、 enp3s2 等等)对于匹配的接口,然后启用 [Network] 部分指定的 DHCP 网络配置。 ### 静态 IP 网络 如果你想给网络设备分配一个静态 IP 地址,那就新建下面的配置文件。 ``` $ sudo vi /etc/systemd/network/10-static-enp3s0.network ``` --- ``` [Match] Name=enp3s0 [Network] Address=192.168.10.50/24 Gateway=192.168.10.1 DNS=8.8.8.8 ``` 正如你猜测的, enp3s0 接口地址会被指定为 192.168.10.50/24,默认网关是 192.168.10.1, DNS 服务器是 8.8.8.8。这里微妙的一点是,接口名 enp3s0 事实上也匹配了之前 DHCP 配置中定义的模式规则。但是,根据词汇顺序,文件 "10-static-enp3s0.network" 在 "20-dhcp.network" 之前被处理,对于 enp3s0 接口静态配置比 DHCP 配置有更高的优先级。 一旦你完成了创建配置文件,重启 systemd-networkd 服务或者重启机器。 ``` $ sudo systemctl restart systemd-networkd ``` 运行以下命令检查服务状态: ``` $ systemctl status systemd-networkd $ systemctl status systemd-resolved ``` ![](/data/attachment/album/201511/22/234954e7a6toyokasovoyh.jpg) ### 用 systemd-networkd 配置虚拟网络设备 **systemd-networkd** 同样允许你配置虚拟网络设备,例如网桥、VLAN、隧道、VXLAN、绑定等。你必须在用 .netdev 作为扩展名的文件中配置这些虚拟设备。 这里我展示了如何配置一个桥接接口。 #### Linux 网桥 如果你想创建一个 Linux 网桥(br0) 并把物理接口(eth1) 添加到网桥,你可以新建下面的配置。 ``` $ sudo vi /etc/systemd/network/bridge-br0.netdev ``` --- ``` [NetDev] Name=br0 Kind=bridge ``` 然后按照下面这样用 .network 文件配置网桥接口 br0 和从接口 eth1。 ``` $ sudo vi /etc/systemd/network/bridge-br0-slave.network ``` --- ``` [Match] Name=eth1 [Network] Bridge=br0 ``` --- ``` $ sudo vi /etc/systemd/network/bridge-br0.network ``` --- ``` [Match] Name=br0 [Network] Address=192.168.10.100/24 Gateway=192.168.10.1 DNS=8.8.8.8 ``` 最后,重启 systemd-networkd。 ``` $ sudo systemctl restart systemd-networkd ``` 你可以用 [brctl 工具](http://xmodulo.com/how-to-configure-linux-bridge-interface.html) 来验证是否创建好了网桥 br0。 ### 总结 当 systemd 誓言成为 Linux 的系统管理器时,有类似 systemd-networkd 的东西来管理网络配置也就不足为奇。但是在现阶段,systemd-networkd 看起来更适合于网络配置相对稳定的服务器环境。对于桌面/笔记本环境,它们有多种临时有线/无线接口,NetworkManager 仍然是比较好的选择。 对于想进一步了解 systemd-networkd 的人,可以参考官方[man 手册](http://www.freedesktop.org/software/systemd/man/systemd.network.html)了解完整的支持列表和关键点。 --- via: <http://xmodulo.com/switch-from-networkmanager-to-systemd-networkd.html> 作者:[Dan Nanni](http://xmodulo.com/author/nanni) 译者:[ictlyh](http://mutouxiaogui.cn/blog) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,631
Fedora 24 考虑将 systemd 分成两个软件包
http://news.softpedia.com/news/fedora-developers-discuss-systemd-package-split-for-fedora-24-linux-496544.shtml
2015-11-23T15:57:00
[ "Fedora", "systemd" ]
https://linux.cn/article-6631-1.html
![Fedora](/data/attachment/album/201511/23/155719df886pl67n5p877l.jpg) 来自 Redhat 的 Fedora 平台和程序经理 Jan Kurik 宣布了一个功能建议,这是给目前已经进入了开发周期的 Fedora 24 的第一份功能建议。 这些[新功能建议之一](https://lists.fedoraproject.org/archives/list/devel-announce%40lists.fedoraproject.org/thread/EOX5J7FUK6SQJK2OHZTDAN2K5ZM2L4LU/)是,在 Fedora 24 中将 systemd 包分割出两个子包:systemd-udev 和 systemd-container。不出所料,这让 Fedora 的开发宣告邮件列表炸了锅,要知道,这两个 systemd 子包都是可选的。 systemd-container 子包将包含所有用于启动和管理容器和虚拟机的工具,以帮助 Fedora 用户应用这些技术;而 systemd-udev 子包将包含 udev 守护进程(udevd)和各种硬件相关的工具。 ### 这些子包都会包含什么? 看起来 Fedora 开发者们已经讨论过了哪些工具会包含在这些新的子包中。对于 systemd-container.rpm, 它应该包括 systemd-pull、 systemd-nspawn、 machinectl、 systemd-machined 和 systemd-importd。 而 systemd-udev.rpm 将包括硬件数据库、udev 规则,以及 udevadm 和system-udevd 工具。 要实现这些子包,Fedora 开发者需要将这些相关的依赖都加上。 此外,Anaconda 安装器也需要更新来使 systemd-udev 子包成为 Fedora 24 的默认安装包。无论如何,让我们拭目以待 Fedora 即将到来的更新。
301
Moved Permanently
null
6,633
超神们:15 位健在的世界级程序员!
http://www.itworld.com/article/2823547/enterprise-software/158256-superclass-14-of-the-world-s-best-living-programmers.html
2015-11-24T10:00:00
[ "程序员" ]
https://linux.cn/article-6633-1.html
当开发人员说起世界顶级程序员时,他们的名字往往会被提及。 好像现在程序员有很多,其中不乏有许多优秀的程序员。但是哪些程序员更好呢? 虽然这很难客观评价,不过在这个话题确实是开发者们津津乐道的。ITworld 深入程序员社区,避开四溅的争执口水,试图找出可能存在的所谓共识。事实证明,屈指可数的某些名字经常是讨论的焦点。 ![](/data/attachment/album/201511/24/020058lffr5xk9son375s5.jpg) *图片来源: [tom\_bullock CC BY 2.0](https://www.flickr.com/photos/tombullock/15713223772)* 下面就让我们来看看这些世界顶级的程序员吧! ### <ruby> 玛格丽特·汉密尔顿 <rp> ( </rp> <rt> Margaret Hamilton </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020059wah98rq71p797ia7.jpg) *图片来源: [NASA](https://commons.wikimedia.org/wiki/File:Margaret_Hamilton_in_action.jpg)* **成就: 阿波罗飞行控制软件背后的大脑** 生平: <ruby> 查尔斯·斯塔克·德雷珀实验室 <rp> ( </rp> <rt> Charles Stark Draper Laboratory </rt> <rp> ) </rp></ruby>软件工程部的主任,以她为首的团队负责设计和打造 NASA 的阿波罗的舰载飞行控制器软件和<ruby> 空间实验室 <rp> ( </rp> <rt> Skylab </rt> <rp> ) </rp></ruby>的任务。基于阿波罗这段的工作经历,她又后续开发了<ruby> <a href="http://www.htius.com/Articles/r12ham.pdf"> 通用系统语言 </a> <rp> ( </rp> <rt> Universal Systems Language </rt> <rp> ) </rp></ruby>和<ruby> <a href="http://www.htius.com/Articles/Inside_DBTF.htm"> 开发先于事实 </a> <rp> ( </rp> <rt> Development Before the Fact </rt> <rp> ) </rp></ruby>的范例。开创了[异步软件、优先调度和超可靠的软件设计](http://www.nasa.gov/home/hqnews/2003/sep/HQ_03281_Hamilton_Honor.html)理念。被认为发明了“<ruby> <a href="http://www.nasa.gov/50th/50th_magazine/scientists.html"> 软件工程 </a> <rp> ( </rp> <rt> software engineering </rt> <rp> ) </rp></ruby>”一词。1986年获<ruby> <a href="https://books.google.com/books?id=JcmV0wfQEoYC&amp;pg=PA321&amp;lpg=PA321&amp;dq=ada+lovelace+award+1986&amp;source=bl&amp;ots=qGdBKsUa3G&amp;sig=bkTftPAhM1vZ_3VgPcv-38ggSNo&amp;hl=en&amp;sa=X&amp;ved=0CDkQ6AEwBGoVChMI3paoxJHWxwIVA3I-Ch1whwPn#v=onepage&amp;q=ada%20lovelace%20award%201986&amp;f=false"> 奥古斯塔·埃达·洛夫莱斯奖 </a> <rp> ( </rp> <rt> Augusta Ada Lovelace Award </rt> <rp> ) </rp></ruby>,2003年获<ruby> <a href="http://history.nasa.gov/alsj/a11/a11Hamilton.html"> NASA 杰出太空行动奖 </a> <rp> ( </rp> <rt> Exceptional Space Act Award </rt> <rp> ) </rp></ruby>。 评论: > > “汉密尔顿发明了测试,使美国计算机工程规范了很多” —— [ford\_beeblebrox](https://www.reddit.com/r/pics/comments/2oyd1y/margaret_hamilton_with_her_code_lead_software/cmrswof) > > > “我认为在她之前(不敬地说,包括<ruby> 高德纳 <rp> ( </rp> <rt> Knuth </rt> <rp> ) </rp></ruby>在内的)计算机编程是(另一种形式上留存的)数学分支。然而这个宇宙飞船的飞行控制系统明确地将编程带入了一个崭新的领域。” —— [Dan Allen](http://qr.ae/RFEZLk) > > > “... 她引入了‘软件工程’这个术语 — 并作出了最好的示范。” —— [David Hamilton](http://qr.ae/RFEZUn) > > > “真是个坏家伙” —— [Drukered](https://www.reddit.com/r/pics/comments/2oyd1y/margaret_hamilton_with_her_code_lead_software/cmrv9u9) > > > ### <ruby> 唐纳德·克努斯 <rp> ( </rp> <rt> Donald Knuth </rt> <rp> ) </rp></ruby>,即 高德纳 ![](/data/attachment/album/201511/24/020059w1vi6f6826p69928.jpg) *图片来源: [vonguard CC BY-SA 2.0](https://www.flickr.com/photos/44451574@N00/5347112697)* **成就: 《<ruby> 计算机程序设计艺术 <rp> ( </rp> <rt> The Art of Computer Programming,TAOCP </rt> <rp> ) </rp></ruby>》 作者** 生平: 撰写了[编程理论的权威书籍](http://cs.stanford.edu/%7Euno/taocp.html)。发明了数字排版系统 Tex。1971年,[ACM(美国计算机协会)<ruby></ruby>](http://awards.acm.org/award_winners/knuth_1013846.cfm)[葛丽丝·穆雷·霍普奖](http://awards.acm.org/award_winners/knuth_1013846.cfm)(Grace Murray Hopper Award) 的首位获奖者。1974年获 ACM<ruby> <a href="http://amturing.acm.org/award_winners/knuth_1013846.cfm"> 图灵奖 </a> <rp> ( </rp> <rt> A. M. Turing </rt> <rp> ) </rp></ruby>,1979年获<ruby> <a href="http://www.nsf.gov/od/nms/recip_details.jsp?recip_id=198"> 美国国家科学奖章 </a> <rp> ( </rp> <rt> National Medal of Science </rt> <rp> ) </rp></ruby>,1995年获 IEEE <ruby> <a href="http://www.ieee.org/documents/von_neumann_rl.pdf"> 约翰·冯·诺依曼奖章 </a> <rp> ( </rp> <rt> John von Neumann Medal </rt> <rp> ) </rp></ruby>。1998年入选<ruby> 计算机历史博物馆 <rp> ( </rp> <rt> Computer History Museum </rt> <rp> ) </rp></ruby><ruby> <a href="http://www.computerhistory.org/fellowawards/hall/bios/Donald,Knuth/"> 名人录 </a> <rp> ( </rp> <rt> Hall of Fellows </rt> <rp> ) </rp></ruby>。 评论: > > “... 写的<ruby> 《计算机编程艺术》 <rp> ( </rp> <rt> The Art of Computer Programming,TAOCP </rt> <rp> ) </rp></ruby>可能是有史以来计算机编程方面最大的贡献。”—— [佚名](http://www.quora.com/Who-are-the-best-programmers-in-Silicon-Valley-and-why/answers/3063) > > > “唐·克努斯的 TeX 是我所用过的计算机程序中唯一一个几乎没有 bug 的。真是让人印象深刻!”—— [Jaap Weel](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Jaap-Weel) > > > “如果你要问我的话,我只能说太棒了!” —— [Mitch Rees-Jones](http://qr.ae/RFE94x) > > > ### <ruby> 肯·汤普逊 <rp> ( </rp> <rt> Ken Thompson </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020059gwsntkks76ps0q98.jpg) *图片来源: [Association for Computing Machinery](http://amturing.acm.org/photo/thompson_4588371.cfm)* **成就: Unix 之父** 生平:与<ruby> <a href="https://www.youtube.com/watch?v=JoVQTPbD6UY"> 丹尼斯·里奇 </a> <rp> ( </rp> <rt> Dennis Ritchie </rt> <rp> ) </rp></ruby>共同创造了 Unix。创造了 [B 语言](https://www.bell-labs.com/usr/dmr/www/bintro.html)、[UTF-8 字符编码方案](http://doc.cat-v.org/bell_labs/utf-8_history)、[ed 文本编辑器](http://c2.com/cgi/wiki?EdIsTheStandardTextEditor),同时也是 Go 语言的共同开发者。(和里奇)共同获得1983年的<ruby> <a href="http://amturing.acm.org/award_winners/thompson_4588371.cfm"> 图灵奖 </a> <rp> ( </rp> <rt> A.M. Turing Award </rt> <rp> ) </rp></ruby>,1994年获<ruby> <a href="http://www.computer.org/portal/web/awards/cp-thompson"> IEEE 计算机先驱奖 </a> <rp> ( </rp> <rt> IEEE Computer Pioneer Award </rt> <rp> ) </rp></ruby>,1998年获颁<ruby> <a href="http://www.uspto.gov/about/nmti/recipients/1998.jsp"> 美国国家科技奖章 </a> <rp> ( </rp> <rt> National Medal of Technology </rt> <rp> ) </rp></ruby>。在1997年入选<ruby> 计算机历史博物馆 <rp> ( </rp> <rt> Computer History Museum </rt> <rp> ) </rp></ruby><ruby> <a href="http://www.computerhistory.org/fellowawards/hall/bios/Ken,Thompson/"> 名人录 </a> <rp> ( </rp> <rt> Hall of Fellows </rt> <rp> ) </rp></ruby>。 评论: > > “... 可能是有史以来最能成事的程序员了。Unix 内核,Unix 工具,国际象棋程序世界冠军 Belle,Plan 9,Go 语言。” —— [Pete Prokopowicz](http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Pete-Prokopowicz-1) > > > “肯所做出的贡献,据我所知无人能及,是如此的根本、实用、经得住时间的考验,时至今日仍在使用。” —— [Jan Jannink](http://qr.ae/RFEWBY) > > > ### <ruby> 理查德·斯托曼 <rp> ( </rp> <rt> Richard Stallman </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020059yz9hgwlizdykgkg2.jpg) *图片来源: [Jiel Beaumadier CC BY-SA 3.0](http://commons.wikimedia.org/wiki/File:Jielbeaumadier_richard_stallman_2010.jpg)* **成就: Emacs 和 GCC 缔造者** 生平: 成立了<ruby> <a href="https://groups.google.com/forum/#!msg/net.unix-wizards/8twfRPM79u0/1xlglzrWrU0J"> GNU 工程 </a> <rp> ( </rp> <rt> GNU Project </rt> <rp> ) </rp></ruby>,并创造了它的许多核心工具,如 [Emacs、GCC、GDB](http://www.emacswiki.org/emacs/RichardStallman) 和 [GNU Make](https://www.gnu.org/gnu/thegnuproject.html)。还创办了<ruby> <a href="http://www.emacswiki.org/emacs/FreeSoftwareFoundation"> 自由软件基金会 </a> <rp> ( </rp> <rt> Free Software Foundation </rt> <rp> ) </rp></ruby>。1990年荣获 ACM 的<ruby> <a href="http://awards.acm.org/award_winners/stallman_9380313.cfm"> 葛丽丝·穆雷·霍普奖 </a> <rp> ( </rp> <rt> Grace Murray Hopper Award </rt> <rp> ) </rp></ruby>,1998年获<ruby> <a href="https://w2.eff.org/awards/pioneer/1998.php"> EFF 先驱奖 </a> <rp> ( </rp> <rt> EFF Pioneer Award </rt> <rp> ) </rp></ruby>. 评论: > > “... 在 Symbolics 对阵 LMI 的战斗中,独自一人与一众 Lisp 黑客好手对码。” —— [Srinivasan Krishnan](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Greg-Naughton/comment/4146397) > > > “通过他在编程上的精湛造诣与强大信念,开辟了一整套编程与计算机的亚文化。” —— [Dan Dunay](http://qr.ae/RFEaib) > > > “我可以不赞同这位伟人的很多方面,不必盖棺论定,他不可否认都已经是一位伟大的程序员了。” —— [Marko Poutiainen](http://www.quora.com/Software-Engineering/Who-are-some-of-the-greatest-currently-active-software-architects-in-the-world/answer/Marko-Poutiainen) > > > “试想 Linux 如果没有 GNU 工程的前期工作会怎么样。(多亏了)斯托曼的炸弹!” —— [John Burnette](http://qr.ae/RFEUqp) > > > ### <ruby> 安德斯·海尔斯伯格 <rp> ( </rp> <rt> Anders Hejlsberg </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020059fpeuxkb9z5sm9cmx.jpg) *图片来源: [D.Begley CC BY 2.0](https://www.flickr.com/photos/begley/2979906130)* **成就: 创造了 Turbo Pascal** 生平: [Turbo Pascal 的原作者](http://www.taoyue.com/tutorials/pascal/history.html),是最流行的 Pascal 编译器和第一个集成开发环境。而后,[领导了 Turbo Pascal 的继任者 Delphi](http://c2.com/cgi/wiki?AndersHejlsberg) 的构建。[C# 的主要设计师和架构师](http://www.microsoft.com/about/technicalrecognition/anders-hejlsberg.aspx)。2001年荣获<ruby> <a href="http://www.drdobbs.com/windows/dr-dobbs-excellence-in-programming-award/184404602"> Dr. Dobb 的杰出编程奖 </a> <rp> ( </rp> <rt> Dr. Dobb's Excellence in Programming Award </rt> <rp> ) </rp></ruby>。 评论: > > “他用汇编语言为当时两个主流的 PC 操作系统(DOS 和 CPM)编写了 [Pascal] 编译器。用它来编译、链接并运行仅需几秒钟而不是几分钟。” —— [Steve Wood](http://qr.ae/RFEZrv) > > > “我佩服他 - 他创造了我最喜欢的开发工具,陪伴着我度过了三个关键的时期直至我成为一位专业的软件工程师。” —— [Stefan Kiryazov](http://www.quora.com/Software-Engineering/Who-are-some-of-the-greatest-currently-active-software-architects-in-the-world/answer/Stefan-Kiryazov) > > > ### Doug Cutting ![](/data/attachment/album/201511/24/020059qj7cu02ejtu8u8e7.jpg) *图片来源: [vonguard CC BY-SA 2.0](https://www.flickr.com/photos/vonguard/4076389963/)* **成就: 创造了 Lucene** 生平: [开发了 Lucene 搜索引擎以及 Web 爬虫 Nutch](http://www.wizards-of-os.org/archiv/sprecher/a_c/doug_cutting.html) 和用于大型数据集的分布式处理套件 [Hadoop](http://hadoop.apache.org/)。一位强有力的开源支持者(Lucene、Nutch 以及 Hadoop 都是开源的)。前<ruby> <a href="https://www.linkedin.com/in/cutting"> Apache 软件基金 </a> <rp> ( </rp> <rt> Apache Software Foundation </rt> <rp> ) </rp></ruby>[的理事](https://www.linkedin.com/in/cutting)。 评论: > > “...他就是那个既写出了优秀搜索框架(lucene/solr),又为世界开启大数据之门(hadoop)的男人。” —— [Rajesh Rao](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Shalin-Shekhar-Mangar/comment/2293071) > > > “他在 Lucene 和 Hadoop(及其它工程)的创造/工作中为世界创造了巨大的财富和就业...” —— [Amit Nithianandan](http://www.quora.com/Who-are-the-best-programmers-in-Silicon-Valley-and-why/answer/Amit-Nithianandan) > > > ### Sanjay Ghemawat ![](/data/attachment/album/201511/24/020100s3oqllitt46ptzq3.jpg) *图片来源: [Association for Computing Machinery](http://awards.acm.org/award_winners/ghemawat_1482280.cfm)* **成就: 谷歌核心架构师** 生平: [协助设计和实现了一些谷歌大型分布式系统的功能](http://research.google.com/pubs/SanjayGhemawat.html),包括 MapReduce、BigTable、Spanner 和<ruby> 谷歌文件系统 <rp> ( </rp> <rt> Google File System </rt> <rp> ) </rp></ruby>。[创造了 Unix 的 ical](http://www.quora.com/Google/Who-is-Sanjay-Ghemawat) 日历系统。2009年入选<ruby> <a href="http://www8.nationalacademies.org/onpinews/newsitem.aspx?RecordID=02062009"> 美国国家工程院 </a> <rp> ( </rp> <rt> National Academy of Engineering </rt> <rp> ) </rp></ruby>。2012年荣获<ruby> <a href="http://awards.acm.org/award_winners/ghemawat_1482280.cfm"> ACM-Infosys 基金计算机科学奖 </a> <rp> ( </rp> <rt> ACM-Infosys Foundation Award in the Computing Sciences </rt> <rp> ) </rp></ruby>。 评论: > > “Jeff Dean的僚机。” —— [Ahmet Alp Balkan](http://www.quora.com/Google/Who-is-Sanjay-Ghemawat/answer/Ahmet-Alp-Balkan) > > > ### Jeff Dean ![](/data/attachment/album/201511/24/020100ucrcul0fhfhpf4r7.jpg) *图片来源: [Google](http://research.google.com/people/jeff/index.html)* **成就: 谷歌搜索索引背后的大脑** 生平:协助设计和实现了[许多谷歌大型分布式系统的功能](http://research.google.com/people/jeff/index.html),包括网页爬虫,索引搜索,AdSense,MapReduce,BigTable 和 Spanner。2009年入选<ruby> <a href="http://www8.nationalacademies.org/onpinews/newsitem.aspx?RecordID=02062009"> 美国国家工程院 </a> <rp> ( </rp> <rt> National Academy of Engineering </rt> <rp> ) </rp></ruby>。2012年荣获ACM 的<ruby> <a href="http://news.cs.washington.edu/2012/10/10/uw-cse-ph-d-alum-jeff-dean-wins-2012-sigops-mark-weiser-award/"> SIGOPS 马克·维瑟奖 </a> <rp> ( </rp> <rt> SIGOPS Mark Weiser Award </rt> <rp> ) </rp></ruby>及<ruby> <a href="http://awards.acm.org/award_winners/dean_2879385.cfm"> ACM-Infosys基金计算机科学奖 </a> <rp> ( </rp> <rt> ACM-Infosys Foundation Award in the Computing Sciences </rt> <rp> ) </rp></ruby>。 评论: > > “... 带来了在数据挖掘(GFS、MapReduce、BigTable)上的突破。” —— [Natu Lauchande](http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Natu-Lauchande) > > > “... 设计、构建并部署 MapReduce 和 BigTable,和以及数不清的其它东西” —— [Erik Goldman](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Cosmin-Negruseri/comment/28399) > > > ### <ruby> 林纳斯·托瓦兹 <rp> ( </rp> <rt> Linus Torvalds </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020100enqggz4d1teprrot.jpg) *图片来源: [Krd CC BY-SA 4.0](https://commons.wikimedia.org/wiki/File:LinuxCon_Europe_Linus_Torvalds_05.jpg)* **成就: Linux缔造者** 生平:创造了 [Linux 内核](http://www.linuxfoundation.org/about/staff#torvalds)与[开源的版本控制系统 Git](http://git-scm.com/book/en/Getting-Started-A-Short-History-of-Git)。收获了许多奖项和荣誉,包括有1998年的<ruby> <a href="https://w2.eff.org/awards/pioneer/1998.php"> EFF 先驱奖 </a> <rp> ( </rp> <rt> EFF Pioneer Award </rt> <rp> ) </rp></ruby>,2000年荣获<ruby> 英国电脑学会 <rp> ( </rp> <rt> British Computer Society </rt> <rp> ) </rp></ruby>授予的[洛夫莱斯勋章](http://www.bcs.org/content/ConWebDoc/14769)(Lovelace Medal),2012年荣获<ruby> <a href="http://www.zdnet.com/blog/open-source/linus-torvalds-wins-the-tech-equivalent-of-a-nobel-prize-the-millennium-technology-prize/10789"> 千禧技术奖 </a> <rp> ( </rp> <rt> Millenium Technology Prize </rt> <rp> ) </rp></ruby>还有2014年<ruby> IEEE计算机学会 <rp> ( </rp> <rt> IEEE Computer Society </rt> <rp> ) </rp></ruby>授予的<ruby> <a href="http://www.computer.org/portal/web/pressroom/Linus-Torvalds-Named-Recipient-of-the-2014-IEEE-Computer-Society-Computer-Pioneer-Award"> 计算机先驱奖 </a> <rp> ( </rp> <rt> Computer Pioneer Award </rt> <rp> ) </rp></ruby>。同样入选了2008年的<ruby> 计算机历史博物馆 <rp> ( </rp> <rt> Computer History Museum </rt> <rp> ) </rp></ruby><ruby> <a href="http://www.computerhistory.org/fellowawards/hall/bios/Linus,Torvalds/"> 名人录 </a> <rp> ( </rp> <rt> Hall of Fellows </rt> <rp> ) </rp></ruby>与2012年的<ruby> <a href="http://www.internethalloffame.org/inductees/linus-torvalds"> 互联网名人堂 </a> <rp> ( </rp> <rt> Internet Hall of Fame </rt> <rp> ) </rp></ruby>。 评论: > > “他只用了几年的时间就写出了 Linux 内核,而 GNU Hurd(GNU 开发的内核)历经25年的开发却丝毫没有准备发布的意思。他的成就就是带来了希望。” —— [Erich Ficker](http://qr.ae/RFEeeo) > > > “托沃兹可能是程序员的程序员。” —— [Dan Allen](http://qr.ae/RFEZLk) > > > “他真的很棒。” —— [Alok Tripathy](http://www.quora.com/Software-Engineering/Who-are-some-of-the-greatest-currently-active-software-architects-in-the-world/answer/Alok-Tripathy-1) > > > ### <ruby> 约翰·卡马克 <rp> ( </rp> <rt> John Carmack </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020100x472q16vvv2v6a76.jpg) *图片来源: [QuakeCon CC BY 2.0](https://www.flickr.com/photos/quakecon/9434713998)* **成就: 毁灭战士的缔造者** 生平: ID 社联合创始人,打造了<ruby> 德军总部3D <rp> ( </rp> <rt> Wolfenstein 3D </rt> <rp> ) </rp></ruby>、<ruby> 毁灭战士 <rp> ( </rp> <rt> Doom </rt> <rp> ) </rp></ruby>和<ruby> 雷神之锤 <rp> ( </rp> <rt> Quake </rt> <rp> ) </rp></ruby>等所谓的即时 FPS 游戏。引领了<ruby> <a href="http://thegamershub.net/2012/04/gaming-gods-john-carmack/"> 切片适配刷新 </a> <rp> ( </rp> <rt> adaptive tile refresh </rt> <rp> ) </rp></ruby>,<ruby> <a href="http://www.shamusyoung.com/twentysidedtale/?p=4759"> 二叉空间分割 </a> <rp> ( </rp> <rt> binary space partitioning </rt> <rp> ) </rp></ruby>,<ruby> 表面缓存 <rp> ( </rp> <rt> surface caching </rt> <rp> ) </rp></ruby>等开创性的计算机图像技术。2001年入选<ruby> <a href="http://www.interactive.org/special_awards/details.asp?idSpecialAwards=6"> 互动艺术与科学学会名人堂 </a> <rp> ( </rp> <rt> Academy of Interactive Arts and Sciences Hall of Fame </rt> <rp> ) </rp></ruby>,2007年和2008年荣获工程技术类<ruby> <a href="http://www.itworld.com/article/2951105/it-management/a-fly-named-for-bill-gates-and-9-other-unusual-honors-for-tech-s-elite.html#slide8"> 艾美奖 </a> <rp> ( </rp> <rt> Emmy awards </rt> <rp> ) </rp></ruby>并于2010年由<ruby> <a href="http://www.gamechoiceawards.com/archive/lifetime.html"> 游戏开发者甄选奖 </a> <rp> ( </rp> <rt> Game Developers Choice Awards </rt> <rp> ) </rp></ruby>授予终生成就奖。 评论: > > “他在写第一个渲染引擎的时候不到20岁。这家伙这是个天才。我若有他四分之一的天赋便心满意足了。” —— [Alex Dolinsky](http://qr.ae/RFEEgr) > > > “... <ruby> 德军总部3D <rp> ( </rp> <rt> Wolfenstein 3D </rt> <rp> ) </rp></ruby>、<ruby> 毁灭战士 <rp> ( </rp> <rt> Doom </rt> <rp> ) </rp></ruby>还有<ruby> 雷神之锤 <rp> ( </rp> <rt> Quake </rt> <rp> ) </rp></ruby>在那时都是革命性的,影响了一代游戏设计师。” —— [dniblock](http://www.itworld.com/answers/topic/software/question/whos-best-living-programmer#comment-424562) > > > “一个周末他几乎可以写出任何东西....” —— [Greg Naughton](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Greg-Naughton) > > > “他是编程界的莫扎特... ” —— [Chris Morris](http://money.cnn.com/2003/08/21/commentary/game_over/column_gaming/) > > > ### <ruby> 法布里斯·贝拉 <rp> ( </rp> <rt> Fabrice Bellard </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020100fz35577asktias55.jpg) *图片来源: [Duff](http://dufoli.wordpress.com/2007/06/23/ammmmaaaazing-night/)* **成就: 创造了 QEMU** 生平: 创造了[一系列耳熟能详的开源软件](http://bellard.org/),其中包括硬件模拟和虚拟化的平台 QEMU,用于处理多媒体数据的 FFmpeg,<ruby> 微型C编译器 <rp> ( </rp> <rt> Tiny C Compiler </rt> <rp> ) </rp></ruby>和 一个可执行文件压缩软件 LZEXE。2000年和2001年<ruby> C语言混乱代码大赛 <rp> ( </rp> <rt> Obfuscated C Code Contest </rt> <rp> ) </rp></ruby>的[获胜者](http://www.ioccc.org/winners.html#B)并在2011年荣获<ruby> <a href="http://www.oscon.com/oscon2011/public/schedule/detail/21161"> Google-O'Reilly 开源奖 </a> <rp> ( </rp> <rt> Google-O'Reilly Open Source Award </rt> <rp> ) </rp></ruby>。[计算 Pi 最多位数](http://bellard.org/pi/pi2700e9/)的前世界纪录保持着。 评论: > > “我觉得法布里斯·贝拉做的每一件事都是那么显著而又震撼。” —— [raphinou](https://news.ycombinator.com/item?id=7850797) > > > “法布里斯·贝拉是世界上最高产的程序员...” —— [Pavan Yara](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Erik-Frey/comment/1718701) > > > “他就像软件工程界的<ruby> 尼古拉·特斯拉 <rp> ( </rp> <rt> Nikola Tesla </rt> <rp> ) </rp></ruby>。” —— [Michael Valladolid](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Erik-Frey/comment/2454450) > > > “自80年代以来,他一直高产出一系列的成功作品。” —— [Michael Biggins](http://qr.ae/RFEjhZ) > > > ### Jon Skeet ![](/data/attachment/album/201511/24/020100u37obt9or4grd8zi.jpg) *图片来源: [Craig Murphy CC BY 2.0](https://www.flickr.com/photos/craigmurphy/4325516497)* **成就: Stack Overflow 的传说级贡献者** 生平: Google 工程师,<ruby> <a href="http://www.amazon.co.uk/gp/product/1935182471?ie=UTF8&amp;tag=developetutor-21&amp;linkCode=as2&amp;camp=1634&amp;creative=19450&amp;creativeASIN=1935182471"> 深入解析C# </a> <rp> ( </rp> <rt> C# in Depth </rt> <rp> ) </rp></ruby>的作者。保持着[有史以来在 Stack Overflow 上最高的声誉](http://stackexchange.com/leagues/1/alltime/stackoverflow),平均每月解答390个问题。 评论: > > “他根本不需要调试器,只要他盯一下代码,错误之处自会原形毕露。” —— [Steven A. Lowe](http://meta.stackexchange.com/a/9156) > > > “如果他的代码没有通过编译,那编译器应该道歉。” —— [Dan Dyer](http://meta.stackexchange.com/a/9138) > > > “他根本不需要什么编程规范,他的代码就是编程规范。” —— [佚名](http://meta.stackexchange.com/a/9182) > > > ### <ruby> 亚当·安捷罗 <rp> ( </rp> <rt> Adam D'Angelo </rt> <rp> ) </rp></ruby> ![](/data/attachment/album/201511/24/020101dm7myfhjhmk7j81s.jpg) *图片来源: [Philip Neustrom CC BY 2.0](https://www.flickr.com/photos/philipn/5326344032)* **成就: Quora 的创办人之一** 生平: 还是 Facebook 工程师时,[为其搭建了 news feed 功能的基础](http://www.crunchbase.com/person/adam-d-angelo)。直至其离开并联合创始了 Quora,已经成为了 Facebook 的CTO和工程 VP。2001年以高中生的身份在<ruby> 美国计算机奥林匹克 <rp> ( </rp> <rt> USA Computing Olympiad </rt> <rp> ) </rp></ruby>上[第八位完成比赛](http://www.exeter.edu/documents/Exeter_Bulletin/fall_01/oncampus.html)。2004年ACM<ruby> 国际大学生编程大赛 <rp> ( </rp> <rt> International Collegiate Programming Contest </rt> <rp> ) </rp></ruby>[获得银牌的团队](http://icpc.baylor.edu/community/results-2004) -<ruby> 加州理工学院 <rp> ( </rp> <rt> California Institute of Technology </rt> <rp> ) </rp></ruby>的成员。2005年入围 Topcoder 大学生<ruby> <a href="https://www.topcoder.com/tc?module=Static&amp;d1=pressroom&amp;d2=pr_022205"> 算法编程挑战赛 </a> <rp> ( </rp> <rt> Algorithm Coding Competition </rt> <rp> ) </rp></ruby>。 评论: > > “一位程序设计全才。” —— [佚名](http://qr.ae/RFfOfe) > > > "我做的每个好东西,他都已有了六个。" ——<ruby> <a href="http://www.businessinsider.com/in-new-alleged-ims-mark-zuckerberg-talks-about-adam-dangelo-2012-9#ixzz369FcQoLB"> 马克.扎克伯格 </a> <rp> ( </rp> <rt> Mark Zuckerberg </rt> <rp> ) </rp></ruby> > > > ### Petr Mitrechev ![](/data/attachment/album/201511/24/020101ijsssl0ss17jb7bz.jpg) *图片来源: [Facebook](https://www.facebook.com/hackercup/photos/a.329665040399024.91563.133954286636768/553381194694073/?type=1)* **成就: 有史以来最具竞技能力的程序员之一** 生平: 在<ruby> 国际信息学奥林匹克 <rp> ( </rp> <rt> International Olympiad in Informatics </rt> <rp> ) </rp></ruby>中[两次获得金牌](http://stats.ioinformatics.org/people/1849)(2000,2002)。在2006,[赢得 Google Code Jam](http://googlepress.blogspot.com/2006/10/google-announces-winner-of-global-code_27.html) 同时也是[TopCoder Open 算法大赛冠军](http://community.topcoder.com/tc?module=SimpleStats&c=coder_achievements&d1=statistics&d2=coderAchievements&cr=10574855)。也同样,两次赢得<ruby> Facebook黑客杯 <rp> ( </rp> <rt> Facebook Hacker Cup </rt> <rp> ) </rp></ruby>([2011](https://www.facebook.com/notes/facebook-hacker-cup/facebook-hacker-cup-finals/208549245827651),[2013](https://www.facebook.com/hackercup/photos/a.329665040399024.91563.133954286636768/553381194694073/?type=1))。写这篇文章的时候,[TopCoder 榜中排第二](http://community.topcoder.com/tc?module=AlgoRank) (即:Petr)、在 [Codeforces 榜同样排第二](http://codeforces.com/ratings)。 评论: > > “他是竞技程序员的偶像,即使在印度也是如此...” —— [Kavish Dwivedi](http://www.quora.com/Respected-Software-Engineers/Who-are-some-of-the-best-programmers-in-the-world/answer/Venkateswaran-Vicky/comment/1960855) > > > ### Gennady Korotkevich ![](/data/attachment/album/201511/24/020101e1gqfcjfsfzvgg91.jpg) *图片来源: [Ishandutta2007 CC BY-SA 3.0](http://commons.wikimedia.org/wiki/File:Gennady_Korot.jpg)* **成就: 竞技编程小神童** 生平: <ruby> 国际信息学奥林匹克 <rp> ( </rp> <rt> International Olympiad in Informatics </rt> <rp> ) </rp></ruby>中最小参赛者(11岁),[6次获得金牌](http://stats.ioinformatics.org/people/804) (2007-2012)。2013年 ACM 国际大学生编程大赛(International Collegiate Programming Contest)[获胜队伍](http://icpc.baylor.edu/regionals/finder/world-finals-2013/standings)成员及2014<ruby> <a href="https://www.facebook.com/hackercup/posts/10152022955628845"> Facebook 黑客杯 </a> <rp> ( </rp> <rt> Facebook Hacker Cup </rt> <rp> ) </rp></ruby>获胜者。写这篇文章的时候,[Codeforces 榜排名第一](http://codeforces.com/ratings) (即:Tourist)、[TopCoder榜第一](http://community.topcoder.com/tc?module=AlgoRank)。 评论: > > “一个编程神童!” —— [Prateek Joshi](http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Prateek-Joshi) > > > “Gennady 真是棒,也是为什么我在白俄罗斯拥有一个强大开发团队的例证。” —— [Chris Howard](http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Prateek-Joshi/comment/4720779) > > > “Tourist 真是天才” —— [Nuka Shrinivas Rao](http://www.quora.com/Computer-Programming/Who-is-the-best-programmer-in-the-world-right-now/answer/Prateek-Joshi/comment/4880549) > > > --- via: <http://www.itworld.com/article/2823547/enterprise-software/158256-superclass-14-of-the-world-s-best-living-programmers.html#slide1> 作者:[Phil Johnson](http://www.itworld.com/author/Phil-Johnson/) 译者:[martin2011qi](https://github.com/martin2011qi) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,650
好奇 Linux?试试云端的 Linux 桌面
http://www.linuxlinks.com/article/20151003095334682/LinuxCloud.html
2015-11-27T06:34:00
[ "Linux" ]
https://linux.cn/article-6650-1.html
Linux 在桌面操作系统市场上只占据了非常小的份额,从目前的调查结果来看,估计只有2%的市场份额;对比来看,丰富多变的 Windows 系统占据了接近90%的市场份额。对于 Linux 来说,要挑战 Windows 在桌面操作系统市场的垄断,需要有一个让用户学习不同的操作系统的简单方式。如果你相信传统的 Windows 用户会再买一台机器来使用 Linux,那你就太天真了。我们只能去试想用户重新分区,设置引导程序来使用双系统,或者跳过所有步骤回到一个最简单的方法。 ![](/data/attachment/album/201511/27/063922gvj4i44y4ozjljz4.jpg) 我们实验过一系列让用户试操作 Linux 的无风险的使用方法,不涉及任何分区管理,包括 CD/DVD 光盘、USB 存储棒和桌面虚拟化软件等等。通过实验,我强烈推荐使用 VMware 的 VMware Player 或者 Oracle VirtualBox 虚拟机,对于桌面操作系统或者便携式电脑的用户,这是一种安装运行多操作系统的相对简单而且免费的的方法。每一台虚拟机和其他虚拟机相隔离,但是共享 CPU、内存、网络接口等等。虚拟机仍需要一定的资源来安装运行 Linux,也需要一台相当强劲的主机。但对于一个好奇心不大的人,这样做实在是太麻烦了。 要打破用户传统的使用观念是非常困难的。很多 Windows 用户可以尝试使用 Linux 提供的自由软件,但也有太多要学习的 Linux 系统知识。这会花掉他们相当一部分时间才能习惯 Linux 的工作方式。 当然了,对于一个第一次在 Linux 上操作的新手,有没有一个更高效的方法呢?答案是肯定的,接着往下看看云实验平台。 ### LabxNow ![](/data/attachment/album/201511/27/063935drpz2wl6lmpnn5w5.jpg) LabxNow 提供了一个免费服务,方便广大用户通过浏览器来访问远程 Linux 桌面。开发者将其加强为一个用户个人远程实验室(用户可以在系统里运行、开发任何程序),用户可以在任何地方通过互联网登入远程实验室。 这项服务现在可以为个人用户提供2核处理器,4GB RAM和10GB的固态硬盘,运行在128G RAM的4 AMD 6272处理器上。 #### 配置参数: * 系统镜像:基于 Ubuntu 14.04 的 Xface 4.10,RHEL 6.5,CentOS(Gnome桌面),Oracle * 硬件: CPU - 1核或者2核;内存: 512MB, 1GB, 2GB or 4GB * 超快的网络数据传输 * 可以运行在所有流行的浏览器上 * 可以安装任意程序,可以运行任何程序 – 这是一个非常棒的方法,可以随意做实验学习你想学的任何知识,没有 一点风险 * 添加、删除、管理、制定虚拟机非常方便 * 支持虚拟机共享,远程桌面 你所需要的只是一台有稳定网络的设备。不用担心虚拟专用系统(VPS)、域名、或者硬件带来的高费用。LabxNow提供了一个在 Ubuntu、RHEL 和 CentOS 上实验的非常好的方法。它给 Windows 用户提供一个极好的环境,让他们探索美妙的 Linux 世界。说得深入一点,它可以让用户随时随地在里面工作,而没有了要在每台设备上安装 Linux 的压力。点击下面这个链接进入 [www.labxnow.org/labxweb/](https://www.labxnow.org/labxweb/)。 另外还有一些其它服务(大部分是收费服务)可以让用户使用 Linux,包括 Cloudsigma 环境的7天使用权和Icebergs.io (通过HTML5实现root权限)。但是现在,我推荐 LabxNow。 --- 来自: <http://www.linuxlinks.com/article/20151003095334682/LinuxCloud.html> 译者:[sevenot](https://github.com/sevenot) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,651
Linux 有问必答:如何知道当前正在使用的 shell 是哪个?
http://ask.xmodulo.com/which-shell-am-i-using.html
2015-11-27T07:50:00
[ "shell" ]
/article-6651-1.html
> > **问题**: 我经常在命令行中切换 shell。是否有一个快速简便的方法来找出我当前正在使用的 shell 呢?此外,我怎么能找到当前 shell 的版本? > > > ### 找到你当前正在使用的 Shell 版本 ![](/data/attachment/album/201511/27/065300nnznqys2g616ovgw.jpg) 有多种方式可以查看你目前在使用什么 shell,最简单的方法就是通过使用 shell 的特殊参数。 其一,[一个名为 "$$" 的特殊参数](http://ask.xmodulo.com/process-id-pid-shell-script.html) 表示当前你正在运行的 shell 实例的 PID。此参数是只读的,不能被修改。所以,下面的命令也将显示你正在运行的 shell 的名字: ``` $ ps -p $$ PID TTY TIME CMD 21666 pts/4 00:00:00 bash ``` 上述命令可在所有可用的 shell 中工作。 如果你不使用 csh,找到当前使用的 shell 的另外一个办法是使用特殊参数 “$0” ,它表示当前正在运行的 shell 或 shell 脚本的名称。这是 Bash 的一个特殊参数,但也可用在其他 shell 中,如 sh、zsh、tcsh 或 dash。使用 echo 命令可以查看你目前正在使用的 shell 的名称。 ``` $ echo $0 bash ``` 不要被一个叫做 $SHELL 的单独的环境变量所迷惑,它被设置为你的默认 shell 的完整路径。因此,这个变量并不一定指向你当前使用的 shell。例如,即使你在终端中调用不同的 shell,$SHELL 也保持不变。 ``` $ echo $SHELL /bin/shell ``` ![](/data/attachment/album/201511/27/065311b9q9bwn8wvc9qc2c.jpg) 因此,找出当前的shell,你应该使用 $$ 或 $0,但不是 $SHELL。 ### 找出当前 Shell 的版本 一旦你知道你使用的是哪个 shell,你可能想知道此 shell 的版本。为此,在命令行中输入 shell 并在后面加上 “--version” 参数可以查看版本信息。例如: **对于** bash **shell** : ``` $ bash --version GNU bash, version 4.3.30(1)-release (x86_64-pc-linux-gnu) Copyright (C) 2013 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. ``` **对于** zsh **shell**: ``` $ zsh --version zsh 5.0.7 (x86_64-pc-linux-gnu) ``` **对于** tcsh **shell**: $ tcsh --version ``` tcsh 6.18.01 (Astron) 2012-02-14 (x86_64-unknown-linux) options wide,nls,dl,al,kan,rh,nd,color,filec ``` 对于某些 shell,你还可以使用 shell 特定的变量(例如,$BASH*VERSION 或 $ZSH*VERSION)。 ``` $ echo $BASH_VERSION 4.3.8(1)-release ``` --- via: <http://ask.xmodulo.com/which-shell-am-i-using.html> 作者:[Dan Nanni](http://ask.xmodulo.com/author/nanni) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='ask.xmodulo.com', port=80): Max retries exceeded with url: /which-shell-am-i-using.html (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b8327582440>: Failed to resolve 'ask.xmodulo.com' ([Errno -2] Name or service not known)"))
null
6,661
用浏览器管理 Docker
http://linoxide.com/linux-how-to/setup-dockerui-web-interface-docker/
2015-11-30T07:34:00
[ "Docker", "DockerUI" ]
/article-6661-1.html
Docker 越来越流行了。在一个容器里面而不是虚拟机里运行一个完整的操作系统是一种非常棒的技术和想法。docker 已经通过节省工作时间来拯救了成千上万的系统管理员和开发人员。这是一个开源技术,提供一个平台来把应用程序当作容器来打包、分发、共享和运行,而不用关注主机上运行的操作系统是什么。它没有开发语言、框架或打包系统的限制,并且可以在任何时间、任何地点运行,从小型计算机到高端服务器都可以。 运行 docker 容器和管理它们可能会花费一点点努力和时间,所以现在有一款基于 web 的应用程序-DockerUI,可以让管理和运行容器变得很简单。DockerUI 是一个对那些不熟悉 Linux 命令行,但又很想运行容器化程序的人很有帮助的工具。DockerUI 是一个开源的基于 web 的应用程序,它最值得称道的是它华丽的设计和用来运行和管理 docker 的简洁的操作界面。 下面会介绍如何在 Linux 上安装配置 DockerUI。 ![](/data/attachment/album/201511/29/224158l666f0sgss66ggh8.jpg) ### 1. 安装 docker 首先,我们需要安装 docker。我们得感谢 docker 的开发者,让我们可以简单的在主流 linux 发行版上安装 docker。为了安装 docker,我们得在对应的发行版上使用下面的命令。 #### Ubuntu/Fedora/CentOS/RHEL/Debian docker 维护者已经写了一个非常棒的脚本,用它可以在 Ubuntu 15.04/14.10/14.04、 CentOS 6.x/7、 Fedora 22、 RHEL 7 和 Debian 8.x 这几个 linux 发行版上安装 docker。这个脚本可以识别出我们的机器上运行的 linux 的发行版本,然后将需要的源库添加到文件系统、并更新本地的安装源目录,最后安装 docker 及其依赖库。要使用这个脚本安装docker,我们需要在 root 用户或者 sudo 权限下运行如下的命令, ``` # curl -sSL https://get.docker.com/ | sh ``` #### OpenSuse/SUSE Linux 企业版 要在运行了 OpenSuse 13.1/13.2 或者 SUSE Linux Enterprise Server 12 的机器上安装 docker,我们只需要简单的执行zypper 命令。运行下面的命令就可以安装最新版本的docker: ``` # zypper in docker ``` #### ArchLinux docker 在 ArchLinux 的官方源和社区维护的 AUR 库中可以找到。所以在 ArchLinux 上我们有两种方式来安装 docker。使用官方源安装,需要执行下面的 pacman 命令: ``` # pacman -S docker ``` 如果要从社区源 AUR 安装 docker,需要执行下面的命令: ``` # yaourt -S docker-git ``` ### 2. 启动 安装好 docker 之后,我们需要运行 docker 守护进程,然后才能运行并管理 docker 容器。我们需要使用下列命令来确认 docker 守护进程已经安装并运行了。 #### 在 SysVinit 上 ``` # service docker start ``` #### 在Systemd 上 ``` # systemctl start docker ``` ### 3. 安装 DockerUI 安装 DockerUI 比安装 docker 要简单很多。我们仅仅需要从 docker 注册库上拉取 dockerui ,然后在容器里面运行。要完成这些,我们只需要简单的执行下面的命令: ``` # docker run -d -p 9000:9000 --privileged -v /var/run/docker.sock:/var/run/docker.sock dockerui/dockerui ``` ![Starting DockerUI Container](/data/attachment/album/201511/29/223551oc0kco9q70kwe7qg.png) 在上面的命令里,dockerui 使用的默认端口是9000,我们需要使用`-p` 命令映射默认端口。使用`-v` 标志我们可以指定docker 的 socket。如果主机使用了 SELinux 那么就得使用`--privileged` 标志。 执行完上面的命令后,我们要检查 DockerUI 容器是否运行了,或者使用下面的命令检查: ``` # docker ps ``` ![Running Docker Containers](/data/attachment/album/201511/29/223624vay03skfhpwu6f6x.png) ### 4. 拉取 docker 镜像 现在我们还不能直接使用 DockerUI 拉取镜像,所以我们需要在命令行下拉取 docker 镜像。要完成这些我们需要执行下面的命令。 ``` # docker pull ubuntu ``` ![Docker Image Pull](/data/attachment/album/201511/29/223644evo4r4a4loeopo0l.png) 上面的命令将会从 docker 官方源 [Docker Hub](https://hub.docker.com/)拉取一个标志为 ubuntu 的镜像。类似的我们可以从 Hub 拉取需要的其它镜像。 ### 4. 管理 启动了 DockerUI 容器之后,我们可以用它来执行启动、暂停、终止、删除以及 DockerUI 提供的其它操作 docker 容器的命令。 首先,我们需要在 web 浏览器里面打开 dockerui:在浏览器里面输入 http://ip-address:9000 或者 [http://mydomain.com:9000,具体要根据你的系统配置。默认情况下登录不需要认证,但是可以配置我们的](http://mydomain.com:9000%EF%BC%8C%E5%85%B7%E4%BD%93%E8%A6%81%E6%A0%B9%E6%8D%AE%E4%BD%A0%E7%9A%84%E7%B3%BB%E7%BB%9F%E9%85%8D%E7%BD%AE%E3%80%82%E9%BB%98%E8%AE%A4%E6%83%85%E5%86%B5%E4%B8%8B%E7%99%BB%E5%BD%95%E4%B8%8D%E9%9C%80%E8%A6%81%E8%AE%A4%E8%AF%81%EF%BC%8C%E4%BD%86%E6%98%AF%E5%8F%AF%E4%BB%A5%E9%85%8D%E7%BD%AE%E6%88%91%E4%BB%AC%E7%9A%84) web 服务器来要求登录认证。要启动一个容器,我们需要有包含我们要运行的程序的镜像。 #### 创建 创建容器我们需要在 Images 页面里,点击我们想创建的容器的镜像 id。然后点击 `Create` 按钮,接下来我们就会被要求输入创建容器所需要的属性。这些都完成之后,我们需要点击按钮`Create` 完成最终的创建。 ![Creating Docker Container](/data/attachment/album/201511/29/223707t51sf19qj195ao1k.png) #### 停止 要停止一个容器,我们只需要跳转到`Containers` 页面,然后选取要停止的容器。然后在 Action 的子菜单里面按下 Stop 就行了。 ![Managing Container](/data/attachment/album/201511/29/223726fwnpsafnab11p2aw.png) #### 暂停与恢复 要暂停一个容器,只需要简单的选取目标容器,然后点击 Pause 就行了。恢复一个容器只需要在 Actions 的子菜单里面点击 Unpause 就行了。 #### 删除 类似于我们上面完成的任务,杀掉或者删除一个容器或镜像也是很简单的。只需要检查、选择容器或镜像,然后点击 Kill 或者 Remove 就行了。 ### 结论 DockerUI 使用了 docker 远程 API 提供了一个很棒的管理 docker 容器的 web 界面。它的开发者们完全使用 HTML 和 JS 设计、开发了这个应用。目前这个程序还处于开发中,并且还有大量的工作要完成,所以我们并不推荐将它应用在生产环境。它可以帮助用户简单的完成管理容器和镜像,而且只需要一点点工作。如果想要为 DockerUI 做贡献,可以访问它们的 [Github 仓库](https://github.com/crosbymichael/dockerui/)。如果有问题、建议、反馈,请写在下面的评论框,这样我们就可以修改或者更新我们的内容。谢谢。 --- via: <http://linoxide.com/linux-how-to/setup-dockerui-web-interface-docker/> 作者:[Arun Pyasi](http://linoxide.com/author/arunp/) 译者:[oska874](https://github.com/oska874) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /linux-how-to/setup-dockerui-web-interface-docker/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b8327582cb0>, 'Connection to linoxide.com timed out. (connect timeout=10)'))
null
6,662
在 Ubuntu 15.10 上安装 Intel Graphics 安装器
http://ubuntuhandbook.org/index.php/2015/11/install-intel-graphics-installer-in-ubuntu-15-10/
2015-11-30T08:31:00
[ "Intel", "显卡" ]
https://linux.cn/article-6662-1.html
![Intel graphics installer](/data/attachment/album/201511/30/003240nf6xgamxwd2xk3am.jpg) Intel 最近发布了一个新版本的 Linux Graphics 安装器。在新版本中,将不支持 Ubuntu 15.04,而必须用 Ubuntu 15.10 Wily。 > > Linux 版 Intel® Graphics 安装器可以让你很容易的为你的 Intel Graphics 硬件安装最新版的图形与视频驱动。它能保证你一直使用最新的增强与优化功能,并能够安装到 Intel Graphics Stack 中,来保证你在你的 Intel 图形硬件下,享受到最佳的用户体验。*现在 Linux 版的 Intel® Graphics 安装器支持最新版的 Ubuntu。* > > > ![intel-graphics-installer](/data/attachment/album/201511/30/003241fyk5kc3e2czv7vcq.jpg) ### 安装 **1.** 从[这个链接页面](https://01.org/linuxgraphics/downloads)中下载该安装器。当前支持 Ubuntu 15.10 的版本是1.2.1版。你可以在**系统设置 -> 详细信息**中检查你的操作系统(32位或64位)的类型。 ![download-intel-graphics-installer](/data/attachment/album/201511/30/003242arvzzhivr9ih4dbd.jpg) **2.** 一旦下载完成,到下载目录中点击 .deb 安装包,用 Ubuntu 软件中心打开它,然最后点击“安装”按钮。 ![install-via-software-center](/data/attachment/album/201511/30/003242o7g51cdks0p9h375.jpg) **3.** 为了让系统信任 Intel Graphics 安装器,你需要通过下面的命令来为它添加密钥。 用快捷键`Ctrl+Alt+T`或者在 Unity Dash 中的“应用程序启动器”中打开终端。依次粘贴运行下面的命令。 ``` wget --no-check-certificate https://download.01.org/gfx/RPM-GPG-KEY-ilg -O - | sudo apt-key add - wget --no-check-certificate https://download.01.org/gfx/RPM-GPG-KEY-ilg-2 -O - | sudo apt-key add - ``` ![trust-intel](/data/attachment/album/201511/30/003243sjana404j0pyzwh4.jpg) 注意:在运行第一个命令的过程中,如果密钥下载完成后,光标停住不动并且一直闪烁的话,就像上面图片显示的那样,输入你的密码(输入时不会看到什么有变化)然后回车就行了。 最后通过 Unity Dash 或应用程序启动器打开 Intel Graphics 安装器。 --- via: <http://ubuntuhandbook.org/index.php/2015/11/install-intel-graphics-installer-in-ubuntu-15-10/> 作者:[Ji m](http://ubuntuhandbook.org/index.php/about/) 译者:[XLCYun](https://github.com/XLCYun) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,663
如何在 Ubuntu 15.10,14.04 中安装 NVIDIA 358.16 驱动程序
http://ubuntuhandbook.org/index.php/2015/11/install-nvidia-358-16-driver-ubuntu-15-10/
2015-12-01T08:45:00
[ "显卡", "驱动" ]
https://linux.cn/article-6663-1.html
![nvidia-logo-1](/data/attachment/album/201511/30/004624v8xte85t9z6ip6xv.png) [NVIDIA 358.16](http://www.nvidia.com/Download/driverResults.aspx/95921/en-us) —— NVIDIA 358 系列的第一个稳定版本已经发布,并对 358.09 中(测试版)做了一些修正,以及一些小的改进。 NVIDIA 358 增加了一个新的 **nvidia-modeset.ko** 内核模块,可以配合 nvidia.ko 内核模块工作来调用 GPU 显示引擎。在以后发布版本中,**nvidia-modeset.ko** 内核驱动程序将被用于模式设置接口的基础,该接口由内核的直接渲染管理器(DRM)所提供。 新的驱动程序也有新的 GLX 协议扩展,以及在 OpenGL 驱动中分配大量内存的系统内存分配新机制。新的 GPU **GeForce 805A** 和 **GeForce GTX 960A** 都支持。NVIDIA 358.16 也支持 X.Org 1.18 服务器和 OpenGL 4.3。 ### 如何在 Ubuntu 中安装 NVIDIA 358.16 : > > **请不要在生产设备上安装,除非你知道自己在做什么以及如何才能恢复。** > > > 对于官方的二进制文件,请到 [nvidia.com/object/unix.html](http://www.nvidia.com/Download/driverResults.aspx/95921/en-us) 查看。 对于那些喜欢 Ubuntu PPA 的,我建议你使用 [显卡驱动 PPA](http://www.nvidia.com/object/unix.html)。到目前为止,支持 Ubuntu 16.04, Ubuntu 15.10, Ubuntu 15.04, Ubuntu 14.04。 **1. 添加 PPA.** 通过按 `Ctrl+Alt+T` 快捷键来从 Unity 桌面打开终端。当打启动应用后,粘贴下面的命令并按回车键: ``` sudo add-apt-repository ppa:graphics-drivers/ppa ``` ![nvidia-ppa](/data/attachment/album/201511/30/004624puus08uz09f79uuf.jpg) 它会要求你输入密码。输入密码后,密码不会显示在屏幕上,按 Enter 继续。 **2. 刷新并安装新的驱动程序** 添加 PPA 后,逐一运行下面的命令刷新软件库并安装新的驱动程序: ``` sudo apt-get update sudo apt-get install nvidia-358 nvidia-settings ``` ### (如果需要的话,) 卸载: 开机从 GRUB 菜单进入恢复模式,进入根控制台。然后逐一运行下面的命令: 重新挂载文件系统为可写: ``` mount -o remount,rw / ``` 删除所有的 nvidia 包: ``` apt-get purge nvidia* ``` 最后返回菜单并重新启动: ``` reboot ``` 要禁用/删除显卡驱动 PPA,点击系统设置下的**软件和更新**,然后导航到**其他软件**标签。 --- via: <http://ubuntuhandbook.org/index.php/2015/11/install-nvidia-358-16-driver-ubuntu-15-10/> 作者:[Ji m](http://ubuntuhandbook.org/index.php/about/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,664
如何在 Linux 终端下创建新的文件系统/分区
https://www.maketecheasier.com/create-file-systems-partitions-terminal-linux/
2015-12-01T09:00:00
[ "分区", "文件系统", "CFdisk" ]
https://linux.cn/article-6664-1.html
![](/data/attachment/album/201511/30/010226fsjxv1ajaavkbjj7.png) 在 Linux 中创建分区或新的文件系统通常意味着一件事:安装 Gnome Parted 分区编辑器(GParted)。对于大多数 Linux 用户而言,这是唯一的办法。不过,你是否考虑过在终端创建这些分区和文件系统?当然可以!以下就是方法! ### 使用 CFdisk 创建一个基本的 Linux 分区 以下是如何在命令行中创建一个基本的 Linux 分区的正确方案。要做的第一件事就是先打开你的终端。若你已打开,你需要找到你想要创建分区的磁盘。这可以使用一个简单的命令来找到。 ``` lsblk ``` ![cfdisk-lsblk](/data/attachment/album/201511/30/010226qc0o50hcokokm515.png) 当你运行了 `lsblk`,你应该会看到当前系统上每个磁盘的详细列表。看看这个列表,然后找出你想要使用的磁盘。在本文中,我将使用 `sdb` 来进行演示。 在终端输入这个命令。它会显示一个功能强大的基于终端的分区编辑程序。 ``` sudo cfdisk /dev/sdb ``` ![cfdisk-empty-layout](/data/attachment/album/201511/30/010226wkalek56f5vy5a85.png) **注意**: 使用在 `lsblk` 命令输出的你想要使用的磁盘来替换 `sdb`。 当输入此命令后,你将进入分区编辑器中,然后访问你想改变的磁盘。 由于磁盘分区的不同,这取决于用户的需求,这部分的指南将在 **如何建立一个分离的 Linux home/root 分区布局**。 首先,需要创建根分区。这需要根据磁盘的字节数来进行分割。我测试的磁盘是 32 GB。 在 CFdisk 中使用键盘上的方向键选择需要分配的空间。你找到后,请使用箭头键选择 [ NEW ],然后按 Enter 键。 ![cfdisk-create-root-partition](/data/attachment/album/201511/30/010227jmz93ou2o3o1b3on.png) 该程序会要求你输入分区大小。一旦你指定好大小后,按 Enter 键。这将被称为根分区(或 /dev/sdb1)。 接下来该创建 home 分区(/dev/sdb2)了。你需要在 CFdisk 中再选择一些空闲分区。使用箭头选择 [ NEW ] 选项,然后按 Enter 键。输入你的 home 分区的大小,然后按 Enter 键来创建它。 ![cfdisk-create-home-partition](/data/attachment/album/201511/30/010227trp7cc75z4n0rddr.png) 最后,需要创建交换分区。像前两次一样,先找一些空闲分区,并使用箭头选择 [ NEW ] 选项。之后,算下你 Linux 想使用多大的交换分区。 **注意**: 交换分区通常和计算机的内存差不多大。 ![cfdisk-specify-partition-type-swap](/data/attachment/album/201511/30/010227mhjsoscx2qfsz4nz.png) 现在,创建了交换分区,该指定其类型。使用上下箭头来选择它。之后,使用左右箭头选择 [ TYPE ] 。找到 Linux swap 选项,然后按 Enter 键。 ![cfdisk-write-partition-table](/data/attachment/album/201511/30/010227hixwtd5boif7qhdv.jpg) 所有分区创建后。然后就是将其写入到磁盘。使用右箭头键,选择 [ WRITE ] 选项,然后按 Enter 键。这将直接将新创建的分布写入到磁盘中。 ### 使用 mkfs 创建文件系统 有时候,你并不需要一个整个重新分区,你只想要创建一个文件系统而已。你可以在终端直接使用 `mkfs` 命令来实现。 ![cfdisk-mkfs-list-partitions-lsblk](/data/attachment/album/201511/30/010228pcmfycgyw22a2dg2.png) 首先,找出你要使用的磁盘。在终端输入 `lsblk` 找出来。它会打印出列表,之后只要找到你想创建文件系统的分区或盘符。 在这个例子中,我将使用第二个硬盘的 `/dev/sdb1` 作为第一个分区。可以对 `/dev/sdb` 使用 mkfs(这将会使用整个分区)。 ![cfdisk-mkfs-make-file-system-ext4](/data/attachment/album/201511/30/010228k5z33xbzdxoxvutx.png) 要在一个特定的分区上创建新文件系统,只需输入 ``` sudo mkfs.ext4 /dev/sdb1 ``` 在终端。应当指出的是,`mkfs.ext4` 可以换成任何你想要使用的的文件系统。 ### 结论 虽然使用图形工具编辑文件系统和分区更容易,但终端可以说是更有效的。终端的加载速度更快,点击几个按钮即可。GParted 和其它工具一样,它也是一个完整的工具。我希望在本教程的帮助下,你会明白如何在终端中高效的编辑文件系统。 你是否更喜欢使用基于终端的方法在 Linux 上编辑分区?不管是不是,请在下面告诉我们。 --- via: <https://www.maketecheasier.com/create-file-systems-partitions-terminal-linux/> 作者:[Derrik Diener](https://www.maketecheasier.com/author/derrikdiener/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
![A photograph of the internal components of a hard drive.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-00-featured-image.jpg) Partition editing or making new file systems on Linux usually means one thing: installing the Gnome Parted partition editor (GParted). For most Linux users, this is the only way to go about it. Still, what if you could edit these partitions and file systems right in the terminal? You can! Here’s how! **Note**: you might want to [back up your partition](https://www.maketecheasier.com/back-up-partitions-linux-apart-gtk/) first before making any changes to your hard disk. ## Creating a Basic Linux Partition Layout with CFdisk Here’s how to make a basic Linux partition scheme right from the command line. - The first thing to do is open your terminal. Once you’re there, you’ll need to [identify what hard drive you’re looking to change](https://www.maketecheasier.com/lsblk-list-storage-information-linux/). This can easily be figured out with one simple command. lsblk ![cfdisk-lsblk A terminal showing the output of lsblk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-01-basic-lsblk.png) - Once you’ve run `lsblk` , you should get a detailed list of each hard drive currently on your system. Look through this generated list, and figure out the denotation to the drive you want to change. Here I’ll be using`sdb` for the sake of example. - In your terminal enter this command. It will launch a powerful terminal-based partition editing program. sudo cfdisk /dev/sda ![cfdisk-empty-layout A terminal showing the default interface for cfdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-02-cfdisk-free-space.png) **Note:** replace `sda` with whatever `lsblk` told you your hard drive was. When this command is entered, you’ll be inside the partition editor and will have total access to the hard drive you wish to modify. Since hard drive partitions are different, depending on a user’s needs, this part of the guide will go over how to set up a split Linux home/root system layout. You can [learn more about Linux partition schemes here](https://www.maketecheasier.com/quick-guide-to-linux-partition-schemes/). To start, a root partition will need to be created. This will require a bit of math as the gigabytes on the hard drive need to be divided up. My test drive is 16 GB. - In CFdisk using the arrow keys on your keyboard, select some free space. Once you’ve found some, use the arrow key to select “[ NEW ]” and press the `Enter`key. - The program will ask you to input the partition size. Once you’ve specified the size, press the `Enter`key. This will be the root partition (or “/dev/sdb1”). ![cfdisk-create-root-partition A terminal showing the creation of the first partition in cfdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-03-create-new-root-partition.png) - It’s time to create the home partition (/dev/sdb2). Once again, you’ll need to select some free space in CFdisk. Use the arrow key to select the “[ NEW ]” option, and press the `Enter`key. Input the size of your home partition, and press the`Enter`key to create it. ![cfdisk-create-home-partition A terminal showing the create of the second partition in cfdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-04-create-second-partition.png) - Finally, you need to create the swap partition. Find some free space, and use the arrow key to select the “[ NEW ]” option. After that calculate exactly how big your Linux swap partition needs to be. **Tip: **Learn more about swap partitions and how you can [configure your system to use swap effectively](https://www.maketecheasier.com/swap-partitions-on-linux/). - With the swap partition available, it’s time to specify its type. Highlight it with the up and down arrow keys. After that, use the left and right arrow keys to select “[ TYPE ].” Find Linux swap in the menu, and press `Enter`. ![cfdisk-specify-partition-type-swap A terminal showing the process of changing the partition type in cfdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-05-change-partition-type.png) - All of the partition creation is out of the way. All that’s left is to write it to the disk. Using the right arrow key, select the “[ WRITE ]” option, and press the `Enter`key. This will write your newly created layout directly to the hard drive. ![cfdisk-write-partition-table A terminal showing the commit process for cfdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-06-commit-changes-to-disk.png) **Tip**: do you know [you can move your Home directory to another partition](https://www.maketecheasier.com/move-home-folder-ubuntu/)? Here is how it is done. ## Using Fdisk to Create Linux Partition Layouts Aside from cfdisk, you can also use the more traditional `fdisk` utility to create and modify disk partitions inside Linux. One of the advantages of this approach is that fdisk often comes by default on most Linux distros. - Run `fdisk` along with the disk that you want to partition: sudo fdisk /dev/sda ![A terminal showing the default interface for fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-08-fdisk-dev-sda.png) - type `g`then press`Enter`to wipe your current partition table and recreate it in the newer “GPT” format. ![A terminal showing the disklabel setup for fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-09-create-new-gpt-label.png) - Type “n 1” then press `Enter`twice to create the first partition. ![A terminal showing the creation of the first partition in fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-10-create-first-partition.png) - fdisk will ask for the starting sector of your first partition. Press `Enter`to select the default value for your disk. - You need to determine the overall size of your partition. You can use symbols such as M (megabyte), G (gigabyte) and T (terabyte) to refine your partition’s size. For example, “+8G” will set your partition at exactly 8 gigabytes. ![A terminal showing the output for the partition creation process in fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-11-set-proper-disk-size-first-partition.png) - Once done, type “n 2” and press `Enter`twice to create the second partition. - Press `Enter`again to accept the default starting sector, then provide the size that you want for your second partition. In my case, I will write “+4G” to set the overall size to 4 gigabytes. ![A terminal showing the output for the creation of the second partition in fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-12-create-second-partition.png) - Type “n 3” then press `Enter`twice to create your last partition. - Press `Enter`to accept the default starting sector. However, unlike the previous partitions, you can leave the second prompt blank and press`Enter`. ![A terminal showing the output for the third partition creation process in fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-13-create-third-partition.png) - After that, type “t 3”, and press `Enter`twice to modify the type of the last partition. - Inside, write “19”, and press `Enter`to set it to “Linux swap.” ![A terminal showing process for changing the partition type in fdisk.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-14-modify-third-partition-type.png) - Lastly, type “wq” and press `Enter`to save your new partition table layout. ## Creating File Systems With mkfs Sometimes you don’t need to make an entire partition layout. Sometimes you just need to [make a filesystem](https://www.maketecheasier.com/choosing-the-best-linux-filesystem/). This can easily be accomplished directly in the terminal with the `mkfs` command. - Enter `lsblk` in your terminal. It’ll print out a list. Find the partition or drive you want to make a file system on. ![cfdisk-mkfs-list-partitions-lsblk A terminal showing the output of lsblk with a disk with three distinct partitions.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-15-modified-lsblk-contents.png) In this example, I’ll point it to the first partition of the secondary drive “/dev/sda1.” It’s also possible to just point mkfs to “/dev/sda” (to make use of the entire drive). - Enter the following command to create the new file system on a specific partition. sudo mkfs.ext4 /dev/sda1 ![cfdisk-mkfs-make-file-system-ext4 A terminal showing the output of the mkfs.ext4 program.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-16-create-ext4-filesystem.png) It should be noted that `mkfs.ext4` can be changed to whatever file system you want to use. For example, you can create a “FAT” partition by running `mkfs.vfat` instead: sudo mkfs.vfat /dev/sda1 ![A terminal showing the output of the mkfs.vfat program.](https://www.maketecheasier.com/assets/uploads/2023/07/create-file-systems-partitions-linux-17-create-fat-partition.png) **Good to know: **Learn how your computer stores data in file systems by looking at some of the [best file recovery tools in Linux](https://www.maketecheasier.com/ways-recover-deleted-files-linux/) today. ## Frequently Asked Questions ### Do you need to unmount your drive before running cfdisk? Ideally yes. However, desktop environments today tend to automatically remove a drive’s device file whenever you unmount it from your file manager. This can be an issue since cfdisk relies on an accessible device file in order to format a drive properly. To fix this issue, you can either run cfdisk even if your drive is still mounted or unmount it using the `umount` utility: `sudo umount /media/$USER/your-device` . ### Is it possible to list all the available partition types in fdisk? Yes. The Type submenu fdisk provides a handy list of all the available partition types that it can format to. To access this, you need to type `t` followed by the number of the partition that you want to modify. Next, press `Shift` + `L` to print a list of the available partition types along with their type number. ### Would clearing the partition table completely wipe my drive? No. A partition table is a small binary file that sits at the beginning of every disk drive. It serves as a “phone book” for your operating system so that it can find the right sectors to load a file system from. Because of that, removing the partition table will not delete any existing data inside your hard disk. To [properly remove the data inside your drives](https://www.maketecheasier.com/completely-delete-file-in-linux/), you can “zero” its contents by piping “/dev/zero” to your device file using dd: `sudo dd status=progress if=/dev/zero of=/dev/sda` . Image credit: [Sajad Nori via Unsplash](https://unsplash.com/photos/sIX4eDtak7k). All alterations and screenshots by Ramces Red. Our latest tutorials delivered straight to your inbox
6,668
UNIX 家族小史
http://www.unixmen.com/brief-history-aix-hp-ux-solaris-bsd-linux/
2015-12-01T08:59:00
[ "UNIX" ]
https://linux.cn/article-6668-1.html
要记住,当一扇门在你面前关闭的时候,另一扇门就会打开。<ruby> <a href="http://www.unixmen.com/ken-thompson-unix-systems-father/"> 肯·汤普森 </a> <rp> ( </rp> <rt> Ken Thompson </rt> <rp> ) </rp></ruby> 和<ruby> <a href="http://www.unixmen.com/dennis-m-ritchie-father-c-programming-language/"> 丹尼斯·里奇 </a> <rp> ( </rp> <rt> Dennis Richie </rt> <rp> ) </rp></ruby>两个人就是这句名言很好的实例。他们俩是**20世纪**最优秀的信息技术专家之二,因为他们创造了最具影响力和创新性的软件之一: **UNIX**。 ![用于推广 UNIX,以车牌形式出现](/data/attachment/album/201512/01/085036marlozcc4xcjo9ci.jpg) (题图来自:[wikimedia.org](https://commons.wikimedia.org/wiki/File:Actual_DEC_UNIX_License_Plate_DSC_0317.jpg),CC BY-SA 3.0) ### UNIX 系统诞生于贝尔实验室 **UNIX** 最开始的名字是 **UNICS** (**UN**iplexed **I**nformation and **C**omputing **S**ervice),它有一个大家庭,并不是从石头缝里蹦出来的。UNIX的祖父是 **CTSS** (**C**ompatible **T**ime **S**haring **S**ystem),它的父亲是 **Multics** (**MULT**iplexed **I**nformation and **C**omputing **S**ervice),这个系统能支持大量用户通过交互式<ruby> 分时 <rp> ( </rp> <rt> timesharing </rt> <rp> ) </rp></ruby>的方式使用大型机。 UNIX 诞生于 **1969** 年,由**肯·汤普森**以及后来加入的**丹尼斯·里奇**共同完成。这两位优秀的研究员和科学家在一个**通用电器 GE**和**麻省理工学院**的合作项目里工作,项目目标是开发一个叫 Multics 的交互式分时系统。 Multics 的目标是整合分时技术以及当时其他先进技术,允许用户在远程终端通过电话(拨号)登录到主机,然后可以编辑文档,阅读电子邮件,运行计算器,等等。 在之后的五年里,AT&T 公司为 Multics 项目投入了数百万美元。他们购买了 GE-645 大型机,聚集了贝尔实验室的顶级研究人员,例如肯·汤普森、 Stuart Feldman、丹尼斯·里奇、<ruby> 道格拉斯·麦克罗伊 <rp> ( </rp> <rt> M. Douglas McIlroy </rt> <rp> ) </rp></ruby>、 Joseph F. Ossanna 以及 Robert Morris。但是项目目标太过激进,进度严重滞后。最后,AT&T 高层决定放弃这个项目。 贝尔实验室的管理层决定停止这个让许多研究人员无比纠结的操作系统上的所有遗留工作。不过要感谢汤普森,里奇和一些其他研究员,他们把老板的命令丢到一边,并继续在实验室里满怀热心地忘我工作,最终孵化出前无古人后无来者的 UNIX。 UNIX 的第一声啼哭是在一台 PDP-7 微型机上,它是汤普森测试自己在操作系统设计上的点子的机器,也是汤普森和 里奇一起玩 Space and Travel 游戏的模拟器。 > > “我们想要的不仅是一个优秀的编程环境,而是能围绕这个系统形成团体。按我们自己的经验,通过远程访问和分时主机实现的公共计算,本质上不只是用终端输入程序代替打孔机而已,而是鼓励密切沟通。”丹尼斯·里奇说。 > > > UNIX 是第一个靠近理想的系统,在这里程序员可以坐在机器前自由摆弄程序,探索各种可能性并随手测试。在 UNIX 整个生命周期里,它吸引了大量因其他操作系统限制而投身过来的高手做出无私贡献,因此它的功能模型一直保持上升趋势。 UNIX 在 1970 年因为 PDP-11/20 获得了首次资金注入,之后正式更名为 UNIX 并支持在 PDP-11/20 上运行。UNIX 带来的第一次用于实际场景中是在 1971 年,贝尔实验室的专利部门配备来做文字处理。 ### UNIX 上的 C 语言革命 丹尼斯·里奇在 1972 年发明了一种叫 “**C**” 的高级编程语言 ,之后他和肯·汤普森决定用 “C” 重写 UNIX 系统,来支持更好的移植性。他们在那一年里编写和调试了差不多 100,000 行代码。在迁移到 “C” 语言后,系统可移植性非常好,只需要修改一小部分机器相关的代码就可以将 UNIX 移植到其他计算机平台上。 UNIX 第一次公开露面是 1973 年丹尼斯·里奇和肯·汤普森在<ruby> 操作系统原理 <rp> ( </rp> <rt> Operating Systems Principles </rt> <rp> ) </rp></ruby>上发表的一篇论文,然后 AT&T 发布了 UNIX 系统第 5 版,并授权给教育机构使用,之后在 1975 年第一次以 **$20.000** 的价格授权企业使用 UNIX 第 6 版。应用最广泛的是 1980 年发布的 UNIX 第 7 版,任何人都可以购买授权,只是授权条款非常严格。授权内容包括源代码,以及用 PDP-11 汇编语言写的及其相关内核。反正,各种版本 UNIX 系统完全由它的用户手册确定。 ### UNIX 分支演化 ![UNIX 分支演化](/data/attachment/album/201512/01/084203t49995lxl94c1pnt.png) (来自 wikipedia.org,CC BY-SA 3.0) ### AIX 系统 在 **1983** 年,**微软**计划开发 **Xenix** 作为 MS-DOS 的多用户版继任者,他们在那一年花了 $8,000 搭建了一台拥有 **512 KB** 内存以及 **10 MB**硬盘并运行 Xenix 的 Altos 586。而到 1984 年为止,全世界 UNIX System V 第二版的安装数量已经超过了 100,000 。在 1986 年发布了包含因特网域名服务的 4.3BSD,而且 **IBM** 宣布 **AIX 系统**的安装数已经超过 250,000。AIX 基于 Unix System V 开发,这套系统拥有 BSD 风格的根文件系统,是两者的结合。 AIX 第一次引入了 **日志文件系统 (JFS)** 以及集成LVM(<ruby> 逻辑卷管理器 <rp> ( </rp> <rt> Logical Volume Manager </rt> <rp> ) </rp></ruby>)。IBM 在 1989 年将 AIX 移植到自己的 RS/6000 平台。2001 年发布的 5L 版是一个突破性的版本,提供了 Linux 友好性以及支持 Power4 服务器的逻辑分区。 在 2004 年发布的 AIX 5.3 引入了支持APV(<ruby> 高级电源虚拟化 <rp> ( </rp> <rt> Advanced Power Virtualization </rt> <rp> ) </rp></ruby>)的虚拟化技术,支持对称多线程、微分区,以及共享处理器池。 在 2007 年,IBM 同时发布 AIX 6.1 和 Power6 架构,开始加强自己的虚拟化产品。他们还将高级电源虚拟化重新包装成 PowerVM。 这次改进包括被称为 WPARs 的负载分区形式,类似于 Solaris 的 zones/Containers,但是功能更强。 ### HP-UX 系统 **HP-UX**(<ruby> 惠普 UNIX <rp> ( </rp> <rt> Hewlett-Packard’s UNIX </rt> <rp> ) </rp></ruby>) 源于 System V 第 3 版。这套系统一开始只支持 PA-RISC HP 9000 平台。HP-UX 第 1 版发布于 1984 年。 HP-UX 第 9 版引入了 SAM,一个基于字符的图形用户界面 (GUI),用户可以用来管理整个系统。在 1995 年发布的第 10 版,调整了系统文件分布以及目录结构,变得有点类似 AT&T SVR4。 第 11 版发布于 1997 年。这是 HP 第一个支持 64 位寻址的版本。不过在 2000 年重新发布成 11i,因为 HP 为特定的信息技术用途,引入了<ruby> 操作环境 <rp> ( </rp> <rt> operating environments </rt> <rp> ) </rp></ruby>和<ruby> 分级应用 <rp> ( </rp> <rt> layered applications </rt> <rp> ) </rp></ruby>的<ruby> 捆绑组 <rp> ( </rp> <rt> bundled groups </rt> <rp> ) </rp></ruby>。 在 2001 年发布的 11.20 版宣称支持<ruby> 安腾 <rp> ( </rp> <rt> Itanium </rt> <rp> ) </rp></ruby>系统。HP-UX 是第一个使用 ACLs(<ruby> 访问控制列表 <rp> ( </rp> <rt> Access Control Lists </rt> <rp> ) </rp></ruby>)管理文件权限的 UNIX 系统,也是首先支持内建<ruby> 逻辑卷管理器 <rp> ( </rp> <rt> Logical Volume Manager </rt> <rp> ) </rp></ruby>的系统之一。 如今,HP-UX 因为 HP 和 Veritas 的合作关系使用了 Veritas 作为主文件系统。 HP-UX 目前的最新版本是 11iv3, update 4。 ### Solaris 系统 Sun 的 UNIX 版本是 **Solaris**,用来接替 1992 年创建的 **SunOS**。SunOS 一开始基于 BSD(<ruby> 伯克利软件发行版 <rp> ( </rp> <rt> Berkeley Software Distribution </rt> <rp> ) </rp></ruby>)风格的 UNIX,但是 SunOS 5.0 版以及之后的版本都是基于重新包装为 Solaris 的 Unix System V 第 4 版。 SunOS 1.0 版于 1983 年发布,用于支持 Sun-1 和 Sun-2 平台。随后在 1985 年发布了 2.0 版。在 1987 年,Sun 和 AT&T 宣布合作一个项目以 SVR4 为基础将 System V 和 BSD 合并成一个版本。 Solaris 2.4 是 Sun 发布的第一个 Sparc/x86 版本。1994 年 11 月份发布的 SunOS 4.1.4 版是最后一个版本。Solaris 7 是首个 64 位 Ultra Sparc 版本,加入了对文件系统元数据记录的原生支持。 Solaris 9 发布于 2002 年,支持 Linux 特性以及 <ruby> Solaris 卷管理器 <rp> ( </rp> <rt> Solaris Volume Manager </rt> <rp> ) </rp></ruby>。之后,2005 年发布了 Solaris 10,带来许多创新,比如支持 Solaris Containers,新的 ZFS 文件系统,以及<ruby> 逻辑域 <rp> ( </rp> <rt> Logical Domains </rt> <rp> ) </rp></ruby>。 目前 Solaris 最新的版本是 第 10 版,最后的更新发布于 2008 年。 (LCTT 译注:据微信网友 @atoningfang涛 指出,[Solaris 11.3](https://en.wikipedia.org/wiki/Solaris_(operating_system)#Version_history) 才是当前最新版本,发布于 2015/8/26。) ### Linux 到了 1991 年,用来替代商业操作系统的<ruby> 自由 <rp> ( </rp> <rt> free </rt> <rp> ) </rp></ruby>操作系统的需求日渐高涨。因此,**Linus Torvalds** 开始构建一个自由的操作系统,最终成为 **Linux**。Linux 最开始只有一些 “C” 文件,并且使用了阻止商业发行的授权。Linux 是一个类 UNIX 系统但又不尽相同。 2015 年发布了基于 GNU Public License (GPL)授权的 3.18 版。IBM 声称有超过 1800 万行开源代码开源给开发者。 如今 GNU Public License 是应用最广泛的自由软件授权方式。根据开源软件原则,这份授权允许个人和企业自由分发、运行、通过拷贝共享、学习,以及修改软件源码。 ### UNIX vs. Linux:技术概要 * Linux 鼓励多样性,Linux 的开发人员来自各种背景,有更多不同经验和意见。 * Linux 比 UNIX 支持更多的平台和架构。 * UNIX 商业版本的开发人员针对特定目标平台以及用户设计他们的操作系统。 * **Linux 比 UNIX 有更好的安全性**,更少受病毒或恶意软件攻击。截止到现在,Linux 上大约有 60-100 种病毒,但是没有任何一种还在传播。另一方面,UNIX 上大约有 85-120 种病毒,但是其中有一些还在传播中。 * 由于 UNIX 命令、工具和元素很少改变,甚至很多接口和命令行参数在后续 UNIX 版本中一直沿用。 * 有些 Linux 开发项目以自愿为基础进行资助,比如 Debian。其他项目会维护一个和商业 Linux 的社区版,比如 SUSE 的 openSUSE 以及红帽的 Fedora。 * 传统 UNIX 是纵向扩展,而另一方面 Linux 是横向扩展。 --- via: <http://www.unixmen.com/brief-history-aix-hp-ux-solaris-bsd-linux/> 作者:[M.el Khamlichi](http://www.unixmen.com/author/pirat9/) 译者:[zpl1025](https://github.com/zpl1025) 校对:[Caroline](https://github.com/carolinewuyan) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,670
每个 HTTP/2 连接会发送一条隐藏的秘密信息!
http://blog.jgc.org/2015/11/the-secret-message-hidden-in-every.html
2015-12-01T17:55:00
[ "PRISM", "NSA", "HTTP/2.0" ]
https://linux.cn/article-6670-1.html
![PRISM](/data/attachment/album/201512/01/174610yw4ng4q75cwfwk5c.png) 如果你监听过 HTTP/2 连接的建立过程,你也许会注意到在每个连接建立时都会发送一条这样的报文。如下: ![](/data/attachment/album/201512/01/171643b56fb677699sskne.png) 即以下文本: ``` PRI * HTTP2.0 SM ``` 如果将 HTTP2.0 以及换行从其中去掉,那么我们就得到了“**PRISM**”!——这是什么?是斯诺登所揭露的 NSA 的“棱镜计划”!只要是 HTTP/2.0 连接,都会在一开头就发送这样的报文。 是你的 HTTP/2.0 连接被 NSA 监控了么?不是!这条消息代表了你的服务器真正支持了 HTTP/2.0,它是一个用于识别的魔法字符串。 它在 [RFC7540](https://tools.ietf.org/html/rfc7540) [Section 3.5](https://tools.ietf.org/html/rfc7540#section-3.5) 中描述如下: > > 在 HTTP/2 中,每个端点都需要发送一个连接引语作为所用协议的最终确认,并用于建立 HTTP/2 连接的初始设置。客户端和服务器发送不同的连接引语。 > > > 客户端的连接引语以24个字节开始,以16进制表示如下: > > > **0x505249202a20485454502f322e300d0a0d0a534d0d0a0d0a** > > > 即以下列字符串开始: “**PRI \*** **HTTP/2.0\r\n\r\nSM\r\n\r\n”**。 > > > 事实上,这个魔法字符串原本是“FOOBA”:在 2013/5/29 发布的 [draft-ietf-httpbis-http2-03](https://tools.ietf.org/html/draft-ietf-httpbis-http2-03#section-3.2) 中它还是这个样子:“**FOO \* HTTP/2.0\r\n\r\nBA\r\n\r\n**”。 而在同年6月份斯诺登事件沸沸扬扬之后,7/8发布的 [draft-ietf-httpbis-http2-04](https://tools.ietf.org/html/draft-ietf-httpbis-http2-04) 中就变成了“**PRI \* HTTP/2.0\r\n\r\nSM\r\n\r\n**”。 所以,你知道了吧?这个古怪的字符串是互联网工程任务组(IETF)对 NSA 的嘲讽。
301
Moved Permanently
null
6,675
Enlightenment E20 发布
https://phab.enlightenment.org/phame/live/3/post/e20_release/
2015-12-03T07:33:00
[ "Enlightenment" ]
/article-6675-1.html
![](/data/attachment/album/201512/02/220827i9pyzhgkep79yxjk.jpg) E20 的开发已经告一段落了。在这 441 天期间,50 位以上的开发者提交了 1890 个补丁。报告了 25 个以上的 Coverity 分析问题,解决了 165 个问题(根据提交信息得知)。bug 汇报之王 [@ApB](https://phab.enlightenment.org/p/ApB/) 共提交了 231 个问题,虽然只有其中 70% 得到了解决,但是依然为我们帮了大忙。 非常感谢每位做出贡献的人,无论是提交补丁、撰写文档、汇报问题还是简单地在 IRC 上提供反馈。 ### 新版本亮点 * 对 [Wayland](https://git.enlightenment.org/core/enlightenment.git/tree/README.wayland) 的完整支持 * 新的屏幕管理架构和对话框 * 新的声音混音器架构及部件 * Elementary 替换了许多内部部件 * 改进了 FreeBSD 支持 * Geolocation 模块 完整的更新日志 [在此](https://git.enlightenment.org/core/enlightenment.git/tree/NEWS?id=v0.20.0)。 ### 下载 | | | | --- | --- | | **链接** | **SHA256** | | [Enlightenment DR 0.20.0 GZIP](http://download.enlightenment.org/rel/apps/enlightenment/enlightenment-0.20.0.tar.gz) | 2e59533d5576e7c96a40af0885540aa0990b4a5a60b578cf990f6bc5daa365a9 | | [Enlightenment DR 0.20.0 XZ](http://download.enlightenment.org/rel/apps/enlightenment/enlightenment-0.20.0.tar.xz) | bb5f257dc91f67f321c5960556e8c4029ce9a42aace3e3d4d880986d418d9157 | ### 构建和依赖 如果你已经安装了 EFL 和 Elementary,你也许应该在编译安装它们之前,删除它们的头文件和库文件,以避免出现编译冲突。请以下列顺序编译这些依赖: 1. [EFL](https://phab.enlightenment.org/diffusion/EFL) ([说明](https://git.enlightenment.org/core/efl.git/tree/README)) 2. [Elementary](https://phab.enlightenment.org/diffusion/ELM) ([说明](https://git.enlightenment.org/core/elementary.git/tree/README)) 3. [Emotion Generic Players](https://phab.enlightenment.org/diffusion/EGP) ([说明](https://git.enlightenment.org/core/emotion_generic_players.git/tree/README)) 4. [Evas Generic Loaders](https://phab.enlightenment.org/diffusion/EGL) ([说明](https://git.enlightenment.org/core/evas_generic_loaders.git/tree/README)) **注意:** E20 依赖于 EFL **v1.15.2** 及更新版本来支持 X11 混合,如需要支持 Wayland 则需要1.16。
null
HTTPSConnectionPool(host='phab.enlightenment.org', port=443): Max retries exceeded with url: /phame/live/3/post/e20_release/ (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7b8327580bb0>: Failed to resolve 'phab.enlightenment.org' ([Errno -5] No address associated with hostname)"))
null
6,677
LNAV:基于 Ncurses 的日志文件阅读器
http://www.ubuntugeek.com/lnav-ncurses-based-log-file-viewer.html
2015-12-02T23:17:49
[ "日志", "lnav" ]
https://linux.cn/article-6677-1.html
日志文件导航器(Logfile Navigator,简称 lnav),是一个基于 curses 的,用于查看和分析日志文件的工具。和文本阅读器/编辑器相比, lnav 的好处是它充分利用了可以从日志文件中获取的语义信息,例如时间戳和日志等级。利用这些额外的语义信息, lnav 可以处理像这样的事情:来自不同文件的交错的信息;按照时间生成信息直方图;支持在文件中导航的快捷键。它希望使用这些功能可以使得用户可以快速有效地定位和解决问题。 ### lnav 功能 #### 支持以下日志文件格式: Syslog、Apache 访问日志、strace、tcsh 历史以及常见的带时间戳的日志文件。读入文件的时候回自动检测文件格式。 #### 直方图视图: 以时间区划来显示日志信息数量。这对于大概了解在一长段时间内发生了什么非常有用。 #### 过滤器: 只显示那些匹配或不匹配一些正则表达式的行。对于移除大量你不感兴趣的日志行非常有用。 #### 即时操作: 在你输入到时候会同时完成检索;当添加了新日志行的时候会自动加载和搜索;加载行的时候会应用过滤器;另外,还会在你输入 SQL 查询的时候检查其正确性。 #### 自动显示后文: 日志文件视图会自动往下滚动到新添加到文件中的行。只需要向上滚动就可以锁定当前视图,然后向下滚动到底部恢复显示后文。 #### 按照日期顺序排序行: 从所有文件中加载的日志行会按照日期进行排序。使得你不需要手动从不同文件中收集日志信息。 #### 语法高亮: 错误和警告会用红色和黄色显示。高亮还可用于: SQL 关键字、XML 标签、Java 文件行号和括起来的字符串。 #### 导航: 有快捷键用于跳转到下一个或上一个错误或警告,按照指定的时间向后或向前翻页。 #### 用 SQL 查询日志: 每个日志文件行都相当于数据库中的一行,可以使用 SQL 进行查询。可以使用的列取决于查看的日志文件类型。 #### 命令和搜索历史: 会自动保存你之前输入的命令和搜素,因此你可以在会话之间使用它们。 ####  压缩文件: 会实时自动检测和解压压缩的日志文件。 ### 在 ubuntu 15.10 上安装 lnav 打开终端运行下面的命令 ``` sudo apt-get install lnav ``` ### 使用 lnav 如果你想使用 lnav 查看日志,你可以使用下面的命令,默认它会显示 syslogs ``` lnav ``` ![](/data/attachment/album/201512/02/231752xz4aklpb0fisxhss.png) 如果你想查看特定的日志,那么需要指定路径。如果你想看 CPU 日志,在你的终端里运行下面的命令 ``` lnav /var/log/cups ``` ![](/data/attachment/album/201512/02/231753f33vmrlrwln5e3vg.png) --- via: <http://www.ubuntugeek.com/lnav-ncurses-based-log-file-viewer.html> 作者:[ruchi](http://www.ubuntugeek.com/author/ubuntufix) 译者:[ictlyh](http://mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
# LNAV – Ncurses based log file viewer **Sponsored Link** **lnav Features** **Support for the following log file formats:** Syslog, Apache access log, strace, tcsh history, and generic log files with timestamps. The file format is automatically detected when the file is read in. **Histogram view:** Displays the number of log messages per bucket-of-time. Useful for getting an overview of what was happening over a long period of time. **Filters:** Display only lines that match or do not match a set of regular expressions. Useful for removing extraneous log lines that you are not interested in. **"Live" operation:** Searches are done as you type; new log lines are automatically loaded and searched as they are added; filters apply to lines as they are loaded; and, SQL queries are checked for correctness as you type. **Automatic tailing:** The log file view automatically scrolls down to follow new lines that are added to files. Simply scroll up to lock the view in place and then scroll down to the bottom to resume tailing. **Time-of-day ordering of lines:** The log lines from all the files are loaded and then sorted by time-of-day. Relieves you of having to manually line up log messages from different files. **Syntax highlighting:** Errors and warnings are colored in red and yellow, respectively. Highlights are also applied to: SQL keywords, XML tags, file and line numbers in Java backtraces, and quoted strings. **Navigation:** There are hotkeys for jumping to the next or previous error or warning and moving forward or backward by an amount of time. **Use SQL to query logs:** Each log file line is treated as a row in a database that can be queried using SQL. The columns that are available depend on logs file types being viewed. **Command and search history:** Your previously entered commands and searches are saved so you can access them between sessions. **Compressed files:** Compressed log files are automatically detected and uncompressed on the fly. **Install lnav on ubuntu 15.10** Open the terminal and run the following command sudo apt-get install lnav **Using lnav** If you want to view logs using lnav you can do using the following command by default it shows syslogs lnav If you want to view specific logs provide the path If you want to view CUPS logs run the following command from your terminal lnav /var/log/cups
6,678
如何在 Ubuntu 服务器中配置 AWStats
https://www.maketecheasier.com/set-up-awstats-ubuntu/
2015-12-03T10:38:00
[ "AWStats", "日志" ]
https://linux.cn/article-6678-1.html
![](/data/attachment/album/201512/03/063949bt53ex3otbdzxjdx.jpg) AWStats 是一个开源的网站分析报告工具,可以生成强大的网站、流媒体、FTP 或邮件服务器的访问统计图。此日志分析器以 CGI 或命令行方式进行工作,并在网页中以图表的形式尽可能的显示你日志中所有的信息。它可以“部分”读取信息文件,以便能够频繁并快速处理大量的日志文件。它支持绝大多数 Web 服务器日志文件格式,包括 Apache,IIS 等。 本文将帮助你在 Ubuntu 上安装配置 AWStats。 ### 安装 AWStats 包 默认情况下,AWStats 的包可以在 Ubuntu 仓库中找到。 可以通过运行下面的命令来安装: ``` sudo apt-get install awstats ``` 接下来,你需要启用 Apache 的 CGI 模块。 运行以下命令来启动 CGI: ``` sudo a2enmod cgi ``` 现在,重新启动 Apache 以使改变生效。 ``` sudo /etc/init.d/apache2 restart ``` ### 配置 AWStats 你需要为你想要查看统计的每个域或网站创建一个配置文件。在这个例子中,我们将为 “test.com” 创建一个配置文件。 要完成此步,你可以通过复制 AWStats 的默认配置文件来配置你要统计的域。 ``` sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.test.com.conf ``` 现在,你需要在配置文件中做一些修改: ``` sudo nano /etc/awstats/awstats.test.com.conf ``` 像下面这样修改一下: ``` # Change to Apache log file, by default it's /var/log/apache2/access.log LogFile="/var/log/apache2/access.log" # Change to the website domain name SiteDomain="test.com" HostAliases="www.test.com localhost 127.0.0.1" # When this parameter is set to 1, AWStats adds a button on report page to allow to "update" statistics from a web browser AllowToUpdateStatsFromBrowser=1 ``` 保存并关闭文件。 修改配置文件后,你需要用服务器的当前日志建立初步统计。你可以这样做: ``` sudo /usr/lib/cgi-bin/awstats.pl -config=test.com -update ``` 输出会是这个样子: ![awtstats](/data/attachment/album/201512/03/063950x1vki1ii21011v45.png) ### 为 Apache 配置 AWStats 接下来,你需要配置 Apache2 来显示统计数据。现在你需要将 “cgi-bin” 文件夹中的内容复制到 Apache 默认根目录下。默认它是在 “/usr/lib/cgi-bin”。 运行以下命令来完成此步: ``` sudo cp -r /usr/lib/cgi-bin /var/www/html/ sudo chown www-data:www-data /var/www/html/cgi-bin/ sudo chmod -R 755 /var/www/html/cgi-bin/ ``` ### 测试 AWStats 现在,您可以通过访问 url “http://your-server-ip/cgi-bin/awstats.pl?config=test.com.” 来查看 AWStats 的页面。 它的页面像下面这样: ![awstats_page](/data/attachment/album/201512/03/063950ph7krr1771iwccht.jpg) ### 设置定时任务来更新日志 建议你创建一个定时任务,使用新创建的日志条目定期更新 AWStats 的数据库,然后统计会定期更新。这也将节省你的时间。 要做到这一点,你需要编辑 “/etc/crontab” 文件: ``` sudo nano /etc/crontab ``` 添加下面那一行来让 AWStats 每十分钟更新一次。 ``` */10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=test.com -update ``` 保存并关闭文件。 ### 结论 AWStats 是一个非常有用的工具,可以让你对网站的状况了如指掌,并能协助你分析网站。它非常容易安装和配置。如果你有任何疑问,请在下面发表评论。 --- via: <https://www.maketecheasier.com/set-up-awstats-ubuntu/> 作者:[Hitesh Jethva](https://www.maketecheasier.com/author/hiteshjethva/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
AWStats is an open-source Web analytics reporting tool that generates advanced web, streaming, FTP or mail server statistics graphically. This log analyser works as a CGI or from command line and shows you all the possible information your log contains in a few graphical web pages. It uses a partial information file to be able to process large log files often and quickly. It supports most web server log file formats including Apache, IIS and many other web server log formats. This article will help you to install and configure AWStats on Ubuntu. ## Install AWStats Package By default, AWStats package is available in the Ubuntu repository. You can install it by running: sudo apt-get install awstats Next you will need to enable the CGI module in Apache. You can do this by running: `sudo a2enmod cgi` Now, restart Apache to reflect the changes. sudo /etc/init.d/apache2 restart ## Configure AWStats You need to create a configuration file for each domain or website you wish to view statistics for. In this example we will create a configuration file for “*test.com*“. You can do this by duplicating the AWStats default configuration file to one with your domain name. sudo cp /etc/awstats/awstats.conf /etc/awstats/awstats.test.com.conf Now, you need to make some changes in the config file: sudo nano /etc/awstats/awstats.test.com.conf Update the settings shown below: # Change to Apache log file, by default it's /var/log/apache2/access.log LogFile="/var/log/apache2/access.log" # Change to the website domain name SiteDomain="test.com" HostAliases="www.test.com localhost 127.0.0.1" # When this parameter is set to 1, AWStats adds a button on report page to allow to "update" statistics from a web browser AllowToUpdateStatsFromBrowser=1 Save and close the file. After these changes, you need to build your initial statistics which will be generated from the current logs on your server. You can do this using: sudo /usr/lib/cgi-bin/awstats.pl -config=test.com -update The output will look something like this: ## Configure Apache For AWStats Next, you need to configure Apache2 to show these stats. Now copy the content of the “cgi-bin” folder to the default document root directory of your Apache installation. By default, this is in the “/usr/lib/cgi-bin” folder. You can do this by running: sudo cp -r /usr/lib/cgi-bin /var/www/html/ sudo chown www-data:www-data /var/www/html/cgi-bin/ sudo chmod -R 755 /var/www/html/cgi-bin/ ## Test AWStats Now you can access your AWStats by visiting the url “http://your-server-ip/cgi-bin/awstats.pl?config=test.com.” It will show you a results page like this: ## Set Up Cron to Update Logs It is recommended to schedule a cron job to regularly update the AWStats database using newly created log entries, so the stats get updated on a regular basis. This will also save your time. To do this you need to edit the “/etc/crontab” file: sudo nano /etc/crontab Add the following line that tells AWStats to update every ten minutes. */10 * * * * root /usr/lib/cgi-bin/awstats.pl -config=test.com -update Save and close the file. ## Conclusion AWStats is a very useful tool that can give you an overview of what is happening on your website and assist with site analysis. It is very easy to install and configure. Feel free to comment below if you have any questions. Our latest tutorials delivered straight to your inbox
6,679
基础:tar 命令使用介绍
https://www.howtoforge.com/tutorial/linux-tar-command/
2015-12-03T11:00:00
[ "tar" ]
https://linux.cn/article-6679-1.html
Linux [tar](https://en.wikipedia.org/wiki/Tar_(computing)) 命令是归档或分发文件时的强大武器。GNU tar 归档包可以包含多个文件和目录,还能保留其文件权限,它还支持多种压缩格式。Tar 表示 "**T**ape **Ar**chiver",这种格式是 POSIX 标准。 ![](/data/attachment/album/201512/03/065134arm11mnqcqofs11o.png) ### Tar 文件格式 tar 压缩等级简介: * **无压缩** 没有压缩的文件用 .tar 结尾。 * **Gzip 压缩** Gzip 格式是 tar 使用最广泛的压缩格式,它能快速压缩和提取文件。用 gzip 压缩的文件通常用 .tar.gz 或 .tgz 结尾。这里有一些如何[创建](http://www.faqforge.com/linux/create-tar-gz/)和[解压](http://www.faqforge.com/linux/extract-tar-gz/) tar.gz 文件的例子。 * **Bzip2 压缩** 和 Gzip 格式相比 Bzip2 提供了更好的压缩比。创建压缩文件也比较慢,通常采用 .tar.bz2 结尾。 * **Lzip(LAMA)压缩** Lizp 压缩结合了 Gzip 快速的优势,以及和 Bzip2 类似(甚至更好) 的压缩率。尽管有这些好处,这个格式并没有得到广泛使用。 * **Lzop 压缩** 这个压缩选项也许是 tar 最快的压缩格式,它的压缩率和 gzip 类似,但也没有广泛使用。 常见的格式是 tar.gz 和 tar.bz2。如果你想快速压缩,那么就是用 gzip。如果归档文件大小比较重要,就是用 tar.bz2。 ### tar 命令用来干什么? 下面是一些使用 tar 命令的常见情形。 * 备份服务器或桌面系统 * 文档归档 * 软件分发 ### 安装 tar 大部分 Linux 系统默认都安装了 tar。如果没有,这里有安装 tar 的命令。 #### CentOS 在 CentOS 中,以 root 用户在 shell 中执行下面的命令安装 tar。 ``` yum install tar ``` #### Ubuntu 下面的命令会在 Ubuntu 上安装 tar。“sudo” 命令确保 apt 命令是以 root 权限运行的。 ``` sudo apt-get install tar ``` #### Debian 下面的 apt 命令在 Debian 上安装 tar。 ``` apt-get install tar ``` #### Windows tar 命令在 Windows 也可以使用,你可以从 Gunwin 项目<http://gnuwin32.sourceforge.net/packages/gtar.htm>中下载它。 ### 创建 tar.gz 文件 下面是在 shell 中运行 [tar 命令](http://www.faqforge.com/linux/tar-command/) 的一些例子。下面我会解释这些命令行选项。 ``` tar pczf myarchive.tar.gz /home/till/mydocuments ``` 这个命令会创建归档文件 myarchive.tar.gz,其中包括了路径 /home/till/mydocuments 中的文件和目录。**命令行选项解释**: * **[p]** 这个选项表示 “preserve”,它指示 tar 在归档文件中保留文件属主和权限信息。 * **[c]** 表示创建。要创建文件时不能缺少这个选项。 * **[z]** z 选项启用 gzip 压缩。 * **[f]** file 选项告诉 tar 创建一个归档文件。如果没有这个选项 tar 会把输出发送到标准输出( LCTT 译注:如果没有指定,标准输出默认是屏幕,显然你不会想在屏幕上显示一堆乱码,通常你可以用管道符号送到其它程序去)。 #### Tar 命令示例 **示例 1: 备份 /etc 目录** 创建 /etc 配置目录的一个备份。备份保存在 root 目录。 ``` tar pczvf /root/etc.tar.gz /etc ``` ![用 tar 备份 /etc 目录](/data/attachment/album/201512/03/065148d5fthw6wpzzwe6wt.png) 要以 root 用户运行命令确保 /etc 中的所有文件都会被包含在备份中。这次,我在命令中添加了 [v] 选项。这个选项表示 verbose,它告诉 tar 显示所有被包含到归档文件中的文件名。 **示例 2: 备份你的 /home 目录** 创建你的 home 目录的备份。备份会被保存到 /backup 目录。 ``` tar czf /backup/myuser.tar.gz /home/myuser ``` 用你的用户名替换 myuser。这个命令中,我省略了 [p] 选项,也就不会保存权限。 **示例 3: 基于文件的 MySQL 数据库备份** 在大部分 Linux 发行版中,MySQL 数据库保存在 /var/lib/mysql。你可以使用下面的命令来查看: ``` ls /var/lib/mysql ``` ![使用 tar 基于文件备份 MySQL](/data/attachment/album/201512/03/065149amomzog7ulhln0zm.png) 用 tar 备份 MySQL 数据文件时为了保持数据一致性,首先停用数据库服务器。备份会被写到 /backup 目录。 1) 创建 backup 目录 ``` mkdir /backup chmod 600 /backup ``` 2) 停止 MySQL,用 tar 进行备份并重新启动数据库。 ``` service mysql stop tar pczf /backup/mysql.tar.gz /var/lib/mysql service mysql start ls -lah /backup ``` ![基于文件的 MySQL 备份](/data/attachment/album/201512/03/065151e3q2aba89fasazj1.png) ### 提取 tar.gz 文件 提取 tar.gz 文件的命令是: ``` tar xzf myarchive.tar.gz ``` #### tar 命令选项解释 * **[x]** x 表示提取,提取 tar 文件时这个命令不可缺少。 * **[z]** z 选项告诉 tar 要解压的归档文件是 gzip 格式。 * **[f]** 该选项告诉 tar 从一个文件中读取归档内容,本例中是 myarchive.tar.gz。 上面的 tar 命令会安静地提取 tar.gz 文件,除非有错误信息。如果你想要看提取了哪些文件,那么添加 “v” 选项。 ``` tar xzvf myarchive.tar.gz ``` **[v]** 选项表示 verbose,它会向你显示解压的文件名。 ![提取 tar.gz 文件](/data/attachment/album/201512/03/065152zwswhbnyh8y8hee7.png) --- via: <https://www.howtoforge.com/tutorial/linux-tar-command/> 作者:[howtoforge](https://www.howtoforge.com/) 译者:[ictlyh](http://mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
200
OK
# The Linux tar Command Explained The Linux [tar](https://en.wikipedia.org/wiki/Tar_(computing)) command is the swiss army knife of the Linux admin when it comes to archiving or distributing files. Gnu Tar archives can contain multiple files and directories, file permissions can be preserved and it supports multiple compression formats. The name tar stands for "**T**ape **Ar**chiver", the format is an official POSIX standard. ## Tar file formats A short introduction to tar compression levels. **No compression**Uncompressed files have the file ending .tar.**Gzip Compression**The Gzip format is the most widely used compression format for tar, it is fast for creating and extracting files. Files with gz compression have normally the file ending .tar.gz or .tgz. Below you will find some examples on how to create and extract a tar.gz file.**Bzip2 Compression**The Bzip2 format offers better compression than the Gzip format. Creating files is slower, the file ending is usually .tar.bz2.**Lzip (LZMA) Compression**The Lzip compression combines the speed of Gzip with a compression level that is similar to Bzip2 (or even better). Independently from these good attributes, this format is not widely used.**Lzop Compression**This compress option is probably the fastest compression format for tar, it has a compression level similar to gzip and is not widely used. The common formats are tar.gz and tar.bz2. If your goal is fast compression, then use gzip. When the archive file size is critical, then use tar.bz2. ## What is the tar command used for? Here a few common use cases of the tar command. - Backup of Servers and Desktops. - Document archiving. - Software Distribution. ## Installing tar The command is installed on most Linux systems by default. Here are the instructions to install tar in case that the command is missing. ### CentOS Execute the following command as root user on the shell to install tar on CentOS. yum install tar ### Ubuntu This command will install tar on Ubuntu. The "sudo" command ensures that the apt command is run with root privileges. sudo apt-get install tar ### Debian The following apt command installs tar on Debian. apt-get install tar ### Windows The tar command is available for Windows as well, you can download it from the Gunwin project. [http://gnuwin32.sourceforge.net/packages/gtar.htm](http://gnuwin32.sourceforge.net/packages/gtar.htm) ## Create tar.gz Files Here is the tar command that has to be run on the shell. I will explain the command-line options below. tar pczf myarchive.tar.gz /home/till/mydocuments This command creates the archive *myarchive.tar.gz* which contains the files and folders from the path */home/till/*mydocuments. **The command-line options explained:** **[p]**This option stands for "preserve", it instructs tar to store details on file owner and file permissions in the archive.**[c]**Stands for*create*. This option is mandatory when a file is created.**[z]**The z option enables gzip compression.**[f]**The file option tells tar to create an archive file. Tar will send the output to stdout if this option is omitted. ### Tar command examples **Example 1: Backup the /etc Directory** Create a backup of the /etc config directory. The backup is stored in the root folder. tar pczvf /root/etc.tar.gz /etc The command should be run as root to ensure that all files in /etc are included in the backup. This time, I've added the [v] option in the command. This option stands for verbose, it tells tar to show all file names that get added into the archive. **Example 2: Backup your /home directory** Create a backup of your home directory. The backup will be stored in a directory /backup. tar czf /backup/myuser.tar.gz /home/myuser Replace *myuser* with your username. In this command, I've omitted the [p] switch, so the permissions get not preserved. **Example 3: A file-based backup of MySQL databases** The MySQL databases are stored in /var/lib/mysql on most Linux distributions. You can check that with the command: ls /var/lib/mysql Stop the database server to get a consistent MySQL file backup with tar. The backup will be written to the /backup folder. 1) Create the backup folder mkdir /backup chmod 600 /backup 2) Stop MySQL, run the backup with tar and start the database server again. service mysql stop tar pczf /backup/mysql.tar.gz /var/lib/mysql service mysql start ls -lah /backup ## Extract tar.gz Files The command to extract tar.gz files is: tar xzf myarchive.tar.gz ### The tar command options explained **[x]**The x stand for extract, it is mandatory when a tar file shall be extracted.**[z]**The z option tells tar that the archive that shall be unpacked is in gzip format.**[f]**This option instructs tar to read the archive content from a file, in this case the file myarchive.tar.gz. The above tar command will silently extract that tar.gz file, it will show only error messages. If you like to see which files get extracted, then add the "v" option. tar xzvf myarchive.tar.gz The **[v]** option stands for verbose, it will show the file names while they get unpacked.
6,680
如何在 Ubuntu 16.04,15.10,14.04 中安装 GIMP 2.8.16
http://ubuntuhandbook.org/index.php/2015/11/how-to-install-gimp-2-8-16-in-ubuntu-16-04-15-10-14-04/
2015-12-03T13:45:00
[ "GIMP" ]
https://linux.cn/article-6680-1.html
![GIMP 2.8.16](/data/attachment/album/201512/03/074612zreh2jzy8z8pysru.png) GIMP 图像编辑器 2.8.16 版本在其20岁生日时发布了。下面是如何安装或升级 GIMP 在 Ubuntu 16.04, Ubuntu 15.10, Ubuntu 14.04, Ubuntu 12.04 及其衍生版本中,如 Linux Mint 17.x/13, Elementary OS Freya。 GIMP 2.8.16 支持 OpenRaster 文件中的层组,修复了 PSD 中的层组支持以及各种用户界面改进,修复了 OSX 上的构建系统,以及更多新的变化。请阅读 [官方声明](http://www.gimp.org/news/2015/11/22/20-years-of-gimp-release-of-gimp-2816/)。 ![GIMP image editor 2.8,16](/data/attachment/album/201512/03/074613evzxo3o1xfujlsmf.jpg) ### 如何安装或升级: 多亏了 Otto Meier,[Ubuntu PPA](https://launchpad.net/%7Eotto-kesselgulasch/+archive/ubuntu/gimp) 中最新的 GIMP 包可用于当前所有的 Ubuntu 版本和其衍生版。 **1. 添加 GIMP PPA** 从 Unity Dash 中打开终端,或通过 Ctrl+Alt+T 快捷键打开。在它打开它后,粘贴下面的命令并回车: ``` sudo add-apt-repository ppa:otto-kesselgulasch/gimp ``` ![add GIMP PPA](/data/attachment/album/201512/03/074613mgdm6xc6g4cxx9ze.jpg) 输入你的密码,密码不会在终端显示,然后回车继续。 **2. 安装或升级编辑器** 在添加了 PPA 后,启动 **Software Updater**(在 Mint 中是 Software Manager)。检查更新后,你将看到 GIMP 的更新列表。点击 “Install Now” 进行升级。 ![upgrade-gimp2816](/data/attachment/album/201512/03/074614pmc7hlyqgqy3j3ja.jpg) 对于那些喜欢 Linux 命令的,按顺序执行下面的命令,刷新仓库的缓存然后安装 GIMP: ``` sudo apt-get update sudo apt-get install gimp ``` **3. (可选的) 卸载** 如果你想卸载或降级 GIMP 图像编辑器。从软件中心直接删除它,或者按顺序运行下面的命令来将 PPA 清除并降级软件: ``` sudo apt-get install ppa-purge sudo ppa-purge ppa:otto-kesselgulasch/gimp ``` 就这样。玩的愉快! --- via: <http://ubuntuhandbook.org/index.php/2015/11/how-to-install-gimp-2-8-16-in-ubuntu-16-04-15-10-14-04/> 作者:[Ji m](http://ubuntuhandbook.org/index.php/about/) 译者:[strugglingyouth](https://github.com/strugglingyouth) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,688
PHP 7.0.0 正式版发布!
http://php.net/archive/2015.php#id2015-12-03-1
2015-12-04T08:00:00
[ "PHP" ]
https://linux.cn/article-6688-1.html
![](/data/attachment/album/201512/04/075939j1ckzisqko4qid1k.jpg) **PHP 开发团队宣布,PHP 7.0.0 已经正式发布了!**这标志着 PHP 正式进入崭新的 PHP 7 时代! PHP 7.0.0 使用了新的 <ruby> Zend 引擎 <rp> ( </rp> <rt> Zend Engine </rt> <rp> ) </rp></ruby>,有几个重大改进和新的功能: * 性能的极大提升:PHP 7 的性能接近上一个版本 PHP 5.6 的两倍 * 显著降低了其内存用量 * 支持 <ruby> 抽象语法树 <rp> ( </rp> <rt> Abstract Syntax Tree </rt> <rp> ) </rp></ruby> * 一致的64位支持 * 改进了<ruby> 异常 <rp> ( </rp> <rt> Exception </rt> <rp> ) </rp></ruby>的层次结构 * 许多<ruby> 致命错误 <rp> ( </rp> <rt> fatal errors </rt> <rp> ) </rp></ruby>转换为<ruby> 异常 <rp> ( </rp> <rt> Exceptions </rt> <rp> ) </rp></ruby> * 更安全的随机数生成器 * 去除老旧的、不支持的 SAPI 和扩展 * 新的空合并操作符 (??) * 返回类型申明和标量类型申明 * 匿名类 * 零成本断言 下载: * 源代码请访问 [下载页](http://www.php.net/downloads.php) * Windows 二进制可在 [windows.php.net/download/](http://windows.php.net/download/) 找到 完整的更新记录请参见 [ChangeLog](http://www.php.net/ChangeLog-7.php#7.0.0) 。 [迁移指南](http://php.net/manual/migration70.php) 已经放到了 PHP 手册当中,请关注新功能的细节和向后不兼容的变化。 由于要兼容最新的 OpenSSL 1.0.2e 发布,所以发布延误了,谢谢大家的耐心等待。 今天发布的不仅仅是 PHP 的下一代主版本,它也是我们这将近两年来的开发工作的成果。这是核心团队的殊胜成就,这与社区许多活跃成员令人难以置信的努力所分不开的。事实上,今天发布的不仅仅是一个新的版本,而是揭晓了一个潜力巨大的 PHP 新时代的到来。 这是 PHP 世界的伟大一天! 感谢所有的贡献者和支持者! (题图来自: digitalocean.com)
301
Moved Permanently
null
6,692
如何在 Ubuntu 15.04 中安装 puppet
http://linoxide.com/linux-how-to/install-puppet-ubuntu-15-04/
2015-12-05T09:32:57
[ "puppet" ]
/article-6692-1.html
大家好,本教程将学习如何在 ubuntu 15.04 上面安装 puppet,它可以用来管理你的服务器基础环境。puppet 是由 <ruby> puppet 实验室 <rp> ( </rp> <rt> Puppet Labs </rt> <rp> ) </rp></ruby>开发并维护的一款开源的配置管理软件,它能够帮我们自动化供给、配置和管理服务器的基础环境。不管我们管理的是几个服务器还是数以千计的计算机组成的业务报表体系,puppet 都能够使管理员从繁琐的手动配置调整中解放出来,腾出时间和精力去提系统的升整体效率。它能够确保所有自动化流程作业的一致性、可靠性以及稳定性。它让管理员和开发者更紧密的联系在一起,使开发者更容易产出付出设计良好、简洁清晰的代码。puppet 提供了配置管理和数据中心自动化的两个解决方案。这两个解决方案分别是 **puppet 开源版** 和 **puppet 企业版**。puppet 开源版以 Apache 2.0 许可证发布,它是一个非常灵活、可定制的解决方案,设置初衷是帮助管理员去完成那些重复性操作工作。pupprt 企业版是一个全平台复杂 IT 环境下的成熟解决方案,它除了拥有开源版本所有优势以外还有移动端 apps、只有商业版才有的加强支持,以及模块化和集成管理等。Puppet 使用 SSL 证书来认证主控服务器与代理节点之间的通信。 本教程将要介绍如何在运行 ubuntu 15.04 的主控服务器和代理节点上面安装开源版的 puppet。在这里,我们用一台服务器做<ruby> 主控服务器 <rp> ( </rp> <rt> master </rt> <rp> ) </rp></ruby>,管理和控制剩余的当作 puppet <ruby> 代理节点 <rp> ( </rp> <rt> agent node </rt> <rp> ) </rp></ruby>的服务器,这些代理节点将依据主控服务器来进行配置。在 ubuntu 15.04 只需要简单的几步就能安装配置好 puppet,用它来管理我们的服务器基础环境非常的方便。(LCTT 译注:puppet 采用 C/S 架构,所以必须有至少有一台作为服务器,其他作为客户端处理) ![](/data/attachment/album/201512/05/093245eiiz284dw4gw28i1.jpg) ### 1.设置主机文件 在本教程里,我们将使用2台运行 ubuntu 15.04 “Vivid Vervet" 的主机,一台作为主控服务器,另一台作为 puppet 的代理节点。下面是我们将用到的服务器的基础信息。 * puupet 主控服务器 IP:44.55.88.6 ,主机名: puppetmaster * puppet 代理节点 IP: 45.55.86.39 ,主机名: puppetnode 我们要在代理节点和服务器这两台机器的 hosts 文件里面都添加上相应的条目,使用 root 或是 sudo 访问权限来编辑 `/etc/hosts` 文件,命令如下: ``` # nano /etc/hosts 45.55.88.6 puppetmaster.example.com puppetmaster 45.55.86.39 puppetnode.example.com puppetnode ``` 注意,puppet 主控服务器必使用 8140 端口来运行,所以请务必保证开启8140端口。 ### 2. 用 NTP 更新时间 puppet 代理节点所使用系统时间必须要准确,这样可以避免代理证书出现问题。如果有时间差异,那么证书将过期失效,所以服务器与代理节点的系统时间必须互相同步。我们使用 NTP(<ruby> Network Time Protocol <rp> ( </rp> <rt> 网络时间协议 </rt> <rp> ) </rp></ruby>)来同步时间。**在服务器与代理节点上面分别**运行以下命令来同步时间。 ``` # ntpdate pool.ntp.org 17 Jun 00:17:08 ntpdate[882]: adjust time server 66.175.209.17 offset -0.001938 sec ``` (LCTT 译注:显示类似的输出结果表示运行正常) 如果没有安装 ntp,请使用下面的命令更新你的软件仓库,安装并运行ntp服务 ``` # apt-get update && sudo apt-get -y install ntp ; service ntp restart ``` ### 3. 安装主控服务器软件 安装开源版本的 puppet 有很多的方法。在本教程中我们在 puppet 实验室官网下载一个名为 puppetlabs-release 的软件包的软件源,安装后它将为我们在软件源里面添加 puppetmaster-passenger。puppetmaster-passenger 包括带有 apache 的 puppet 主控服务器。我们开始下载这个软件包: ``` # cd /tmp/ # wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb --2015-06-17 00:19:26-- https://apt.puppetlabs.com/puppetlabs-release-trusty.deb Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 7384 (7.2K) [application/x-debian-package] Saving to: ‘puppetlabs-release-trusty.deb’ puppetlabs-release-tr 100%[===========================>] 7.21K --.-KB/s in 0.06s 2015-06-17 00:19:26 (130 KB/s) - ‘puppetlabs-release-trusty.deb’ saved [7384/7384] ``` 下载完成,我们来安装它: ``` # dpkg -i puppetlabs-release-trusty.deb Selecting previously unselected package puppetlabs-release. (Reading database ... 85899 files and directories currently installed.) Preparing to unpack puppetlabs-release-trusty.deb ... Unpacking puppetlabs-release (1.0-11) ... Setting up puppetlabs-release (1.0-11) ... ``` 使用 apt 包管理命令更新一下本地的软件源: ``` # apt-get update ``` 现在我们就可以安装 puppetmaster-passenger 了 ``` # apt-get install puppetmaster-passenger ``` **提示**: 在安装的时候可能会报错: ``` Warning: Setting templatedir is deprecated.see http://links.puppetlabs.com/env-settings-deprecations (at /usr/lib/ruby/vendor_ruby/puppet/settings.rb:1139:in `issue_deprecation_warning') ``` 不过不用担心,忽略掉它就好,我们只需要在设置配置文件的时候把这一项禁用就行了。 如何来查看 puppet 主控服务器是否已经安装成功了呢?非常简单,只需要使用下面的命令查看它的版本就可以了。 ``` # puppet --version 3.8.1 ``` 现在我们已经安装好了 puppet 主控服务器。因为我们使用的是配合 apache 的 passenger,由 apache 来控制 puppet 主控服务器,当 apache 运行时 puppet 主控服务器才运行。 在开始之前,我们需要通过停止 apache 服务来让 puppet 主控服务器停止运行。 ``` # systemctl stop apache2 ``` ### 4. 使用 Apt 工具锁定主控服务器的版本 现在已经安装了 3.8.1 版的 puppet,我们锁定这个版本不让它随意升级,因为升级会造成配置文件混乱。 使用 apt 工具来锁定它,这里我们需要使用文本编辑器来创建一个新的文件 `/etc/apt/preferences.d/00-puppet.pref`: ``` # nano /etc/apt/preferences.d/00-puppet.pref ``` 在新创建的文件里面添加以下内容: ``` # /etc/apt/preferences.d/00-puppet.pref Package: puppet puppet-common puppetmaster-passenger Pin: version 3.8* Pin-Priority: 501 ``` 这样在以后的系统软件升级中, puppet 主控服务器将不会跟随系统软件一起升级。 ### 5. 配置 Puppet 主控服务器 Puppet 主控服务器作为一个证书发行机构,需要生成它自己的证书,用于签署所有代理的证书的请求。首先我们要删除所有在该软件包安装过程中创建出来的 ssl 证书。本地默认的 puppet 证书放在 `/var/lib/puppet/ssl`。因此我们只需要使用 `rm` 命令来整个移除这些证书就可以了。 ``` # rm -rf /var/lib/puppet/ssl ``` 现在来配置该证书,在创建 puppet 主控服务器证书时,我们需要包括代理节点与主控服务器沟通所用的每个 DNS 名称。使用文本编辑器来修改服务器的配置文件 `puppet.conf`: ``` # nano /etc/puppet/puppet.conf ``` 输出的结果像下面这样 ``` [main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter templatedir=$confdir/templates [master] # These are needed when the puppetmaster is run by passenger # and can safely be removed if webrick is used. ssl_client_header = SSL_CLIENT_S_DN ssl_client_verify_header = SSL_CLIENT_VERIFY ``` 在这我们需要注释掉 `templatedir` 这行使它失效。然后在文件的 `[main]` 小节的结尾添加下面的信息。 ``` server = puppetmaster environment = production runinterval = 1h strict_variables = true certname = puppetmaster dns_alt_names = puppetmaster, puppetmaster.example.com ``` 还有很多你可能用的到的配置选项。 如果你有需要,在 Puppet 实验室有一份详细的描述文件供你阅读: [Main Config File (puppet.conf)](https://docs.puppetlabs.com/puppet/latest/reference/config_file_main.html)。 编辑完成后保存退出。 使用下面的命令来生成一个新的证书。 ``` # puppet master --verbose --no-daemonize Info: Creating a new SSL key for ca Info: Creating a new SSL certificate request for ca Info: Certificate Request fingerprint (SHA256): F6:2F:69:89:BA:A5:5E:FF:7F:94:15:6B:A7:C4:20:CE:23:C7:E3:C9:63:53:E0:F2:76:D7:2E:E0:BF:BD:A6:78 ... Notice: puppetmaster has a waiting certificate request Notice: Signed certificate request for puppetmaster Notice: Removing file Puppet::SSL::CertificateRequest puppetmaster at '/var/lib/puppet/ssl/ca/requests/puppetmaster.pem' Notice: Removing file Puppet::SSL::CertificateRequest puppetmaster at '/var/lib/puppet/ssl/certificate_requests/puppetmaster.pem' Notice: Starting Puppet master version 3.8.1 ^CNotice: Caught INT; storing stop Notice: Processing stop ``` 至此,证书已经生成。一旦我们看到 `Notice: Starting Puppet master version 3.8.1`,就表明证书就已经制作好了。我们按下 `CTRL-C` 回到 shell 命令行。 查看新生成证书的信息,可以使用下面的命令。 ``` # puppet cert list -all + "puppetmaster" (SHA256) 33:28:97:86:A1:C3:2F:73:10:D1:FB:42:DA:D5:42:69:71:84:F0:E2:8A:01:B9:58:38:90:E4:7D:B7:25:23:EC (alt names: "DNS:puppetmaster", "DNS:puppetmaster.example.com") ``` ### 6. 创建一个 Puppet 清单 默认的主<ruby> 清单 <rp> ( </rp> <rt> Manifest </rt> <rp> ) </rp></ruby>是 `/etc/puppet/manifests/site.pp`。 这个主要清单文件包括了用于在代理节点执行的配置定义。现在我们来创建一个清单文件: ``` # nano /etc/puppet/manifests/site.pp ``` 在刚打开的文件里面添加下面这几行: ``` # execute 'apt-get update' exec { 'apt-update': # exec resource named 'apt-update' command => '/usr/bin/apt-get update' # command this resource will run } # install apache2 package package { 'apache2': require => Exec['apt-update'], # require 'apt-update' before installing ensure => installed, } # ensure apache2 service is running service { 'apache2': ensure => running, } ``` 以上这几行的意思是给代理节点部署 apache web 服务。 ### 7. 运行 puppet 主控服务 已经准备好运行 puppet 主控服务器 了,那么开启 apache 服务来让它启动 ``` # systemctl start apache2 ``` 我们 puppet 主控服务器已经运行,不过它还不能管理任何代理节点。现在我们给 puppet 主控服务器添加代理节点. **提示**: 如果报错 ``` Job for apache2.service failed. see "systemctl status apache2.service" and "journalctl -xe" for details. ``` 肯定是 apache 服务器有一些问题,我们可以使用 root 或是 sudo 访问权限来运行 `apachectl start`查看它输出的日志。在本教程执行过程中, 我们发现一个 `/etc/apache2/sites-enabled/puppetmaster.conf` 的证书配置问题。修改其中的 `SSLCertificateFile /var/lib/puppet/ssl/certs/server.pem` 为 `SSLCertificateFile /var/lib/puppet/ssl/certs/puppetmaster.pem`,然后注释掉后面这行 `SSLCertificateKeyFile` 。然后在命令行重新启动 apache。 ### 8. 安装 Puppet 代理节点的软件包 我们已经准备好了 puppet 的服务器,现在需要一个可以管理的代理节点,我们将安装 puppet 代理软件到节点上去。这里我们要给每一个需要管理的节点安装代理软件,并且确保这些节点能够通过 DNS 查询到服务器主机。下面将 安装最新的代理软件到 节点 puppetnode.example.com 上。 在代理节点上使用下面的命令下载 puppet 实验室提供的软件包: ``` # cd /tmp/ # wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb\ --2015-06-17 00:54:42-- https://apt.puppetlabs.com/puppetlabs-release-trusty.deb Resolving apt.puppetlabs.com (apt.puppetlabs.com)... 192.155.89.90, 2600:3c03::f03c:91ff:fedb:6b1d Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|192.155.89.90|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 7384 (7.2K) [application/x-debian-package] Saving to: ‘puppetlabs-release-trusty.deb’ puppetlabs-release-tr 100%[===========================>] 7.21K --.-KB/s in 0.04s 2015-06-17 00:54:42 (162 KB/s) - ‘puppetlabs-release-trusty.deb’ saved [7384/7384] ``` 在 ubuntu 15.04 上我们使用 debian 包管理系统来安装它,命令如下: ``` # dpkg -i puppetlabs-release-trusty.deb ``` 使用 apt 包管理命令更新一下本地的软件源: ``` # apt-get update ``` 通过远程仓库安装: ``` # apt-get install puppet ``` Puppet 代理默认是不启动的。这里我们需要使用文本编辑器修改 `/etc/default/puppet` 文件,使它正常工作: ``` # nano /etc/default/puppet ``` 更改 `START` 的值改成 "`yes`" 。 ``` START=yes ``` 最后保存并退出。 ### 9. 使用 Apt 工具锁定代理软件的版本 和上面的步骤一样为防止随意升级造成的配置文件混乱,我们要使用 apt 工具来把它锁定。具体做法是使用文本编辑器创建一个文件 `/etc/apt/preferences.d/00-puppet.pref`: ``` # nano /etc/apt/preferences.d/00-puppet.pref ``` 在新建的文件里面加入如下内容 ``` # /etc/apt/preferences.d/00-puppet.pref Package: puppet puppet-common Pin: version 3.8* Pin-Priority: 501 ``` 这样 puppet 就不会随着系统软件升级而随意升级了。 ### 10. 配置 puppet 代理节点 我们需要编辑一下代理节点的 `puppet.conf` 文件,来使它运行。 ``` # nano /etc/puppet/puppet.conf ``` 它看起来和服务器的配置文件完全一样。同样注释掉 `templatedir`这行。不同的是在这里我们需要删除掉所有关于`[master]` 的部分。 假定主控服务器可以通过名字“puppet-master”访问,我们的客户端应该可以和它相互连接通信。如果不行的话,我们需要使用完整的主机域名 `puppetmaster.example.com` ``` [agent] server = puppetmaster.example.com certname = puppetnode.example.com ``` 在文件的结尾增加上面3行,增加之后文件内容像下面这样: ``` [main] logdir=/var/log/puppet vardir=/var/lib/puppet ssldir=/var/lib/puppet/ssl rundir=/var/run/puppet factpath=$vardir/lib/facter #templatedir=$confdir/templates [agent] server = puppetmaster.example.com certname = puppetnode.example.com ``` 最后保存并退出。 使用下面的命令来启动客户端软件: ``` # systemctl start puppet ``` 如果一切顺利的话,我们不会看到命令行有任何输出。 第一次运行的时候,代理节点会生成一个 ssl 证书并且给服务器发送一个请求,经过签名确认后,两台机器就可以互相通信了。 **提示**: 如果这是你添加的第一个代理节点,建议你在添加其他节点前先给这个证书签名。一旦能够通过并正常运行,回过头来再添加其他代理节点。 ### 11. 在主控服务器上对证书请求进行签名 第一次运行的时候,代理节点会生成一个 ssl 证书并且给服务器发送一个签名请求。在主控服务器给代理节点服务器证书签名之后,主服务器才能和代理服务器通信并且控制代理服务器。 在主控服务器上使用下面的命令来列出当前的证书请求: ``` # puppet cert list "puppetnode.example.com" (SHA256) 31:A1:7E:23:6B:CD:7B:7D:83:98:33:8B:21:01:A6:C4:01:D5:53:3D:A0:0E:77:9A:77:AE:8F:05:4A:9A:50:B2 ``` 因为只设置了一台代理节点服务器,所以我们将只看到一个请求。看起来类似如上,代理节点的完整域名即其主机名。 注意有没有“+”号在前面,代表这个证书有没有被签名。 使用带有主机名的 `puppet cert sign`这个命令来签署这个签名请求,如下: ``` # puppet cert sign puppetnode.example.com Notice: Signed certificate request for puppetnode.example.com Notice: Removing file Puppet::SSL::CertificateRequest puppetnode.example.com at '/var/lib/puppet/ssl/ca/requests/puppetnode.example.com.pem' ``` 主控服务器现在可以通讯和控制它签名过的代理节点了。 如果想签署所有的当前请求,可以使用 `-all` 选项,如下所示: ``` # puppet cert sign --all ``` ### 12. 删除一个 Puppet 证书 如果我们想移除一个主机,或者想重建一个主机然后再添加它。下面的例子里我们将展示如何删除 puppet 主控服务器上面的一个证书。使用的命令如下: ``` # puppet cert clean hostname Notice: Revoked certificate with serial 5 Notice: Removing file Puppet::SSL::Certificate puppetnode.example.com at '/var/lib/puppet/ssl/ca/signed/puppetnode.example.com.pem' Notice: Removing file Puppet::SSL::Certificate puppetnode.example.com at '/var/lib/puppet/ssl/certs/puppetnode.example.com.pem' ``` 如果我们想查看所有的签署和未签署的请求,使用下面这条命令: ``` # puppet cert list --all + "puppetmaster" (SHA256) 33:28:97:86:A1:C3:2F:73:10:D1:FB:42:DA:D5:42:69:71:84:F0:E2:8A:01:B9:58:38:90:E4:7D:B7:25:23:EC (alt names: "DNS:puppetmaster", "DNS:puppetmaster.example.com") ``` ### 13. 部署 Puppet 清单 当配置并完成 puppet 清单后,现在我们需要部署清单到代理节点服务器上。要应用并加载主 puppet 清单,我们可以在代理节点服务器上面使用下面的命令: ``` # puppet agent --test Info: Retrieving pluginfacts Info: Retrieving plugin Info: Caching catalog for puppetnode.example.com Info: Applying configuration version '1434563858' Notice: /Stage[main]/Main/Exec[apt-update]/returns: executed successfully Notice: Finished catalog run in 10.53 seconds ``` 这里向我们展示了主清单如何立即影响到了一个单一的服务器。 如果我们打算运行的 puppet 清单与主清单没有什么关联,我们可以简单使用 `puppet apply` 带上相应的清单文件的路径即可。它仅将清单应用到我们运行该清单的代理节点上。 ``` # puppet apply /etc/puppet/manifest/test.pp ``` ### 14. 为特定节点配置清单 如果我们想部署一个清单到某个特定的节点,我们需要如下配置清单。 在主控服务器上面使用文本编辑器编辑 `/etc/puppet/manifest/site.pp`: ``` # nano /etc/puppet/manifest/site.pp ``` 添加下面的内容进去 ``` node 'puppetnode', 'puppetnode1' { # execute 'apt-get update' exec { 'apt-update': # exec resource named 'apt-update' command => '/usr/bin/apt-get update' # command this resource will run } # install apache2 package package { 'apache2': require => Exec['apt-update'], # require 'apt-update' before installing ensure => installed, } # ensure apache2 service is running service { 'apache2': ensure => running, } } ``` 这里的配置显示我们将在名为 puppetnode 和 puppetnode1 的2个指定的节点上面安装 apache 服务。这里可以添加其他我们需要安装部署的具体节点进去。 ### 15. 配置清单模块 模块对于组合任务是非常有用的,在 Puppet 社区有很多人贡献了自己的模块组件。 在主控服务器上, 我们将使用 `puppet module` 命令来安装 `puppetlabs-apache` 模块。 ``` # puppet module install puppetlabs-apache ``` **警告**: 千万不要在一个已经部署 apache 环境的机器上面使用这个模块,否则它将清空你没有被 puppet 管理的 apache 配置。 现在用文本编辑器来修改 `site.pp` : ``` # nano /etc/puppet/manifest/site.pp ``` 添加下面的内容进去,在 puppetnode 上面安装 apache 服务。 ``` node 'puppet-node' { class { 'apache': } # use apache module apache::vhost { 'example.com': # define vhost resource port => '80', docroot => '/var/www/html' } } ``` 保存退出。然后重新运行该清单来为我们的代理节点部署 apache 配置。 ### 总结 现在我们已经成功的在 ubuntu 15.04 上面部署并运行 puppet 来管理代理节点服务器的基础运行环境。我们学习了 puppet 是如何工作的,编写清单文件,节点与主机间使用 ssl 证书认证的认证过程。使用 puppet 开源软件配置管理工具在众多的代理节点上来控制、管理和配置重复性任务是非常容易的。如果你有任何的问题,建议,反馈,与我们取得联系,我们将第一时间完善更新,谢谢。 --- via: <http://linoxide.com/linux-how-to/install-puppet-ubuntu-15-04/> 作者:[Arun Pyasi](http://linoxide.com/author/arunp/) 译者:[ivo-wang](https://github.com/ivo-wang) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /linux-how-to/install-puppet-ubuntu-15-04/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b8327581240>, 'Connection to linoxide.com timed out. (connect timeout=10)'))
null
6,696
RHCE 系列(八):在 Apache 上使用网络安全服务(NSS)实现 HTTPS
http://www.tecmint.com/create-apache-https-self-signed-certificate-using-nss/
2015-12-06T09:00:00
[ "RHCE", "HTTPS", "NSS" ]
https://linux.cn/article-6696-1.html
如果你是一个负责维护和确保 web 服务器安全的系统管理员,你需要花费最大的精力确保服务器中处理和通过的数据任何时候都受到保护。 ![使用 SSL/TLS 设置 Apache HTTPS](/data/attachment/album/201512/05/231234fbw8pwe707wienue.png) *RHCE 系列:第八部分 - 使用网络安全服务(NSS)为 Apache 通过 TLS 实现 HTTPS* 为了在客户端和服务器之间提供更安全的连接,作为 HTTP 和 SSL(<ruby> Secure Sockets Layer <rp> ( </rp> <rt> 安全套接层 </rt> <rp> ) </rp></ruby>)或者最近称为 TLS(<ruby> Transport Layer Security <rp> ( </rp> <rt> 传输层安全 </rt> <rp> ) </rp></ruby>)的组合,产生了 HTTPS 协议。 由于一些严重的安全漏洞,SSL 已经被更健壮的 TLS 替代。由于这个原因,在这篇文章中我们会解析如何通过 TLS 实现你 web 服务器和客户端之间的安全连接。 这里假设你已经安装并配置好了 Apache web 服务器。如果还没有,在进入下一步之前请阅读下面站点中的文章。 * [在 RHEL/CentOS 7 上安装 LAMP(Linux,MySQL/MariaDB,Apache 和 PHP)](/article-5789-1.html) ### 安装 OpenSSL 和一些工具包 首先,确保正在运行 Apache 并且允许 http 和 https 通过防火墙: ``` # systemctl start http # systemctl enable http # firewall-cmd --permanent –-add-service=http # firewall-cmd --permanent –-add-service=https ``` 然后安装一些必需的软件包: ``` # yum update && yum install openssl mod_nss crypto-utils ``` **重要**:请注意如果你想使用 OpenSSL 库而不是 NSS(<ruby> Network Security Service <rp> ( </rp> <rt> 网络安全服务 </rt> <rp> ) </rp></ruby>)实现 TLS,你可以在上面的命令中用 mod\_ssl 替换 mod\_nss(使用哪一个取决于你,但在这篇文章中我们会使用 NSS,因为它更加安全,比如说,它支持最新的加密标准,比如 PKCS #11)。 如果你使用 mod\_nss,首先要卸载 mod\_ssl,反之如此。 ``` # yum remove mod_ssl ``` ### 配置 NSS(网络安全服务) 安装完 mod\_nss 之后,会创建默认的配置文件 `/etc/httpd/conf.d/nss.conf`。你应该确保所有 Listen 和 VirualHost 指令都指向 443 号端口(HTTPS 默认端口): nss.conf – 配置文件 --- ``` Listen 443 VirtualHost _default_:443 ``` 然后重启 Apache 并检查是否加载了 mod\_nss 模块: ``` # apachectl restart # httpd -M | grep nss ``` ![在 Apache 中检查 mod_nss 模块](/data/attachment/album/201512/05/231235mzuf4mcglmylxuf4.png) 检查 Apache 是否加载 mod\_nss 模块 下一步,在 `/etc/httpd/conf.d/nss.conf` 配置文件中做以下更改: 1、 指定 NSS 数据库目录。你可以使用默认的目录或者新建一个。本文中我们使用默认的: ``` NSSCertificateDatabase /etc/httpd/alias ``` 2、 通过保存密码到数据库目录中的 `/etc/httpd/nss-db-password.conf` 文件来避免每次系统启动时要手动输入密码: ``` NSSPassPhraseDialog file:/etc/httpd/nss-db-password.conf ``` 其中 `/etc/httpd/nss-db-password.conf` 只包含以下一行,其中 mypassword 是后面你为 NSS 数据库设置的密码: ``` internal:mypassword ``` 另外,要设置该文件的权限和属主为 0640 和 root:apache: ``` # chmod 640 /etc/httpd/nss-db-password.conf # chgrp apache /etc/httpd/nss-db-password.conf ``` 3、 由于 POODLE SSLv3 漏洞,红帽建议停用 SSL 和 TLSv1.0 之前所有版本的 TLS(更多信息可以查看[这里](https://access.redhat.com/articles/1232123))。 确保 NSSProtocol 指令的每个实例都类似下面一样(如果你没有托管其它虚拟主机,很可能只有一条): ``` NSSProtocol TLSv1.0,TLSv1.1 ``` 4、 由于这是一个自签名证书,Apache 会拒绝重启,并不会识别为有效发行人。由于这个原因,对于这种特殊情况我们还需要添加: ``` NSSEnforceValidCerts off ``` 5、 虽然并不是严格要求,为 NSS 数据库设置一个密码同样很重要: ``` # certutil -W -d /etc/httpd/alias ``` ![为 NSS 数据库设置密码](/data/attachment/album/201512/05/231236yo2eovtaffdedvzv.png) *为 NSS 数据库设置密码* ### 创建一个 Apache SSL 自签名证书 下一步,我们会创建一个自签名证书来让我们的客户机可以识别服务器(请注意这个方法对于生产环境并不是最好的选择;对于生产环境你应该考虑购买第三方可信证书机构验证的证书,例如 DigiCert)。 我们用 genkey 命令为 box1 创建有效期为 365 天的 NSS 兼容证书。完成这一步后: ``` # genkey --nss --days 365 box1 ``` 选择 Next: ![创建 Apache SSL 密钥](/data/attachment/album/201512/05/231237zsycaga2v5qm7rmk.png) *创建 Apache SSL 密钥* 你可以使用默认的密钥大小(2048),然后再次选择 Next: ![选择 Apache SSL 密钥大小](/data/attachment/album/201512/05/231239udizt1vqbt2vbqbh.png) *选择 Apache SSL 密钥大小* 等待系统生成随机比特: ![生成随机密钥比特](/data/attachment/album/201512/05/231240hct2iztw22xlq22n.png) *生成随机密钥比特* 为了加快速度,会提示你在控制台输入随机字符,正如下面的截图所示。请注意当没有从键盘接收到输入时进度条是如何停止的。然后,会让你选择: 1. 是否发送验证签名请求(CSR)到一个验证机构(CA):选择 No,因为这是一个自签名证书。 2. 为证书输入信息。 最后,会提示你输入之前给 NSS 证书设置的密码: ``` # genkey --nss --days 365 box1 ``` ![Apache NSS 证书密码](/data/attachment/album/201512/05/231241h8bz4efabccqc8fy.png) *Apache NSS 证书密码* 需要的话,你可以用以下命令列出现有的证书: ``` # certutil –L –d /etc/httpd/alias ``` ![列出 Apache NSS 证书](/data/attachment/album/201512/05/231243qli0ki5gm9zy95hk.png) *列出 Apache NSS 证书* 然后通过名字删除(如果你真的需要删除的,用你自己的证书名称替换 box1): ``` # certutil -d /etc/httpd/alias -D -n "box1" ``` 如果你需要继续进行的话,请继续阅读。 ### 测试 Apache SSL HTTPS 连接 最后,是时候测试到我们服务器的安全连接了。当你用浏览器打开 https://<web 服务器 IP 或主机名>,你会看到著名的信息 “This connection is untrusted”: ![检查 Apache SSL 连接](/data/attachment/album/201512/05/231250jknhchc8c8g7wic6.png) *检查 Apache SSL 连接* 在上面的情况中,你可以点击<ruby> 添加例外 <rp> ( </rp> <rt> Add Exception </rt> <rp> ) </rp></ruby> 然后<ruby> 确认安全例外 <rp> ( </rp> <rt> Confirm Security Exception </rt> <rp> ) </rp></ruby> - 但先不要这么做。让我们首先来看看证书看它的信息是否和我们之前输入的相符(如截图所示)。 要做到这点,点击上面的<ruby> 视图 <rp> ( </rp> <rt> View... </rt> <rp> ) </rp></ruby>-> <ruby> 详情 <rp> ( </rp> <rt> Details </rt> <rp> ) </rp></ruby>选项卡,当你从列表中选择发行人你应该看到这个: ![确认 Apache SSL 证书详情](/data/attachment/album/201512/05/231251ph47aahy7878mrae.png) *确认 Apache SSL 证书详情* 现在你可以继续,确认例外(限于此次或永久),然后会通过 https 把你带到你 web 服务器的 DocumentRoot 目录,在这里你可以使用你浏览器自带的开发者工具检查连接详情: 在火狐浏览器中,你可以通过在屏幕中右击,然后从上下文菜单中选择<ruby> 检查元素 <rp> ( </rp> <rt> Inspect Element </rt> <rp> ) </rp></ruby>启动开发者工具,尤其要看“<ruby> 网络 <rp> ( </rp> <rt> Network </rt> <rp> ) </rp></ruby>”选项卡: ![检查 Apache HTTPS 连接](/data/attachment/album/201512/05/231255w29pdj29fsfeejjp.png) *检查 Apache HTTPS 连接* 请注意这和之前显示的在验证过程中输入的信息一致。还有一种方式通过使用命令行工具测试连接: 左图(测试 SSLv3): ``` # openssl s_client -connect localhost:443 -ssl3 ``` 右图(测试 TLS): ``` # openssl s_client -connect localhost:443 -tls1 ``` ![测试 Apache SSL 和 TLS 连接](/data/attachment/album/201512/05/231308j6ckbs4bjhr14jdh.png) *测试 Apache SSL 和 TLS 连接* 参考上面的截图了解更详细信息。 ### 总结 我想你已经知道,使用 HTTPS 会增加会在你站点中输入个人信息的访客的信任(从用户名和密码到任何商业/银行账户信息)。 在那种情况下,你会希望获得由可信验证机构签名的证书,正如我们之前解释的(步骤和设置需要启用例外的证书的步骤相同,发送 CSR 到 CA 然后获得返回的签名证书);否则,就像我们的例子中一样使用自签名证书即可。 要获取更多关于使用 NSS 的详情,可以参考关于 [mod-nss](https://git.fedorahosted.org/cgit/mod_nss.git/plain/docs/mod_nss.html) 的在线帮助。如果你有任何疑问或评论,请告诉我们。 --- via: <http://www.tecmint.com/create-apache-https-self-signed-certificate-using-nss/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](http://www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,699
RHCE 系列(九):如何使用无客户端配置 Postfix 邮件服务器(SMTP)
http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/
2015-12-07T10:27:00
[ "RHCE", "SMTP" ]
https://linux.cn/article-6699-1.html
尽管现在有很多在线联系方式,电子邮件仍然是一个人传递信息给远在世界尽头或办公室里坐在我们旁边的另一个人的有效方式。 下面的图描述了电子邮件从发送者发出直到信息到达接收者收件箱的传递过程。 ![电子邮件如何工作](/data/attachment/album/201512/06/213226iooi9z5tjhm5noca.png) *电子邮件如何工作* 要实现这一切,背后发生了好多事情。为了使电子邮件信息从一个客户端应用程序(例如 [Thunderbird](http://www.tecmint.com/install-thunderbird-17-in-ubuntu-xubuntu-linux-mint/)、Outlook,或者 web 邮件服务,例如 Gmail 或 Yahoo 邮件)投递到一个邮件服务器,并从其投递到目标服务器并最终到目标接收人,每个服务器上都必须有 SMTP(简单邮件传输协议)服务。 这就是为什么我们要在这篇博文中介绍如何在 RHEL 7 中设置 SMTP 服务器,从本地用户发送的邮件(甚至发送到另外一个本地用户)被<ruby> 转发 <rp> ( </rp> <rt> forward </rt> <rp> ) </rp></ruby>到一个中央邮件服务器以便于访问。 在这个考试的要求中这称为<ruby> 无客户端 <rp> ( </rp> <rt> null-client </rt> <rp> ) </rp></ruby>安装。 在我们的测试环境中将包括一个<ruby> 起源 <rp> ( </rp> <rt> originating </rt> <rp> ) </rp></ruby>邮件服务器和一个中央服务器或<ruby> 中继主机 <rp> ( </rp> <rt> relayhost </rt> <rp> ) </rp></ruby>。 * 起源邮件服务器: (主机名: box1.mydomain.com / IP: 192.168.0.18) * 中央邮件服务器: (主机名: mail.mydomain.com / IP: 192.168.0.20) 我们在两台机器中都会使用你熟知的 `/etc/hosts` 文件做名字解析: ``` 192.168.0.18 box1.mydomain.com box1 192.168.0.20 mail.mydomain.com mail ``` ### 安装 Postfix 和防火墙/SELinux 注意事项 首先,我们需要(在两台机器上): **1、 安装 Postfix:** ``` # yum update && yum install postfix ``` **2、 启动服务并启用开机自动启动:** ``` # systemctl start postfix # systemctl enable postfix ``` **3、 允许邮件流量通过防火墙:** ``` # firewall-cmd --permanent --add-service=smtp # firewall-cmd --add-service=smtp ``` ![在防火墙中开通邮件服务器端口](/data/attachment/album/201512/06/213227t16qe1egz1q2rhc2.png) *在防火墙中开通邮件服务器端口* **4、 在 box1.mydomain.com 配置 Postfix** Postfix 的主要配置文件是 `/etc/postfix/main.cf`。这个文件本身是一个很大的文本文件,因为其中包含了解释程序设置的用途的注释。 为了简洁,我们只显示了需要编辑的行(没错,在起源服务器中你需要保留 `mydestination` 为空;否则邮件会被存储到本地,而不是我们实际想要发往的中央邮件服务器): ``` myhostname = box1.mydomain.com mydomain = mydomain.com myorigin = $mydomain inet_interfaces = loopback-only mydestination = relayhost = 192.168.0.20 ``` **5、 在 mail.mydomain.com 配置 Postfix** ``` myhostname = mail.mydomain.com mydomain = mydomain.com myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks = 192.168.0.0/24, 127.0.0.0/8 ``` 如果还没有设置,还要设置相关的 SELinux 布尔值永久为真: ``` # setsebool -P allow_postfix_local_write_mail_spool on ``` ![设置 Postfix SELinux 权限](/data/attachment/album/201512/06/213227nxrgkw0owlwwrwsx.png) *设置 Postfix SELinux 权限* 上面的 SELinux 布尔值会允许中央服务器上的 Postfix 可以写入<ruby> 邮件池 <rp> ( </rp> <rt> mail spool </rt> <rp> ) </rp></ruby>。 **6、 在两台机子上重启服务以使更改生效:** ``` # systemctl restart postfix ``` 如果 Postfix 没有正确启动,你可以使用下面的命令进行错误处理。 ``` # systemctl -l status postfix # journalctl -xn # postconf -n ``` ### 测试 Postfix 邮件服务 要测试邮件服务器,你可以使用任何<ruby> 邮件用户代理 <rp> ( </rp> <rt> Mail User Agent,MUA </rt> <rp> ) </rp></ruby>,例如 [mail 或 mutt](http://www.tecmint.com/send-mail-from-command-line-using-mutt-command/)。 由于我个人喜欢 mutt,我会在 box1 中使用它发送邮件给用户 tecmint,并把现有文件(mailbody.txt)作为信息内容: ``` # mutt -s "Part 9-RHCE series" [email protected] < mailbody.txt ``` ![测试 Postfix 邮件服务器](/data/attachment/album/201512/06/213228vt5sszfoeyfeeyhn.png) *测试 Postfix 邮件服务器* 现在到中央邮件服务器(mail.mydomain.com)以 tecmint 用户登录,并检查是否收到了邮件: ``` # su – tecmint # mail ``` ![检查 Postfix 邮件服务器发送](/data/attachment/album/201512/06/213230ffa1kjcaqwqwco5z.png) *检查 Postfix 邮件服务器发送* 如果没有收到邮件,检查 root 用户的邮件池看看是否有警告或者错误提示。你也许需要使用 [nmap 命令](http://www.tecmint.com/nmap-command-examples/)确保两台服务器运行了 SMTP 服务,并在中央邮件服务器中打开了 25 号端口: ``` # nmap -PN 192.168.0.20 ``` ![Postfix 邮件服务器错误处理](/data/attachment/album/201512/06/213232c424fzdii52p3q1q.png) *Postfix 邮件服务器错误处理* ### 总结 像本文中展示的设置邮件服务器和中继主机是每个系统管理员必须拥有的重要技能,也代表了理解和安装更复杂情景的基础,例如一个邮件服务器托管有多个邮件账户(甚至成百上千)的域名。 (请注意这种类型的设置需要有 DNS 服务器,这不在本文的介绍范围),但你可以参照下面的文章设置 DNS 服务器: * [在 CentOS/RHEL 07 上配置仅缓存的 DNS 服务器](http://www.tecmint.com/setup-dns-cache-server-in-centos-7/) 最后,我强烈建议你熟悉 Postfix 的配置文件(main.cf)和这个程序的帮助手册。如果有任何疑问,别犹豫,使用下面的评论框或者我们的论坛 Linuxsay.com 告诉我们吧,你会从世界各地的 Linux 高手中获得几乎是及时的帮助。 --- via: <http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/> 作者:[Gabriel Cánepa](http://www.tecmint.com/author/gacanepa/) 译者:[ictlyh](https//www.mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,700
RHCE 系列(十):在 RHEL/CentOS 7 中设置 NTP(网络时间协议)服务器
http://www.tecmint.com/install-ntp-server-in-centos/
2015-12-08T10:21:00
[ "RHCE", "NTP" ]
https://linux.cn/article-6700-1.html
网络时间协议 - NTP - 是运行在传输层 123 号端口的 UDP 协议,它允许计算机通过网络同步准确时间。随着时间的流逝,计算机内部时间会出现漂移,这会导致时间不一致问题,尤其是对于服务器和客户端日志文件,或者你想要复制服务器的资源或数据库。 ![在 CentOS 上安装 NTP 服务器](/data/attachment/album/201512/06/222345zvhza8nvpwlhwxoo.png) *在 CentOS 和 RHEL 7 上安装 NTP 服务器* #### 前置要求: * [CentOS 7 安装过程](http://www.tecmint.com/centos-7-installation/) * [RHEL 安装过程](http://www.tecmint.com/redhat-enterprise-linux-7-installation/) #### 额外要求: * [注册并启用 RHEL 7 更新订阅](http://www.tecmint.com/enable-redhat-subscription-reposiories-and-updates-for-rhel-7/) * [在 CentOS/RHCE 7 上配置静态 IP](http://www.tecmint.com/configure-network-interface-in-rhel-centos-7-0/) * [在 CentOS/RHEL 7 上停用并移除不需要的服务](http://www.tecmint.com/remove-unwanted-services-in-centos-7/) 这篇指南会告诉你如何在 CentOS/RHCE 7 上安装和配置 NTP 服务器,并使用 <ruby> NTP 公共时间服务器池 <rp> ( </rp> <rt> NTP Public Pool Time Servers </rt> <rp> ) </rp></ruby>列表中和你服务器地理位置最近的可用节点中同步时间。 #### 步骤一:安装和配置 NTP 守护进程 1、 官方 CentOS /RHEL 7 库默认提供 NTP 服务器安装包,可以通过使用下面的命令安装。 ``` # yum install ntp ``` ![在 CentOS 上安装 NTP 服务器](/data/attachment/album/201512/06/222347s2ygmygxymxr16qg.png) *安装 NTP 服务器* 2、 安装完服务器之后,首先到官方 <ruby> <a href="http://www.pool.ntp.org/en/"> NTP 公共时间服务器池 </a> <rp> ( </rp> <rt> NTP Public Pool Time Servers </rt> <rp> ) </rp></ruby>,选择你服务器物理位置所在的洲,然后搜索你的国家位置,然后会出现 NTP 服务器列表。 ![NTP 服务器池](/data/attachment/album/201512/06/222404q543a8948t4ojgto.png) *NTP 服务器池* 3、 然后打开编辑 NTP 守护进程的主配置文件,注释掉来自 pool.ntp.org 项目的公共服务器默认列表,并用类似下面截图中提供给你所在国家的列表替换。(LCTT 译注:中国使用 0.cn.pool.ntp.org 等) ![在 CentOS 中配置 NTP 服务器](/data/attachment/album/201512/06/222408sgrlkgg9erg70r90.png) *配置 NTP 服务器* 4、 下一步,你需要允许来自你的网络的客户端和这台服务器同步时间。为了做到这点,添加下面一行到 NTP 配置文件,其中 **restrict** 语句控制允许哪些网络查询和同步时间 - 请根据需要替换网络 IP。 ``` restrict 192.168.1.0 netmask 255.255.255.0 nomodify notrap ``` **nomodify notrap** 语句意味着不允许你的客户端配置服务器或者作为同步时间的节点。 5、 如果你需要用于错误处理的额外信息,以防你的 NTP 守护进程出现问题,添加一个 logfile 语句,用于记录所有 NTP 服务器问题到一个指定的日志文件。 ``` logfile /var/log/ntp.log ``` ![在 CentOS 中启用 NTP 日志](/data/attachment/album/201512/06/222417s4fzngrwdsk6fzok.png) *启用 NTP 日志* 6、 在你编辑完所有上面解释的配置并保存关闭 ntp.conf 文件后,你最终的配置看起来像下面的截图。 ![CentOS 中 NTP 服务器的配置](/data/attachment/album/201512/06/222444ovcx7mm3cjccmwck.png) *NTP 服务器配置* ### 步骤二:添加防火墙规则并启动 NTP 守护进程 7、 NTP 服务使用 OSI 传输层(第四层)的 123 号 UDP 端口。它是为了避免可变延迟的影响所特别设计的。要在 RHEL/CentOS 7 中开放这个端口,可以对 Firewalld 服务使用下面的命令。 ``` # firewall-cmd --add-service=ntp --permanent # firewall-cmd --reload ``` ![在 Firewall 中开放 NTP 端口](/data/attachment/album/201512/06/222448j7fk2gyi3g43dk2f.png) *在 Firewall 中开放 NTP 端口* 8、 你在防火墙中开放了 123 号端口之后,启动 NTP 服务器并确保系统范围内可用。用下面的命令管理服务。 ``` # systemctl start ntpd # systemctl enable ntpd # systemctl status ntpd ``` ![启动 NTP 服务](/data/attachment/album/201512/06/222523ubmy38e8umy8rryb.png) *启动 NTP 服务* ### 步骤三:验证服务器时间同步 9、 启动了 NTP 守护进程后,用几分钟等服务器和它的服务器池列表同步时间,然后运行下面的命令验证 NTP 节点同步状态和你的系统时间。 ``` # ntpq -p # date -R ``` ![验证 NTP 服务器时间](/data/attachment/album/201512/06/222527tzo4h2a4b28bcdbh.png) *验证 NTP 时间同步* 10、 如果你想查询或者和你选择的服务器池同步,你可以使用 ntpdate 命令,后面跟服务器名或服务器地址,类似下面建议的命令行示例。 ``` # ntpdate -q 0.ro.pool.ntp.org 1.ro.pool.ntp.org ``` ![同步 NTP 同步](/data/attachment/album/201512/06/222535x1i841o1cu1r8h4y.png) *同步 NTP 时间* ### 步骤四:设置 Windows NTP 客户端 11、 如果你的 windows 机器不是域名控制器的一部分,你可以配置 Windows 和你的 NTP服务器同步时间。在任务栏右边 -> 时间 -> 更改日期和时间设置 -> 网络时间标签 -> 更改设置 -> 和一个网络时间服务器检查同步 -> 在 Server 空格输入服务器 IP 或 FQDN -> 马上更新 -> OK。 ![和 NTP 同步 Windows 时间](/data/attachment/album/201512/06/222552nmgjhzhttwupuuaj.png) *和 NTP 同步 Windows 时间* 就是这些。在你的网络中配置一个本地 NTP 服务器能确保你所有的服务器和客户端有相同的时间设置,以防出现网络连接失败,并且它们彼此都相互同步。 --- via: <http://www.tecmint.com/install-ntp-server-in-centos/> 作者:[Matei Cezar](http://www.tecmint.com/author/cezarmatei/) 译者:[ictlyh](http://motouxiaogui.cn/blog) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
301
Moved Permanently
null
6,715
如何在 CentOS 7.x 上安装 Zephyr 测试管理工具
http://linoxide.com/linux-how-to/setup-zephyr-tool-centos-7-x/
2015-12-10T09:05:00
[ "测试", "Zephyr" ]
/article-6715-1.html
<ruby> 测试管理 <rp> ( </rp> <rt> Test Management </rt> <rp> ) </rp></ruby>指测试人员所需要的任何的所有东西。测试管理工具用来记录测试执行的结果、计划测试活动以及汇报质量控制活动的情况。在这篇文章中我们会向你介绍如何配置 Zephyr 测试管理工具,它包括了管理测试活动需要的所有东西,不需要单独安装测试活动所需要的应用程序从而降低测试人员不必要的麻烦。一旦你安装完它,你就看可以用它跟踪 bug 和缺陷,和你的团队成员协作项目任务,因为你可以轻松地共享和访问测试过程中多个项目团队的数据。 ![](/data/attachment/album/201512/09/200618siq8kr5n5oc5rwvr.png) ### Zephyr 要求 安装和运行 Zephyr 要求满足以下最低条件。可以根据你的基础设施提高资源。我们会在 64 位 CentOS-7 系统上安装 Zephyr,几乎在所有的 Linux 操作系统中都有可用的 Zephyr 二进制发行版。 注:表格 | | | --- | | **Zephyr test management tool** | | **Linux OS** | CentOS Linux 7 (Core), 64-bit | | | **Packages** | JDK 7 或更高 , Oracle JDK 6 update | 没有事先安装的 Tomcat 和 MySQL | | **RAM** | 4 GB | 推荐 8 GB | | **CPU** | 2.0 GHZ 或更高 | | **Hard Disk** | 30 GB , 至少 5GB | 安装 Zephyr 要求你有超级用户(root)权限,并确保你已经正确配置了网络的静态 IP ,默认端口必须可用并允许通过防火墙。其中 tomcat 会使用 80/443、 8005、 8009、 8010 端口, Zephyr 内部使用 RTMP 协议的 flex 会使用 443 和 2099 号端口。 ### 安装 Java JDK 7 安装 Zephyr 首先需要安装 Java JDK 7,如果你的系统上还没有安装,可以按照下面的方法安装 Java 并设置 JAVA\_HOME 环境变量。 输入以下的命令安装 Java JDK 7。 ``` [root@centos-007 ~]# yum install java-1.7.0-openjdk-1.7.0.79-2.5.5.2.el7_1 [root@centos-007 ~]# yum install java-1.7.0-openjdk-devel-1.7.0.85-2.6.1.2.el7_1.x86_64 ``` 安装完 java 和它的所有依赖后,运行下面的命令设置 JAVA\_HOME 环境变量。 ``` [root@centos-007 ~]# export JAVA_HOME=/usr/java/default [root@centos-007 ~]# export PATH=/usr/java/default/bin:$PATH ``` 用下面的命令检查 java 版本以验证安装。 ``` [root@centos-007 ~]# java –version java version "1.7.0_79" OpenJDK Runtime Environment (rhel-2.5.5.2.el7_1-x86_64 u79-b14) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode) ``` 输出显示我们已经正确安装了 1.7.0\_79 版本的 OpenJDK Java。 ### 安装 MySQL 5.6.x 如果的机器上有其它的 MySQL,建议你先卸载它们并安装这个版本,或者升级它们的<ruby> 模式 <rp> ( </rp> <rt> schemas </rt> <rp> ) </rp></ruby>到指定的版本。因为 Zephyr 前提要求这个指定的 5.6.x 版本的 MySQL ,要有 root 用户名。 可以按照下面的步骤在 CentOS-7.1 上安装 MySQL 5.6 : 下载 rpm 软件包,它会为安装 MySQL 服务器创建一个 yum 库文件。 ``` [root@centos-007 ~]# yum install wget [root@centos-007 ~]# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm ``` 然后用 rpm 命令安装下载下来的 rpm 软件包。 ``` [root@centos-007 ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm ``` 安装完这个软件包后你会有两个和 MySQL 相关的新的 yum 库。然后使用 yum 命令安装 MySQL Server 5.6,它会自动安装所有需要的依赖。 ``` [root@centos-007 ~]# yum install mysql-server ``` 安装过程完成之后,运行下面的命令启动 mysqld 服务并检查它的状态是否激活。 ``` [root@centos-007 ~]# service mysqld start [root@centos-007 ~]# service mysqld status ``` 对于全新安装的 MySQL 服务器,MySQL root 用户的密码为空。为了安全起见,我们应该重置 MySQL root 用户的密码。用自动生成的空密码连接到 MySQL 并更改 root 用户密码。 ``` [root@centos-007 ~]# mysql mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('your_password'); mysql> flush privileges; mysql> quit; ``` 现在我们需要在 MySQL 默认的配置文件中配置所需的数据库参数。打开 "/etc/" 目录中的文件并按照下面那样更新。 ``` [root@centos-007 ~]# vi /etc/my.cnf ``` --- ``` [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock symbolic-links=0 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES max_allowed_packet=150M max_connections=600 default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_unicode_ci [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid default-storage-engine=INNODB character-set-server=utf8 collation-server=utf8_unicode_ci [mysql] max_allowed_packet = 150M [mysqldump] quick ``` 保存配置文件中的更新并重启 mysql 服务。 ``` [root@centos-007 ~]# service mysqld restart ``` ### 下载 Zephyr 安装包 我们已经安装完了安装 Zephyr 所需要的软件包。现在我们需要获取 Zephyr 二进制发布包和它的许可证密钥。到 Zephyr 官方下载链接 <http://download.yourzephyr.com/linux/download.php> 输入你的电子邮件 ID 并点击下载。 ![下载 Zephyr](/data/attachment/album/201512/09/200130ti00kxkb0xwxi0hh.png) 然后确认你的电子邮件地址,你会获得 Zephyr 下载链接和它的许可证密钥链接。点击提供的链接从服务器中选择和你操作系统合适的版本下载二进制安装包以及许可证文件。 我们把它下载到 home 目录并更改它的权限为可执行。 ![Zephyr 二进制包](/data/attachment/album/201512/09/200132cb5wxgj2by82je2e.png) ### 开始安装和配置 Zephyr 现在我们通过执行它的二进制安装脚本开始安装 Zephyr。 ``` [root@centos-007 ~]# ./zephyr_4_7_9213_linux_setup.sh –c ``` 一旦你运行了上面的命令,它会检查是否正确配置了 Java 环境变量。如果配置不正确,你可能会看到类似下面的错误。 ``` testing JVM in /usr ... Starting Installer ... Error : Either JDK is not found at expected locations or JDK version is mismatched. Zephyr requires Oracle Java Development Kit (JDK) version 1.7 or higher. ``` 如果你正确配置了 Java,它会开始安装 Zephyr 并要求你输入 “o” 继续或者输入 “c” 取消安装。让我们敲击 “o” 并输入回车键开始安装。 ![安装 zephyr](/data/attachment/album/201512/09/200133clj4u1fl2aae2fzu.png) 下一个选项是检查安装 Zephyr 所有的要求,输入回车进入下一个选项。 ![zephyr 要求](/data/attachment/album/201512/09/200135nz87zvtf8b1hdn3v.png) 输入 “1” 并回车同意许可证协议。 ``` I accept the terms of this license agreement [1], I do not accept the terms of this license agreement [2, Enter] ``` 我们需要选择安装 Zephyr 合适的目标位置以及默认端口,如果你想用默认端口之外的其它端口,也可以在这里配置。 ![installation folder](/data/attachment/album/201512/09/200137rccz8xm6ljd656o5.png) 然后自定义 mysql 数据库参数并给出配置文件的正确路径。在这一步你可能看到类似下面的错误。 ``` Please update MySQL configuration. Configuration parameter max_connection should be at least 500 (max_connection = 500) and max_allowed_packet should be at least 50MB (max_allowed_packet = 50M). ``` 要消除这个错误,你要确保在 mysql 配置文件中正确配置了 "max\_connection" 和 "max\_allowed\_packet" 参数。运行所示的命令连接到数据库确认这些设置。 ![连接 mysql](/data/attachment/album/201512/09/200139ha66l48qpzqpnngx.png) 当你正确配置了 mysql 数据库,它会提取配置文件并完成安装。 ![配置 mysql](/data/attachment/album/201512/09/200141r4spskksijslzupk.png) 安装过程在你的计算机上成功的安装了 Zephyr 4.7。要启动 Zephyr 桌面,输入 “y” 完成 Zephyr 安装。 ![启动 zephyr](/data/attachment/album/201512/09/200142ikgml92tt89m97d7.png) ### 启动 Zephyr 桌面 打开你的 web 浏览器并用你的本机 IP 地址启动 Zephyr 桌面,你会被导向 Zephyr 桌面。 ``` http://your_server_IP/zephyr/desktop/ ``` ![Zephyr 桌面](/data/attachment/album/201512/09/200149mjsbyfli810oi1zl.png) 从 Zephyr 仪表盘点击 "Test Manager" 并用默认的用户名和密码 "test.manager" 登录。 ![Test Manage 登录](/data/attachment/album/201512/09/200158j7j17krff7y7ys7a.png) 你登录进去后你就可以配置你的管理设置了。根据你的环境选择你想要的设置。 ![Test Manage 管理](/data/attachment/album/201512/09/200206nid5nk5gyi2dnjng.png) 完成管理设置后保存设置,资源管理和项目配置也类似,然后开始使用 Zephyr 作为你的测试管理工具吧。如图所示在 Department Dashboard Management 中检查和编辑管理设置状态。 ![zephyr 仪表盘](/data/attachment/album/201512/09/200215qaj5e952bqe25neo.png) ### 总结 好了! 我们已经在 CentOS 7.1 上安装完了 Zephyr。我们希望你能更加深入了解 Zephyr 测试管理工具,它提供简化测试流程、允许快速访问数据分析、协作工具以及多个项目成员之间交流。如果在你的环境中遇到任何问题,欢迎和我们联系。 --- via: <http://linoxide.com/linux-how-to/setup-zephyr-tool-centos-7-x/> 作者:[Kashif Siddique](http://linoxide.com/author/kashifs/) 译者:[ictlyh](http://mutouxiaogui.cn/blog/) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='linoxide.com', port=80): Max retries exceeded with url: /linux-how-to/setup-zephyr-tool-centos-7-x/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7b8327580760>, 'Connection to linoxide.com timed out. (connect timeout=10)'))
null
6,717
开源开发者提交不安全代码,遭 Linus 炮轰
http://thevarguy.com/open-source-application-software-companies/110415/linus-torvalds-lambasts-open-source-programmers-over-inse
2015-12-10T08:37:00
[ "Linus Torvalds" ]
/article-6717-1.html
![](/data/attachment/album/201512/09/203933dxz84v3gjj3h1x8j.jpg) Linus 上个月骂了一个 Linux 开发者,原因是他向 kernel 提交了一份不安全的代码。 Linus 是个 Linux 内核项目非官方的“<ruby> 仁慈的独裁者 <rp> ( </rp> <rt> benevolent dictator </rt> <rp> ) </rp></ruby>”(LCTT译注:英国《卫报》曾将乔布斯评价为‘仁慈的独裁者’),这意味着他有权决定将哪些代码合入内核,哪些代码直接丢掉。 在10月28号,一个开源开发者提交的代码未能符合 Torvalds 的要求,于是遭来了[一顿臭骂](http://lkml.iu.edu/hypermail/linux/kernel/1510.3/02866.html)。Torvalds 在他提交的代码下评论道:“你提交的是什么东西。” 接着他说这个开发者是“毫无能力的神经病”。 Torvalds 为什么会这么生气?他觉得那段代码可以写得更有效率一点,可读性更强一点,编译器编译后跑得更好一点(编译器的作用就是将让人看的代码翻译成让电脑看的代码)。 Torvalds 重新写了一版代码将原来的那份替换掉,并建议所有开发者应该像他那种风格来写代码。 Torvalds 一直在嘲讽那些不符合他观点的人。早在1991年他就攻击过 [Andrew Tanenbaum](https://en.wikipedia.org/wiki/Tanenbaum%E2%80%93Torvalds_debate)——那个 Minix 操作系统的作者,而那个 Minix 操作系统被 Torvalds 描述为“脑残”。 但是 Torvalds 在这次嘲讽中表现得更有战略性了:“我想让*每个人*都知道,像他这种代码是完全不能被接收的。”他说他的目的是提醒每个 Linux 开发者,而不是针对那个开发者。 Torvalds 也用这个机会强调了烂代码的安全问题。现在的企业对安全问题很重视,所以安全问题需要在开源开发者心中得到足够重视,甚至需要在代码中表现为最高等级(LCTT 译注:操作系统必须权衡许多因素:安全、处理速度、灵活性、易用性等,而这里 Torvalds 将安全提升为最高优先级了)。骂一下那些提交不安全代码的开发者可以帮助提高 Linux 系统的安全性。 --- via: <http://thevarguy.com/open-source-application-software-companies/110415/linus-torvalds-lambasts-open-source-programmers-over-inse> 作者:[Christopher Tozzi](http://thevarguy.com/author/christopher-tozzi) 译者:[bazz2](https://github.com/bazz2) 校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
null
HTTPConnectionPool(host='thevarguy.com', port=80): Max retries exceeded with url: /open-source-application-software-companies/110415/linus-torvalds-lambasts-open-source-programmers-over-inse (Caused by NameResolutionError("<urllib3.connection.HTTPConnection object at 0x7b83275822f0>: Failed to resolve 'thevarguy.com' ([Errno -2] Name or service not known)"))
null