If you already have a server with Debian on it and cannot or don’t want to reinstall then feel free to skip this page. This may be the case if you are using a (virtual) root server from a hosting company or you do not have console access.
What kind of server do you need?
If you just want to host a mail server for your friends and family then these are sane requirements:
- MySQL: 500 MB by default but can easily be tuned down to less than 64 MB.
- Postfix: virtually nothing… a few MB
- Dovecot: 100 MB
- Apache + Roundcube (for the web mail service): 50 MB
- Any CPU is good. (Your mail server will usually have a load of 0.)
So basically an old desktop computer with 512 MB RAM and 50 GB of disk space is more than sufficient. Or you take a Raspberry PI and install a 64 GB SD card – probably the greenest mail server available.
Dimensioning the server
So you can choose the actual server yourself? Great. This gives you the choice on the hardware, the disk partitioning scheme and choice of file systems. As a general guideline a decent mail server should have at least 2 GB of RAM and lots of disk space living on a hardware-based RAID controller. Users will collect a lot of mails with a lot of useless attachments. And don’t expect them to clean up their inbox – especially when offering IMAP. Project 5 GB of mailbox space per user. Regarding the CPU load there is mainly spam and virus scanning that needs raw computing power. A common server will handle dozens of emails per second without spam checking. If you don’t need spam checking or just get smaller amounts of email then even an old desktop PC will do well.
Basic installation and Partitioning
It’s rumoured that even a chicken can install Debian if you just put enough grains on the enter key. And that depicts pretty much how easy it is to install Debian. Insert your boot medium and start the installation. Even if your native language is not english I still suggest you choose english as a system language. If later you have trouble with the server you will more likely find help when google’ing for english error messages.
Next I recommend that you take a little time though when it comes to partitioning your disk. When the installation asks how to partition choose “Manual”. Throughout this tutorial you will store your users’ emails in the /var/vmail partition and will hold the most files which also sum up to a lot of used space. The MySQL database will live in /var/lib/mysql. Log files will live in /var/log.
So my recommendation is:
- / (10 GB, ext4)
- /boot (500 MB – don’t forget to mark it as “bootable”, ext3)
- /var (5 GB, ext4)
- /var/vmail (the more the better, ext4)
- /tmp (1 GB, ext4, optional but recommended)
- swap (1 GB)
The file system can also be ext3, XFS or ReiserFS if you like. Choosing the right file system is a religious issue. XFS is almost always a safe choice for servers but in some conditions may become very slow. ext3 is okay if you don’t want to reformat your /var/vmail partition but the file system check after a reboot can take hours. ReiserFS is also a decent choice but the future of the file system is not entirely clear.
If at all possible choose to use the logical volume manager (LVM) which gives you great flexibility about growing or (depending on the file system you chose) shrinking partitions or even making consistent backups using the snaphot feature. If you haven’t dealt with LVM yet then don’t fear it. In the Lenny tutorial I have given a lengthy introduction on LVM. Even if you have never used LVM you will quickly learn how it works and will never again want to install a server without it.