{"id":4793,"date":"2014-10-13T13:43:11","date_gmt":"2014-10-13T18:43:11","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4793"},"modified":"2022-12-19T07:02:45","modified_gmt":"2022-12-19T13:02:45","slug":"setup-a-mailserver-with-exim-and-dovecot-on-a-centos-7-vps","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/setup-a-mailserver-with-exim-and-dovecot-on-a-centos-7-vps\/","title":{"rendered":"Setup a mailserver with Exim and Dovecot on a CentOS 7"},"content":{"rendered":"
The following article will guide you through the steps of installing and setting up a mailserver using Exim and Dovecot on a CentOS 7 VPS<\/a><\/strong>.<\/p>\n For this tutorial, we are using one of our CentOS-based managed VPS hosting<\/a> plans, pre-installed with minimal CentOS 7 OS.<\/p>\n What is Exim?<\/strong><\/p>\n Exim is a mail transfer agent (MTA) used on Unix-like operating systems. Exim is free software<\/strong> distributed under the terms of the GNU General Public License, and it aims to be a general and flexible mailer with extensive facilities for checking incoming e-mail.<\/p>\n What is Dovecot?<\/strong><\/p>\n Dovecot is an open source IMAP and POP3<\/a> email server<\/strong> for Linux\/UNIX-like systems, written with security primarily in mind. Dovecot is an excellent choice for both small and large installations.<\/p>\n <\/p>\n <\/p>\n First off, once you’re in a <\/p>\n Enable EPEL repository on the CentOS system using:<\/p>\n if you get a 404 not found, go at https:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/Packages\/e\/<\/a> and install the latest check if EPEL has been enabled on your system using:<\/p>\n once EPEL is enabled, install some useful tools using:<\/p>\n <\/p>\n Since we are going to use SSL in Dovecot and Exim, we need to have an SSL certificate. You can purchase and use one of our GeoTrust SSL Certificates<\/a> or you can create your own self-signed SSL certificate for Move the SSL certificate and key to <\/p>\n Install exim<\/strong> on the CentOS 7 virtual server using next, open find the transport section and edit the following:<\/p>\n scroll down the the authenticators section and add the following lines:<\/p>\n Start the EXIM MTA and add it to system’s startup using <\/p>\n Install Dovecot<\/strong> on the system using Once installed, configure SSL in Dovecot<\/strong> by editing the following:<\/p>\n next, allow plaintext authentication<\/strong> in configure mailbox location<\/strong> and type in Set-up Dovecot so that is allows Exim to use its authentication system in Start Dovecot and add it to system’s start-up using:<\/p>\n <\/p>\n <\/p>\n In this example, we are using Mozilla Thunderbird as email client to send\/receive emails. To configure the newly created email account, open Thunderbird enter your account details as shown in the pictures below:<\/p>\n <\/p>\n Enter your name, your email address and your password and click ‘Continue’.<\/p>\n <\/p>\n Configure your mail server parameters and click ‘Done’. That’s it.<\/p>\n <\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install a mailserver with Exim and Dovecot<\/strong>. They are available 24×7 and will take care of your request immediately.<\/p>\n PS<\/span>.<\/strong> If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":" The following article will guide you through the steps of installing and setting up a mailserver using Exim and Dovecot … <\/p>\nUPDATE THE SYSTEM<\/b><\/h4>\n
ssh<\/code> to your server and initiate a
screen<\/code> session using the command below:<\/p>\n
## screen -U -S exim-dovecot<\/pre>\n
screen<\/code> session, update your CentOS 7 VPS using
yum<\/code> as in:<\/p>\n
## yum update<\/pre>\n
ENABLE EPEL REPOSITORY<\/b><\/h4>\n
## yum install http:\/\/dl.fedoraproject.org\/pub\/epel\/7\/x86_64\/e\/epel-release-7-2.noarch.rpm<\/pre>\n
epel-release<\/code> rpm package available.<\/p>\n
## yum repolist<\/pre>\n
## yum install file perl-Mail-SPF.noarch openssl vim<\/pre>\n
GENERATE SSL CERTIFICATE<\/b><\/h4>\n
mail.mydomain.com<\/code> using the commands below:<\/p>\n
## mkdir \/root\/SSL\/mail.mydomain.com -p\r\n## cd \/root\/SSL\/mail.mydomain.com\r\n## openssl req -nodes -x509 -newkey rsa:2048 -keyout mail.mydomain.com.key -out mail.mydomain.com.crt -days 365<\/pre>\n
\/etc\/ssl<\/code> using:<\/p>\n
## cp mail.mydomain.com.key mail.mydomain.com.crt \/etc\/ssl\/<\/pre>\n
INSTALL AND CONFIGURE EXIM<\/b><\/h4>\n
yum<\/code>:<\/p>\n
## yum install exim<\/pre>\n
\/etc\/exim\/exim.conf<\/code> with your favorite editor and configure exim<\/strong> as follows:<\/p>\n
## cp \/etc\/exim\/exim.conf{,.orig}\r\n## vim \/etc\/exim\/exim.conf\r\n\r\nprimary_hostname = mail.mydomain.com\r\ndomainlist local_domains = @ : mydomain.com\r\n\r\ntls_advertise_hosts = *\r\ntls_certificate = \/etc\/ssl\/mail.mydomain.com.crt\r\ntls_privatekey = \/etc\/ssl\/mail.mydomain.com.key\r\n\r\nauth_advertise_hosts = *\r\n<\/pre>\n
local_delivery:\r\n driver = appendfile\r\n directory = $home\/Maildir\r\n maildir_format\r\n maildir_use_size_file\r\n delivery_date_add\r\n envelope_to_add\r\n return_path_add<\/pre>\n
dovecot_login:\r\n driver = dovecot\r\n public_name = LOGIN\r\n server_socket = \/var\/run\/dovecot\/auth-client\r\n server_set_id = $auth1\r\n\r\ndovecot_plain:\r\n driver = dovecot\r\n public_name = PLAIN\r\n server_socket = \/var\/run\/dovecot\/auth-client\r\n server_set_id = $auth1<\/pre>\n
systemctl<\/code><\/p>\n
## systemctl start exim\r\n## systemctl status exim\r\n## systemctl enable exim<\/pre>\n
INSTALL AND CONFIGURE DOVECOT<\/b><\/h4>\n
yum<\/code><\/p>\n
## yum install dovecot<\/pre>\n
## vim \/etc\/dovecot\/conf.d\/10-ssl.conf\r\n\r\nssl = yes\r\nssl_cert = <\/etc\/ssl\/mail.mydomain.com.crt\r\nssl_key = <\/etc\/ssl\/mail.mydomain.com.key<\/pre>\n
\/etc\/dovecot\/conf.d\/10-auth.conf<\/code>:<\/p>\n
## vim \/etc\/dovecot\/conf.d\/10-auth.conf\r\n\r\ndisable_plaintext_auth = no\r\nauth_mechanisms = plain login<\/pre>\n
\/etc\/dovecot\/conf.d\/10-mail.conf<\/code>:<\/p>\n
## vim \/etc\/dovecot\/conf.d\/10-mail.conf\r\n\r\nmail_location = maildir:~\/Maildir<\/pre>\n
\/etc\/dovecot\/conf.d\/10-master.conf<\/code><\/p>\n
## vim \/etc\/dovecot\/conf.d\/10-master.conf\r\n\r\nservice auth {\r\n...\r\n unix_listener auth-client {\r\n mode = 0660\r\n user = exim\r\n }\r\n}<\/pre>\n
## systemctl start dovecot\r\n## systemctl status dovecot\r\n## systemctl enable dovecot<\/pre>\n
CREATE SYSTEM USER<\/b><\/h4>\n
## useradd -m test\r\n## passwd test<\/pre>\n
CONFIGURE YOUR EMAIL CLIENT<\/b><\/h4>\n
LET US DO THIS FOR YOU?<\/b><\/h4>\n