【实验名称】邮件服务器Postfix的配置
【实验目标】
熟悉邮件服务的基本原理
掌握Postfix服务器的基本配置
掌握dovecot服务器的安装于配置
掌握webmail应用系统的安装于配置
实现双域邮件服务器的收发
【实验原理】
常用的邮件服务器软件
商业邮件系统 :
Postfix的日志文件:
【实验步骤】
一、修改主机名:
[root@rhel5 ~]# vi /etc/sysconfig/network --------------------修改主机名
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=rhel5.xapc.com
NETWORKING=yes
NETWORKING_IPV6=no
[root@rhel5 ~]# vi /etc/hosts -------------------------------修改主机配置文件
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 rhel5.xapc.com rhel5 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
127.0.0.1 gouzhongxing.xapc.com gouzhongxing localhost.localdomain"/etc/hosts" 4L, 222C written
[root@rhel5 ~]# vi /etc/selinux/config --------------------修改防火墙配置
SELINUX=disabled
[root@rhel5 ~]# service iptables save
Saving firewall rules to /etc/sysconfig/iptables: [ OK ]
[root@rhel5 ~]# iptables -F
[root@rhel5 ~]#reboot
二、安装Postfix服务:
[root@gouzhongxing named]# yum install postfix ------------------------------安装postfix服务
[root@gouzhongxing named]# postconf
[root@gouzhongxing named]# postfix start ------------------------------启动postfix服务
postfix/postfix-script: starting the Postfix mail system
[root@gouzhongxing named]# netstat -ntl -----------------------------查看运行端口
tcp 0 0 192.168.20.10:25 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
[root@gouzhongxing named]# useradd gou -----------------------------新建邮件用户
[root@gouzhongxing named]# useradd zhong
[root@gouzhongxing named]# useradd xing
[root@gouzhongxing named]#
[root@gouzhongxing named]# passwd gou -----------------------------设置口令
Changing password for user gou.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@gouzhongxing named]# passwd zhong
Changing password for user zhong.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@gouzhongxing named]# passwd xing
Changing password for user xing.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@gouzhongxing named]# telnet localhost 25 ----------------------------使用telnet命令进行测试
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 gouzhongxing.xapc.com ESMTP Postfix
HELO localhost
250 gouzhongxing.xapc.com
MAIL FROM:[email protected]
250 2.1.0 Ok
Rcpt to:[email protected]
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Subject:111111111111111111
11111111111111111111111111
.
250 2.0.0 Ok: queued as 56F3D258059
QUIT
221 2.0.0 Bye
Connection closed by foreign host.
[root@gouzhongxing named]# ll ~zhong -----------------------------查看用户的目录
total 4
drwx------ 5 zhong zhong 4096 Feb 17 01:52 Maildir
[root@gouzhongxing named]# ll ~zhong/Maildir/
total 12
drwx------ 2 zhong zhong 4096 Feb 17 01:52 cur
drwx------ 2 zhong zhong 4096 Feb 17 01:52 new
drwx------ 2 zhong zhong 4096 Feb 17 01:52 tmp
[root@gouzhongxing named]# ll ~zhong/Maildir/new/
total 4
-rw------- 1 zhong zhong 480 Feb 17 01:52 1013881936.Vfd00I10012fM499738.gouzhongxing.xapc.com
[root@gouzhongxing named]# cat ~zhong/Maildir/new/1013881936.Vfd00I10012fM499738.gouzhongxing.xapc.com
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from localhost (gouzhongxing.xapc.com [127.0.0.1])
by gouzhongxing.xapc.com (Postfix) with SMTP id 56F3D258059
for <[email protected]>; Sun, 17 Feb 2002 01:51:08 +0800 (CST)
Subject:111111111111111111
Message-Id: <[email protected]>
Date: Sun, 17 Feb 2002 01:51:08 +0800 (CST)
From: [email protected]
To: undisclosed-recipients:;
11111111111111111111111111
三、安装dovecot服务:
[root@gouzhongxing named]# yum install dovecot ------------------------安装dovecot服务器
[root@gouzhongxing named]# vi /etc/dovecot.conf
ssl_disable = yes -------------------禁用ssl机制
...............................................
protocols = imap pop3 -------------------支持的邮局协议
disable_plaintext_auth = no -------------------允许明文密码认证
mail_location = maildir:~/Maildir -------------------邮件存储格式及位置
[root@gouzhongxing named]# service dovecot start-------------------启动dovecot服务
Starting Dovecot Imap: [ OK ]
[root@gouzhongxing named]# netstat -ntl -------------------查看运行端口
tcp 0 0 :::110 :::* LISTEN
tcp 0 0 :::143 :::* LISTEN
[root@gouzhongxing named]# telnet localhost 110---------------------使用telnet命令进行收信测试
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
+OK Dovecot ready.
USER zhong
+OK
PASS 123
+OK Logged in.
LIST
+OK 1 messages:
1 493
.
RETR 1
+OK 493 octets
Return-Path: <[email protected]>
X-Original-To: [email protected]
Delivered-To: [email protected]
Received: from localhost (gouzhongxing.xapc.com [127.0.0.1])
by gouzhongxing.xapc.com (Postfix) with SMTP id 56F3D258059
for <[email protected]>; Sun, 17 Feb 2002 01:51:08 +0800 (CST)
Subject:111111111111111111
Message-Id: <[email protected]>
Date: Sun, 17 Feb 2002 01:51:08 +0800 (CST)
From: [email protected]
To: undisclosed-recipients:;
11111111111111111111111111
.
QUIT
+OK Logging out.
Connection closed by foreign host.
使用邮件客户端测试:
在Outlook Express 中设置邮件账号:
对于用户gou需要设置邮件帐号为[email protected]
创建及调整数据目录、附件目录:
[root@gouzhongxing webmail]# mkdir -p attach data
[root@gouzhongxing webmail]#chown -R apache:apache attach/ data/
建立并调整config.php配置文件:
[root@gouzhongxing webmail]# cp config/config_default.php config/config.php