The Perfect Server - CentOS 5.3 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/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:

cd /tmp
wget http://prdownloads.sourceforge.net/courier/courier-authlib-0.62.2.tar.bz2
wget http://prdownloads.sourceforge.net/courier/courier-imap-4.5.0.tar.bz2
wget http://prdownloads.sourceforge.net/courier/maildrop-2.1.0.tar.bz2

Now (still in /tmp) we can build courier-authlib:

sudo rpmbuild -ta courier-authlib-0.62.2.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 608
-rw-r--r-- 1 root root 139745 May 25 14:52 courier-authlib-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root 328419 May 25 14:52 courier-authlib-debuginfo-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root  35322 May 25 14:52 courier-authlib-devel-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root  18310 May 25 14:52 courier-authlib-ldap-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root  14501 May 25 14:52 courier-authlib-mysql-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root  13714 May 25 14:52 courier-authlib-pgsql-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root   8358 May 25 14:52 courier-authlib-pipe-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root root  35287 May 25 14:52 courier-authlib-userdb-0.62.2-1.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.2-1.x86_64.rpm courier-authlib-mysql-0.62.2-1.x86_64.rpm courier-authlib-devel-0.62.2-1.x86_64.rpm

Now we go back to the /tmp directory and run rpmbuild again, this time without sudo, otherwise the compilation will fail because it was run as root:

cd /tmp
rpmbuild -ta courier-imap-4.5.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 1924
-rw-r--r-- 1 root        root        139745 May 25 14:52 courier-authlib-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root        328419 May 25 14:52 courier-authlib-debuginfo-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         35322 May 25 14:52 courier-authlib-devel-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         18310 May 25 14:52 courier-authlib-ldap-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         14501 May 25 14:52 courier-authlib-mysql-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         13714 May 25 14:52 courier-authlib-pgsql-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root          8358 May 25 14:52 courier-authlib-pipe-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         35287 May 25 14:52 courier-authlib-userdb-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 397262 May 25 15:04 courier-imap-4.5.0-3.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 940108 May 25 15:04 courier-imap-debuginfo-4.5.0-3.x86_64.rpm
[compileuser@server1 x86_64]$

You can install courier-imap like this:

sudo rpm -ivh courier-imap-4.5.0-3.x86_64.rpm

Now we go back to the /tmp directory and run rpmbuild again, this time to build a maildrop package:

cd /tmp
sudo rpmbuild -ta maildrop-2.1.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 3188
-rw-r--r-- 1 root        root        139745 May 25 14:52 courier-authlib-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root        328419 May 25 14:52 courier-authlib-debuginfo-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         35322 May 25 14:52 courier-authlib-devel-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         18310 May 25 14:52 courier-authlib-ldap-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         14501 May 25 14:52 courier-authlib-mysql-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         13714 May 25 14:52 courier-authlib-pgsql-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root          8358 May 25 14:52 courier-authlib-pipe-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 root        root         35287 May 25 14:52 courier-authlib-userdb-0.62.2-1.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 397262 May 25 15:04 courier-imap-4.5.0-3.x86_64.rpm
-rw-r--r-- 1 compileuser compileuser 940108 May 25 15:04 courier-imap-debuginfo-4.5.0-3.x86_64.rpm
-rw-r--r-- 1 root        root        299343 May 25 15:13 maildrop-2.1.0-3.x86_64.rpm
-rw-r--r-- 1 root        root        770389 May 25 15:13 maildrop-debuginfo-2.1.0-3.x86_64.rpm
-rw-r--r-- 1 root        root        134758 May 25 15:13 maildrop-devel-2.1.0-3.x86_64.rpm
-rw-r--r-- 1 root        root         63937 May 25 15:13 maildrop-man-2.1.0-3.x86_64.rpm
[compileuser@server1 x86_64]$

You can now install maildrop like this:

sudo rpm -ivh maildrop-2.1.0-3.x86_64.rpm

After you have compiled and installed all needed packages, you can become root again by typing

exit

 

11 Apply Quota Patch To Postfix

We have to get the Postfix source rpm, patch it with the quota patch, build a new Postfix rpm package and install it.

cd /usr/src
wget http://ftp-stud.fht-esslingen.de/pub/Mirrors/centos/5.3/os/SRPMS/postfix-2.3.3-2.1.el5_2.src.rpm
rpm -ivh postfix-2.3.3-2.1.el5_2.src.rpm

