阿里雲ECS 操做系統CentOS下安裝IRedMail收發郵件

使用阿里雲ECS製做IRedMail收發郵件服務器詳細過程以下html

一、什麼是IRedMail?

iRedMail - 免費、開源郵件服務解決方案
以最佳的方式搭建基於 Linux/BSD 和開源軟件的郵件服務器。始於 2007 年。
支持 Red Hat Enterprise Linux、CentOS、Debian、Ubuntu、FreeBSD、OpenBSD
只需幾分鐘,iRedMail 便可爲您部署一臺徹底基於開源軟件、功能完善的郵件服務器,並且,免費。
使用的都是開源領域有口皆碑的開源軟件,並預設了最佳配置,讓您能夠「開箱即用」。python

二、安裝IRedMail

安裝文檔在這,設置好以後要設置阿里雲域名A和MX的解析記錄,以下:mysql

clipboard.png

值得注意的一點是:阿里雲ECS是禁用SMTP發件的25端口的,若是你想使用就要申請了,雖然你可以在ECS的安全規則下打開這個端口,可是阿里雲技術文檔也說了,實際仍是被封的!linux

clipboard.png

clipboard.png

因此我這裏只當收件功能,發件我沒試!web

三、配置文件

安裝好IRedMail以後,接着你要設置/etc/postfix/main.cf下的主機和域名,以下:sql

inet_protocols = ipv4
virtual_alias_domains =
myhostname = mail.xfindzp.com
myorigin = mail.xfindzp.com
allow_percent_hack = no
swap_bangpath = no
mydomain = xfindzp.com
mydestination = $myhostname, localhost, localhost.localdomain, localhost.$myhostname
biff = no
inet_interfaces = all
mynetworks = 0.0.0.0/0

而後再設置ECS的主機名,以下 :vim

clipboard.png

clipboard.png

clipboard.png

而後重啓下ECS便可生效centos

接着設置打開後臺管理系統,添加域:mail.xfindzp.com和用戶:test01@mail.xfindzp.com,以下:安全

clipboard.png

clipboard.png

查看下mail.xfindzp.com在阿里雲ECS服務器上解析狀況:服務器

☁  ~  telnet mail.xfindzp.com 110
Trying 47.97.104.97...
Connected to mail.xfindzp.com.
Escape character is '^]'.
+OK Dovecot ready.
user test01@mail.xfindzp.com
+OK
pass 23456789
+OK Logged in.
list
+OK 3 messages:
1 2781
2 2745
3 2853

四、測試收信

用我本身的qq郵箱發送的時候報下面的錯:

clipboard.png

如何解決這個問題呢,這個我查看了/var/log/maillog日誌和/var/log/dovecot.log日誌,發現報錯:

Jul  8 15:46:14 mail postfix/smtpd[2272]: NOQUEUE: reject: RCPT from unknown[14.17.44.32]: 450 4.1.8 <1576410833@qq.com>: Sender address rejected: Domain not found; from=<1576410833@qq.com> to=<test01@mail.xfindzp.com> proto=ESMTP helo=<smtpbg337.qq.com>

這個問題值到我提交到阿里雲工單上面技術人員才幫我解決問題,以下:

clipboard.png

問題緣由找到了,原來是var/spool/postfix/etc/resolv.conf文件和/etc/resolv.conf有差別
把後面文件裏面的ip替換前面文件裏面的ip才搞定,真是個坑,還好解決了,再測試發信試試

# vim /var/spool/postfix/etc/resolv.conf

options timeout:1 attempts:1 rotate
nameserver 10.202.72.116
nameserver 10.202.72.118
替換成:
options timeout:1 attempts:1 rotate
nameserver 100.100.2.138
nameserver 100.100.2.136
# vim /etc/resolv.conf

nameserver 100.100.2.138
nameserver 100.100.2.136
options timeout:2 attempts:3 rotate single-request-reopen

clipboard.png

成功

再看看後臺,也是收到了!

clipboard.png

至此收信功能圓滿完成!

總結:

