Mail server on CentOS 7. Installing Dovecot + Exim + Roundcube

In this article, we will install and configure a mail server using Exim and Dovecot on a 7.5 VPS using the Roundcube web interface.

We use a CentOS-based VPS for this; pre-installed with minimal CentOS 7.5 

What is Exim?

Exim is a mail transfer agent (MTA) that is commonly used on Unix-like operating systems. Exim is free distributed under the terms of the GNU (General Public License) and is a versatile and flexible tool with extensive features for checking incoming emails.

What is Dovecot?

Dovecot is an open-source IMAP and POP3 mail server for Linux/UNIX-like systems. has been the cornerstone of this product’s focus on flexibility and speed.

Dovecot is a great choice for both small and large email systems.

What is Roundcube?

Roundcube is a web-based email interface that provides the ability to work with your mailboxes using  IMAP  and  SMTP. The application has powerful functionality and is comparable in capabilities to desktop email clients such as  Outlook Express  or  Mozilla Thunderbird

Preparation and setup

Let’s connect an additional EPEL repository, as follows:

# yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# yum update
To check that the newly added EPEL repository has connected to our system, enter:
# yum repolist
Then install the following tools:
# yum install file perl-Mail-SPF.noarch openssl nano

Exim installation and configuration

# yum install exim

We will now open the /etc/exim/exim.conf file using your favorite editor, backing it up first, and reshaping it as follows:

# cp /etc/exim/exim.conf{,.original}
# nano /etc/exim/exim.conf

primary_hostname = mail.mypostdomain.com
list local_domains = @ : mypostdomain.com
tls_advertise_hosts = *
tls_certificate = /etc//mail.mypostdomain.com.crt
tls_privatekey = /etc/ssl/mail.mypostdomain.com.key
auth_advertise_hosts = *

Let’s pay attention to the lines tls_certificate and tls_privatekey, we will use the Certificate, you can order it on our website and find the necessary in the Personal Account – SSL  

Next, let’s move on to the transport section and bring it to the form:

local_delivery:
driver = append file
directory = $home/Maildir
maildir_format
maildir_use_size_file
delivery_date_add
envelope_to_add
return_path_add

Next, in the authentication section, add the following 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

Start exim , and add it to system using systemctl: 

# systemctl start exim
# systemctl status exim
# systemctl enable exim

Dovecot setup

# yum install dovecot
After installation, edit the configuration files:

# nano /etc/dovecot/conf.d/10-ssl.conf
ssl = yes
ssl_cert = /etc/ssl/mail.mypostdomain.com.crt
ssl_key = /etc/ssl/mail.mypostdomain.com.key

# nano /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login

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

# vim /etc/dovecot/conf.d/10-master.conf
service auth {

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

Run dovecot , and add it to system startup using systemctl. 

# systemctl start dovecot
# systemctl status dovecot
# systemctl enable dovecot

RoundCube

LAMP
# yum  install roundcubemail

# nano /etc/httpd/conf.d/roundcube.conf

#
# Round Cube is a browser-based multilingual IMAP client
#

Alias /roundcube /usr/share/roundcubemail
Alias /webmail /usr/share/roundcubemail


Options none
AllowOverride Limit
Require all granted


Options none
AllowOverride Limit
Require all granted

# Those directories should not be viewed by Web clients.

Order Allow,Deny
Deny from all


Order Allow,Deny
Deny from all

# service httpd restart

# mysql -u root -p
mysql> CREATE DATABASE dbroundcube;
mysql> CREATE USER userroundcube@localhost IDENTIFIED BY ‘password’;
mysql> GRANT ALL PRIVILEGES on dbroundcube.* to userroundcube@localhost ;
mysql> FLUSH PRIVILEGES;
mysql> quit

http://mail.mypostdomain.com/roundcube/installer

POP3: 110
IMAP: 143
SMTP: 25

 

Welcome to the world of DomainRooster, where roosters (and hens) rule the roost! We're a one-stop shop for all your entrepreneurial needs, bringing together domain names and website hosting, and all the tools you need to bring your ideas to life. With our help, you'll soar to new heights and hatch great success. Think of us as your trusty sidekick, always there to lend a wing and help you navigate the sometimes-complex world of domain names and web hosting. Our team of roosters are experts in their fields and are always on hand to answer any questions and provide guidance. So why wait? Sign up today and join the ranks of the world's greatest entrepreneurs. With DomainRooster, the sky's the limit! And remember, as the saying goes, "Successful people do what unsuccessful people are not willing to do." So don't be afraid to take that leap of faith - DomainRooster is here to help you reach for the stars. Caw on!