Sunday 4 May 2014

MAIL SERVER CONFIGURATION USING SQUIRREL MAIL WEB MAIL SERVER

(1) SET HOST NAME  
[root@www ~]# hostname www.arunmail.com
[root@www ~]# vi /etc/sysconfig/network

































[root@www ~]# vi /etc/hosts




(2) Configure DNS Server

For DNS  There are 3 Utility. Before configure DNS we  have to install following packages using yum.


[root@www ~]# yum install bind
[root@www ~]# yum install bind-utils
[root@www ~]# yum install caching-nameserver

[root@www ~]# vi /etc/named.conf




[root@www ~]# cd /var/named/
[root@www named]# ll
total 40
drwxr-x--- 5 root  named 4096 May  4 04:47 chroot
drwxrwx--- 2 named named 4096 Dec  2  2011 data
-rw-r----- 1 root  named  198 Dec  2  2011 localdomain.zone
-rw-r----- 1 root  named  195 Dec  2  2011 localhost.zone
-rw-r----- 1 root  named  427 Dec  2  2011 named.broadcast
-rw-r----- 1 root  named 1892 Dec  2  2011 named.ca
-rw-r----- 1 root  named  424 Dec  2  2011 named.ip6.local
-rw-r----- 1 root  named  426 Dec  2  2011 named.local
-rw-r----- 1 root  named  427 Dec  2  2011 named.zero
drwxrwx--- 2 named named 4096 Dec  2  2011 slaves

[root@www named]# cp localhost.zone for
[root@www named]# cp localhost.zone rev



## Edit for file like this 


[root@www named]# vim for




## Edit Rev file Like This

[root@www named]# vim rev





[root@www named]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]

[root@www named]# chkconfig named  --list
named           0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@www named]# chkconfig named on

[root@www named]# nslookup www.arunmail.com
Server:         192.168.88.140
Address:        192.168.88.140#53

Name:   www.arunmail.com
Address: 192.168.88.140

[root@www named]# nslookup 192.168.88.140
Server:         192.168.88.140
Address:        192.168.88.140#53

140.88.168.192.in-addr.arpa     name = www.arunmail.com.

(3) Configure Postfix MTA (MAIL TRANSPORT AGENT)

[root@www ~]# yum install postfix*


Make change in configuration file as bellow

[root@www ~]# vi /etc/postfix/main.cf

(1) myhostname = www.arunmail.com.
#myhostname = virtual.domain.tld

(2)mydomain = arunmail.com

(3)#myorigin = $myhostname
myorigin = $mydomain

(4)inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost


(5)mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain




[root@www named]# alternatives --config mta

There are 2 programs which provide 'mta'.

  Selection    Command
-----------------------------------------------
*  1           /usr/sbin/sendmail.sendmail
 + 2           /usr/sbin/sendmail.postfix

Enter to keep the current selection[+], or type selection number: 2


[root@www named]# chkconfig sendmail off

[root@www named]# service postfix restart
Shutting down postfix:                                     [FAILED]
Starting postfix:                                          [  OK  ]

[root@www named]# chkconfig postfix on


(4) Now Configure Dovecot MRA( Mail Retrieving Agent ) 



[root@www named]# yum install dovecot*



## Make change in the configuration file like bellow

[root@www named]# vi /etc/dovecot.conf

protocols = imap imaps pop3 pop3s



[root@www named]# service dovecot restart
Stopping Dovecot Imap:                                     [FAILED]
Starting Dovecot Imap:                                     [  OK  ]
[root@www named]# service dovecot restart
Stopping Dovecot Imap:                                     [  OK  ]
Starting Dovecot Imap:                                     [  OK  ]

[root@www named]# chkconfig dovecot on







(5) Now configure Squirrel mail web mail server


[root@www named]# yum install  squirrelmail*

[root@www ~]# cd /usr/share/squirrelmail/config/
[root@www config]# ll
total 188
-rwxrwxrwx 1 root root  29548 Oct  5  2009 config_default.php
lrwxrwxrwx 1 root root     45 May  4 06:13 config_local.php -> ../../../../etc/squirrelmail/config_local.php
lrwxrwxrwx 1 root root     39 May  4 06:13 config.php -> ../../../../etc/squirrelmail/config.php
-rwxrwxrwx 1 root root 148706 Oct  5  2009 conf.pl
-rwxrwxrwx 1 root root    492 Oct  5  2009 index.php

root@www config]# ./conf.pl











(6) Now Configure Apache web Server 


[root@www named]# yum install  httpd*


## Make change in the configuration file like bellow


[root@www named]# vi /etc/httpd/conf/httpd.conf

(1) ServerName www.arunmail.com:80


(2) NameVirtualHost 192.168.88.140:80

(
3)
  <VirtualHost 192.168.88.140:80>
#    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /usr/share/squirrelmail
    ServerName www.arunmail.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

[root@www named]# vi /etc/httpd/conf/httpd.conf
[root@www named]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd:                                            [  OK  ]
[root@www named]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]


[root@www named]# chkconfig httpd on




(7) Now add 2 user for testing.



(1) root@www ~]# useradd arun
[root@www ~]# passwd arun
Changing password for user arun.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


(2) [root@www ~]# useradd gaurav
[root@www ~]# passwd gaurav
Changing password for user gaurav.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.



(8) Open Firefox and open the url www.arunmail.com