출처
(http://www.digimoon.net/)
소스는 아래 사이트에서 구한다.
# tar xvfz dovecot-1.1.2.tar.gz
# cd dovecot-1.1.2
# ./configure --prefix=/usr --localstatedir=/var --with-pam --with-gssapi --with-mysql
# make
# make install
# cp /usr/etc/dovecot-example.conf /usr/etc/dovecot.conf
# groupadd -g 97 dovecot
# useradd -u 97 -g 97 -d /usr/libexec/dovecot -s /sbin/nologin dovecot
편집기로 환경설정 파일인 dovecot.conf 을 아래와 같이 내용 작성한다.
disable_plaintext_auth = no
ssl_disable = yes
protocol imap {
}
protocol pop3 {
}
auth default {
mechanisms = plain
passdb passwd {
}
passdb shadow {
}
userdb passwd {
}
user = root
}
plugin {
}
mail_privileged_group = mail
실행 커맨드는 아래와 같다.
아래와 같이 출력된다면 dovecot이 잘 올라온 상태이다.
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:50022 0.0.0.0:* LISTEN 18505/xinetd
tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN 18505/xinetd
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 18313/mysqld
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN 3523/smbd
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 21245/dovecot
tcp 0 0 0.0.0.0:143 0.0.0.0:* LISTEN 21245/dovecot
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 18505/xinetd
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN 19307/sendmail: acc
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN 3523/smbd
tcp 0 0 :::80 :::* LISTEN 4562/httpd
udp 0 0 192.168.0.100:137 0.0.0.0:* 3528/nmbd
udp 0 0 0.0.0.0:137 0.0.0.0:* 3528/nmbd
udp 0 0 192.168.0.100:138 0.0.0.0:* 3528/nmbd
udp 0 0 0.0.0.0:138 0.0.0.0:* 3528/nmbd
udp 0 0 0.0.0.0:161 0.0.0.0:* 2832/snmpd
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
unix 2 [ ACC ] STREAM LISTENING 5738801 21245/dovecot /var/run/dovecot/dict-server
unix 2 [ ACC ] STREAM LISTENING 5738803 21245/dovecot /var/run/dovecot/login/default
unix 2 [ ACC ] STREAM LISTENING 5738812 21245/dovecot /var/run/dovecot/auth-worker.21246
unix 2 [ ACC ] STREAM LISTENING 1535445 28839/saslauthd /var/run/saslauthd/mux
unix 2 [ ACC ] STREAM LISTENING 5976316 18313/mysqld /tmp/mysql.sock
[root@digimoon modules]#
실행 스크립트는 아래와 같이 작성 (레드햇 계열)
#
# /etc/rc.d/init.d/dovecot
#
# Starts the dovecot daemon
#
# chkconfig: - 65 35
# description: Dovecot Imap Server
# processname: dovecot
# Source function library.
. /etc/init.d/functions
test -x /usr/sbin/dovecot || exit 0
RETVAL=0
prog="Dovecot Imap"
start() {
echo -n $"Starting $prog: "
daemon /usr/sbin/dovecot
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dovecot
echo
}
stop() {
echo -n $"Stopping $prog: "
killproc /usr/sbin/dovecot
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/dovecot
echo
}
#
# See how we were called.
#
case "$1" in
start)
start
;;
stop)
stop
;;
reload|restart)
stop
start
RETVAL=$?
;;
condrestart)
if [ -f /var/lock/subsys/dovecot ]; then
stop
start
fi
;;
status)
status /usr/sbin/dovecot
RETVAL=$?
;;
*)
echo $"Usage: $0 {condrestart|start|stop|restart|reload|status}"
exit 1
esac
exit $RETVAL
# chkconfig --add dovecot
# chkconfig --level 345 dovecot on
# /etc/init.d/dovecot start|stop|restart
우분투용 init 스크립트는 아래와 같다.
( http://ubuntuforums.org/showthread.php?t=282688 )
#!/bin/sh
# Dovecot IMAP server
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DISTRO=$(lsb_release -is 2>/dev/null || echo Debian)
case "$1" in
'start')
log_daemon_msg "Starting Dovecot IMAP server..."
/usr/sbin/dovecot
RETVAL=$?
log_end_msg 0
;;
'stop')
log_daemon_msg "Stopping Dovecot IMAP server..."
kill `cat /var/run/dovecot/master.pid`
RETVAL=$?
log_end_msg 0
;;
'restart')
log_daemon_msg "Restarting Dovecot IMAP server..."
$0 stop && $0 start
RETVAL=$?
log_end_msg 0
;;
*)
echo "Usage: $0 { start | stop | restart }"
RETVAL=1
;;
esac
exit $RETVAL
# update-rc.d dovecot defaults
# /etc/init.d/dovecot start|stop|restart
실제 사용 시 인증 관련 에러를 비롯해서 한 번에 성공 안 되고 답답하다면 구글 검색 밖에 답 없음... ^^
하지만 위 dovecot.conf 샘플 내용을 그대로 적용한다면 분명히 성공할 겁니다. ㅎ