Posts Tagged ‘imap’

How to setup a personal mail server with Postfix and Dovecot

May 21st, 2013 Comments off

The instructions were tested on Fedora 17, most RedHat distributions should be very similar and it should at least give you an idea for other distros.

Install the required software:

# yum install postfix dovecot

Check that Postfix supports Dovecot SASL:

# postconf -a

Edit /etc/postfix/, add at the top of the file:

inet_interfaces = all
# list of domains receiving mails on this server, remember to set the MX record in their DNS
virtual_alias_domains =,
virtual_alias_maps = hash:/etc/postfix/virtual
mynetworks_style = host
# add the ips that are always allowed to relay to mynetworks list
mynetworks =
# use reject_rbl_client to specify RBLs (simple anti-spam measure)
smtpd_recipient_restrictions =

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

Create/edit /etc/postfix/virtual and add a couple of email aliases: myaccount myaccount

Compile the aliases table:

# postmap /etc/postfix/virtual

Restart the postfix service, for minor changes in the configuration file you can also use:

# postfix reload

Uncomment the postfix smtp-auth settings in /etc/dovecot/conf.d/10-master.conf

# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666

Edit /etc/dovecot/conf.d/10-mail.conf and set mail_location:

mail_location = mbox:~/mail:INBOX=/var/mail/%u

Restart dovecot.

This should be enough for a couple of email accounts for your domains, accessible by POP3 and IMAP.

Categories: Linux Tags: , , ,