Monday, 8 October 2007

Linux,Windows and Setting them up as Mailservers

Recently I have been trying to set up a mail server for my organisations trainees, being a fan of OpenSource software I had to try to do it in Linux. For the uninitiated, this is probably one of the hardest things you can do, only because of the different software and dependencies required and getting each element to integrate. N.B: This whole scenario is much easier if you set up the users on Linux, I - fool that I am - decided on a virtual style setup which makes things immeasurably harder, If you do set them up as per the latter (or run LDAP) you can install Dovecot and away to go.

I decided that for the benefit of our trainees, to use one of the groupware solutions available rather than just Webmail, I settled on E-Groupware after testing several (which I will post about soon).

Ingredients:
One stable machine capable of running the Linux distribution of your choice (more on this later)
Cyrus Imap
MySQL
PHP 5
Postfix
Webmail client
Apache
Webmin
Sharp Stick to repeatedly poke in eye (optional)

How To:

Begin by installing your Linux software on your server, I used Ubuntu just for ease of use and installed the packages as above using apt-get.

N.B: When installing PHP 5 make sure you get the additional PEAR package as this is essential for accessing MySQL using PHP.

If you've ever set up a MailServer on Windows it is usually a one application deal, run setup, follow the prompts and Bingo! your done. Not Linux though - oh no, in Linux land everything has to be infinitely configurable and therefore infinitely harder than is strictly necessary. In Windows you are sheltered from a lot of the things that Linux exposes you to. For example, to send SMTP mail, you at the very base level need a mail transport agent (MTA) - of your choice - in Windows you don't really see this in the same way so it spares you the pain.

I chose Postfix as my MTA as it is powerful and yet easy to configure. Sendmail is set up as default but isn't really as easy as Postfix. Postfix works pretty much straight out of the box, as does MySQL, although you do have to create an administrator user first. PHP was just as straightforward as was Apache.

I know most people probably know this already but Apache makes Linux boxes the best webservers, no, really, IIS is nothing more than a bloated piece of inflexible shite compared to Apache, I used the Virtualhost options and this allowed me to have a subdomain accessible for the mail server (mail.mycompany.com) rather than using www.mywebsite.com/mywebmail, this Apache does effortlessly and is something that is barely implemented in IIS.


After installing the groundwork I then installed Cyrus, as with all the other packages I used either the Synaptic package manager or apt-get, which is why I prefer Debian based distributions as it takes some of the hassle out of installing software in Linux. I configured Cyrus according to the guidelines on the Ubuntu website and soldiered onward.

After setting up the remaining features (MySQL, PHP5) I then installed Webmin. This really is an important feature as it lets you remotely administer your server over an http ssl link, it is extremely comprehensive and via their website you can install an additional plug-in to manage cyrus.

Finally I installed egroupware - I say installed, more unpacked into a suitable folder within Apache - The setup is handled entirely via the setup script and is very nice and polished and ensures any required modules e.g. PHP PEAR are installed. This done it was job complete, then it ran for a few hours and suddenly Cyrus wouldn't add users, no amount of fiddling would work. Tried various troubleshooting techniques, until finally the server started showing signs of a hardware problem, this is still outstanding as due to deadlines the only spare server I could find was a Windows one and I had to install on that. At this point if this happens to you grab the aforementioned sharp stick and repeatedly poke into the eye of your choice.

Setting up a similar setup on Windows is a little easier as you don't have to worry about the MTA, I do recommend however, stay away from the various pre-packed WAMP systems and install each application yourself as this makes it easier in the long run especially installing PEAR on Windows which lacks instructions. I also used hmailserver which is a great freeware mailserver.

So what did I learn from this? Linux is great, and the free software is extremely powerful, no client access licences as with Windows servers, however, it is more complicated than Windows to integrate the various elements, especially Cyrus which can only be described as massive, perhaps others would recommend Courier IMAP.

What it also made me wonder was that given the talent of those in the open source community that no-one has come up with anything to rival Active Directory and Exchange, LDAP is close to Active Directory but lacks simplicity and there is nothing close to Exchange, the web based groupware solutions are generally excellent, but still feel marginally unfinished in certain areas.

If Linux had these features, implemented easily with a group policy style feature it could beat Windows hands down. Which makes it more amazing that no-one from the commercial distributions has done this yet either! Red Hat and SUSE, this means you.


No comments: