这几天用windows的邮件服务器感觉真不爽,还不稳定,就搭建了基于Linux的邮件服务器系统,下面是步骤,需要的可以参考参考
 
1、  首先确认把sendmail关闭或者卸载,service sendmail stop (停止)。在联网的情况下使用yum remove sendmail 卸载
2、  确认安装GCC环境,联网就用yum install gcc-c++ 安装,确认安装MySQL和Apache、php环境(这两个可以用RPM包来安装)。
3、  配置主机名、IP地址、默认网关、DNS地址等。Hostname配置主机名 ,setup来配置。调试之后要重启网卡service  network  restart
4、  整理好要安装的源码包,这里Postfix和openwebmail使用源码包安装。Dovecot和cyrus-sasl用RPM包安装。
5、  首先安装postfix,建立组和用户shell> groupadd -g 10000 postdrop
shell> useradd  -u 1000 -s /sbin/nologin postfix   解压tar xzvf Postfix            
cd postfix--*--*   make (提示安装db4-devel),可以安装RPM包,也可以从网上下载
安装yum install db4-devel
安装之后make   make install
6、配置postfix
shell> cd /etc/postfix/
shell> postconf -n > main.cf(如果main.cf文件有的话,就不用做这一步了)
shell> vi /etc/postfix/main.cf
myhostname = mail.456.com(与邮箱有关)
mydomain = 456.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)
7、安装syrus-sasl 安装RPM包 ,也可以从网上在线安装 yum install cyrs-sasl
8、为postfix提供SMTP认证支持
   配置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
 
修改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、重新加载postfix服务
shell> postfix reload
9、安装配置Dovecot(提供POP3和IMAP服务)(对源码包不熟悉的,就安装rpm包)
 也可安装rpm包(一般系统光盘里面有RPM包)
    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(安装RPM包的可以省略这一步)
shell> vi /etc/dovecot.conf
disable_plaintext_auth = no    #//允许使用明文密码登录
ssl_disable = yes
protocols = pop3 imap
3、启动dovecot
shell> dovecot -c /etc/dovecot.conf
安装RPM包的启动方法:(service dovecot start)
装到这里需要用用oe等测试工具试一下收发邮件.
 
 
10、安装openwebmail
安装openwebmail之前首先要安装perl-Text-Iconv这个组件在 http://openwebmail.org/openwebmail/download/redhat/rpm/packages/下载,注意64位系统要安装64位的包,也可以在上面下载openwebmail的包(安装openwebmail需要两个包openwebmail-data-2.53-3.i386.rpm和openwebmail-2.53-3.i386.rpm)
(1)首先要编辑yum的一个文件vi /etc/yum.repos.d/openwebmail.repo默认是不存在的(要是安装openwebmail RPM包的话可以省略1—2步)
添加下面的数据
[openwebmail]
## Thomas Chung
## 2008.05.29
name=Openwebmail for Fedora or Enterprise Linux
baseurl=http://openwebmail.org/openwebmail/download/redhat/rpm/release/
enabled=1
gpgcheck=1
gpgkey=http://openwebmail.org/openwebmail/download/redhat/rpm/release/RPM-GPG-KEY-openwebmail
#metadata_expire=0
(2)下载openwebmail
[root@ser etc]#yum -y  install openwebmail
[root@ser etc]#cd /var/www/cgi-bin/openwebmail/
[root@ser etc]#./openwebmail-tool.pl  --init  #出现Y/N时 ,按N.
修改openwebmail 的一些配置文件
[root@ser etc]# vi dbm.conf
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         no
[root@ser etc]]# cd defaults/
[root@ser defaults]#  vi dbm.conf
dbm_ext                 .db
dbmopen_ext             .db
dbmopen_haslock         yes
smtpserver  192.168.1.2
[root@ser defaults]#  vi openwebmail.conf
domainnames             ***.com
smtpserver              192.168.1.2
authpop3_server         192.168.1.2
 
[root@ser defaults]# cd  ../../openwebmail-tool.pl  --init 
出现Y/N 时,按Y。
11、配置httpd
[root@ser ~]# vi /etc/httpd/conf/httpd.conf
ServerAdmin
root@***.com
ServerName  mail.***.com:80
AddHandler cgi-script .cgi .pl
Service httpd start
12、测试登陆openwebmail
在IE里输入mail.***.com/cgi-bin/openwebmail/openwebmail.pl, 这个地址是不是很长,那么我们来点短点的
在  httpd的 配置文件中添加 下面 内容:
ScriptAlias  /mail    /var/www/cgi-bin/openwebmail/openwebmail.pl
这样在IE 中直接输入
mail.yjw.com/mail
 
13、修改openwebmail的中文支持
Vi /var/www/cgi-bin/openwebmail/etc/openwebmail.conf
Domainnames ltext.com
Default_language    zh_CM.GB2312
Default_iconset      Cool3D .Chinese.Simplified
然后用登陆openwebmail测试如果还是英语,就新建一个用户试试。