上面我们只是安装了smtp发送服务器,下面我们来安装接收服务器,并使用dovecot软件。
[root@www ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@www ~]# cd /mnt
[root@www mnt]# groupadd dovecot //建立dovecot组
[root@www mnt]# useradd -M -g dovecot -s /sbin/nologin dovecot //建立dovecot用户并加入dovecot组,并不允许登录到系统
[root@www mnt]# ll
总计 42163
-r-xr-xr-x 1 root root 2175238 03-21 21:36 courier-authlib-0.62.4.tar.bz2
-r-xr-xr-x 1 root root 137736 03-21 21:37 DBD-mysql-4.020.tar.gz
-r-xr-xr-x 1 root root 576803 03-21 21:37 DBI-1.616.tar.gz
-r-xr-xr-x 1 root root 2314155 03-21 21:38 dovecot-1.1.4.tar.gz
-r-xr-xr-x 1 root root 541279 12-21 19:34 extmail-1.2.tar.gz
-r-xr-xr-x 1 root root 586234 12-21 19:35 extman-1.1.tar.gz
-r-xr-xr-x 1 root root 22800 03-21 21:37 File-Tail-0.99.3.tar.gz
-r-xr-xr-x 1 root root 14420771 03-21 21:42 fp-Linux-i686-ws.tar.gz
-r-xr-xr-x 1 root root 260989 03-21 21:37 GD-2.46.tar.gz
-r-xr-xr-x 1 root root 5864320 03-21 21:45 MailScanner-4.84.3-1.rpm.tar.gz
-r-xr-xr-x 1 root root 11439508 03-02 04:34 php-5.4.0.tar.bz2
-r-xr-xr-x 1 root root 3644570 2011-03-24 postfix-2.8.2.tar.gz
-r-xr-xr-x 1 root root 474709 03-21 21:37 rrdtool-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 34075 03-21 21:37 rrdtool-perl-1.2.23-3.el5.i386.rpm
-r-xr-xr-x 1 root root 664076 04-10 17:53 squirrelmail-webmail-1.4.22.tar.gz
-r-xr-xr-x 1 root root 13738 03-21 21:37 Unix-Syslog-1.1.tar.gz
[root@www mnt]# tar -zxvf dovecot-1.1.4.tar.gz -C /usr/src/
[root@www mnt]# cd /usr/src/dovecot-1.1.4/
[root@www dovecot-1.1.4]# ./configure --sysconfdir=/etc --with-mysql
[root@www dovecot-1.1.4]# make && make install
[root@www dovecot-1.1.4]# cp /etc/dovecot-example.conf /etc/dovecot.conf //建立主配置文件
[root@www dovecot-1.1.4]# vi /etc/dovecot.conf
23 protocols = pop3 imap
47 disable_plaintext_auth = no
87 ssl_disable = yes
208 mail_location = maildir:~/Maildir
[root@www dovecot-1.1.4]# vim /etc/postfix/main.cf
414 home_mailbox = Maildir/
建立认证文件
vim /etc/pam.d/dovecot
auth required pam_nologin.so
auth include system-auth
account include system-auth
session include system-auth
将此脚本加入到开机时自动启动
[root@www dovecot-1.1.4]# /usr/local/sbin/dovecot -c /etc/dovecot.conf
测试dovecot
[root@www dovecot-1.1.4]#
[root@www dovecot-1.1.4]# telnet mail.linuxidc.com 110
Trying 192.168.10.170...
Connected to mail.linuxidc.com (192.168.10.170).
Escape character is '^]'.
+OK Dovecot ready.
user user2
+OK
pass 123456
+OK Logged in.
list
+OK 0 messages:
.
quit
+OK Logging out.
Connection closed by foreign host.
[root@www dovecot-1.1.4]#
安装squirrelmail-webmail
[root@www mnt]# tar -zxvf squirrelmail-webmail-1.4.22.tar.gz -C /usr/local/apache2/htdocs/
[root@www mnt]# cd /usr/local/apache2/htdocs/
[root@www htdocs]# ll
总计 12
-rw-r--r-- 1 root root 45 2007-06-12 index.html
-rw-r--r-- 1 root root 20 05-26 21:58 index.php
drwxr-xr-x 16 root root 4096 2011-07-13 squirrelmail-webmail-1.4.22
[root@www htdocs]# mv squirrelmail-webmail-1.4.22/ webmail
[root@www htdocs]#
[root@www htdocs]# cd webmail/
[root@www webmail]# mkdir -pv data/ attach/
mkdir: 已创建目录 “attach”
[root@www webmail]# ll
总计 72
drwxr-xr-x 2 root root 4096 05-27 21:36 attach
drwxr-xr-x 5 root root 4096 2011-07-13 class
drwxrwxr-x 2 root root 4096 2011-07-13 config
-rwxr-xr-x 1 root root 102 2005-08-03 configure
drwxr-xr-x 3 root root 4096 2011-07-13 contrib
drwxrwxr-x 2 root root 4096 2011-07-13 data
drwxr-xr-x 3 root root 4096 2011-07-13 doc
drwxr-xr-x 4 root root 4096 2011-07-13 functions
drwxr-xr-x 3 root root 4096 2011-07-13 help
drwxr-xr-x 2 root root 4096 2011-07-13 images
drwxr-xr-x 3 root root 4096 2011-07-13 include
-rw-r--r-- 1 root root 671 2011-01-06 index.php
drwxr-xr-x 2 root root 4096 2011-07-13 locale
drwxr-xr-x 19 root root 4096 2011-07-13 plugins
drwxr-xr-x 2 root root 4096 2011-07-13 po
-rw-r--r-- 1 root root 56 2009-03-27 README
drwxr-xr-x 2 root root 4096 2011-07-13 src
drwxr-xr-x 3 root root 4096 2011-07-13 themes
[root@www webmail]#
[root@www webmail]# chown -R daemon.daemon attach/ data/
[root@www webmail]#
[root@www webmail]# chmod 730 attach/
[root@www webmail]# cp config/config_default.php config/config.php
[root@www webmail]# vi config/config.php
118 $domain = 'linuxidc.com';
146 $smtpServerAddress = 'localhost';
151 $smtpPort = 25;
210 $imapPort = 143;
231 $imap_server_type = 'dovecot';
499 $data_dir = '/usr/local/apache2/htdocs/webmail/data/';
517 $attachment_dir = '/usr/local/apache2/htdocs/webmail/attach/';
[root@www webmail]# /usr/local/apache2/bin/apachectl restart //重启apache服务
打开浏览器输入:此时可以打开squirrelMail的首页