How to Setup a Mail Server on FC6

Postfix + Davecot + Squirrelmail

This article explains how to setup a small mail server very fast on a Fedora Core 6 system. If you run a different distribution, you will have to use the package manager specific to your distro or search for and install the source packages. However, the configuration files are (usually) in the same locations. After following this tutorial, you will have:

- MTA: Postfix

- SMTP Authentification: Cyrus SASL

- IMAP and POP3: Dovecot

- Webmail: Squirrelmail

Installing packages

- Install the needed packages using YUM: Login as root and type the following command in a terminal:

# yum install postfix dovecot cyrus-sasl cyrus-sasl-devel cyrus-sasl-plain cyrus-sasl-lib squirrelmail

It doesn't matter if you have one or more packages already installed as yum will skip those and install only the missing ones.

- Change the default MTA: Type the following command in a terminal and choose postfix:

# system-switch-mail

- Add Postfix and Dovecot (and optionally httpd if you also chose to install the webmail) to startup: First, make sure they are in the services list:

# chkconfig --list | grep postfix

# chkconfig --list | grep dovecot

# chkconfig --add postfix (only if necessary)

# chkconfig --add dovecot (only if necessary)

Then add them for init levels 3 and 5, just in case you will change your init level:

# chkconfig --levels 35 postfix on

# chkconfig --levels 35 dovecot on

# chkconfig --levels 35 httpd on

Configuring Postfix

- Edit /etc/postfix/ and change the following values. These are the basic values that need editing in order to get you going really fast. Don't edit other values unless you know what you're doing:

myhostname =

This is only an example. Replace with your real Internet hostname or IP address. This will be the address that receives the mails.

mydomain =

Optional. Replace with your real domain name. This will be the domain your mails appear to be sent from. It can also be used as the destination.

inet_interfaces = all

This parameter specifies the address used for receiving mail.

mydestination = $myhostname, $mydomain, localhost, localhost.localdomain

This parameter specifies the list of domains that this machine considers itself the final destination for. You can enter here all the hostnames pointing at your IP address but DON'T specify the names of domains that this machine is backup MX host for.

home_mailbox = Maildir/

This specifies the path where the mail is stored. Mailbox will store the mailto /var/spool/mail/user or /var/mail/user, while Maildir/ (the / is required) will store the mail in each user's home directory (/home/user/Maildir)

- Save the file and restart Postfix with:

# service postfix restart

- Test it: Run the following command and check /root/Maildir/new for a message. You can read it using less, cat or a text editor:

# echo "Hello" | mail root

Configuring Dovecot

- Edit /etc/dovecot.conf and change the following line:

protocols = imap pop3

Don't leave the '#' in front

- Test and start Dovecot:

# echo "Hello" | mail username

'username' is a NON-ROOT user so you might have to create one.

- Start Apache for webmail and Dovecot:

# service httpd start

# service dovecot start

- Test it: Open your favorite browser and go to and log in with the NON-ROOT user and password. If everything worked out well, you should have a new mail in your inbox.

Enable SMTP Authentication

- Edit the /etc/postfix/ file and add these lines at the bottom of the file:

smtpd_sasl_auth_enable = yes

smtpd_sasl_security_options = noanonymous

smtpd_sasl_local_domain = $myhostname

broken_sasl_auth_clients = yes

smtpd_recipient_restrictions = permit_sasl_authenticated, check_relay_domains

- Start the saslauthd daemon and reload Postfix:

# service saslauthd start

# service postfix reload

Everything should work fine now. Open you favorite email client (Thunderbird, KMail etc) and set your account as follows:


Name: Your name

Email address:

Account password: your-linux-password-for-the-non-root-user

Server type: POP

Incoming server:


Description: Something

Server address:

Port: 25

Check "My SMTP server requires authentication"


Password: your-linux-password-for-the-non-root-user

Choose "PLAIN" for authentication type.

If you want to receive the root's mail to your non-root user maildir, edit the /etc/aliases file and uncomment the root line to look like this and reload Postfix.

root: non-root-user

That's it! Play around with the settings in and tweak them to your taste but always remember to make a backup in case something goes wrong.

Hot right now  ·  Latest news