Install Mail Server Postfix, Dovecot and SquirrelMail in CentOS or Redhat RHEL

Install Mail Server Postfix, Dovecot and SquirrelMail in CentOS or Redhat RHEL

Postfix Devocot

In this guide we will guide you how to install Mail Server with Postfix as SMTP Server, Dovecot for POP Server and SquirrelMail for webmail.

More details about Postfix Email and Mail server on Linux. Please have a look : http://linuxelearning.ithelpblog.com/

 

Step 1: Remove Sendmail if we had before installing Postfix

[root@ITHelpBlog ~]# yum erase sendmail

Step 2: Disable Iptables Firewall and SELinux on Centos/Redhat RHEL

http://ithelpblog.com/os/linux/redhat/centos-redhat/howto-disable-firewall-or-stop-iptables-on-centos-or-redhat-rhel/

http://ithelpblog.com/os/linux/redhat/howto-disable-or-enable-selinux-on-centos-6-4-redhat-rhel-6-4/

Step 3: Install postfix Mail Server

[root@ITHelpBlog ~]# yum install postfix

Step 4: Postfix Configuration and Restart postfix service.

Uncomment (delete #) these lines into your postfix configuration which mapped with your mail system

[root@ITHelpBlog ~]# vi /etc/postfix/main.cf
# Hostname for your email server

myhostname = ITHelpBlog.ithelpblog.com

# Domain for your email server

mydomain = ithelpblog.com

# From your domain

myorigin = $mydomain

# Listen in all interfaces

inet_interfaces = all

# Networks are allowed to use email server

mynetworks = 192.168.0.0/24, 127.0.0.0/8

# Destination allowed to send mail to, you can add more in the last

mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

# Home mail box setting

home_mailbox = Maildir/

[root@ITHelpBlog ~]# /etc/init.d/postfix restart
Shutting down postfix: [ OK ]
Starting postfix: [ OK ]
[root@ITHelpBlog ~]#
[root@ITHelpBlog ~]# chkconfig postfix on

Step 5 : Send one test email to one user in your Linux system

[root@ITHelpBlog kevin]# telnet localhost 25
Trying ::1…
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
220 ITHelpBlog.ithelpblog.com ESMTP Postfix
ehlo localhost
250-ITHelpBlog.ithelpblog.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<kevin>
250 2.1.0 Ok
rcpt to:<kevin>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
.
250 2.0.0 Ok: queued as D2897A1DFE
quit
221 2.0.0 Bye
Connection closed by foreign host.
[root@ITHelpBlog kevin]#

Step 6: Checking your email

[root@ITHelpBlog new]# cd /home/kevin/Maildir/new/
[root@ITHelpBlog new]# ls
1381577562.V802I60559M208787.ITHelpBlog
[root@ITHelpBlog new]# cat 1381577562.V802I60559M208787.ITHelpBlog
Return-Path: <kevin@ithelpblog.com>
X-Original-To: kevin
Delivered-To: kevin@ithelpblog.com
Received: from localhost (localhost [127.0.0.1])
by ITHelpBlog.ithelpblog.com (Postfix) with ESMTP id D2897A1DFE
for <kevin>; Sat, 12 Oct 2013 04:32:17 -0700 (PDT)
Message-Id: <20131012113232.D2897A1DFE@ITHelpBlog.ithelpblog.com>
Date: Sat, 12 Oct 2013 04:32:17 -0700 (PDT)
From: kevin@ithelpblog.com
To: undisclosed-recipients:;test
[root@ITHelpBlog new]#

You have installed Postfix SMTP Server on Centos/Redhat.

Step 7: Install Dovecot POP Server on Centos / Redhat

[root@ITHelpBlog new]# yum install dovecot
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.digipower.vn
* epel: mirrors.digipower.vn
* extras: mirrors.digipower.vn
* rpmforge: mirrors.digipower.vn
* updates: mirrors.digipower.vn
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dovecot.x86_64 1:2.0.9-5.el6 will be installed
–> Finished Dependency ResolutionDependencies Resolved=====================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================
Installing:
dovecot x86_64 1:2.0.9-5.el6 base 1.9 MTransaction Summary
=====================================================================================================================================================================================================
Install 1 Package(s)Total download size: 1.9 M
Installed size: 5.6 M
Is this ok [y/N]: y
Downloading Packages:
dovecot-2.0.9-5.el6.x86_64.rpm | 1.9 MB 00:11
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 1:dovecot-2.0.9-5.el6.x86_64 1/1
Verifying : 1:dovecot-2.0.9-5.el6.x86_64 1/1Installed:
dovecot.x86_64 1:2.0.9-5.el6Complete!
[root@ITHelpBlog new]#

Step 8: Configure Dovecot

Uncomment (delete #) to open imap,pop3 on Dovecot

[root@ITHelpBlog ~]# vi /etc/dovecot/dovecot.conf
# Protocols we want to be serving.
protocols = imap pop3 lmtp

Uncomment (delete #) to define Mail directory which we defined in Postfix configuration

[root@ITHelpBlog ~]# vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir

Uncomment and edit these line on 10-auth.conf to allow plain text authentication

[root@ITHelpBlog ~]# vi /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login

Edit these line to use postfix user and group for Dovecot

[root@ITHelpBlog ~]# vi /etc/dovecot/conf.d/10-master.conf
unix_listener auth-userdb {

#mode = 0600
user = postfix
group = postfix
}

Step 9: Restart Dovecot service and add dovecot into boot list

[root@ITHelpBlog ~]# /etc/init.d/dovecot restart
Stopping Dovecot Imap: [FAILED]
Starting Dovecot Imap: [ OK ]
[root@ITHelpBlog ~]#[root@ITHelpBlog ~]# chkconfig dovecot on

Step 10: Test connection and check mail by Dovecot

[root@ITHelpBlog ~]# telnet localhost pop3
Trying ::1…
Connected to localhost.
Escape character is ‘^]’.
+OK Dovecot ready.
user kevin
+OK
pass itkevin
+OK Logged in.
list
+OK 1 messages:
1 442
.
retr 1
+OK 442 octets
Return-Path: <kevin@ithelpblog.com>
X-Original-To: kevin
Delivered-To: kevin@ithelpblog.com
Received: from localhost (localhost [127.0.0.1])
by ITHelpBlog.ithelpblog.com (Postfix) with ESMTP id D2897A1DFE
for <kevin>; Sat, 12 Oct 2013 04:32:17 -0700 (PDT)
Message-Id: <20131012113232.D2897A1DFE@ITHelpBlog.ithelpblog.com>
Date: Sat, 12 Oct 2013 04:32:17 -0700 (PDT)
From: kevin@ithelpblog.com
To: undisclosed-recipients:;test
.
quit
+OK Logging out.
Connection closed by foreign host.
[root@ITHelpBlog ~]#

We have done Dovecot in our Mail server.

Step 11:  Install Epel repository on CentOS / Redhat

http://ithelpblog.com/os/linux/redhat/centos-redhat/how-to-install-epel-repository-on-centos-6-4-or-redhat-6-4-rhel/

Step 12: Install SquirrelMail by Epel Repository

[root@ITHelpBlog ~]# yum install squirrelmail
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.digipower.vn
* epel: mirrors.digipower.vn
* extras: mirrors.digipower.vn
* rpmforge: mirrors.digipower.vn
* updates: mirrors.digipower.vn
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package squirrelmail.noarch 0:1.4.22-3.el6 will be installed
–> Processing Dependency: php-mbstring for package: squirrelmail-1.4.22-3.el6.noarch
–> Processing Dependency: php for package: squirrelmail-1.4.22-3.el6.noarch
–> Running transaction check
—> Package php.x86_64 0:5.3.3-23.el6_4 will be installed
–> Processing Dependency: php-common(x86-64) = 5.3.3-23.el6_4 for package: php-5.3.3-23.el6_4.x86_64
–> Processing Dependency: php-cli(x86-64) = 5.3.3-23.el6_4 for package: php-5.3.3-23.el6_4.x86_64
—> Package php-mbstring.x86_64 0:5.3.3-23.el6_4 will be installed
–> Running transaction check
—> Package php-cli.x86_64 0:5.3.3-23.el6_4 will be installed
—> Package php-common.x86_64 0:5.3.3-23.el6_4 will be installed
–> Finished Dependency ResolutionDependencies Resolved=====================================================================================================================================================================================================
Package Arch Version Repository Size
=====================================================================================================================================================================================================
Installing:
squirrelmail noarch 1.4.22-3.el6 epel 4.1 M
Installing for dependencies:
php x86_64 5.3.3-23.el6_4 updates 1.1 M
php-cli x86_64 5.3.3-23.el6_4 updates 2.2 M
php-common x86_64 5.3.3-23.el6_4 updates 524 k
php-mbstring x86_64 5.3.3-23.el6_4 updates 455 kTransaction Summary
=====================================================================================================================================================================================================
Install 5 Package(s)Total download size: 8.4 M
Installed size: 35 MIs this ok [y/N]: y
Downloading Packages:
(1/5): php-5.3.3-23.el6_4.x86_64.rpm | 1.1 MB 00:09
(2/5): php-cli-5.3.3-23.el6_4.x86_64.rpm | 2.2 MB 00:20
(3/5): php-common-5.3.3-23.el6_4.x86_64.rpm | 524 kB 00:14
(4/5): php-mbstring-5.3.3-23.el6_4.x86_64.rpm | 455 kB 00:08
(5/5): squirrelmail-1.4.22-3.el6.noarch.rpm | 4.1 MB 01:23
—————————————————————————————————————————————————————————————————–
Total 62 kB/s | 8.4 MB 02:17
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Installing : php-common-5.3.3-23.el6_4.x86_64 1/5
Installing : php-cli-5.3.3-23.el6_4.x86_64 2/5
Installing : php-5.3.3-23.el6_4.x86_64 3/5
Installing : php-mbstring-5.3.3-23.el6_4.x86_64 4/5
Installing : squirrelmail-1.4.22-3.el6.noarch 5/5
Verifying : php-common-5.3.3-23.el6_4.x86_64 1/5
Verifying : squirrelmail-1.4.22-3.el6.noarch 2/5
Verifying : php-cli-5.3.3-23.el6_4.x86_64 3/5
Verifying : php-5.3.3-23.el6_4.x86_64 4/5
Verifying : php-mbstring-5.3.3-23.el6_4.x86_64 5/5

Installed:
squirrelmail.noarch 0:1.4.22-3.el6

Dependency Installed:
php.x86_64 0:5.3.3-23.el6_4 php-cli.x86_64 0:5.3.3-23.el6_4 php-common.x86_64 0:5.3.3-23.el6_4 php-mbstring.x86_64 0:5.3.3-23.el6_4

Complete!
[root@ITHelpBlog ~]#

 

Step 13: Configure Squirrelmail by run conf.pl, We can change options depend on our requirements.

[root@ITHelpBlog ~]# cd /usr/share/squirrelmail/config/
[root@ITHelpBlog config]#
[root@ITHelpBlog config]# ./conf.pl
SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Main Menu —
1. Organization Preferences
2. Server Settings
3. Folder Defaults
4. General Options
5. Themes
6. Address Books
7. Message of the Day (MOTD)
8. Plugins
9. Database
10. LanguagesD. Set pre-defined settings for specific IMAP serversC Turn color off
S Save data
Q QuitCommand >>

You can choose Option 1 to change Organization

SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Organization Preferences
1. Organization Name : ITHelpblog.com
2. Organization Logo : ../images/sm_logo.png
3. Org. Logo Width/Height : (308/111)
4. Organization Title : SquirrelMail $version
5. Signout Page :
6. Top Frame : _top
7. Provider link : http://squirrelmail.org/
8. Provider name : SquirrelMail

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >>

After that, You press R –> Choose Option 2 to configure Domain and Choose SMTP instead of Sendmail

SquirrelMail Configuration : Read: config.php (1.4.0)
———————————————————
Server Settings

General
——-
1. Domain : IThelblog.com
2. Invert Time : false
3. Sendmail or SMTP : SMTP

A. Update IMAP Settings : localhost:143 (uw)
B. Update SMTP Settings : localhost:25

R Return to Main Menu
C Turn color off
S Save data
Q Quit

Command >> S

Data saved in config.php
Press enter to continue…

Command >> Q
Exiting conf.pl.
You might want to test your configuration by browsing to
http://your-squirrelmail-location/src/configtest.php
Happy SquirrelMailing!

[root@ITHelpBlog config]#

Step 14: Configure httpd and restart httpd service

[root@ITHelpBlog ~]# chkconfig httpd on

Add these lines at the end of the httpd.conf file

[root@ITHelpBlog ~]# vi /etc/httpd/conf/httpd.conf
Alias /squirrelmail /usr/share/squirrelmail
<Directory /usr/share/squirrelmail>
Options Indexes FollowSymLinks
RewriteEngine On
AllowOverride All
DirectoryIndex index.php
Order allow,deny
Allow from all
</Directory>
[root@ITHelpBlog ~]# /etc/init.d/httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: apr_sockaddr_info_get() failed for ITHelpBlog
httpd: Could not reliably determine the server’s fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
[root@ITHelpBlog ~]#

Step 15: Create user for mail server

[root@ITHelpBlog ~]# useradd kevin.ngo
[root@ITHelpBlog ~]# passwd kevin.ngo
Changing password for user kevin.ngo.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@ITHelpBlog ~]#

Step 16: Running Configuration testing

http://x.x.x.x/squirrelmail/src/configtest.php

SquirrelMail Web Test Config

Step 17: Checking email by Webmail SquirrelMail

http://x.x.x.x/squirrelmail/

SquirrelMail Web

Step 18: Test sendmail and check mail by SquirrelMail

SquirrelMail sendmail

 

Send one test email from Kevin@ithelpblog.com and got email on kevin.ngo@ithelpblog.com.

 

SquirrelMail email got

Thanks for using IThelpblog.com.

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>