6 C
Texas

How to Install Dovecot on CentOS 8

Today we are going to learn that how to install Dovecot on CentOS 8. Dovecot is an open source service for IMAP & POP3. It is fast and secure mail server here we will install and configure it on our CentOS 8 system. For easy installation just follow the below steps.

Step 1: Update Your System

As usual we do, first of all update the system to have the latest packages.

sudo yum -y update

Step 2: Install Dovecot on CentOS 8

As the Dovecot package is available on AppStream yum repo, so simply hit the below command to install it on CentOS*8.

- Advertisement -
sudo dnf -y install dovecot

Output:

[sabi@localhost ~]$ sudo dnf -y install dovecot
Last metadata expiration check: 0:00:54 ago on Thu 04 Jun 2020 10:29:57 AM EDT.
Dependencies resolved.
Package Arch Version Repository Size
Installing:
dovecot x86_64 1:2.2.36-10.el8 AppStream 4.6 M
Installing dependencies:
clucene-core x86_64 2.3.3.4-31.20130812.e8e3d20git.el8 AppStream 596 k
Transaction Summary
Install 2 Packages
Total download size: 5.2 M
Installed size: 21 M
Downloading Packages:
(1/2): clucene-core-2.3.3.4-31.20130812.e8e3d20 5.1 kB/s | 596 kB 01:56
(2/2): dovecot-2.2.36-10.el8.x86_64.rpm 27 kB/s | 4.6 MB 02:55
Total 30 kB/s | 5.2 MB 02:56
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Preparing : 1/1
Installing : clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_ 1/2
Running scriptlet: dovecot-1:2.2.36-10.el8.x86_64 2/2
Installing : dovecot-1:2.2.36-10.el8.x86_64 2/2
Running scriptlet: dovecot-1:2.2.36-10.el8.x86_64 2/2
Verifying : clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_ 1/2
Verifying : dovecot-1:2.2.36-10.el8.x86_64 2/2
Installed:
dovecot-1:2.2.36-10.el8.x86_64
clucene-core-2.3.3.4-31.20130812.e8e3d20git.el8.x86_64
Complete!

Step 3: Configuring Dovecot on CentOS8

As you know the installation of Dovecot is not just necessary for its proper working you’ve to configure it to work properly. Here I’ll provide you the fast and reliable configuration so that you face no issue during the installation and configuration of Dovecot.

Edit the /etc/dovecot/dovecot.conf file and un-comment the below line.

sudo nano /etc/dovecot/dovecot.conf
###Uncomment the below lines given.###
protocols = imap pop3 lmtp
listen = *, ::

Then save and close the file.

After it edit the /etc/dovecot/conf.d/10-auth.conf file for authentication purposes & update it to the similar below given.

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

Now, configure the location of the mail server. Make sure to provide the accurate location.

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

After it edit the /etc/dovecot/conf.d/10-master.conf file and provide the user name as well as group name of the mail server.

unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix
}

Then finally edit the SSL Configuration file located under /etc/dovecot/conf.d/10-ssl.conf and edit it to use your ownSSL. If you’ve not any SSL certificate it will use it’s own.

ssl = required
ssl_cert =

Step 4: Manage Dovecot Service

To start the Dovecot service on the boot of system hit the below command in your terminal.

sudo systemctl enable dovecot.service

For start, stop and restart hit the below commands respectively.

sudo systemctl start dovecot.service
sudo systemctl stop dovecot.service
sudo systemctl restart dovecot.service

Verify the status of the Dovecot by hitting the below command.

sudo systemctl status dovecot.service

Output:

[sabi@localhost ~]$ sudo systemctl status dovecot.service
● dovecot.service - Dovecot IMAP/POP3 email server
Loaded: loaded (/usr/lib/systemd/system/dovecot.service; disabled; vendor pr>
Active: active (running) since Thu 2020-06-04 10:47:29 EDT; 2s ago
Docs: man:dovecot(1)
http://wiki2.dovecot.org/
Process: 36951 ExecStart=/usr/sbin/dovecot (code=exited, status=0/SUCCESS)
Process: 36942 ExecStartPre=/usr/libexec/dovecot/prestartscript (code=exited,>
Main PID: 36952 (dovecot)
Tasks: 4 (limit: 4884)
Memory: 11.1M
CGroup: /system.slice/dovecot.service
├─36952 /usr/sbin/dovecot
├─36959 dovecot/anvil
├─36960 dovecot/log
└─36962 dovecot/config
Jun 04 10:47:29 localhost.localdomain systemd[1]: Starting Dovecot IMAP/POP3 em>
Jun 04 10:47:29 localhost.localdomain dovecot[36951]: Warning: Corrected permis>
Jun 04 10:47:29 localhost.localdomain dovecot[36951]: master: Warning: Correcte>
Jun 04 10:47:29 localhost.localdomain systemd[1]: Started Dovecot IMAP/POP3 ema>
Jun 04 10:47:29 localhost.localdomain dovecot[36952]: master: Dovecot v2.2.36 (>

Step 5: Testing Configuration

To test the configuration create a user on your system and install the muatt to connect to the mailbox using imaps protocol.

sudo dnf install mutt

After it connect to the mail box by hitting

mutt -f imaps://sabi@localhost

Note: Replace the username “sabi” with your own username.

Accept the certificate when prompted. And provide your credentials to see the emails of your account.

Step 6: Allow Firewall Access

To access the server from remote machine, don’t forget to allow the firewall.

Here are the ports used by IMAP,IMAPS,POP3 and POP3S.

  • IMAP – 143
  • IMAPS – 993
  • POP3 – 110
  • POP3S – 995

To add firewall rules hit the below commands.

sudo firewall-cmd --add-service={pop3,imap} --permanent
sudo firewall-cmd --add-service={pop3s,imaps} --permanent

And then reload the changes to take effect.

sudo firewall-cmd --reload

So, this is how you can install dovecot on CentOS 8 and configure it.

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article