iredmail-doc/html_bk/install.iredmail.on.rhel-zh...

210 lines
11 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>在 Red Hat Enterprise Linux 或 CentOS 系统上安装 iRedMail</title>
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
<a href="https://www.iredmail.org" target="_blank">
<img alt="iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>&nbsp;
<span>iRedMail</span>
</a>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><div class="admonition note">
<p class="admonition-title">This tutorial is available in other languages. <a href="https://github.com/iredmail/docs">Help translate more</a></p>
<p><a href="./install.iredmail.on.rhel.html">English</a> /</p>
</div>
<h1 id="red-hat-enterprise-linux-centos-iredmail">在 Red Hat Enterprise Linux 或 CentOS 系统上安装 iRedMail</h1>
<div class="toc">
<ul>
<li><a href="#red-hat-enterprise-linux-centos-iredmail">在 Red Hat Enterprise Linux 或 CentOS 系统上安装 iRedMail</a><ul>
<li><a href="#_1">系统要求</a></li>
<li><a href="#_2">准备</a><ul>
<li><a href="#fqdn">为服务器设置一个完整域名FQDN的主机名</a></li>
<li><a href="#selinux">禁用 SELinux</a></li>
<li><a href="#yum">启用必须的 yum 仓库</a></li>
<li><a href="#iredmail">下载最新的 iRedMail</a></li>
</ul>
</li>
<li><a href="#iredmail_1">运行 iRedMail 安装程序</a></li>
<li><a href="#_3">安装过程的截图</a></li>
<li><a href="#_4">安装完成后你必须知道的几个重要事项</a></li>
<li><a href="#webmail-web">访问 webmail 和其它 web 程序</a></li>
<li><a href="#_5">技术支持</a></li>
</ul>
</li>
</ul>
</div>
<h2 id="_1">系统要求</h2>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>阿里云、腾讯云均禁止使用邮件服务所必须的 25 端口提供邮件服务,因此您不能在
它们的云服务器部署邮件服务器。</p>
</div>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>iRedMail 只针对全新安装的操作系统设计,它要求你的操作系统上 <strong>没有</strong> 事先
安装邮件服务相关的组件,例如 MySQLOpenLDAPPostfixAmavisd等。
iRedMail 会自动安装和配置邮件服务所需的组件,因此如果操作系统上已有相关
组件iRedMail 可能会打乱你的配置并造成服务无法正常启动。</p>
</div>
<p>要在 Red Hat Enterprise Linux (以下简称 RHEL或 CentOS 上安装 iRedMail你需要</p>
<ul>
<li>一个全新安装的 RHEL 或 CentOS 系统。支持的版本号在<a href="https://www.iredmail.org/download.html">下载</a>页面有注明。</li>
<li>要运行一个低流量的邮件服务器,要求至少<code>2 GB</code> 内存才能使用完整的垃圾邮件和病毒扫描功能。</li>
</ul>
<h2 id="_2">准备</h2>
<h3 id="fqdn">为服务器设置一个完整域名FQDN的主机名</h3>
<p>不管你的服务器将用于实际运行还是仅仅用作测试都建议设置一个完整域名FQDN的主机名。</p>
<p>输入命令 <code>hostname -f</code> 查看当前的主机名</p>
<pre><code class="language-shell">$ hostname -f
mx.example.com
</code></pre>
<p>在 RHEL/CentOS 系统上,主机名需要在两个文件里设置:</p>
<ol>
<li>
<p>对于 RHEL/CentOS 7 和 8主机名定义在 <code>/etc/hostname</code>.</p>
<p><code>mx.example.com</code></p>
</li>
<li>
<p><code>/etc/hosts</code> 里定义主机名和 IP 地址的对应关系。注意:一定要将 FQDN 主机名列在第一个。</p>
<p><code>127.0.0.1 mx.example.com mx localhost localhost.localdomain</code></p>
</li>
</ol>
<p>确认系统已使用设置好的 FQDN 作为主机名。如果没有生效,请重启系统。</p>
<pre><code>$ hostname -f
mx.example.com
</code></pre>
<h3 id="selinux">禁用 SELinux</h3>
<p>iRedMail 不支持 SELinux所以需要在 <code>/etc/selinux/config</code> 文件里禁用它。</p>
<pre><code>SELINUX=disabled
</code></pre>
<p>如果不希望禁用 SELinux可以设置为让它打印警告信息但不强制限制</p>
<pre><code>SELINUX=permissive
</code></pre>
<p>也可以无须重启服务就禁用它:</p>
<pre><code># setenforce 0
</code></pre>
<h3 id="yum">启用必须的 yum 仓库</h3>
<ul>
<li>
<p>对于 CentOS 系统,必须启用 <code>/etc/yum.repos.d/CentOS-Base.repo</code> 里定义的所有
CentOS 官方 yum 仓库。同时 <strong>禁用</strong> 所有第三方yum 仓库,以避免软件包冲突。</p>
</li>
<li>
<p>对于 RHEL请启用 Red Hat Network 以便安装软件包。</p>
</li>
</ul>
<h3 id="iredmail">下载最新的 iRedMail</h3>
<ul>
<li>访问<a href="https://www.iredmail.org/download.html">下载页面</a>下载最新的版本。</li>
<li>上传 iRedMail 到服务器上。假设上传后的路径是 <code>/root/iRedMail-x.y.z.tar.bz2</code>
(这里以 <code>x.y.z</code> 代替实际的版本号)。</li>
<li>解压缩 iRedMail 安装包:</li>
</ul>
<pre><code># cd /root/
# tar xjf iRedMail-x.y.z.tar.bz2
</code></pre>
<h2 id="iredmail_1">运行 iRedMail 安装程序</h2>
<p>现在可以运行 iRedMail 安装程序了,它会问你几个简单的问题,仅此而已。</p>
<pre><code>cd /root/iRedMail-x.y.z/
bash iRedMail.sh
</code></pre>
<p>如果是在 CentOS 8 系统上安装iRedMail 安装程序会使用 <code>pip2</code> 命令安装几个
Python-2 的模块,国内用户请指定镜像站点完成安装,否则很大可能会因网络问题
导致安装失败:</p>
<pre><code>PIP_MIRROR_SITE='http://pypi.douban.com/simple/' PIP_TRUSTED_HOST=pypi.douban.com bash iRedMail.sh
</code></pre>
<h2 id="_3">安装过程的截图</h2>
<ul>
<li>欢迎和感谢使用</li>
</ul>
<p><img alt="" src="./images/installation/welcome.png" width="700px" /></p>
<ul>
<li>指定用于存储用户邮箱的路径。默认是 <code>/var/vmail/</code></li>
</ul>
<p><img alt="" src="./images/installation/mail_storage.png" width="700px" /></p>
<ul>
<li>选择用于存储邮件账号的数据库。</li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>各个数据库之间没有太大区别,建议使用自己熟悉的数据库,便于后期维护。</p>
</div>
<p><img alt="" src="./images/installation/backends.png" width="700px" /></p>
<ul>
<li>如果选择 OpenLDAP 数据库用于存储邮件账号,安装程序会要求你输入 LDAP 前缀:</li>
</ul>
<p><img alt="" src="./images/installation/ldap_suffix.png" width="700px" /></p>
<div class="admonition note">
<p class="admonition-title">MySQL/MariaDB/PostgreSQL 用户</p>
<p>如果选择 MySQL/MariaDB/PostgreSQL 用于存储邮件账号, 安装程序会为数据库的
root 用户生成一个随机的强密码,安装完成后可以在 <code>iRedMail.tips</code> 文件里找到。</p>
</div>
<ul>
<li>添加第一个邮件域名</li>
</ul>
<p><img alt="" src="./images/installation/first_domain.png" width="700px" /></p>
<ul>
<li>设置邮件管理员的密码</li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>该账号即是邮件管理员,也是普通的邮件账号,可以登录管理后台和 webmail。</p>
</div>
<p><img alt="" src="./images/installation/admin_pw.png" width="700px" /></p>
<ul>
<li>可选的组件</li>
</ul>
<p><img alt="" src="./images/installation/optional_components.png" width="700px" /></p>
<p>回答完上面的几个问题之后,安装程序给出本次安装的基本信息并要求确认是否实际
执行安装,请输入 <code>y</code><code>Y</code> 并按回车键确认,或 <code>n</code>, <code>N</code> 并按回车键中止安装。</p>
<p><img alt="" src="./images/installation/review.png" width="700px" /></p>
<h2 id="_4">安装完成后你必须知道的几个重要事项</h2>
<ul>
<li>邮件服务器最薄弱的环节是用户的弱密码,所以请一定强制你的用户使用强度高的密码。</li>
<li>
<p>阅读 <code>/root/iRedMail-x.y.z/iRedMail.tips</code> 文件,它包含了:</p>
<ul>
<li>各个 web 程序的访问地址URL用户名和密码。</li>
<li>各个组件的配置文件路径。除此之外还应该阅读文档:<a href="./file.locations.html">Locations of configuration and log files of major components</a>.</li>
<li>以及其它一些重要和敏感信息</li>
</ul>
</li>
<li>
<p><a href="./setup.dns.html">设置 DNS 记录</a></p>
</li>
<li><a href="./index.html#configure-mail-client-applications">如何配置邮件客户端程序</a></li>
<li>强烈建议获取 SSL 证书以避免每次访问 web 程序时烦人的自签名 SSL 证书警告,
<a href="https://letsencrypt.org">Let's Encrypt 提供免费的 SSL 证书</a>。可根据该文档
配置获取的证书:<a href="./use.a.bought.ssl.certificate.html">use a SSL certificate</a>.</li>
<li>如果需要批量添加邮件账号,可以参考以下针对不同数据库的批量建账号的文档:
<a href="./ldap.bulk.create.mail.users.html">OpenLDAP</a>
<a href="./sql.bulk.create.mail.users.html">MySQL/MariaDB/PostgreSQL</a></li>
<li>如果这是一台繁忙的服务器,这里有<a href="./performance.tuning.html">一些提升性能的建议</a></li>
</ul>
<h2 id="webmail-web">访问 webmail 和其它 web 程序</h2>
<p>安装完成后,可以通过以下 URL 访问相关程序。注意:请将 <code>&lt;server\&gt;</code> 替换为实际的
服务器地址。</p>
<ul>
<li><strong>Roundcube webmail</strong>: <a href="https://your_server/mail/">https://your_server/mail/</a></li>
<li><strong>SOGo Groupware</strong>: <a href="https://your_server/SOGo">https://your_server/SOGo</a></li>
<li><strong>Web 管理后台</strong>: <a href="httpS://your_server/iredadmin/">httpS://your_server/iredadmin/</a></li>
<li><strong>Awstats</strong>: <a href="httpS://your_server/awstats/awstats.pl?config=web">httpS://your_server/awstats/awstats.pl?config=web</a> (or <code>?config=smtp</code> for SMTP log)</li>
</ul>
<h2 id="_5">技术支持</h2>
<ul>
<li>遇到问题、疑问,或有建议、功能需求,都可以发到活跃的在线论坛:<ul>
<li><a href="https://forum.iredmail.org/">英文论坛</a></li>
<li><a href="https://bbs.iredmail.org/">中文论坛</a></li>
</ul>
</li>
<li>如需及时快速的专业技术支持,请查看网页:<a href="https://www.iredmail.org/support.html">获取专业的技术支持</a>.</li>
</ul><div class="footer">
<p style="text-align: center; color: grey;">All documents are available in <a href="https://github.com/iredmail/docs/">GitHub repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://github.com/iredmail/docs/archive/master.zip">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div></body></html>