Friday, September 6, 2013

how to create a mail server in centos 6 & redhat 6

 

How to Create a mail server in centos 6 & redhat 6


Mail Server Configuration in RHEL6

MUA = Mail User Agent (Example: outlook, eudora, thanderbird etc)
MTA = Mail Transfer Agent (Protocol: SMTP) (Example: Postfix, Sendmail etc)
MDA = Mail Delivery Agent (Protocol: POP3)

SMTP Port = 25
POP3 Port = 110
MTA: Postfix
Port: 25
Package: Postfix
Daemon: Postfix
Install: yum install postfix* -y
Conf File: /etc/postfix/main.cf
MDA: Dovecot
Port: 110
Package: Dovecot
Daemon: dovecot
Install: yum install dovecot* -y
Conf File: /etc/dovecot/dovecot.conf



Install Postfix
# yum install postfix* -y

Delete all text of the file “main.cf”
# echo "" > /etc/postfix/main.cf

Edit Conf File

# vim /etc/postfix/main.cf
   myhostname = mail.example.com
   mydomain = example.com
   myorigin = $mydomain
   inet_interfaces = all
   mydestination = $mydomain, localhost.$mydomain, localhost, $myhostname
   mynetworks = 192.168.0.0/24, 127.0.0.0/8
   relay_domains =
   home_mailbox = Maildir/
:wq!

Start and enable service
# service postfix restart

# chkconfig postfix on


Install Dovecot
# yum install dovecot* -y

Edit Conf File
# vim /etc/dovecot/dovecot.conf
Uncomment the line
protocols = imap pop3 lmtp
:wq!


# vim /etc/dovecot/conf.d/10-mail.conf
Uncomment the line
mail_location = maildir:~/Maildir
:wq!


Start and enable service
# service dovecot restart

# chkconfig dovecot on

Install Squirrel Mail
# yum install php* -y

# cp /root/Desktop/squirrelmail-webmail-1.4.22.tar /var/www/html/

# cd /var/www/html/

# tar -xvf squirrelmail-webmail-1.4.22.tar

# mv squirrelmail-webmail-1.4.22 webmail

# mkdir -p /var/local/squirrelmail/data

# mkdir -p /var/local/squirrelmail/attach

# chown -R apache:apache /var/local/squirrelmail/data

# chown -R apache:apache /var/local/squirrelmail/attach

# service httpd restart

Add entry into DNS zone files
# vim /var/named/example.fz
mail IN A 192.168.0.254

# vim /var/named/example.rz
254 IN PTR mail.example.com.

# service named restart

# nslookup
> mail.example.com
Server:
192.168.0.254
Address:
192.168.0.254#53
Name:
mail.example.com
Address: 192.168.0.254
Check and disable SELinux AND REBOOT MACHINE

# vim /etc/sysconfig/selinux
SELINUX=disabled
:wq!

# reboot
Check script file

# cd /var/www/html/webmail/config

# ./conf.pl
Browse from a browser
http://mail.example.com/webmail/src/configtest.php
Click "Login Now" at the bottom of the page to get the login page.
http://mail.example.com/webmail/src/login.php
Add user to login into mail server

# useradd naser

# passwd naser

# useradd asgar

# passwd asgar




No comments:

Post a Comment