CentOS7 安裝 iRedMail Mail Server
-
iRedMail 0.9.8
-
IP : 172.21.20.253
-
DN : iredmail.ichiayi.com
-
hostname : iredmail
環境準備
-
關閉 selinux
vi /etc/selinux/config
: SELINUX=disabled
-
設定 /etc/sysconfig/network
HOSTNAME=iredmail.ichiayi.com
-
設定 /etc/hosts
127.0.0.1 iredmail.ichiayi.com iredmail localhost localhost.localdomain
-
設定 /etc/hostname
iredmail.ichiayi.com
-
重新開機
sync;sync;sync;reboot
下載安裝 iRedMail
su - root yum install wget bzip2 cd /root/ wget https://bitbucket.org/zhb/iredmail/downloads/iRedMail-0.9.8.tar.bz2 tar xjf iRedMail-0.9.8.tar.bz2 cd /root/iRedMail-0.9.8/ bash iRedMail.sh
-
安裝完成最後更新完成掃毒病毒碼 daily.cld 之後, 要重新開機所有服務才能正常啟動
sync;sync;sync;reboot
-
如果執行安裝時一直出現 /etc/hosts 的設定錯誤, 請先用
hostname -f
是否能夠正確出現標準 FQDN 格式 Exp. iredmai.ichiayi.com
-
如果是安裝在中國機房, 因為 iredmail.org 被 GFW 封鎖, 所以要改用以下語法
IREDMAIL_EPEL_MIRROR='http://mirrors.aliyun.com/epel' IREDMAIL_MIRROR='https://dl.iredmail.org' bash iRedMail.sh
-
安裝完成後重要資訊會產生在 /root/iRedMail-0.9.8/iRedMail.tips 檔案內
相關設定與驗證測試
-
DNS : MX / DKIM / SPF 設定
-
IP 反查設定 → 找 ISP 協助
-
設定 aliases domain 的方式 – https://docs.iredmail.org/sql.add.alias.domain.html SQL 語法
-
設定 aliases (自動轉寄) 的方式 – https://docs.iredmail.org/user.alias.address.html SQL 語法
-
設定 greylisting 白名單的方式 – https://docs.iredmail.org/manage.iredapd.html#greylisting
-
設定多個 domain 的 DKIM – https://docs.iredmail.org/sign.dkim.signature.for.new.domain.html
-
設定預設 domain 的處理方式 – 主要是修改 dovecot.conf 內的 auth_default_realm
-
解決 outlook 寄信無法使用 STARTTLS(port:587) 需要設定提供 SMTPS(port:465) – https://docs.iredmail.org/enable.smtps.html
-
修改主機名稱的處理方式 : 除修改 /etc/hosts 之外還有其他服務設定檔都要一起修改 – https://docs.iredmail.org/change.server.hostname.html
-
-
取得免費的 LetsEncrypt ssl 憑證 參考 – CentOS 6 + Apache / Nginx 申請設定 Let’s Encrypt 免費網站 SSL 憑證
-
Exp. 取得的憑證存放在 /etc/letsencrypt/archive/mail.ichiayi.com/
-
-
設定 Postfix (SMTP server)
postconf -e smtpd_tls_cert_file='/etc/letsencrypt/archive/mail.ichiayi.com/cert1.pem' postconf -e smtpd_tls_key_file='/etc/letsencrypt/archive/mail.ichiayi.com/privkey1.pem' postconf -e smtpd_tls_CAfile='/etc/letsencrypt/archive/mail.ichiayi.com/fullchain1.pem' systemctl restart postfix
-
設定 Dovecot (POP3/IMAP server)
- /etc/dovecot/dovecot.conf
-
ssl = required ssl_cert = </etc/letsencrypt/archive/mail.ichiayi.com/cert1.pem ssl_key = </etc/letsencrypt/archive/mail.ichiayi.com/privkey1.pem ssl_ca = </etc/letsencrypt/archive/mail.ichiayi.com/fullchain1.pem
systemctl restart dovecot
-
郵件移轉 (imapsync)
-
是透過新舊 Mail Server 的 imap 協定來將舊 Mail Server 內的信件移轉至新 Mail Server 內
-
安裝 imapsync
yum install imapsync
-
假設要移轉 jonathan 的信件, 要知道新舊主機 jonathan 的密碼, 將密碼寫入 /root/sync_info/jonathan 檔案內, 然後執行以下的語法
imapsync --host1 mail.ichiayi.com --user1 jonathan --passfile1 /root/sync_info/jonathan --host2 192.168.11.236 --user2 jonathan --passfile2 /root/sync_info/jonathan