本来是打算用cyrus 做pop3服务器的,但是因为跟openwebmail不兼容,就选用了dovecot,性能应该比cyrus 好。
一、编译安装
# tar xzvf dovecot-1.0.2.tar.gz
# cd dovecot-1.0.2
# ./configure
# make
# make install
二、找出sendmail邮箱的位置
# echo "Hello me" | mail -s "Dovecot test" $USER
一般的rh系统都在 /var/mail 目录下
三、配置dovecot
# mv /usr/local/etc/dovecot-example.conf /usr/local/etc/dovecot.conf
每个配置的选项conf文件里已经有很详细的注释了,这里贴出我的dovecot.conf:
protocols = imap pop3
disable_plaintext_auth = no
ssl_disable = yes
ser=<%u> method=%m rip=%r lip=%l %c
#login_log_format = %$: %s
mail_location = mbox:~/mail:INBOX=/var/mail/%u
dotlock_use_excl = yes
maildir_copy_with_hardlinks = yes
protocol pop3 {
pop3_uidl_format = %v.%u
}
protocol lda {
postmaster_address = postmaster@example.com
}
auth_verbose = yes
auth default {
mechanisms = plain
passdb shadow {
}
userdb passwd {
}
user = root
}
四、启动dovecot
编辑启动脚本 /etc/init.d/dovecot,适应于所有的操作系统
#! /bin/sh
DAEMON=/usr/local/sbin/dovecot
test -x $DAEMON || exit 0
set -e
base_dir=`$DAEMON -a|grep '^base_dir: '|sed 's/^base_dir: //'`
pidfile=$base_dir/master.pid
if test -f $pidfile; then
running=yes
else
running=no
fi
case "$1" in
start)
echo -n "Starting Dovecot"
$DAEMON
echo "."
;;
stop)
if test $running = yes; then
echo "Stopping Dovecot"
kill `cat $pidfile`
echo "."
else
echo "Dovecot is already stopped."
fi
;;
reload)
if test $running = yes; then
echo -n "Reloading Dovecot configuration"
kill -HUP `cat $base_dir/master.pid`
echo "."
else
echo "Dovecot isn't running."
fi
;;
restart|force-reload)
echo -n "Restarting Dovecot"
if test $running = yes; then
kill `cat $base_dir/master.pid`
sleep 1
fi
$DAEMON
echo "."
;;
*)
echo "Usage: /etc/init.d/dovecot {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
# /etc/init.d/dovecot start 启动dovecot
# kill `cat /usr/local/var/run/dovecot/master.pid` 关闭dovecot
参考资料:
http://wiki.dovecot.org/FrontPage?action=show&redirect=%E9%A6%96%E9%A1%B5