I have already posted on Zimbra mail service, now i am going to share  how to install and configure postfix mail server using devocot and squrell mail service, suggest you go into detail study of post fix and other mail server before going to install and use, and different mail protocol i will publish all these on my later edition.Here i  am  going to tell you some future of post fix mail server,and why we choose postfix.

What is post fix?
Postfix is an open-source Mail Transport Agent (MTA), which supports protocols like LDAP, SMTP AUTH (SASL), and TLS.


Operating systems:

Postfix runs on every Unix and Linux Operating system,It is the default MTA of Linux and Ubuntu operating systems.To install Post fix first we need to uninstall default post fix.



Architecture:




Postfix consists of a combination of server programs that run in the background, and client programs that are invoked by user programs or by system administrators.In this way post fix is very helpful we can use post fix with outlook,squrelmail or any oyher front end application running post fix on backend, here are other post fix feature.



Feature:

  • Postfix mail server is very light we can use and install it even on 4kb ram avilable.
  • Intergate with all mail system.
  • Flexibility.
  • Compatability
Installation:

Before installing make sure that you have system hostname with staticip also 
firewall, and selinux is not working you can check with these command:



[root@localhost keenable]# /etc/init.d/iptables stop

[root@localhost keenable]#/etc/init.d/ip6tables stop

[root@localhost keenable]#getenforce

[root@localhost keenable]#setenforce 0





Postfix is installed by default. If it is not installed, use the below command to install postfix.
[root@localhost keenable]# yum install postfix*

Configration:

open the postfix config file /etc/postfix/main.cf find the below lines and then as shown below.
[root@localhost keenable]#vim /etc/postfix/main.cf
[hostname=root@localhost keenable]###line no 75 - uncomment and enter your host name
mydomain = example.com##line no 83 - uncomment and enter your domain name
myorigin = $mydomain ##line no 99 - uncomment
inet_interfaces = all ##line no 116 - change to all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
        mail.$mydomain, www.$mydomain, ftp.$mydomain ##line no 164 - add $domain at the end
mynetworks = 192.168.2.0/24, 127.0.0.1/8 ##line no 264 - uncomment and add your network range
home_mailbox = Maildir/ ##line no 419 - uncomment
:wq!

Restart the postfix server.
[root@localhost keenable]#/etc/init.d/postfix restart
  * Stopping Postfix         [ok]                                                                      [ OK ] 
 * Starting Postfix          [ok]
[root@localhost keenable]#chkconfig postfix on

Test postfix:
The commands shown in bold letters should be entered by the user. 
Note: The dot after the test command is important.
[root@localhost keenable]# telnet localhost smtp
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 squid.example.com ESMTP Postfix
ehlo localhost
250-squid.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail from:<abdul.qayoom@fosteringlinux.com>
250 2.1.0 Ok
rcpt to:<qayoom2009@gmail.com>
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
test
.
250 2.0.0 Ok: queued as F1E05642F0
250 2.0.0 Ok: queued as 117113FF18
quit
221 2.0.0 Bye
Connection closed by foreign host.

Check Mail:
Navigate to the user mail directory and check for the new mail. 
[root@localhost keenable]# cd /home/qayoom2009/Maildir/new/
[root@localhost keenable]#ls
1370754819.Vfd01I62M508545.squid.example.com
[root@localhost keenable]#cat 1370754819.Vfd01I62M508545.keen.example.com 
Return-Path: <root@example.com>
X-Original-To: abdul.qayoom@fosteringlinux.com
Delivered-To: qayoom2009@gmail.com.com
Received: by keen.example.com (Postfix, from userid 0)
 id 71C0F64B6B; Sun,  9 Jun 2018 10:43:39 +0530 (IST)
Date: Sun, 09 Jun 2018 10:43:39 +0530
To: qayoom2009@gmail.com.com
Subject: hello
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20130609051339.71C0F64B6B@keen.example.com>
From: root@example.com (root)

test
Thats it. Postfix working now.


