This information is deprecated. The dovecot mail server is now available as ipkg for installation on your slug.
I leave the information here out of sentiment and who knows, it might come in handy for someone…
As many people, I’ve been running an old PC with a large hard drive as local file and mail server.
When Linksys released their cute little NSLU2, and it became clear that it was possible to load that device with an alternative open firmware, I thought it was time to shut the 8-year old AMD K6 down.
I’ll describe the steps I followed to install an IMAP server with the combination of dovecot, fetchmail, and procmail on the NSLU2.
Installing the alternative firmware on the NSLU2
After unpacking and booting the NSLU2 (pet named ‘slug’ by the developers of the alternative firmware), I quickly realised that my USB enclosure was not detected by the Linksys stock firmware.
Well, I was planning to reflash it with the unslung firmware anyway, so off we went.
After install (be sure to exactly follow the installation instructions), the disk in the USB enclosure was picked up and off we went…
So, as step 1: intall the unslung firmware on your slug.
Install openssl
Since we don’t want to send our password and mails in cleartext over the network, we’ll compile dovecot with IMAP support. Installing openssl is trivial:
> ipkg install openssl
Building dovecot
Dovecot is a small and secure mail server, perfectly suited to be run on the slug. Since there is no ipkg available for dovecot, we first need to build it.
I tried to cross compile the package, but I ran into problems with the ‘configure’ script that tried to run some tests that required code execution. This can of course not be done when cross compiling.
I decided to go for the native compilation package that allows to build applications on the slug itself.
SSH into the slug and install the native compilation package with:
> ipkg install unslung-devel
Then download the latest stable release of dovecot, extract in and compile it on the slug:
> wget http://www.dovecot.org/nightly/stable/dovecot-stable-latest.tar.gz
> tar -zxvf dovecot-stable-latest.tar.gz
> cd dovecot-1.0-stable
> CPPFLAGS=-I/opt/include LDFLAGS=-L/opt/lib ./configure –without-pop3d –prefix=/opt –disable-ipv6
> make
> make install
Installing ldconfig
Since the binaries of dovecot are linked against the openssl library, we need ldconfig to resolve the fact that the shared openssl libs are located in /opt/lib .
> ipkg install ldconfig
Installing fetchmail and procmail
Fetchmail will be used to get mails from an external mail server, and procmail will distribute the mails locally to the correct inboxes.
> ipkg install fetchmail
> ipkg install procmail