====== Installation IMAP daemon courier ======
===== Vorbereitung =====
Das Dokument bezieht sich auf die Installation des IMAP daemons [[http://www.courier-mta.org/imap/|courier]] in Version 4.1.x.\\
Als Erstes lädt man sich die Sourcen der benötigten Komponenten herunter:\\
* courier-imap-4.1.x.tar.bz2 von [[http://www.courier-mta.org/download.php|courier-mta.org]]
* courier-authlib-0.xx.tar.bz2 von [[http://www.courier-mta.org/download.php|courier-mta.org]]
* db-4.4.xx.tar.gz von [[http://www.oracle.com/technology/software/products/berkeley-db/index.html|oracle.com]] ((Berkeley DB 4.5.xx funktioniert auch))
* [[postgres|PostgreSQL]] 8.1.x
* fam (File Alteration Monitor) ist bei den meisten Distributionen dabei und kann über das jeweilige Installationsprogramm (yast, apt-get ...) installiert werden ((ist aber rein optional))
Nach dem Download werden alle Archive in einem temporären Verzeichnis ausgepackt.\\
* **tar xvzpf archiv.tar.gz** oder **tar xvjpf archiv.tar.bz2**
===== Berkeley DB kompilieren =====
cd db-4.4.x
cd build_unix
../dist/configure --with-gnu-ld
make
make install
cd ..
===== Courier authentication library kompilieren =====
cd courier-authlib-x.xx
CPPFLAGS=-I/usr/local/BerkeleyDB.4.4/include LDFLAGS=-L/usr/local/BerkeleyDB.4.4/lib \
./configure --with-gnu-ld --without-authpgsql --without-authmysql --with-authpam --with-authpwd --with-authshadow
make
make check
make install-configure
cd ..
Natürlich kann man das Ganze auch mit PostgreSQL-Anbindung und Verschlüsselung bauen. Das würde dann ungefähr so aussehen:
cd courier-authlib-x.xx
CPPFLAGS="-I/usr/local/BerkeleyDB.4.5/include -I/usr/local/pgsql/include -I/opt/apache/include" \
LDFLAGS="-L/usr/local/BerkeleyDB.4.5/lib -L/usr/local/pgsql/lib -ldl -L/opt/apache/lib" \
./configure --with-gnu-ld --without-authmysql --with-pgsql-libs=/usr/local/pgsql/lib --with-pgsql-includes=/usr/local/pgsql/include --with-db=db \
--with-authpgsqlrc=/usr/local/etc/authlib/authpgsqlrc
make
make check
make install-configure
cd ..
Im obigen Beispiel wurde openSSL nach **/opt/apache** installiert. Die Bibliotheken nach **lib/** und die Headerfiles nach **include/** \\
Außerdem wurde **/opt/apache/lib** in **/etc/ld.so.conf** eingetragen und **ldconfig** aufgerufen, um **LD_LIBRARY_PATH** auf den neuesten Stand zu bringen.
===== Courier IMAPd kompilieren =====
su -
cd courier-imap-4.1.x
CPPFLAGS=-I/usr/local/BerkeleyDB.4.4/include LDFLAGS=-L/usr/local/BerkeleyDB.4.4/lib ./configure --with-gnu-ld --with-db=db
make
make check (export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/BerkeleyDB.4.4/lib)
exit (Rest als root)
cd courier-imap-4.1.x
make install-strip
make install-configure
cd /usr/lib
for i in $(ls /usr/local/BerkeleyDB.4.4/lib/*);do ln -s $i $(basename $i);done
Wenn man die Kommunikation verschlüsseln möchte, dann muß man folgendermaßen vorgehen:
su -
cd courier-imap-4.1.x
CPPFLAGS="-I/usr/local/BerkeleyDB.4.5/include -I/usr/local/pgsql/include -I/opt/apache/include" \
LDFLAGS="-L/usr/local/BerkeleyDB.4.5/lib -L/usr/local/pgsql/lib -L/opt/apache/lib -ldl -lssl -lcrypto" \
./configure --with-gnu-ld --with-db=db
make install-strip
make install-configure
cd /usr/lib
for i in $(ls /usr/local/BerkeleyDB.4.4/lib/*);do ln -s $i $(basename $i);done
Wenn man sich das Linken der BerkeleyDB-Libraries schenken möchte, sollte man **/usr/local/BerkeleyDB.4.4/lib** in den **LD_LIBRARY_PATH** aufnehmen ((analog **/opt/apache/lib**))
===== Umstellung der mbox-Dateien auf Maildir (exim4) =====
Als normaler User, dessen Mailbox umgestellt werden soll, führt man folgende Befehle aus:
cd $HOME
mkdir -p Maildir/new Maildir/cur Maildir/tmp
chmod -R 700 Maildir
Als root fügt man in die Datei **/etc/exim4/update-exim4.conf.conf** folgende Zeile ein:
dc_localdelivery='maildir_home'
und restartet den Maildaemon.
Bereits erhaltene Mails, welche unter /var/spool/mail/ gespeichert sind werden als der jeweilige User mit
mb2md -s /var/spool/mail/ -d Maildir/
in das neue Format konvertiert.