CentOS 安裝配置Extmail Web郵件收發系統 Extmail 是一個以perl語言編寫,面向大容量/ISP級應用,免費的高性能Webmail軟體,主要包括ExtMail、Extman兩個部分的程序套件。ExtMail套件用於提供從瀏覽器中登錄、使用郵件系統的Web操作界面,而Extman套件用於提供從瀏覽器中管理郵件系統的Web操作界面。它以GPL版權釋出,設計初衷是希望設計一個適應當前高速發展的IT應用環境,滿足用戶多變的需求,能快速進行開發、改進和升級,適應能力強的webmail系統。 下面是在CentOS Linux 32位系統安裝配置Extmail Web郵件收發系統:製作 yum 倉庫 編譯CentOS-Base.repo文件 # vi /etc/yum.repos.d/CentOS-Base.repo 加入如下內容: # EMOS-Base.repo # # Created by ExtMail Dev Team: http://www.extmail.org/ # # $Id$ name=EMOS-Base baseurl=http://mirror.extmail.org/yum/emos/1.5/os/$basearch/ gpgcheck=0 priority=0 protect=0 name=EMOS-Updates baseurl=http://mirror.extmail.org/yum/emos/1.5/updates/$basearch/ gpgcheck=0 priority=0 protect=0 保存后,然後嘗試執行一下yum list 等操作,看看是否已經成功;配置mta-postfix 1、安裝postfix # yum -y install postfix # yum remove sendmail 2、配置postfix # postconf -n > /etc/postfix/main2.cf # mv /etc/postfix/main.cf /etc/postfix/main.cf.old # mv /etc/postfix/main2.cf /etc/postfix/main.cf 編輯main.cf: # vi /etc/postfix/main.cf 增加如下內容: # hostname mynetworks = 127.0.0.1 myhostname = mail.linuxde.net mydestination = $mynetworks $myhostname # banner mail_name = Postfix - by extmail.org smtpd_banner = $myhostname ESMTP $mail_name # response immediately smtpd_error_sleep_time = 0s # Message and return coolcode control message_size_limit = 5242880 mailbox_size_limit = 5242880 show_user_unknown_table_name = no # Queue lifetime control bounce_queue_lifetime = 1d maximal_queue_lifetime = 1d 註:myhostname改為自己的。 設置postfix開機自啟: # chkconfig postfix on配置courier-authlib 1、安裝Courier-Authlib 安裝以下軟體包: # yum -y install courier-authlib # yum -y install courier-authlib-mysql 刪除並編輯/etc/authlib/authmysqlrc文件: # cat /dev/null >/etc/authlib/authmysqlrc # vi /etc/authlib/authmysqlrc 增加如下內容: MYSQL_SERVER localhost MYSQL_USERNAME extmail MYSQL_PASSWORD extmail MYSQL_SOCKET /var/lib/mysql/mysql.sock MYSQL_PORT 3306 MYSQL_OPT 0 MYSQL_DATABASE extmail MYSQL_USER_TABLE mailbox MYSQL_CRYPT_PWFIELD password MYSQL_UID_FIELD uidnumber MYSQL_GID_FIELD gidnumber MYSQL_LOGIN_FIELD username MYSQL_HOME_FIELD homedir MYSQL_NAME_FIELD name MYSQL_MAILDIR_FIELD maildir MYSQL_QUOTA_FIELD quota MYSQL_SELECT_CLAUSE SELECT username,password,"",uidnumber,gidnumber,\ CONCAT('/home/domains/',homedir), \ CONCAT('/home/domains/',maildir), \ quota,\ name \ FROM mailbox \ WHERE username = '$(local_part)@$(domain)' 修改authdaemonrc文件 # vi /etc/authlib/authdaemonrc 修改如下內容: authmodulelist="authmysql" authmodulelistorig="authmysql" 或者使用如下命令直接修改: # sed -i 's/authmodulelist=.*/authmodulelist="authmysql"/g'/etc/authlib/authdaemonrc # sed -i 's/authmodulelistorig=.*/authmodulelistorig="authmysql"/g'/etc/authlib/authdaemonrc 2、啟動courier-authlib: # service courier-authlib start 修改authdaemon socket目錄許可權 # chmod 755 /var/spool/authdaemon/配置maildrop 1、安裝maildrop # yum -y install maildrop 配置master.cf 為了使Postfix支持Maildrop,必須修改/etc/postfix/master.cf文件,註釋掉原來的maildrop的配置內容,並改為: maildrop unix - n n - - pipe flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop} 注意:flags前面有「兩個空格」 配置main.cf 由於maildrop不支持一次接收多個收件人,因此必須在main.cf里增加如下參數: # vi /etc/postfix/main.cf maildrop_destination_recipient_limit = 1 2、測試maildrop對authlib支持 # maildrop -v 看是否出現以下內容: maildrop 2.1.0 Copyright 1998-2005 Double Precision, Inc. GDBM/DB extensions enabled. Courier Authentication Library extension enabled. Maildir quota extension enabled. This program is distributed under the terms of the GNU General Public License. See COPYING for additional information.配置apache 1、安裝httpd # yum -y install httpd 2、虛擬主機設置 編輯httpd.conf文件: # vi /etc/httpd/conf/httpd.conf 在最後一行加上: NameVirtualHost *:80 Include conf/vhost_*.conf 編輯 vhost_extmail.conf # vi /etc/httpd/conf/vhost_extmail.conf 裡面定義虛擬主機的相關內容: # VirtualHost for ExtMail Solution ServerName mail.linuxde.net DocumentRoot /var/www/extsuite/extmail/html/ ScriptAlias /extmail/cgi/ /var/www/extsuite/extmail/cgi/ Alias /extmail /var/www/extsuite/extmail/html/ ScriptAlias /extman/cgi/ /var/www/extsuite/extman/cgi/ Alias /extman /var/www/extsuite/extman/html/ # Suexec config SuexecUserGroup vuser vgroup 注意:把ServerName修改成自己的。 設置apache開機啟動並重啟apache # chkconfig httpd on # service httpd restart配置webmail-extmail 1、安裝ExtMail # yum -y install extsuite-webmail 2、編輯webmail.cf # cd /var/www/extsuite/extmail # cp webmail.cf.default webmail.cf # vi webmail.cf 主要變動的內容見下: SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail SYS_MYSQL_DB = extmail 更新cgi目錄許可權 由於SuEXEC的需要,必須將extmail的cgi目錄修改成vuser:vgroup許可權: # chown -R vuser:vgroup /var/www/extsuite/extmail/cgi/配置管理後台-extman 1、yum安裝ExtMan # yum -y install extsuite-webman 更新cgi目錄許可權 由於SuEXEC的需要,必須將extman的cgi目錄修改成vuser:vgroup許可權: # chown -R vuser:vgroup /var/www/extsuite/extman/cgi/ 鏈接基本庫到Extmail # mkdir /tmp/extman # chown -R vuser:vgroup /tmp/extman 注意事項: 由於RedHat發行版中包含了一個叫tmpwatch的工具,該工具會定期掃描/tmp/下的文件,如果這些文件很久都沒被使用,將被刪除,因此如果後台長期不使用,/tmp/extman目錄有可能被tmpwatch刪除,所以要麼定期登陸後台,要麼修改 webman.cf將臨時目錄修改到另一個地方。此處暫以/tmp/extman默認值為例。 2、安裝mysql資料庫 # yum -y install mysql mysql-server 3、資料庫初始化 啟動Mysql # service mysqld start # chkconfig mysqld on 導入mysql資料庫結構及初始化數據,root密碼默認為空 # mysql -u root -p < /var/www/extsuite/extman/docs/extmail.sql # mysql -u root -p < /var/www/extsuite/extman/docs/init.sql 注意事項: 上述導入初始化SQL時,默認的uidnumber/gidnumber都是1000,這和vuser:vgroup 的uid/gid一致,是因為maildrop投遞時會從資料庫里取uidnumber/gidnumber,而在master.cf里已經定義好了投遞時的運行身份(vuser:vgroup),所以這兩個欄位的內容必須為1000,否則將出現投遞錯誤,例如報0×06等錯誤。 4、設置虛擬域和虛擬用戶的配置文件 # cd /var/www/extsuite/extman/docs # cp mysql_virtual_alias_maps.cf /etc/postfix/ # cp mysql_virtual_domains_maps.cf /etc/postfix/ # cp mysql_virtual_mailbox_maps.cf /etc/postfix/ # cp mysql_virtual_sender_maps.cf /etc/postfix/ 配置main.cf: # vi /etc/postfix/main.cf 增加以下內容: # extmail config here virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_transport = maildrop: 重啟postfix : # service postfix restart 5、測試authlib # /usr/sbin/authtest -s login postmaster@extmail.org extmail 結果如下: Authentication succeeded. Authenticated: postmaster@extmail.org (uid 1000, gid 1000) Home Directory: /home/domains/extmail.org/postmaster Maildir: /home/domains/extmail.org/postmaster/Maildir/ Quota:104857600S Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0 Cleartext Password: extmail Options:(none) 這樣表明ExtMan的正確安裝,資料庫也正確導入,courier-authlib能正確連接到mysql資料庫 最後訪問http://mail.linuxde.net/extmail/,如無意外,將看到webmail的登陸頁,不過此時還沒有加正式的用戶,所以不能登陸,包括postmaster@extmail.org也不行。必須要登陸到http://mail.linuxde.net/extman/ 里增加一個新帳戶才能登陸。 ExtMan的默認超級管理員帳戶:root@extmail.org,初始密碼:extmail*123*,登陸成功后,建議將密碼修改,以確保安全。 6、配置圖形化日誌 啟動mailgraph_ext # /usr/local/mailgraph_ext/mailgraph-init start 啟動cmdserver(在後台顯示系統信息) # /var/www/extsuite/extman/daemon/cmdserver --daemon 加入開機自啟動: # echo "/usr/local/mailgraph_ext/mailgraph-init start">> /etc/rc.d/rc.local # echo "/var/www/extsuite/extman/daemon/cmdserver -v -d" >> /etc/rc.d/rc.local 使用方法: 等待大約15分鐘左右,如果郵件系統有一定的流量,即可登陸到extman里,點「圖形日誌」即可看到圖形化的日誌。具體每天,周,月,年的則點擊相應的圖片進入即可。配置cyrus-sasl 1、安裝cyrus-sasl 刪除系統的cyrus-sasl: # rpm -e cyrus-sasl --nodeps 安裝新的支持authdaemon的軟體包 # yum -y install cyrus-sasl cyrus-sasl-plain 2、配置main.cf文件 Postfix的SMTP認證需要透過Cyrus-SASL,連接到authdaemon獲取認證信息。 編輯main.cf # vi /etc/postfix/main.cf 增加如下內容: # smtpd related config smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_non_fqdn_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unauth_destination, reject_unauth_pipelining, reject_invalid_hostname, # SMTP sender login matching config smtpd_sender_restrictions = permit_mynetworks, reject_sender_login_mismatch, reject_authenticated_sender_login_mismatch, reject_unauthenticated_sender_login_mismatch smtpd_sender_login_maps = mysql:/etc/postfix/mysql_virtual_sender_maps.cf, mysql:/etc/postfix/mysql_virtual_alias_maps.cf # SMTP AUTH config here broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous 3、編輯smtpd.conf文件 # vi /usr/lib/sasl2/smtpd.conf 確保其內容為: pwcheck_method: authdaemond log_level: 3 mech_list: PLAIN LOGIN authdaemond_path:/var/spool/authdaemon/socket 重新啟動postfix: # service postfix restart 4、測試SMTP認證 通過以下命令獲得postmaster@extmail.org的用戶名及密碼的BASE64編碼: # perl -e 'use MIME::Base64; print encoolcode_base64("postmaster\@extmail.org")' 內容如下: cG9zdG1hc3RlckBleHRtYWlsLm9yZw== # perl -e 'use MIME::Base64; print encoolcode_base64("extmail")' 內容如下: ZXh0bWFpbA== 然後本機測試: # telnet localhost 25 其過程如下: Trying 127.0.0.1… Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 mail.extmail.org ESMTP Postfix – by extmail.org ehlo demo.domain.tld << 輸入內容 250-mail.extmail.org 250-PIPELINING 250-SIZE 10240000 250-VRFY 250-ETRN 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN PLAIN 250-ENHANCEDSTATUScoolcodeS 250-8BITMIME 250 DSN auth login <<輸入內容 334 VXNlcm5hbWU6 cG9zdG1hc3RlckBleHRtYWlsLm9yZw== << 輸入內容 334 UGFzc3dvcmQ6 ZXh0bWFpbA== << 輸入內容 235 2.0.0 Authentication successful quit << 輸入內容 221 2.0.0 Bye 最後出現235 Authentication Successful 表明認證成功了。配置courier-imap 1、安裝Courier-imap 默認的courier-authlib及courier-imap都會增加系統自啟動設置,因此下一次伺服器啟動將自動啟動相應的authlib及POP3服務 # yum -y install courier-imap 配置courier-imap 由於Courier-imap的IMAP目錄是按UTF-7編碼的,ExtMail目前還沒有正式支持IMAP目錄,因此需要屏蔽IMAP,只提供pop3服務。而就目前的使用情況來看,IMAP使用的非常少,絕大部分OutLook/Foxmail用戶都習慣使用POP3而非IMAP。 # vi /usr/lib/courier-imap/etc/imapd 修改內容如下:IMAPDSTART=NO # vi /usr/lib/courier-imap/etc/imapd-ssl 修改內容如下:IMAPDSSLSTART=NO 然後重新啟動courier-imap: # service courier-imap start 測試POP3 請按如下步驟輸入pop3命令測試其是否正常工作,注意藍色的信息是我們輸入到POP3伺服器的(請首先登錄extman自行建立test@extmail.org用戶,密碼:extmail) # telnet localhost 110 其過程如下: Trying 127.0.0.1… Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. +OK Hello there. user test@extmail.org << 輸入內容 +OK Password required. pass extmail <<輸入內容 +OK logged in. list <<輸入內容 +OK POP3 clients that break here, they violate STD53.. quit << 輸入內容 +OK Bye-bye. Connection closed by foreign host. 最後說明 至此,ExtMail的安裝配置基本完成,如想配置內容,病毒過濾請到官方網站學習配置。登錄extmail系統後台后,請及時修改密碼或者用戶名。最後需要確認的是,是否已經設置好郵件域名的MX記錄或者A記錄,這樣才能正常收取郵件。 原文:http://www.linuxde.net/2011/11/2035.html [*]CentOS Linux安裝配置Extmail Web郵件收發系統[*]百度員工猝死 是否過勞死引發爭論[*]Android 4.0 開發板現身 可自適應解析度[*]用PHP來做負載均衡指南[*]必備的數據中心管理工具[*]簡述linux服務自動啟動[*]避免在遷移Linux時嚴重出錯[*]開源虛擬化 KVM能否成為未來[*]FreeBSD 9.0 RC2 發布[*]騰訊和360同日表態進軍搜索[*]IT管理 因「雲」而改變[*]蘋果獲得首個與零售交易相關的NFC技術專利[*]linux伺服器管理系統WDCP 2.0 beta4版發布[*]Linux下搭建DNS伺服器和配置文件(named.conf)祥解[*]15個值得開發人員關注的jQuery開發技巧和心得
[火星人
]
CentOS 安裝配置Extmail Web郵件收發系統 已經有1002 次圍觀
本文地址: http://coctec.com/docs/service/show-post-13741.html