Installing Exim on Cent OS 6.x / 7.x

Operating System: Cent os 6.x / 7.x
Hostname: hostname [not a registered domain name, but you can use any domain name if you can set it as local domain in /etc/hosts]

Centos includes Postfix as default MTA in the repo. If you wish to install Exim on your Virtual machine or server, you need to enable third party packages in your repo, to do so:
yum R1;enablerepo=extras install epel-release

Update your yum repo:
yum update

Install Exim from repo:
yum install exim

Enable Exim on server startup:
systemctl enable exim.service
OR
systemctl enable exim

Start Exim:
systemctl start exim

Install addtional tools such as vim, SPF libraries & openssl to setup a secure mail server:
yum install file perl-Mail-SPF.noarch openssl vim

Assuming you have set a hostname for your virtual machine, let’s generate certificates for your hostname:

mkdir /root/SSL/mail.hostname -p
cd /root/SSL/mail.hostname/
openssl req -nodes -x509 -newkey rsa:2048 -keyout mail.hostname.key -out mail.hostname.crt -days 365

Let’s move Certificates to /etc/ssl:
cp mail.hostname.crt mail.hostname.key /etc/ssl/

Let’s keep a backup for exim.conf before we edit the original:
cp /etc/exim/exim.conf{,.orig}

Edit exim.conf file [look for following fields & replace hostname with your hostname.com]
vi /etc/exim/exim.conf

primary_hostname = hostname
domainlist local_domains = @ : hostname
tls_certificate = /etc/ssl/mail.hostname.crt
tls_privatekey = /etc/ssl/mail.hostname.key

Look for: local_delivery & add /edit following lines:

driver = appendfile
delivery_date_add
envelope_to_add
return_path_add
directory = $home/Maildir
maildir_format
maildir_use_size_file
group = mail
mode = 0660

Let’s add dovecot as mailbox authenticator with Exim so dovecot can IMAP / POP emails:

dovecot_login:
driver = dovecot
public_name = LOGIN
server_socket = /var/run/dovecot/auth-client
server_set_id = $auth1


dovecot_plain:
driver = dovecot
public_name = PLAIN
server_socket = /var/run/dovecot/auth-client
server_set_id = $auth1

Now, we need to install IMAP software which is Dovecot:

yum install dovecot
systemctl start dovecot
systemctl enable dovecot

Configuring dovecot & ask to listen to specific ports & use Exim as authSMTP:
Adding SSL for dovecot:
Command: vim /etc/dovecot/conf.d/10-ssl.conf

ssl_cert = </etc/ssl/mail.hostname.crt
ssl_key = </etc/ssl/mail.hostname.key

Disable plaintext authentication:
Command: vim /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no

Setup mailbox path:

vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir

Setup Dovecot to auth with Exim:
vim /etc/dovecot/conf.d/10-master.conf


unix_listener auth-userdb {
mode = 0660
user = exim
}

Send a test email:
Command: mail -s “Test Email” username@hostname.com < /dev/null
and check your exim log.

That’s all! We now have installed Exim & Dovecot and configured as they both work together as IMAP / SMTP servers for your machine.

  • exim install, install exim, install exim on cent os, cent os 6.x, cent os 7.x, exim on cent os
  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

How to enable the html display for horde webmail?

This step is only for VPS managed severs and cpanel/whm setup. Log into server via shell:vi...

Important Exim commands & Cheat sheet to manage your Email Queues via Secure Shell

Exim is an open source mail transfer agent (MTA), used in Linux based OS & is an email...

Best way to fight & prevent email spamming on your server

This article provides instruction on prevening email spamming from your hosting account or from...

How to clear or unmount cPanel jailed virtfs mounts?

You may see /home/virtfs taking a lot of disk space on the server or you may see a lot of virtfs...

Outlook, Thunderbird and Mobile Email Client Settings

In order to send and recieve emails using Email Clients, please make sure to use the following...

Powered by WHMCompleteSolution