postfix+dovecot+squrrelmail郵件服務器的搭建

 提前搭好php環境

軟件環境:
   
源碼包:
        postfix-2.4.6.tar.gz
        squirrelmail-1.4.13.tar.bz2

      all_locales-1.5.1-20060219.tar.bz2

    RHEL4/5自帶rpm包:——
        cyrus-sasl-2.1.22-4
        httpd-2.2.3-6.el5
        php-5.1.6-5.el5

一、配置主機名、IP地址、默認網關、DNS地址等

 

1、配置主機名
vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mail.benet.com
vi /etc/hosts    #//
添加主機名到IP地址的映射

重啓一下網卡

    2、配置IP地址、默認網關、DNS地址等(略)


二、安裝配置Postfix

 

    1、解壓安裝
shell> groupadd -g 10000 postdrop
shell> useradd  -u 1000 -s /sbin/nologin postfix
shell> tar zxvf postfix-2.4.6.tar.gz
shell> make(
提示你安裝db4-devel)
shell> make install    #//
對安裝過程中的提示信息,可以直接回車接受默認值即可。(不用修改,直接回車就行了)

2、建立main.cf主配置文件
shell> cd /etc/postfix/
shell> postconf -n > main.cf(
如果main.cf文件有的話,就不用做這一步了)
shell> vi /etc/postfix/main.cf
myhostname = mail.456.com
(與郵箱有關)
mydomain = example.com
myorigin = $mydomain  
僞裝

inet_interfaces = all
mydestination = $myhostname, $mydomain, localhost
mynetworks = 127.0.0.0/8 10.100.100.0/8
home_mailbox = Maildir/    #//
郵件存儲使用Maildir方式
message_size_limit = 31457280    #//
限制郵件大小30MB
mailbox_size_limit = 524288000    #//
限制郵箱空間500MB

 

    3、啓動postfix
postfix start


三、爲postfix提供SMTP認證支持

 

    1、配置saslauthd服務(cyrus-sasl
shell> vi /usr/lib/sasl2/smtpd.conf 
該文件默認不存在
pwcheck_method:saslauthd

shell> vi /etc/sysconfig/saslauthd
SOCKETDIR=/var/run/saslauthd   
確認這三行
MECH=shadow
FLAGS=

shell> service saslauthd start

 

    2、修改postfix配置文件
shell> vi /etc/postfix/main.cf    #//
添加相關認證選項
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_invalid_hostname, reject_unauth_pipelining, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_banner = $myhostname ESMTP "Require SMTP Auth."

 

    3、重新加載服務
shell> postfix reload


四、安裝配置Dovecot(提供POP3IMAP服務)(對源碼包不熟悉的,就安裝rpm包)

 也可安裝rpm(先裝mysql)

    1、解壓安裝
shell> useradd -s /sbin/nologin dovecot
shell> tar zxvf dovecot-1.1.4.tar.gz
shell> cd dovecot-1.1.4
shell> ./configure --sysconfdir=/etc
shell> make
shell> make install

 

    2、調整dovecot.conf配置文件
shell> cp /etc/dovecot-example.conf /etc/dovecot.conf
shell> vi /etc/dovecot.conf
disable_plaintext_auth = no    #//
允許使用明文密碼登錄
ssl_disable = yes
protocols = pop3 imap

    3、啓動dovecot
shell> dovecot -c /etc/dovecot.conf
service dovecot start

裝到這裏需要用用oe等測試工具試一下收發郵件.

特別提示:postfix需要/etc/aliases.db的支持,用newaliases來生成
五、安裝配置Squirrelmail(提供使用郵件系統的Web界面,需要用到SMTPIMAP

    1、解壓安裝
shell> tar jxvf squirrelmail-1.4.13.tar.bz2 -C /var/www/html/
/var/www/html/squirrelmail-1.4.13/
shell> cd /var/www/html/
shell> mv squirrelmail-1.4.13 squirrelmail

shell> cd /var/www/html/squirrelmail
shell> mkdir -p attach 
放附件
shell> chown -R apache:apache attach/ data/    #//
假設httpd的運行用戶和組身份爲"apache"
shell> chmod 730 attach/

 linux支持中文:

下載了語言包all_locales-1.4.9-20070106.tar.bz2

tar  xjvf all_locales-1.4.9-20070106.tar.bz2

進入解壓目錄  cp   *     /var/www/html/squirrelmail/locale/

cd /var/www/html/webmail/config  ./conf.pl
選擇10 設置語言爲zh_CN
默認字符集爲gb2312
保存退出,重新刷新webmail頁面,就成中文了

    2、調整config.php配置
     
需要運行/var/www/html/squirrelmail/config/config.pl,然後根據提示進行設置,依次來生成config.php

 

    3、配置啓動httpd服務
   
配置網頁目錄使用“DocumentRoot "/var/www/html/squirrelmail"”…… ——過程略。
    ——
用戶訪問時使用 http://mail.example.com 的地址
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章