1 配置邮件DNS

[root@localhost ~]# vim /var/named/chroot/var/named/lsq.com.zone

$TTL      86400
@                IN SOA  @       root (
                                          42
                                          3H
                                          15M
                                          1W
                                          1D )

lsq.com.                 IN NS             www.lsq.com.
www                      IN A              192.168.18.134
lsq.com.                  IN MX 10          mail.lsq.com.
mail                     IN A              192.168.18.134
~
~
~
~
~
"/var/named/chroot/var/named/lsq.com.zone" 12L, 514C 已写入



2启动httpd

[root@localhost ~]# service httpd restart
停止 httpd:[失败]
启动 httpd:[确定]

3

[root@localhost ~]# service sendmail stop
关闭 sm-client:[确定]
关闭 sendmail:[确定]
[root@localhost ~]# chkconfig sendmail off


4安装图形切换工具

[root@localhost Server]# rpm -ivh system-switch-mail-*.rpm
Preparing...                ########################################### [100%]
   1:system-switch-mail     ########################################### [ 50%]
   2:system-switch-mail-gnom########################################### [100%]
[root@localhost Server]# 

5安装postfix服务

[root@localhost Server]# rpm -ivh postfix-2.3.3-2.1.el5_2.i386.rpm 
Preparing...                ########################################### [100%]
   1:postfix                ########################################### [100%]


6

 69 myhostname = mail.lsq.com

 77 mydomain = lsq.com
 92 myorigin = $myhostname
107 inet_interfaces = all
155 mydestination = $myhostname, $mydomain
255 mynetworks = 192.168.18.0/24, 127.0.0.0/8
287 relay_domains = lsq.com

7看有没有sasl包认证
[root@localhost Server]# rpm -qa |grep sasl
cyrus-sasl-2.1.22-4
cyrus-sasl-devel-2.1.22-4
cyrus-sasl-lib-2.1.22-4
cyrus-sasl-plain-2.1.22-4

8smtp认证的配置

668 smtpd_sasl_auth_enable = yes
669 smtpd_sasl_local_domain = ''
670 smtpd_recipient_restrictions =permit_mynetworks, permit_sasl_authenticated, reject_unauth_destinat    ion
671 broken_sasl_auth_clients=yes
672 smtpd_client_restrictions = permit_sasl_authenticated
673 smtpd_sasl_security_options = noanonymous

9
vim /etc/sysconfig/saslauthd
MECH=shadow

创建用户
[root@localhost ~]# useradd text
[root@localhost ~]# passwd text
Changing password for user text.
New UNIX password: 
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.

启动
saslauthd
[root@localhost ~]# service saslauthd start
启动 saslauthd:[确定]
添加到开机启动项
[root@localhost ~]# chkconfig saslauthd on
[root@localhost ~]# 

10
[root@localhost ~]# cd /usr
[root@localhost usr]# cd /sbin
[root@localhost sbin]# testsaslauthd -u text -p '123456' 
0: OK "Success."

[root@localhost /]# telnet mail.lsq.com 25
Trying 192.168.18.134...
Connected to mail.lsq.com (192.168.18.134).
Escape character is '^]'.
220 mail.lsq.com ESMTP Postfix
ehlo   
501 Syntax: EHLO hostname
ehlo lsq.com
250-mail.lsq.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

11

安装dovecot服务
[root@localhost ~]# rpm -q dovecot
dovecot-1.0.7-7.el5

rpm -ivh /mnt/Server/perl-DBI-1.52-1.fc6.i386.rpm需要安装三个安装包
rpm -ivh /mnt/Server/mysql-5.0.22-2.1.i386.rpm
rpm -ivh /mnt/Server/dovecot-1.0-1.2.rc15.el5.i386.rpm



12vim /etc/dovecot.conf

# If you only want to use dovecot-auth, you can set this to "none".
protocols = pop3 pop3s    注意 是此行改
# IP or host address where to listen in for connections. It's not currently

#     listen = *:10143
#     ssl_listen = *:10943
#     ..
#   }
protocol pop3 {  listen = *:10100   此行改
}
#listen = [::]


13
                                          
[root@localhost ~]# service dovecot start   启动dovecot服务
启动 Dovecot Imap:[确定]
[root@localhost ~]# chkconfig dovecot on     添加开机启动项
[root@localhost ~]# 

14

cyrus-imapd服务的安装

服务相关的RPM包文件:
cyrus-imapd-perl-2.3.7-1.1.el5.i386.rpm
cyrus-imapd-utils-2.3.7-1.1.el5.i386.rpm
db4-utils-4.3.29-9.fc6.i386.rpm
lm_sensors-2.10.0-3.1.i386.rpm
cyrus-imapd-2.3.7-1.1.el5.i386.rpm
cyrus-imapd-devel-2.3.7-1.1.el5.i386.

安装完成
[root@localhost Server]# rpm -qa |grep cyrus-imap
cyrus-imapd-2.3.7-2.el5
cyrus-imapd-utils-2.3.7-2.el5
cyrus-imapd-perl-2.3.7-2.el5
cyrus-imapd-devel-2.3.7-2.el5
[root@localhost Server]# rpm -ivh db4-utils-4.3.29-9.fc6.i386.rpm
Preparing...                ########################################### [100%]
        package db4-utils-4.3.29-9.fc6.i386 is already installed
[root@localhost Server]# rpm -ivh lm_sensors-2.10.7-4.el5.i386.rpm 
Preparing...                ########################################### [100%]
        package lm_sensors-2.10.7-4.el5.i386 is already installed


