SquirrelMail is an opensource webmail package written in PHP. It includes built-in PHP support for the IMAP and SMTP protocols . It has very few requirements and very easy to install and configure.
In this guide you will learn how to install and configure SquirrelMail step by step in Centos 7 and RHEL 7.
Step 1: First of all disable SELINUX using below command
this is not the best choice to disable the firewall because of security purposes, but we are doing this locally. in your case you allow the traffic vie the firewall-cmd rules.
# vi /etc/selinux/config
set SELINUX=disabled
save changes to file and quite
and reboot the server using below command
# reboot
Step 2: Install and Configure Postfix
You must install Epel Repository using below command
# yum install epel-release -y
Now install Postfix
# yum install postfix -y
Now make following changes to posfix file using below command at the end.
# vi /etc/postfix/main.cf
## Enter your hostname myhostname = osradar.localhost.local ## Enter your domain name mydomain = osradar.localhost.local inet_interfaces = all myorigin = $mydomain ##set your IP range mynetworks = 192.168.130.138/24, 127.0.0.0/8 ## set your mail direcotry home_mailbox = Maildir/ ## Now Go to line no 164 add $domain at the end mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
save changes to file and quite
Restart Postfix
# systemctl restart postfix # systemctl enable postfix
Step 3: Install and Configure Dovecot
# yum install dovecot # systemctl start dovecot # systemctl enable dovecot
Now modify below files one by one
make following changes at the end of file /etc/dovecot/dovecot.conf
# vi /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp
make following changes at the end of file /etc/dovecot/conf.d/10-mail.conf
# vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir
make following changes at the end of file /etc/dovecot/conf.d/10-auth.conf
# vi /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = yes
auth_mechanisms = plain login
make following changes to file /etc/dovecot/conf.d/10-master.conf
# vi /etc/dovecot/conf.d/10-master.conf
unix_listener auth-userdb {
#mode = 0600
user = postfix ## uncomment line 91 and enter postfix
group = postfix ## uncomment line 92 and enter postfix
Now restart Dovecot
# systemctl restart dovecot # systemctl enable dovecot
Step 4: Install and Configure Squirrelmail
First install and start apache service
# yum install httpd -y # systemctl start httpd # systemctl enable httpd
Now install Squirrelmail
# yum install squirrelmail -y
Now go to squirrelmail folder and configure it according to your server
# cd /usr/share/squirrelmail/config/ # ./conf.pl
After changes press S to save settings and press Q to exit.
Now add following lines at the end of httpd.conf file.
Note: If these lines are already added at the end of file SKIP this step.
# vi /etc/httpd/conf/httpd.conf
Alias /webmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
RewriteEngine On
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
save changes and quite
then restart Apache and dovecot service
# systemctl restart httpd # systemctl restart dovecot
Step 5: Create User and Access Webmail
# adduser osradar # passwd osradar
Finally access Webmail
http://server-ip/webmail
OR
http://yourdomainname/webmail
Error connecting to IMAP server: localhost.
111 : Connection refused
systemctl stop firewalld
you can use this link for troubleshooting:
https://www.linuxquestions.org/questions/linux-server-73/error-connecting-to-imap-server-localhost-4175540512/