courier-authlib dovecot postfix postdrop extmail mysql 系統版本6.7 軟件版本 httpd-2.2.15-47.el6.centos postfix-3.1.0 extman-1.1 extmail-1.2 mysql 5.6.30 dovecot-2.0.9-19.el6_7.2.x86_64 yum -y remove boost-* yum -y remove mysql yum -y install wget gcc gcc-c++ ncurses-devel cmake make perl 能夠有dns須要的可自行配置,須要的能夠找我,還得寫配置 新建mysql組以及用戶 groupadd mysql useradd -M -s /sbin/nologin -r -g mysql mysql 好像得要有boost 源碼編譯mysql 14-61行 安裝過的可直接忽略 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/mysql/data \ -DSYSCONFDIR=/usr/local/mysql/ \ -DWITH_MYISAM_STORAGE_ENGINE=1 \ -DWITH_INNOBASE_STORAGE_ENGINE=1 \ -DWITH_MEMORY_STORAGE_ENGINE=1 \ -DWITH_READLINE=1 \ -DWITH_BOOST=/files/boost \ -DWITH_PARTITION_STORAGE_ENGINE=1 \ -DMYSQL_UNIX_ADDR=/usr/local/mysql/mysql.sock \ -DMYSQL_TCP_PORT=3306 \ -DDEFAULT_CHARSET=utf8 \ -DDEFAULT_COLLATION=utf8_general_ci \ -DDOWNLOAD_BOOST=1 \ -DENABLED_LOCAL_INFILE=1 \ -DEXTRA_CHARSETS=all 安裝完以後可能會報有四個選項錯誤,這是5.7的配置錯誤能夠忽略 make && make install mv /etc/my.cnf{,.bak} cp support-files/my-default.cnf /etc/my.cnf cp support-files/mysql.server /etc/init.d/mysqld chmod +x /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on mkdir -p /mysql/data chown -R mysql:mysql /mysql/data 5.6 scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/mysql/data -u mysql 5.7 /usr/local/mysql/bin/mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/mysql/data 問題 [root@localhost MySQL]# /etc/rc.d/init.d/mysql status MySQL is not running, but lock file (/var/lock/subsys/mysql[FAILED] 解決方 查看日誌 cat /mysql/data/xiong.err 160513 00:19:41 mysqld_safe mysqld from pid file /mysql/data/xiong.pid ended chown -R mysql:mysql /usr/local/mysql/ touch /etc/profile.d/mysqld.sh echo "export PATH=$PATH:/usr/local/mysql/bin" >> /etc/profile.d/mysqld.sh source /etc/profile.d/mysqld.sh 安裝組工具包以及軟件包 yum -y groupinstall "Development tools" "Desktop Platform Development" "Server Platform Development" yum -y install httpd perl-DBD-MySQL courier-authlib dovecot 首先必定要加入emos源不然authlib軟件會安裝失敗 vim /etc/yum.repo.d/emos.repo [EMOS] name=EMOS baseurl=file:///mnt 此處Yum倉庫按本身要想的來,均可以 enabled=1 gpgcheck=0 卸載postfix軟件 yum -y remove postfix 刪除系統用戶postfix此步必定要操做不然extmail最後發送郵件會出現系統配置錯誤 groupdel postfix groupadd -g 2000 postfix useradd -g 2000 -u 2000 -s /sbin/nologin -M postfix groupadd -g 2001 postdrop userdel -r postdrop useradd -g 2001 -u 2001 -s /sbin/nologin -M postdrop 由於刪除了系統用戶須要將postfix原先自帶文件增長權限,不然啓動時會失敗 chown postfix -R /var/lib/postfix/ chown postfix -R /var/spool/postfix/ 增長庫文件不然make postfix 會失敗 echo "/usr/local/mysql/lib" >> //etc/ld.so.conf.d/mysqld.conf 個人版本是postfix-3.1.0 ,系統版本64位的須要更改/usr/lib64,個人mysql是源碼編的指定頭文件跟庫文件位置 make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/include/sasl -DUSE_TLS' 'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm -L/usr/lib64/sasl2 -lsasl2 -lssl -lcrypto' make -j 2 && make install 生成/etc/init.d/postfix腳本 下載位置 連接:http://pan.baidu.com/s/1hrSpPDM 密碼:tieu chmod +x /etc/init.d/postfix chkconfig postfix --add chkconfig postfix on postconf "smtputf8_enable = no" 編輯authdaemonrc文件更改配置方式只爲myql vim /etc/authlib/authdaemonrc Euthmodulelist="authuserdb authpam authpgsql authldap authmysql authcustom authpipe" authmodulelist="authmysql" Euthmodulelistorig="authuserdb authpam authpgsql authldap authmysql authcustom authpipe" authmodulelistorig="authmysql" #daemons=5 daemons=10 進程爲10 鏈接mysql配置文件,用戶跟密碼按本身指定的來個人是默認的extmail egrep -v "^#|^[[:space:]]|^$" /etc/authlib/authmysqlrc MYSQL_SERVER localhost MYSQL_USERNAME extmial MYSQL_PASSWORD extmail MYSQL_PORT 3306 端口號 MYSQL_OPT 0 MYSQL_DATABASE extmail MYSQL_USER_TABLE mailbox 文件目錄 MYSQL_CRYPT_PWFIELD password MYSQL_UID_FIELD 2000 用戶組ID號上頭建立的用戶 MYSQL_GID_FIELD 2000 MYSQL_LOGIN_FIELD username MYSQL_HOME_FIELD concat('var/mailbox/',homedir) 鏈接目錄 MYSQL_NAME_FIELD name MYSQL_MAILDIR_FIELD concat('/var/mailbox/',maildir) MYSQL_SOCKET /usr/local/mysql/mysql.sock 此處必定要注意指定本身的mysql.sock文件 配置完成以後記得啓動用服務並將authlib加入開機啓動項 service courier-authlib restart chkconfig courier-authlib on 建立authlib指定的目錄,上面指什麼這裏建立什麼目錄 mkdir -pv /var/mailbox chown -R postfix /var/mailbox/ 指定sasl2認證方式 vim /usr/lib64/sasl2/smtpd.conf pwcheck_method: authdaemond mech_list: PLAIN LOGIN authdaemond_path:/var/spool/authdaemon/socket 這裏修改成:sasl所支持的認證方式 vim /etc/postfix/main.cf inet_interfaces = all 監聽地址必定要改成all本地也行 ############################CYRUS-SASL############################ broken_sasl_auth_clients = yes smtpd_recipient_restrictions=permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous smtpd_sasl_application_name = smtpd smtpd_banner = Welcome to our $myhostname ESMTP,Warning: Version not Available! ########################Virtual Mailbox Settings######################## 這裏是extmil配置 virtual_mailbox_base = /var/mailbox virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf virtual_alias_domains = virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf virtual_uid_maps = static:2000 virtual_gid_maps = static:2000 virtual_transport = virtual ##########################QUOTA Settings######################## 配額可取消 message_size_limit = 14336000 virtual_mailbox_limit = 20971520 這裏很關鍵、必定要注意雙引號以及自動建立模式,不然導入extmail.sql文件會出錯 vim /usr/local/mysql/my.cnf sql_mode="NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES" sql-mode="NO_AUTO_CREATE_USER" [root@xiong docs]# service mysqld restart 改完必定要重啓再導入extmail.sql 進入數據庫中導入個人是5.6.30版本 source /tmp/extman-1.1/docs/extmail.sql; 建立用戶並受權,mysql不熟這是百度的 GRANT ALL PRIVILEGES ON extmail.* TO extmail@localhost IDENTIFIED BY 'extmail'; GRANT ALL PRIVILEGES ON extmail.* TO extmail@127.0.0.1 IDENTIFIED BY 'extmail'; 將extman ,mysql_虛擬用戶複製到postfix目錄下、這文件都是main.cf定義的不要少複製、不然也會報錯 [root@xiong docs]# cp /tmp/extman-1.1/docs/mysql_virtual_* /etc/postfix/ vim /etc/dovecot/conf.d/auth-sql.conf.ext 行前加入該行 mail_location = maildir:/var/mailbox/%d/%n/Maildir vim /etc/dovecot/dovecot-sql.conf.ext 該文件需跟auth-sql.conf中定義一致 driver = mysql host注意必定s改爲mysql.sock指定的不要直接複製不然會有錯誤 connect = host=/usr/local/mysql/mysql.sock dbname=extmail user=extmail password=extmail default_pass_scheme = CRYPT password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = '%u' user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = '%u' 安裝extmail tar zxvf extmail-1.2.tar.gz mkdir -pv /var/www/extsuite mv extmail-1.2 /var/www/extsuite/extmail cp /var/www/extsuite/extmail/webmail.cf.default /var/www/extsuite/extmail/webmail.cf vim /var/www/extsuite/extmail/webmail.cf SYS_USER_LANG = en_US 語言選項,可改做: SYS_USER_LANG = zh_CN SYS_MAILDIR_BASE = /home/domains 此處即爲您在前文所設置的用戶郵件的存放目錄,可改做: SYS_MAILDIR_BASE = /var/mailbox SYS_MYSQL_USER = db_user SYS_MYSQL_PASS = db_pass 以上兩句句用來設置鏈接數據庫服務器所使用用戶名、密碼和郵件服務器用到的數據庫,這裏修改成: SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail vim /etc/httpd/conf/httpd.conf User postfix Group postfix
ServerAdmin adminmail.xiong.com DocumentRoot /var/www/extsuite/extmail/html ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi Alias /extmail /var/www/extsuite/extmail/html/
extmail將會用到perl的Unix::syslogd功能,您能夠去http://search.cpan.org搜索下載原碼包進行安裝。 tar zxvf Unix-Syslog-0.100.tar.gz cd Unix-Syslog-0.100 perl Makefile.PL make make install 啓動apache服務 service httpd restart 安裝extman 下載路徑www.extmail.org tar zxvf extman-1.1.tar.gz [root@xiong tmp]# mv extman-1.1 /var/www/extsuite/extman cd /var/www/extsuite/extman [root@xiong extman]# cp webman.cf.default webman.cf vim webman.cf SYS_MAILDIR_BASE = /home/domains 此處即爲您在前文所設置的用戶郵件的存放目錄,可改做: SYS_MAILDIR_BASE = /var/mailbox SYS_DEFAULT_UID = 1000 SYS_DEFAULT_GID = 1000 此兩處後面設定的ID號需更改成前而建立的postfix用戶和postfix組的id號,本文使用的是2525,所以,上述兩項須要修改成: SYS_DEFAULT_UID = 2525 SYS_DEFAULT_GID = 2525 SYS_MYSQL_USER = webman SYS_MYSQL_PASS = webman 修改成: SYS_MYSQL_USER = extmail SYS_MYSQL_PASS = extmail SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock 修改成:SYS_MYSQL_SOCKET = /tmp/mysql.sock [root@xiong extman]# vim /etc/httpd/conf/httpd.conf 添加到虛擬網站中 ScriptAlias /extman/cgi /var/www/extsuite/extman/cgi Alias /extman /var/www/extsuite/extman/html 建立其運行時所需的臨時目錄,並修改其相應的權限: #mkdir -pv /tmp/extman #chown postfix.postfix /tmp/extman vim /var/www/extsuite/extman/webman.cf 不啓用驗證碼 SYS_CAPTCHA_ON = 1 爲 SYS_CAPTCHA_ON = 0 最後圖形日誌沒有開啓,還得修改,這樣就能夠直接使用