15

启动cyrus-imapd服务
[root@localhost ~]# service cyrus-imapd start
导入 cyrus-imapd 数据库:[确定]
启动 cyrus-imapd:[确定]
[root@localhost ~]# chkconfig cyrus-imapd on    添加到开机启动


16
vim /etc/postfix/main.cf
注释第456行(去掉前面#号)
456 mailbox_transport = lmtp:unix:/var/lib/imap/socket/lmtp

17
为Cyrus-IMAP管理员账户cyrus设置密码123456

[root@localhost ~]# passwd cyrus
Changing password for user cyrus.
New UNIX password: 
BAD PASSWORD: it is too simplistic/systematic
Retype new UNIX password: 
passwd: all authentication tokens updated successfully.


18
创建用户 text
[root@localhost ~]# cd /usr
[root@localhost usr]# cd /bin
[root@localhost bin]# cyradm -u cyrus localhost
IMAP Password: 
              localhost.localdomain> cm user.text
localhost.localdomain> cm user.text.Send
localhost.localdomain> cm user.text.Trash
localhost.localdomain> cm user.text.Drafts
localhost.localdomain> quit
[root@localhost bin]# 


19
squirrelmail安装
 rpm -ivh php-mbstring-5.1.6-23.el5.i386.rpm 
Preparing...                ########################################### [100%]
   1:php-mbstring           ########################################### [100%]
root@localhost Server]# rpm -ivh squirrelmail-1.4.8-4.0.1.el5.noarch.rpm 
Preparing...                ########################################### [100%]
   1:squirrelmail           ########################################### [100%]

20打开squirrelmail的配置工具
执行
/usr/share/squirrelmail/config/conf.pl

Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> d       此处选D


SquirrelMail Configuration : Read: config.php
---------------------------------------------------------
While we have been building SquirrelMail, we have discovered some
preferences that work better with some servers that don't work so
well with others.  If you select your IMAP server, this option will
set some pre-defined settings for that server.

Please note that you will still need to go through and make sure
everything is correct.  This does not change everything.  There are
only a few settings that this will change.

Please select your IMAP server:
    bincimap    = Binc IMAP server
    courier     = Courier IMAP server
    cyrus       = Cyrus IMAP server
    dovecot     = Dovecot Secure IMAP server
    exchange    = Microsoft Exchange IMAP server
    hmailserver = hMailServer
    macosx      = Mac OS X Mailserver
    mercury32   = Mercury/32
    uw          = University of Washington's IMAP server

    quit        = Do not change anything
Command >> cyrus     此处选择cyrus


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> 2



SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : localhost
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

A.  Update IMAP Settings   : localhost:143 (cyrus)
B.  Change Sendmail Config : /usr/sbin/sendmail

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 1


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : localhost
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

A.  Update IMAP Settings   : localhost:143 (cyrus)
B.  Change Sendmail Config : /usr/sbin/sendmail

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 1

The domain name is the suffix at the end of all email addresses.  If
for example, your email address is [email protected], then your domain
would be example.com.

[localhost]: lsq.com





---------------------------------------------------------
Server Settings

General
-------
1.  Domain                 : lsq.com
2.  Invert Time            : false
3.  Sendmail or SMTP       : Sendmail

A.  Update IMAP Settings   : localhost:143 (cyrus)
B.  Change Sendmail Config : /usr/sbin/sendmail

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 3




S   Save data
Q   Quit

Command >> 3

You now need to choose the method that you will use for sending
messages in SquirrelMail.  You can either connect to an SMTP server
or use sendmail directly.

  1.  Sendmail
  2.  SMTP
Your choice [1/2] [1]: 2



Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> 4

General Options
1.  Data Directory              : /var/lib/squirrelmail/prefs/
2.  Attachment Directory        : /var/spool/squirrelmail/attach/
3.  Directory Hash Level        : 0
4.  Default Left Size           : 150
5.  Usernames in Lowercase      : false
6.  Allow use of priority       : true
7.  Hide SM attributions        : false
8.  Allow use of receipts       : true
9.  Allow editing of identity   : true
    Allow editing of name       : true
    Remove username from header : false
10. Allow server thread sort    : true
11. Allow server-side sorting   : true
12. Allow server charset search : true
13. Enable UID support          : true
14. PHP session name            : SQMSESSID
15. Location base               : 

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 5

Some IMAP servers only have lowercase letters in the usernames
but they still allow people with uppercase to log in.  This
causes a problem with the user's preference files.  This option
transparently changes all usernames to lowercase.
Convert usernames to lowercase (y/n) [n]: y

---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> 10


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Language preferences
1.  Default Language       : en_US
2.  Default Charset        : iso-8859-1
3.  Enable lossy encoding  : false

R   Return to Main Menu
C   Turn color off
S   Save data
Q   Quit

Command >> 1

SquirrelMail attempts to set the language in many ways.  If it
can not figure it out in another way, it will default to this
language.  Please use the code for the desired language.

[en_US]:zh_CN  


SquirrelMail Configuration : Read: config.php (1.4.0)
---------------------------------------------------------
Main Menu --
1.  Organization Preferences
2.  Server Settings
3.  Folder Defaults
4.  General Options
5.  Themes
6.  Address Books
7.  Message of the Day (MOTD)
8.  Plugins
9.  Database
10. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color off
S   Save data
Q   Quit

Command >> Q

You have not saved your data.
Save?  [Y/n]: y

要安装apache服务