[root@mail ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 mail.lwb.com mail localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
[root@mail ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=mail.lwb.com
|
[root@mail ~]# chkconfig named on
|
[root@mail ~]# service sendmail stop
[root@mail ~]# chkconfig --level 35 sendmail off
|
[root@mail ~]# groupadd postdrop
[root@mail ~]# groupadd postfix
[root@mail ~]#useradd -M -g postfix -G postdrop -s /sbin/nologin postfix
|
[root@mail l6]# ls
postfix-2.4.6.tar.gz
postfix-2.4.6-vda-ng.patch.gz
[root@mail l6]# tar zxf postfix-2.4.6.tar.gz
[root@mail l6]# gunzip postfix-2.4.6-vda-ng.patch.gz
[root@mail l6]# cd postfix-2.4.6
[root@mail postfix-2.4.6]# patch -p1 < ../postfix-2.4.6-vda-ng.patch
|
make makefiles \
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
|
[root@mail postfix-2.4.6]# make
|
[root@mail postfix-2.4.6]# make install
|
install_root: [/] //
指定系统的根目录
tempdir: [/root/l6/postfix-2.4.6]
//
指定
postfix-install
脚本使用的临时文件目录
config_directory: [/etc/postfix] //
设置
Postfix
的配置文件目录
daemon_directory: [/usr/libexec/postfix]
command_directory: [/usr/sbin] //
设置
Postfix
命令的存放目录
queue_directory: [/var/spool/postfix] //
设置邮件队列目录
sendmail_path: [/usr/sbin/sendmail]
newaliases_path: [/usr/bin/newaliases]
mailq_path: [/usr/bin/mailq]
mail_owner: [postfix]
setgid_group: [postdrop]
html_directory: [no]
manpage_directory: [/usr/local/man]
readme_directory: [no]
|
[root@mail ~]# vi /etc/postfix/main.cf
inet_interfaces = all
//
设置监听
25
端口在哪些
IP
地址可以使用
myhostname = mail.lwb.com
//
设置
Postfix
服务器使用的主机名
mydomain = lwb.com
//
设置
Postfix
服务器使用的邮件域
myorigin = $mydomain
//
设置发件人邮件地址中的邮件域名
mydestination = $mydomain,$myhostname
//
设置可接收的邮件地址中的域名
home_mailbox = Maildir/
//
设置邮件存储位置和格式
|
[root@mail ~]# postfix start
查看其
25
端口是否是如下信息(看是否有
4
个
0
)
root@mail ~]# netstat -antp |grep :25
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 4626/master
|
[root@mail ~]# adduser -s /sbin/nologin zs;passwd zs
[root@mail ~]# adduser -s /sbin/nologin ls;passwd ls
|
[root@mail ~]# useradd -M -s /sbin/nologin dovecot
[root@mail l6]# ls
dovecot-1.1.4.tar.gz
[root@mail l6]# tar zxf dovecot-1.1.4.tar.gz
[root@mail l6]# cd dovecot-1.1.4
[root@mail dovecot-1.1.4]#./configure –sysconfdir=/etc –with-mysql
[root@mail dovecot-1.1.4]#make && make install
|
[root@mail dovecot-1.1.4]# cp dovecot-example.conf /etc/dovecot.conf
或
[root@mail dovecot-1.1.4]# cp /etc/dovecot-example.conf /etc/dovecot.conf
[root@mail dovecot-1.1.4]#vi /etc/dovecot.conf
ssl_disable = yes //
禁用
SSL
机制
protocols = pop3 imap //
指定支持的邮局协议
disable_plaintext_auth = no //
允许明文密码认证
mail_location = maildir:~/Maildir //
设置邮件存储格式及位置
|
[root@mail ~]# vi /etc/pam.d/dovecot
#%PAM-1.0
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
|
[root@mail ~]# /usr/local/sbin/dovecot -c /etc/dovecot.conf
[root@mail ~]# echo "/usr/local/sbin/dovecot -c /etc/dovecot.conf"
[root@mail ~]# netstat -anpt |grep dovecot
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 30040/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 30040/dovecot
|
[root@mail l6]# ls
squirrelmail-1.4.13.tar.bz2
zh_CN-1.4.13-20071220.tar.bz2
[root@mail l6]# tar jxf squirrelmail-1.4.13.tar.bz2 -C /usr/local/apache2/htdocs/
[root@mail l6]# cd /usr/local/apache2/htdocs/
[root@mail htdocs]# mv squirrelmail-1.4.13 webmail
[root@mail htdocs]#cd webmail
[root@mail webmail]#tar jxf ~/l6/zh_CN-1.4.13-20071220.tar.bz2
|
[root@mail webmail]# mkdir -p attach data
[root@mail webmail]# chown -R daemon:daemon attach data
[root@mail webmail]# chmod 730 attach
|
[root@mail webmail]# cp config/config_default.php config/config.php
[root@mail webmail]# vi config/config.php
$squirrelmail_default_language = 'zh_CN';
$default_charset = 'zh_CN.UTF-8';
$domain = 'lwb.com';
$smtpServerAddress = 'localhost';
$smtpPort = 25;
$imap_server_type = 'dovecot';
$imapPort = 143;
$data_dir = '/usr/local/apache2/htdocs/webmail/data/';
$attachment_dir = '/usr/local/apache2/htdocs/webmail/attach/';
|
[root@web ~]# /usr/local/apache2/bin/apachectl start
[root@mail ~]# echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.local
|
[root@web ~]# cd /usr/lib/sasl2/
[root@web sasl2]# cp Sendmail.conf smtpd.conf
[root@web sasl2]# vi /usr/lib/sasl2/smtpd.conf
pwcheck_method:saslauthd
[root@web sasl2]# service saslauthd start
[root@web sasl2]# chkconfig --level 35 saslauthd on
|
[root@web ~]# vi /etc/postfix/main.cf
smtpd_sas1_auth_enable = yes //
启用
SMTP
认证
smtpd_sas1_security_options = noannonymous //
禁止匿名登录
mynetworks = 127.0.0.1
smtpd_recipient_restrictions=permit_mynetworks,permit_sas1_authenticated,reject_unauth_destination
[root@web ~]# postfix reload
|
[root@mail ~]# tail -f /var/log/maillog
|
[root@mail ~]#egrep ‘(regect|warning|error|fatal|panic):’ /var/log/maillog
|
[root@mail ~]#vi /etc/postfix/main.cf
alias_maps = hash:/etc/aliases
|
[root@mail ~]#vi /etc/aliases
zu:lili,xixi,hihi //
在文件末尾添加该行
[root@mail ~]#newaliases
|
[root@mail ~]#chkconfig –level 35 iptables off
[root@mail ~]#vi /etc/selinux/config
SELINUX=disabled
[root@mail ~]#reboot
|
本文出自 “刘文斌” 博客,谢绝转载!