There is a new version of this tutorial available for Ubuntu 18.04 (Bionic Beaver).

The Perfect Server - Ubuntu 9.04 [ISPConfig 3] - Page 4

12 Install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter, binutils

We can install Postfix, Courier, Saslauthd, MySQL, phpMyAdmin, rkhunter, and binutils with a single command:

aptitude install postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl maildrop getmail4 rkhunter binutils

You will be asked the following questions:

New password for the MySQL "root" user: <-- yourrootsqlpassword
Repeat password for the MySQL "root" user: <-- yourrootsqlpassword
Create directories for web-based administration? <-- No
General type of mail configuration: <-- Internet Site
System mail name: <--
SSL certificate required <-- Ok

We want MySQL to listen on all interfaces, not just localhost, therefore we edit /etc/mysql/my.cnf and comment out the line bind-address =

vi /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address           =

Then we restart MySQL:

/etc/init.d/mysql restart

Now check that networking is enabled. Run

netstat -tap | grep mysql

The output should look like this:

[email protected]:~# netstat -tap | grep mysql
tcp        0      0 *:mysql                 *:*                     LISTEN      8474/mysqld
[email protected]:~#

During the installation, the SSL certificates for IMAP-SSL and POP3-SSL are created with the hostname localhost. To change this to the correct hostname ( in this tutorial), delete the certificates...

cd /etc/courier
rm -f /etc/courier/imapd.pem
rm -f /etc/courier/pop3d.pem

... and modify the following two files; replace CN=localhost with (you can also modify the other values, if necessary):

vi /etc/courier/imapd.cnf
vi /etc/courier/pop3d.cnf

Then recreate the certificates...


... and restart Courier-IMAP-SSL and Courier-POP3-SSL:

/etc/init.d/courier-imap-ssl restart
/etc/init.d/courier-pop-ssl restart


13 Install Amavisd-new, SpamAssassin, And Clamav

To install amavisd-new, SpamAssassin, and ClamAV, we run

aptitude install amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl


14 Install Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, And mcrypt

Apache2, PHP5, phpMyAdmin, FCGI, suExec, Pear, and mcrypt can be installed as follows:

aptitude install apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp

You will see the following question:

Web server to reconfigure automatically: <-- apache2
Configure database for phpmyadmin with dbconfig-common? <-- Yes
Password of your database's administrative user: <-- yourrootsqlpassword
MySQL application password for phpmyadmin: <-- [blank]

Then run the following command to enable the Apache modules suexec, rewrite, ssl, actions, and include:

a2enmod suexec rewrite ssl actions include

Secure phpMyAdmin by deleting the /etc/phpmyadmin/htpasswd.setup file...

rm -f /etc/phpmyadmin/htpasswd.setup

... and remove or comment out the following section in /etc/phpmyadmin/apache.conf:

vi /etc/phpmyadmin/apache.conf
## Authorize for setup
#<Directory /usr/share/phpmyadmin/setup>
#    <IfModule mod_authn_file.c>
#    AuthType Basic
#    AuthName "phpMyAdmin Setup"
#    AuthUserFile /etc/phpmyadmin/htpasswd.setup
#    </IfModule>
#    Require valid-user

Restart Apache afterwards:

/etc/init.d/apache2 restart


15 Install PureFTPd And Quota

PureFTPd and quota can be installed with the following command:

aptitude install pure-ftpd-common pure-ftpd-mysql quota quotatool

Edit the file /etc/default/pure-ftpd-common...

vi /etc/default/pure-ftpd-common

... and make sure that the start mode is set to standalone and set VIRTUALCHROOT=true:


Then restart PureFTPd:

/etc/init.d/pure-ftpd-mysql restart

Edit /etc/fstab. Mine looks like this (I added ,usrquota,grpquota to the partition with the mount point /):

vi /etc/fstab
# /etc/fstab: static file system information.
# Use 'vol_id --uuid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0
# / was on /dev/mapper/server1-root during installation
UUID=b8d265bc-5959-404d-a68e-8dc1c76f18d6 /               ext3    relatime,errors=remount-ro,usrquota,grpquota 0       1
# /boot was on /dev/sda5 during installation
UUID=01e9c3c7-2ad0-4f52-a356-18290517b362 /boot           ext2    relatime        0       2
# swap was on /dev/mapper/server1-swap_1 during installation
UUID=c1e0bcbb-5c73-4bd2-a7b2-8beeb7526200 none            swap    sw              0       0
/dev/scd0       /media/cdrom0   udf,iso9660 user,noauto,exec,utf8 0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto,exec,utf8 0       0

To enable quota, run these commands:

touch /quota.user /
chmod 600 /quota.*
mount -o remount /
quotacheck -avugm
quotaon -avug


16 Install MyDNS

Before we install MyDNS, we need to install a few prerequisites:

aptitude install g++ libc6 gcc gawk make texinfo libmysqlclient15-dev

MyDNS is not available in the Ubuntu 9.04 repositories, therefore we have to build it ourselves as follows:

cd /tmp
tar xvfz mydns-
cd mydns-1.2.8
make install

Next we create the start/stop script for MyDNS:

vi /etc/init.d/mydns
#! /bin/sh
# mydns         Start the MyDNS server
# Author:       Philipp Kern <[email protected]>.
#               Based upon skeleton 1.9.4 by Miquel van Smoorenburg
#               <[email protected]> and Ian Murdock <[email protected]>.

set -e

DESC="DNS server"


# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0

case "$1" in
        echo -n "Starting $DESC: $NAME"
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        echo -n "Stopping $DESC: $NAME"
        start-stop-daemon --stop --oknodo --quiet \
                --exec $DAEMON
        echo "."
        echo -n "Reloading $DESC configuration..."
        start-stop-daemon --stop --signal HUP --quiet \
                --exec $DAEMON
        echo "done."
        echo -n "Restarting $DESC: $NAME"
        start-stop-daemon --stop --quiet --oknodo \
                --exec $DAEMON
        sleep 1
        start-stop-daemon --start --quiet \
                --exec $DAEMON -- -b
        echo "."
        echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
        exit 1

exit 0

Then we make the script executable and create the system startup links for it:

chmod +x /etc/init.d/mydns
update-rc.d mydns defaults


17 Install Vlogger And Webalizer

Vlogger and webalizer can be installed as follows:

aptitude install vlogger webalizer


18 Install Jailkit

Jailkit is needed only if you want to chroot SSH users. It can be installed as follows (important: Jailkit must be installed before ISPConfig - it cannot be installed afterwards!):

aptitude install build-essential autoconf automake1.9 libtool flex bison
cd /tmp
tar xvfz jailkit-2.5.tar.gz
cd jailkit-2.5
make install
cd ..
rm -rf jailkit-2.5*


19 Install fail2ban

This is optional but recommended, because the ISPConfig monitor tries to show the fail2ban log:

aptitude install fail2ban
Share this page:

Suggested articles

11 Comment(s)

Add comment


By: merkur

Cpt. Obvious says:

If you don't restart your server before using ISPConfig you need to start MyDNS by hand:

/etc/init.d/mydns start

BTW: This Howto also works with Ubuntu 9.04 JeOS on AMD64 without any change.

By: boynas

Since we are installing MyDNS from source...

 Does that mean that our box will be broken if we update our box using the repositories... as we should do?

Please advise.


how can i use Dovecot instead of Courier in this howto?

 is it just a simple change or will it be too complicated to use Dovecot instead?

 does ISPConfig works better with Courier or Dovecot?

By: GenX

I wonder about the same thing.

I would love to see a Perfect Server Howto covering the following:

Ubuntu 9.04
Dovecot with MySQL integration for virtual users

and round this off with the other bits and pieces already covered here.

There are many of these tutorials online already, but none of them actually work.

Are we going to see this setup here?

By: David

Me too.

 I'm setting up a configuration like this, with Dovecot&Virtual Users over mysql db, on a fresh Debian intallation.

 I didn't find any documentation about this.

By: OmegaQuest

I seem to have a problem here.  I followed everthing to the letter and everything seems to work great except I have problems uploading/removing anything when I log into the FTP under the users account.

When I log in to FTP, I go to the users directory automatically.  But the Owner shows 5003 (not web2 for example).

The strange thing is, if I creat them an SSH account SFTP and login with that the upload works fine and the Owner shows web2.

I did a look at the root web directory permissions/groups for the users (/var/www/clients/client4/web2) inside SSH (PuTTY) and the permissions show properly.

Any idea why the users has to have AND login via their SSH account (SFTP - Port 22) to be able to upload stuff and not just regular FTP (Port 21)????


By: Anonymous

I added the quota stuff in my fstab file # /etc/fstab: static file system information. # # Use 'vol_id --uuid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # proc /proc proc defaults 0 0 # / was on /dev/sda1 during installation UUID=fc726e41-4e5e-4493-9518-ceaed04ab8cb / ext3 relatime,errors=remount-r,usrquota,grpquotao 0 1 # swap was on /dev/sda5 during installation UUID=bd3ff276-b49b-46fd-b26c-3d5729995f42 none swap sw 0 0 /dev/scd0 /media/cdrom0 udf,iso9660 user,noauto,exec,utf8 0 0 But when I run the commands [email protected]:/# mount -o remount / mount: / not mounted already, or bad option [email protected]:/# quotacheck -avugm quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option. What did I do wrong?

By: ctroyp

Just a FYI, in step 12, you mention that phpmyadmin is being installed in this step, when it is actually being installed in step 14.

 Also, thanks for another great tutorial falko!

By: Sn3akyP3t3

Attempting to install "apache2-suexec" fails on Ubuntu Server LTS 8.04.3.  I get error "Couldn't find any package whose name or description matched "apache2-suexec".  I will ignore this problem for now since the server will be redone next year and currently there are no plans to run anything CGI.  If anyone knows of the correct method please inform me.

By: Sn3akyP3t3

I had some difficulty installing postfix, but running this command prior to the mail setup portion of this tutorial fixes the problem.

sudo /etc/init.d/exim4 start


Hi..Can someone help me with my problem here? After enter this command - sudo apt-get install libsas12-modules libsas12-modules-sql libgsas17\libauthen-sasl-cyrus-perl sas12-bin libpam-mysql

And somehow having like below error.Have no problem with installing MySql & Postfix..

Reading package lists... Done
Building dependency tree      
Reading state information... Done
E: Unable to locate package libsas12-modules
E: Unable to locate package libsas12-modules-sql
E: Unable to locate package libgsas17libauthen-sasl-cyrus-perl
E: Unable to locate package sas12-bin

FYI, am just doing some testing & tutorial How To Set Up Mail Server on Gnu/ Linux..Hope there's someone out there can help  me with it..Thanks a mill..really appreciate it!!~