The last command will show some warnings that you can ignore:

warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root

cd /usr/src/redhat/SOURCES
wget http://vda.sourceforge.net/VDA/postfix-2.3.3-vda.patch.gz
gunzip postfix-2.3.3-vda.patch.gz
cd /usr/src/redhat/SPECS/

Now we must edit the file postfix.spec:

vi postfix.spec

Change %define MYSQL 0 to %define MYSQL 1, add Patch0: postfix-2.3.3-vda.patch to the # Patches stanza, and finally add %patch0 -p1 -b .vda to the %setup -q stanza:

[...]
%define MYSQL 1
[...]
# Patches

Patch0: postfix-2.3.3-vda.patch
Patch1: postfix-2.1.1-config.patch
Patch3: postfix-alternatives.patch
Patch6: postfix-2.1.1-obsolete.patch
Patch7: postfix-2.1.5-aliases.patch
Patch8: postfix-large-fs.patch
Patch9: postfix-2.2.5-cyrus.patch
Patch10: postfix-CVE-2008-2936.patch
[...]
%setup -q
# Apply obligatory patches
%patch0 -p1 -b .vda
%patch1 -p1 -b .config
%patch3 -p1 -b .alternatives
%patch6 -p1 -b .obsolete
%patch7 -p1 -b .aliases
%patch8 -p1 -b .large-fs
%patch9 -p1 -b .cyrus
%patch10 -p1 -b .CVE-2008-2936
[...]

Then we build our new Postfix rpm package with quota and MySQL support:

rpmbuild -ba postfix.spec

Our Postfix rpm package is created in /usr/src/redhat/RPMS/x86_64 (/usr/src/redhat/RPMS/i386 if you are on an i386 system), so we go there:

cd /usr/src/redhat/RPMS/x86_64

The command

ls -l

shows you the available packages:

[root@server1 x86_64]# ls -l
total 11732
-rw-r--r-- 1 root root 3940144 May 25 15:19 postfix-2.3.3-2.1.x86_64.rpm
-rw-r--r-- 1 root root 7999302 May 25 15:20 postfix-debuginfo-2.3.3-2.1.x86_64.rpm
-rw-r--r-- 1 root root   49760 May 25 15:19 postfix-pflogsumm-2.3.3-2.1.x86_64.rpm
[root@server1 x86_64]#

Pick the Postfix package and install it like this:

rpm -ivh postfix-2.3.3-2.1.x86_64.rpm

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

Share this page:

18 Comment(s)

Add comment

Comments

From: Morris Hong at: 2009-08-25 02:09:22

I am struggling to install mailman after this installation.

Would you recommend any documment for me ?

Thanks in advance !!!

From: Rafael at: 2009-09-30 21:24:48
From: mazarin at: 2009-10-08 20:46:58

My first time ever with linux, took me a whole day to do number 9. As I understand it there are to faults to the above instructions. 1. The "yum priorities" are not installed, that solved my problems. 2. The proper rpmforge-link is not at all found on the urls above. This is what I did: 

yum install yum-priorities

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

cd /tmp

wget http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm 

 Then the long install command. Why have a GUI when installing the perfect-server...

I guess you get what you pay for...

From: Anonymous at: 2009-07-16 13:10:59

the command: yum install getmail doesnt install getmail. Here is the command result:

[root@xxxxx]# yum install getmail
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.nsc.liu.se
 * updates: mirror.nsc.liu.se
 * addons: mirror.nsc.liu.se
 * extras: mirror.nsc.liu.se
Setting up Install Process
Parsing package install arguments
No package getmail available.
Nothing to do

 

I manualy isntalled Getmail from their website, version 3.x - should we install version 3.x or 4.x ???

Some changes needed to the article...

From: Intelec at: 2009-08-03 20:38:48

I found on the installation intructions of another Control Panel, the www.ispcp.net that there is a repository with the precompiled Courier. You can use these commands to install:

 # wget http://www.thatfleminggent.com/packages/centos/5/i386/courier-authlib-0.62.2-1.el5.mf.i386.rpm
