Linux+Postfix+Extmail+Dovecot打造基于WEB页面的邮件系统最终效果图:
准备阶段:需要手动下载的软件包:
postfix-2.6.5.tar.gz
courier-authlib-0.62.4.tar.bz2
eextmail-1.2.tar.gz
xtman-1.1.tar.gz
Time-HiRes-1.9707.tar.gz
File-Tail-0.99.3.tar.gz
rrdtool-1.2.23.tar.gz
1.配置好yum源,以本地光盘为例。将RedHat5.6光盘挂载到虚拟机上,使用如下命令配置yum源,下面的过程会使用。
mkdir /media/cdrom
mount /dev/cdrom /media/cdrom
rm /etc/yum.repo/* -rf
vim /etc/yum.repos.d/server.repo
[base] name=Instructor Server Repository baseurl=file:///media/cdrom/Server gpgcheck=0 [VT] name=Instructor VT Repository baseurl=file:///media/cdrom/VT gpgcheck=0 [Cluster] name=Instructor Cluster Repository baseurl=file:///media/cdrom/Cluster gpgcheck=0 [ClusterStorage] name=Instructor ClusterStorage Repository baseurl=file:///media/cdrom/ClusterStorage gpgcheck=0
2.配置自己的dns服务器,我以dean.com域为例
1)安装bind
yum install bind
yum install caching-nameserver # 这个软件包可以自动建立一个纯缓存域名服务器
2)手动创建配置文件
vim /etc/named
options { directory "/var/named"; }; zone "." { typehint; file"named.ca"; }; zone "localhost" { typemaster; file"localhost.zone"; }; zone "0.0.127.in-addr.arpa" { typemaster; file "named.local"; }; zone "dean.com" { typemaster; file"dean.com.zone"; }; zone "0.168.192.in-addr.arpa" { typemaster; file"192.arpa"; };
3) 手动创建正反向dean.com域文件
cd /var/named vim dean.com.zone $TTL 86400 dean.com. IN SOA ns.dean.com. admin.dean.com. ( 2011082301 1H 10M 7D 1D) NS ns.dean.com. MX 10 mail.dean.com. ns.dean.com. IN A 192.168.0.32 mail.dean.com. IN A 192.168.0.32 vim 192.arpa $TTL 86400 @ IN SOA ns.dean.com. admin.dean.com. ( 2011082301 1H 10M 7D 1D ) NS ns.dean.com. MX 10 mail.dean.com. 32 IN PTR ns.dean.com. 32 IN PTR mail.dean.com.
chown :named /var/named/* -R
service named start
# 修改主机名称
vim /etc/sysconfig/network
HOSTNAME=mail.dean.com
hostname mail.dean.com
vim /etc/hosts
127.0.0.1 mail.dean.com localhost
# 修改虚拟机的默认DNS,测试下我们自己配置的DNS是否正常
vim /etc/resolv.conf
nameserver 192.168.0.32 #只保留这一行就行
dig -t A mail.dean.com @127.0.0.1 #能解析出192.168.0.32说明正常
dig -x 192.168.0.32 @127.0.0.1 #能正常解析出mail.dean.com说明正常
成功建立DNS后,下面进入正式阶段:(以下根据老师的文章略作修改)整个构架图如下:
1、首选安装相关的rpm包,使用yum安装下列rpm包
httpd, php, php-mysql, mysql, mysql-server,mysql-devel, openssl-devel, dovecot, perl-DBD-MySQL, tcl, tcl-devel,libart_lgpl, libart_lgpl-devel,libtool-ltdl,libtool-ltdl-devel
yum install -y httpd php php-mysql mysql mysql-servermysql-devel openssl-devel dovecot perl-DBD-MySQL tcl tcl-devel libart_lgpllibart_lgpl-devel libtool-ltdl libtool-ltdl-devel
2、因为我们使用postfix,所以最好关闭sendmail,甚至是卸载
service sendmail stop
chkconfig sendmail off # 开机不启动
rpm –e sendmail --nodeps
3、最好事先安装下列组件,防止编译出错:
Development Libraries
Development Tools
Legacy Software Development
X Software Development
yum groupinstall "Development Libraries""Development Tools" "Legacy Software Development" "XSoftware Development" –y
4、启动mysql数据库,并给mysql的root用户设置密码:
service mysqld start
chkconfig mysqld on
mysqladmin -u root password 'redhat'
set password forroot@'localhost'=password('redhat');
set password for root@'127.0.0.1'=password('redhat'); #设置本地密码
GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY ‘redhat’;#设置远程登陆密码
FLUSH PRIVILEGES;
quit
#启动saslauthd服务,并将其加入到自动启动队列:
servicesaslauthd start
chkconfig saslauthd on