日韩黑丝制服一区视频播放|日韩欧美人妻丝袜视频在线观看|九九影院一级蜜桃|亚洲中文在线导航|青草草视频在线观看|婷婷五月色伊人网站|日本一区二区在线|国产AV一二三四区毛片|正在播放久草视频|亚洲色图精品一区

分享

CentOS5.3+Nginx0.7.57+Postfix+Extmail郵件系統(tǒng)安裝 -...

 楊民華 2010-02-14

說明:關(guān)于郵件配置這幾篇文章,主要參考的是作者sery博客,里邊還有一些作者的內(nèi)容.本篇配置,大部分軟件版本與原作者的都不相同.同時(shí),里邊更新了一些新的內(nèi)容,如WEBServer 采用nginx,系統(tǒng)版本采用CentOS5.3.這幾篇命名為原創(chuàng)不是作者的本意,為了避免誤解,現(xiàn)更改為轉(zhuǎn)載.但,整篇配置確是作者一步步配置.在原作者的配置上也發(fā)現(xiàn)了一些新的問題.本人會(huì)繼續(xù)開源軟件的研究和實(shí)踐.
 
系統(tǒng)平臺(tái):CentOS5.3
1. nginx……………………………………………web server
2. Mysql…………………………………………… 用數(shù)據(jù)庫存儲(chǔ)用戶信息
3. Php………………………………………………php(fastcgi)
4. Authlib………………………………………… 與sasl一起做驗(yàn)證
5. Sasl ……………………………………………驗(yàn)證方法
6. Postfix ……………………………………… smtp郵件發(fā)送服務(wù)主程序
7. Courier-imap…………………………………pop3 郵件接收主程序
8. Pcre ……………………………………………安裝Imap需要perl正則表達(dá)式
9. Maildrop…………………………………………郵件投遞代理,郵件轉(zhuǎn)發(fā)到用戶郵箱
10. clamav……………………………………………殺毒軟件
11. amavisd-new………………………………………郵件病毒掃描
12. Mail-SpamAssassin………………………………防垃圾郵件
 
CentOS5.3系統(tǒng)安裝包,一定要選的6個(gè)包。
1、system tools
2、administration tools
3、development tools
4、development libraries
5、network servers (5.1為network services)
6. base            (5.1沒有單獨(dú)列出)
相關(guān)軟件下載地址:
 
      http://prdownloads./courier/courier-authlib-0.62.2.tar.bz2
      http://asg3.andrew./pub/cyrus-mail/cyrus-sasl-2.1.22.tar.gz
      http://jaist.dl./sourceforge/pcre/pcre-7.8.tar.gz
      http://www./source/official/postfix-2.5.6.tar.gz
      http://nchc.dl./sourceforge/courier/courier-imap-4.4.1.tar.bz2
      http://switch.dl./sourceforge/courier/maildrop-2.0.4.tar.bz2
      http:///release/fontconfig-2.6.0.tar.gz
      ftp://ftp.openpkg.org/sources/DST/xpm/xpm-3.4k.tar.gz
 
以下是具體安裝步驟:
一.PHP(FastCGI)環(huán)境
 
一.PHP(FastCGI)環(huán)境
  1.MySQL安裝
 @版本:mysql-5.0.41.tar.gz
  安裝過程:
 ……………………………安裝開始………………………………………………
# groupadd mysql
# useradd -g mysql mysql
#./configure --prefix=/usr/local/mysql --with-extra-charsets=gb2312,gbk
 --with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock
 --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static
 --sysconfdir=/etc --enable-assembler
# make && make install
# scripts/mysql_install_db --user=mysql    //數(shù)據(jù)庫安裝
# bin/mysqld_safe --user=mysql &  //起動(dòng)mysqld
…………………………安裝結(jié)束……………………………………………
echo "/usr/local/mysql/lib/mysql">> /etc/ld.so.conf //postfix編譯里會(huì)用到
基本操作:
1.    起動(dòng)/關(guān)閉MySQL
/usr/local/mysql/bin/mysqld_safe &
/usr/local/mysql/bin/mysqladmin -u root –p shutdown
2.    設(shè)置密碼
mysqladmin -u root password 'new-password'    
3. 添加 /usr/local/webserver/mysql5/bin 到環(huán)境變量
  vi /etc/profile
      export PATH=$PATH:/usr/local/mysql/bin
2. GD相關(guān)安裝
     1. @版本libpng-1.2.29.tar.gz
###################################################
shell> tar zxvf libpng-1.2.29.tar.gz
shell> cd libpng-1.2.29
shell> ./configure
shell> make
shell> make install
################################################### 
 2.版本jpegsrc.v6b.tar.gz
#############################################################
shell> tar zxvf jpegsrc.v6b.tar.gz
shell> cd jpeg-6b

