1Postfix邮件服务器(一)主机名:mail.benet.comAMP平台:编译安装Apache、MySQL、PHP注意:AMP平台完成后最好执行reboot重启一下系统l准备DNS域名服务、添加MX邮件交换记录[root@mailServer]#rpm-ivhbind-9.3.6-4.P1.el5_4.2.i386.rpm[root@mailServer]#rpm-ivhbind-chroot-9.3.6-4.P1.el5_4.2.i386.rpm[root@mailServer]#rpm-ivhcaching-nameserver-9.3.6-4.P1.el5_4.2.i386.rpm建立named.conf主配置文件:[root@mailServer]#cd/var/named/chroot/etc/[root@mailetc]#vimnamed.confoptions{directory/var/named;forwarders{192.168.1.1;};//配置转发器,可以解析外网域名};zonebenet.comIN{typemaster;filebenet.com.zone;};zone1.168.192.in-addr.arpaIN{typemaster;file192.168.1.arpa;2};建立区域数据库文件:[root@mailetc]#cd/var/named/chroot/var/named/[root@mailnamed]#cplocaldomain.zonebenet.com.zone[root@mailnamed]#cpnamed.local192.168.1.arpa[root@mailnamed]#[root@mailnamed]#vimbenet.com.zone[root@mailnamed]#vim192.168.1.arpa修改文件的属主、属组:[root@mailnamed]#chownnamed.namedbenet.com.zone[root@mailnamed]#chownnamed.named192.168.1.arpa启动服务:[root@mailnamed]#servicenamedrestart停止named:[确定]启动named:[确定][root@mailnamed]#chkconfignamedon$TTL86400@INSOAbenet.com.admin.benet.com.(1997022700;Serial28800;Refresh14400;Retry3600000;Expire86400);MinimumINNSns1.benet.com.33INPTRns1.benet.com.33INPTRmail.benet.com.$TTL86400@INSOAbenet.com.admin.benet.com.(42;serial(d.adams)3H;refresh15M;retry1W;expiry1D);minimumINNSns1.benet.com.INMX10mail.benet.com.ns1INA192.168.1.33mailINA192.168.1.333客户机上测试DNS服务:l编译安装Postfix关闭sendmail服务:[root@mail~]#servicesendmailstop关闭sm-client:[确定]关闭sendmail:[确定][root@mail~]#chkconfigsendmailoff创建用户:[root@mail~]#groupadd-g1200postdrop[root@mail~]#groupadd-g1000postfix[root@mail~]#useradd-M-u1000-gpostfix-Gpostdrop-s/sbin/nologinpostfix[root@mail~]#解压释放源码包、合并补丁包:[root@mailLNS-SG6]#tarxzvfpostfix-2.4.6.tar.gz[root@mailLNS-SG6]#gunzippostfix-2.4.6-vda-ng.patch.gz[root@mailLNS-SG6]#cdpostfix-2.4.6[root@mailpostfix-2.4.6]#patch-p1../postfix-2.4.6-vda-ng.patch//-p1(1为数字)patchingfileREADME_FILES/VDA_READMEpatchingfilesrc/global/mail_params.hpatchingfilesrc/util/file_limit.cpatchingfilesrc/virtual/mailbox.cpatchingfilesrc/virtual/maildir.cpatchingfilesrc/virtual/virtual.cpatchingfilesrc/virtual/virtual.h[root@mailpostfix-2.4.6]#4配置编译参数:[root@mailpostfix-2.4.6]#vimpostfix.sh//配置编译参数的脚本内容,“\”为换行符[root@mailpostfix-2.4.6]#chmoda+xpostfix.sh[root@mailpostfix-2.4.6]#./postfix.sh//使用脚本进行编译前的配置[root@mailpostfix-2.4.6]#make[root@mailpostfix-2.4.6]#makeinstall//有提示直接回车接受默认配置[root@mailpostfix-2.4.6]#编辑main.cf配置文件,调整Postfix的基本运行参数:[root@mailpostfix-2.4.6]#cd/etc/postfix/[root@mailpostfix]#postconf-nmain2.cf[root@mailpostfix]#mvmain.cfmain.cf.bak[root@mailpostfix]#mvmain2.cfmain.cf[root@mailpostfix]#[root@mailpostfix]#postfixstartpostfix/postfix-script:startingthePostfixmailsystem[root@mailpostfix]#netstat-antp|grep:25tcp000.0.0.0:250.0.0.0:*LISTEN12738/master[root@mailpostfix]#[root@mailpostfix]#vimmain.cf[root@mailpostfix]#//添加下列各行[root@mailpostfix]#groupaddmailusers[root@mailpostfix]#useradd-gmailusers-s/sbin/nologinzhangsan[root@mailpostfix]#useradd-gmailusers-s/sbin/nologinlisi[root@mailpostfix]#passwdzhangsan[root@mailpostfix]#passwdlisi[root@mailpostfix]#postfixreloadinet_interfaces=192.168.1.33,127.0.0.1myhostname=mail.benet.commydomain=benet.commyorigin=$mydomainmydestination=$mydomain,$myhostnamehome_mailbox=Maildir/makemakefiles\'CCARGS=-DHAS_MYSQL-I/usr/local/mysql/include/mysql\-DUSE_SASL_AUTH-DUSE_CYRUS_SASL-I/usr/include/sasl'\'AUXLIBS=-L/usr/local/mysql/lib/mysql-lmysqlclient-lz-lm-L/usr/lib/sasl2-lsasl2'5l编译安装Dovecot软件包[root@mailLNS-SG6]#useradd-M-s/sbin/nologindovecot[root@mailLNS-SG6]#tarxzvfdovecot-1.1.4.tar.gz[root@mailLNS-SG6]#cddovecot-1.1.4[root@maildovecot-1.1.4]#[root@maildovecot-1.1.4]#./configure--sysconfdir=/etc/--with-mysql[root@maildovecot-1.1.4]#make[root@maildovecot-1.1.4]#makeinstall[root@maildovecot-1.1.4]#建立dovecot.conf配置文件:[root@maildovecot-1.1.4]#cp/etc/dovecot-example.conf/etc/dovecot.conf[root@maildovecot-1.1.4]#[root@maildovecot-1.1.4]#vim/etc/dovecot.conf//找到对应行数,复制后去掉#号修改创建PAM认证文件:[root@maildovecot-1.1.4]#[root@maildovecot-1.1.4]#vim/etc/pam.d/dovecot启动Dovecot服务,验证TCP端口(110,43)[root@maildovecot-1.1.4]#/usr/local/sbin/dovecot-c/etc/dovecot.conf[root@maildovecot-1.1.4]#[root@maildovecot-1.1.4]#netstat-nutpl|grepdovecottcp000.0.0.0:1100.0.0.0:*LISTEN3425/dovecottcp000.0.0.0:1430.0.0.0:*LISTEN3425/dovecot[root@maildovecot-1.1.4]#authrequiredpam_nologin.soauthincludesystem-authaccountincludesystem-authsessionincludesystem-auth23#protocols=imapimaps24protocols=pop3imap48#disable_plaintext_auth=yes49disable_plaintext_auth=no87#ssl_disable=no88ssl_disable=yes211#mail_location=maildir:~/Maildir212mail_location=maildir:~/Maildir6用户lisi使用OutlookExplorer客户端发送邮件:接收邮件:lSquirreMail实现Webmail邮件界面安装程序包、中文语言包:[root@mailLNS-SG6]#tarxjvfsquirrelmail-1.4.13.tar.bz2-C/usr/local/apache2/htdocs/[root@mailLNS-SG6]#[root@mailLNS-SG6]#cd/usr/local/apache2/htdocs/[root@mailhtdocs]#mvsquirrelmail-1.4.13webmail[root@mailhtdocs]#[root@mailhtdocs]#cdwebmail/[root@mailwebmail]#tarxjvf/home/tom/LNS-SG6/zh_CN-1.4.13-20071220.tar.bz2通过互联网接收到邮件7创建及调整数据目录