一、一開始我並無安裝IRedMail,而是在ECS上面安裝postfix+dovecot+extmail,可是添加域以及收發件都是不成功的,沒辦法到網上找到了ECS的境像:iRedMail 運行環境鏡像使用指南

鏡像環境是:CentOS 6.5 64位

clipboard.png

clipboard.png

這個他已經幫你搭建好了,你只要按照他的說明文檔來就好,並且帳戶和密碼什麼的已經保存到/alidata/account.log裏面了,直接拿來登陸就好!

問題:

一、安裝過程當中遇到好多問題,都沒法解決,找了好多人,加了好多羣,可是值到我使用IRedMail纔看到但願

引用:

一、IRedMail
二、IRedMail安裝文檔
三、Setup DNS records for your iRedMail server (A, PTR, MX, SPF, DKIM)
四、iRedMail郵件服務的部署
五、iRedMail 運行環境鏡像使用指南
六、Postfix郵件發送和接收實驗
七、CentOS7下搭建postfix郵箱服務器並實現extmail的web訪問
*八、使用Postfix和Dovecot收發電子郵件
九、請求-阿里雲搭建郵件服務器
十、基於騰訊雲主機CentOS搭建郵件收發服務器
十一、查看centos中的用戶和用戶組
十二、[
linux(CentOS)之postfix服務器Dovecot接收郵件](http://blog.51cto.com/hf1208/...
*1三、Sendmail郵件服務器報錯:-ERR Plaintext authentication disallowed on non-secure (SSL/TLS) connections 解決辦法
1四、Sender address rejected: Domain not found
1五、iRedMail運行環境(Centos 64位 | iRedMail)
*1六、nslookup命令詳解
1七、postfix 郵件服務的安裝及詳解

[root@mail ~]# netstat -lnpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name
tcp        0      0 0.0.0.0:587                 0.0.0.0:*                   LISTEN      2636/master
tcp        0      0 127.0.0.1:9998              0.0.0.0:*                   LISTEN      15771/amavisd (mast
tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      2256/dovecot
tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      2256/dovecot
tcp        0      0 127.0.0.1:10031             0.0.0.0:*                   LISTEN      1582/perl
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      1614/httpd
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      908/sshd
tcp        0      0 0.0.0.0:24                  0.0.0.0:*                   LISTEN      2256/dovecot
tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      2636/master
tcp        0      0 0.0.0.0:443                 0.0.0.0:*                   LISTEN      1614/httpd
tcp        0      0 0.0.0.0:4190                0.0.0.0:*                   LISTEN      2256/dovecot
tcp        0      0 127.0.0.1:7777              0.0.0.0:*                   LISTEN      13617/python
tcp        0      0 127.0.0.1:10024             0.0.0.0:*                   LISTEN      15771/amavisd (mast
tcp        0      0 127.0.0.1:10025             0.0.0.0:*                   LISTEN      2636/master
tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      1843/mysqld

history.log

1  ll
    2  netstat -anpt
    3  mysql -uroot
    4  netstat -lnpt
    5   vi /etc/sysconfig/network
    6  vi /etc/hosts
    7  ll
    8  netstat -lnpt
    9  vim /alidata/account.log 
   10  vi /etc/postfix/main.cf
   11  vim /etc/postfix/main.cf
   12  vim /alidata/account.log 
   13  service postfix restart
   14  vim /alidata/account.log 
   15  ll
   16  vim /alidata/account.log 
   17  cd /var/vmail/vmail1
   18  ll
   19  cd email.xfindzp.com/
   20  ll
   21  cd t/
   22  ll
   23  cd e/
   24  ll
   25  cd s/
   26  ll
   27  vim test01-2018.07.06.16.41.59/
   28  vim /alidata/account.log 
   29  mysql -uroot -pV6433FNMKF
   30  ll
   31  cd test01-2018.07.06.16.41.59/
   32  ll
   33  cd Maildir/
   34  ll
   35  cd new/
   36  ll
   37  cd ../
   38  ll
   39  cd cur/
   40  ll
   41  cd ../tmp/
   42  ll
   43  cd ../
   44  ll
   45  vim dovecot.index.log 
   46  vim dovecot.mailbox.log 
   47  vim /alidata/account.log 
   48  hostnamectl set-hostname email.xfindzp.com
   49  hostname
   50  cat /etc/hosts   
   51  yum install hostnamectl
   52  hostnamectl set-hostname email.xfindzp.com
   53  vim /etc/sysconfig/network   
   54  cat /etc/sysconfig/network
   55  hostname email.xfindzp.com
   56  vim /etc/hosts
   57  hostname
   58  exit
   59  hostname
   60  ll
   61  cd /var/
   62  ll
   63  cd mail/
   64  ll
   65  cd vmail 
   66  ll
   67  systemctl status postfix
   68  service profix status
   69  service posfix status
   70  service postfix status
   71  cat /var/log/maillog
   72  history
   73  vim /etc/postfix/main.cf
   74  cat /var/log/maillog
   75  netstat -lnpt
   76  cat /var/log/maillog
   77  vim /etc/postfix/main.cf
   78  service postfix restart
   79  vim /etc/postfix/main.cf
   80  netstat -anpt
   81  netstat -lnpt
   82  exit
   83  ll
   84  cat /var/log/maillog
   85  hostname -f
   86  vim /etc/sysconfig/network
   87  vim /etc/hostname
   88  vim /etc/hosts
   89  hostname -f
   90  service postfix restart
   91  vim /etc/selinux/config
   92  exit
   93  netstat -lnpt
   94  vim /etc/postfix/main.cf
   95  service postfix restart
   96  vim /etc/selinux/config
   97  cat /var/log/maillog
   98  vim /alidata/account.log 
   99  cat /var/log/maillog
  100  cat /etc/resolv.conf 
  101  vim /etc/hostname 
  102  hostname -f
  103  systemctl iptables status
  104  service iptables status
  105  vim /etc/postfix/main.cf
  106  mail
  107  cat /etc/sysconfig/network
  108  cat /etc/hosts
  109  vim /etc/host
  110  vim /etc/hosts
  111  cat /etc/hosts
  112  cat /var/log/maillog
  113  tail /var/log/maillog
  114   > /var/log/maillog
  115  tail /var/log/maillog
  116  vi /etc/dovecot/conf.d/10-auth.conf
  117  vim /etc/dovecot/conf.d/10-auth.conf
  118  vim /etc/dovecot/conf.d/10-ssl.conf
  119  service dovecot restart
  120  service postfix restart
  121  tail /var/log/maillog
  122   > /var/log/maillog
  123  tail /var/log/maillog
  124   printf   "test03@email.xfindzp.com" | openssl base64
  125  printf   "extmail" | openssl base64
  126  telnet email.xfindzp.com 25
  127   cat /usr/lib/sasl2/smtpd.conf
  128  tail /var/log/maillog
  129  ping 126mx02.mxmail.netease.com
  130  tail /var/log/maillog
  131   > /var/log/maillog
  132  tail /var/log/maillog
  133  vim /etc/postfix/main.cf
  134  vim /etc/postfix/mysql/virtual_mailbox_domains.cf
  135   > /var/log/maillog
  136  tail /var/log/maillog
  137  mail
  138   > /var/log/maillog
  139  netstat -lnpt
  140  top
  141  netstat -lnpt
  142  tail /var/log/maillog
  143  exit
  144  netstat -lnpt
  145  vim /alidata/account.log 
  146  hostname -f
  147  tail /var/log/maillog
  148  vim /etc/postfix/main.cf
  149  service postfix restart
  150  tail /var/log/maillog
  151  vim /etc/postfix/main.cf
  152  service postfix restart
  153  tail /var/log/maillog
  154  netstat -lnpt
  155  ps -ef | grep 32383
  156  netstat -anpt
  157  tail /var/log/maillog
  158  vim /etc/postfix/main.cf
  159  service postfix restart
  160  cat /etc/resolv.conf 
  161  nslookup
  162  vim /etc/postfix/main.cf
  163  service postfix restart
  164  vim /alidata/account.log 
  165  tail /var/log/maillog
  166  telnet email.xfindzp.com
  167  telnet email.xfindzp.com 25
  168  tail /var/log/maillog
  169   >  /var/log/maillog
  170  tail /var/log/maillog
  171  telnet email.xfindzp.com 25
  172  tail /var/log/maillog
  173  ps -ef | grep smtp
  174  netstat -lnpt
  175  vim /var/named
  176  user list
  177  ll
  178  cd 
  179  ll
  180  pwd
  181  cd /
  182  ll
  183  cd home/
  184  ll
  185  cd al
  186  cd /alidata/
  187  ll
  188  cd init/
  189  ll
  190  vim initPasswd.sh 
  191  vim /var/www/iredadmin/settings.py
  192   su - boss
  193   vim /etc/dovecot/conf.d/10-mail.conf
  194  tail /var/log/maillog
  195  vim /alidata/account.log 
  196  ll /var/vmail
  197  cd /var/vmail/vmail1/
  198  ll
  199  cd email.xfindzp.com/
  200  ll
  201  cd t/
  202  ll
  203  cd e/
  204  ll
  205  cd s/
  206  ll
  207  cd test04-2018.07.07.14.19.01/
  208  ll
  209  cd Maildir/
  210  ll
  211  cd new/
  212  ll
  213  vim /etc/postfix/main.cf
  214  service postfix restart
  215  ll
  216  cd ..
  217  ll
  218  vim dovecot.index.log 
  219  vim dovecot.mailbox.log 
  220  ll tmp/
  221  ll cur/
  222  ll subscriptions 
  223  vim subscriptions 
  224  vim /etc/postfix/main.cf
  225  telnet email.xfindzp.com
  226  telnet email.xfindzp.com 25
  227  tail /var/log/maillog
  228  netstat -tan | grep -i :110
  229  telnet localhost 110
  230  tail /var/log/maillog
  231  telnet localhost 110
  232  netstat -lnpt
  233  vim /etc/dovecot/dovecot.conf
  234  id test04
  235  vim /alidata/account.log 
  236  cut -d : -f 1 /etc/passwd
  237  ll
  238  ls -all
  239  cat /etc/passwd | grep -v /sbin/nologin | cut -d : -f 1
  240  w root
  241  useradd boss
  242  echo "123456" | passwd --stdin boss
  243  cut -d : -f 1 /etc/passwd
  244  telnet localhost 110
  245  systemctl start dovecot
  246  service dovecot restart
  247  ps -ef | grep dovecot
  248  id vmail
  249  telnet localhost 110
  250  vim /etc/dovecot/dovecot.conf
  251  vim /var/log/dovecot.log
  252   >  /var/log/dovecot.log
  253  cat /var/log/dovecot.log
  254  telnet localhost 110
  255  cat /var/log/dovecot.log
  256  telnet localhost 110
  257  cat /var/log/dovecot.log
  258  w root
  259  cat /etc/passwd
  260  telnet localhost 110
  261  useradd zw
  262  passWd zw
  263  passwd ze
  264  passwd zw
  265  telnet localhost 110
  266  cat /etc/passwd
  267  cat /var/log/dovecot.log
  268   >  /var/log/dovecot.log
  269  telnet localhost 110
  270  cat /var/log/dovecot.log
  271   >  /var/log/dovecot.log
  272  telnet localhost 110
  273  cat /var/log/dovecot.log
  274  netstat -lntp
  275  w test04
  276  w root
  277  telnet localhost 110
  278  vim /etc/dovecot/conf.d/10-auth.conf
  279  vim /etc/dovecot/conf.d/10-ssl.conf
  280  service dovecot restart
  281  vim /etc/dovecot/conf.d/10-mail.conf 
  282  vim /etc/dovecot/dovecot.conf
  283  service dovecot restart
  284  mail
  285  telnet localhost 110
  286  cat /var/log/dovecot.log
  287   >  /var/log/dovecot.log
  288  cat /var/log/dovecot.log
  289  ll
  290  cd new/
  291  ll
  292  vim /etc/dovecot/dovecot.conf
  293  vim /etc/dovecot/conf.d/10-mail.conf 
  294  cd ~
  295  ll
  296  cd /etc/dovecot/conf.d
  297  ll
  298  vim 10-auth.conf 
  299  vim 10-mail.conf 
  300  service dovecot restart
  301  vim /etc/dovecot/dovecot.conf
  302  vim /etc/dovecot/conf.d/10-mail.conf 
  303  service dovecot restart
  304  cat /var/log/dovecot.log
  305  history
  306  vim /var/log/maillog
  307  whois
  308  ping email.xfindzp.com
  309  nslookup
  310  vim /var/log/maillog
  311  vim /var/log/dovecot.log
  312  vim /etc/postfix/main.cf
  313  service postfix restart
  314  vim /etc/postfix/main.cf
  315  vim /var/log/maillog
  316  hostname -f
  317  cat /etc/hosts
  318  more /etc/sysconfig/network 
  319  hostname
  320  more /proc/sys/kernel/hostname
  321  cd /etc
  322  ls
  323  vim my.cnf
  324  vim networks 
  325  vim /var/log/maillog
  326  cd /etc/dovecot/
  327  ll
  328  vim dovecot.conf
  329  service dovecot restart
  330  vim /var/log/maillog
  331   > /var/log/maillog
  332  vim /var/log/maillog
  333  cat /var/log/maillog
  334  hostname
  335  vim /etc/sysconfig/network
  336  hostname
  337  vim /etc/hosts
  338  hostname
  339  more /etc/sysconfig/network 
  340  more /etc/hosts
  341  more /proc/sys/kernel/hostname
  342  vim /proc/sys/kernel/hostname
  343  exit
  344  hostname
  345  vim /etc/postfix/main.cf
  346  service postfix restart
  347  vim /alidata/account.log 
  348  cd /var/vmail
  349  ll
  350  cd vmail1/
  351  ll
  352  netstat -lntp
  353  ll
  354  cat /var/log/maillog
  355  netstatp
  356  netstat -anpt
  357  service dovecot restart
  358   > /var/log/maillog
  359  cat /var/log/maillog
  360  vim /etc/postfix/main.cf
  361  cat /var/log/maillog
  362  vim /etc/postfix/main.cf
  363  service postfix restart
  364  vim /etc/postfix/main.cf
  365  cat /var/log/maillog
  366  netstat -anpt
  367  vim /etc/postfix/main.cf
  368  pwd
  369  exit
  370  ll
  371  vim hostnam~
  372  ll
  373  cd
  374  ll
  375  cd echo 
  376  netstat -anpt
  377  netstat -lnpt
  378  cat /var/log/maillog
  379  vim /etc/resolv.con
  380  vim /etc/resolv.conf
  381  vim /alidata/account.log 
  382  exit
  383  vim /var/spool/postfix/etc/resolv.conf
  384  cd /var/spool/postfix/etc
  385  ll
  386  cp resolv.conf resolv.conf_copy
  387  vim resolv.conf_copy 
  388  vim resolv.conf
  389  vim resolv.conf_copy 
  390  cat /var/log/maillog
  391  exit
  392  netstat -lnpt
  393  vim /etc/postfix/main.cf
  394  vim /proc/sys/kernel/hostname
  395  cat /proc/sys/kernel/hostname
  396  history
  397  more /etc/sysconfig/network
  398  cat /etc/hosts
  399  vim /alidata/account.log
  400  history
  401  vim /var/log/dovecot.log
  402  cat /var/log/maillog
  403  history
  404  vim /var/spool/postfix/etc/resolv.conf
  405  vim /var/spool/postfix/etc/resolv.conf_copy 
  406  vim /etc/resolv.conf
  407  vim /var/spool/postfix/etc/resolv.conf
  408  netstat -lnpt
  409  history > history.log
相關文章
相關標籤/搜索