Exim

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Tuto exim

In the following tutorial, we will teach you how to install and set up a mailserver using
Exim and Dovecot on a CentOS 7 VPS.
We will use a CentOS based VPS host plan for this tutorial; it will be pre-installed
with minimal CentOS 7 OS.

What is Exim?
Exim is a mail transfer agent (MTA) which is commonly used on Unix-like operating
systems. Exim is a free software, which is distributed under the terms of the GNU
(General Public License), and it’s trying to be a general and flexible mailer with
extensive facilities for verifying any incoming e-mail.

What is Dovecot?
Dovecot is an open-source IMAP and POP3 email server for Linux/UNIX-like
systems. It was written with security as its top priority. Dovecot is an amazing choice
for both small and large installations.

UPDATE THE SYSTEM


Begin by sshing to your server then start a screen session with the following
command:

## screen -U -S exim-dovecot

After you are in the screen session, update your CentOS 7 VPS with yum as follows:

## yum update
Copy

ENABLE EPEL REPOSITORY


With the following command, we can enable the EPEL repository on the CentOS
system:

## yum install http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-


release-7-2.noarch.rpm
Copy

If you receive a 404 not found error, use the following


link, https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/, then install the latest
epel-release rpm package available.
Confirm that EPEL has been enabled on your system using the following command:

## yum repolist
Copy

If EPEL is enabled, install some useful tools with this:

## yum install file perl-Mail-SPF.noarch openssl vim


Copy

GENERATE SSL CERTIFICATE


Because we will be using SSL in Dovecot and Exim, we will need to have an SSL
certificate. You may create your own self-signed SSL certificate for
mail.mydomain.com with the commands below:

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

With the command below, we will move the SSL certificate and key to /etc/ssl
directory:

## cp mail.mydomain.com.key mail.mydomain.com.crt /etc/ssl/


Copy

INSTALL AND CONFIGURE EXIM


Use the command below to install exim on the CentOS 7 VPS with yum:
## yum install exim
Copy

Now, we will open the file /etc/exim/exim.conf using your favorite editor, then
configure exim as follows:

## cp /etc/exim/exim.conf{,.orig}

## vim /etc/exim/exim.conf

primary_hostname = mail.mydomain.com

domainlist local_domains = @ : mydomain.com

tls_advertise_hosts = *

tls_certificate = /etc/ssl/mail.mydomain.com.crt

tls_privatekey = /etc/ssl/mail.mydomain.com.key

auth_advertise_hosts = *

Look for the transport section and modify the following:

local_delivery:

driver = appendfile

directory = $home/Maildir

maildir_format

maildir_use_size_file

delivery_date_add

envelope_to_add

return_path_add
Scroll down to the authenticators section and append the next lines:

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

Initiate the EXIM MTA then append it to the system’s startup using systemctl

## systemctl start exim


## systemctl status exim
## systemctl enable exim
Copy

INSTALL AND CONFIGURE DOVECOT


Next, we will install Dovecot on the system using yum:

## yum install dovecot


Copy

After it’s installed, configure SSL in Dovecot by modifying the following:


## vim /etc/dovecot/conf.d/10-ssl.conf

ssl = yes

ssl_cert = </etc/ssl/mail.mydomain.com.crt

ssl_key = </etc/ssl/mail.mydomain.com.key

Next we will allow plaintext authentication in /etc/dovecot/conf.d/10-auth.conf:

## vim /etc/dovecot/conf.d/10-auth.conf

disable_plaintext_auth = no

auth_mechanisms = plain login

Configure the mailbox location and enter this in /etc/dovecot/conf.d/10-mail.conf:

## vim /etc/dovecot/conf.d/10-mail.conf

mail_location = maildir:~/Maildir

Now we’ll set up Dovecot so it grants Exim the ability to use its authentication system
in

/etc/dovecot/conf.d/10-master.conf

## vim /etc/dovecot/conf.d/10-master.conf

service auth {

...

unix_listener auth-client {

mode = 0660
user = exim

Start up Dovecot and append it to the system’s start-up using the following:

## systemctl start dovecot


## systemctl status dovecot
## systemctl enable dovecot
Copy

Create a System User:

## useradd -m test
## passwd test
Copy

You might also like