郵件服務系列之編譯安裝Postfix2.9.15

Mail Server:
SMTP:簡單郵件服務器
ESMTP:擴展的簡單郵件服務器
POP3:郵局協議
IMAP4:互聯網郵件訪問協議
UUCP:Unix主機複製文件的協議
SMTP監聽tcp協議的25端口

Open Relay: 開放式中繼
SASL:簡單認證安全層

WebMail
LDAP:輕量級目錄訪問協議
MySQL:
虛擬用戶:僅用於訪問某服務的數字表示:
   用戶:字符串,憑證
   
MTA:郵件傳輸代理,SMTP服務器
   sendmail,UUCP
      單體機構,SUID,配置文件語法(m4編寫)
      qmail
      postfix:模塊化設計,安全,跟sendmmail兼容,效率高
      exim:MTA
      Exchange (Windows,異步消息協作平臺)

SASL:v2
     cyrus-sasl
     courier-authlib
      
MDA:郵件投遞代理
    promail
    maildrop

MRA: pop3,imap4
    cyrus-imap
    dovecot
MUA:郵件用戶代理
    Outlook Express,Outlook
    Foxmail
    Thunderbird
    Evolution
    mutt(文本界面)
WebMail:
    Openwebmail
    squirrelmail
    Extmail(Extman)
    
    
Postfix+SASL (courier-authlib) + RySQL
Docecot+MySQL
Extmail+Extman+httpd
[root@www ~]# yum  list all |grep sendmail 查看系統是否安裝了rpm包的sendmail,如果安裝了就卸載掉
[root@www ~]# rpm -e sendmail -nodeps
首先安裝MySQL
http://www.postfix.org/  下載postfix源碼包

[root@www postfix-2.9.15]# tar -xf postfix-2.9.15.tar.gz
[root@www postfix-2.9.15]# groupadd -g 2525 postfix
[root@www postfix-2.9.15]# useradd -g 2525 -u 2525 -s /sbin/nologin -M postfix
[root@www postfix-2.9.15]# groupadd -g 2526 postdrop
[root@www postfix-2.9.15]# useradd -g 2526 -u 2526 -s /sbin/nologin -M postdrop
[root@www usr]# yum -y install cyrus-sasl-devel.i686
[root@www lib64]# rpm -ql cyrus-sasl-devel  根據sasl的lib和include路徑來進行安裝

[root@www postfix-2.10.10]# make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH -I/usr/include/sasl -DUSE_TLS' 'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/lib/sasl2 -lsasl2 -lssl -lcrypto'
CCARGS 編譯的時候鏈接到什麼地方,主要是找哪個系統的頭文件
AUXLIBS 到哪裏去找mysql庫文件
instal_root: [/] /
tempdir: [/root/postfix-2.9.3] /tmp/postfix
config_directory: [/etc/postfix] /etc/postfix
daemon_directory: [/usr/libexec/postfix]
command_directory: [/usr/sbin]
queue_directory: [/var/spool/postfix]
sendmail_path: [/usr/sbin/sendmail]
newaliases_path: [/usr/bin/newaliases]
mailq_path: [/usr/bin/mailq]
mail_owner: [postdrop]postfix
setgid_group: [postdrop]
html_directory: [no] /var/www/html/postfix
manpages: [/usr/local/man]
readme_dirctory: [no]

-------------------

postfix start


[root@localhost ~]# tail /var/log/maillog

Aug  6 09:49:21 localhost postfix/master[8115]: fatal: open lock file /var/lib/postfix/master.lock: cannot open file: Permission denied

Aug  6 09:49:22 localhost postfix/master[8114]: fatal: daemon initialization failure

Aug  6 09:49:23 localhost postfix/postfix-script[8116]: fatal: mail system startup failed

Aug  6 09:56:00 localhost postfix/postfix-script[8206]: starting the Postfix mail system

Aug  6 09:56:00 localhost postfix/master[8208]: daemon started -- version 2.10.10, configuration /etc/postfix

Aug  6 15:53:43 localhost postfix/postfix-script[1658]: starting the Postfix mail system

Aug  6 15:53:43 localhost postfix/master[1660]: daemon started -- version 2.10.10, configuration /etc/postfix

Aug  6 16:01:17 localhost postfix/postfix-script[1691]: starting the Postfix mail system

Aug  6 16:01:17 localhost postfix/master[1693]: daemon started -- version 2.10.10, configuration /etc/postfix

Aug  6 16:01:54 localhost postfix/postfix-script[1803]: fatal: the Postfix mail system is already running


postfix的配置文件

   postfix模塊化:

     master:/etc/postfix/master.cf 主進程,用於控制啓動的其他進程

     mail: /etc/postfix/main.cf  整個郵件服務器的配置文件

     參數 = 值:參數必須寫在行的絕對行首,以空白開頭的行被認爲是上一行的延續

[root@localhost ~]# vim /etc/postfix/master.cf 

 

pickup    fifo  n       -       n       60      1       pickup 分揀進程

cleanup   unix  n       -       n       -       0       cleanup 清理進程

qmgr      fifo  n       -       n       300     1       qmgr 隊列管理器 
此配置文件記錄進程信息。而每個進程的配置都在/etc/postfix/main.cf裏


命令postconf  用於配置postfix

   -d 顯示默認配置

   -n 修改了的配置

    -m 顯示支持的所有查找表的類型

   -A 顯示當前主機支持的SASL的類型

   -e 參數=某個值。更改某參數的配置信息,並保存至main.cf文件中

[root@localhost ~]# vim /etc/postfix/main.cf

[root@localhost ~]# telnet localhost 25

helo localhost

ehlo localhost

SMTP狀態碼:

1xx:純信息

2xx:正確信息

3xx:上一步操作尚未完成,需要繼續補充

4xx:暫時性錯誤

5xx:永久性錯誤


SMTP協議命令:

 hello (smtp協議)||   ehlo  (esmtp協議)

 mail from :[email protected]   發件人

 rcpt to: [email protected] 收件人

 data 正文

 . 表示發送

 quit退出

 

alias郵件別名:


[email protected] : [email protected]

所有發給abc的郵件都直接轉給qwe

通過編輯/etc/aliases來配置

/etc/aliases-->hash-->aliases.db


#newaliases

[root@localhost ~]# newaliases

[root@localhost ~]# ls /etc/ |grep aliases

aliases

aliases.db


postfix stop

postfix start

postfix默認本機所在網段的地址中繼



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章