1-E: DOVECOT
Is an open-source IMAP and POP3 server. We are interested in both. It is a necessary ingredient for most popular web based mail clients.
I'm using this version for compatibility. Anyways, it is not outdated.
cd /usr/src/
mkdir dovecot
cd dovecot/
wget http://www.dovecot.org/releases/1.2/dovecot-1.2.9.tar.gz
gunzip dovecot-1.2.9.tar.gz
tar -xpf dovecot-1.2.9.tar
cd dovecot-1.2.9/
#we set it up to our needs
./configure --without-passwd --without-passwd-file --without-shadow --without-pam --without-checkpassword --without-bsdauth --without-gssapi --without-sia --without-ldap \
--without-sql-drivers --without-static-userdb --without-prefetch-userdb --without-sql --without-pgsql --without-mysql --without-sqlite \
--with-ssl=openssl --with-vpopmail
make && make install
useradd -d /nonexistent -s /bin/false -c 'Dovecot user' dovecot
ln -s /var/qmail/control/servercert.pem /etc/ssl/certs/dovecot.pem
ln -s /var/qmail/control/servercert.pem /etc/ssl/private/dovecot.pem
dovecot -n
cd /usr/local/etc/
nano dovecot.conf
##START PASTE HERE
protocols = imap imaps pop3s
listen = *, [::]
log_path = /var/log/dovecot
verbose_ssl = yes
mail_location = maildir:~/Maildir
verbose_proctitle = yes
first_valid_uid = 89
last_valid_uid = 89
protocol lda {
postmaster_address = postmaster@example.com
}
auth default {
mechanisms = plain digest-md5 cram-md5
passdb vpopmail {
args =
}
userdb vpopmail {
}
user = vpopmail
}
dict {
}
plugin {
}
namespace private {
separator = .
prefix = INBOX.
inbox = yes
}
verbose_proctitle = yes
protocol imap {
listen = *:143,[::]:143
ssl_listen = *:993,[::]:993
imap_max_line_length = 65536
}
protocol pop3 {
listen = *:110,[::]:110
ssl_listen = *:995,[::]:995
pop3_no_flag_updates = no
pop3_uidl_format = %v-%u
}
### END PASTE HERE
nano /etc/init.d/dovecot
=====================================================
# License is public domain.
DAEMON=/usr/local/sbin/dovecot
test -x $DAEMON || exit 1
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 $pidfile`
echo "."
else
echo "Dovecot isn't running."
fi
;;
restart|force-reload)
echo -n "Restarting Dovecot"
if test $running = yes; then
kill `cat $pidfile`
sleep 1
fi
$DAEMON
echo "."
;;
*)
echo "Usage: /etc/init.d/dovecot {start|stop|reload|restart|force-reload}" >&2
exit 1
;;
esac
exit 0
=====================================================
chmod 755 /etc/init.d/dovecot
#we should add it to our startup...
update-rc.d dovecot defaults
#Then we set up a log for dovecot...
cd /etc/logrotate.d/
cp apache2 dovecot
echo > dovecot
nano dovecot
/var/log/dovecot {
weekly
rotate 5
nocompress
create 0660 root root
size=100M
}
# If you don't have IPv6 enabled you MAY or may not get some errors, in case you get any error open the config file
# And remove the , "[::]:port" part at the end of every "listen" directive