mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
commit
63f12bf5f1
@ -1,12 +1,13 @@
|
||||
在CentOS 7中安装并使用Ansible(自动化工具)
|
||||
在 CentOS 7 中安装并使用自动化工具 Ansible
|
||||
================================================================================
|
||||
Ansible是一款为类Unix系统开发的免费开源配置和自动化工具。它用Python写成并且和Chef和Puppet相似,但是有一个不同和好处是我们不需要在节点中安装任何客户端。它使用SSH来和节点进行通信。
|
||||
|
||||
Ansible是一款为类Unix系统开发的自由开源的配置和自动化工具。它用Python写成,类似于Chef和Puppet,但是有一个不同和优点是我们不需要在节点中安装任何客户端。它使用SSH来和节点进行通信。
|
||||
|
||||
本篇中我们将在CentOS 7上安装并配置Ansible,并且尝试管理两个节点。
|
||||
|
||||
**Ansible 服务端** – ansible.linuxtechi.com ( 192.168.1.15 )
|
||||
- **Ansible 服务端** – ansible.linuxtechi.com ( 192.168.1.15 )
|
||||
|
||||
**Nodes** – 192.168.1.9 , 192.168.1.10
|
||||
- **节点** – 192.168.1.9 , 192.168.1.10
|
||||
|
||||
### 第一步: 设置EPEL仓库 ###
|
||||
|
||||
@ -38,17 +39,16 @@ Ansible仓库默认不在yum仓库中,因此我们需要使用下面的命令
|
||||
|
||||
### 第四步:为Ansible定义节点的清单 ###
|
||||
|
||||
文件 ‘**/etc/ansible/hosts**‘ 维护了Ansible中服务器的清单。
|
||||
文件 `/etc/ansible/hosts` 维护着Ansible中服务器的清单。
|
||||
|
||||
[root@ansible ~]# vi /etc/ansible/hosts
|
||||
[test-servers]
|
||||
192.168.1.9
|
||||
192.168.1.10
|
||||
|
||||
Save and exit the file.
|
||||
保存并退出文件
|
||||
保存并退出文件。
|
||||
|
||||
主机文件示例。
|
||||
主机文件示例如下:
|
||||
|
||||
![ansible-host](http://www.linuxtechi.com/wp-content/uploads/2015/09/ansible-host.jpg)
|
||||
|
||||
@ -62,19 +62,19 @@ Save and exit the file.
|
||||
|
||||
#### 执行shell命令 ####
|
||||
|
||||
**例子1:检查Ansible节点的运行时间 **
|
||||
**例子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:检查节点的内核版本 **
|
||||
**例子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:给节点增加用户 **
|
||||
**例子3:给节点增加用户**
|
||||
|
||||
[root@ansible ~]# ansible -m command -a "useradd mark" 'test-servers'
|
||||
[root@ansible ~]# ansible -m command -a "grep mark /etc/passwd" 'test-servers'
|
||||
@ -93,7 +93,7 @@ via: http://www.linuxtechi.com/install-and-use-ansible-in-centos-7/
|
||||
|
||||
作者:[Pradeep Kumar][a]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](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
|
@ -1,43 +1,43 @@
|
||||
RHCSA 系列: 在 RHEL 7 中设置基于 LDAP 的认证 – Part 14
|
||||
RHCSA 系列(十四): 在 RHEL 7 中设置基于 LDAP 的认证
|
||||
================================================================================
|
||||
在这篇文章中,我们将首先罗列一些 LDAP 的基础知识(它是什么,它被用于何处以及为什么会被这样使用),然后向你展示如何使用 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
|
||||
*RHCSA 系列:设置 LDAP 服务器及客户端认证 – Part 14*
|
||||
|
||||
正如你将看到的那样,关于认证,还存在其他可能的应用场景,但在这篇指南中,我们将只关注基于 LDAP 的认证。另外,请记住,由于这个话题的广泛性,在这里我们将只涵盖它的基础知识,但你可以参考位于总结部分中列出的文档,以此来了解更加深入的细节。
|
||||
|
||||
基于相同的原因,你将注意到:为了简洁起见,我已经决定省略了几个位于 man 页中 LDAP 工具的参考,但相应命令的解释是近在咫尺的(例如,输入 man ldapadd)。
|
||||
基于相同的原因,你将注意到:为了简洁起见,我已经决定省略了几个位于 man 页中 LDAP 工具的参考,但相应命令的解释是近在咫尺的(例如,输入 man ldapadd)。
|
||||
|
||||
那还是让我们开始吧。
|
||||
|
||||
**我们的测试环境**
|
||||
|
||||
我们的测试环境包含两台 RHEL 7 机子:
|
||||
我们的测试环境包含两台 RHEL 7机器:
|
||||
|
||||
Server: 192.168.0.18. FQDN: rhel7.mydomain.com
|
||||
Client: 192.168.0.20. FQDN: ldapclient.mydomain.com
|
||||
|
||||
如若你想,你可以使用在 [Part 12: RHEL 7 的自动化安装][1] 中使用 Kickstart 安装的机子来作为客户端。
|
||||
如若你想,你可以使用在 [RHCSA 系列(十二): 使用 Kickstart 完成 RHEL 7 的自动化安装][1] 中使用 Kickstart 安装的机子来作为客户端。
|
||||
|
||||
#### LDAP 是什么? ####
|
||||
|
||||
LDAP 代表轻量级目录访问协议(Lightweight Directory Access Protocol),并包含在一系列协议之中,这些协议允许一个客户端通过网络去获取集中存储的信息(例如登陆 shell 的目录,家目录的绝对路径,或者其他典型的系统用户信息),而这些信息可以从不同的地方访问到或被很多终端用户获取到(另一个例子是含有某个公司所有雇员的家庭地址和电话号码的目录)。
|
||||
LDAP 代表轻量级目录访问协议(Lightweight Directory Access Protocol),并包含在一系列协议之中,这些协议允许一个客户端通过网络去获取集中存储的信息(例如所登录的 shell 的路径,家目录的绝对路径,或者其他典型的系统用户信息),而这些信息可以从不同的地方访问到或被很多终端用户获取到(另一个例子是含有某个公司所有雇员的家庭地址和电话号码的目录)。
|
||||
|
||||
对于那些被赋予了权限可以使用这些信息的人来说,将这些信息进行集中管理意味着可以更容易地维护和获取。
|
||||
|
||||
下面的图表提供了一个简化了的关于 LDAP 的示意图,且在下面将会进行更多的描述:
|
||||
下面的图表提供了一个简化了的关于 LDAP 的示意图,在下面将会进行更多的描述:
|
||||
|
||||
![LDAP 示意图](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Diagram.png)
|
||||
|
||||
LDAP 示意图
|
||||
*LDAP 示意图*
|
||||
|
||||
下面是对上面示意图的一个详细解释。
|
||||
|
||||
- 在一个 LDAP 目录中,一个条目代表一个独立单元或信息,被所谓的 Distinguished Name 唯一识别。
|
||||
- 一个属性是一些与某个条目相关的信息(例如地址,有效的联系电话号码和邮箱地址)。
|
||||
- 每个属性被分配有一个或多个值,这些值被包含在一个以空格为分隔符的列表中。每个条目中那个唯一的值被称为一个 Relative Distinguished Name。
|
||||
- 在一个 LDAP 目录中,一个条目(entry)代表一个独立单元或信息,被所谓的 Distinguished Name(DN,区别名) 唯一识别。
|
||||
- 一个属性(attribute)是一些与某个条目相关的信息(例如地址,有效的联系电话号码和邮箱地址)。
|
||||
- 每个属性被分配有一个或多个值(value),这些值被包含在一个以空格为分隔符的列表中。每个条目中那个唯一的值被称为一个 Relative Distinguished Name(RDN,相对区别名)。
|
||||
|
||||
接下来,就让我们进入到有关服务器和客户端安装的内容。
|
||||
|
||||
@ -67,7 +67,7 @@ LDAP 示意图
|
||||
# systemctl restart slapd.service
|
||||
# systemctl stop slapd.service
|
||||
|
||||
**3. 由于 slapd 服务是由 ldap 用户来运行的(你可以使用 `ps -e -o pid,uname,comm | grep slapd` 来验证),为了使得服务器能够更改由管理工具创建的条目,这个用户应该有目录 `/var/lib/ldap` 的所有权,而这些管理工具仅可以由 root 用户来运行(紧接着有更多这方面的内容)。**
|
||||
**3. 由于 slapd 服务是由 ldap 用户来运行的(你可以使用 `ps -e -o pid,uname,comm | grep slapd` 来验证),为了使得服务器能够更改由管理工具创建的条目,该用户应该有目录 `/var/lib/ldap` 的所有权,而这些管理工具仅可以由 root 用户来运行(紧接着有更多这方面的内容)。**
|
||||
|
||||
在递归地更改这个目录的所有权之前,将 slapd 的示例数据库配置文件复制进这个目录:
|
||||
|
||||
@ -78,11 +78,11 @@ LDAP 示意图
|
||||
|
||||
# slappasswd
|
||||
|
||||
正如下一福图所展示的那样:
|
||||
正如下一幅图所展示的那样:
|
||||
|
||||
![设置 LDAP 管理密码](http://www.tecmint.com/wp-content/uploads/2015/06/Set-LDAP-Admin-Password.png)
|
||||
|
||||
设置 LDAP 管理密码
|
||||
*设置 LDAP 管理密码*
|
||||
|
||||
然后以下面的内容创建一个 LDIF 文件(`ldaprootpasswd.ldif`):
|
||||
|
||||
@ -97,9 +97,9 @@ LDAP 示意图
|
||||
- cn=config 指的是全局配置选项。
|
||||
- olcDatabase 指的是一个特定的数据库实例的名称,并且通常可以在 `/etc/openldap/slapd.d/cn=config` 目录中发现。
|
||||
|
||||
根据上面提供的理论背景,`ldaprootpasswd.ldif` 文件将添加一个条目到 LDAP 目录中。在那个条目中,每一行代表一个属性键值对(其中 dn,changetype,add 和 olcRootPW 为属性,每个冒号右边的字符串为相应的键值)。
|
||||
根据上面提供的理论背景,`ldaprootpasswd.ldif` 文件将添加一个条目到 LDAP 目录中。在那个条目中,每一行代表一个属性键值对(其中 dn,changetype,add 和 olcRootPW 为属性,每个冒号右边的字符串为相应的键值)。
|
||||
|
||||
随着我们的进一步深入,请记住上面的这些,并注意到在这篇文章的余下部分,我们使用相同的 Common Names `(cn=)`,而这些余下的步骤中的每一步都将与其上一步相关。
|
||||
随着我们的进一步深入,请记住上面的这些,并注意到在这篇文章的余下部分,我们使用相同的 Common Names(通用名) `(cn=)`,而这些余下的步骤中的每一步都将与其上一步相关。
|
||||
|
||||
**5. 现在,通过特别指定相对于 ldap 服务的 URI ,添加相应的 LDAP 条目,其中只有 protocol/host/port 这几个域被允许使用。**
|
||||
|
||||
@ -109,7 +109,7 @@ LDAP 示意图
|
||||
|
||||
![LDAP 配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Configuration.png)
|
||||
|
||||
LDAP 配置
|
||||
*LDAP 配置*
|
||||
|
||||
接着从 `/etc/openldap/schema` 目录导入一个基本的 LDAP 定义:
|
||||
|
||||
@ -117,11 +117,11 @@ LDAP 配置
|
||||
|
||||
![LDAP 定义](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Definitions.png)
|
||||
|
||||
LDAP 定义
|
||||
*LDAP 定义*
|
||||
|
||||
**6. 让 LDAP 在它的数据库中使用你的域名。**
|
||||
|
||||
以下面的内容创建另一个 LDIF 文件,我们称之为 `ldapdomain.ldif`, 然后酌情替换这个文件中的域名(在域名分量 dc=) 和密码:
|
||||
以下面的内容创建另一个 LDIF 文件,我们称之为 `ldapdomain.ldif`, 然后酌情替换这个文件中的域名(在域名部分(Domain Component) dc=) 和密码:
|
||||
|
||||
dn: olcDatabase={1}monitor,cn=config
|
||||
changetype: modify
|
||||
@ -158,7 +158,7 @@ LDAP 定义
|
||||
|
||||
![LDAP 域名配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Domain-Configuration.png)
|
||||
|
||||
LDAP 域名配置
|
||||
*LDAP 域名配置*
|
||||
|
||||
**7. 现在,该是添加一些条目到我们的 LDAP 目录的时候了。在下面的文件中,属性和键值由一个冒号`(:)` 所分隔,这个文件我们将命名为 `baseldapdomain.ldif`:**
|
||||
|
||||
@ -188,7 +188,7 @@ LDAP 域名配置
|
||||
|
||||
![添加 LDAP 域名,属性和键值](http://www.tecmint.com/wp-content/uploads/2015/06/Add-LDAP-Domain-Configuration.png)
|
||||
|
||||
添加 LDAP 域名,属性和键值
|
||||
*添加 LDAP 域名,属性和键值*
|
||||
|
||||
**8. 创建一个名为 ldapuser 的 LDAP 用户(`adduser ldapuser`),然后在`ldapgroup.ldif` 中为一个 LDAP 组创建定义。**
|
||||
|
||||
@ -206,7 +206,7 @@ LDAP 域名配置
|
||||
|
||||
# ldapadd -x -W -D "cn=Manager,dc=mydomain,dc=com" -f ldapgroup.ldif
|
||||
|
||||
**9. 为用户 ldapuser 添加一个带有定义的 LDIF 文件(`ldapuser.ldif`):**
|
||||
**9. 为用户 ldapuser 添加一个带有定义的 LDIF 文件(`ldapuser.ldif`):**
|
||||
|
||||
dn: uid=ldapuser,ou=People,dc=mydomain,dc=com
|
||||
objectClass: top
|
||||
@ -231,7 +231,7 @@ LDAP 域名配置
|
||||
|
||||
![LDAP 用户配置](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-User-Configuration.png)
|
||||
|
||||
LDAP 用户配置
|
||||
*LDAP 用户配置*
|
||||
|
||||
相似地,你可以删除你刚刚创建的用户条目:
|
||||
|
||||
@ -243,7 +243,7 @@ LDAP 用户配置
|
||||
|
||||
**11. 最后,但并非最不重要的是使用 LDAP 开启客户端的认证。**
|
||||
|
||||
为了在最后一步中对我们有所帮助,我们将使用 authconfig 工具(一个配置系统认证资源的界面)。
|
||||
为了在最后一步中对我们有所帮助,我们将使用 authconfig 工具(一个配置系统认证资源的界面)。
|
||||
|
||||
使用下面的命令,在通过 LDAP 服务器认证成功后,假如请求的用户的家目录不存在,则将会被创建:
|
||||
|
||||
@ -251,7 +251,7 @@ LDAP 用户配置
|
||||
|
||||
![LDAP 客户端认证](http://www.tecmint.com/wp-content/uploads/2015/06/LDAP-Client-Configuration.png)
|
||||
|
||||
LDAP 客户端认证
|
||||
*LDAP 客户端认证*
|
||||
|
||||
### 总结 ###
|
||||
|
||||
@ -265,11 +265,11 @@ via: http://www.tecmint.com/setup-ldap-server-and-configure-client-authenticatio
|
||||
|
||||
作者:[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/automatic-rhel-installations-using-kickstart/
|
||||
[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
|
@ -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
|
@ -1,128 +0,0 @@
|
||||
A Developer’s Journey into Linux Containers
|
||||
================================================================================
|
||||
![](https://deis.com/images/blog-images/dev_journey_0.jpg)
|
||||
|
||||
I’ll let you in on a secret: all that DevOps cloud stuff that goes into getting my applications into the world is still a bit of a mystery to me. But, over time I’ve come to realize that understanding the ins and outs of large scale machine provisioning and application deployment is important knowledge for a developer to have. It’s akin to being a professional musician. Of course you need know how to play your instrument. But, if you don’t understand how a recording studio works or how you fit into a symphony orchestra, you’re going to have a hard time working in such environments.
|
||||
|
||||
In the world of software development getting your code into our very big world is just as important as making it. DevOps counts and it counts a lot.
|
||||
|
||||
So, in the spirit of bridging the gap between Dev and Ops I am going to present container technology to you from the ground up. Why containers? Because there is strong evidence to suggest that containers are the next step in machine abstraction: making a computer a place and no longer a thing. Understanding containers is a journey that we’ll take together.
|
||||
|
||||
In this article I am going to cover the concepts behind containerization. I am going to cover how a container differs from a virtual machine. I am going to go into the logic behind containers construction as well as how containers fit into application architecture. I’ll discussion how lightweight versions of the Linux operating system fits into the container ecosystem. I’ll discuss using images to create reusable containers. Lastly I’ll cover how clusters of containers allow your applications to scale quickly.
|
||||
|
||||
In later articles I’ll show you the step by step process to containerize a sample application and how to create a host cluster for your application’s containers. Also, I’ll show you how to use a Deis to deploy the sample application to a VM on your local system as well as a variety of cloud providers.
|
||||
|
||||
So let’s get started.
|
||||
|
||||
### The Benefit of Virtual Machines ###
|
||||
|
||||
In order to understand how containers fit into the scheme of things you need to understand the predecessor to containers: virtual machines.
|
||||
|
||||
A [virtual machine][1] (VM) is a software abstraction of a computer that runs on a physical host computer. Configuring a virtual machine is akin to buying a typical computer: you define the number of CPUs you want along with desired RAM and disk storage capacity. Once the machine is configured, you load in the operating system and then any servers and applications you want the VM to support.
|
||||
|
||||
Virtual machines allow you to run many simulations of a computer on a single hardware host. Here’s what that looks like with a handy diagram:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_1.png)
|
||||
|
||||
Virtual machines bring efficiency to your hardware investment. You can buy a big, honking machine and run a lots of VMs on it. You can have a database VM sitting with a bunch of VMs with identical versions of your custom app running as a cluster. You can get a lot of scalability out of a finite hardware resources. If you find that you need more VMs and your host hardware has the capacity, you add what you need. Or, if you don’t need a VM, you simply bring the VM off line and delete the VM image.
|
||||
|
||||
### The Limitations of Virtual Machines ###
|
||||
|
||||
But, virtual machines do have limits.
|
||||
|
||||
Say you create three VMs on a host as shown above. The host has 12 CPUs, 48 GB of RAM, and 3 TB of storage. Each VM is configured to have 4 CPUs, 16 GB of RAM and 1 TB of storage. So far, so good. The host has the capacity.
|
||||
|
||||
But there is a drawback. All the resources allocated to a particular machine are dedicated, no matter what. Each machine has been allocated 16 GB of RAM. However, if the first VM never uses more than 1 GB of its RAM allocation, the remaining 15 GB just sit there unused. If the third VM uses only 100 GB of its 1 TB storage allocation, the remaining 900 GB is wasted space.
|
||||
|
||||
There is no leveling of resources. Each VM owns what it is given. So, in a way we’re back to that time before virtual machines when we were paying a lot of good money for unused resources.
|
||||
|
||||
There is *another* drawback to VMs too. They can take a long time to spin up. So, if you are in a situation where your infrastructure needs to grow quickly, even in a situation when VM provisioning is automated, you can still find yourself twiddling your thumbs waiting for machines to come online.
|
||||
|
||||
### Enter: Containers ###
|
||||
|
||||
Conceptually, a container is a Linux process that thinks it is the only process running. The process knows only about things it is told to know about. Also, in terms of containerization, the container process is assigned its own IP address. This is important, so I will say it again. **In terms of containerization, the container process is assigned its own IP address**. Once given an IP address, the process is an identifiable resource within the host network. Then, you can issue a command to the container manager to map the container’s IP address to a IP address on the host that is accessible to the public. Once this mapping takes place, for all intents and purposes, a container is a distinct machine accessible on the network, similar in concept to a virtual machine.
|
||||
|
||||
Again, a container is an isolated Linux process that has a distinct IP address thus making it identifiable on a network. Here’s what that looks like as diagram:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_2.png)
|
||||
|
||||
A container/process shares resources on the host computer in a dynamic, cooperative manner. If the container needs only 1 GB of RAM, it uses only 1 GB. If it needs 4 GB, it uses 4 GB. It’s the same with CPU utilization and storage. The allocation of CPU, memory and storage resources is dynamic, not static as is usual on a typical virtual machine. All of this resource sharing is managed by the container manager.
|
||||
|
||||
Lastly, containers boot very quickly.
|
||||
|
||||
So, the benefit of containers is: **you get the isolation and encapsulation of a virtual machine without the drawback of dedicated static resources**. Also, because containers load into memory fast, you get better performance when it comes to scaling many containers up.
|
||||
|
||||
### Container Hosting, Configuration, and Management ###
|
||||
|
||||
Computers that host containers run a version of Linux that is stripped down to the essentials. These days, the more popular underlying operating system for a host computer is [CoreOS, mentioned above][2]. There are others, however, such as [Red Hat Atomic Host][3] and [Ubuntu Snappy][4].
|
||||
|
||||
The Linux operating system is shared between all containers, minimising duplication and reducing the container footprint. Each container contains only what is unique to that specific container. Here’s what that looks like in diagram form:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_3.png)
|
||||
|
||||
You configure your container with the components it requires. A container component is called a **layer**. A layer is a container image. (You’ll read more about container images in the following section.). You start with a base layer which typically the type of operating system you want in your container. (The container manager will provides only the parts of your desired operating system that is not in the host OS) As you construct the configuration of your container, you’ll add layers, say Apache if you want a web server, PHP or Python runtimes, if your container is running scripts.
|
||||
|
||||
Layering is very versatile. If you application or service container requires PHP 5.2, you configure that container accordingly. If you have another application or service that requires PHP 5.6, no problem. You configure that container to use PHP.5.6. Unlike VMs, where you need to go through a lot of provisioning and installation hocus pocus to change a version of a runtime dependency; with containers you just redefine the layer in the container configuration file.
|
||||
|
||||
All of the container versatility described previously is controlled by the a piece of software called a container manager. Presently, the most popular container managers are [Docker][5] and [Rocket][6]. The figure above shows a host scenario is which Docker is the container manager and CoreOS is the host operating system.
|
||||
|
||||
### Containers are Built with Images ###
|
||||
|
||||
When it comes time for you to build our application into a container, you are going to assemble images. An image represents a template of a container that your container needs to do its work. (I know, containers within containers. Go figure.) Images are stored in a registry. Registries live on the network.
|
||||
|
||||
Conceptually, a registry is similar to a [Maven][7] repository, for those of you from the Java world, or a [NuGet][8] server, for you .NET heads. You’ll create a container configuration file that lists the images your application needs. The you’ll use the container manager to make a container that includes your application’s code as well as constituent resources downloaded from a container registry. For example, if your application is made up of some PHP files, your container configuration file will declare that you get the PHP runtime from a registry. Also, you’ll use the container configuration file to declare the .php files to copy into the container’s file system. The container manager encapsulates all your application stuff into a distinct container that you’ll run on a host computer, under a container manager.
|
||||
|
||||
Here’s a diagram that illustrates the concepts behind container creation:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_4.png)
|
||||
|
||||
Let’s take a detailed look at this diagram.
|
||||
|
||||
Here, (1) indicates there is a container configuration file that defines the stuff your container needs, as well as how your container is to be constructed. When you run your container on the host, the container manager will read the configuration file to get the container images you need from a registry on the cloud (2) and add the images as layers in your container.
|
||||
|
||||
Also, if that constituent image requires other images, the container manager will get those images too and layer them in. At (3) the container manager will copy in files to your container as is required.
|
||||
|
||||
If you use a provisioning service, such as [Deis][9], the application container you just created exists as an image (4) which the provisioning service will deploy to a cloud provider of your choice. Examples of cloud providers are AWS and Rackspace.
|
||||
|
||||
### Containers in a Cluster ###
|
||||
|
||||
Okay. So we can say there is a good case to be made that containers provide a greater degree of configuration flexibility and resource utilization than virtual machines. Still, this is not the all of it.
|
||||
|
||||
Where containers get really flexible is when they’re clustered. Remember, a container has a distinct IP address. Thus, it can be put behind a load balancer. Once a container goes behind a load balancer, the game goes up a level.
|
||||
|
||||
You can run a cluster of containers behind a load balancer container to achieve high performance, high availability computing. Here’s one example setup:
|
||||
|
||||
![](https://deis.com/images/blog-images/dev_journey_5.png)
|
||||
|
||||
Let’s say you’ve made an application that does some resource intensive work. Photograph processing, for example. Using a container provisioning technology such as [Deis][9], you can create a container image that has your photo processing application configured with all the resources upon which your photo processing application depends. Then, you can deploy one or many instances of your container image to under a load balancer that reside on the host. Once the container image is made, you can keep it on the sidelines for introduction later on when the system becomes maxed out and more instances of your container are required in the cluster to meet the workload at hand.
|
||||
|
||||
There is more good news. You don’t have manually configure the load balancer to accept your container image every time you add more instances into the environment. You can use service discovery technology to make it so that your container announces its availability to the balancer. Then, once informed, the balancer can start to route traffic to the new node.
|
||||
|
||||
### Putting It All Together ###
|
||||
|
||||
Container technology picks up where the virtual machine has left off. Host operating systems such as CoreOS, RHEL Atomic, and Ubuntu’s Snappy, in conjunction with container management technologies such as Docker and Rocket, are making containers more popular everyday.
|
||||
|
||||
While containers are becoming more prevalent, they do take a while to master. However, once you get the hang of them, you can use provisioning technologies such as [Deis][9] to make container creation and deployment easier.
|
||||
|
||||
Getting a conceptual understanding of containers is important as we move forward to actually doing some work with them. But, I imagine the concepts are hard to grasp without the actual hands-on experience to accompany the ideas in play. So, this is what we’ll do in the next segment of this series: make some containers.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://deis.com/blog/2015/developer-journey-linux-containers
|
||||
|
||||
作者:[Bob Reselman][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者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
|
@ -1,153 +0,0 @@
|
||||
ictlyh Translating
|
||||
How to Setup Postfix Mail Server (SMTP) using null-client Configuration – Part 9
|
||||
================================================================================
|
||||
Regardless of the many online communication methods that are available today, email remains a practical way to deliver messages from one end of the world to another, or to a person sitting in the office next to ours.
|
||||
|
||||
The following image illustrates the process of email transport starting with the sender until the message reaches the recipient’s inbox:
|
||||
|
||||
![How Mail Setup Works](http://www.tecmint.com/wp-content/uploads/2015/09/How-Mail-Setup-Works.png)
|
||||
|
||||
How Mail Setup Works
|
||||
|
||||
To make this possible, several things happen behind the scenes. In order for an email message to be delivered from a client application (such as [Thunderbird][1], Outlook, or webmail services such as Gmail or Yahoo! Mail) to a mail server, and from there to the destination server and finally to its intended recipient, a SMTP (Simple Mail Transfer Protocol) service must be in place in each server.
|
||||
|
||||
That is the reason why in this article we will explain how to set up a SMTP server in RHEL 7 where emails sent by local users (even to other local users) are forwarded to a central mail server for easier access.
|
||||
|
||||
In the exam’s requirements this is called a null-client setup.
|
||||
|
||||
Our test environment will consist of an originating mail server and a central mail server or relayhost.
|
||||
|
||||
Original Mail Server: (hostname: box1.mydomain.com / IP: 192.168.0.18)
|
||||
Central Mail Server: (hostname: mail.mydomain.com / IP: 192.168.0.20)
|
||||
|
||||
For name resolution we will use the well-known /etc/hosts file on both boxes:
|
||||
|
||||
192.168.0.18 box1.mydomain.com box1
|
||||
192.168.0.20 mail.mydomain.com mail
|
||||
|
||||
### Installing Postfix and Firewall / SELinux Considerations ###
|
||||
|
||||
To begin, we will need to (in both servers):
|
||||
|
||||
**1. Install Postfix:**
|
||||
|
||||
# yum update && yum install postfix
|
||||
|
||||
**2. Start the service and enable it to run on future reboots:**
|
||||
|
||||
# systemctl start postfix
|
||||
# systemctl enable postfix
|
||||
|
||||
**3. Allow mail traffic through the firewall:**
|
||||
|
||||
# firewall-cmd --permanent --add-service=smtp
|
||||
# firewall-cmd --add-service=smtp
|
||||
|
||||
![Open Mail Server Port in Firewall](http://www.tecmint.com/wp-content/uploads/2015/09/Allow-Traffic-through-Firewall.png)
|
||||
|
||||
Open Mail Server SMTP Port in Firewall
|
||||
|
||||
**4. Configure Postfix on box1.mydomain.com.**
|
||||
|
||||
Postfix’s main configuration file is located in /etc/postfix/main.cf. This file itself is a great documentation source as the included comments explain the purpose of the program’s settings.
|
||||
|
||||
For brevity, let’s display only the lines that need to be edited (yes, you need to leave mydestination blank in the originating server; otherwise the emails will be stored locally as opposed to in a central mail server which is what we actually want):
|
||||
|
||||
**Configure Postfix on box1.mydomain.com**
|
||||
|
||||
----------
|
||||
|
||||
myhostname = box1.mydomain.com
|
||||
mydomain = mydomain.com
|
||||
myorigin = $mydomain
|
||||
inet_interfaces = loopback-only
|
||||
mydestination =
|
||||
relayhost = 192.168.0.20
|
||||
|
||||
**5. Configure Postfix on mail.mydomain.com.**
|
||||
|
||||
**Configure Postfix on mail.mydomain.com**
|
||||
|
||||
----------
|
||||
|
||||
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
|
||||
|
||||
And set the related SELinux boolean to true permanently if not already done:
|
||||
|
||||
# setsebool -P allow_postfix_local_write_mail_spool on
|
||||
|
||||
![Set Postfix SELinux Permission](http://www.tecmint.com/wp-content/uploads/2015/09/Set-Postfix-SELinux-Permission.png)
|
||||
|
||||
Set Postfix SELinux Permission
|
||||
|
||||
The above SELinux boolean will allow Postfix to write to the mail spool in the central server.
|
||||
|
||||
**6. Restart the service on both servers for the changes to take effect:**
|
||||
|
||||
# systemctl restart postfix
|
||||
|
||||
If Postfix does not start correctly, you can use following commands to troubleshoot.
|
||||
|
||||
# systemctl –l status postfix
|
||||
# journalctl –xn
|
||||
# postconf –n
|
||||
|
||||
### Testing the Postfix Mail Servers ###
|
||||
|
||||
To test the mail servers, you can use any Mail User Agent (most commonly known as MUA for short) such as [mail or mutt][2].
|
||||
|
||||
Since mutt is a personal favorite, I will use it in box1 to send an email to user tecmint using an existing file (mailbody.txt) as message body:
|
||||
|
||||
# mutt -s "Part 9-RHCE series" tecmint@mydomain.com < mailbody.txt
|
||||
|
||||
![Test Postfix Mail Server](http://www.tecmint.com/wp-content/uploads/2015/09/Test-Postfix-Mail-Server.png)
|
||||
|
||||
Test Postfix Mail Server
|
||||
|
||||
Now go to the central mail server (mail.mydomain.com), log on as user tecmint, and check whether the email was received:
|
||||
|
||||
# su – tecmint
|
||||
# mail
|
||||
|
||||
![Check Postfix Mail Server Delivery](http://www.tecmint.com/wp-content/uploads/2015/09/Check-Postfix-Mail-Server-Delivery.png)
|
||||
|
||||
Check Postfix Mail Server Delivery
|
||||
|
||||
If the email was not received, check root’s mail spool for a warning or error notification. You may also want to make sure that the SMTP service is running on both servers and that port 25 is open in the central mail server using [nmap command][3]:
|
||||
|
||||
# nmap -PN 192.168.0.20
|
||||
|
||||
![Troubleshoot Postfix Mail Server](http://www.tecmint.com/wp-content/uploads/2015/09/Troubleshoot-Postfix-Mail-Server.png)
|
||||
|
||||
Troubleshoot Postfix Mail Server
|
||||
|
||||
### Summary ###
|
||||
|
||||
Setting up a mail server and a relay host as shown in this article is an essential skill that every system administrator must have, and represents the foundation to understand and install a more complex scenario such as a mail server hosting a live domain for several (even hundreds or thousands) of email accounts.
|
||||
|
||||
(Please note that this kind of setup requires a DNS server, which is out of the scope of this guide), but you can use following article to setup DNS Server:
|
||||
|
||||
- [Setup Cache only DNS Server in CentOS/RHEL 07][4]
|
||||
|
||||
Finally, I highly recommend you become familiar with Postfix’s configuration file (main.cf) and the program’s man page. If in doubt, don’t hesitate to drop us a line using the form below or using our forum, Linuxsay.com, where you will get almost immediate help from Linux experts from all around the world.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.tecmint.com/setup-postfix-mail-server-smtp-using-null-client-on-centos/
|
||||
|
||||
作者:[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/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/
|
@ -1,3 +1,5 @@
|
||||
FSSlc translating
|
||||
|
||||
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.
|
||||
@ -185,4 +187,4 @@ via: http://www.tecmint.com/kvm-virtualization-basics-and-guest-administration/
|
||||
[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/
|
||||
[6]:http://www.tecmint.com/install-and-configure-kvm-in-linux/
|
||||
|
@ -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)
|
||||
校对:[校对者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,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