Linode Ubuntu Mail Server: Part 1 - Setting up postfix, dovecot, and squirrelmail

My mail server configuration has evolved quite a lot over the paste couple of weeks. Going from basic mail server, to mail forwarding only, to now being a Google hosted server. This two part article will talk about how I set up a mail server on my Linode VPS with Ubuntu Server x64.

The first step is to install postfix. Postfix is the main mail transfer agent (MTA) for many Linux distributions and it is the main one for Ubuntu. The MTA takes care of both sending and receiving of mail and is a critical part of any mail server. You can install it on Ubuntu by following this guide. In it you will also find how to set up most basic postfix functionality. I would recommend following the guide until the Courier installation sections.

The second step is setting up a mail transfer agent. If you installed Courier above, you do not need to do this. I did this because I find Dovecot to be a much better all-in-one solution. The installation is just as painless as postfix and can be found here.

The final step in setting up a mail server is installing a webmail interface. You can skip this and start sending emails to your local accounts and seeing if they show up. However, I preferred to use a web interface as configuring my mail client is a bit of a pain. Squirrelmail is a very simple mail interface that allows you to do the basics. The installation guide explains how to set it up.

An optional final step is to edit /etc/apache2/sites-available/squirrelmail and change it to use a subdomain instead of a subdirectory. You can enable it but un-commenting the following:

<VirtualHost *>
DocumentRoot /usr/share/squirrelmail

You can replace with your desired domain name. Remember to reload Apache (use sudo /etc/init.d/apache2 reload) for it to take effect.

Now you should have an accessible anywhere mail server. Furthermore, as a developer, you can also send mail directly from PHP for notifications and all other kinds of convenience functions..


Post a Comment