# wget http://www.thatfleminggent.com/packages/centos/5/i386/courier-authlib-userdb-0.62.2-1.el5.mf.i386.rpm
# wget http://www.thatfleminggent.com/packages/centos/5/i386/courier-imap-4.4.1-1.el5.mf.i386.rpm
# sudo rpm -i courier-authlib-*.rpm
# sudo rpm -i courier-authlib-userdb-*.rpm
# sudo rpm -i courier-imap-*.rpm
# sudo groupadd courier -g 3000
# sudo useradd -u 3000 -c 'Courier Mail Server' -d /dev/null -g courier -s /bin/false courier

From: Anonymous at: 2009-11-03 10:06:04

I strongly disagree with what you are trying to pass here as THE perfect setup.

This configuration might work for some time, but is highly UNMAINTAINABLE!

Half of the core packages here are compiled from source, patched or otherwise modified, this is a security nightmare!
Don't tell me that If you install this mess, you will keep on tracking the security issues in all the custom compiled subsystems to keep them up-to-date.

BAD, BAD advise!

From: rct2dotcom at: 2009-09-02 10:41:29

The URL for the source rpms is no longer available.

At the official postfix website, the postfix.spec file is a different format that the one described, thus these postfix build instructions do not work.

Further, the same version of postfix at the official site will not build because it does not recognise the version of 'redHat'. It is for redHat 4 or below.

[The above comments are also true for the HOWTO for CentOs 5.2]

From: Jose at: 2009-07-04 19:32:41

Hi

 You explain here the instllation of MyDNS 1.1.0 ( http://mydns.bboy.net) but the newest version is 1.2.8.27 http://mydns.pl/

 Is good the last one or is better to use 1.1.0 from mydns.bboy.net

 Thank you

From: Anonymous at: 2009-10-21 19:53:19

If you are doing this on your local machine it is imperative that you add -p to the second command:

mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword -p

as you will be actually connecting from the localhost for which you already set the password above.

From: Anonymous at: 2009-09-10 08:05:08

check your /etc/hosts

From: Simon Barrett at: 2009-09-04 23:56:24

This happened for me and I was searching high and low for answers.

 I eventually found out via the "/var/log/httpd/error_log" output (open it in vi) that access was denied to the following file:

 /usr/sbin/vlogger/access.log

 I browsed to that directory but found that the "vlogger" directory did not exist.

I put in the following command: "mkdir /usr/sbin/vlogger" 

I then retried  starting apache with the "/etc/init.d/httpd start" command and it worked.

 I can now browse to the server via HTTP from my client computers again.

 Hope this was helpful

From: at: 2009-09-06 07:35:05

I have jammed in this step:

  • mysqladmin -u root password yourrootsqlpassword
  • mysqladmin -h server1.example.com -u root password yourrootsqlpassword

 

The first command has successed, but second one has failed as following message:

  • mysqladmin: connect to server at 'ispconfig.raytracy.com' failed
  • error: 'Host 'ispconfig.raytracy.com' is not allowed to connect to this MySQL server'

 

Of course, I have replaced the 'server1.example.com' with the server name which has been designated in /etc/hosts setup. And my 'rootsqlpassword' also same as the first command.

 Is there anything I missed? and how can I fix it? May I ignore this error and go forward?

From: Anonymous at: 2009-07-30 01:48:44

Hello all..just a remark..followed directions to the letter..as far as i can tell..up to suphp everything was fine..then make and make install errors

followed a thread from another forum to get the suphp install to work ok...

then the squirrelmail pretest  failed..I was assuming perhaps ispconfig needed to be in for some additional config items...

then a nice errorless ispconfig install....unfortunatlely  there are issues with ispconfig as well...

I will see if i can debug the items and return to post: )

From: matthewm at: 2009-08-26 21:08:43

yum install mod_suphp

solved suphp prob there are still some errors I am trying to solve though

From: Andywe at: 2009-08-10 13:56:20

The suPHP installation fails and kicks out with error when you go to make it. Please regress and adjust the step for the proper way to build it.

Thanks!

From: uKrease at: 2009-09-12 19:02:55

I wish all tutorials were this precise and to the point.

 Thank you for providing this material, I had my server installed and running in a very short space of time.

 Brilliant !

From: Paul at: 2009-09-02 20:49:34

Superb article. Thanks very much for the lengths you have gone to in order to put this together

From: geld verdienen at: 2010-11-02 14:59:02

Great tutorial, now im still waiting to see if this is better then directadmin.