Shell> mkdir –p /usr/local/jpeg/bin
Shell> mkdir /usr/local/jpeg/lib
Shell> mkdir /usr/local/jpeg/include
Shell> mkdir /usr/local/jpeg/man
Shell> mkdir /usr/local/jpeg/man1
Shell> mkdir /usr/local/jpeg/man/man1

Shell> ./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
Shell> make && make install  
 #################################################
   
3. @版本freetype-2.3.7.tar.gz
#############################################
shell> tar zxvf freetype-2.3.7.tar.gz
shell> cd freetype-2.3.7
shell> ./configure   //不指定目錄,方便以下RRDTool安裝
shell> make && make install
##############################################
4.@版本 fontconfig-2.6.0.tar.gz
  #################################################
Shell> tar zxvf fontconfig-2.6.0.tar.gz && cd font*
Shell> ./configure --prefix=/usr/local/fontconfig --with-freetype-config=/usr/local/bin/freetype-config
Shell> make && make install
 ##################################################
5. @版本 gd-2.0.35.tar.gz
GD庫安裝以前先把以上幾個(gè)安裝上,這個(gè)安裝是有一定順序的。
###############################################
Shell> tar zxvf gd-2.0.35.tar.gz
Shell> cd gd-2.0.35
Shell> ./configure --prefix=/usr/local/gd
 --with-png
--with-jpeg=/usr/local/jpeg
 --with-freetype
--with-fontconfig=/usr/local/fontconfig
Shell> make && make install
###############################################
** Configuration summary for gd 2.0.34:
 
  Support for PNG library:         yes
  Support for JPEG library:        yes
  Support for Freetype 2.x library:   yes
  Support for Fontconfig library:    yes
  Support for Xpm library:         no
  Support for pthreads:            yes
