5.3. 运行
启动命令如下:
# /usr/sbin/postfix start
5.4. 测试Postfix
启动Postfix后,首先检查日志/var/log/messages有无错误信息,然后检查进程,应该有如下进程存在:检查端口及进程:
# pstree |grep master
|-master-+-pickup
接着检查端口,应该有如下端口打开:
# netstat -an |grep LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
再检测SMTP服务是否正常:
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 mail.nero.3322.org ESMTP Postfix
QUIT
221 Bye
Connection closed by foreign host.
6.0. 安装Cyrus-IMAP
6.1. 编译与安装
在RedHat系列的Linux中,其Kerberos的头文件不在标准的地方,所以需要在编译配置前用env命令指定。此外取消对ucdsnmp的支持:
# cd /home/pub
# tar -zxf cyrus-imapd-2.1.16.tar.gz
# cd cyrus-imapd-2.1.16
# env CPPFLAGS=-I/usr/kerberos/include ./configure --with-cyrus-prefix=/usr/cyrus --with-sasl=/usr/lib/sasl2 --with-auth=unix --without-ucdsnmp --with-krb=/usr/kerberos
# make depend
# make all CFLAGS=-O
# make install
如果编译时提示没有找到com_err.h,请复制当前目录的et目录下面的com_err.h到/usr/include:
# cp et/com_err.h /usr/include
Cyrus-IMAP的安装脚本有问题,cyradm(现在使用的是Perl版本,原来的TCL版本不再支持)所需要的perl模块被安装到一些不在Perl的标准@INC的目录里,需要手工安装。
# cd perl/imap
# perl Makefile.PL
# make install
6.2. 配置
创建主配置文件/etc/cyrus.conf:
# cd /home/pub/cyrus-imapd-2.1.16
# cp master/conf/small.conf /etc/cyrus.conf
添加cyrus-imap的管理账号cyrus,并设置密码为“cyrus”(实际应用中可以使用更加复杂的密码),但是没有指定有效的SHELL,以防止使用它来登录:
# useradd -g mail -M -s/no/shell -d/var/imap cyrus
# passwd cyrus
Changing password for user cyrus
New password: ******
BAD PASSWORD: it it too short
Retype new password: ******
passwd: all authentocation tokens updated successfully
这里要记住你设的cyrus的密码,在以后添加用户时有用。
创建IMAP配置文件/etc/imapd.conf,管理员是cyrus:
使用已建好的文件:
# cp /home/pub/imapd.conf /etc/imapd.conf
7.2. 配置Turba
# cd /var/www/html/horde/turba/config
# vi sources.php
在146行添上你设的horde的密码
最后,添加turba数据库表:
# cd ../scripts/drivers
# mysql --user=root --password=password horde < turba.sql
7.3. 配置IMP
修改/var/www/html/horde/imp/config/servers.php中的域名部分
最后在浏览器中访问如下URL:
http://nero.3322.org/horde/
输入用户名test和密码123456登录
7.4. 启动脚本
可以编写一个启动脚本/etc/rc.d/init.d/mailsys来启动这些进程,这样就不需要单独启动postfix和cyrusd了:
# cp /home/pub/mailsys /etc/rc.d/init.d/mailsys
# chmod 755 /etc/rc.d/init.d/mailsys
# chkconfig --level 35 mailsys on
8.0. 添加和删除用户
8.1. 添加用户数据库脚本:
USE mail;
INSERT INTO USER (USERNAME,PASSWORD,FORWARD,DOMAIN,MAIL)
VALUES ('user','$1$hmX8KLab$uLC0tV0WJA$6WT2jS4ty3Yg0',
'user','nero.3322.org','user@nero.3322.org');
8.2. 删除用户数据库脚本:
USE mail;
DELETE FROM USER
WHERE USERNAME = 'user';