Wednesday, October 7, 2009

configuring Dovecot using source code

Thanks to Sayan, I got a chance to revise my knowledge on configuring dovecot using source code.

So this to start with, download the dovecot source code from here. Then untar the tar ball in your /usr/src folder.

$ cd /usr/src
$ tar xvfz

Then after you the source code has been untared, execute the configure file along with necessary arguments. I configured dovecot to use pam and passwd for authentication. Hence I used the following command

$ ./configure --with-passwd --with-pam

When I executed this command, configure failed as I got an error: "libpam not found". This was because I had not installed libpam0g-dev package. After I installed it using apt-get and again I tried the above command. It finished with no error.

Then execute the command
$ make

and

$ make install

After make and make install command are successful, Dovecot is installed in /usr/local

Now you need to create a dovecot.conf file in /ust/local/etc which will have all the configuration for the dovecot. For the convienience of users, a sample dovecot-example.conf file is already present in the directory and for testing purpose you can just rename it to dovecot.conf file.

You will have to do some necessary changes in the dovecot.conf file.

First you need to select what protocols should be maintained by dovecot. YOu can select imap,pop3,imaps and pop3s.(However if you want pop3s and imaps protocols, then you will have to configure dovecot with --enable-SSL option).

protocols = imap imaps pop3 pop3s

Adding above line in the conf file will enable all the four protocols.

Then you need to add a log_path which is the path of log file.

log_path = /var/log/dovecot.log

You also need to specify a login_user. Dovecot uses this unprivileged user for internal purposes (for login processes).

login_user = dovecot

Also you need to mention the mail location from where dovecot can fetch mails.

mail_location = maildir:~/Maildir

This should be enough for your donvecot.conf file.

Now try to execute the command

$ dovecot

You might just expect a warning. If you get some error, then you can find check the log file.

Now confirm that all the ports are open by executing nmap localhost command.

$ nmap localhost

Note that imap port no. is 143, pop3 port no. is 110, imaps port no. is 993, pop3s port no. is 995

YOu should be able to see these ports in the output of nmap command.