faq:
1> cd . && /bin/sh /usr/local/src/gd-2.0.35/config/missing --run aclocal-1.9 -I config
aclocal:configure.ac:64: warning: macro `AM_ICONV' not found in library
 cd . && /bin/sh /usr/local/src/gd-2.0.35/config/missing --run automake-1.9 --foreign
cd . && /bin/sh /usr/local/src/gd-2.0.35/config/missing --run autoconf
configure.ac:64: error: possibly undefined macro: AM_ICONV
     If this token and others are legitimate, please use m4_pattern_allow.
     See the Autoconf documentation.
make: *** [configure] Error 1
解決:
重新make 一下,如果不行,可以安裝下邊的包
安裝gettext包
安裝方式: shell> yum install gettext 或通過手動(dòng)下載gettext包
3.PHP(FastCGI)模式安裝
 @php版本:5.2.6
 #gzip -cd php-5.2.9-fpm-0.5.10.diff.gz | patch -d php- 5.2.9 -p1
步驟:
 ###########################################################
#./configure --prefix=/usr/local/phpcgi --with-config-file-path=/usr/local/phpcgi/etc --with-mysql=/usr/local/mysql --with-gd=/usr/local/gd --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/local/lib --enable-mbstring --enable-mbregex --enable-bcmath --enable-sockets --with-xsl --with-curl --with-curlwrappers --enable-fastcgi --enable-force-cgi-redirect --enable-discard-path --with-openssl --enable-fpm
# make && make install
#cp php.ini-recommended /usr/local/phpcgi/etc/php.ini
######################################################
# /usr/local/phpcgi/etc/php-fpm.conf
<?xml version="1.0" ?> 
<configuration> 
 
 <section name="global_options"> 
 
   <value name="pid_file">/usr/local/phpcgi/logs/php-fpm.pid</value> 
 
   <value name="error_log">/usr/local/phpcgi/logs/php-fpm.log</value> 
 
   <value name="log_level">notice</value> 
 
   <value name="emergency_restart_threshold">10</value> 
 
   <value name="emergency_restart_interval">1m</value> 
 
   <value name="process_control_timeout">5s</value> 
 
   <value name="daemonize">yes</value> 
 
 </section> 
 
 <workers> 
 
   <section name="pool"> 
 
     <value name="name">default</value> 
 
     <value name="listen_address">127.0.0.1:9000</value> 
 
     <value name="listen_options"> 
 
       <value name="backlog">-1</value> 
 
       <value name="owner"></value> 
       <value name="group"></value> 
       <value name="mode">0666</value> 
     </value> 
 
     <value name="php_defines"> 
       <value name="sendmail_path">/usr/sbin/sendmail -t -i</value> 
       <value name="display_errors">1</value> 
     </value> 
 
       <value name="user">vmail</value> 
 
       <value name="group">vmail</value> 
 
     <value name="pm"> 
 
       <value name="style">static</value> 
 
       <value name="max_children">25</value> 
 
       <value name="apache_like"> 
 
         <value name="StartServers">10</value> 
 
         <value name="MinSpareServers">5</value> 
 
         <value name="MaxSpareServers">25</value> 
 
       </value> 
 
     </value> 
 
     <value name="request_terminate_timeout">0s</value> 
 
     <value name="request_slowlog_timeout">0s</value> 
 
     <value name="slowlog">logs/slow.log</value> 
 
     <value name="rlimit_files">51200</value> 
 
     <value name="rlimit_core">0</value> 
 
     <value name="chroot"></value> 
 
     <value name="chdir"></value> 
 
     <value name="catch_workers_output">yes</value> 
 
     <value name="max_requests">500</value> 
 
     <value name="allowed_clients">127.0.0.1</value> 
 
     <value name="environment"> 
       <value name="HOSTNAME">$HOSTNAME</value> 
       <value name="PATH">/usr/local/bin:/usr/bin:/bin</value> 
       <value name="TMP">/tmp</value> 
       <value name="TMPDIR">/tmp</value> 
       <value name="TEMP">/tmp</value> 
       <value name="OSTYPE">$OSTYPE</value> 
       <value name="MACHTYPE">$MACHTYPE</value> 
       <value name="MALLOC_CHECK_">2</value> 
     </value> 
 
   </section> 
 
 </workers> 
 
</configuration>

起動(dòng)php-cgi進(jìn)程:
/usr/local/phpcgi/sbin/php-fpm start
4.NGINX安裝
 @nginx版本:0.7.57
步驟:
####################################################
# ./configure --user=vmail --group=vmail --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module
# make && make install
###################################################
# more /usr/local/nginx/conf/fcgi.conf
#fastcgi.conf
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE   nginx;
fastcgi_param QUERY_STRING      $query_string;
fastcgi_param REQUEST_METHOD    $request_method;
fastcgi_param CONTENT_TYPE      $content_type;
fastcgi_param CONTENT_LENGTH    $content_length;
fastcgi_param SCRIPT_NAME       $fastcgi_script_name;
fastcgi_param REQUEST_URI       $request_uri;
fastcgi_param DOCUMENT_ROOT     $document_root;
fastcgi_param SERVER_PROTOCOL   $server_protocol;
fastcgi_param REMOTE_ADDR       $remote_addr;
fastcgi_param REMOTE_PORT       $remote_port;
fastcgi_param SERVER_ADDR       $server_addr;
fastcgi_param SERVER_PORT       $server_port;
fastcgi_param SERVER_NAME       $server_name;

二.郵件發(fā)送接收相關(guān)包的安裝
 
再繼續(xù)安裝前先清理一下系統(tǒng)自帶的一些軟件
Sendmail相關(guān)包rpm –q sendmail
sendmail-8.13.8-2.el5
----------------------------------------------
清除:
rpm -e sendmail --nodeps
Sasl 相關(guān)包列出 rpm -qa|grep sasl
cyrus-sasl-2.1.22-4
cyrus-sasl-devel-2.1.22-4
cyrus-sasl-plain-2.1.22-4
cyrus-sasl-lib-2.1.22-4
---------------------------------------------
清除:
rpm -e --nodeps cyrus-sasl cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl-lib

如果出現(xiàn)

error: "cyrus-sasl-lib" specifies multiple packages

rpm -e --nodeps --allmatches cyrus-sasl cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl-lib
然后是創(chuàng)建以下用戶及組
用戶名 組名 作用 備注
mysql mysql 數(shù)據(jù)庫mysql運(yùn)行用戶 以上已創(chuàng)建
vmail vmail nginx 服務(wù)運(yùn)行用戶 以上已創(chuàng)建
vmail vmail Postfix虛擬郵件賬號(hào)所使用的用戶及組 uid,gid:1001,1001
postfix Postfix Postfix主程序使用的賬號(hào)和組 Uid,gid:1000,1000
 Postdrop Postfix setgid_group setgid_group=postdrop
1002
amavis amavis 郵件掃描  
clamav Clamav 病毒掃描  

 

ln -s /usr/src/kernels/2.6.18-128.el5-i686 /usr/src/linux   //避免以下安裝編譯出現(xiàn)問題
一.安裝courier-authlib
安裝過程:
      ……………………………安裝開始………………………………………………
      Shell> tar jxvf courier-authlib-0.62.2.tar.bz2
      Shell> cd courier-authlib-0.62.2
      Shell>./configure
--with-mailuser=vmail --with-mailgroup=vmail
 --with-mysql-libs=/usr/local/mysql/lib/mysql
 --with-mysql-includes=/usr/local/mysql/include/mysql
 --prefix=/usr/local/authlib
 --without-stdheaderdir
      Shell> make && make install
      Shell> make install-configure
…………………………安裝結(jié)束……………………………………………

---------------------------------------------------------
一般情況下,anthlib的安裝應(yīng)該是容易完成的。
     配置:
配置authlib.在目錄/usr/local/authlib/etc/authlib中,修改文件authdaemonrc及authmysqlrc。
vim /usr/local/authlib/etc/authlib/authdaemonrc
vi /usr/local/authlib/etc/authlib/authdaemonrc
authmodulelist="authmysql"
authmodulelistorig="authmysql"
DEBUG_LOGIN=2
 
修改上面3項(xiàng),其他的項(xiàng)保持不變。這個(gè)修改前2行表示用mysql認(rèn)證模塊;把DEBUG_LOGIN的值有默認(rèn)的“0”改成“2”的用意是運(yùn)行postfix時(shí)有更多的信息輸出,通過生成的日志以幫助排錯(cuò)。
vi /usr/local/authlib/etc/authlib/authmysqlrc
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_DATABASE extmail
MYSQL_SOCKET /usr/local/mysql/tmp/mysql.sock
MYSQL_PORT             3306
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password //這里需要注意
#MYSQL_CLEAR_PWFIELD password
DEFAULT_DOMAIN mail.
MYSQL_UID_FIELD ‘1001’
MYSQL_GID_FIELD ‘1001’
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD '/var/mailbox/'
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD maildir
MYSQL_QUOTA_FIELD concat(quota,'S')
MYSQL_WHERE_CLAUSE active='1'
特別注意MYSQL_UID_FIELD和MYSQL_GID_FIELD字段的值,這里是‘1001’,也可以是其它的,但一定要與vmail用戶及組相一致(id vmail可以得出這2者的值)

后續(xù)工作還有,所以現(xiàn)在還不能測(cè)試。
-------------------------------------------------------
二.安裝SASL
cyrus-sasl-2.1.22.tar.gz
      安裝過程:
      ……………………………安裝開始………………………………………………
Shell> tar zxvf cyrus-sasl-2.1.22.tar.gz
Shell> cd cyrus-sasl-2.1.22
Shell> ./configure --disable-anon
 --disable-gssapi          //授權(quán)
 --disable-sample
 --disable-digest          //授權(quán)
 --enable-plain
 --enable-login
 --enable-sql
 --with-mysql=/usr/local/mysql
 --with-mysql-includes=/usr/local/mysql/include/mysql
 --with-mysql-libs=/usr/local/mysql/lib/mysql
--with-authdaemond=/usr/local/authlib/var/spool/authdaemon/socket
Shell> make
Shell> make install
…………………………安裝結(jié)束……………………………………………
配置:
ln -s /usr/local/lib/sasl2 /usr/lib/sasl2 //sasl的安裝目錄是/usr/local/lib/sasl //安裝結(jié)束后有Warning警告
echo “/usr/local/lib” >> ld.so.conf    //否則postfix 編譯里會(huì)找不到libsasl2.so.2
   創(chuàng)建文件 /usr/local/lib/sasl2/smtpd.conf,并加入如下內(nèi)容:
pwcheck_method: authdaemond
mech_list: PLAIN LOGIN
log_level: 3
authdaemond_path: /usr/local/authlib/var/spool/authdaemon/socket

   Sasl2需要使用文件/usr/local/authlib/var/spool/authdaemon/socket,但默認(rèn)情況下,其屬性是744,需要把它加上執(zhí)行權(quán)限,以便文件屬組(主)而外的其它用戶可以執(zhí)行。運(yùn)行命令
chmod +x /usr/local/authlib/var/spool/authdaemon即可,如果不這樣處理,smtp驗(yàn)證無一例外會(huì)失敗的。創(chuàng)建運(yùn)行時(shí)需要的目錄并調(diào)試啟動(dòng)
# mkdir -pv /var/state/saslauthd
# /usr/local/sbin/saslauthd -v //看看版本是不是2.1.22 
saslauthd 2.1.22
authentication mechanisms: getpwent pam rimap shadow 
# /usr/local/sbin/saslauthd -a shadow pam -d //正常不會(huì)報(bào)錯(cuò)
   啟動(dòng)并測(cè)試
# /usr/local/sbin/saslauthd -a shadow pam
# /usr/local/sbin/testsaslauthd -u root -p password //正常顯示0: OK "Success"成功
      (Password改成機(jī)器登錄賬號(hào)root 的密碼,這里不是賬號(hào)不是指的MySQL賬號(hào)密碼。否則會(huì)提示:
   0: NO "authentication failed",同時(shí),注意這里測(cè)試不用開啟authdaemond(authlib)
 
      加入開機(jī)自啟動(dòng)
Echo “/usr/local/sbin/saslauthd -a shadow pam” >>/etc/rc.local
 
三.安裝postfix
Make參數(shù)參考:安裝源文件READ_FILES目錄
   # more README_FILES/MYSQL_README
   安裝過程:
      ……………………………安裝開始………………………………………………
      Shell> tar zxvf postfix-2.5.6.tar.gz
      Shell> cd postfix-2.5.6
Shell> make makefiles 'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include/mysql -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/include/sasl' 'AUXLIBS=-L/usr/local/mysql/lib/mysql -lmysqlclient -lz -lm -L/usr/local/lib -lsasl2'
@@注意:1. 如果沒有Makefile文件,需要設(shè)置成make -f Makefile.init
              2. /usr/local/mysql/include 如果此目錄下還有mysql目錄,應(yīng)改成/usr/local/mysql/include/mysql
               3. /usr/local/mysql/lib 如果此目錄下還有mysql目錄,應(yīng)改成/usr/local/mysql/lib/mysql
      如果沒有意外,make這一步很快就執(zhí)行完了,接下來就是安裝,使用的命令是
      Shell> make install
程序先自動(dòng)執(zhí)行一陣子,然后會(huì)進(jìn)入交互狀態(tài),等待用戶的輸入,一般情況下,一路回車即可完成所有的安裝。

 
最后:
生成別名二進(jìn)制文件,這個(gè)步驟如果忽略,會(huì)造成postfix效率極低:
shell> /usr/bin/newaliases
…………………………安裝結(jié)束……………………………………………
檢驗(yàn)postfix是否支持sasl認(rèn)證,如果輸出為以下結(jié)果,則支持:
shell> /usr/sbin/postconf -a     //postfix 安裝沒有指定目錄
cyrus
dovecot
      shell> /usr/sbin/postconf -m |grep mysql
      mysql         //沒有的話需重新編譯postfix
四.安裝imap
  Postfix只是實(shí)現(xiàn)郵件系統(tǒng)的smtp功能,pop3或imap則需要另外的軟件來實(shí)現(xiàn),這個(gè)軟件就是courier-imap(當(dāng)然也有別的軟件可以選擇)。
……………………………安裝開始………………………………………………
Shell> tar jxvf courier-imap-4.4.1.tar.bz2
Shell> cd courier-imap-4.4.1
Shell>./configure
--prefix=/usr/local/imap
--with-redhat
--disable-root-check
--enable-unicode=utf-8,iso-8859-1,gb2312,gbk,gb18030
--with-trashquota
--with-dirsync 
--with-mysql-libs=/usr/local/mysql/lib/mysql --with-mysql-includes=/usr/local/mysql/include/mysql
--with-authmysql
--with-authmysql=yes
 CPPFLAGS='-I/usr/local/authlib/include' LDFLAGS='-L/usr/local/authlib/lib/courier-authlib'
COURIERAUTHCONFIG='/usr/local/authlib/bin/courierauthconfig' 
 
[以上時(shí)間長(zhǎng)一些]
 
Shell> make
Shell> make install
Shell> make install-configure
 
……………………………安裝結(jié)束………………………………………………
 
配置:
……………………………配置開始………………………………………………
修改配置文件/usr/local/imap/etc/pop3d及/usr/local/imap/etc/imapd。把/usr/local/imap
/etc/pop3d 文件的行“POP3DSTART=NO”改成“POP3DSTART=YES”,再依照這個(gè)形式把文件/usr/local/imap/etc/imapd的行“IMAPDSTART=NO”改成“IMAPDSTART=YES”即可。
 
加入開機(jī)啟動(dòng):
cp courier-imap.sysvinit /etc/rc.d/init.d/imapd    // courier-imap.sysvinit在安裝源文件中
chmod +x /etc/rc.d/init.d/imapd
chkconfig --add imapd
[chkconfig --level 2345 imapd on]
Service imapd start //輸出Starting Courier-IMAP server: imap pop3
 
檢測(cè):
netstat -tnl|egrep "110|143"
 五.安裝pcre
      安裝前先卸載系統(tǒng)自帶的pcre-6.6-1.1
Rpm –e pcre
自帶的pcre RPM包可能與一些有沖突,可以先卸載掉
Shell> rpm –e pcre如果提示libpcre.so.0與別的軟件有依存關(guān)系??梢赃@樣
先備份一下libpcre.so.0這個(gè)文件,然后。
Shell> rpm -e pcre –nodeps
 
……………………………安裝開始………………………………………………
Shell> tar zxvf pcre-7.8.tar.gz
Shell> cd pcre-7.8
Shell> ./configure
 
Install prefix .................. : /usr/local
   C preprocessor .................. : gcc -E
   C compiler ...................... : gcc
   C++ preprocessor ................ : g++ -E
   C++ compiler .................... : g++
   Linker .......................... : /usr/bin/ld
   C preprocessor flags ............ :
   C compiler flags ................ : -O2
   C++ compiler flags .............. : -O2
   Linker flags .................... :
   Extra libraries ................. :
 
   Build C++ library ............... : yes
   Enable UTF-8 support ............ : no
   Unicode properties .............. : no
   Newline char/sequence ........... : lf
   \R matches only ANYCRLF ......... : no
   EBCDIC coding ................... : no
   Rebuild char tables ............. : no
   Use stack recursion ............. : yes
   POSIX mem threshold ............. : 10
   Internal link size .............. : 2
   Match limit ..................... : 10000000
   Match limit recursion ........... : MATCH_LIMIT
   Build shared libs ............... : yes
   Build static libs ............... : yes
   Link pcregrep with libz ......... : no
   Link pcregrep with libbz2 ....... : no
   Link pcretest with libreadline .. : no
Shell> make
Shell> make install
……………………………安裝結(jié)束………………………………………………
六.安裝maildrop
      注意%源碼安裝的,將courierauthconfig 命令鏈接到/usr/bin里,假設(shè)裝在:
/usr/local/authlib/bin/courierauthconfig,則:
ln -s /usr/local/authlib/bin/courierauthconfig /usr/bin/courierauthconfig
這樣編譯出來的maildrop才會(huì)Courier Authentication Library extension enabled.
……………………………安裝開始………………………………………………
      Shell> tar jxvf maildrop-2.0.4.tar.bz2
      Shell> cd maildrop-2.0.4
      Shell>./configure  
--enable-sendmail=/usr/sbin/sendmail
--enable-trusted-users='root vmail'
--enable-syslog=1
--enable-maildirquota
--enable-maildrop-uid=1001
--enable-maildrop-gid=1001
--with-trashquota
--with-dirsync
Shell> make
Shell> make install
Shell> cp /usr/local/bin/maildrop /usr/bin  //可有可無
……………………………安裝結(jié)束………………………………………………
 
驗(yàn)證安裝是否成功:
Shell> maildrop –v
[root@localhost postfix]# /usr/local/bin/maildrop -v
maildrop 2.0.4 Copyright 1998-2005 Double Precision, Inc.
GDBM 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.
      FAQ:
  如果沒有顯示Courier Authentication Library extension enabled.說明你的maidrop還不支持courier auth,請(qǐng)仔細(xì)檢查,重新編譯maildrop建議不要自定義目錄安裝,可以減少不必要的麻煩,刪除很方便:直接在已經(jīng)編譯的源代碼目錄 make uninstall 就行
知道m(xù)aildrop把郵件移動(dòng)到哪個(gè)用戶目錄還是非常有必要的,這個(gè)操作就是maildrop的日志記錄。這里我們創(chuàng)建一個(gè)新文件/etc/maildroprc,這個(gè)文件就2行內(nèi)容:如果加入反SPAM,需要更改以下內(nèi)容
[root@mail mailbox]# more /etc/maildroprc
logfile "/var/log/maildrop.log" 
to "$HOME/$DEFAULT"

Shell> touch /var/log/maildrop.log
Shell> chown vmail.vmail /var/log/maildrop.log
shell> chown vmail.vmail /var/mailbox

三.Webmail相關(guān)包安裝
一.安裝webmail
      安裝前先安裝Unix-Syslog-1.1.tar.gz
http://search./CPAN/authors/id/M/MH/MHARNISCH/Unix-Syslog-1.1.tar.gz
 
Tar zxvf Unix-Syslog-1.1.tar.gz
cd Unix-Syslog-1.1
perl Makefile.PL
make
make install
安裝:DBI-1.605.tar.gz(先安裝)
DBD-mysql-4.010.tar.gz
 
      
安裝extmail
   ……………………………安裝開始………………………………………………
Shell> Mkdir -p /var/www/extsuite/extmail
      將下載的extmail-1.0.4.tar.gz解壓到 /var/www/extsuite/extmail下
      Shell> cd /var/www/extsuite/extmail/
Shell> cp webmail.cf.default webmail.cf
[Shell> chown –R vmail.vmail /var/www/extsuite/extmail]
[shell> chmod +x /var/www/extsuite/extmail/cgi]
……………………………安裝結(jié)束………………………………………………
 
簡(jiǎn)易配置
1.      修改nginx nginx.conf文件
#more /usr/local/nginx/conf/nginx.conf
user vmail vmail;
worker_processes 8;
#error_log /usr/local/nginx/logs/nginx_error.log crit;
error_log /usr/local/nginx/logs/nginx_error.log info;

pid       /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events
{
 use epoll;
 worker_connections 51200;
}
http
{
 include      mime.types;
 default_type application/octet-stream;
 #charset gb2312;
     
 server_names_hash_bucket_size 128;
 client_header_buffer_size 32k;
 large_client_header_buffers 4 32k;
 client_max_body_size 8m;
     
 sendfile on;
 tcp_nopush    on;
 keepalive_timeout 60;
 tcp_nodelay on;
 fastcgi_connect_timeout 300;
 fastcgi_send_timeout 300;
 fastcgi_read_timeout 300;
 fastcgi_buffer_size 64k;
 fastcgi_buffers 4 64k;
 fastcgi_busy_buffers_size 128k;
 fastcgi_temp_file_write_size 128k;
 gzip on;
 gzip_min_length 1k;
 gzip_buffers    4 16k;
 gzip_http_version 1.0;
 gzip_comp_level 2;
 gzip_types      text/plain application/x-javascript text/css application/xml;
 gzip_vary on;
 #limit_zone crawler $binary_remote_addr 10m;
 server
 {
   listen      80;
   server_name mail.;
   index index.html index.htm index.php index.cgi;
   root /var/www/extsuite/extmail/html/;
   
     
   location /extmail/cgi/ {
       fastcgi_pass 127.0.0.1:12009;
       fastcgi_index        index.cgi;
       fastcgi_param SCRIPT_FILENAME  /var/www/extsuite/extmail/cgi/$fastcgi_script_name;
       include fcgi.conf;
  }
   location  ^~ /extmail/ {
       alias /var/www/extsuite/extmail/html/;
  }
   location /extman/cgi/ {
       fastcgi_pass 127.0.0.1:12009;
       fastcgi_index        index.cgi;
       fastcgi_param SCRIPT_FILENAME  /var/www/extsuite/extman/cgi/$fastcgi_script_name;
       include fcgi.conf;
  }
   location ^~ /extman/ {
       alias /var/www/extsuite/extman/html/;
   }
  
  
   location ^~ /status {
      stub_status on;
      access_log  off;
      #allow 192.168.0.0/24;
      #deny all;
      allow 59.108.107.66;
   }
                     
  location ~ .*\.(php|php5)?$
       
     #fastcgi_pass unix:/tmp/php-cgi.sock;
     fastcgi_pass 127.0.0.1:12009;
     fastcgi_index index.cgi;
     include fcgi.conf;
   }
   
   location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
   {
     expires     30d;
   }
   location ~ .*\.(js|css)?$
   {
     expires     1h;
     
   log_format access '$remote_addr - $remote_user [$time_local] "$request" '
             '$status $body_bytes_sent "$http_referer" '
             '"$http_user_agent" $http_x_forwarded_for';
   access_log /usr/local/nginx/logs/access.log access;
     }
}
 
 2.extmail cgi腳本配置
  #MAXFORK=5
  MAXFORK=20
  #MAXREQS=100
  MAXREQS=500
  #TIMEOUT=120
  TIMEOUT=300
  PORT=12009 #端口號(hào)與nginx.conf文件保持一致,
  SU_UID=vmail
  SU_GID=vmail
 
  安裝extman
……………………………安裝開始………………………………………………
Shell> mv extman-0.2.3 /var/www/extsuite/extman
//Shell> chown -R vmail:vmail /var/www/extsuite/extman
創(chuàng)建extman運(yùn)行時(shí)所需要臨時(shí)目錄
Shell> mkdir -pv /tmp/extman
Shell> chown -R vmail.vmail /tmp/extman
初始化數(shù)據(jù)庫時(shí),請(qǐng)更改init.sql中extmail.org的名稱為自已域名
Shell> cd /var/www/extsuite/extman/docs/
//Shell> vi init.sql            
        將extmail.org 全部替換為mail.(自己根據(jù)自己的域名替換)
 
修改cgi目錄的屬主:
# chown -R vmail.vmail /var/www/extsuite/extman/cgi/
Shell> mysql -u root -p < ./extmail.sql    
Shell> mysql –u root –p < ./init.sql
 
Extmail 和 extman 詳細(xì)配置
1.      extmail 配置 vi webmail.cf
SYS_USER_LANG = en_US 改為SYS_USER_LANG = zh_CN
SYS_MAILDIR_BASE = /home/domains 右邊改為 /var/mailbox
SYS_MYSQL_USER = db_user 右邊改為extmail
SYS_MYSQL_PASS = db_pass   右邊改為extmail
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock 右邊改為/usr/local/mysql/tmp/mysql.sock
SYS_AUTHLIB_SOCKET = /usr/local/authlib/var/spool/authdaemon/socket
………………………
2.      extman 配置 vi webman.cf
SYS_MAILDIR_BASE = /home/domains 右邊改為/var/mailbox
SYS_DEFAULT_UID = 1001
SYS_DEFAULT_GID = 1001
SYS_MYSQL_SOCKET = /usr/local/mysql/tmp/mysql.sock
SYS_CAPTCHA_ON = 0         //關(guān)閉圖形驗(yàn)證碼
 
起動(dòng)NGINX和extmail cgi
/var/www/extsuite/extmail/dispatch-init start
/usr/local/nginx/sbin/nginx
 
測(cè)試:
輸入網(wǎng)址:http://mail./extmail/cgi/index.cgi
管理員賬號(hào)root@mail. extmail*123*      
 
      FAQ:
Can't open /tmp/extman//sid_e438c6f837880729ff491bd3f7ea3f01, No such file or directory
      解決:mkdir -pv /tmp/extman
      chown -R vmail.vmail /tmp/extman
      apache 運(yùn)行用戶及組為vmail
二.安裝webmail圖形化日志
      1. RRDTool安裝
下載:http://oss./rrdtool/pub/rrdtool-1.2.30.tar.gz
         http://ftp./pub/gnome/sources/libart_lgpl/2.3/libart_lgpl-2.3.20.tar.gz(先安裝)
步驟:
--------------------------------------------------------------------------------------------------
libart安裝(包括了libart庫文件,對(duì)平面圖形的良好性能很有幫助)
# tar zxvf libart_lgpl-2.3.20.tar.gz && cd libart*
# ./configure --prefix=/usr/local/libart
# make && make install
RRDTool安裝(Rrdtool 依賴libpng freetype libart庫支持,安裝這個(gè)前應(yīng)先保證這幾個(gè)庫已安裝上)
# tar zxvf rrdtool-1.2.30.tar.gz && cd rrd*
# more /doc/rrdbuild.txt (安裝說明)
# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/libart/lib/pkgconfig
# pkg-config --libs freetype2(檢測(cè)一下是否可以找到freetype2)
 -L/usr/local/lib -lfreetype -lz
# ./configure --prefix=/usr/local/rrdtool    //本機(jī)需要連網(wǎng)
##############################################################################
配置信息:
----------------------------------------------------------------
Config is DONE!
 
         With MMAP IO: yes
         Perl Modules: perl_piped perl_shared
          Perl Binary: /usr/bin/perl
         Perl Version: 5.8.8
         Perl Options: PREFIX=/usr/local/rrdtool LIB=/usr/local/rrdtool/lib/perl/5.8.8
         Ruby Modules:
          Ruby Binary: no
         Ruby Options: sitedir=$(DESTDIR)/usr/local/rrdtool/lib/ruby
   Build Tcl Bindings: no
 Build Python Bindings: yes
         Build rrdcgi: yes
      Build librrd MT: yes
 
 
Type 'make' to compile the software and use 'make install' to
install everything to: /usr/local/rrdtool.
 
      ... that wishlist is NO JOKE. If you find RRDtool useful
make me happy. Go tohttp://tobi./wishand
place an order.
 
                              -- Tobi Oetiker <tobi@>
---------------------------------------------------------------- ########################################################################
# make && make install
2.安裝File-Tail perl模塊
下載:http://search./CPAN/authors/id/M/MG/MGRABNAR/File-Tail-0.99.3.tar.gz
基本步驟:
# tar zxvf File-Tail-0.99.3.tar.gz && cd File*
# perl Makefile.PL
# make && make install
以下是安裝信息:
      cp Tail.pm blib/lib/File/Tail.pm
Manifying blib/man3/File::Tail.3pm
Installing /usr/lib/perl5/site_perl/5.8.8/File/Tail.pm
Installing /usr/share/man/man3/File::Tail.3pm
Writing /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/auto/File/Tail/.packlist
Appending installation info to /usr/lib/perl5/5.8.8/i386-linux-thread-multi/perllocal.pod
      3.啟動(dòng)圖形日志服務(wù)測(cè)試
Shell> cp -r /var/www/extsuite/extman/addon/mailgraph_ext /usr/local/

其它設(shè)置:(因?yàn)閞rdtool安裝在非標(biāo)準(zhǔn)目錄,所以其perl模塊找不到,拷備到標(biāo)準(zhǔn)目錄即可)
cp -r /usr/local/rrdtool/lib/perl/5.8.8/i386-linux-thread-multi/* /usr/lib/perl5/5.8.8/i386-linux-thread-multi/
 
             shell> /usr/local/mailgraph_ext/mailgraph-init start  
          shell> /usr/local/mailgraph_ext/qmonitor-init start
          加入到開機(jī)啟動(dòng):
          Shell> echo “/usr/local/mailgraph_ext/mailgraph-init start”>>/etc/rc.local
          Echo > echo “/usr/local/mailgraph_ext/qmonitor-init start”>>/etc/rc.local
          圖形日志測(cè)試
            測(cè)試頁:http://mail./extman/cgi/index.cgi
            默認(rèn)登錄賬號(hào):root@mail./extmail*123*
三.郵件系統(tǒng)配置測(cè)試補(bǔ)充
1.   postfix配置
#########################################################
# more master.cf
# sed -e '/^#/d' -e '/^$/d' master.cf
smtp     inet                          smtpd
pickup   fifo                60          pickup
cleanup  unix                          cleanup
qmgr     fifo                300         qmgr
tlsmgr   unix                1000?       tlsmgr
rewrite  unix                          trivial-rewrite
bounce   unix                          bounce
defer    unix                          bounce
trace    unix                          bounce
verify   unix                          verify
flush    unix                1000?       flush
proxymap unix                          proxymap
proxywrite unix -                          proxymap
smtp     unix                          smtp
relay    unix                          smtp
       -o smtp_fallback_relay=
showq    unix                          showq
error    unix                          error
retry    unix                          error
discard  unix                          discard
local    unix                          local
virtual  unix                          virtual
lmtp     unix                          lmtp
anvil    unix       

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多