利用Docker部署iRedMail一站式邮箱服务
参考文档1:https://jbritian.com/article/46
参考文档2:https://hub.docker.com/r/iredmail/mariadb
拉取包
docker pull iredmail/mariadb:stable
# 创建所需要的环境变量文件
mkdir /home/iredmail cd /home/iredmail 将以下信息写入iredmail-docker.conf HOSTNAME=mail.bctc-squad.cn FIRST_MAIL_DOMAIN=bctc-squad.cn FIRST_MAIL_DOMAIN_ADMIN_PASSWORD=123456 MLMMJADMIN_API_TOKEN=45XA9oLe/ZQijJZWtua1PYN4R1vZC4TJtalXDmhGfPs= ROUNDCUBE_DES_KEY=E5iWgDL1CinmIwg8RMDpoohhkmXhbcFA MYSQL_ROOT_PASSWORD=123456 注意上方内容,地址和密码替换为你想要的!
首次启动,生成初始文件
docker run -d --name iredmail --env-file iredmail-docker.conf \ --hostname mail.bctc-squad.cn \ --privileged=true \ -p 80:80 \ -p 443:443 \ -p 110:110 \ -p 995:995 \ -p 143:143 \ -p 993:993 \ -p 25:25 \ -p 465:465 \ -p 587:587 \ iredmail/mariadb:nightly
首次启动消耗时间较长,可以进入容器查看进程和端口的生成情况。
docker exec -it iredmail bash
备份文件
docker cp iredmail:/opt/iredmail/custom/iredapd/settings.py /home/iredmail/data/custom/iredapd/settings.py docker cp iredmail:/opt/iredmail/ssl /home/iredmail/data/ docker cp iredmail:/var/vmail/backup/mysql /home/iredmail/data/backup-mysql docker cp iredmail:/var/lib/mysql /home/iredmail/data/mysql docker cp iredmail:/var/vmail/backup/mysql /home/iredmail/data/backup-mysql docker cp iredmail:/var/vmail/vmail1 /home/iredmail/data/mailboxes docker cp iredmail:/var/vmail/mlmmj /home/iredmail/data/mlmmj docker cp iredmail:/var/vmail/mlmmj-archive /home/iredmail/data/mlmmj-archive docker cp iredmail:/var/vmail/imapsieve_copy /home/iredmail/data/imapsieve_copy docker cp iredmail:/opt/iredmail/custom /home/iredmail/data/custom docker cp iredmail:/opt/iredmail/ssl /home/iredmail/data/ssl docker cp iredmail:/var/lib/mysql /home/iredmail/data/mysql docker cp iredmail:/var/lib/clamav /home/iredmail/data/clamav docker cp iredmail:/var/lib/spamassassin /home/iredmail/data/sa_rules docker cp iredmail:/var/spool/postfix /home/iredmail/data/postfix_queue docker cp iredmail:/var/vmail/imapsieve_copy /home/iredmail/data/imapsieve_copy docker cp iredmail:/opt/iredmail/custom/iredapd/settings.py /home/iredmail/data/custom/iredapd/settings.py
备份完成后,启动容器,这样就有了关联路径:
cd /iredmail docker run -d --name iredmail --env-file iredmail-docker.conf \ --restart=unless-stopped \ --hostname mail.bctc-squad.cn \ --privileged \ -p 80:80 \ -p 443:443 \ -p 110:110 \ -p 995:995 \ -p 143:143 \ -p 993:993 \ -p 25:25 \ -p 465:465 \ -p 587:587 \ -v /home/iredmail/data/backup-mysql:/var/vmail/backup/mysql \ -v /home/iredmail/data/mailboxes:/var/vmail/vmail1 \ -v /home/iredmail/data/mlmmj:/var/vmail/mlmmj \ -v /home/iredmail/data/mlmmj-archive:/var/vmail/mlmmj-archive \ -v /home/iredmail/data/imapsieve_copy:/var/vmail/imapsieve_copy \ -v /home/iredmail/data/custom:/opt/iredmail/custom \ -v /home/iredmail/data/ssl:/opt/iredmail/ssl \ -v /home/iredmail/data/mysql:/var/lib/mysql \ -v /home/iredmail/data/clamav:/var/lib/clamav \ -v /home/iredmail/data/sa_rules:/var/lib/spamassassin \ -v /home/iredmail/data/postfix_queue:/var/spool/postfix \ iredmail/mariadb:stable
解决证书问题。
cp -rp /home/iredmail/data/ssl/mail.bctc-squad.cn_nginx/mail.bctc-squad.cn_bundle.crt /home/iredmail/data/ssl/cert.pem cp -rp /home/iredmail/data/ssl/mail.bctc-squad.cn_nginx/mail.bctc-squad.cn_bundle.crt /home/iredmail/data/ssl/combined.pem cp -rp /home/iredmail/data/ssl/mail.bctc-squad.cn_nginx/mail.bctc-squad.cn.key /home/iredmail/data/ssl/key.pem
登录邮箱
# 登录系统, https://mail.bctc-squad.cn # 用户名为:[email protected] # 密码为:123456 # 登录后需要修改一下管理员密码 # 登录管理后台 https://mail.bctc-squad.cn/iredadmin # 用户名为:[email protected] # 密码为:123456
添加DNS解析记录。
主机记录 | 记录类型 | 记录值 | MX |
---|---|---|---|
A | Host IP | ||
@ | MX | mail.teddyou.cn | 10 |
@ | TXT | v=spf1 mx -all | |
dkim._domainkey | TXT | v=DKIM1;p=xxxxxxxxx | |
_dmarc | TXT | v=DMARC1; p=none; pct=100; rua=mailto:[email protected] |
注意,dkim._domainkey的记录值需要登录容器,通过命令amavisd showkeys 或者 amavisd-new showkeys查询。
收发信端口表单。
协议 | 地址 | 端口 | 加密端口 |
---|---|---|---|
IAMP | mail.teddyou.com | 143 | 993 |
POP3 | mail.teddyou.com | 110 | 995 |
SMTP | mail.teddyou.com | 25 | 587 |
发表评论