It is quite surprising that the opensolaris distribution does not come with an imap server in the standard repositories. I needed one and the simplest one to use is the one from UW IMAP.
I downloaded the source package from:
ftp://ftp.cac.washington.edu/imap/imap.tar.gz
The UW IMAP documentation is at http://www.washington.edu/imap/documentation/
I have GCC installed in my opensolaris 2009.6
$ which cc /usr/gnu/bin/cc
I followed the usual compile procedure:
$ tar -xvzf imap.tar.gz $ cd imap-2007e
I tried building it, but it failed although GCC is installed. So I thought of compiling it with Sun Studio. I installed the Sun Studio as follows:
$ pfexec pkg install developer/sunstudio12u1
Next I did some modifications to the src/osdep/unix/Makefile in the UW IMAPD. Following are the lines that need to be changed from the default ones.
CC=/usr/bin/cc SSLCERTS=/etc/openssl/certs SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib
Now run the make command. With UW IMAP you need to tell the system type for which you are building the imap, I tried ‘sol’ but it did not work for some reason. Next I tried ‘gso’ which is actually for GNU C in solaris, and it worked. Not sure why as I was using the Sun Studio compiler….
$ make gso
Next I needed to manually copy the imapd (I only wanted imapd and not pop as of now).
$ pfexec cp imap/imapd /usr/sbin/
Now add the inetd service entry
imap stream tcp nowait root /usr/sbin/imapd imapd imaps stream tcp nowait root /usr/sbin/imapd imapd
and add it to the SMF framework
$ pfexec inetconv
I received an error for the imaps entry:
inetconv: Error /etc/inet/inetd.conf line 42 invalid or inconsistent fields: service-name protocol
Upon checking I found that /etc/services file was missing the entry for the imaps protocol, so I added a line:
imaps 993/tcp
and imported the services to the SMF again. This was a success this time. Finally we need to enable the daemons, which can be done as follows:
$ pfexec svcadm enable svc:/network/imaps/tcp:default $ pfexec svcadm enable svc:/network/imap/tcp:default