企業郵件系統-Postfix安裝使用

Postfix是目前流行的一套郵件傳輸代理軟件(MTA),其做者Wietst Venema最初開發這套軟件時就對整體設計、擴展能力、可用性及系統安全等方面進行了充分的考慮。因爲Postfix在穩定、效率、安全和可用性上的優點,使得不少大型的郵件服務提供商都從原有的MTA軟件向Postfix過分,而新僅誕生的郵件產品也大多采用了Postfix。網易、Tom和新浪都將原有的Qmail更換爲Postfix,可見Postfix在大規模郵件系統中有比較廣泛的應用,固然,Postfix也徹底適用設計中小型的郵件系統,由於Postfix在保證了效率、安全、擴展等方面優點的同時,還具備配置簡單的特色。[比較老的數據了]html

 

碎語:

又開始搗騰我比較喜歡的郵件系統了,本文爲後面的郵件系統作鋪墊,後面在來關聯文章樹,本文LNMP環境基於LNMP一鍵安裝,請自行經過博客搜索功能搜索該關鍵詞node

 

基於CentOS6.5,環境minimal,卸載postfixpython

[root@ipython ~]# service postfix stop Shutting down postfix: [ OK ] [root@ipython ~]# rpm -e --nodeps postfix

 

安裝Postfixmysql

[root@ipython ~]# yum install db4-devel [root@ipython ~]# tar zxf postfix-2.12-20140801.tar.gz [root@ipython ~]# cd postfix-2.12-20140801 ####直接編譯Makefiles#### ###AUX = 擴展功能[就這理解着吧] -lz = 壓縮工具 -lm = 編碼支持 #### ####lssl = openssl加密支持 lcrypto = crypto庫 #### ###若是你參考了本文,請不要看別的文章,而且最好使用我打包好的免安裝LNMP或一鍵安裝LNMP作完一次完整的測試後,再嘗試跟着你本身的感受走哦### ###固然,若是你仍採用了本身的思路並參考了本文,那麼請修改下面的依賴文件的路徑,歡迎提問### [root@ipython postfix-2.12-20140801]# make makefiles CCARGS='-DHAS_MYSQL -I/software/mysql/include/mysql -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/software/openssl/include' AUXLIBS='-L/software/mysql/lib/mysql/ -lmysqlclient -lz -lm -L/software/openssl/lib/ -lssl -lcrypto' [root@ipython postfix-2.12-20140801]# make ###給權限哦### [root@ipython postfix-2.12-20140801]# chmod a+x postfix-install [root@ipython postfix-2.12-20140801]# ./postfix-install -non-interactive install_root=/ tempdir=/tmp config_directory=/etc/postfix command_directory=/usr/sbin/ daemon_directory=/software/postfix data_directory=/var/lib/postfix html_directory=no mail_owner=postfix mailq_path=/usr/bin/mailq manpage_directory=/usr/local/man newaliases_path=/usr/bin/newaliases queue_directory=/var/spool/postfix readme_directory=no sendmail_path=/usr/sbin/sendmail setgia_group=postdrop

 

Postfix自動啓動sql

###postfix 啓動腳本能夠參考 blfs-bootscripts 包,依賴redhat-lsb,因爲太大,這裏放棄### ---手動創建--- ---------------------/etc/init.d/postfix--------------------------- #!/bin/bash # # postfix Postfix Mail Transfer Agent # # chkconfig: 2345 80 30 # description: Postfix is a Mail Transport Agent, which is the program \ # that moves mail from one machine to another. # processname: master # pidfile: /var/spool/postfix/pid/master.pid # config: /etc/postfix/main.cf # config: /etc/postfix/master.cf # # Based on startup script from Simon J Mudd <sjmudd@pobox.com> # 25/02/99: Mostly s/sendmail/postfix/g by John A. Martin <jam@jamux.com> # 23/11/00: Changes & suggestions by Ajay Ramaswamy <ajayr@bigfoot.com> # 20/01/01: Changes to fall in line with RedHat 7.0 style # 23/02/01: Fix a few untidy problems with help from Daniel Roesen. ### BEGIN INIT INFO # Provides: postfix MTA # Required-Start: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop postfix # Description: Postfix is a Mail Transport Agent, which is the program that  # moves mail from one machine to another. ### END INIT INFO # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network RETVAL=0 prog="postfix" lockfile=/var/lock/subsys/$prog pidfile=/var/spool/postfix/pid/master.pid ALIASESDB_STAMP=/var/lib/misc/postfix.aliasesdb-stamp # Script to update chroot environment CHROOT_UPDATE=/etc/postfix/chroot-update status -p $pidfile -l $(basename $lockfile) -b /usr/libexec/postfix/master master >/dev/null 2>&1 running=$? conf_check() { [ -x /usr/sbin/postfix ] || exit 5 [ -d /etc/postfix ] || exit 6 [ -d /var/spool/postfix ] || exit 5 } make_aliasesdb() { if [ "$(/usr/sbin/postconf -h alias_database)" == "hash:/etc/aliases" ] then # /etc/aliases.db may be used by other MTA, make sure nothing # has touched it since our last newaliases call [ /etc/aliases -nt /etc/aliases.db ] || [ "$ALIASESDB_STAMP" -nt /etc/aliases.db ] || [ "$ALIASESDB_STAMP" -ot /etc/aliases.db ] || return /usr/bin/newaliases touch -r /etc/aliases.db "$ALIASESDB_STAMP" else /usr/bin/newaliases fi } start() { [ "$EUID" != "0" ] && exit 4 # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 1 conf_check # Start daemons. echo -n $"Starting postfix: " make_aliasesdb >/dev/null 2>&1 [ -x $CHROOT_UPDATE ] && $CHROOT_UPDATE /usr/sbin/postfix start 2>/dev/null 1>&2 && success || failure $"$prog start" RETVAL=$? [ $RETVAL -eq 0 ] && touch $lockfile echo return $RETVAL } stop() { [ "$EUID" != "0" ] && exit 4 conf_check # Stop daemons. echo -n $"Shutting down postfix: " /usr/sbin/postfix stop 2>/dev/null 1>&2 && success || failure $"$prog stop" RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $lockfile $pidfile echo return $RETVAL } reload() { conf_check echo -n $"Reloading postfix: " [ -x $CHROOT_UPDATE ] && $CHROOT_UPDATE /usr/sbin/postfix reload 2>/dev/null1>&2&& success || failure $"$prog reload" RETVAL=$? echo return $RETVAL } abort(){ conf_check /usr/sbin/postfix abort 2>/dev/null1>&2&& success || failure $"$prog abort"return $?} flush(){ conf_check /usr/sbin/postfix flush 2>/dev/null1>&2&& success || failure $"$prog flush"return $?} check(){ conf_check /usr/sbin/postfix check 2>/dev/null1>&2&& success || failure $"$prog check"return $?}# See how we were called.case"$1"in start)[ $running -eq 0]&&exit0 start ;; stop)[ $running -eq 0]||exit0 stop ;; restart|force-reload) stop start ;; reload)[ $running -eq 0]||exit7 reload ;; abort) abort ;; flush) flush ;; check) check ;; status) status -p $pidfile -l $(basename $lockfile)-b /usr/libexec/postfix/master master ;; condrestart)[ $running -eq 0]||exit0 stop start ;;*) echo $"Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart}"exit2esacexit $?###################################點到爲止###################################[root@ipython postfix-2.12-20140801]# chmod 755/etc/init.d/postfix [root@ipython postfix-2.12-20140801]# service postfix start Starting postfix:[ OK ]

 

» 轉載保留版權: IT辰逸 »  《郵件系統-Postfix 安裝詳解》
» 本文版權採起:  BY-NC-SA 協議進行受權,轉載註明出處。除IT-Tools、News以及特別標註,本站全部文章均爲原創。
» 若是喜歡能夠:  點此訂閱本站
相關文章
相關標籤/搜索