Install Dovecot:
[root@localhost keenable]#yum install dovecot*
Then configure devocot
Open the dovecot config file /etc/dovecot/dovecot.conf. Find and uncomment the line as shown below.
[root@localhost keenable]#vim /etc/dovecot/dovecot.conf
uncomment the flow line
protocols = imap pop3 lmtp
[root@localhost keenable]# vim /etc/dovecot/conf.d/10-mail.conf
uncomment the flow line
mail_location = maildir:~/Maildir ##line no 24 - uncomment
[root@localhost keenable]# vi /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no ##line no 9 - uncomment and change from yes to no.
auth_mechanisms = plain login ##line no 97 - add the text "login"
[root@localhost keenable]#vim /etc/dovecot/conf.d/10-master.conf
unix_listener auth-userdb {
    #mode = 0600
    user = postfix ##line no 83 - uncomment and enter postfix
    group = postfix ##line no 84 - uncomment and enter postfix
[root@localhost keenable]# /etc/init.d/dovecot restart 
Stopping Dovecot Imap:                                     [  OK  ]
Starting Dovecot Imap:                                     [  OK  ] 
[root@localhost keenable]#chkconfig dovecot on
Test Dovecot:
[root@localhost keenable]#telnet localhost pop3
Trying ::1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.


USER qayoom2009
+OK
Pass aa
+OK Logged in.
list
+OK 5 messages:
1 428
2 798
3 417
4 794
5 507
.
retr 1
+OK 428 octets
Return-Path: <abdul.qayoom@fosteringlinux.com>
X-Original-To: test
Delivered-To: qayoom2009@fosteringlinux.com
Received: from localhost (localhost [IPv6:::1])
by squid.example.com (Postfix) with ESMTP id 2804464701
 for <test>; Sat,  8 Jun 2013 18:26:09 +0530 (IST)
Message-Id: <20130608125719.2804464701@keen.example.com>
Date: Sat,  8 Jun 2013 18:26:09 +0530 (IST)
From: abdul.qayoom@fosteringlinux.com
To: undisclosed-recipients:;

test

.
quit
+OK Logging out.
Connection closed by foreign host.
Test imap:
[root@localhost keenable]#telnet localhost imap

Trying ::1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE STARTTLS AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
. login qayoom2009 qayoom
. OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in
. list "" "*"
* LIST (\HasChildren) "." "INBOX"
* LIST (\HasNoChildren) "." "INBOX.Trash"
* LIST (\HasNoChildren) "." "INBOX.Sent"
* LIST (\HasNoChildren) "." "INBOX.Drafts"
. OK List completed.
. select "INBOX"
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 5 EXISTS
* 0 RECENT
* OK [UNSEEN 3] First unseen.
* OK [UIDVALIDITY 1370696717] UIDs valid
* OK [UIDNEXT 6] Predicted next UID
* OK [HIGHESTMODSEQ 1] Highest
. OK [READ-WRITE] Select completed.
. fetch 1 all
* 1 FETCH (FLAGS (\Seen) INTERNALDATE "08-Jun-2013 18:27:55 +0530" RFC822.SIZE 428 ENVELOPE ("Sat, 8 Jun 2013 18:26:09 +0530 (IST)" NIL ((NIL NIL "test" "example.com")) ((NIL NIL "qayoom2009" "example.com")) ((NIL NIL "qayoom2009" "example.com")) ((NIL NIL "undisclosed-recipients" NIL)(NIL NIL NIL NIL)) NIL NIL NIL "<20130608125719.2804464701@keen.example.com>"))
. OK Fetch completed.
. fetch 1 body[]
* 1 FETCH (BODY[] {428}
Return-Path: <abdul.qayoom@fosteringlinux.com>
X-Original-To: test
Delivered-To: qayoom2009@fosteringlinux.com
Received: from localhost (localhost [IPv6:::1])
 by squid.example.com (Postfix) with ESMTP id 2804464701
 for <test>; Sat,  8 Jun 2013 18:26:09 +0530 (IST)
Message-Id: <20130608125719.2804464701@squid.example.com>
Date: Sat,  8 Jun 2013 18:26:09 +0530 (IST)
From: abdul.qayoom@fosteringlinux.com.com
To: undisclosed-recipients:;

test

)
. OK Fetch completed.
. logout
* BYE Logging out
. OK Logout completed.
Connection closed by foreign host.
Install Squirrelmail:
Download the squrellmail from any link

[root@localhost keenable]http://citylan.dl.sourceforge.net/project/squirrelmail/stable/1.4.22/squirrelmail-webmail-1.4.22.tar.gz

Or install with yum install
[root@localhost keenable]tar -xvzf squirrelmail-webmail-1.4.22.tar.gz
[root@localhost keenable]mkdir webmail
[root@localhost keenable]mv squirrelmail-webmail-1.4.22 webmail
[root@localhost keenable]cd webmail
[root@localhost keenable] ./configure
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. Languages

D.  Set pre-defined settings for specific IMAP servers

C   Turn color on
S   Save data
Q   Quit

Command >> 2

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

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

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

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

Command >> S to save the configuration
command >> quit
Install Httpd:
[root@localhost keenable]#yum install httpd*
[root@localhost keenable]# vim /etc/httpd/conf/httpd.conf
<VirtualHost 192.168.2.100:80>
ServerAdmin root@squid.example.com
ServerName redhat.com
DocumentRoot /var/www/html/webmail
</VirtualHost>
[root@localhost keenable]#/etc/init.d/httpd restart
[root@localhost keenable]#chkconfig httpd on
Check the Browser  
 http://192.168.2.100/webmail
===================Then you will Face the following Error=================================================
Error opening ../data/default_pref
Could not create initial preference file!
/var/local/squirrelmail/data/ should be writable by user apache
Please contact your system administrator and report this error.

============================Now Solve this Problem Like this===============
The data directory is used for storing user preferences, like signature, name and theme. You need to create this directory yourself.
This directory must be writable by the webserver. If your webserver is running as the user "apache" and group "apache" you can fix this by running:
[root@localhost keenable]#chown -R apache:apache /var/local/squirrelmail/data
[ro[root@localhost keenable]#mkdir -p /var/local/squirrelmail/data
ot@localhost keenable]#chmod 755 /var/local/squirrelmail/data

Now you will login the firefox http://192.168.2.100/webmail
 
Best of Luck 
Waiting for your comment and feedback 

Comments

Popular posts from this blog

Docker Private Registery