最後更新: 2016-02-19
Centos6
# Download Source
wget http://www.dovecot.org/releases/2.2/dovecot-2.2.13.tar.gz.sig
wget http://www.dovecot.org/releases/2.2/dovecot-2.2.13.tar.gz
# Verify Source
# key 40558AC9 from wwwkeys.pgp.net
gpg --keyserver wwwkeys.pgp.net --recv-keys 40558AC9
gpg --verify dovecot-2.2.13.tar.gz.sig
# Prepare
yum groupinstall "Development tools"
yum install mysql-devel openssl-devel
useradd -r dovecot -s /sbin/nologin -d /usr/local/libexec/dovecot
useradd -r dovenull -s /sbin/nologin -d /usr/local/libexec/dovecot
# Compiling
tar -zxf dovecot-2.2.13.tar.gz
cd dovecot-2.2.13
./configure --with-mysql --with-sql --with-zlib --with-ssl
# --with-zlib: Build with zlib compression support (default if detected)
# --with-mysql: SQL Driver
# --with-sql: Authentication Backend
Install prefix . : /usr/local File offsets ... : 64bit I/O polling .... : epoll I/O notifys .... : inotify SSL ............ : yes (OpenSSL) GSSAPI ......... : no passdbs ........ : static passwd passwd-file shadow checkpassword sql : -pam -bsdauth -sia -ldap -vpopmail userdbs ........ : static prefetch passwd passwd-file checkpassword sql nss : -ldap -vpopmail SQL drivers .... : mysql : -pgsql -sqlite Full text search : squat : -lucene -solr
make
make install
# Start
參考: /usr/local/share/doc/dovecot/example-config/*
設定:
http://datahunter.org/dovecot_config#dovecot_mini
/etc/init.d/dovecot
#!/bin/bash # # /etc/rc.d/init.d/dovecot # # Starts the dovecot daemon # # chkconfig: - 65 35 # description: Dovecot Imap Server # processname: dovecot ### BEGIN INIT INFO # Provides: dovecot # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Should-Start: $remote_fs # Should-Stop: $remote_fs # Default-Start: # Default-Stop: 0 1 2 3 4 5 6 # Short-Description: start and stop Dovecot Imap server # Description: Dovecot is an IMAP server for Linux/UNIX-like systems, # written with security primarily in mind. It also contains # a small POP3 server. ### END INIT INFO ulimit -n 5000 # Source function library. . /etc/init.d/functions if [ -f /etc/sysconfig/dovecot -a $UID -eq 0 ]; then . /etc/sysconfig/dovecot fi RETVAL=0 prog="Dovecot Imap" exec="/usr/local/sbin/dovecot" config="/usr/local/etc/dovecot/dovecot.conf" pidfile="/usr/local/var/run/dovecot/master.pid" lockfile="/var/lock/subsys/dovecot" start() { [ $UID -eq 0 ] || exit 4 [ -x $exec ] || exit 5 [ -f $config ] || exit 6 echo -n $"Starting $prog: " daemon --pidfile $pidfile $exec $OPTIONS RETVAL=$? [ $RETVAL -eq 0 ] && touch $lockfile echo } stop() { [ $UID -eq 0 ] || exit 4 echo -n $"Stopping $prog: " killproc -p $pidfile $exec RETVAL=$? [ $RETVAL -eq 0 ] && rm -f $lockfile echo } reload() { [ $UID -eq 0 ] || exit 4 echo -n $"Reloading $prog: " killproc -p $pidfile $exec -HUP RETVAL=$? echo } # # See how we were called. # case "$1" in start) start ;; stop) stop ;; reload) reload ;; force-reload|restart) stop sleep 1 start RETVAL=$? ;; condrestart|try-restart) if [ -f $lockfile ]; then stop sleep 3 start fi ;; status) status -p $pidfile $exec RETVAL=$? ;; *) echo $"Usage: $0 {condrestart|try-restart|start|stop|restart|reload|force-reload|status}" RETVAL=2 [ "$1" = 'usage' ] && RETVAL=0 esac exit $RETVAL
mkdir /var/run/dovecot
chmod +x /etc/init.d/dovecot
chkconfig --add dovecot
chkconfig dovecot on
service dovecot start
link config file:
ln -s /usr/local/etc/dovecot /etc/
Dovecot login without domain
Setting
# Append this domain name if client gives empty realm. auth_default_realm = datahunter.org