The Perfect Server - Fedora 12 x86_64 [ISPConfig 3] - Page 4
10 Install Courier-IMAP, Courier-Authlib, And Maildrop
Unfortunately there are no rpm packages for Courier-IMAP, Courier-Authlib, and Maildrop, therefore we have to build them ourselves.
RPM packages should not be built as root; courier-imap will even refuse to compile if it detects that the compilation is run as the root user. Therefore we create a normal user account now (compileuser in this example) and give him a password:
useradd -m -s /bin/bash compileuser
passwd compileuser
We will need the sudo command later on so that the user compileuser can compile and install the rpm packages. But first, we must allow compileuser to run all commands using sudo:
Run
visudo
In the file that opens there's a line root ALL=(ALL) ALL. Add a similar line for compileuser just below that line:
[...] root ALL=(ALL) ALL compileuser ALL=(ALL) ALL [...] |
Now we are ready to build our rpm package. First become the user compileuser:
su compileuser
Next we create our build environment:
mkdir $HOME/rpm
mkdir $HOME/rpm/SOURCES
mkdir $HOME/rpm/SPECS
mkdir $HOME/rpm/BUILD
mkdir $HOME/rpm/BUILDROOT
mkdir $HOME/rpm/SRPMS
mkdir $HOME/rpm/RPMS
mkdir $HOME/rpm/RPMS/i386
mkdir $HOME/rpm/RPMS/x86_64
echo "%_topdir $HOME/rpm" >> $HOME/.rpmmacros
Now we download the source files from http://www.courier-mta.org/download.php:
mkdir $HOME/downloads
cd $HOME/downloads
wget https://sourceforge.net/projects/courier/files/authlib/0.62.4/courier-authlib-0.62.4.tar.bz2/download
wget https://sourceforge.net/projects/courier/files/imap/4.6.0/courier-imap-4.6.0.tar.bz2/download
wget https://sourceforge.net/projects/courier/files/maildrop/2.2.0/maildrop-2.2.0.tar.bz2/download
Now (still in $HOME/downloads) we can build courier-authlib:
sudo rpmbuild -ta courier-authlib-0.62.4.tar.bz2
After the build process, the rpm packages can be found in $HOME/rpm/RPMS/x86_64 ($HOME/rpm/RPMS/i386 if you are on an i386 system):
cd $HOME/rpm/RPMS/x86_64
The command
ls -l
shows you the available rpm packages:
[compileuser@server1 x86_64]$ ls -l
total 508
-rw-r--r-- 1 root root 124592 2009-11-21 15:19 courier-authlib-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 252608 2009-11-21 15:19 courier-authlib-debuginfo-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 35028 2009-11-21 15:19 courier-authlib-devel-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 17312 2009-11-21 15:19 courier-authlib-ldap-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 13976 2009-11-21 15:19 courier-authlib-mysql-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 13112 2009-11-21 15:19 courier-authlib-pgsql-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 8328 2009-11-21 15:19 courier-authlib-pipe-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 34252 2009-11-21 15:19 courier-authlib-userdb-0.62.4-1.fc12.x86_64.rpm
[compileuser@server1 x86_64]$
Select the ones you want to install, and install them like this:
sudo rpm -ivh courier-authlib-0.62.4-1.fc12.x86_64.rpm courier-authlib-mysql-0.62.4-1.fc12.x86_64.rpm courier-authlib-devel-0.62.4-1.fc12.x86_64.rpm
Now we go back to the $HOME/downloads directory and run rpmbuild again, this time without sudo, otherwise the compilation will fail because it was run as root:
cd $HOME/downloads
rpmbuild -ta courier-imap-4.6.0.tar.bz2
After the build process, the rpm packages can be found in $HOME/rpm/RPMS/x86_64 ($HOME/rpm/RPMS/i386 if you are on an i386 system):
cd $HOME/rpm/RPMS/x86_64
The command
ls -l
shows you the available rpm packages:
[compileuser@server1 x86_64]$ ls -l
total 1552
-rw-r--r-- 1 root root 124592 2009-11-21 15:19 courier-authlib-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 252608 2009-11-21 15:19 courier-authlib-debuginfo-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 35028 2009-11-21 15:19 courier-authlib-devel-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 17312 2009-11-21 15:19 courier-authlib-ldap-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 13976 2009-11-21 15:19 courier-authlib-mysql-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 13112 2009-11-21 15:19 courier-authlib-pgsql-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 8328 2009-11-21 15:19 courier-authlib-pipe-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 34252 2009-11-21 15:19 courier-authlib-userdb-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 331660 2009-11-21 15:30 courier-imap-4.6.0-1.12.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 733256 2009-11-21 15:30 courier-imap-debuginfo-4.6.0-1.12.x86_64.rpm
[compileuser@server1 x86_64]$
You can install courier-imap like this:
sudo rpm -ivh courier-imap-4.6.0-1.12.x86_64.rpm
Now we go back to the $HOME/downloads directory and run rpmbuild again, this time to build a maildrop package:
cd $HOME/downloads
sudo rpmbuild -ta maildrop-2.2.0.tar.bz2
After the build process, the rpm packages can be found in $HOME/rpm/RPMS/x86_64 ($HOME/rpm/RPMS/i386 if you are on an i386 system):
cd $HOME/rpm/RPMS/x86_64
The command
ls -l
shows you the available rpm packages:
[compileuser@server1 x86_64]$ ls -l
total 2500
-rw-r--r-- 1 root root 124592 2009-11-21 15:19 courier-authlib-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 252608 2009-11-21 15:19 courier-authlib-debuginfo-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 35028 2009-11-21 15:19 courier-authlib-devel-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 17312 2009-11-21 15:19 courier-authlib-ldap-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 13976 2009-11-21 15:19 courier-authlib-mysql-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 13112 2009-11-21 15:19 courier-authlib-pgsql-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 8328 2009-11-21 15:19 courier-authlib-pipe-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 root root 34252 2009-11-21 15:19 courier-authlib-userdb-0.62.4-1.fc12.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 331660 2009-11-21 15:30 courier-imap-4.6.0-1.12.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 733256 2009-11-21 15:30 courier-imap-debuginfo-4.6.0-1.12.x86_64.rpm
-rw-r--r-- 1 root root 249212 2009-11-21 15:37 maildrop-2.2.0-1.12.x86_64.rpm
-rw-r--r-- 1 root root 557188 2009-11-21 15:37 maildrop-debuginfo-2.2.0-1.12.x86_64.rpm
-rw-r--r-- 1 root root 92544 2009-11-21 15:37 maildrop-devel-2.2.0-1.12.x86_64.rpm
-rw-r--r-- 1 root root 64764 2009-11-21 15:37 maildrop-man-2.2.0-1.12.x86_64.rpm
[compileuser@server1 x86_64]$
You can now install maildrop like this:
sudo rpm -ivh maildrop-2.2.0-1.12.x86_64.rpm
After you have compiled and installed all needed packages, you can become root again by typing
exit
11 Install Postfix
Postfix can be installed as follows:
yum install postfix
Then turn off Sendmail and start Postfix, saslauthd, and courier-authlib:
chkconfig --levels 235 courier-authlib on
/etc/init.d/courier-authlib start
chkconfig --levels 235 sendmail off
chkconfig --levels 235 postfix on
chkconfig --levels 235 saslauthd on
/etc/init.d/sendmail stop
/etc/init.d/postfix start
/etc/init.d/saslauthd start
12 Configure Courier
Now we create the system startup links for courier-imap:
chkconfig --levels 235 courier-imap on
/etc/init.d/courier-authlib restart
/etc/init.d/courier-imap restart
When courier-imap is started for the first time, it automatically creates the certificate files /usr/lib/courier-imap/share/imapd.pem and /usr/lib/courier-imap/share/pop3d.pem from the /usr/lib/courier-imap/etc/imapd.cnf and /usr/lib/courier-imap/etc/pop3d.cnf files. Because the .cnf files contain the line CN=localhost, but our server is named server1.example.com, the certificates might cause problems when you use TLS connections. To solve this, we delete both certificates...
cd /usr/lib/courier-imap/share/
rm -f imapd.pem
rm -f pop3d.pem
... and replace the CN=localhost lines in /usr/lib/courier-imap/etc/imapd.cnf and /usr/lib/courier-imap/etc/pop3d.cnf with CN=server1.example.com:
vi /usr/lib/courier-imap/etc/imapd.cnf
[...] CN=server1.example.com [...] |
vi /usr/lib/courier-imap/etc/pop3d.cnf
[...] CN=server1.example.com [...] |
Then we recreate both certificates...
./mkimapdcert
./mkpop3dcert
... and restart courier-authlib and courier-imap:
/etc/init.d/courier-authlib restart
/etc/init.d/courier-imap restart
13 Install Getmail
Getmail can be installed as follows:
yum install getmail