Installing packages

There is a newer issue of thie ISPmail guide available if you are using Debian Jessie!

By now your Debian Wheezy server should be readily installed. Now it’s time to install the necessary Debian packages to make it an actual mail server.

It is a good idea to install all missing security updates first:

apt-get update

apt-get upgrade

Debian Wheezy does not install the SSH server by default. So to spare you an extra walk to the server room I suggest:

apt-get install ssh

Then let’s install Postfix with MySQL backend support:

apt-get install postfix postfix-mysql

When you get asked for the mail server configuration type please choose “Internet site”. Enter your own mail server name (the fully qualified domain name).

As by default Debian installs exim as a mail service you should remove its remains:

apt-get –purge remove ‘exim4*’

A very useful tool is SWAKS (the SWiss Army Knife for Smtp):

apt-get install swaks

You also need a MySQL server:

apt-get install mysql-server

Note: You can run MySQL server on the same system as your actual mail service – but don’t have to. The mail server can communicate with the MySQL server via TCP networking. Maybe you even have a MySQL server in your network already that you can use.

During the installation you will get asked for the password of a newly created “root” user. This is not your system’s “root” login but a special administrative user used to access the MySQL server. Choose a secure password you want and write it down. (Use “pwgen -s 25 1” or “apg -m 25 -a 1 -n 1” to get good passwords. The commands are available once you “apt-get install pwgen apg”.)

And another warning: during the installation a MySQL user account called “debian-sys-maint” will be created with a random password. The password is stored in the /etc/mysql/debian.cnf file. Do not touch this file or change the user’s password in the database or you won’t be able to stop or start the MySQL service any more.

You will want to offer POP3 and IMAP services to your users so you need to install Dovecot’s services:

apt-get install dovecot-mysql dovecot-pop3d dovecot-imapd dovecot-managesieved

If you intend to offer a webmail service I can recommend the Roundcube package. Previous versions of the tutorial recommended Squirrelmail but honestly Roundcube is way more comfortable. Type:

apt-get install roundcube roundcube-plugins

This will also install an Apache server and PHP packages. You will get asked if you want to maintain the RoundCube package using “dbconfig-common”. Basically this means that Debian will set up the database for you and in future releases upgrade the database. I suggest you say “Yes” here. The database type is “MySQL”. When asked for the “database’s administrative user’s password” enter the password you entered for the MySQL “root” user when you installed the MySQL server. Then you will have to think of a safe password that RoundCube will use to access its database and enter that twice.

If you believe you are not a MySQL ninja on the command line then I suggest you install the PHPMyAdmin software which allows you to manage your MySQL database in the web browser:

apt-get install phpmyadmin

Again you are asked if you want to manage the phpmyadmin database using “dbconfig-common”. Answer “yes”, enter the MySQL “root” user’s password. You will get asked for a “MySQL application password for phpmyadmin”. Just leave the field empty and continue – a password will be generated automatically. As a web server to be used select “apache2”.

Now all basic packages are installed and it’s time to prepare the database in the next chapter.

16 thoughts on “Installing packages”

  1. Lawrence Jones

    After installing phpmyadmin:
    cd /etc/apache2/conf.d
    ln -s /etc/phpmyadmin/apache.conf phpmyadmin
    service apache2 reload

  2. some typos
    – By now your Debian Whgeezy
    – Debian Squeeze does not install the SSH server

  3. Hi!

    Trying to install dovecot-managesieved results in an error: Package dovecot-managesieved is not available, but is referred to by another package.


  4. I thought that Debian had replaced Postfix with Exim4 as the MTA.

    Note no Postfix in the Debian tasksel for Mail Server.

    $ apt-cache show task-mail-server

    Package: task-mail-server
    Source: tasksel
    Version: 3.14.1
    Installed-Size: 21
    Maintainer: Debian Install System Team
    Architecture: all
    Depends: tasksel, exim4
    Recommends: dovecot-imapd, dovecot-pop3d, mailx, mutt, exim4-daemon-light, exim4-config, procmail, mailagent, spamassassin, sa-exim
    Description-en: Mail server
    This task selects a variety of packages useful for a general purpose mail
    server system.

    1. Christoph Haas

      By default Exim4 is capable enough for simple cases in a default setup. That doesn't mean it's the only choice. Debian hasn't replaced Postfix by Exim4.

  5. Thomas Schmieder

    There is also a package called postfixadmin in the debian wheezy repository.
    I installed it a few days before I found your detailed script.
    The module provides an HTTP interface for postfix.

    What is the purpose of the module with respect to your description?

    I followed a different script under “” to setup
    – postfix
    – postfixadmin
    – dovecot
    – mysql
    – apache
    – dovecots sieve

    unfortunately for the old versions.
    It seems to have changed a lot in the logical interaction of the components.
    The installation didn’t work at least with the new versions, i.e. partially the functions worked. After including Dovecot nothing more was running 🙁

    1. Christoph Haas

      Eek, that's bad news. I actually liked Roundcube because it integrated so well with Dovecot regarding the Sieve filter management. I don't want to promise anything but I think I'll consider adopting the package. Or is anyone aware of a similarly good webmail software?

      1. Just so you are aware I was able to install roundcube using the guide with no issues in xUbuntu (yeah I only like the XFCE4 UI; sleek, smooth, slightly windows-esque so it makes moving users away from Winblows easy, and it is light on resources so even old slow netbooks run it rather well).

        Anyways; Ubuntu usually pulls upstream Debian changes, and as such would usually nix something like Roundcube if it were a bug related to the core of the Debian system. I think they have since squashed the issue and Roundcube is available again. This is not always the case, and if it is not then usuing any Ubuntu flavor 14.04 and probably above should give you access to Roundcube repo. If not you should be able to easily add a roundcube repo which would be easy to add to the guide and I would suspect in any case you need to most likely enable to multiverse and restricted extras repos before it would become available.

    2. I would like to know if there is a good replacement (available in Debian, of course) for roundcube.

      1. Use egroupware ( …. it’ sieve capable and much moore. It has webdav carddav caldav file manager and mysql/mariadb compliant

        It’s also available as deb package

  6. I would not go for egroupware any more, since Stylite – the company behind most of the developers – tries to push primarily the professional edition of egw, Egroupware EPL, and the opensource version seems to be nowadays just a fig leaf …
    (Some years ago, I would agree on your recommendation, but today not anymore).
    But there are some good alternatives in my opinion with actively developed opensource versions:
    – personally my favorite is horde groupware ( It is in the Debian repository, thusnI would recommend installation via pear;
    – also an alternative is the Kolab project (

    But these are just my 2ct

  7. Just to let you know Christoph, I was looking for some information about a standby Wheezy server I have and all the information between the text, (commands etc.) seems to have disappeared.

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top