宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取

iRedMail的搭建和注意事项

经过一段时间的折腾,终于将iRedMail搭建起来了,下面介绍一下搭建的过程,以及注意事项。

注意事项: 

  1. iRedMail不支持重复安装,如果安装错误,请重置环境;开始安装时候,尽量选择一个干净的环境。这也是选择云服务器的原因,小巧、经济。

  2. epel源是安装的必要条件。

  3. 修改/etc/hosts, 127.0.0.1增加mail.lius.space(邮箱域名,因人而异)并切换到这个hostname,以及修改安装脚本iredmail.org为镜像ip的操作是必须的。

1. 前期准备

  【1】hostname的设定和iredmail.org的hosts指定

# vim /etc/hosts
在127.0.0.1的后面添加mail.lius.space     //设定的邮箱域名
在最下面添加一段:106.187.51.47 www.iredmail.org iredmail.org,保存退出。
# hostname mail.lius.space
# bash
# hostname -f   //看一下输出结果是不是mail.lius.space

  【2】MX记录的添加,下面以阿里云的万网域名的MX记录添加为例:

  需要购买一个域名,还要有个带公网ip的服务器(虚拟机因为没有公网ip,只能发邮件,而不能收),云服务器既轻巧又实惠,是最佳选择。比如我们购买的域名是lius.space,公网ip是115.23.56.232,开始下面的配置:

  打开阿里云的页面 –> 登录 –> 点击左上角自己的账户名称 –> 点击菜单选项中的“云解析” –> 点击自己的域名

iRedMail的搭建过程记录-风君雪科技博客

+

iRedMail的搭建过程记录-风君雪科技博客

  添加MX记录:

iRedMail的搭建过程记录-风君雪科技博客

 点击添加解析,共增加两行记录,分两次添加;标题和对应的值如下:

主机记录    记录类型    线路类型    记录值                MX优先级
mail         A        默认       115.23.56.232
@       MX       默认       mail.lius.space.        5

  一个记录指向服务器的域名,注意后面有个“.”,不过即使不加,系统也会自动添加,优先级5或者10都可以;

  一个指向公网ip,也就是服务器的ip地址;

2. 下载iRedMail和相应参数调整

  在一个合适的目录,下载和安装iRedMail,推荐下载地址:https://bitbucket.org/zhb/iredmail/downloads,选择0.9.2的版本就好。(官网只找到了最新版0.9.3的下载地址,参数有调整,修改方法还没查资料)

# cd /usr/local/src/
# wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.2.tar.bz2
# tar jxvf iRedMail-0.9.2.tar.bz2
# cd iRedMail-0.9.0/pkgs/ # vim get_all.sh 用搜索的功能,修改https --> http;下载地址相关的iredmail.org --> 106.187.51.47
修改的原因:国内已经将iredmail.org屏蔽,以上ip是日本镜像地址。 用命令也可以完成修改
#
sed -i 's/iredmail.org/106.187.51.47/g' get_all.sh

3. yum源扩展和执行下载脚本

  在/etc/yum.repo.d/目录下面,确定要有epel的扩展源(epel.repo && epel-testing.repo),如果没有,yum install -y epel-release

# cd /usr/local/src/iRedMail-0.9.0/
# sh iRedMail.sh

  

  经过漫长的等待,会出现一个类图形界面:

  第一步,点击Yes;(用键盘操作方法:Tab键“切换”,空格键“选择”或“取消选择”,Enter键“确定”)

iRedMail的搭建过程记录-风君雪科技博客 

  第二步,填写邮件的存放目录,默认即可,但确保磁盘空间足够大。

iRedMail的搭建过程记录-风君雪科技博客

  第三步,选择数据库,我们选的是MySQL。

iRedMail的搭建过程记录-风君雪科技博客

  第四步,给MySQL数据库的root用户设定一个密码。

iRedMail的搭建过程记录-风君雪科技博客

  第五步,给邮箱添加域,这个域不能与mail.lius.space相同,可以是lius.com一类,不一定非要以space结尾;安装完成后,可以在浏览器登录邮箱管理员,增加域。

iRedMail的搭建过程记录-风君雪科技博客

  第六步,给iRedMail邮箱管理员添加一个密码。

iRedMail的搭建过程记录-风君雪科技博客

  第七步,选择安装的组件,默认即可。

iRedMail的搭建过程记录-风君雪科技博客

  以后的步骤按部就班即可;跳出如“[Y|n]n”的选项,除与22端口相关的为“n”以外,其余全部“y”。

Would you like to use firewall rules provided by iRedMail now? 
< Question > File: /etc/sysconfig/iptables, with SSHD port: 22. [Y|n]n

  

  安装结束,会有如下提示:

********************************************************************
* URLs of installed web applications:
*
* - Webmail:
*   o Roundcube webmail: httpS://mail.lius.space/mail/
*
* - Web admin panel (iRedAdmin): httpS://mail.lius.space/iredadmin/
*
* You can login to above links with same credential:
*
*   o Username: postmaster@lius.space
*   o Password: root
*
*
********************************************************************
* Congratulations, mail server setup completed successfully. Please
* read below file for more information:
*
*   - /usr/local/src/iRedMail-0.9.2/iRedMail.tips
*
* And it's sent to your mail account postmaster@lius.space.
*
********************* WARNING **************************************
*
* Rebooting your system is required to enable mail services.
*
********************************************************************

  第八步,启动所有相关的服务;

# for s in httpd iredapd amavisd clamd postfix dovecot cbpolicyd spamassassin clamd.amavisd saslauthd fail2ban; do /etc/init.d/$s restart; done

  如果很多提示关闭失败的提示,不用管,原因是服务以前就是关闭的。

4. 账户的登录和管理

  根据上面安装结束时的提示:

Roundcube webmail: httpS://mail.lius.space/mail/   //登录邮箱

Web admin panel (iRedAdmin): httpS://mail.lius.space/iredadmin/    //登录管理后台

Username: postmaster@lius.space   //管理员邮箱地址,即账号

Password: root   //管理员登录密码,类图形界面操作时设定的。

  注意的是,https地址由于没有购买认证,浏览器会提示危险,直接访问即可;

  【1】邮箱管理页面:

    登录界面:

iRedMail的搭建过程记录-风君雪科技博客

    添加域,可以丰富邮箱的尾缀。

iRedMail的搭建过程记录-风君雪科技博客

+

iRedMail的搭建过程记录-风君雪科技博客

    添加iRedMail邮箱账号:

iRedMail的搭建过程记录-风君雪科技博客

  (可选择自己定义的域)

iRedMail的搭建过程记录-风君雪科技博客

  【2】iRedMail邮箱用户登录和邮件操作

  邮箱登录界面:

iRedMail的搭建过程记录-风君雪科技博客

  (熟悉的功能和操作界面)

iRedMail的搭建过程记录-风君雪科技博客