mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
e1645cf3b1
@ -1,20 +1,20 @@
|
||||
给新手的 10 个有用 Linux 命令行技巧 - 第二部分
|
||||
给新手的 10 个有用 Linux 命令行技巧
|
||||
================================================================================
|
||||
我记得我第一次使用 Linux 的时候,我还习惯于 Windows 的图形界面,我真的很讨厌 Linux 终端。那时候我觉得命令难以记忆,不能正确使用它们。随着时间推移,我意识到了 Linux 终端的优美、灵活和可用性,说实话,我没有一天不使用它。今天,我很高兴和刚开始接触 Linux 的人一起来分享一些有用的技巧和提示,希望能帮助他们更好的向 Linux 过度,并帮助他们学到一些新的东西(希望如此)。
|
||||
|
||||
我记得我第一次使用 Linux 的时候,我还习惯于 Windows 的图形界面,我真的很讨厌 Linux 终端。那时候我觉得命令难以记忆,不能正确使用它们。随着时间推移,我意识到了 Linux 终端的优美、灵活和可用性,说实话,我没有一天不使用它。今天,我很高兴和刚开始接触 Linux 的人一起来分享一些有用的技巧和提示,希望能帮助他们更好的向 Linux 过渡,并帮助他们学到一些新的东西(希望如此)。
|
||||
|
||||
![给新手的 10 个命令行技巧](http://www.tecmint.com/wp-content/uploads/2015/09/10-Linux-Commandline-Tricks.jpg)
|
||||
|
||||
10 个 Linux 命令行技巧 - 第二部分
|
||||
*10 个 Linux 命令行技巧*
|
||||
|
||||
- [5 个有趣的 Linux 命令行技巧][1]
|
||||
- [管理 Linux 文件类型的 5 个有用命令][2]
|
||||
|
||||
- [Linux 中 5 个有趣的命令行提示和技巧 - 第一部分][1]
|
||||
- [管理 Linux 文件类型的 5 个有用命令 – 第三部分][2]
|
||||
|
||||
这篇文章希望向你展示一些不需要很高的技术而可以像一个高手一样使用 Linux 终端的有用技巧。你只需要一个 Linux 终端和一些自由时间来体会这些命令。
|
||||
这篇文章希望向你展示一些不需要很高的技术就可以像一个高手一样使用 Linux 终端的有用技巧。你只需要一个 Linux 终端和一些自由时间来体会这些命令。
|
||||
|
||||
### 1. 找到正确的命令 ###
|
||||
|
||||
执行正确的命令对你的系统来说非常重要。然而在 Linux 中有很多通常难以记忆的不同的命令行。那么怎样才能找到你需要的正确命令呢?答案是 apropos。你只需要运行:
|
||||
执行正确的命令对你的系统来说非常重要。然而在 Linux 中有如此多的、难以记忆的各种的命令行。那么怎样才能找到你需要的正确命令呢?答案是 apropos。你只需要运行:
|
||||
|
||||
# apropos <description>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
### 2. 执行之前的命令 ###
|
||||
|
||||
很多时候你需要一遍又一遍执行相同的命令。尽管你可以重复按你键盘上的 Up 键,你也可以用 history 命令。这个命令会列出自从你上次启动终端以来所有输入过的命令:
|
||||
很多时候你需要一遍又一遍执行相同的命令。尽管你可以重复按你键盘上的向上光标键,但你也可以用 history 命令替代。这个命令会列出自从你上次启动终端以来所有输入过的命令:
|
||||
|
||||
# history
|
||||
|
||||
@ -73,12 +73,11 @@
|
||||
|
||||
如果你不习惯使用类似 cd、cp、mv、rm 等命令,你可以使用 midnight 命令。它是一个简单的可视化 shell,你可以在上面使用鼠标:
|
||||
|
||||
|
||||
![Midnight 命令](http://www.tecmint.com/wp-content/uploads/2015/09/mc-command.jpg)
|
||||
|
||||
Midnight 命令
|
||||
*Midnight 命令*
|
||||
|
||||
多亏了 F1 到 F12 键,你可以轻易地执行不同任务。只需要在底部选择对应的命令。要选择文件或者目录,点击 “Insert” 按钮。
|
||||
借助 F1 到 F12 键,你可以轻易地执行不同任务。只需要在底部选择对应的命令。要选择文件或者目录,按下 “Insert” 键。
|
||||
|
||||
简而言之 midnight 就是所谓的 “mc”。要安装 mc,只需要运行:
|
||||
|
||||
@ -96,21 +95,21 @@ Midnight 命令
|
||||
|
||||
![Midnight 命令移动文件](http://www.tecmint.com/wp-content/uploads/2015/09/Midnight-Commander-Move-Files.jpg)
|
||||
|
||||
Midnight 命令移动文件
|
||||
*Midnight 命令移动文件*
|
||||
|
||||
按 F6 按钮移动文件到新的目录。MC 会请求你确认:
|
||||
|
||||
![移动文件到新目录](http://www.tecmint.com/wp-content/uploads/2015/09/Move-Files-to-new-Directory.png)
|
||||
|
||||
移动文件到新目录
|
||||
*移动文件到新目录*
|
||||
|
||||
确认了之后,文件就会被移动到新的目标目录。
|
||||
|
||||
扩展阅读:[如何在 Linux 中使用 Midnight 命令文件管理器][4]
|
||||
- 扩展阅读:[如何在 Linux 中使用 Midnight 命令文件管理器][4]
|
||||
|
||||
### 4. 在指定时间关闭计算机 ###
|
||||
|
||||
有时候你需要在结束工作几个小时后再关闭计算机。你可以通过使用下面的命令在指定时间关闭你的计算机:
|
||||
有时候你需要在下班几个小时后再关闭计算机。你可以通过使用下面的命令在指定时间关闭你的计算机:
|
||||
|
||||
$ sudo shutdown 21:00
|
||||
|
||||
@ -151,13 +150,12 @@ Midnight 命令移动文件
|
||||
...
|
||||
|
||||
### 6. 查找文件 ###
|
||||
### 6. Search for Files ###
|
||||
|
||||
查找文件有时候并不像你想象的那么简单。一个搜索文件的好例子是:
|
||||
|
||||
# find /home/user -type f
|
||||
|
||||
这个命令会搜索 /home/user 目录下的所有文件。find 命令真的很强大,你可以传递更多选项给它使得你的搜索更加详细。如果你想搜索比特定大小大的文件,可以使用:
|
||||
这个命令会搜索 /home/user 目录下的所有文件。find 命令真的很强大,你可以传递更多选项给它使得你的搜索更加详细。如果你想搜索超过特定大小的文件,可以使用:
|
||||
|
||||
# find . -type f -size 10M
|
||||
|
||||
@ -221,7 +219,7 @@ Midnight 命令移动文件
|
||||
10.0.0.4
|
||||
10.0.0.5
|
||||
|
||||
这里有一个简单的解决方法。收集服务器的 IP 地址到文件 list.txt 中,像上面那样一行一个。然后运行:
|
||||
这里有一个简单的解决方法。将服务器的 IP 地址写到文件 list.txt 中,像上面那样一行一个。然后运行:
|
||||
|
||||
# for in $i(cat list.txt); do ssh user@$i 'bash command'; done
|
||||
|
||||
@ -239,15 +237,15 @@ via: http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
|
||||
|
||||
作者:[Marin Todorov][a]
|
||||
译者:[ictlyh](http://mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/marintodorov89/
|
||||
[1]:http://www.tecmint.com/5-linux-command-line-tricks/
|
||||
[1]:https://linux.cn/article-5485-1.html
|
||||
[2]:http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
|
||||
[3]:http://www.tecmint.com/history-command-examples/
|
||||
[4]:http://www.tecmint.com/midnight-commander-a-console-based-file-manager-for-linux/
|
||||
[5]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
||||
[6]:http://www.linuxsay.com/
|
||||
[7]:http://www.tecmint.com/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps/
|
||||
[7]:https://linux.cn/article-5202-1.html
|
@ -1,17 +1,17 @@
|
||||
Linux 中管理文件类型和系统时间的 5 个有用命令 - 第三部分
|
||||
5 个在 Linux 中管理文件类型和系统时间的有用命令
|
||||
================================================================================
|
||||
对于想学习 Linux 的初学者来说要适应使用命令行或者终端可能非常困难。由于终端比图形用户界面程序更能帮助用户控制 Linux 系统,我们必须习惯在终端中运行命令。因此为了有效记忆 Linux 不同的命令,你应该每天使用终端并明白怎样将命令和不同选项以及参数一同使用。
|
||||
|
||||
![在 Linux 中管理文件类型并设置时间](http://www.tecmint.com/wp-content/uploads/2015/09/Find-File-Types-in-Linux.jpg)
|
||||
|
||||
在 Linux 中管理文件类型并设置时间 - 第三部分
|
||||
*在 Linux 中管理文件类型并设置时间*
|
||||
|
||||
请先查看我们 [Linux 小技巧][1]系列之前的文章。
|
||||
请先查看我们 Linux 小技巧系列之前的文章:
|
||||
|
||||
- [Linux 中 5 个有趣的命令行提示和技巧 - 第一部分][2]
|
||||
- [给新手的有用命令行技巧 - 第二部分][3]
|
||||
- [5 个有趣的 Linux 命令行技巧][2]
|
||||
- [给新手的 10 个有用 Linux 命令行技巧][3]
|
||||
|
||||
在这篇文章中,我们打算看看终端中 10 个和文件以及时间相关的提示和技巧。
|
||||
在这篇文章中,我们打算看看终端中 5 个和文件以及时间相关的提示和技巧。
|
||||
|
||||
### Linux 中的文件类型 ###
|
||||
|
||||
@ -22,10 +22,10 @@ Linux 系统中文件有不同的类型:
|
||||
- 普通文件:可能包含命令、文档、音频文件、视频、图像,归档文件等。
|
||||
- 设备文件:系统用于访问你硬件组件。
|
||||
|
||||
这里有两种表示存储设备的设备文件块文件,例如硬盘,它们以快读取数据,字符文件,以逐个字符读取数据。
|
||||
这里有两种表示存储设备的设备文件:块文件,例如硬盘,它们以块读取数据;字符文件,以逐个字符读取数据。
|
||||
|
||||
- 硬链接和软链接:用于在 Linux 文件系统的任意地方访问文件。
|
||||
- 命名管道和套接字:允许不同的进程彼此之间交互。
|
||||
- 命名管道和套接字:允许不同的进程之间进行交互。
|
||||
|
||||
#### 1. 用 ‘file’ 命令确定文件类型 ####
|
||||
|
||||
@ -219,7 +219,7 @@ which 命令用于定位文件系统中的命令。
|
||||
20 21 22 23 24 25 26
|
||||
27 28 29 30
|
||||
|
||||
使用 hwclock 命令查看硬件始终时间。
|
||||
使用 hwclock 命令查看硬件时钟时间。
|
||||
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock
|
||||
Wednesday 09 September 2015 06:02:58 PM IST -0.200081 seconds
|
||||
@ -231,7 +231,7 @@ which 命令用于定位文件系统中的命令。
|
||||
tecmint@tecmint ~/Linux-Tricks $ sudo hwclock
|
||||
Wednesday 09 September 2015 12:33:11 PM IST -0.891163 seconds
|
||||
|
||||
系统时间是由硬件始终时间在启动时设置的,系统关闭时,硬件时间被重置为系统时间。
|
||||
系统时间是由硬件时钟时间在启动时设置的,系统关闭时,硬件时间被重置为系统时间。
|
||||
|
||||
因此你查看系统时间和硬件时间时,它们是一样的,除非你更改了系统时间。当你的 CMOS 电量不足时,硬件时间可能不正确。
|
||||
|
||||
@ -256,7 +256,7 @@ which 命令用于定位文件系统中的命令。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
对于初学者来说理解 Linux 中的文件类型是一个好的尝试,同时时间管理也非常重要,尤其是在需要可靠有效地管理服务的服务器上。希望这篇指南能对你有所帮助。如果你有任何反馈,别忘了给我们写评论。和 Tecmint 保持联系。
|
||||
对于初学者来说理解 Linux 中的文件类型是一个好的尝试,同时时间管理也非常重要,尤其是在需要可靠有效地管理服务的服务器上。希望这篇指南能对你有所帮助。如果你有任何反馈,别忘了给我们写评论。和我们保持联系。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -264,16 +264,16 @@ via: http://www.tecmint.com/manage-file-types-and-set-system-time-in-linux/
|
||||
|
||||
作者:[Aaron Kili][a]
|
||||
译者:[ictlyh](http://www.mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/aaronkili/
|
||||
[1]:http://www.tecmint.com/tag/linux-tricks/
|
||||
[2]:http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/
|
||||
[3]:http://www.tecmint.com/10-useful-linux-command-line-tricks-for-newbies/
|
||||
[2]:https://linux.cn/article-5485-1.html
|
||||
[3]:https://linux.cn/article-6314-1.html
|
||||
[4]:http://www.tecmint.com/linux-dir-command-usage-with-examples/
|
||||
[5]:http://www.tecmint.com/12-practical-examples-of-linux-grep-command/
|
||||
[5]:https://linux.cn/article-2250-1.html
|
||||
[6]:http://www.tecmint.com/wc-command-examples/
|
||||
[7]:http://www.tecmint.com/setup-samba-file-sharing-for-linux-windows-clients/
|
||||
[8]:http://www.tecmint.com/35-practical-examples-of-linux-find-command/
|
@ -1,26 +1,26 @@
|
||||
如何在Ubuntu中添加和删除书签[新手技巧]
|
||||
[新手技巧] 如何在Ubuntu中添加和删除书签
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Add-Bookmark.jpg)
|
||||
|
||||
这是一篇对完全是新手的一篇技巧,我将向你展示如何在Ubuntu文件管理器中添加书签。
|
||||
|
||||
现在如果你想知道为什么要这么做,答案很简单。它可以让你可以快速地在左边栏中访问。比如。我[在Ubuntu中安装了Copy][1]。现在它创建了/Home/Copy。先进入Home目录再进入Copy目录并不是一件大事,但是我想要更快地访问它。因此我添加了一个书签这样我就可以直接从侧边栏访问了。
|
||||
现在如果你想知道为什么要这么做,答案很简单。它可以让你可以快速地在左边栏中访问。比如,我[在Ubuntu中安装了Copy 云服务][1]。它创建在/Home/Copy。先进入Home目录再进入Copy目录并不是很麻烦,但是我想要更快地访问它。因此我添加了一个书签这样我就可以直接从侧边栏访问了。
|
||||
|
||||
### 在Ubuntu中添加书签 ###
|
||||
|
||||
打开Files。进入你想要保存快速访问的目录。你需要在标记书签的目录里面。
|
||||
|
||||
现在,你有两种方法。
|
||||
现在,你有两种方法:
|
||||
|
||||
#### 方法1: ####
|
||||
|
||||
当你在Files中时(Ubuntu中的文件管理器),查看顶部菜单。你会看到书签按钮。点击它你会看到将当前路径保存为书签的选项。
|
||||
当你在Files(Ubuntu中的文件管理器)中时,查看顶部菜单。你会看到书签按钮。点击它你会看到将当前路径保存为书签的选项。
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Add-Bookmark-Ubuntu.jpeg)
|
||||
|
||||
#### 方法 2: ####
|
||||
|
||||
你可以直接按下Ctrl+D就可以将当前位置保存位书签。
|
||||
你可以直接按下Ctrl+D就可以将当前位置保存为书签。
|
||||
|
||||
如你所见,这里左边栏就有一个新添加的Copy目录:
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/09/Remove-bookmark-ubuntu.png)
|
||||
|
||||
这就是在Ubuntu中管理书签需要做的。我知道这对于大多数用户而言很贱,但是这也许多Ubuntu的新手而言或许还有用。
|
||||
这就是在Ubuntu中管理书签需要做的。我知道这对于大多数用户而言很简单,但是这也许多Ubuntu的新手而言或许还有用。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -40,7 +40,7 @@ via: http://itsfoss.com/add-remove-bookmarks-ubuntu/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,44 @@
|
||||
看看新的 Ubuntu 15.10 默认壁纸
|
||||
================================================================================
|
||||
**全新的Ubuntu 15.10 Wily Werewolf默认壁纸已经亮相**
|
||||
|
||||
乍一看你几乎无法发现与今天4月发布的Ubuntu 15.04中受到折纸启发的‘Suru’设计有什么差别。但是仔细看你就会发现默认背景有一些细微差别。
|
||||
|
||||
其中一点是更淡,受到由左上角图片发出的橘黄色光的帮助。保持了角褶皱和色块,但是增加了块和矩形部分。
|
||||
|
||||
新的背景由Canonica设计团队的Alex Milazzo设计。
|
||||
|
||||
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/09/ubuntu-1510-wily-werewolf-wallpaper.jpg)
|
||||
|
||||
*Ubuntu 15.10 默认桌面背景*
|
||||
|
||||
为了凸显变化,这个是Ubuntu 15.04的默认壁纸作为比较:
|
||||
|
||||
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/03/suru-desktop-wallpaper-ubuntu-vivid.jpg)
|
||||
|
||||
*Ubuntu 15.04 默认壁纸*
|
||||
|
||||
### 下载Ubuntu 15.10 壁纸 ###
|
||||
|
||||
如果你正运行的是Ubuntu 15.10 Wily Werewolf每日构建版本,那么你无法看到这个默认壁纸:设计已经亮相但是还没有打包到Wily中。
|
||||
|
||||
你不必等到10月份来使用新的设计来作为你的桌面背景。你可以点击下面的按钮下载4096×2304高清壁纸。
|
||||
|
||||
- [下载Ubuntu 15.10新的默认壁纸][1]
|
||||
|
||||
最后,如我们每次在有新壁纸时说的,你不必在意发布版品牌和设计细节。如果壁纸不合你的口味或者不想永远用它,轻易地就换掉,毕竟这不是Ubuntu Phone!
|
||||
|
||||
**你是新版本的粉丝么?在评论中让我们知道**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2015/09/ubuntu-15-10-wily-werewolf-default-wallpaper
|
||||
|
||||
作者:[Joey-Elijah Sneddon][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://plus.google.com/117485690627814051450/?rel=author
|
||||
[1]:https://launchpadlibrarian.net/218258177/Wolf_Wallpaper_Desktop_4096x2304_Purple_PNG-24.png
|
127
published/20150925 HTTP 2 Now Fully Supported in NGINX Plus.md
Normal file
127
published/20150925 HTTP 2 Now Fully Supported in NGINX Plus.md
Normal file
@ -0,0 +1,127 @@
|
||||
NGINX Plus 现在完全支持 HTTP/2
|
||||
================================================================================
|
||||
早些时候,我们发布了支持 HTTP/2 协议的 [NGINX Plus R7][1]。作为 HTTP 协议的最新标准,HTTP/2 的设计为现在的 web 应用程序带来了更高的性能和安全性。(LCTT 译注: [开源版本的 NGINX 1.95 也支持 HTTP/2 了][18]。)
|
||||
|
||||
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][2] 中并没有强制,其允许纯文本的 HTTP/2,但是当前所有实现 HTTP/2的 Web 浏览器都只支持加密。 SSL/TLS 可以使你的网站更安全,并且使用 HTTP/2 各项性能会有提升,加密和解密过程的性能损失就减少了。
|
||||
|
||||
要了解更多关于 HTTP/2:
|
||||
|
||||
- 请阅读我们的 [白皮书][3],它涵盖了你需要了解HTTP/2 的一切。
|
||||
- 下载由 Google 的 Ilya Grigorik 编写的 [特别版的高性能浏览器网络电子书][4] 。
|
||||
|
||||
### NGINX Plus 如何实现 HTTP/2 ###
|
||||
|
||||
我们的 HTTP/2 实现是基于 SPDY 支持的,它已经被广泛部署(使用了 NGINX 或 NGINX Plus 的网站近 75% 都使用了 SPDY)。使用 NGINX Plus 部署 HTTP/2 时,几乎不会改变你应用程序的配置。本节将讨论 NGINX Plus如何实现对 HTTP/2 的支持。
|
||||
|
||||
#### 一个 HTTP/2 网关 ####
|
||||
|
||||
![](https://www.nginx.com/wp-content/uploads/2015/09/http2-27-1024x300.png)
|
||||
|
||||
NGINX Plus 作为一个 HTTP/2 网关。它与支持 HTTP/2 的客户端 Web 浏览器用 HTTP/2 通讯,而转换 HTTP/2 请求给后端服务器通信时使用 HTTP/1.x(或者 FastCGI, SCGI, uWSGI, 等等. – 取决于你目前正在使用的协议)。
|
||||
|
||||
#### 向后兼容性 ####
|
||||
|
||||
![](https://www.nginx.com/wp-content/uploads/2015/09/http2-281-1024x581.png)
|
||||
|
||||
在一段时间内,你需要同时支持 HTTP/2 和 HTTP/1.x。在撰写本文时,超过50%的用户使用的 Web 浏览器已经[支持 HTTP/2][5],但这也意味着近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 加密,现在启用它正是一个好的时机。加密你的应用程序可以保护你免受间谍以及来自其他中间人的攻击。一些搜索引擎甚至在搜索结果中对加密站点[提高排名][6]。下面的配置块重定向所有的普通 HTTP 请求到该网站的加密版本。
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
#### 启用 HTTP/2 ####
|
||||
|
||||
要启用对 HTTP/2 的支持,只需将 http2 参数添加到所有的 [listen][7] 指令中,也要包括 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][8] 和 [Firefox][9] 中使用 “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][10],因此同时支持这两种协议也非必要。
|
||||
|
||||
- 如果 [ssl_prefer_server_ciphers][11] 设置为 on 或者使用了定义在 [Appendix A: TLS 1.2 Ciper Suite Black List][13] 中的 [ssl_ciphers][12] 列表时,浏览器会出现 handshake-errors 而无法正常工作。详细内容请参阅 [section 9.2.2 of the HTTP/2 RFC][14]。
|
||||
|
||||
### 特别感谢 ###
|
||||
|
||||
NGINX 公司要感谢 [Dropbox][15] 和 [Automattic][16],他们是我们软件的重度使用者,并帮助我们实现 HTTP/2。他们的贡献帮助我们加速完成这个软件,我们希望你也能支持他们。
|
||||
|
||||
![](https://www.nginx.com/wp-content/themes/nginx-theme/assets/img/landing-page/highperf_nginx_ebook.png)
|
||||
|
||||
[O'REILLY'S BOOK ABOUT HTTP/2 & PERFORMANCE TUNING][17]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.nginx.com/blog/http2-r7/
|
||||
|
||||
作者:[Faisal Memon][a]
|
||||
译者:[strugglingyouth](https://github.com/strugglingyouth)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.nginx.com/blog/author/fmemon/
|
||||
[1]:https://www.nginx.com/blog/nginx-plus-r7-released/
|
||||
[2]:https://tools.ietf.org/html/rfc7540
|
||||
[3]:https://www.nginx.com/wp-content/uploads/2015/09/NGINX_HTTP2_White_Paper_v4.pdf
|
||||
[4]:https://www.nginx.com/http2-ebook/
|
||||
[5]:http://caniuse.com/#feat=http2
|
||||
[6]:http://googlewebmastercentral.blogspot.co.uk/2014/08/https-as-ranking-signal.html
|
||||
[7]:http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
|
||||
[8]:https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en
|
||||
[9]:https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/
|
||||
[10]:http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html
|
||||
[11]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers
|
||||
[12]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers
|
||||
[13]:https://tools.ietf.org/html/rfc7540#appendix-A
|
||||
[14]:https://tools.ietf.org/html/rfc7540#section-9.2.2
|
||||
[15]:http://dropbox.com/
|
||||
[16]:http://automattic.com/
|
||||
[17]:https://www.nginx.com/http2-ebook/
|
||||
[18]:http://mailman.nginx.org/pipermail/nginx-announce/2015/000162.html
|
@ -0,0 +1,100 @@
|
||||
在 CentOS 7 中安装并使用自动化工具 Ansible
|
||||
================================================================================
|
||||
|
||||
Ansible是一款为类Unix系统开发的自由开源的配置和自动化工具。它用Python写成,类似于Chef和Puppet,但是有一个不同和优点是我们不需要在节点中安装任何客户端。它使用SSH来和节点进行通信。
|
||||
|
||||
本篇中我们将在CentOS 7上安装并配置Ansible,并且尝试管理两个节点。
|
||||
|
||||
- **Ansible 服务端** – ansible.linuxtechi.com ( 192.168.1.15 )
|
||||
|
||||
- **节点** – 192.168.1.9 , 192.168.1.10
|
||||
|
||||
### 第一步: 设置EPEL仓库 ###
|
||||
|
||||
Ansible仓库默认不在yum仓库中,因此我们需要使用下面的命令启用epel仓库。
|
||||
|
||||
[root@ansible ~]# rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
|
||||
|
||||
### 第二步: 使用yum安装Ansible ###
|
||||
|
||||
[root@ansible ~]# yum install ansible
|
||||
|
||||
安装完成后,检查ansible版本:
|
||||
|
||||
[root@ansible ~]# ansible --version
|
||||
|
||||
![ansible-version](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-version.jpg)
|
||||
|
||||
### 第三步: 设置用于节点鉴权的SSH密钥 ###
|
||||
|
||||
在Ansible服务端生成密钥,并且复制公钥到节点中。
|
||||
|
||||
root@ansible ~]# ssh-keygen
|
||||
|
||||
![ssh-keygen](http://www.linuxtechi.com/wp-content/uploads/2015/09/ssh-keygen.jpg)
|
||||
|
||||
使用ssh-copy-id命令来复制Ansible公钥到节点中。
|
||||
|
||||
![ssh-copy-id-command](http://www.linuxtechi.com/wp-content/uploads/2015/09/ssh-copy-id-command.jpg)
|
||||
|
||||
### 第四步:为Ansible定义节点的清单 ###
|
||||
|
||||
文件 `/etc/ansible/hosts` 维护着Ansible中服务器的清单。
|
||||
|
||||
[root@ansible ~]# vi /etc/ansible/hosts
|
||||
[test-servers]
|
||||
192.168.1.9
|
||||
192.168.1.10
|
||||
|
||||
保存并退出文件。
|
||||
|
||||
主机文件示例如下:
|
||||
|
||||
![ansible-host](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-host.jpg)
|
||||
|
||||
### 第五步:尝试在Ansible服务端运行命令 ###
|
||||
|
||||
使用ping检查‘test-servers’或者ansible节点的连通性。
|
||||
|
||||
[root@ansible ~]# ansible -m ping 'test-servers'
|
||||
|
||||
![ansible-ping](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-ping.jpg)
|
||||
|
||||
#### 执行shell命令 ####
|
||||
|
||||
**例子1:检查Ansible节点的运行时间(uptime)**
|
||||
|
||||
[root@ansible ~]# ansible -m command -a "uptime" 'test-servers'
|
||||
|
||||
![ansible-uptime](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-uptime.jpg)
|
||||
|
||||
**例子2:检查节点的内核版本**
|
||||
|
||||
[root@ansible ~]# ansible -m command -a "uname -r" 'test-servers'
|
||||
|
||||
![kernel-version-ansible](http://www.linuxtechi.com/wp-content/uploads/2015/09/kernel-version-ansible.jpg)
|
||||
|
||||
**例子3:给节点增加用户**
|
||||
|
||||
[root@ansible ~]# ansible -m command -a "useradd mark" 'test-servers'
|
||||
[root@ansible ~]# ansible -m command -a "grep mark /etc/passwd" 'test-servers'
|
||||
|
||||
![useradd-ansible](http://www.linuxtechi.com/wp-content/uploads/2015/09/useradd-ansible.jpg)
|
||||
|
||||
**例子4:重定向输出到文件中**
|
||||
|
||||
[root@ansible ~]# ansible -m command -a "df -Th" 'test-servers' > /tmp/command-output.txt
|
||||
|
||||
![redirecting-output-ansible](http://www.linuxtechi.com/wp-content/uploads/2015/09/redirecting-output-ansible.jpg)
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.linuxtechi.com/install-and-use-ansible-in-centos-7/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.linuxtechi.com/author/pradeep/
|
@ -1,25 +1,25 @@
|
||||
RHCSA 系列: 防火墙简要和使用 FirewallD 和 Iptables 来控制网络流量 – Part 11
|
||||
RHCSA 系列(十一): 使用 firewalld 和 iptables 来控制网络流量
|
||||
================================================================================
|
||||
|
||||
简单来说,防火墙就是一个基于一系列预先定义的规则(例如流量包的目的地或来源,流量的类型等)的安全系统,它控制着一个网络中的流入和流出流量。
|
||||
简单来说,防火墙就是一个基于一系列预先定义的规则(例如流量包的目的地或来源,流量的类型等)的安全系统,它控制着一个网络中的流入和流出流量。
|
||||
|
||||
![使用 FirewallD 和 Iptables 来控制网络流量](http://www.tecmint.com/wp-content/uploads/2015/05/Control-Network-Traffic-Using-Firewall.png)
|
||||
|
||||
RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11
|
||||
*RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11*
|
||||
|
||||
在本文中,我们将回顾 firewalld 和 iptables 的基础知识。前者是 RHEL 7 中的默认动态防火墙守护进程,而后者则是针对 Linux 的传统的防火墙服务,大多数的系统和网络管理员都非常熟悉它,并且在 RHEL 7 中也可以获取到。
|
||||
在本文中,我们将回顾 firewalld 和 iptables 的基础知识。前者是 RHEL 7 中的默认动态防火墙守护进程,而后者则是针对 Linux 的传统的防火墙服务,大多数的系统和网络管理员都非常熟悉它,并且在 RHEL 7 中也可以用。
|
||||
|
||||
### FirewallD 和 Iptables 的一个比较 ###
|
||||
|
||||
在后台, firewalld 和 iptables 服务都通过相同的接口来与内核中的 netfilter 框架相交流,这不足为奇,即它们都通过 iptables 命令来与 netfilter 交互。然而,与 iptables 服务相反, firewalld 可以在不丢失现有连接的情况下,在正常的系统操作期间更改设定。
|
||||
|
||||
在默认情况下, firewalld 应该已经安装在你的 RHEL 系统中了,尽管它可能没有在运行。你可以使用下面的命令来确认(firewall-config 是用户界面配置工具):
|
||||
在默认情况下, firewalld 应该已经安装在你的 RHEL 系统中了,尽管它可能没有在运行。你可以使用下面的命令来确认(firewall-config 是用户界面配置工具):
|
||||
|
||||
# yum info firewalld firewall-config
|
||||
|
||||
![检查 FirewallD 的信息](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FirewallD-Information.png)
|
||||
|
||||
检查 FirewallD 的信息
|
||||
*检查 FirewallD 的信息*
|
||||
|
||||
以及,
|
||||
|
||||
@ -27,7 +27,7 @@ RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11
|
||||
|
||||
![检查 FirewallD 的状态](http://www.tecmint.com/wp-content/uploads/2015/05/Check-FirewallD-Status.png)
|
||||
|
||||
检查 FirewallD 的状态
|
||||
*检查 FirewallD 的状态*
|
||||
|
||||
另一方面, iptables 服务在默认情况下没有被包含在 RHEL 系统中,但可以被安装上。
|
||||
|
||||
@ -38,13 +38,13 @@ RHCSA: 使用 FirewallD 和 Iptables 来控制网络流量 – Part 11
|
||||
# systemctl start firewalld.service | iptables-service.service
|
||||
# systemctl enable firewalld.service | iptables-service.service
|
||||
|
||||
另外,请阅读:[管理 Systemd 服务的实用命令][1] (注: 本文已被翻译发表,在 https://linux.cn/article-5926-1.html)
|
||||
另外,请阅读:[管理 Systemd 服务的实用命令][1]
|
||||
|
||||
至于配置文件, iptables 服务使用 `/etc/sysconfig/iptables` 文件(假如这个软件包在你的系统中没有被安装,则这个文件将不存在)。在一个被用作集群节点的 RHEL 7 机子上,这个文件长得像这样:
|
||||
至于配置文件, iptables 服务使用 `/etc/sysconfig/iptables` 文件(假如这个软件包在你的系统中没有被安装,则这个文件将不存在)。在一个被用作集群节点的 RHEL 7 机子上,这个文件看起来是这样:
|
||||
|
||||
![Iptables 防火墙配置文件](http://www.tecmint.com/wp-content/uploads/2015/05/Iptables-Rules.png)
|
||||
|
||||
Iptables 防火墙配置文件
|
||||
*Iptables 防火墙配置文件*
|
||||
|
||||
而 firewalld 则在两个目录中存储它的配置文件,即 `/usr/lib/firewalld` 和 `/etc/firewalld`:
|
||||
|
||||
@ -52,33 +52,32 @@ Iptables 防火墙配置文件
|
||||
|
||||
![FirewallD 的配置文件](http://www.tecmint.com/wp-content/uploads/2015/05/Firewalld-configuration.png)
|
||||
|
||||
FirewallD 的配置文件
|
||||
*FirewallD 的配置文件*
|
||||
|
||||
在这篇文章中后面,我们将进一步查看这些配置文件,在那之后,我们将在各处添加一些规则。
|
||||
现在,是时候提醒你了,你总可以使用下面的命令来找到更多有关这两个工具的信息。
|
||||
在这篇文章中后面,我们将进一步查看这些配置文件,在那之后,我们将在这两个地方添加一些规则。现在,是时候提醒你了,你总可以使用下面的命令来找到更多有关这两个工具的信息。
|
||||
|
||||
# man firewalld.conf
|
||||
# man firewall-cmd
|
||||
# man iptables
|
||||
|
||||
除了这些,记得查看一下当前系列的第一篇 [RHCSA 系列(一): 回顾基础命令及系统文档][2](注: 本文已被翻译发表,在 https://linux.cn/article-6133-1.html ),在其中我描述了几种渠道来得到安装在你的 RHEL 7 系统上的软件包的信息。
|
||||
除了这些,记得查看一下当前系列的第一篇 [RHCSA 系列(一): 回顾基础命令及系统文档][2],在其中我描述了几种渠道来得到安装在你的 RHEL 7 系统上的软件包的信息。
|
||||
|
||||
### 使用 Iptables 来控制网络流量 ###
|
||||
|
||||
在进一步深入之前,或许你需要参考 Linux 基金会认证工程师(Linux Foundation Certified Engineer,LFCE) 系列中的 [配置 Iptables 防火墙 – Part 8][3] 来复习你脑中有关 iptables 的知识。
|
||||
在进一步深入之前,或许你需要参考 Linux 基金会认证工程师(Linux Foundation Certified Engineer,LFCE) 系列中的 [配置 Iptables 防火墙 – Part 8][3] 来复习你脑中有关 iptables 的知识。
|
||||
|
||||
**例 1:同时允许流入和流出的网络流量**
|
||||
|
||||
TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP) 和安全(HTTPS)网络流量的默认端口。你可以像下面这样在 enp0s3 接口上允许流入和流出网络流量通过这两个端口:
|
||||
TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)和安全(HTTPS)网络流量的默认端口。你可以像下面这样在 enp0s3 接口上允许流入和流出网络流量通过这两个端口:
|
||||
|
||||
# iptables -A INPUT -i enp0s3 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
|
||||
# iptables -A OUTPUT -o enp0s3 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
|
||||
# iptables -A INPUT -i enp0s3 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
|
||||
# iptables -A OUTPUT -o enp0s3 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
|
||||
|
||||
**例 2:从某个特定网络中阻挡所有(或某些)流入连接**
|
||||
**例 2:从某个特定网络中阻挡所有(或某些)流入连接**
|
||||
|
||||
或许有时你需要阻挡来自于某个特定网络的所有(或某些)类型的来源流量,比方说 192.168.1.0/24:
|
||||
或许有时你需要阻挡来自于某个特定网络的所有(或某些)类型的来源流量,比方说 192.168.1.0/24:
|
||||
|
||||
# iptables -I INPUT -s 192.168.1.0/24 -j DROP
|
||||
|
||||
@ -90,7 +89,7 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)
|
||||
|
||||
**例 3:将流入流量重定向到另一个目的地**
|
||||
|
||||
假如你不仅使用你的 RHEL 7 机子来作为一个软件防火墙,而且还将它作为一个硬件防火墙,使得它位于两个不同的网络之间,则在你的系统 IP 转发一定已经被开启了。假如没有开启,你需要编辑 `/etc/sysctl.conf` 文件并将 `net.ipv4.ip_forward` 的值设为 1,即:
|
||||
假如你不仅使用你的 RHEL 7 机子来作为一个软件防火墙,而且还将它作为一个硬件防火墙,使得它位于两个不同的网络之间,那么在你的系统上 IP 转发一定已经被开启了。假如没有开启,你需要编辑 `/etc/sysctl.conf` 文件并将 `net.ipv4.ip_forward` 的值设为 1,即:
|
||||
|
||||
net.ipv4.ip_forward = 1
|
||||
|
||||
@ -98,27 +97,27 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)
|
||||
|
||||
# sysctl -p /etc/sysctl.conf
|
||||
|
||||
例如,你可能在一个内部的机子上安装了一个打印机,它的 IP 地址为 192.168.0.10,CUPS 服务在端口 631 上进行监听(同时在你的打印服务器和你的防火墙上)。为了从防火墙另一边的客户端传递打印请求,你应该添加下面的 iptables 规则:
|
||||
例如,你可能在一个内部的机子上安装了一个打印机,它的 IP 地址为 192.168.0.10,CUPS 服务在端口 631 上进行监听(同时在你的打印服务器和你的防火墙上)。为了从防火墙另一边的客户端传递打印请求,你应该添加下面的 iptables 规则:
|
||||
|
||||
# iptables -t nat -A PREROUTING -i enp0s3 -p tcp --dport 631 -j DNAT --to 192.168.0.10:631
|
||||
|
||||
请记住 iptables 逐条地读取它的规则,所以请确保默认的策略或后面的规则不会重载上面例子中那些有下划线的规则。
|
||||
请记住 iptables 会逐条地读取它的规则,所以请确保默认的策略或后面的规则不会重载上面例子中那些规则。
|
||||
|
||||
### FirewallD 入门 ###
|
||||
|
||||
引入 firewalld 的一个改变是区域(zone) (注:翻译参考了 https://fedoraproject.org/wiki/FirewallD/zh-cn) 的概念。它允许将网路划分为拥有不同信任级别的区域,由用户决定将设备和流量放置到哪个区域。
|
||||
firewalld 引入的一个变化是区域(zone) (注:翻译参考了 https://fedoraproject.org/wiki/FirewallD/zh-cn )。这个概念允许将网路划分为拥有不同信任级别的区域,由用户决定将设备和流量放置到哪个区域。
|
||||
|
||||
要获取活动的区域,使用:
|
||||
|
||||
# firewall-cmd --get-active-zones
|
||||
|
||||
在下面的例子中,公用区域被激活了,并且 enp0s3 接口被自动地分配到了这个区域。要查看有关一个特定区域的所有信息,可使用:
|
||||
在下面的例子中,public 区域是激活的,并且 enp0s3 接口被自动地分配到了这个区域。要查看有关一个特定区域的所有信息,可使用:
|
||||
|
||||
# firewall-cmd --zone=public --list-all
|
||||
|
||||
![列出所有的 Firewalld 区域](http://www.tecmint.com/wp-content/uploads/2015/05/View-FirewallD-Zones.png)
|
||||
|
||||
列出所有的 Firewalld 区域
|
||||
*列出所有的 Firewalld 区域*
|
||||
|
||||
由于你可以在 [RHEL 7 安全指南][4] 中阅读到更多有关区域的知识,这里我们将仅列出一些特别的例子。
|
||||
|
||||
@ -130,9 +129,9 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)
|
||||
|
||||
![列出所有受支持的服务](http://www.tecmint.com/wp-content/uploads/2015/05/List-All-Supported-Services.png)
|
||||
|
||||
列出所有受支持的服务
|
||||
*列出所有受支持的服务*
|
||||
|
||||
要立刻且在随后的开机中使得 http 和 https 网络流量通过防火墙,可以这样:
|
||||
要立刻生效且在随后重启后都可以让 http 和 https 网络流量通过防火墙,可以这样:
|
||||
|
||||
# firewall-cmd --zone=MyZone --add-service=http
|
||||
# firewall-cmd --zone=MyZone --permanent --add-service=http
|
||||
@ -140,13 +139,13 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)
|
||||
# firewall-cmd --zone=MyZone --permanent --add-service=https
|
||||
# firewall-cmd --reload
|
||||
|
||||
假如 code>–zone 被忽略,则默认的区域(你可以使用 `firewall-cmd –get-default-zone`来查看)将会被使用。
|
||||
假如 `-–zone` 被忽略,则使用默认的区域(你可以使用 `firewall-cmd –get-default-zone`来查看)。
|
||||
|
||||
若要移除这些规则,可以在上面的命令中将 `add` 替换为 `remove`。
|
||||
|
||||
**例 5:IP 转发或端口转发**
|
||||
|
||||
首先,你需要查看在目标区域中,伪装是否被开启:
|
||||
首先,你需要查看在目标区域中,伪装(masquerading)是否被开启:
|
||||
|
||||
# firewall-cmd --zone=MyZone --query-masquerade
|
||||
|
||||
@ -154,7 +153,7 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)
|
||||
|
||||
![在 firewalld 中查看伪装状态](http://www.tecmint.com/wp-content/uploads/2015/05/Check-masquerading.png)
|
||||
|
||||
查看伪装状态
|
||||
*查看伪装状态*
|
||||
|
||||
你可以为公共区域开启伪装:
|
||||
|
||||
@ -164,11 +163,11 @@ TCP 端口 80 和 443 是 Apache web 服务器使用的用来处理常规(HTTP)
|
||||
|
||||
# firewall-cmd --zone=external --add-forward-port=port=631:proto=tcp:toport=631:toaddr=192.168.0.10
|
||||
|
||||
并且别忘了重新加载防火墙。
|
||||
不要忘了重新加载防火墙。
|
||||
|
||||
在 RHCSA 系列的 [Part 9][5] 你可以找到更深入的例子,在那篇文章中我们解释了如何允许或禁用通常被 web 服务器和 ftp 服务器使用的端口,以及在针对这两个服务所使用的默认端口被改变时,如何更改相应的规则。另外,你或许想参考 firewalld 的 wiki 来查看更深入的例子。
|
||||
在 RHCSA 系列的 [第九部分][5] 你可以找到更深入的例子,在那篇文章中我们解释了如何允许或禁用通常被 web 服务器和 ftp 服务器使用的端口,以及在针对这两个服务所使用的默认端口被改变时,如何更改相应的规则。另外,你或许想参考 firewalld 的 wiki 来查看更深入的例子。
|
||||
|
||||
Read Also: [在 RHEL 7 中配置防火墙的几个实用的 firewalld 例子][6]
|
||||
- 延伸阅读: [在 RHEL 7 中配置防火墙的几个实用的 firewalld 例子][6]
|
||||
|
||||
### 总结 ###
|
||||
|
||||
@ -180,14 +179,14 @@ via: http://www.tecmint.com/firewalld-vs-iptables-and-control-network-traffic-in
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/
|
||||
[2]:http://www.tecmint.com/rhcsa-exam-reviewing-essential-commands-system-documentation/
|
||||
[1]:https://linux.cn/article-5926-1.html
|
||||
[2]:https://linux.cn/article-6133-1.html
|
||||
[3]:http://www.tecmint.com/configure-iptables-firewall/
|
||||
[4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html
|
||||
[5]:http://www.tecmint.com/rhcsa-series-install-and-secure-apache-web-server-and-ftp-in-rhel/
|
||||
[5]:https://linux.cn/article-6286-1.html
|
||||
[6]:http://www.tecmint.com/firewalld-rules-for-centos-7/
|
@ -1,32 +1,33 @@
|
||||
RHCSA 系列: 使用 ‘Kickstart’完成 RHEL 7 的自动化安装 – Part 12
|
||||
RHCSA 系列(十二): 使用 Kickstart 完成 RHEL 7 的自动化安装
|
||||
================================================================================
|
||||
无论是在数据中心还是实验室环境,Linux 服务器很少是独立的机子,很可能有时你不得不安装多个以某种方式相互联系的机子。假如你将在单个服务器上手动安装 RHEL 7 所花的时间乘以你需要配置的机子个数,则这将导致你必须做出一场相当长的努力,而通过使用被称为 kicksta 的无人值守安装工具则可以避免这样的麻烦。
|
||||
|
||||
无论是在数据中心还是实验室环境,Linux 服务器很少是独立的机器,很可能有时你需要安装多个以某种方式相互联系的机器。假如你将在单个服务器上手动安装 RHEL 7 所花的时间乘以你需要配置的机器数量,这将导致你必须做出一场相当长的努力,而通过使用被称为 kicksta 的无人值守安装工具则可以避免这样的麻烦。
|
||||
|
||||
在这篇文章中,我们将向你展示使用 kickstart 工具时所需的一切,以便在安装过程中,不用你时不时地照看“处在襁褓中”的服务器。
|
||||
|
||||
![RHEL 7 的自动化 Kickstart 安装](http://www.tecmint.com/wp-content/uploads/2015/05/Automatic-Kickstart-Installation-of-RHEL-7.jpg)
|
||||
|
||||
RHCSA: RHEL 7 的自动化 Kickstart 安装
|
||||
*RHCSA: RHEL 7 的自动化 Kickstart 安装*
|
||||
|
||||
#### Kickstart 和自动化安装简介 ####
|
||||
|
||||
Kickstart 是一种被用来执行无人值守操作系统安装和配置的自动化安装方法,主要被 RHEL(和其他 Fedora 的副产品,如 CentOS,Oracle Linux 等)所使用。因此,kickstart 安装方法可使得系统管理员只需考虑需要安装的软件包组和系统的配置,便可以得到相同的系统,从而省去必须手动安装这些软件包的麻烦。
|
||||
Kickstart 是一种被用来执行无人值守操作系统安装和配置的自动化安装方法,主要被 RHEL(以及其他 Fedora 的副产品,如 CentOS,Oracle Linux 等)所使用。因此,kickstart 安装方法可使得系统管理员只需考虑需要安装的软件包组和系统的配置,便可以得到相同的系统,从而省去必须手动安装这些软件包的麻烦。
|
||||
|
||||
### 准备一次 Kickstart 安装 ###
|
||||
### 准备 Kickstart 安装 ###
|
||||
|
||||
要执行一次 kickstart 安装,我们需要遵循下面的这些步骤:
|
||||
要执行 kickstart 安装,我们需要遵循下面的这些步骤:
|
||||
|
||||
1. 创建一个 Kickstart 文件,它是一个带有多个预定义配置选项的纯文本文件。
|
||||
|
||||
2. 使得 Kickstart 文件在可移动介质上可得,如一个硬盘或一个网络位置。客户端将使用 `rhel-server-7.0-x86_64-boot.iso` 镜像文件,而你还需要使得完全的 ISO 镜像(`rhel-server-7.0-x86_64-dvd.iso`)可从一个网络资源上获取得到,例如通过一个 FTP 服务器的 HTTP(在我们当前的例子中,我们将使用另一个 IP 地址为 192.168.0.18 的 RHEL 7 机子)。
|
||||
2. 将 Kickstart 文件保存在可移动介质上,如一个硬盘或一个网络位置。kickstart 客户端需要使用 `rhel-server-7.0-x86_64-boot.iso` 镜像文件,而你还需要可从一个网络资源上获取得到完整的 ISO 镜像 `rhel-server-7.0-x86_64-dvd.iso` ,例如通过一个 FTP 服务器的 HTTP 服务形式(在我们当前的例子中,我们将使用另一个 IP 地址为 192.168.0.18 的 RHEL 7 机器)。
|
||||
|
||||
3. 开始 Kickstart 安装。
|
||||
|
||||
为创建一个 kickstart 文件,请登陆你的红帽客户门户网站帐户,并使用 [Kickstart 配置工具][1] 来选择所需的安装选项。在向下滑动之前请仔细阅读每个选项,然后选择最适合你需求的选项:
|
||||
要创建一个 kickstart 文件,请登录你的红帽客户门户网站(Red Hat Customer Portal)帐户,并使用 [Kickstart 配置工具][1] 来选择所需的安装选项。在向下滑动之前请仔细阅读每个选项,然后选择最适合你需求的选项:
|
||||
|
||||
![Kickstart 配置工具](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Configuration-Tool.png)
|
||||
|
||||
Kickstart 配置工具
|
||||
*Kickstart 配置工具*
|
||||
|
||||
假如你指定安装将通过 HTTP,FTP,NFS 来执行,请确保服务器上的防火墙允许这些服务通过。
|
||||
|
||||
@ -59,13 +60,13 @@ Kickstart 配置工具
|
||||
|
||||
url --url=http://192.168.0.18//kickstart/media
|
||||
|
||||
这个目录是你解压 DVD 或 ISO 安装介质的地方。在执行解压之前,我们将把 ISO 安装文件作为一个回环设备挂载到 /media/rhel 目录下:
|
||||
这个目录是你展开 DVD 或 ISO 安装介质内容的地方。在执行解压之前,我们将把 ISO 安装文件作为一个回环设备挂载到 /media/rhel 目录下:
|
||||
|
||||
# mount -o loop /var/www/html/kickstart/rhel-server-7.0-x86_64-dvd.iso /media/rhel
|
||||
|
||||
![挂载 RHEL ISO 镜像](http://www.tecmint.com/wp-content/uploads/2015/05/Mount-RHEL-ISO-Image.png)
|
||||
|
||||
挂载 RHEL ISO 镜像
|
||||
*挂载 RHEL ISO 镜像*
|
||||
|
||||
接下来,复制 /media/rhel 中的全部文件到 /var/www/html/kickstart/media 目录:
|
||||
|
||||
@ -75,11 +76,11 @@ Kickstart 配置工具
|
||||
|
||||
![Kickstart 媒体文件](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-media-Files.png)
|
||||
|
||||
Kickstart 媒体文件
|
||||
*Kickstart 媒体文件*
|
||||
|
||||
现在,我们已经准备好开始 kickstart 安装了。
|
||||
|
||||
不管你如何选择创建 kickstart 文件的方式,在执行安装之前检查这个文件的语法总是一个不错的主意。为此,我们需要安装 pykickstart 软件包。
|
||||
不管你如何选择创建 kickstart 文件的方式,在执行安装之前检查下这个文件的语法是否有误总是一个不错的主意。为此,我们需要安装 pykickstart 软件包。
|
||||
|
||||
# yum update && yum install pykickstart
|
||||
|
||||
@ -89,7 +90,7 @@ Kickstart 媒体文件
|
||||
|
||||
假如文件中的语法正确,你将不会得到任何输出,反之,假如文件中存在错误,你得到警告,向你提示在某一行中语法不正确或出错原因未知。
|
||||
|
||||
### 执行一次 Kickstart 安装 ###
|
||||
### 执行 Kickstart 安装 ###
|
||||
|
||||
首先,使用 rhel-server-7.0-x86_64-boot.iso 来启动你的客户端。当初始屏幕出现时,选择安装 RHEL 7.0 ,然后按 Tab 键来追加下面这一句,接着按 Enter 键:
|
||||
|
||||
@ -97,31 +98,31 @@ Kickstart 媒体文件
|
||||
|
||||
![RHEL Kickstart 安装](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-Kickstart-Installation.png)
|
||||
|
||||
RHEL Kickstart 安装
|
||||
*RHEL Kickstart 安装*
|
||||
|
||||
其中 tecmint.bin 是先前创建的 kickstart 文件。
|
||||
|
||||
当你按了 Enter 键后,自动安装就开始了,且你将看到一个列有正在被安装的软件的列表(软件包的数目和名称根据你所选择的程序和软件包组而有所不同):
|
||||
当你按了 Enter 键后,自动安装就开始了,且你将看到一个列有正在被安装的软件的列表(软件包的数目和名称根据你所选择的程序和软件包组而有所不同):
|
||||
|
||||
![RHEL 7 的自动化 Kickstart 安装](http://www.tecmint.com/wp-content/uploads/2015/05/Kickstart-Automatic-Installation.png)
|
||||
|
||||
RHEL 7 的自动化 Kickstart 安装
|
||||
*RHEL 7 的自动化 Kickstart 安装*
|
||||
|
||||
当自动化过程结束后,将提示你移除安装介质,接着你就可以启动到你新安装的系统中了:
|
||||
|
||||
![RHEL 7 启动屏幕](http://www.tecmint.com/wp-content/uploads/2015/05/RHEL-7.png)
|
||||
|
||||
RHEL 7 启动屏幕
|
||||
*RHEL 7 启动屏幕*
|
||||
|
||||
尽管你可以像我们前面提到的那样,手动地创建你的 kickstart 文件,但你应该尽可能地考虑使用受推荐的方式:你可以使用在线配置工具,或者使用在安装过程中创建的位于 root 家目录下的 anaconda-ks.cfg 文件。
|
||||
|
||||
这个文件实际上就是一个 kickstart 文件,所以你或许想在选择好所有所需的选项(可能需要更改逻辑卷布局或机子上所用的文件系统)后手动地安装第一个机子,接着使用产生的 anaconda-ks.cfg 文件来自动完成其余机子的安装过程。
|
||||
这个文件实际上就是一个 kickstart 文件,你或许想在选择好所有所需的选项(可能需要更改逻辑卷布局或机器上所用的文件系统)后手动地安装第一个机器,接着使用产生的 anaconda-ks.cfg 文件来自动完成其余机器的安装过程。
|
||||
|
||||
另外,使用在线配置工具或 anaconda-ks.cfg 文件来引导将来的安装将允许你使用一个加密的 root 密码来执行系统的安装。
|
||||
另外,使用在线配置工具或 anaconda-ks.cfg 文件来引导将来的安装将允许你在系统安装时以加密的形式设置 root 密码。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
既然你知道了如何创建 kickstart 文件并如何使用它们来自动完成 RHEL 7 服务器的安装,你就可以忘记时时照看安装进度的过程了。这将给你时间来做其他的事情,或者若你足够幸运,你还可以用来休闲一番。
|
||||
既然你知道了如何创建 kickstart 文件并如何使用它们来自动完成 RHEL 7 服务器的安装,你就可以不用时时照看安装进度的过程了。这将给你时间来做其他的事情,或者若你足够幸运,你还可以用来休闲一番。
|
||||
|
||||
无论以何种方式,请使用下面的评论栏来让我们知晓你对这篇文章的看法。提问也同样欢迎!
|
||||
|
||||
@ -133,7 +134,7 @@ via: http://www.tecmint.com/automatic-rhel-installations-using-kickstart/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,28 +1,29 @@
|
||||
RHCSA 系列: 在 RHEL 7 中使用 SELinux 进行强制访问控制 – Part 13
|
||||
RHCSA 系列(十三): 在 RHEL 7 中使用 SELinux 进行强制访问控制
|
||||
================================================================================
|
||||
在本系列的前面几篇文章中,我们已经详细地探索了至少两种访问控制方法:标准的 ugo/rwx 权限([管理用户和组 – Part 3][1]) 和访问控制列表([在文件系统中配置 ACL – Part 7][2])。
|
||||
|
||||
在本系列的前面几篇文章中,我们已经详细地探索了至少两种访问控制方法:标准的 ugo/rwx 权限([RHCSA 系列(三): 如何管理 RHEL7 的用户和组][1]) 和访问控制列表([RHCSA 系列(七): 使用 ACL(访问控制列表) 和挂载 Samba/NFS 共享][2])。
|
||||
|
||||
![RHCSA 认证:SELinux 精要和控制文件系统的访问](http://www.tecmint.com/wp-content/uploads/2015/06/SELinux-Control-File-System-Access.png)
|
||||
|
||||
RHCSA 认证:SELinux 精要和控制文件系统的访问
|
||||
*RHCSA 认证:SELinux 精要和控制文件系统的访问*
|
||||
|
||||
尽管作为第一级别的权限和访问控制机制是必要的,但它们同样有一些局限,而这些局限则可以由安全增强 Linux(Security Enhanced Linux,简称为 SELinux) 来处理。
|
||||
尽管作为第一级别的权限和访问控制机制是必要的,但它们同样有一些局限,而这些局限则可以由安全增强 Linux(Security Enhanced Linux,简称为 SELinux) 来处理。
|
||||
|
||||
这些局限的一种情形是:某个用户可能通过一个未加详细阐述的 chmod 命令将一个文件或目录暴露在安全漏洞面前(注:这句我的翻译有点问题),从而引起访问权限的意外传播。结果,由该用户开启的任意进程可以对属于该用户的文件进行任意的操作,最终一个恶意的或受损的软件对整个系统可能会实现 root 级别的访问权限。
|
||||
这些局限的一种情形是:某个用户可能通过一个泛泛的 chmod 命令将文件或目录暴露出现了安全违例,从而引起访问权限的意外传播。结果,由该用户开启的任意进程可以对属于该用户的文件进行任意的操作,最终一个恶意的或有其它缺陷的软件可能会取得整个系统的 root 级别的访问权限。
|
||||
|
||||
考虑到这些局限性,美国国家安全局(NSA) 率先设计出了 SELinux,一种强制的访问控制方法,它根据最小权限模型去限制进程在系统对象(如文件,目录,网络接口等)上的访问或执行其他的操作的能力,而这些限制可以在后面根据需要进行修改。简单来说,系统的每一个元素只给某个功能所需要的那些权限。
|
||||
考虑到这些局限性,美国国家安全局(NSA) 率先设计出了 SELinux,一种强制的访问控制方法,它根据最小权限模型去限制进程在系统对象(如文件,目录,网络接口等)上的访问或执行其他的操作的能力,而这些限制可以在之后根据需要进行修改。简单来说,系统的每一个元素只给某个功能所需要的那些权限。
|
||||
|
||||
在 RHEL 7 中,SELinux 被并入了内核中,且默认情况下以强制模式开启。在这篇文章中,我们将简要地介绍有关 SELinux 及其相关操作的基本概念。
|
||||
在 RHEL 7 中,SELinux 被并入了内核中,且默认情况下以强制模式(Enforcing)开启。在这篇文章中,我们将简要地介绍有关 SELinux 及其相关操作的基本概念。
|
||||
|
||||
### SELinux 的模式 ###
|
||||
|
||||
SELinux 可以以三种不同的模式运行:
|
||||
|
||||
- 强制模式:SELinux 根据 SELinux 策略规则拒绝访问,这些规则是用以控制安全引擎的一系列准则;
|
||||
- 宽容模式:SELinux 不拒绝访问,但对于那些运行在强制模式下会被拒绝访问的行为,它会进行记录;
|
||||
- 关闭 (不言自明,即 SELinux 没有实际运行).
|
||||
- 强制模式(Enforcing):SELinux 基于其策略规则来拒绝访问,这些规则是用以控制安全引擎的一系列准则;
|
||||
- 宽容模式(Permissive):SELinux 不会拒绝访问,但对于那些如果运行在强制模式下会被拒绝访问的行为进行记录;
|
||||
- 关闭(Disabled) (不言自明,即 SELinux 没有实际运行).
|
||||
|
||||
使用 `getenforce` 命令可以展示 SELinux 当前所处的模式,而 `setenforce` 命令(后面跟上一个 1 或 0) 则被用来将当前模式切换到强制模式或宽容模式,但只对当前的会话有效。
|
||||
使用 `getenforce` 命令可以展示 SELinux 当前所处的模式,而 `setenforce` 命令(后面跟上一个 1 或 0) 则被用来将当前模式切换到强制模式(Enforcing)或宽容模式(Permissive),但只对当前的会话有效。
|
||||
|
||||
为了使得在登出和重启后上面的设置还能保持作用,你需要编辑 `/etc/selinux/config` 文件并将 SELINUX 变量的值设为 enforcing,permissive,disabled 中之一:
|
||||
|
||||
@ -35,15 +36,15 @@ SELinux 可以以三种不同的模式运行:
|
||||
|
||||
![设置 SELinux 模式](http://www.tecmint.com/wp-content/uploads/2015/05/Set-SELinux-Mode.png)
|
||||
|
||||
设置 SELinux 模式
|
||||
*设置 SELinux 模式*
|
||||
|
||||
通常情况下,你将使用 `setenforce` 来在 SELinux 模式间进行切换(从强制模式到宽容模式,或反之),以此来作为你排错的第一步。假如 SELinux 当前被设置为强制模式,而你遇到了某些问题,但当你把 SELinux 切换为宽容模式后问题不再出现了,则你可以确信你遇到了一个 SELinux 权限方面的问题。
|
||||
通常情况下,你应该使用 `setenforce` 来在 SELinux 模式间进行切换(从强制模式到宽容模式,或反之),以此来作为你排错的第一步。假如 SELinux 当前被设置为强制模式,而你遇到了某些问题,但当你把 SELinux 切换为宽容模式后问题不再出现了,则你可以确信你遇到了一个 SELinux 权限方面的问题。
|
||||
|
||||
### SELinux 上下文 ###
|
||||
|
||||
一个 SELinux 上下文由一个权限控制环境所组成,在这个环境中,决定的做出将基于 SELinux 的用户,角色和类型(和可选的级别):
|
||||
一个 SELinux 上下文(Context)由一个访问控制环境所组成,在这个环境中,决定的做出将基于 SELinux 的用户,角色和类型(和可选的级别):
|
||||
|
||||
- 一个 SELinux 用户是通过将一个常规的 Linux 用户账户映射到一个 SELinux 用户账户来实现的,反过来,在一个会话中,这个 SELinux 用户账户在 SELinux 上下文中被进程所使用,为的是能够显示地定义它们所允许的角色和级别。
|
||||
- 一个 SELinux 用户是通过将一个常规的 Linux 用户账户映射到一个 SELinux 用户账户来实现的,反过来,在一个会话中,这个 SELinux 用户账户在 SELinux 上下文中被进程所使用,以便能够明确定义它们所允许的角色和级别。
|
||||
- 角色的概念是作为域和处于该域中的 SELinux 用户之间的媒介,它定义了 SELinux 可以访问到哪个进程域和哪些文件类型。这将保护您的系统免受提权漏洞的攻击。
|
||||
- 类型则定义了一个 SELinux 文件类型或一个 SELinux 进程域。在正常情况下,进程将会被禁止访问其他进程正使用的文件,并禁止对其他进程进行访问。这样只有当一个特定的 SELinux 策略规则允许它访问时,才能够进行访问。
|
||||
|
||||
@ -51,7 +52,7 @@ SELinux 可以以三种不同的模式运行:
|
||||
|
||||
**例 1:改变 sshd 守护进程的默认端口**
|
||||
|
||||
在[加固 SSH – Part 8][3] 中,我们解释了更改 sshd 所监听的默认端口是加固你的服务器免收外部攻击的首个安全措施。下面,就让我们编辑 `/etc/ssh/sshd_config` 文件并将端口设置为 9999:
|
||||
在 [RHCSA 系列(八): 加固 SSH,设定主机名及启用网络服务][3] 中,我们解释了更改 sshd 所监听的默认端口是加固你的服务器免受外部攻击的首要安全措施。下面,就让我们编辑 `/etc/ssh/sshd_config` 文件并将端口设置为 9999:
|
||||
|
||||
Port 9999
|
||||
|
||||
@ -62,19 +63,19 @@ SELinux 可以以三种不同的模式运行:
|
||||
|
||||
![更改 SSH 的端口](http://www.tecmint.com/wp-content/uploads/2015/05/Change-SSH-Port.png)
|
||||
|
||||
重启 SSH 服务
|
||||
*重启 SSH 服务*
|
||||
|
||||
正如你看到的那样, sshd 启动失败,但为什么会这样呢?
|
||||
|
||||
快速检查 `/var/log/audit/audit.log` 文件会发现 sshd 已经被拒绝在端口 9999 上开启(SELinux 日志信息包含单词 "AVC",所以这类信息可以被轻易地与其他信息相区分),因为这个端口是 JBoss 管理服务的保留端口:
|
||||
快速检查 `/var/log/audit/audit.log` 文件会发现 sshd 已经被拒绝在端口 9999 上开启(SELinux 的日志信息包含单词 "AVC",所以这类信息可以被轻易地与其他信息相区分),因为这个端口是 JBoss 管理服务的保留端口:
|
||||
|
||||
# cat /var/log/audit/audit.log | grep AVC | tail -1
|
||||
|
||||
![查看 SSH 日志](http://www.tecmint.com/wp-content/uploads/2015/05/Inspect-SSH-Logs.png)
|
||||
|
||||
查看 SSH 日志
|
||||
*查看 SSH 日志*
|
||||
|
||||
在这种情况下,你可以像先前解释的那样禁用 SELinux(但请不要这样做!),并尝试重启 sshd,且这种方法能够起效。但是, `semanage` 应用可以告诉我们在哪些端口上可以开启 sshd 而不会出现任何问题。
|
||||
在这种情况下,你可以像先前解释的那样禁用 SELinux(但请不要这样做!),并尝试重启 sshd,且这种方法能够起效。但是, `semanage` 应用可以告诉我们在哪些端口上可以开启 sshd 而不会出现任何问题。
|
||||
|
||||
运行:
|
||||
|
||||
@ -84,7 +85,7 @@ SELinux 可以以三种不同的模式运行:
|
||||
|
||||
![Semanage 工具](http://www.tecmint.com/wp-content/uploads/2015/05/SELinux-Permission.png)
|
||||
|
||||
Semanage 工具
|
||||
*Semanage 工具*
|
||||
|
||||
所以让我们在 `/etc/ssh/sshd_config` 中将端口更改为 9998 端口,增加这个端口到 ssh_port_t 的上下文,然后重启 sshd 服务:
|
||||
|
||||
@ -94,13 +95,13 @@ Semanage 工具
|
||||
|
||||
![Semanage 添加端口](http://www.tecmint.com/wp-content/uploads/2015/05/Semenage-Add-Port.png)
|
||||
|
||||
Semanage 添加端口
|
||||
*semanage 添加端口*
|
||||
|
||||
如你所见,这次 sshd 服务被成功地开启了。这个例子告诉我们这个事实:SELinux 控制 TCP 端口数为它自己端口类型中间定义。
|
||||
如你所见,这次 sshd 服务被成功地开启了。这个例子告诉我们一个事实:SELinux 用它自己的端口类型的内部定义来控制 TCP 端口号。
|
||||
|
||||
**例 2:允许 httpd 访问 sendmail**
|
||||
|
||||
这是一个 SELinux 管理一个进程来访问另一个进程的例子。假如在你的 RHEL 7 服务器上,你要实现 Apache 的 mod_security 和 mod_evasive(注:这里少添加了一个链接,链接的地址是 http://www.tecmint.com/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora/),你需要允许 httpd 访问 sendmail,以便在遭受到 (D)DoS 攻击时能够用邮件来提醒你。在下面的命令中,如果你不想使得更改在重启后任然生效,请去掉 `-P` 选项。
|
||||
这是一个 SELinux 管理一个进程来访问另一个进程的例子。假如在你的 RHEL 7 服务器上,[你要为 Apache 配置 mod\_security 和 mod\_evasive][6],你需要允许 httpd 访问 sendmail,以便在遭受到 (D)DoS 攻击时能够用邮件来提醒你。在下面的命令中,如果你不想使得更改在重启后仍然生效,请去掉 `-P` 选项。
|
||||
|
||||
# semanage boolean -1 | grep httpd_can_sendmail
|
||||
# setsebool -P httpd_can_sendmail 1
|
||||
@ -108,13 +109,13 @@ Semanage 添加端口
|
||||
|
||||
![允许 Apache 发送邮件](http://www.tecmint.com/wp-content/uploads/2015/05/Allow-Apache-to-Send-Mails.png)
|
||||
|
||||
允许 Apache 发送邮件
|
||||
*允许 Apache 发送邮件*
|
||||
|
||||
从上面的例子中,你可以知道 SELinux 布尔设定(或者只是布尔值)分别对应于 true 或 false,被嵌入到了 SELinux 策略中。你可以使用 `semanage boolean -l` 来列出所有的布尔值,也可以管道至 grep 命令以便筛选输出的结果。
|
||||
从上面的例子中,你可以知道 SELinux 布尔设定(或者只是布尔值)分别对应于 true 或 false,被嵌入到了 SELinux 策略中。你可以使用 `semanage boolean -l` 来列出所有的布尔值,也可以管道至 grep 命令以便筛选输出的结果。
|
||||
|
||||
**例 3:在一个特定目录而非默认目录下服务一个静态站点**
|
||||
**例 3:在一个特定目录而非默认目录下提供一个静态站点服务**
|
||||
|
||||
假设你正使用一个不同于默认目录(`/var/www/html`)的目录来服务一个静态站点,例如 `/websites` 目录(这种情形会出现在当你把你的网络文件存储在一个共享网络设备上,并需要将它挂载在 /websites 目录时)。
|
||||
假设你正使用一个不同于默认目录(`/var/www/html`)的目录来提供一个静态站点服务,例如 `/websites` 目录(这种情形会出现在当你把你的网络文件存储在一个共享网络设备上,并需要将它挂载在 /websites 目录时)。
|
||||
|
||||
a). 在 /websites 下创建一个 index.html 文件并包含如下的内容:
|
||||
|
||||
@ -130,14 +131,14 @@ a). 在 /websites 下创建一个 index.html 文件并包含如下的内容:
|
||||
|
||||
![检查 SELinux 文件的权限](http://www.tecmint.com/wp-content/uploads/2015/05/Check-File-Permssion.png)
|
||||
|
||||
检查 SELinux 文件的权限
|
||||
*检查 SELinux 文件的权限*
|
||||
|
||||
b). 将 `/etc/httpd/conf/httpd.conf` 中的 DocumentRoot 改为 /websites,并不要忘了
|
||||
更新相应的 Directory 代码块。然后重启 Apache。
|
||||
更新相应的 Directory 块。然后重启 Apache。
|
||||
|
||||
c). 浏览到 `http://<web server IP address>`,则你应该会得到一个 503 Forbidden 的 HTTP 响应。
|
||||
c). 浏览 `http://<web server IP address>`,则你应该会得到一个 503 Forbidden 的 HTTP 响应。
|
||||
|
||||
d). 接下来,递归地改变 /websites 的标志,将它的标志变为 httpd_sys_content_t 类型,以便赋予 Apache 对这些目录和其内容的只读访问权限:
|
||||
d). 接下来,递归地改变 /websites 的标志,将它的标志变为 `httpd_sys_content_t` 类型,以便赋予 Apache 对这些目录和其内容的只读访问权限:
|
||||
|
||||
# semanage fcontext -a -t httpd_sys_content_t "/websites(/.*)?"
|
||||
|
||||
@ -149,7 +150,7 @@ e). 最后,应用在 d) 中创建的 SELinux 策略:
|
||||
|
||||
![确认 Apache 页面](http://www.tecmint.com/wp-content/uploads/2015/05/08part13.png)
|
||||
|
||||
确认 Apache 页面
|
||||
*确认 Apache 页面*
|
||||
|
||||
### 总结 ###
|
||||
|
||||
@ -165,13 +166,14 @@ via: http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/rhcsa-exam-manage-users-and-groups
|
||||
[2]:http://www.tecmint.com/rhcsa-exam-configure-acls-and-mount-nfs-samba-shares/
|
||||
[3]:http://www.tecmint.com/rhcsa-series-secure-ssh-set-hostname-enable-network-services-in-rhel-7/
|
||||
[1]:https://linux.cn/article-6187-1.html
|
||||
[2]:https://linux.cn/article-6263-1.html
|
||||
[3]:https://linux.cn/article-6266-1.html
|
||||
[4]:https://www.nsa.gov/research/selinux/index.shtml
|
||||
[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/SELinux_Users_and_Administrators_Guide/part_I-SELinux.html
|
||||
[6]:https://linux.cn/article-5639-1.html
|
@ -0,0 +1,275 @@
|
||||
RHCSA 系列(十四): 在 RHEL 7 中设置基于 LDAP 的认证
|
||||
================================================================================
|
||||
在这篇文章中,我们将首先罗列一些 LDAP 的基础知识(它是什么,它被用于何处以及为什么会被这样使用),然后向你展示如何使用 RHEL 7 系统来设置一个 LDAP 服务器以及配置一个客户端来使用它达到认证的目的。
|
||||
|
||||
![设置 LDAP 服务器及客户端认证](http://www.tecmint.com/wp-content/uploads/2015/06/setup-ldap-server-and-configure-client-authentication.png)
|
||||
|
||||
*RHCSA 系列:设置 LDAP 服务器及客户端认证 – Part 14*
|
||||
|
||||
正如你将看到的那样,关于认证,还存在其他可能的应用场景,但在这篇指南中,我们将只关注基于 LDAP 的认证。另外,请记住,由于这个话题的广泛性,在这里我们将只涵盖它的基础知识,但你可以参考位于总结部分中列出的文档,以此来了解更加深入的细节。
|
||||
|
||||
基于相同的原因,你将注意到:为了简洁起见,我已经决定省略了几个位于 man 页中 LDAP 工具的参考,但相应命令的解释是近在咫尺的(例如,输入 man ldapadd)。
|
||||
|
||||
那还是让我们开始吧。
|
||||
|
||||
**我们的测试环境**
|
||||
|
||||
我们的测试环境包含两台 RHEL 7机器:
|
||||
|
||||
Server: 192.168.0.18. FQDN: rhel7.mydomain.com
|
||||
Client: 192.168.0.20. FQDN: ldapclient.mydomain.com
|
||||
|
||||
如若你想,你可以使用在 [RHCSA 系列(十二): 使用 Kickstart 完成 RHEL 7 的自动化安装][1] 中使用 Kickstart 安装的机子来作为客户端。
|
||||
|
||||
#### LDAP 是什么? ####
|
||||
|
||||
LDAP 代表轻量级目录访问协议(Lightweight Directory Access Protocol),并包含在一系列协议之中,这些协议允许一个客户端通过网络去获取集中存储的信息(例如所登录的 shell 的路径,家目录的绝对路径,或者其他典型的系统用户信息),而这些信息可以从不同的地方访问到或被很多终端用户获取到(另一个例子是含有某个公司所有雇员的家庭地址和电话号码的目录)。
|
||||
|
||||
对于那些被赋予了权限可以使用这些信息的人来说,将这些信息进行集中管理意味着可以更容易地维护和获取。
|
||||
|
||||
下面的图表提供了一个简化了的关于 LDAP 的示意图,在下面将会进行更多的描述:
|
||||
|
||||
![LDAP 示意图](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Diagram.png)
|
||||
|
||||
*LDAP 示意图*
|
||||
|
||||
下面是对上面示意图的一个详细解释。
|
||||
|
||||
- 在一个 LDAP 目录中,一个条目(entry)代表一个独立单元或信息,被所谓的 Distinguished Name(DN,区别名) 唯一识别。
|
||||
- 一个属性(attribute)是一些与某个条目相关的信息(例如地址,有效的联系电话号码和邮箱地址)。
|
||||
- 每个属性被分配有一个或多个值(value),这些值被包含在一个以空格为分隔符的列表中。每个条目中那个唯一的值被称为一个 Relative Distinguished Name(RDN,相对区别名)。
|
||||
|
||||
接下来,就让我们进入到有关服务器和客户端安装的内容。
|
||||
|
||||
### 安装和配置一个 LDAP 服务器和客户端 ###
|
||||
|
||||
在 RHEL 7 中, LDAP 由 OpenLDAP 实现。为了安装服务器和客户端,分别使用下面的命令:
|
||||
|
||||
# yum update && yum install openldap openldap-clients openldap-servers
|
||||
# yum update && yum install openldap openldap-clients nss-pam-ldapd
|
||||
|
||||
一旦安装完成,我们还需要关注一些事情。除非显示地提示,下面的步骤都只在服务器上执行:
|
||||
|
||||
**1. 在服务器和客户端上,为了确保 SELinux 不会妨碍挡道,长久地开启下列的布尔值:**
|
||||
|
||||
# setsebool -P allow_ypbind=0 authlogin_nsswitch_use_ldap=0
|
||||
|
||||
其中 `allow_ypbind` 为基于 LDAP 的认证所需要,而 `authlogin_nsswitch_use_ldap`则可能会被某些应用所需要。
|
||||
|
||||
**2. 开启并启动服务:**
|
||||
|
||||
# systemctl enable slapd.service
|
||||
# systemctl start slapd.service
|
||||
|
||||
记住你也可以使用 [systemctl][2] 来禁用,重启或停止服务:
|
||||
|
||||
# systemctl disable slapd.service
|
||||
# systemctl restart slapd.service
|
||||
# systemctl stop slapd.service
|
||||
|
||||
**3. 由于 slapd 服务是由 ldap 用户来运行的(你可以使用 `ps -e -o pid,uname,comm | grep slapd` 来验证),为了使得服务器能够更改由管理工具创建的条目,该用户应该有目录 `/var/lib/ldap` 的所有权,而这些管理工具仅可以由 root 用户来运行(紧接着有更多这方面的内容)。**
|
||||
|
||||
在递归地更改这个目录的所有权之前,将 slapd 的示例数据库配置文件复制进这个目录:
|
||||
|
||||
# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
|
||||
# chown -R ldap:ldap /var/lib/ldap
|
||||
|
||||
**4. 设置一个 OpenLDAP 管理用户并设置密码:**
|
||||
|
||||
# slappasswd
|
||||
|
||||
正如下一幅图所展示的那样:
|
||||
|
||||
![设置 LDAP 管理密码](http://www.tecmint.com/wp-content/uploads/2015/06/Set-LDAP-Admin-Password.png)
|
||||
|
||||
*设置 LDAP 管理密码*
|
||||
|
||||
然后以下面的内容创建一个 LDIF 文件(`ldaprootpasswd.ldif`):
|
||||
|
||||
dn: olcDatabase={0}config,cn=config
|
||||
changetype: modify
|
||||
add: olcRootPW
|
||||
olcRootPW: {SSHA}PASSWORD
|
||||
|
||||
其中:
|
||||
|
||||
- PASSWORD 是先前得到的经过哈希处理的字符串。
|
||||
- cn=config 指的是全局配置选项。
|
||||
- olcDatabase 指的是一个特定的数据库实例的名称,并且通常可以在 `/etc/openldap/slapd.d/cn=config` 目录中发现。
|
||||
|
||||
根据上面提供的理论背景,`ldaprootpasswd.ldif` 文件将添加一个条目到 LDAP 目录中。在那个条目中,每一行代表一个属性键值对(其中 dn,changetype,add 和 olcRootPW 为属性,每个冒号右边的字符串为相应的键值)。
|
||||
|
||||
随着我们的进一步深入,请记住上面的这些,并注意到在这篇文章的余下部分,我们使用相同的 Common Names(通用名) `(cn=)`,而这些余下的步骤中的每一步都将与其上一步相关。
|
||||
|
||||
**5. 现在,通过特别指定相对于 ldap 服务的 URI ,添加相应的 LDAP 条目,其中只有 protocol/host/port 这几个域被允许使用。**
|
||||
|
||||
# ldapadd -H ldapi:/// -f ldaprootpasswd.ldif
|
||||
|
||||
上面命令的输出应该与下面的图像相似:
|
||||
|
||||
![LDAP 配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Configuration.png)
|
||||
|
||||
*LDAP 配置*
|
||||
|
||||
接着从 `/etc/openldap/schema` 目录导入一个基本的 LDAP 定义:
|
||||
|
||||
# for def in cosine.ldif nis.ldif inetorgperson.ldif; do ldapadd -H ldapi:/// -f /etc/openldap/schema/$def; done
|
||||
|
||||
![LDAP 定义](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Definitions.png)
|
||||
|
||||
*LDAP 定义*
|
||||
|
||||
**6. 让 LDAP 在它的数据库中使用你的域名。**
|
||||
|
||||
以下面的内容创建另一个 LDIF 文件,我们称之为 `ldapdomain.ldif`, 然后酌情替换这个文件中的域名(在域名部分(Domain Component) dc=) 和密码:
|
||||
|
||||
dn: olcDatabase={1}monitor,cn=config
|
||||
changetype: modify
|
||||
replace: olcAccess
|
||||
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth"
|
||||
read by dn.base="cn=Manager,dc=mydomain,dc=com" read by * none
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
replace: olcSuffix
|
||||
olcSuffix: dc=mydomain,dc=com
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
replace: olcRootDN
|
||||
olcRootDN: cn=Manager,dc=mydomain,dc=com
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
add: olcRootPW
|
||||
olcRootPW: {SSHA}PASSWORD
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
add: olcAccess
|
||||
olcAccess: {0}to attrs=userPassword,shadowLastChange by
|
||||
dn="cn=Manager,dc=mydomain,dc=com" write by anonymous auth by self write by * none
|
||||
olcAccess: {1}to dn.base="" by * read
|
||||
olcAccess: {2}to * by dn="cn=Manager,dc=mydomain,dc=com" write by * read
|
||||
|
||||
接着使用下面的命令来加载:
|
||||
|
||||
# ldapmodify -H ldapi:/// -f ldapdomain.ldif
|
||||
|
||||
![LDAP 域名配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Domain-Configuration.png)
|
||||
|
||||
*LDAP 域名配置*
|
||||
|
||||
**7. 现在,该是添加一些条目到我们的 LDAP 目录的时候了。在下面的文件中,属性和键值由一个冒号`(:)` 所分隔,这个文件我们将命名为 `baseldapdomain.ldif`:**
|
||||
|
||||
dn: dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
objectClass: dcObject
|
||||
objectclass: organization
|
||||
o: mydomain com
|
||||
dc: mydomain
|
||||
|
||||
dn: cn=Manager,dc=mydomain,dc=com
|
||||
objectClass: organizationalRole
|
||||
cn: Manager
|
||||
description: Directory Manager
|
||||
|
||||
dn: ou=People,dc=mydomain,dc=com
|
||||
objectClass: organizationalUnit
|
||||
ou: People
|
||||
|
||||
dn: ou=Group,dc=mydomain,dc=com
|
||||
objectClass: organizationalUnit
|
||||
ou: Group
|
||||
|
||||
添加条目到 LDAP 目录中:
|
||||
|
||||
# ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f baseldapdomain.ldif
|
||||
|
||||
![添加 LDAP 域名,属性和键值](http://www.tecmint.com/wp-content/uploads/2015/06/Add-LDAP-Domain-Configuration.png)
|
||||
|
||||
*添加 LDAP 域名,属性和键值*
|
||||
|
||||
**8. 创建一个名为 ldapuser 的 LDAP 用户(`adduser ldapuser`),然后在`ldapgroup.ldif` 中为一个 LDAP 组创建定义。**
|
||||
|
||||
# adduser ldapuser
|
||||
# vi ldapgroup.ldif
|
||||
|
||||
添加下面的内容:
|
||||
|
||||
dn: cn=Manager,ou=Group,dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
objectClass: posixGroup
|
||||
gidNumber: 1004
|
||||
|
||||
其中 gidNumber 是 ldapuser 在 `/etc/group` 中的 GID,然后加载这个文件:
|
||||
|
||||
# ldapadd -x -W -D "cn=Manager,dc=mydomain,dc=com" -f ldapgroup.ldif
|
||||
|
||||
**9. 为用户 ldapuser 添加一个带有定义的 LDIF 文件(`ldapuser.ldif`):**
|
||||
|
||||
dn: uid=ldapuser,ou=People,dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
objectClass: account
|
||||
objectClass: posixAccount
|
||||
objectClass: shadowAccount
|
||||
cn: ldapuser
|
||||
uid: ldapuser
|
||||
uidNumber: 1004
|
||||
gidNumber: 1004
|
||||
homeDirectory: /home/ldapuser
|
||||
userPassword: {SSHA}fiN0YqzbDuDI0Fpqq9UudWmjZQY28S3M
|
||||
loginShell: /bin/bash
|
||||
gecos: ldapuser
|
||||
shadowLastChange: 0
|
||||
shadowMax: 0
|
||||
shadowWarning: 0
|
||||
|
||||
并加载它:
|
||||
|
||||
# ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f ldapuser.ldif
|
||||
|
||||
![LDAP 用户配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-User-Configuration.png)
|
||||
|
||||
*LDAP 用户配置*
|
||||
|
||||
相似地,你可以删除你刚刚创建的用户条目:
|
||||
|
||||
# ldapdelete -x -W -D cn=Manager,dc=mydomain,dc=com "uid=ldapuser,ou=People,dc=mydomain,dc=com"
|
||||
|
||||
**10. 允许有关 ldap 的通信通过防火墙:**
|
||||
|
||||
# firewall-cmd --add-service=ldap
|
||||
|
||||
**11. 最后,但并非最不重要的是使用 LDAP 开启客户端的认证。**
|
||||
|
||||
为了在最后一步中对我们有所帮助,我们将使用 authconfig 工具(一个配置系统认证资源的界面)。
|
||||
|
||||
使用下面的命令,在通过 LDAP 服务器认证成功后,假如请求的用户的家目录不存在,则将会被创建:
|
||||
|
||||
# authconfig --enableldap --enableldapauth --ldapserver=rhel7.mydomain.com --ldapbasedn="dc=mydomain,dc=com" --enablemkhomedir --update
|
||||
|
||||
![LDAP 客户端认证](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Client-Configuration.png)
|
||||
|
||||
*LDAP 客户端认证*
|
||||
|
||||
### 总结 ###
|
||||
|
||||
在这篇文章中,我们已经解释了如何利用一个 LDAP 服务器来设置基本的认证。若想对当前这个指南里描述的设置进行更深入的配置,请参考位于 RHEL 系统管理员指南里的 [第 13 章 – LDAP 的配置][3],并特别注意使用 TLS 来进行安全设定。
|
||||
|
||||
请随意使用下面的评论框来留下你的提问。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authentication/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:https://linux.cn/article-6335-1.html
|
||||
[2]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/
|
||||
[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html
|
@ -0,0 +1,193 @@
|
||||
RHCSA 系列(十五): 虚拟化基础和使用 KVM 进行虚拟机管理
|
||||
================================================================================
|
||||
|
||||
假如你在词典中查一下单词 “虚拟化(virtualize)”,你将会发现它的意思是 “创造某些事物的一个虚拟物(而非真实的)”。在计算机行业中,术语虚拟化(virtualization)指的是:在相同的物理(硬件)系统上,同时运行多个操作系统,且这几个系统相互隔离的**可能性**,而那个硬件在虚拟化架构中被称作宿主机(host)。
|
||||
|
||||
![KVM 虚拟化基础和 KVM 虚拟机管理](http://www.tecmint.com/wp-content/uploads/2015/06/RHCSA-Part15.png)
|
||||
|
||||
*RHCSA 系列: 虚拟化基础和使用 KVM 进行虚拟机管理 – Part 15*
|
||||
|
||||
通过使用虚拟机监视器(也被称为虚拟机管理程序(hypervisor)),虚拟机(被称为 guest)由底层的硬件来供给虚拟资源(举几个例子来说,如 CPU,RAM,存储介质,网络接口等)。
|
||||
|
||||
考虑到这一点就可以清楚地看出,虚拟化的主要优点是节约成本(在设备和网络基础设施,及维护工作等方面)和显著地减少容纳所有必要硬件所需的物理空间。
|
||||
|
||||
由于这个简单的指南不能涵盖所有的虚拟化方法,我鼓励你参考在总结部分中列出的文档,以此对这个话题做更深入的了解。
|
||||
|
||||
请记住当前文章只是用于在 RHEL 7 中用命令行工具使用 [KVM][1] (Kernel-based Virtual Machine(基于内核的虚拟机)) 学习虚拟化基础知识的一个起点,而并不是对这个话题的深入探讨。
|
||||
|
||||
### 检查硬件要求并安装软件包 ###
|
||||
|
||||
为了设置虚拟化,你的 CPU 必须能够支持它。你可以使用下面的命令来查看你的系统是否满足这个要求:
|
||||
|
||||
# grep -E 'svm|vmx' /proc/cpuinfo
|
||||
|
||||
在下面的截图中,我们可以看到当前的系统(带有一个 AMD 的微处理器)支持虚拟化,svm 字样的存在暗示了这一点。假如我们有一个 Intel 系列的处理器,我们将会看到上面命令的结果将会出现 vmx 字样。
|
||||
|
||||
![检查 KVM 支持](http://www.tecmint.com/wp-content/uploads/2015/06/Check-KVM-Support.png)
|
||||
|
||||
*检查 KVM 支持*
|
||||
|
||||
另外,你需要在你宿主机的硬件(BIOS 或 UEFI)中开启虚拟化。
|
||||
|
||||
现在,安装必要的软件包:
|
||||
|
||||
- qemu-kvm 是一个开源的虚拟机程序,为 KVM 虚拟机监视器提供硬件仿真,而 qemu-img 则提供了一个操纵磁盘镜像的命令行工具。
|
||||
- libvirt 包含与操作系统的虚拟化功能交互的工具。
|
||||
- libvirt-python 包含一个模块,它允许用 Python 写的应用来使用由 libvirt 提供的接口。
|
||||
- libguestfs-tools 包含各式各样的针对虚拟机的系统管理员命令行工具。
|
||||
- virt-install 包含针对虚拟机管理的其他命令行工具。
|
||||
|
||||
命令如下:
|
||||
|
||||
# yum update && yum install qemu-kvm qemu-img libvirt libvirt-python libguestfs-tools virt-install
|
||||
|
||||
一旦安装完成,请确保你启动并开启了 libvirtd 服务:
|
||||
|
||||
# systemctl start libvirtd.service
|
||||
# systemctl enable libvirtd.service
|
||||
|
||||
默认情况下,每个虚拟机将只能够与放在相同的物理服务器上的虚拟机以及宿主机自身通信。要使得虚拟机能够访问位于局域网或因特网中的其他机器,我们需要像下面这样在我们的宿主机上设置一个桥接接口(比如说 br0):
|
||||
|
||||
1、 添加下面的一行到我们的 NIC 主配置中(类似 `/etc/sysconfig/network-scripts/ifcfg-enp0s3` 这样的文件):
|
||||
|
||||
BRIDGE=br0
|
||||
|
||||
2、 使用下面的内容(注意,你可能需要更改 IP 地址,网关地址和 DNS 信息)为 br0 创建一个配置文件(`/etc/sysconfig/network-scripts/ifcfg-br0`):
|
||||
|
||||
|
||||
DEVICE=br0
|
||||
TYPE=Bridge
|
||||
BOOTPROTO=static
|
||||
IPADDR=192.168.0.18
|
||||
NETMASK=255.255.255.0
|
||||
GATEWAY=192.168.0.1
|
||||
NM_CONTROLLED=no
|
||||
DEFROUTE=yes
|
||||
PEERDNS=yes
|
||||
PEERROUTES=yes
|
||||
IPV4_FAILURE_FATAL=no
|
||||
IPV6INIT=yes
|
||||
IPV6_AUTOCONF=yes
|
||||
IPV6_DEFROUTE=yes
|
||||
IPV6_PEERDNS=yes
|
||||
IPV6_PEERROUTES=yes
|
||||
IPV6_FAILURE_FATAL=no
|
||||
NAME=br0
|
||||
ONBOOT=yes
|
||||
DNS1=8.8.8.8
|
||||
DNS2=8.8.4.4
|
||||
|
||||
3、 最后在文件`/etc/sysctl.conf` 中设置:
|
||||
|
||||
net.ipv4.ip_forward = 1
|
||||
|
||||
来开启包转发并加载更改到当前的内核配置中:
|
||||
|
||||
# sysctl -p
|
||||
|
||||
注意,你可能还需要告诉 firewalld 让这类的流量应当被允许通过防火墙。假如你需要这样做,记住你可以参考这个系列的 [使用 firewalld 和 iptables 来控制网络流量][2]。
|
||||
|
||||
### 创建虚拟机镜像 ###
|
||||
|
||||
默认情况下,虚拟机镜像将会被创建到 `/var/lib/libvirt/images` 中,且强烈建议你不要更改这个设定,除非你真的需要那么做且知道你在做什么,并能自己处理有关 SELinux 的设定(这个话题已经超出了本教程的讨论范畴,但你可以参考这个系列的第 13 部分 [使用 SELinux 来进行强制访问控制][3],假如你想更新你的知识的话)。
|
||||
|
||||
这意味着你需要确保你在文件系统中分配了必要的空间来容纳你的虚拟机。
|
||||
|
||||
下面的命令将使用位于 `/home/gacanepa/ISOs`目录下的 rhel-server-7.0-x86_64-dvd.iso 镜像文件和 br0 这个网桥来创建一个名为 `tecmint-virt01` 的虚拟机,它有一个虚拟 CPU,1 GB(=1024 MB)的 RAM,20 GB 的磁盘空间(由`/var/lib/libvirt/images/tecmint-virt01.img`所代表):
|
||||
|
||||
|
||||
# virt-install \
|
||||
--network bridge=br0
|
||||
--name tecmint-virt01 \
|
||||
--ram=1024 \
|
||||
--vcpus=1 \
|
||||
--disk path=/var/lib/libvirt/images/tecmint-virt01.img,size=20 \
|
||||
--graphics none \
|
||||
--cdrom /home/gacanepa/ISOs/rhel-server-7.0-x86_64-dvd.iso
|
||||
--extra-args="console=tty0 console=ttyS0,115200"
|
||||
|
||||
假如安装文件位于一个 HTTP 服务器上,而不是存储在你磁盘中的镜像中,你必须将上面的 `-cdrom` 替换为 `-location`,并明确地指出在线存储仓库的地址。
|
||||
|
||||
至于上面的 `–graphics none` 选项,它告诉安装程序只以文本模式执行安装过程。假如你使用一个 GUI 界面和一个 VNC 窗口来访问主虚拟机控制台,则可以省略这个选项。最后,使用 `–extra-args` 参数,我们将传递内核启动参数给安装程序,以此来设置一个串行的虚拟机控制台。
|
||||
|
||||
现在,所安装的虚拟机应当可以作为一个正常的(真实的)服务来运行了。假如没有,请查看上面列出的步骤。
|
||||
|
||||
### 管理虚拟机 ###
|
||||
|
||||
作为一个系统管理员,还有一些典型的管理任务需要你在虚拟机上去完成。注:下面所有的命令都需要在你的宿主机上运行:
|
||||
|
||||
**1. 列出所有的虚拟机:**
|
||||
|
||||
# virsh list --all
|
||||
|
||||
你必须留意上面命令输出中的虚拟机 ID(尽管上面的命令还会返回虚拟机的名称和当前的状态),因为你需要它来执行有关某个虚拟机的大多数管理任务。
|
||||
|
||||
**2. 显示某个虚拟机的信息:**
|
||||
|
||||
# virsh dominfo [VM Id]
|
||||
|
||||
**3. 开启,重启或停止一个虚拟机操作系统:**
|
||||
|
||||
# virsh start | reboot | shutdown [VM Id]
|
||||
|
||||
**4. 假如网络无法连接且在宿主机上没有运行 X 服务器,可以使用下面的命令来访问虚拟机的串行控制台:**
|
||||
|
||||
# virsh console [VM Id]
|
||||
|
||||
**注**:这需要你添加一个串行控制台配置信息到 `/etc/grub.conf` 文件中(参考刚才创建虚拟机时传递给`-extra-args`选项的参数)。
|
||||
|
||||
**5. 修改分配的内存或虚拟 CPU:**
|
||||
|
||||
首先,关闭虚拟机:
|
||||
|
||||
# virsh shutdown [VM Id]
|
||||
|
||||
为 RAM 编辑虚拟机的配置:
|
||||
|
||||
# virsh edit [VM Id]
|
||||
|
||||
然后更改
|
||||
|
||||
<memory>[内存大小,注意不要加上方括号]</memory>
|
||||
|
||||
使用新的设定重启虚拟机:
|
||||
|
||||
# virsh create /etc/libvirt/qemu/tecmint-virt01.xml
|
||||
|
||||
最后,可以使用下面的命令来动态地改变内存的大小:
|
||||
|
||||
# virsh setmem [VM Id] [内存大小,这里没有括号]
|
||||
|
||||
对于 CPU,使用:
|
||||
|
||||
# virsh edit [VM Id]
|
||||
|
||||
然后更改
|
||||
|
||||
<cpu>[CPU 数目,这里没有括号]</cpu>
|
||||
|
||||
至于更深入的命令和细节,请参考 RHEL 5 虚拟化指南(这个指南尽管有些陈旧,但包括了用于管理虚拟机的 virsh 命令的详尽清单)的第 26 章里的表 26.1。
|
||||
|
||||
### 总结 ###
|
||||
|
||||
在这篇文章中,我们涵盖了在 RHEL 7 中如何使用 KVM 和虚拟化的一些基本概念,这个话题是一个广泛且令人着迷的话题。并且我希望它能成为你在随后阅读官方的 [RHEL 虚拟化入门][4] 和 [RHEL 虚拟化部署和管理指南][5] ,探索更高级的主题时的起点教程,并给你带来帮助。
|
||||
|
||||
另外,为了分辨或拓展这里解释的某些概念,你还可以参考先前包含在 [KVM 系列][6] 中的文章。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/kvm-virtualization-basics-and-guest-administration/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.linux-kvm.org/page/Main_Page
|
||||
[2]:https://linux.cn/article-6315-1.html
|
||||
[3]:https://linux.cn/article-6339-1.html
|
||||
[4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Getting_Started_Guide/index.html
|
||||
[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/index.html
|
||||
[6]:http://www.tecmint.com/install-and-configure-kvm-in-linux/
|
@ -1,44 +0,0 @@
|
||||
Meet The New Ubuntu 15.10 Default Wallpaper
|
||||
================================================================================
|
||||
**The brand new default wallpaper for Ubuntu 15.10 Wily Werewolf has been unveiled. **
|
||||
|
||||
At first glance you may find little has changed from the origami-inspired ‘Suru’ design shipped with April’s release of Ubuntu 15.04. But look closer and you’ll see that the new default background does feature some subtle differences.
|
||||
|
||||
For one it looks much lighter, helped by an orange glow emanating from the upper-left of the image. The angular folds and sections remain, but with the addition of blocky, rectangular sections.
|
||||
|
||||
The new background has been designed by Canonical Design Team member Alex Milazzo.
|
||||
|
||||
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/09/ubuntu-1510-wily-werewolf-wallpaper.jpg)
|
||||
|
||||
The Ubuntu 15.10 default desktop wallpaper
|
||||
|
||||
And just to show that there is a change, here is the Ubuntu 15.04 default wallpaper for comparison:
|
||||
|
||||
![](http://www.omgubuntu.co.uk/wp-content/uploads/2015/03/suru-desktop-wallpaper-ubuntu-vivid.jpg)
|
||||
|
||||
The Ubuntu 15.04 default desktop wallpaper
|
||||
|
||||
### Download Ubuntu 15.10 Wallpaper ###
|
||||
|
||||
If you’re running daily builds of Ubuntu 15.10 Wily Werewolf and don’t yet see this as your default wallpaper you’ve no broken anything: the design has been unveiled but is, as of writing, yet to be packaged and uploaded to Wily itself.
|
||||
|
||||
You don’t have to wait until October to use the new design as your desktop background. You can download the wallpaper in a huge HiDPI display friendly 4096×2304 resolution by hitting the button below.
|
||||
|
||||
- [Download Ubuntu the new 15.10 Default Wallpaper][1]
|
||||
|
||||
Finally, as we say this every time there’s a new wallpaper, you don’t have to care about the minutiae of distribution branding and design. If the new wallpaper is not to your tastes or you never keep it you can, as ever, easily change it — this isn’t the Ubuntu Phone after all!
|
||||
|
||||
**Are you a fan of the refreshed look? Let us know in the comments below. **
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2015/09/ubuntu-15-10-wily-werewolf-default-wallpaper
|
||||
|
||||
作者:[Joey-Elijah Sneddon][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://plus.google.com/117485690627814051450/?rel=author
|
||||
[1]:https://launchpadlibrarian.net/218258177/Wolf_Wallpaper_Desktop_4096x2304_Purple_PNG-24.png
|
@ -0,0 +1,62 @@
|
||||
Open Source Media Player MPlayer 1.2 Released
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/MPlayer-1.2.jpg)
|
||||
|
||||
Almost three years after [MPlaayer][1] 1.1, the new version of MPlayer has been released last week. MPlayer 1.2 brings up support for many new codecs in this release.
|
||||
|
||||
MPlayer is a cross-platform, open source media player. Its name is an abbreviation of “Movie Player”. MPlayer has been one of the oldest video players for Linux and during last 15 years, it has inspired a number of other media players. Some of the famous media players based on MPlayer are:
|
||||
|
||||
- [MPV][2]
|
||||
- SMPlayer
|
||||
- KPlayer
|
||||
- GNOME MPlayer
|
||||
- Deepin Player
|
||||
|
||||
#### What’s new in MPlayer 1.2? ####
|
||||
|
||||
- Compatibility with FFmpeg 2.8
|
||||
- VDPAU hardware acceleration for H.265/HEVC
|
||||
- A number of new codecs supported via FFmpeg
|
||||
- Improvements in TV and DVB support
|
||||
- GUI improvements
|
||||
- external dependency on libdvdcss/libdvdnav packages
|
||||
|
||||
#### Install MPlayer 1.2 in Linux ####
|
||||
|
||||
Most Linux distributions are still having MPlayer 1.1. If you want to use the new MPlayer 1.2, you’ll have to compile it from the source code which could be tricky at times for beginners.
|
||||
|
||||
I have used Ubuntu 15.04 for the installation of MPlayer 1.2. Installation instructions will remain the same for all Linux distributions except the part where you need to install yasm.
|
||||
|
||||
Open a terminal and use the following commands:
|
||||
|
||||
wget http://www.mplayerhq.hu/MPlayer/releases/MPlayer-1.2.tar.xz
|
||||
|
||||
tar xvf MPlayer-1.1.1.tar.xz
|
||||
|
||||
cd MPlayer-1.2
|
||||
|
||||
sudo apt-get install yasm
|
||||
|
||||
./configure
|
||||
|
||||
When you run make, it will throw a number of things on the terminal screen and takes some time to build it. Have patience.
|
||||
|
||||
make
|
||||
|
||||
sudo make install
|
||||
|
||||
If you feel uncomfortable using the source code, I advise you to either wait forMPlayer 1.2 to land in the repositories of your Linux distribution or use an alternate like MPV.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/mplayer-1-2-released/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/abhishek/
|
||||
[1]:https://www.mplayerhq.hu/
|
||||
[2]:http://mpv.io/
|
@ -0,0 +1,49 @@
|
||||
A Slick New Set-Up Wizard Is Coming To Ubuntu and Ubuntu Touch
|
||||
================================================================================
|
||||
> Canonical aims to 'seduce and reassure' those unfamiliar with the OS by making a good first impression
|
||||
|
||||
**The Ubuntu installer is set to undergo a dramatic makeover.**
|
||||
|
||||
Ubuntu will modernise its out-of-the-box experience (OOBE) to be easier and quicker to complete, look more ‘seductive’ to new users, and better present the Ubuntu brand through its design.
|
||||
|
||||
Ubiquity, the current Ubuntu installer, has largely remained unchanged since its [introduction back in 2010][1].
|
||||
|
||||
### First Impressions Are Everything ###
|
||||
|
||||
Since the first thing most users see when trying Ubuntu for the first time is an installer (or set-up wizard, depending on device) the design team feel it’s “one of the most important categories of software usability”.
|
||||
|
||||
“It essentially says how easy your software is to use, as well as introducing the user into your brand through visual design and tone of voice, which can convey familiarity and trust within your product.”
|
||||
|
||||
Canonical’s new OOBE designs show a striking departure from the current look of the Ubiquity installer used by the Ubuntu desktop, and presents a refined approach to the way mobile users ‘set up’ a new Ubuntu Phone.
|
||||
|
||||
![Old design (left) and the new proposed design](http://www.omgubuntu.co.uk/wp-content/uploads/2015/09/desktop-2.jpg)
|
||||
|
||||
Old design (left) and the new proposed design
|
||||
|
||||
Detailing the designs in [new blog post][2], the Canonical Design team say the aim of the revamp is to create a consistent out-of-the-box experience across Ubuntu devices.
|
||||
|
||||
To do this it groups together “common first experiences found on the mobile, tablet and desktop” and unifies the steps and screens between each, something they say moves the OS closer to “achieving a seamless convergent platform.”
|
||||
|
||||
![New Ubuntu installer on desktop/tablet (left) and phone](http://www.omgubuntu.co.uk/wp-content/uploads/2015/09/Convergence.jpg)
|
||||
|
||||
New Ubuntu installer on desktop/tablet (left) and phone
|
||||
|
||||
Implementation of the new ‘OOBE’ has already begun’ according to Canonical, though as of writing there’s no firm word on when a revamped installer may land on either desktop or phone images.
|
||||
|
||||
With the march to ‘desktop’ convergence now in full swing, and a(nother) stack of design changes set to hit the mobile build in lieu of the first Ubuntu Phone that ‘transforms’ in to a PC, chances are you won’t have to wait too long to try it out.
|
||||
|
||||
**What do you think of the designs? How would you go about improving the Ubuntu set-up experience? Let us know in the comments below.**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.omgubuntu.co.uk/2015/09/new-look-ubuntu-installer-coming-soon
|
||||
|
||||
作者:[Joey-Elijah Sneddon][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://plus.google.com/117485690627814051450/?rel=author
|
||||
[1]:http://www.omgubuntu.co.uk/2010/09/ubuntu-10-10s-installer-slideshow-oozes-class
|
||||
[2]:http://design.canonical.com/wp-content/uploads/Convergence.jpg
|
@ -1,73 +0,0 @@
|
||||
alim0x translating
|
||||
|
||||
The history of Android
|
||||
================================================================================
|
||||
![Google Music Beta running on Gingerbread.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/device-2014-03-31-110613.png)
|
||||
Google Music Beta running on Gingerbread.
|
||||
Photo by Ron Amadeo
|
||||
|
||||
### Google Music Beta—cloud storage in lieu of a content store ###
|
||||
|
||||
While Honeycomb revamped the Google Music interface, the Music app didn't go directly from the Honeycomb design to Ice Cream Sandwich. In May 2011, Google launched "[Google Music Beta][1]," an online music locker that came along with a new Google Music app.
|
||||
|
||||
The new Google Music app for 2.2 and up took a few design cues from the Cooliris Gallery, of all things, going with a changing, blurry image for the background. Just about everything was transparent: the pop-up menus, the tabs at the top, and the now-playing bar at the bottom. Individual songs or entire playlists could be downloaded to the device for offline playback, making Google Music an easy way to make sure your music was on all your devices. Besides the mobile app, there was also a Webapp, which allowed Google Music to work on any desktop computer.
|
||||
|
||||
Google didn't have content deals in place with the record companies to start a music store yet, so its stop-gap solution was to allow users to store songs online and stream them to a device. Today, Google has content deals for individual song purchases and all-you-can-eat subscription modes, along with the music locker service.
|
||||
|
||||
### Android 4.0, Ice Cream Sandwich—the modern era ###
|
||||
|
||||
![The Samsung Galaxy Nexus, Android 4.0's launch device.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/samsung-i9250-galaxy-nexus-51.jpg)
|
||||
The Samsung Galaxy Nexus, Android 4.0's launch device.
|
||||
|
||||
Released in October 2011, Android 4.0, Ice Cream Sandwich, got the OS back on track with a release spanning phones and tablets, and it was once again open source. It was the first update to come to phones since Gingerbread, which meant the majority of Android's user base went almost a year without seeing an update. 4.0 was all about shrinking the Honeycomb design to smaller devices, bringing on-screen buttons, the action bar, and the new design language to phones.
|
||||
|
||||
Ice Cream Sandwich debuted on the Samsung Galaxy Nexus, one of the first Android phones with a 720p screen. Along with the higher resolution, the Galaxy Nexus pushed phones to even larger sizes with a 4.65-inch screen—almost a full inch larger than the original Nexus One. This was called "too big" by many critics, but today many Android phones are even bigger. (Five inches is "normal" now.) Ice Cream Sandwich required a lot more power than Gingerbread did, and the Galaxy Nexus delivered with a dual core, 1.2Ghz TI OMAP processor and 1GB of RAM.
|
||||
|
||||
In the US, the Galaxy Nexus debuted on Verizon with an LTE modem. Unlike previous Nexus devices, the most popular model—the Verizon version—was under the control of a carrier, and Google's software and updates had to be approved by Verizon before the phone could be updated. This led to delays in updates and the removal of software Verizon didn't like, namely Google Wallet.
|
||||
|
||||
Thanks to the software improvements in Ice Cream Sandwich, Google finally achieved peak button removal on a phone. With the on-screen navigation buttons, the capacitive buttons could be removed, leaving the Galaxy Nexus with only power and volume buttons.
|
||||
|
||||
![Android 4.0 shrunk down a lot of the Honeycomb design.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/2home.png)
|
||||
Android 4.0 shrunk down a lot of the Honeycomb design.
|
||||
Photo by Ron Amadeo
|
||||
|
||||
The Tron aesthetic in Honeycomb was a little much. Immediately in Ice Cream Sandwich, Google started turning down some of the more sci-fi aspects of the design. The sci-fi clock font changed from a folded over semi-transparent thing to a thin, elegant, normal-looking font. The water ripple touch effect on the unlock circle was removed, and the alien Honeycomb clock widget was scrapped in favor of a more minimal design. The system buttons were redesigned, too, changing from blue outlines with the occasional thick side to thin, even, white outlines. The default wallpaper changed from the blue Honeycomb spaceship interior to a streaky, broken rainbow, which added some much-needed color to the default layout.
|
||||
|
||||
The Honeycomb system bar features were split into a two-bar design for phones. At the top was the traditional status bar, and at the bottom was the new system bar, which housed the three system buttons: Back, Home, and Recent. A permanent search bar was added to the top of the home screen. The bar persisted on the screen the same way the dock did, so over the five home screens, it took up 20 icon spots. On the Honeycomb unlock screen, the small inner circle could be moved anywhere outside the larger circle to unlock the device. In Ice Cream Sandwich, you had to actually hit the unlock icon with the inner circle. This new accuracy requirement allowed Google to add another option to the lock screen: a camera shortcut. Dragging the inner circle to the camera icon would directly launch the camera, skipping the home screen.
|
||||
|
||||
![A Phone OS meant a ton more apps, and the notification panel became a full-screen interface again.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/appsandnotic40.png)
|
||||
A Phone OS meant a ton more apps, and the notification panel became a full-screen interface again.
|
||||
Photo by Ron Amadeo
|
||||
|
||||
The App drawer was still tabbed, but the "My Apps" tab from Honeycomb was replaced with "Widgets," which was a simple 2×3 thumbnail view of widgets. Like Honeycomb, this app drawer was paginated and had to be swiped through horizontally. (Android still uses this app drawer design today.) New in the app drawer was an Android Google+ app, which existed separately for some time. Along with it came a shortcut to "Messenger," the Google+ private messaging service. ("Messenger" is not to be confused with "Messaging," the stock SMS app.)
|
||||
|
||||
Since we're back to a phone now, Messaging, News and Weather, Phone, and Voice Dialer returned, and Cordy, a tablet game, was removed. Our screenshots are from the Verizon variant, which, despite being a Nexus device, was sullied by crapware like "My Verizon Mobile," and "VZ Backup Assistant." In keeping with the de-Tronification theme of Ice Cream Sandwich, the Calendar and Camera icons now looked more like something from Planet Earth rather than alien artifacts. Clock, Downloads, Phone, and Android Market got new icons, too, and "Contacts" got a new icon and a new name, becoming "People."
|
||||
|
||||
The Notification panel got a big overhaul, especially when compared to the [previous Gingerbread design][2]. There was now a top header featuring the date, a settings shortcut, and a "clear all." While first Honeycomb allowed users to dismiss individual notifications by tapping on an "X" in the notification, Ice Cream Sandwich's implementation was much more elegant: just swipe the individual notifications to the left or right and they cleared. Honeycomb had blue highlights, but the blue tone was all over the place. Ice Cream Sandwich unified almost everything to a single blue (hex code #33B5E5, if you want to get specific). The background of the notification panel was made transparent, and the "handle" at the bottom changed to a minimal blue circle with an opaque black background.
|
||||
|
||||
![The main page of the Android Market changed back to black.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market.png)
|
||||
The main page of the Android Market changed back to black.
|
||||
Photo by Ron Amadeo
|
||||
|
||||
The Market got yet another redesign. It finally supported portrait mode again and added Music to the lineup of content you can buy in the store. The new Market extended the cards concept that debuted in Honeycomb and was the first version to use the same application on tablets and phones. The cards on the main page usually didn't link to apps, instead pointing to special promotional pages like "staff picks" or seasonal promotions.
|
||||
|
||||
----------
|
||||
|
||||
![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg)
|
||||
|
||||
[Ron Amadeo][a] / Ron is the Reviews Editor at Ars Technica, where he specializes in Android OS and Google products. He is always on the hunt for a new gadget and loves to rip things apart to see how they work.
|
||||
|
||||
[@RonAmadeo][t]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/19/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://arstechnica.com/gadgets/2011/05/hands-on-grooving-on-the-go-with-impressive-google-music-beta/
|
||||
[2]:http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png
|
||||
[a]:http://arstechnica.com/author/ronamadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
@ -1,3 +1,5 @@
|
||||
alim0x translating
|
||||
|
||||
The history of Android
|
||||
================================================================================
|
||||
![Another Market design that was nothing like the old one. This lineup shows the categories page, featured, a top apps list, and an app page.](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market-pages.png)
|
||||
@ -90,4 +92,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor
|
||||
[1]:http://arstechnica.com/gadgets/2011/02/near-field-communications-a-technology-primer/
|
||||
[2]:http://arstechnica.com/business/2012/01/google-launches-style-guide-for-android-developers/
|
||||
[a]:http://arstechnica.com/author/ronamadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
||||
|
@ -0,0 +1,39 @@
|
||||
pyinfo() A good looking phpinfo-like python script
|
||||
================================================================================
|
||||
Being a native php guy, I'm used to having phpinfo(), giving me easy access to php.ini settings and loaded modules etc. So ofcourse I wanted to call the not existing pyinfo() function, to no avail. My fingers quickly pressed CTRL-E to google for a implementation of it, someone must've ported it already?
|
||||
|
||||
Yes, someone did. But oh my was it ugly. Preposterous! Since I cannot stand ugly layouts *cough*, I just had to build my own. So I used the code I found and cleaned up the layout to make it better. The official python website isnt that bad layout-wise, so why not steal their colors and background images? Yes that sounds like a plan to me.
|
||||
|
||||
[Gits Here][1] | [Download here][2] | [Example here][3]
|
||||
|
||||
Mind you, I only ran it on a python 2.6.4 server, so anything else is at your own risk (but it should be no problem to port it to any other version). To get it working, just import the file and call pyinfo() while catching the function's return value. Print that on the screen. Huzzah!
|
||||
|
||||
For those who did not get that and are using [mod_wsgi][4], run it using something like this (replace that path ofcourse):
|
||||
```
|
||||
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][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,
|
||||
[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
|
||||
[a]:http://bran.name/resume/
|
||||
[1]:https://gist.github.com/951825#file_pyinfo.py
|
||||
[2]:http://bran.name/dump/pyinfo.zip
|
||||
[3]:http://bran.name/dump/pyinfo/index.py
|
||||
[4]:http://code.google.com/p/modwsgi/
|
@ -0,0 +1,39 @@
|
||||
Fix Shell Script Opens In Text Editor In Ubuntu
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Run-Shell-Script-on-Double-Click.jpg)
|
||||
|
||||
When you double click on a shell script (.sh file) what do you expect? The normal expectation would be that it is executed. But this might not be the case in Ubuntu, or I should better say in case of Files (Nautilus). You may go crazy yelling “Run, File, Run”, but the file won’t run and instead it gets opened in Gedit.
|
||||
|
||||
I know that you would say, does the file has execute permission? And I say, yes. The shell script has execute permission but still if I double click on it, it is opened in a text editor. I don’t want it and if you are facing the same issue, I assume that even you don’t want it.
|
||||
|
||||
I know that you would have been advised to run it in the terminal and I know that it would work but that’s not an excuse for the GUI way to not work. Is it?
|
||||
|
||||
In this quick tutorial, we shall see **how to make shell script run by double clicking on it**.
|
||||
|
||||
#### Fix Shell script opens in text editor in Ubuntu ####
|
||||
|
||||
The reason why shell scripts are opening in text editor is the default behavior set in Files (file manager in Ubuntu). In earlier versions, it would ask you if you want to run the file or open for editing. The default behavior has been changed in later versions.
|
||||
|
||||
To fix it, go in file manager and from the top menu and click on **Preference**:
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/execute-shell-program-ubuntu-1.png)
|
||||
|
||||
Next in **Files preferences**, go to **Behavior** tab and you’ll see the option of “**Executables Text Files**“.
|
||||
|
||||
By default, it would have been set to “View executable text files when they are opened”. I would advise you to change it to “Ask each time” so that you’ll have the choice whether to execute it or edit but of course you can set it by default for execution. Your choice here really.
|
||||
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/execute-shell-program-ubuntu-2.png)
|
||||
|
||||
I hope this quick tip helped you to fix this little ‘issue’. Questions and suggestions are always welcomed.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/shell-script-opens-text-editor/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/abhishek/
|
@ -0,0 +1,93 @@
|
||||
How To Download Videos Using youtube-dl In Linux
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Download-YouTube-Videos.jpeg)
|
||||
|
||||
I know you have already seen [how to download YouTube videos][1]. But those tools were mostly GUI ways. I am going to show you how to download YouTube videos via terminal using youtube-dl.
|
||||
|
||||
### [youtube-dl][2] ###
|
||||
|
||||
youtube-dl is a Python based small command-line tool that allows to download videos from YouTube.com, Dailymotion, Google Video, Photobucket, Facebook, Yahoo, Metacafe, Depositfiles and few more similar sites. It written in pygtk and requires Python interpreter to run this program, it’s not platform restricted. It should run on any Unix, Windows or in Mac OS X based systems.
|
||||
|
||||
The youtube-dl tool supports resuming interrupted downloads. If youtube-dl is killed (for example by Ctrl-C or due to loss of Internet connectivity) in the middle of download, you can simply re-run it with the same YouTube video url. It will automatically resume the unfinished download, as long as a partial download is present in the current directory. Which means, you don’t need a [download][3] manager for resuming downloads.
|
||||
|
||||
#### Installing youtube-dl ####
|
||||
|
||||
If you are running Ubuntu based Linux distribution, you can install it using this command:
|
||||
|
||||
sudo apt-get install youtube-dl
|
||||
|
||||
For any Linux distribution, you can quickly install youtube-dl on your system through the command line interface with:
|
||||
|
||||
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O/usr/local/bin/youtube-dl
|
||||
|
||||
After fetching the file, you need to set a executable permission on the script to execute properly.
|
||||
|
||||
sudo chmod a+rx /usr/local/bin/youtube-dl
|
||||
|
||||
#### Use YouTube-DL to Download Videos: ####
|
||||
|
||||
To download a video file, simply run the following command. Where “VIDEO_URL” is the url of the video that you want to download.
|
||||
|
||||
youtube-dl VIDEO_URL
|
||||
|
||||
#### Download YouTube Videos in Multiple Formats: ####
|
||||
|
||||
These days YouTube videos have different resolutions, you first need to check available video formats of a given YouTube video. For that run youtube-dl with “-F” option. It will show you a list of available formats.
|
||||
|
||||
youtube-dl -F http://www.youtube.com/watch?v=BlXaGWbFVKY
|
||||
|
||||
It’s output will be like:
|
||||
|
||||
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]
|
||||
|
||||
Now among the available video formats, choose one that you like. For example, if you want to download it in MP4 version, you should use:
|
||||
|
||||
youtube-dl -f 17 http://www.youtube.com/watch?v=BlXaGWbFVKY
|
||||
|
||||
#### Download subtitles of videos using youtube-dl ####
|
||||
|
||||
First check if there are subtitles available for the video. To list all subs for a video, use the command beelow:
|
||||
|
||||
youtube-dl --list-subs https://www.youtube.com/watch?v=Ye8mB6VsUHw
|
||||
|
||||
To download all subs, but not the video:
|
||||
|
||||
youtube-dl --all-subs --skip-download https://www.youtube.com/watch?v=Ye8mB6VsUHw
|
||||
|
||||
#### Download entire playlist ####
|
||||
|
||||
To download a playlist, simply run the following command. Where “playlist_url” is the url of the playlist that ou want to download.
|
||||
|
||||
youtube-dl -cit playlist_url
|
||||
|
||||
youtube-dl is a versatile command line tool and provides a number of functionalities. No wonder it is such a popular command line tool.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/download-youtube-linux/
|
||||
|
||||
作者:[alimiracle][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/ali/
|
||||
[1]:http://itsfoss.com/download-youtube-videos-ubuntu/
|
||||
[2]:https://rg3.github.io/youtube-dl/
|
||||
[3]:http://itsfoss.com/xtreme-download-manager-install/
|
@ -0,0 +1,78 @@
|
||||
Productivity Tools And Tips For Linux
|
||||
================================================================================
|
||||
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/10/Productivity-Tips-Linux.jpg)
|
||||
|
||||
Since productivity in itself is a subjective term, I am not going into the details of what “productivity” I am talking about here. I am going to show you some tools and tips that could help you to focus better, be efficient and save time while working in Linux.
|
||||
|
||||
### Productivity tools and tips for Linux ###
|
||||
|
||||
Again, I am using Ubuntu at the time of writing this article. But the productivity tools and tips I am going to show you here should be applicable to most of the Linux distributions out there.
|
||||
|
||||
#### Ambient Music ####
|
||||
|
||||
[Music impacts productivity][2]. It is an open secret. From psychologists to management gurus, all have been advising to use ambient noise to feel relaxed and concentrate on your work. I am not going to argue with it because it works for me. I put my headphones on and listening to the birds chirping and wind blows indeed helps me in relaxing.
|
||||
|
||||
In Linux, I use ANoise player for ambient noise player. Thanks to the official PPA provided, you can easily [install Ambient Noise player in Ubuntu][2] and other Ubuntu based Linux distributions. Installing it let’s you play the ambient music offline as well.
|
||||
|
||||
Alternatively, you can always listen to ambient noise online. My favorite website for online ambient music is [Noisli][3]. Do give it a try.
|
||||
|
||||
#### Task management app ####
|
||||
|
||||
A good productive habit is to keep a to-do list. And if you combine it with [Pomodoro Technique][4], it could work wonder. What I mean hear is that create a to-do list and if possible, assign those tasks a certain time. This will keep you on track with your planned tasks for the day.
|
||||
|
||||
For this, I recommend [Go For It!][5] app. You can install it in all major Linux distributions and since it is based on [ToDo.txt][6], you can easily sync it with your smartphone as well. I have written a detailed guide on [how to use Go For It!][7].
|
||||
|
||||
Alternatively, you can use [Sticky Notes][8] or [Google Keep][9]. If you need something more like [Evernote][10] fan, you can use these [open source alternatives for Evernote][11].
|
||||
|
||||
#### Clipboard manager ####
|
||||
|
||||
Ctrl+ C and Ctrl+V are the integral part of our daily computer life. Only problem is that these important actions don’t have memory (by default). Suppose you copied something important and then you accidentally copied something else, you’ll lose what you had before.
|
||||
|
||||
A clipboard manager comes handy in such situation. It displays the history of things you have copied (to clipboard) recently. You can copy text back to clipboard from it.
|
||||
|
||||
I prefer [Diodon clipboard manager][12] for this purpose. It is actively developed and is available in Ubuntu repositories.
|
||||
|
||||
#### Recent notifications ####
|
||||
|
||||
When you are busy with something else and a desktop notification blings and fades away, what do you do? You wish that you could see what was the notification about, isn’t it? Recent notification indicator does this job. It keeps a history of all recent notifications. This way, you would never miss the desktop notifications.
|
||||
|
||||
You can read about [Recent Notification Indicator here][13].
|
||||
|
||||
#### Terminal Tips ####
|
||||
|
||||
No, I am not going to show you all those Linux command tricks and shortcuts. That could make up an entire blog. I am going to show you couple of terminal hacks you could use to enhance your productivity.
|
||||
|
||||
|
||||
- **Change** sudo **password timeout**: By default sudo commands require you to enter password after 15 minutes. This could be tiresome. You could actually change the default sudo password timeout. [This tutorial][14] shows you how to do that.
|
||||
- **Get desktop notification for command completion**: It’s a common joke among IT guys that developers spend a lot of time waiting for programs to be compiled and it is not entirely true. But it does affect the productivity because while you wait for the programs to be compiled, you may end up doing something else and forget about the commands you had run in the terminal.A nicer way would be to get desktop notification when a command is completed. This way, you won’t be distracted for long and can go back to what you were supposed to be doing earlier. Read about [how to get desktop notification for command completion][15].
|
||||
|
||||
I know that this is not a comprehensive article about **increasing productivity**. But these little apps and tips may actually help you to get more out of your valuable time.
|
||||
|
||||
Now it’s your turn. What programs or tips you use to be more productive in Linux? Something you want to share with the community?
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://itsfoss.com/productivity-tips-ubuntu/
|
||||
|
||||
作者:[Abhishek][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://itsfoss.com/author/abhishek/
|
||||
[1]:http://www.helpscout.net/blog/music-productivity/
|
||||
[2]:http://itsfoss.com/ambient-noise-music-player-ubuntu/
|
||||
[3]:http://www.noisli.com/
|
||||
[4]:https://en.wikipedia.org/wiki/Pomodoro_Technique
|
||||
[5]:http://manuel-kehl.de/projects/go-for-it/
|
||||
[6]:http://todotxt.com/
|
||||
[7]:http://itsfoss.com/go-for-it-to-do-app-in-linux/
|
||||
[8]:http://itsfoss.com/indicator-stickynotes-windows-like-sticky-note-app-for-ubuntu/
|
||||
[9]:http://itsfoss.com/install-google-keep-ubuntu-1310/
|
||||
[10]:https://evernote.com/
|
||||
[11]:http://itsfoss.com/5-evernote-alternatives-linux/
|
||||
[12]:https://esite.ch/tag/diodon/
|
||||
[13]:http://itsfoss.com/7-best-indicator-applets-for-ubuntu-13-10/
|
||||
[14]:http://itsfoss.com/change-sudo-password-timeout-ubuntu/
|
||||
[15]:http://itsfoss.com/notification-terminal-command-completion-ubuntu/
|
@ -1,277 +0,0 @@
|
||||
FSSlc translating
|
||||
|
||||
RHCSA Series: Setting Up LDAP-based Authentication in RHEL 7 – Part 14
|
||||
================================================================================
|
||||
We will begin this article by outlining some LDAP basics (what it is, where it is used and why) and show how to set up a LDAP server and configure a client to authenticate against it using Red Hat Enterprise Linux 7 systems.
|
||||
|
||||
![Setup LDAP Server and Client Authentication](http://www.tecmint.com/wp-content/uploads/2015/06/setup-ldap-server-and-configure-client-authentication.png)
|
||||
|
||||
RHCSA Series: Setup LDAP Server and Client Authentication – Part 14
|
||||
|
||||
As we will see, there are several other possible application scenarios, but in this guide we will focus entirely on LDAP-based authentication. In addition, please keep in mind that due to the vastness of the subject, we will only cover its basics here, but you can refer to the documentation outlined in the summary for more in-depth details.
|
||||
|
||||
For the same reason, you will note that I have decided to leave out several references to man pages of LDAP tools for the sake of brevity, but the corresponding explanations are at a fingertip’s distance (man ldapadd, for example).
|
||||
|
||||
That said, let’s get started.
|
||||
|
||||
**Our Testing Environment**
|
||||
|
||||
Our test environment consists of two RHEL 7 boxes:
|
||||
|
||||
Server: 192.168.0.18. FQDN: rhel7.mydomain.com
|
||||
Client: 192.168.0.20. FQDN: ldapclient.mydomain.com
|
||||
|
||||
If you want, you can use the machine installed in [Part 12: Automate RHEL 7 installations][1] using Kickstart as client.
|
||||
|
||||
#### What is LDAP? ####
|
||||
|
||||
LDAP stands for Lightweight Directory Access Protocol and consists in a set of protocols that allows a client to access, over a network, centrally stored information (such as a directory of login shells, absolute paths to home directories, and other typical system user information, for example) that should be accessible from different places or available to a large number of end users (another example would be a directory of home addresses and phone numbers of all employees in a company).
|
||||
|
||||
Keeping such (and more) information centrally means it can be more easily maintained and accessed by everyone who has been granted permissions to use it.
|
||||
|
||||
The following diagram offers a simplified diagram of LDAP, and is described below in greater detail:
|
||||
|
||||
![LDAP Diagram](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Diagram.png)
|
||||
|
||||
LDAP Diagram
|
||||
|
||||
Explanation of above diagram in detail.
|
||||
|
||||
- An entry in a LDAP directory represents a single unit or information and is uniquely identified by what is called a Distinguished Name.
|
||||
- An attribute is a piece of information associated with an entry (for example, addresses, available contact phone numbers, and email addresses).
|
||||
- Each attribute is assigned one or more values consisting in a space-separated list. A value that is unique per entry is called a Relative Distinguished Name.
|
||||
|
||||
That being said, let’s proceed with the server and client installations.
|
||||
|
||||
### Installing and Configuring a LDAP Server and Client ###
|
||||
|
||||
In RHEL 7, LDAP is implemented by OpenLDAP. To install the server and client, use the following commands, respectively:
|
||||
|
||||
# yum update && yum install openldap openldap-clients openldap-servers
|
||||
# yum update && yum install openldap openldap-clients nss-pam-ldapd
|
||||
|
||||
Once the installation is complete, there are some things we look at. The following steps should be performed on the server alone, unless explicitly noted:
|
||||
|
||||
**1. Make sure SELinux does not get in the way by enabling the following booleans persistently, both on the server and the client:**
|
||||
|
||||
# setsebool -P allow_ypbind=0 authlogin_nsswitch_use_ldap=0
|
||||
|
||||
Where allow_ypbind is required for LDAP-based authentication, and authlogin_nsswitch_use_ldap may be needed by some applications.
|
||||
|
||||
**2. Enable and start the service:**
|
||||
|
||||
# systemctl enable slapd.service
|
||||
# systemctl start slapd.service
|
||||
|
||||
Keep in mind that you can also disable, restart, or stop the service with [systemctl][2] as well:
|
||||
|
||||
# systemctl disable slapd.service
|
||||
# systemctl restart slapd.service
|
||||
# systemctl stop slapd.service
|
||||
|
||||
**3. Since the slapd service runs as the ldap user (which you can verify with ps -e -o pid,uname,comm | grep slapd), such user should own the /var/lib/ldap directory in order for the server to be able to modify entries created by administrative tools that can only be run as root (more on this in a minute).**
|
||||
|
||||
Before changing the ownership of this directory recursively, copy the sample database configuration file for slapd into it:
|
||||
|
||||
# cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG
|
||||
# chown -R ldap:ldap /var/lib/ldap
|
||||
|
||||
**4. Set up an OpenLDAP administrative user and assign a password:**
|
||||
|
||||
# slappasswd
|
||||
|
||||
as shown in the next image:
|
||||
|
||||
![Set LDAP Admin Password](http://www.tecmint.com/wp-content/uploads/2015/06/Set-LDAP-Admin-Password.png)
|
||||
|
||||
Set LDAP Admin Password
|
||||
|
||||
and create an LDIF file (ldaprootpasswd.ldif) with the following contents:
|
||||
|
||||
dn: olcDatabase={0}config,cn=config
|
||||
changetype: modify
|
||||
add: olcRootPW
|
||||
olcRootPW: {SSHA}PASSWORD
|
||||
|
||||
where:
|
||||
|
||||
- PASSWORD is the hashed string obtained earlier.
|
||||
- cn=config indicates global config options.
|
||||
- olcDatabase indicates a specific database instance name and can be typically found inside /etc/openldap/slapd.d/cn=config.
|
||||
|
||||
Referring to the theoretical background provided earlier, the `ldaprootpasswd.ldif` file will add an entry to the LDAP directory. In that entry, each line represents an attribute: value pair (where dn, changetype, add, and olcRootPW are the attributes and the strings to the right of each colon are their corresponding values).
|
||||
|
||||
You may want to keep this in mind as we proceed further, and please note that we are using the same Common Names `(cn=)` throughout the rest of this article, where each step depends on the previous one.
|
||||
|
||||
**5. Now, add the corresponding LDAP entry by specifying the URI referring to the ldap server, where only the protocol/host/port fields are allowed.**
|
||||
|
||||
# ldapadd -H ldapi:/// -f ldaprootpasswd.ldif
|
||||
|
||||
The output should be similar to:
|
||||
|
||||
![LDAP Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Configuration.png)
|
||||
|
||||
LDAP Configuration
|
||||
|
||||
and import some basic LDAP definitions from the `/etc/openldap/schema` directory:
|
||||
|
||||
# for def in cosine.ldif nis.ldif inetorgperson.ldif; do ldapadd -H ldapi:/// -f /etc/openldap/schema/$def; done
|
||||
|
||||
![LDAP Definitions](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Definitions.png)
|
||||
|
||||
LDAP Definitions
|
||||
|
||||
**6. Have LDAP use your domain in its database.**
|
||||
|
||||
Create another LDIF file, which we will call `ldapdomain.ldif`, with the following contents, replacing your domain (in the Domain Component dc=) and password as appropriate:
|
||||
|
||||
dn: olcDatabase={1}monitor,cn=config
|
||||
changetype: modify
|
||||
replace: olcAccess
|
||||
olcAccess: {0}to * by dn.base="gidNumber=0+uidNumber=0,cn=peercred,cn=external,cn=auth"
|
||||
read by dn.base="cn=Manager,dc=mydomain,dc=com" read by * none
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
replace: olcSuffix
|
||||
olcSuffix: dc=mydomain,dc=com
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
replace: olcRootDN
|
||||
olcRootDN: cn=Manager,dc=mydomain,dc=com
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
add: olcRootPW
|
||||
olcRootPW: {SSHA}PASSWORD
|
||||
|
||||
dn: olcDatabase={2}hdb,cn=config
|
||||
changetype: modify
|
||||
add: olcAccess
|
||||
olcAccess: {0}to attrs=userPassword,shadowLastChange by
|
||||
dn="cn=Manager,dc=mydomain,dc=com" write by anonymous auth by self write by * none
|
||||
olcAccess: {1}to dn.base="" by * read
|
||||
olcAccess: {2}to * by dn="cn=Manager,dc=mydomain,dc=com" write by * read
|
||||
|
||||
Then load it as follows:
|
||||
|
||||
# ldapmodify -H ldapi:/// -f ldapdomain.ldif
|
||||
|
||||
![LDAP Domain Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Domain-Configuration.png)
|
||||
|
||||
LDAP Domain Configuration
|
||||
|
||||
**7. Now it’s time to add some entries to our LDAP directory. Attributes and values are separated by a colon `(:)` in the following file, which we’ll name `baseldapdomain.ldif`:**
|
||||
|
||||
dn: dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
objectClass: dcObject
|
||||
objectclass: organization
|
||||
o: mydomain com
|
||||
dc: mydomain
|
||||
|
||||
dn: cn=Manager,dc=mydomain,dc=com
|
||||
objectClass: organizationalRole
|
||||
cn: Manager
|
||||
description: Directory Manager
|
||||
|
||||
dn: ou=People,dc=mydomain,dc=com
|
||||
objectClass: organizationalUnit
|
||||
ou: People
|
||||
|
||||
dn: ou=Group,dc=mydomain,dc=com
|
||||
objectClass: organizationalUnit
|
||||
ou: Group
|
||||
|
||||
Add the entries to the LDAP directory:
|
||||
|
||||
# ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f baseldapdomain.ldif
|
||||
|
||||
![Add LDAP Domain Attributes and Values](http://www.tecmint.com/wp-content/uploads/2015/06/Add-LDAP-Domain-Configuration.png)
|
||||
|
||||
Add LDAP Domain Attributes and Values
|
||||
|
||||
**8. Create a LDAP user called ldapuser (adduser ldapuser), then create the definitions for a LDAP group in `ldapgroup.ldif`.**
|
||||
|
||||
# adduser ldapuser
|
||||
# vi ldapgroup.ldif
|
||||
|
||||
Add following content.
|
||||
|
||||
dn: cn=Manager,ou=Group,dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
objectClass: posixGroup
|
||||
gidNumber: 1004
|
||||
|
||||
where gidNumber is the GID in /etc/group for ldapuser) and load it:
|
||||
|
||||
# ldapadd -x -W -D "cn=Manager,dc=mydomain,dc=com" -f ldapgroup.ldif
|
||||
|
||||
**9. Add a LDIF file with the definitions for user ldapuser (`ldapuser.ldif`):**
|
||||
|
||||
dn: uid=ldapuser,ou=People,dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
objectClass: account
|
||||
objectClass: posixAccount
|
||||
objectClass: shadowAccount
|
||||
cn: ldapuser
|
||||
uid: ldapuser
|
||||
uidNumber: 1004
|
||||
gidNumber: 1004
|
||||
homeDirectory: /home/ldapuser
|
||||
userPassword: {SSHA}fiN0YqzbDuDI0Fpqq9UudWmjZQY28S3M
|
||||
loginShell: /bin/bash
|
||||
gecos: ldapuser
|
||||
shadowLastChange: 0
|
||||
shadowMax: 0
|
||||
shadowWarning: 0
|
||||
|
||||
and load it:
|
||||
|
||||
# ldapadd -x -D cn=Manager,dc=mydomain,dc=com -W -f ldapuser.ldif
|
||||
|
||||
![LDAP User Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-User-Configuration.png)
|
||||
|
||||
LDAP User Configuration
|
||||
|
||||
Likewise, you can delete the user entry you just created:
|
||||
|
||||
# ldapdelete -x -W -D cn=Manager,dc=mydomain,dc=com "uid=ldapuser,ou=People,dc=mydomain,dc=com"
|
||||
|
||||
**10. Allow communication through the firewall:**
|
||||
|
||||
# firewall-cmd --add-service=ldap
|
||||
|
||||
**11. Last, but not least, enable the client to authenticate using LDAP.**
|
||||
|
||||
To help us in this final step, we will use the authconfig utility (an interface for configuring system authentication resources).
|
||||
|
||||
Using the following command, the home directory for the requested user is created if it doesn’t exist after the authentication against the LDAP server succeeds:
|
||||
|
||||
# authconfig --enableldap --enableldapauth --ldapserver=rhel7.mydomain.com --ldapbasedn="dc=mydomain,dc=com" --enablemkhomedir --update
|
||||
|
||||
![LDAP Client Configuration](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Client-Configuration.png)
|
||||
|
||||
LDAP Client Configuration
|
||||
|
||||
### Summary ###
|
||||
|
||||
In this article we have explained how to set up basic authentication against a LDAP server. To further configure the setup described in the present guide, please refer to [Chapter 13 – LDAP Configuration][3] in the RHEL 7 System administrator’s guide, paying special attention to the security settings using TLS.
|
||||
|
||||
Feel free to leave any questions you may have using the comment form below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authentication/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/automatic-rhel-installations-using-kickstart/
|
||||
[2]:http://www.tecmint.com/manage-services-using-systemd-and-systemctl-in-linux/
|
||||
[3]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-Directory_Servers.html
|
@ -1,188 +0,0 @@
|
||||
RHCSA Series: Essentials of Virtualization and Guest Administration with KVM – Part 15
|
||||
================================================================================
|
||||
If you look up the word virtualize in a dictionary, you will find that it means “to create a virtual (rather than actual) version of something”. In computing, the term virtualization refers to the possibility of running multiple operating systems simultaneously and isolated one from another, on top of the same physical (hardware) system, known in the virtualization schema as host.
|
||||
|
||||
![KVM Virtualization Basics and KVM Guest Administration](http://www.tecmint.com/wp-content/uploads/2015/06/RHCSA-Part15.png)
|
||||
|
||||
RHCSA Series: Essentials of Virtualization and Guest Administration with KVM – Part 15
|
||||
|
||||
Through the use of the virtual machine monitor (also known as hypervisor), virtual machines (referred to as guests) are provided virtual resources (i.e. CPU, RAM, storage, network interfaces, to name a few) from the underlying hardware.
|
||||
|
||||
With that in mind, it is plain to see that one of the main advantages of virtualization is cost savings (in equipment and network infrastructure and in terms of maintenance effort) and a substantial reduction in the physical space required to accommodate all the necessary hardware.
|
||||
|
||||
Since this brief how-to cannot cover all virtualization methods, I encourage you to refer to the documentation listed in the summary for further details on the subject.
|
||||
|
||||
Please keep in mind that the present article is intended to be a starting point to learn the basics of virtualization in RHEL 7 using [KVM][1] (Kernel-based Virtual Machine) with command-line utilities, and not an in-depth discussion of the topic.
|
||||
|
||||
### Verifying Hardware Requirements and Installing Packages ###
|
||||
|
||||
In order to set up virtualization, your CPU must support it. You can verify whether your system meets the requirements with the following command:
|
||||
|
||||
# grep -E 'svm|vmx' /proc/cpuinfo
|
||||
|
||||
In the following screenshot we can see that the current system (with an AMD microprocessor) supports virtualization, as indicated by svm. If we had an Intel-based processor, we would see vmx instead in the results of the above command.
|
||||
|
||||
![Check KVM Support](http://www.tecmint.com/wp-content/uploads/2015/06/Check-KVM-Support.png)
|
||||
|
||||
Check KVM Support
|
||||
|
||||
In addition, you will need to have virtualization capabilities enabled in the firmware of your host (BIOS or UEFI).
|
||||
|
||||
Now install the necessary packages:
|
||||
|
||||
- qemu-kvm is an open source virtualizer that provides hardware emulation for the KVM hypervisor whereas qemu-img provides a command line tool for manipulating disk images.
|
||||
- libvirt includes the tools to interact with the virtualization capabilities of the operating system.
|
||||
- libvirt-python contains a module that permits applications written in Python to use the interface supplied by libvirt.
|
||||
- libguestfs-tools: miscellaneous system administrator command line tools for virtual machines.
|
||||
- virt-install: other command-line utilities for virtual machine administration.
|
||||
|
||||
# yum update && yum install qemu-kvm qemu-img libvirt libvirt-python libguestfs-tools virt-install
|
||||
|
||||
Once the installation completes, make sure you start and enable the libvirtd service:
|
||||
|
||||
# systemctl start libvirtd.service
|
||||
# systemctl enable libvirtd.service
|
||||
|
||||
By default, each virtual machine will only be able to communicate with the rest in the same physical server and with the host itself. To allow the guests to reach other machines inside our LAN and also the Internet, we need to set up a bridge interface in our host (say br0, for example) by,
|
||||
|
||||
1. adding the following line to our main NIC configuration (most likely `/etc/sysconfig/network-scripts/ifcfg-enp0s3`):
|
||||
|
||||
BRIDGE=br0
|
||||
|
||||
2. creating the configuration file for br0 (/etc/sysconfig/network-scripts/ifcfg-br0) with these contents (note that you may have to change the IP address, gateway address, and DNS information):
|
||||
|
||||
DEVICE=br0
|
||||
TYPE=Bridge
|
||||
BOOTPROTO=static
|
||||
IPADDR=192.168.0.18
|
||||
NETMASK=255.255.255.0
|
||||
GATEWAY=192.168.0.1
|
||||
NM_CONTROLLED=no
|
||||
DEFROUTE=yes
|
||||
PEERDNS=yes
|
||||
PEERROUTES=yes
|
||||
IPV4_FAILURE_FATAL=no
|
||||
IPV6INIT=yes
|
||||
IPV6_AUTOCONF=yes
|
||||
IPV6_DEFROUTE=yes
|
||||
IPV6_PEERDNS=yes
|
||||
IPV6_PEERROUTES=yes
|
||||
IPV6_FAILURE_FATAL=no
|
||||
NAME=br0
|
||||
ONBOOT=yes
|
||||
DNS1=8.8.8.8
|
||||
DNS2=8.8.4.4
|
||||
|
||||
3. finally, enabling packet forwarding by making, in `/etc/sysctl.conf`,
|
||||
|
||||
net.ipv4.ip_forward = 1
|
||||
|
||||
and loading the changes to the current kernel configuration:
|
||||
|
||||
# sysctl -p
|
||||
|
||||
Note that you may also need to tell firewalld that this kind of traffic should be allowed. Remember that you can refer to the article on that topic in this same series ([Part 11: Network Traffic Control Using FirewallD and Iptables][2]) if you need help to do that.
|
||||
|
||||
### Creating VM Images ###
|
||||
|
||||
By default, VM images will be created to `/var/lib/libvirt/images` and you are strongly advised to not change this unless you really need to, know what you’re doing, and want to handle SELinux settings yourself (such topic is out of the scope of this tutorial but you can refer to Part 13 of the RHCSA series: [Mandatory Access Control Essentials with SELinux][3] if you want to refresh your memory).
|
||||
|
||||
This means that you need to make sure that you have allocated the necessary space in that filesystem to accommodate your virtual machines.
|
||||
|
||||
The following command will create a virtual machine named `tecmint-virt01` with 1 virtual CPU, 1 GB (=1024 MB) of RAM, and 20 GB of disk space (represented by `/var/lib/libvirt/images/tecmint-virt01.img`) using the rhel-server-7.0-x86_64-dvd.iso image located inside /home/gacanepa/ISOs as installation media and the br0 as network bridge:
|
||||
|
||||
# virt-install \
|
||||
--network bridge=br0
|
||||
--name tecmint-virt01 \
|
||||
--ram=1024 \
|
||||
--vcpus=1 \
|
||||
--disk path=/var/lib/libvirt/images/tecmint-virt01.img,size=20 \
|
||||
--graphics none \
|
||||
--cdrom /home/gacanepa/ISOs/rhel-server-7.0-x86_64-dvd.iso
|
||||
--extra-args="console=tty0 console=ttyS0,115200"
|
||||
|
||||
If the installation file was located in a HTTP server instead of an image stored in your disk, you will have to replace the –cdrom flag with –location and indicate the address of the online repository.
|
||||
|
||||
As for the –graphics none option, it tells the installer to perform the installation in text-mode exclusively. You can omit that flag if you are using a GUI interface and a VNC window to access the main VM console. Finally, with –extra-args we are passing kernel boot parameters to the installer that set up a serial VM console.
|
||||
|
||||
The installation should now proceed as a regular (real) server now. If not, please review the steps listed above.
|
||||
|
||||
### Managing Virtual Machines ###
|
||||
|
||||
These are some typical administration tasks that you, as a system administrator, will need to perform on your virtual machines. Note that all of the following commands need to be run from your host:
|
||||
|
||||
**1. List all VMs:**
|
||||
|
||||
# virsh list --all
|
||||
|
||||
From the output of the above command you will have to note the Id for the virtual machine (although it will also return its name and current status) because you will need it for most administration tasks related to a particular VM.
|
||||
|
||||
**2. Display information about a guest:**
|
||||
|
||||
# virsh dominfo [VM Id]
|
||||
|
||||
**3. Start, restart, or stop a guest operating system:**
|
||||
|
||||
# virsh start | reboot | shutdown [VM Id]
|
||||
|
||||
**4. Access a VM’s serial console if networking is not available and no X server is running on the host:**
|
||||
|
||||
# virsh console [VM Id]
|
||||
|
||||
**Note** that this will require that you add the serial console configuration information to the `/etc/grub.conf` file (refer to the argument passed to the –extra-args option when the VM was created).
|
||||
|
||||
**5. Modify assigned memory or virtual CPUs:**
|
||||
|
||||
First, shutdown the guest:
|
||||
|
||||
# virsh shutdown [VM Id]
|
||||
|
||||
Edit the VM configuration for RAM:
|
||||
|
||||
# virsh edit [VM Id]
|
||||
|
||||
Then modify
|
||||
|
||||
<memory>[Memory size here without brackets]</memory>
|
||||
|
||||
Restart the VM with the new settings:
|
||||
|
||||
# virsh create /etc/libvirt/qemu/tecmint-virt01.xml
|
||||
|
||||
Finally, change the memory dynamically:
|
||||
|
||||
# virsh setmem [VM Id] [Memory size here without brackets]
|
||||
|
||||
For CPU:
|
||||
|
||||
# virsh edit [VM Id]
|
||||
|
||||
Then modify
|
||||
|
||||
<cpu>[Number of CPUs here without brackets]</cpu>
|
||||
|
||||
For further commands and details, please refer to table 26.1 in Chapter 26 of the RHEL 5 Virtualization guide (that guide, though a bit old, includes an exhaustive list of virsh commands used for guest administration).
|
||||
|
||||
### SUMMARY ###
|
||||
|
||||
In this article we have covered some basic aspects of virtualization with KVM in RHEL 7, which is both a vast and a fascinating topic, and I hope it will be helpful as a starting guide for you to later explore more advanced subjects found in the official [RHEL virtualization][4] getting started and [deployment / administration guides][5].
|
||||
|
||||
In addition, you can refer to the preceding articles in [this KVM series][6] in order to clarify or expand some of the concepts explained here.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/kvm-virtualization-basics-and-guest-administration/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.linux-kvm.org/page/Main_Page
|
||||
[2]:http://www.tecmint.com/firewalld-vs-iptables-and-control-network-traffic-in-firewall/
|
||||
[3]:http://www.tecmint.com/selinux-essentials-and-control-filesystem-access/
|
||||
[4]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Getting_Started_Guide/index.html
|
||||
[5]:https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/index.html
|
||||
[6]:http://www.tecmint.com/install-and-configure-kvm-in-linux/
|
@ -0,0 +1,71 @@
|
||||
安卓编年史
|
||||
================================================================================
|
||||
![姜饼上的 Google Music Beta。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/device-2014-03-31-110613.png)
|
||||
姜饼上的 Google Music Beta。
|
||||
Ron Amadeo 供图
|
||||
|
||||
### Google Music Beta —— 取代内容商店的云存储 ###
|
||||
|
||||
尽管蜂巢改进了 Google Music 的界面,但是音乐应用的设计并没有从蜂巢直接进化到冰淇淋三明治。2011年5月,谷歌发布了“[Google Music Beta][1]”,和新的 Google Music 应用一同到来的在线音乐存储。
|
||||
|
||||
新 Google Music 为安卓2.2及以上版本设计,借鉴了 Cooliris 相册的设计语言,但也有改变之处,背景使用了模糊处理的图片。几乎所有东西都是透明的:弹出菜单,顶部标签页,还有底部的正在播放栏。可以下载单独的歌曲或整个播放列表到设备上离线播放,这让 Google Music 成为一个让音乐同步到你所有设备的好途径。除了移动应用外,Google Music 还有一个 Web 应用,让它可以在任何一台桌面电脑上使用。
|
||||
|
||||
谷歌和唱片公司关于内容的合约还没有谈妥,音乐商店还没准备好,所以它的权宜之计是允许用户存储音乐到线上并下载到设备上。如今谷歌除了音乐存储服务外,还有单曲购买和订阅模式。
|
||||
|
||||
### Android 4.0, 冰淇淋三明治 —— 摩登时代 ###
|
||||
|
||||
![三星 Galaxy Nexus,安卓4.0的首发设备。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/samsung-i9250-galaxy-nexus-51.jpg)
|
||||
三星 Galaxy Nexus,安卓4.0的首发设备。
|
||||
|
||||
安卓4.0,冰淇淋三明治,在2011年10月发布,系统发布回到正轨,带来定期发布的手机和平板,并且安卓再次开源。这是自姜饼以来手机设备的第一个更新,意味着最主要的安卓用户群体近乎一年没有见到更新了。4.0随处可见缩小版的蜂巢设计,还将虚拟按键,操作栏(Action Bar),全新的设计语言带到了手机上。
|
||||
|
||||
冰淇淋三明治在三星 Galaxy Nexus 上首次亮相,也是最早带有720p显示屏的安卓手机之一。随着分辨率的提高,Galaxy Nexus 使用了更大的4.65英寸显示屏——几乎比最初的 Nexus One 大了一整英寸。这被许多批评者认为“太大了”,但如今的安卓设备甚至更大。(5英寸现在是“正常”的。)冰淇淋三明治比姜饼的性能要求更高,Galaxy Nexus 配备了一颗双核,1.2Ghz 德州仪器 OMAP 处理器和1GB的内存。
|
||||
|
||||
在美国,Galaxy Nexus 在 Verizon 首发并且支持 LTE。不像之前的 Nexus 设备,最流行的型号——Verizon版——是在运营商的控制之下,谷歌的软件和更新在手机得到更新之前要经过 Verizon 的核准。这导致了更新的延迟以及 Verizon 不喜欢的应用被移除,即便是 Google Wallet 也不例外。
|
||||
|
||||
多亏了冰淇淋三明治的软件改进,谷歌终于达成了移除手机上按钮的目标。有了虚拟导航键,实体电容按钮就可以移除了,最终 Galaxy Nexus 仅有电源和音量是实体按键。
|
||||
|
||||
![安卓4.0将很多蜂巢的设计缩小了。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/2home.png)
|
||||
安卓4.0将很多蜂巢的设计缩小了。
|
||||
Ron Amadeo 供图
|
||||
|
||||
电子质感的审美在蜂巢中显得有点多。于是在冰淇淋三明治中,谷歌开始减少科幻风的设计。科幻风的时钟字体从半透明折叠风格转变成纤细,优雅,看起来更加正常的字体。解锁环的水面波纹效果被去除了,蜂巢中的外星风格时钟小部件也被极简设计所取代。系统按钮也经过了重新设计,原先的蓝色轮廓,偶尔的厚边框变成了细的,设置带有白色轮廓。默认壁纸从蜂巢的蓝色太空船内部变成条纹状,破碎的彩虹,给默认布局增添了不少迟来的色彩。
|
||||
|
||||
蜂巢的系统栏在手机上一分为二。在顶上是传统的状态栏,底部是新的系统栏,放着三个系统按钮:后退,主屏幕,最近应用。一个固定的搜索栏放置在了主屏幕顶部。该栏以和底栏一样的方式固定在屏幕上,所以在五个主屏上,它总共占据了20个图标大小的位置。在蜂巢的锁屏上,内部的小圆圈可以向大圆圈外的任意位置滑动来解锁设备。在冰淇淋三明治,你得把小圆圈移动到解锁图标上。这个新准确度要求允许谷歌向锁屏添加新的选项:一个相机快捷方式。将小圆圈拖向相机图标会直接启动相机,跳过了主屏幕。
|
||||
|
||||
![一个手机系统意味着更多的应用,通知面板重新回到了全屏界面。](http://cdn.arstechnica.net/wp-content/uploads/2014/02/appsandnotic40.png)
|
||||
一个手机系统意味着更多的应用,通知面板重新回到了全屏界面。
|
||||
Ron Amadeo 供图
|
||||
|
||||
应用抽屉还是标签页式的,但是蜂巢中的“我的应用”标签被“部件”标签页替代,这是个简单的2×3部件略缩图视图。像蜂巢里的那样,这个应用抽屉是分页的,需要水平滑动换页。(如今安卓仍在使用这个应用抽屉设计。)应用抽屉里新增的是 Google+ 应用,后来独立存在。还有一个“Messenger”快捷方式,是 Google+ 的私密信息服务。(不要混淆 “Messenger” 和已有的 “Messaging” 短信应用。)
|
||||
|
||||
因为我们现在回到了手机上,所以短信,新闻和天气,电话,以及语音拨号都回来了,以及Cordy,一个平板的游戏,被移除了。尽管不是 Nexus 设备,我们的截图还是来自 Verizon 版的设备,可以从图上看到有像 “My Verizon Mobile” 和 “VZ Backup Assistant” 这样没用的应用。为了和冰淇淋三明治的去电子风格主题一致,日历和相机图标现在看起来更像是来自地球的东西而不是来自外星球。时钟,下载,电话,以及安卓市场同样得到了新图标,联系人“Contacts”获得了新图标,还有新名字“People”。
|
||||
|
||||
通知面板进行了大改造,特别是和[之前姜饼中的设计][2]相比而言。面板头部有个日期,一个设置的快捷方式,以及“清除所有”按钮。虽然蜂巢的第一个版本就允许用户通过通知右边的“X”消除单个通知,但是冰淇淋三明治的实现更加优雅:只要从左向右滑动通知即可。蜂巢有着蓝色高亮,但是蓝色色调到处都是。冰淇淋三明治几乎把所有地方的蓝色统一成一个(如果你想知道确定的值,hex码是#33B5E5)。通知面板的背景是透明的,底部的“把手”变为一个简单的小蓝圈,带着不透明的黑色背景。
|
||||
|
||||
![安卓市场的主页背景变成了黑色。](http://cdn.arstechnica.net/wp-content/uploads/2014/03/market.png)
|
||||
安卓市场的主页背景变成了黑色。
|
||||
Ron Amadeo 供图
|
||||
|
||||
市场获得了又一个新设计。它终于再次支持纵向模式,并且添加了音乐到商店中,你可以从中购买音乐。新的市场拓展了从蜂巢中引入的卡片概念,它还是第一个同时使用在手机和平板上的版本。主页上的卡片通常不是链接到应用的,而是指向特别的促销页面,像是“编辑精选”或季度促销。
|
||||
|
||||
----------
|
||||
|
||||
![Ron Amadeo](http://cdn.arstechnica.net/wp-content//uploads/authors/ron-amadeo-sq.jpg)
|
||||
|
||||
[Ron Amadeo][a] / Ron是Ars Technica的评论编缉,专注于安卓系统和谷歌产品。他总是在追寻新鲜事物,还喜欢拆解事物看看它们到底是怎么运作的。
|
||||
|
||||
[@RonAmadeo][t]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-history-of-googles-mobile-os/19/
|
||||
|
||||
译者:[alim0x](https://github.com/alim0x) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://arstechnica.com/gadgets/2011/05/hands-on-grooving-on-the-go-with-impressive-google-music-beta/
|
||||
[2]:http://cdn.arstechnica.net/wp-content/uploads/2014/02/32.png
|
||||
[a]:http://arstechnica.com/author/ronamadeo
|
||||
[t]:https://twitter.com/RonAmadeo
|
@ -1,126 +0,0 @@
|
||||
|
||||
NGINX Plus 现在完全支持 HTTP/2
|
||||
================================================================================
|
||||
本周早些时候,我们发布了对 HTTP/2 支持的 [NGINX Plus R7][1]。作为 HTTP 协议的最新标准,HTTP/2 的设计对现在的 web 应用程序带来了更高的性能和安全性。
|
||||
|
||||
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 有五个提高性能特点:
|
||||
|
||||
- **完全复用** – HTTP/1.1 强制按严格的顺序来对一个请求建立连接。请求建立必须在下一个进程开始之前完成。 HTTP/2 消除了这一要求,允许并行和乱序来完成请求的建立。
|
||||
|
||||
- **单一,持久连接** – 由于 HTTP/2 允许请求真正的复用,现在通过单一连接可以并行下载网页上的所有对象。在 HTTP/1.x 中,使用多个连接来并行下载资源,从而导致使用底层 TCP 协议效率很低。
|
||||
|
||||
- **二进制编码** – Header 信息使用紧凑二进制格式发送,而不是纯文本格式,节省了传输字节。
|
||||
|
||||
- **Header 压缩** – Headers 使用专用的算法来进行压缩,HPACK 压缩,这进一步降低数据通过网络传输的字节。
|
||||
|
||||
- **SSL/TLS encryption** – 在 HTTP/2 中,强制使用 SSL/TLS。在 [RFC][2] 中并没有强制,其允许纯文本的 HTTP/2,它是由当前 Web 浏览器执行 HTTP/2 的。 SSL/TLS 使你的网站更安全,并且使用 HTTP/2 所有性能会有提升,加密和解密过程的性能也有所提升。
|
||||
|
||||
要了解更多关于 HTTP/2:
|
||||
|
||||
- 请阅读我们的 [白皮书][3],它涵盖了你需要了解HTTP/2 的一切。
|
||||
- 下载由 Google 的 Ilya Grigorik 编写的 [特别版的高性能浏览器网络电子书][4] 。
|
||||
|
||||
### NGINX Plus 如何实现 HTTP/2 ###
|
||||
|
||||
实现 HTTP/2 要基于对 SPDY 的支持,它已经被广泛部署(使用了 NGINX 或 NGINX Plus 的网站近 75% 都使用了 SPDY)。使用 NGINX Plus 部署 HTTP/2 时,几乎不会改变你应用程序的配置。本节将讨论 NGINX Plus如何实现对 HTTP/2 的支持。
|
||||
|
||||
#### 一个 HTTP/2 网关 ####
|
||||
|
||||
![](https://www.nginx.com/wp-content/uploads/2015/09/http2-27-1024x300.png)
|
||||
|
||||
NGINX Plus 作为一个 HTTP/2 网关。它谈到 HTTP/2 对客户端 Web 浏览器支持,但传输 HTTP/2 请求返回给后端服务器通信时使用 HTTP/1.x(或者 FastCGI, SCGI, uWSGI, 等等. – 取决于你目前正在使用的协议)。
|
||||
|
||||
#### 向后兼容性 ####
|
||||
|
||||
![](https://www.nginx.com/wp-content/uploads/2015/09/http2-281-1024x581.png)
|
||||
|
||||
在不久的未来,你需要同时支持 HTTP/2 和 HTTP/1.x。在撰写本文时,超过50%的用户使用的 Web 浏览器已经[支持 HTTP/2][5],但这也意味着近50%的人还没有使用。
|
||||
|
||||
为了同时支持 HTTP/1.x 和 HTTP/2,NGINX Plus 实现了将 Next Protocol Negotiation (NPN协议)扩展到 TLS 中。当 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 加密,现在启用它正是一个好的时机。加密你的应用程序可以保护你免受间谍以及来自其他中间人的攻击。一些搜索引擎甚至在搜索结果中对加密站点 [提高排名][6]。下面的配置块重定向所有的普通 HTTP 请求到该网站的加密版本。
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
#### 启用 HTTP/2 ####
|
||||
|
||||
要启用对 HTTP/2 的支持,只需将 http2 参数添加到所有的 [listen][7] 指令中,包括 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][8] 和 [Firefox][9] 中使用 “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。在以后的版本中,我们将弃用对 SPDY 的支持。谷歌在2016年初将 [弃用 SPDY][10],因此同时支持这两种协议也非必要。
|
||||
|
||||
- 如果 [ssl_prefer_server_ciphers][11] 设置为 on 或者 [ssl_ciphers][12] 列表被定义在 [Appendix A: TLS 1.2 Ciper Suite Black List][13] 使用时,浏览器会出现 handshake-errors 而无法正常工作。详细内容请参阅 [section 9.2.2 of the HTTP/2 RFC][14]。
|
||||
|
||||
### 特别感谢 ###
|
||||
|
||||
NGINX,公司要感谢 [Dropbox][15] 和 [Automattic][16],他们是我们软件的重度使用者,并帮助我们实现 HTTP/2。他们的贡献帮助我们加速完成这个软件,我们希望你也能支持他们。
|
||||
|
||||
![](https://www.nginx.com/wp-content/themes/nginx-theme/assets/img/landing-page/highperf_nginx_ebook.png)
|
||||
|
||||
[O'REILLY'S BOOK ABOUT HTTP/2 & PERFORMANCE TUNING][17]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.nginx.com/blog/http2-r7/
|
||||
|
||||
作者:[Faisal Memon][a]
|
||||
译者:[strugglingyouth](https://github.com/strugglingyouth)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.nginx.com/blog/author/fmemon/
|
||||
[1]:https://www.nginx.com/blog/nginx-plus-r7-released/
|
||||
[2]:https://tools.ietf.org/html/rfc7540
|
||||
[3]:https://www.nginx.com/wp-content/uploads/2015/09/NGINX_HTTP2_White_Paper_v4.pdf
|
||||
[4]:https://www.nginx.com/http2-ebook/
|
||||
[5]:http://caniuse.com/#feat=http2
|
||||
[6]:http://googlewebmastercentral.blogspot.co.uk/2014/08/https-as-ranking-signal.html
|
||||
[7]:http://nginx.org/en/docs/http/ngx_http_core_module.html#listen
|
||||
[8]:https://chrome.google.com/webstore/detail/http2-and-spdy-indicator/mpbpobfflnpcgagjijhmgnchggcjblin?hl=en
|
||||
[9]:https://addons.mozilla.org/en-us/firefox/addon/spdy-indicator/
|
||||
[10]:http://blog.chromium.org/2015/02/hello-http2-goodbye-spdy-http-is_9.html
|
||||
[11]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_prefer_server_ciphers
|
||||
[12]:http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_ciphers
|
||||
[13]:https://tools.ietf.org/html/rfc7540#appendix-A
|
||||
[14]:https://tools.ietf.org/html/rfc7540#section-9.2.2
|
||||
[15]:http://dropbox.com/
|
||||
[16]:http://automattic.com/
|
||||
[17]:https://www.nginx.com/http2-ebook/
|
@ -0,0 +1,128 @@
|
||||
开发者的 Linux 容器之旅
|
||||
================================================================================
|
||||
![](https://deis.com/images/blog-images/dev_journey_0.jpg)
|
||||
|
||||
我告诉你一个秘密:使得我的应用程序进入到全世界的所有云计算的东西,对我来说仍然有一点神秘。但随着时间流逝,我意识到理解大规模机器配置和应用程序部署的来龙去脉对一个开发者来说是非常重要的知识。这类似于成为一个专业的音乐家。你当然需要知道如何使用你的乐器。但是,如果你不知道一个录音室是如何工作的,或者你如何适应一个交响乐团,你在这样的环境中工作会变得非常困难。
|
||||
|
||||
在软件开发的世界里,使你的代码进入我们更大的世界正如写出它来一样重要。开发重要,而且是很重要。
|
||||
|
||||
因此,为了弥合开发和部署之间的间隔,我会从头开始介绍容器技术。为什么是容器?因为有强有力的证据表明,容器是机器抽象的下一步:使计算机成为场所而不再是一个东西。理解容器是我们共同的旅程。
|
||||
|
||||
在这篇文章中,我会介绍容器化背后的概念。容器和虚拟机的区别。以及容器构建背后的逻辑以及它是如何适应应用程序架构的。我会探讨轻量级的 Linux 操作系统是如何适应容器生态系统。我还会讨论使用镜像创建可重用的容器。最后我会介绍容器集群如何使你的应用程序可以快速扩展。
|
||||
|
||||
在后面的文章中,我会一步一步向你介绍容器化一个事例应用程序的过程,以及如何为你的应用程序容器创建一个托管集群。同时,我会向你展示如何使用 Deis 将你的事例应用程序部署到你本地系统以及多种云供应商的虚拟机上。
|
||||
|
||||
让我们开始吧。
|
||||
|
||||
### 虚拟机的好处 ###
|
||||
|
||||
为了理解容器如何适应事物发展,你首先要了解容器的前者:虚拟机
|
||||
|
||||
[虚拟机][1] 是运行在物理宿主机上的软件抽象。配置一个虚拟机就像是购买一台计算机:你需要定义你想要的 CPU 数目,RAM 和磁盘存储容量。配置好了机器后,你把它加载到操作系统,然后是你想让虚拟机支持的任何服务器或者应用程序。
|
||||
|
||||
虚拟机允许你在一台硬件主机上运行多个模拟计算机。这是一个简单的示意图:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_1.png)
|
||||
|
||||
虚拟机使得能充分利用你的硬件资源。你可以购买一台大型机然后在上面运行多个虚拟机。你可以有一个数据库虚拟机以及很多运行相同版本定制应用程序的虚拟机构成的集群。你可以在有限的硬件资源获得很多的扩展能力。如果你觉得你需要更多的虚拟机而且你的宿主硬件还有容量,你可以添加任何你想要的。或者,如果你不再需要一个虚拟机,你可以关闭该虚拟机并删除虚拟机镜像。
|
||||
|
||||
### 虚拟机的局限 ###
|
||||
|
||||
但是,虚拟机确实有局限。
|
||||
|
||||
如上面所示,假如你在一个主机上创建了三个虚拟机。主机有 12 个 CPU,48 GB 内存和 3TB 的存储空间。每个虚拟机配置为有 4 个 CPU,16 GB 内存和 1TB 存储空间。到现在为止,一切都还好。主机有这个容量。
|
||||
|
||||
但这里有个缺陷。所有分配给一个虚拟机的资源,无论是什么,都是专有的。每台机器都分配了 16 GB 的内存。但是,如果第一个虚拟机永不会使用超过 1GB 分配的内存,剩余的 15 GB 就会被浪费在那里。如果第三天虚拟机只使用分配的 1TB 存储空间中的 100GB,其余的 900GB 就成为浪费空间。
|
||||
|
||||
这里没有资源的流动。每台虚拟机拥有分配给它的所有资源。因此,在某种方式上我们又回到了虚拟机之前,把大部分金钱花费在未使用的资源上。
|
||||
|
||||
虚拟机还有*另一个*缺陷。扩展他们需要很长时间。如果你处于基础设施需要快速增长的情形,即使虚拟机配置是自动的,你仍然会发现你的很多时间都浪费在等待机器上线。
|
||||
|
||||
### 来到:容器 ###
|
||||
|
||||
概念上来说,容器是 Linux 中认为只有它自己的一个进程。该进程只知道告诉它的东西。另外,在容器化方面,该容器进程也分配了它自己的 IP 地址。这点很重要,我会再次重复。**在容器化方面,容器进程有它自己的 IP 地址**。一旦给予了一个 IP 地址,该进程就是宿主网络中可识别的资源。然后,你可以在容器管理器上运行命令,使容器 IP 映射到主机中能访问公网的 IP 地址。该映射发生时,对于任何意图和目的,一个容器就是网络上一个可访问的独立机器,概念上类似于虚拟机。
|
||||
|
||||
再次说明,容器是拥有不同 IP 地址从而使其成为网络上可识别的独立 Linux 进程。下面是一个示意图:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_2.png)
|
||||
|
||||
容器/进程以动态合作的方式共享主机上的资源。如果容器只需要 1GB 内存,它就只会使用 1GB。如果它需要 4GB,就会使用 4GB。CPU 和存储空间利用也是如此。CPU,内存和存储空间的分配是动态的,和典型虚拟机的静态方式不同。所有这些资源的共享都由容器管理器管理。
|
||||
|
||||
最后,容器能快速启动。
|
||||
|
||||
因此,容器的好处是:**你获得了虚拟机独立和封装的好处而抛弃了专有静态资源的缺陷**。另外,由于容器能快速加载到内存,在扩展到多个容器时你能获得更好的性能。
|
||||
|
||||
### 容器托管、配置和管理 ###
|
||||
|
||||
托管容器的计算机运行着被剥离的只剩下主要部分的 Linux 版本。现在,宿主计算机流行的底层操作系统是上面提到的 [CoreOS][2]。当然还有其它,例如 [Red Hat Atomic Host][3] 和 [Ubuntu Snappy][4]。
|
||||
|
||||
所有容器之间共享Linux 操作系统,减少了容器足迹的重复和冗余。每个容器只包括该容器唯一的部分。下面是一个示意图:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_3.png)
|
||||
|
||||
你用它所需的组件配置容器。一个容器组件被称为**层**。一层是一个容器镜像,(你会在后面的部分看到更多关于容器镜像的介绍)。你从一个基本层开始,这通常是你想在容器中使用的操作系统。(容器管理器只提供你想要的操作系统在宿主操作系统中不存在的部分。)当你构建配置你的容器时,你会添加层,例如你想要添加网络服务器 Apache,如果容器要运行脚本,则需要添加 PHP 或 Python 运行时。
|
||||
|
||||
分层非常灵活。如果应用程序或者服务容器需要 PHP 5.2 版本,你相应地配置该容器即可。如果你有另一个应用程序或者服务需要 PHP 5.6 版本,没问题,你可以使用 PHP 5.6 配置该容器。不像虚拟机,更改一个版本的运行时依赖时你需要经过大量的配置和安装过程;对于容器你只需要在容器配置文件中重新定义层。
|
||||
|
||||
所有上面描述的容器多功能性都由一个称为容器管理器的软件控制。现在,最流行的容器管理器是 [Docker][5] 和 [Rocket][6]。上面的示意图展示了容器管理器是 Docker,宿主操作系统是 CentOS 的主机情景。
|
||||
|
||||
### 容器由镜像构成 ###
|
||||
|
||||
当你需要将我们的应用程序构建到容器时,你就会编译镜像。镜像代表了需要完成容器工作的容器模板。(容器里的容器)。镜像被保存在网络上的注册表里。
|
||||
|
||||
从概念上讲,注册表类似于一个使用 Java 的人眼中的 [Maven][7] 仓库,使用 .NET 的人眼中的 [NuGet][8] 服务器。你会创建一个列出了你应用程序所需镜像的容器配置文件。然后你使用容器管理器创建一个包括了你应用程序代码以及从注册表中下载的构成资源的容器。例如,如果你的应用程序包括了一些 PHP 文件,你的容器配置文件会声明你会从注册表中获取 PHP 运行时。另外,你还要使用容器配置文件声明需要复制到容器文件系统中的 .php 文件。容器管理器会封装你应用程序的所有东西为一个独立容器。该容器将会在容器管理器的管理下运行在宿主计算机上。
|
||||
|
||||
这是一个容器创建背后概念的示意图:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_4.png)
|
||||
|
||||
让我们仔细看看这个示意图。
|
||||
|
||||
(1)表示一个定义了你容器所需东西以及你容器如何构建的容器配置文件。当你在主机上运行容器时,容器管理器会读取配置文件从云上的注册表中获取你需要的容器镜像,(2)作为层将镜像添加到你的容器。
|
||||
|
||||
另外,如果组成镜像需要其它镜像,容器管理器也会获取这些镜像并把它们作为层添加进来。(3)容器管理器会将需要的文件复制到容器中。
|
||||
|
||||
如果你使用了配置服务,例如 [Deis][9],你刚刚创建的应用程序容器作为镜像存在(4)配置服务会将它部署到你选择的云供应商上。类似 AWS 和 Rackspace 云供应商。
|
||||
|
||||
### 集群中的容器 ###
|
||||
|
||||
好了。这里有一个很好的例子说明了容器比虚拟机提供了更好的配置灵活性和资源利用率。但是,这并不是全部。
|
||||
|
||||
容器真正灵活是在集群中。记住,每个容器有一个独立的 IP 地址。因此,能把它放到负载均衡器后面。将容器放到负载均衡器后面,就上升了一个层次。
|
||||
|
||||
你可以在一个负载均衡容器后运行容器集群以获得更高的性能和高可用计算。这是一个例子:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_5.png)
|
||||
|
||||
假如你开发了一个进行资源密集型工作的应用程序。例如图片处理。使用类似 [Deis][9] 的容器配置技术,你可以创建一个包括了你图片处理程序以及你图片处理程序需要的所有资源的容器镜像。然后,你可以部署一个或多个容器镜像到主机上的负载均衡器。一旦创建了容器镜像,你可以在系统快要刷爆时把它放到一边,为了满足手中的工作时添加更多的容器实例。
|
||||
|
||||
这里还有更多好消息。你不需要每次添加实例到环境中时手动配置负载均衡器以便接受你的容器镜像。你可以使用服务发现技术告知均衡器你容器的可用性。然后,一旦获知,均衡器就会将流量分发到新的结点。
|
||||
|
||||
### 全部放在一起 ###
|
||||
|
||||
容器技术完善了虚拟机不包括的部分。类似 CoreOS、RHEL Atomic、和 Ubuntu 的 Snappy 宿主操作系统,和类似 Docker 和 Rocket 的容器管理技术结合起来,使得容器变得日益流行。
|
||||
|
||||
尽管容器变得更加越来越普遍,掌握它们还是需要一段时间。但是,一旦你懂得了它们的窍门,你可以使用类似 [Deis][9] 的配置技术使容器创建和部署变得更加简单。
|
||||
|
||||
概念上理解容器和进一步实际使用它们完成工作一样重要。但我认为不实际动手把想法付诸实践,概念也难以理解。因此,我们该系列的下一阶段就是:创建一些容器。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://deis.com/blog/2015/developer-journey-linux-containers
|
||||
|
||||
作者:[Bob Reselman][a]
|
||||
译者:[ictlyh](http://www.mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://deis.com/blog
|
||||
[1]:https://en.wikipedia.org/wiki/Virtual_machine
|
||||
[2]:https://coreos.com/using-coreos/
|
||||
[3]:http://www.projectatomic.io/
|
||||
[4]:https://developer.ubuntu.com/en/snappy/
|
||||
[5]:https://www.docker.com/
|
||||
[6]:https://coreos.com/blog/rocket/
|
||||
[7]:https://en.wikipedia.org/wiki/Apache_Maven
|
||||
[8]:https://www.nuget.org/
|
||||
[9]:http://deis.com/learn
|
@ -0,0 +1,153 @@
|
||||
第九部分 - 如果使用零客户端配置 Postfix 邮件服务器(SMTP)
|
||||
================================================================================
|
||||
尽管现在有很多在线联系方式,邮件仍然是一个人传递信息给远在世界尽头或办公室里坐在我们旁边的另一个人的有效方式。
|
||||
|
||||
下面的图描述了邮件从发送者发出直到信息到达接收者收件箱的传递过程。
|
||||
|
||||
![邮件如何工作](http://www.tecmint.com/wp-content/uploads/2015/09/How-Mail-Setup-Works.png)
|
||||
|
||||
邮件如何工作
|
||||
|
||||
要使这成为可能,背后发生了好多事情。为了使邮件信息从一个客户端应用程序(例如 [Thunderbird][1]、Outlook,或者网络邮件服务,例如 Gmail 或 Yahoo 邮件)到一个邮件服务器,并从其到目标服务器并最终到目标接收人,每个服务器上都必须有 SMTP(简单邮件传输协议)服务。
|
||||
|
||||
这就是为什么我们要在这篇博文中介绍如何在 RHEL 7 中设置 SMTP 服务器,从中本地用户发送的邮件(甚至发送到本地用户)被转发到一个中央邮件服务器以便于访问。
|
||||
|
||||
在实际需求中这称为零客户端安装。
|
||||
|
||||
在我们的测试环境中将包括一个原始邮件服务器和一个中央服务器或中继主机。
|
||||
|
||||
原始邮件服务器: (主机名: 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
|
||||
|
||||
|
||||
![在防火墙中开通邮件服务器端口](http://www.tecmint.com/wp-content/uploads/2015/09/Allow-Traffic-through-Firewall.png)
|
||||
|
||||
在防火墙中开通邮件服务器端口
|
||||
|
||||
**4. 在 box1.mydomain.com 配置 Postfix**
|
||||
|
||||
Postfix 的主要配置文件是 /etc/postfix/main.cf。这个文件本身是一个很大的文本,因为其中包含的注释解析了程序设置的目的。
|
||||
|
||||
为了简洁,我们只显示了需要编辑的行(是的,在原始服务器中你需要保留 mydestination 为空;否则邮件会被保存到本地而不是我们实际想要的中央邮件服务器):
|
||||
|
||||
**在 box1.mydomain.com 配置 Postfix**
|
||||
|
||||
----------
|
||||
|
||||
myhostname = box1.mydomain.com
|
||||
mydomain = mydomain.com
|
||||
myorigin = $mydomain
|
||||
inet_interfaces = loopback-only
|
||||
mydestination =
|
||||
relayhost = 192.168.0.20
|
||||
|
||||
**5. 在 mail.mydomain.com 配置 Postfix**
|
||||
|
||||
** 在 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 权限](http://www.tecmint.com/wp-content/uploads/2015/09/Set-Postfix-SELinux-Permission.png)
|
||||
|
||||
设置 Postfix SELinux 权限
|
||||
|
||||
上面的 SELinux 布尔值会允许 Postfix 在中央服务器写入邮件池。
|
||||
|
||||
**6. 在两台机子上重启服务以使更改生效:**
|
||||
|
||||
# systemctl restart postfix
|
||||
|
||||
如果 Postfix 没有正确启动,你可以使用下面的命令进行错误处理。
|
||||
|
||||
# systemctl –l status postfix
|
||||
# journalctl –xn
|
||||
# postconf –n
|
||||
|
||||
### 测试 Postfix 邮件服务 ###
|
||||
|
||||
为了测试邮件服务器,你可以使用任何邮件用户代理(最常见的简称为 MUA)例如 [mail 或 mutt][2]。
|
||||
|
||||
由于我个人喜欢 mutt,我会在 box1 中使用它发送邮件给用户 tecmint,并把现有文件(mailbody.txt)作为信息内容:
|
||||
|
||||
# mutt -s "Part 9-RHCE series" tecmint@mydomain.com < mailbody.txt
|
||||
|
||||
![测试 Postfix 邮件服务器](http://www.tecmint.com/wp-content/uploads/2015/09/Test-Postfix-Mail-Server.png)
|
||||
|
||||
测试 Postfix 邮件服务器
|
||||
|
||||
现在到中央邮件服务器(mail.mydomain.com)以 tecmint 用户登录,并检查是否收到了邮件:
|
||||
|
||||
# su – tecmint
|
||||
# mail
|
||||
|
||||
![检查 Postfix 邮件服务器发送](http://www.tecmint.com/wp-content/uploads/2015/09/Check-Postfix-Mail-Server-Delivery.png)
|
||||
|
||||
检查 Postfix 邮件服务器发送
|
||||
|
||||
如果没有收到邮件,检查 root 用户的邮件池查看警告或者错误提示。你也需要使用 [nmap 命令][3]确保两台服务器运行了 SMTP 服务,并在中央邮件服务器中 打开了 25 号端口:
|
||||
|
||||
# nmap -PN 192.168.0.20
|
||||
|
||||
![Postfix 邮件服务器错误处理](http://www.tecmint.com/wp-content/uploads/2015/09/Troubleshoot-Postfix-Mail-Server.png)
|
||||
|
||||
Postfix 邮件服务器错误处理
|
||||
|
||||
### 总结 ###
|
||||
|
||||
像本文中展示的设置邮件服务器和中继主机是每个系统管理员必须拥有的重要技能,也代表了理解和安装更复杂情景的基础,例如一个邮件服务器托管有多个邮件账户(甚至成百上千)的域名。
|
||||
|
||||
(请注意这种类型的设置需要有 DNS 服务器,这不在本文的介绍范围),但你可以参照下面的文章设置 DNS 服务器:
|
||||
|
||||
- [在 CentOS/RHEL 07 上配置仅缓存的 DNS 服务器][4]
|
||||
|
||||
最后,我强烈建议你熟悉 Postfix 的配置文件(main.cf)和这个程序的帮助手册。如果有任何疑问,别犹豫,使用下面的评论框或者我们的论坛 Linuxsay.com 告诉我们吧,你会从世界各地的 Linux 高手中获得几乎及时的帮助。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/
|
||||
|
||||
作者:[Gabriel Cánepa][a]
|
||||
译者:[ictlyh](https//www.mutouxiaogui.cn/blog/)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.tecmint.com/author/gacanepa/
|
||||
[1]:http://www.tecmint.com/install-thunderbird-17-in-ubuntu-xubuntu-linux-mint/
|
||||
[2]:http://www.tecmint.com/send-mail-from-command-line-using-mutt-command/
|
||||
[3]:http://www.tecmint.com/nmap-command-examples/
|
||||
[4]:http://www.tecmint.com/setup-dns-cache-server-in-centos-7/
|
Loading…
Reference in New Issue
Block a user