Sie sind auf Seite 1von 6

Install/Configure Postfix On Cent OS5

This is How to Build SMTP Server with Postfix.

[root@mail ~]# yum -y install postfix

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

# line 70: uncomment and specify hostname

myhostname = mail.server.world

# line 77: uncomment and specify domain name

mydomain = server.world

# line 93: uncomment

myorigin = $mydomain

# line 110: change

inet_interfaces = all

# line 155: add

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

# line 255: uncomment and specify LAN

mynetworks = 127.0.0.0/8, 10.0.0.0/24


# line 410: uncomment (use Maildir)

home_mailbox = Maildir/

# line 536: uncomment; line 537: add

header_checks = regexp:/etc/postfix/header_checks
body_checks = regexp:/etc/postfix/body_checks

# line 562: add

smtpd_banner = $myhostname ESMTP

# add at the bottom

# limit an email size 5M

message_size_limit = 5242880

# limit mailbox 100M

mailbox_size_limit = 104857600

# for SMTP-Auth setting

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth-client
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions = permit_mynetworks,reject_unknown_client,permit
smtpd_recipient_restrictions =
permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject

[root@mail ~]#
vi /etc/postfix/header_checks
# add at the head

# reject if email address is empty

/^From:.*<#.*@.*>/ REJECT
/^Return-Path:.*<#.*@.*>/ REJECT
# hide Received line

/^Received:/ IGNORE

[root@mail ~]#
vi /etc/postfix/body_checks

# reject if includes 'example.com' in mail body

/^(|[^>].*)example.com/ REJECT

[root@mail ~]#
/etc/rc.d/init.d/sendmail stop

Shutting down sm-client:


[ OK ]

Shutting down sendmail:


[ OK ]

[root@mail ~]#
chkconfig sendmail off

[root@mail ~]#
alternatives --config mta

# change default 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

# switch to postfix

[root@mail ~]# /etc/rc.d/init.d/postfix start

Starting postfix:
[ OK ]

[root@mail ~]# chkconfig


postfix on

Build POP/IMAP Server with dovecot.

root@mail ~]# yum -y install dovecot

[root@mail ~]# vi /etc/dovecot.conf

# line 20: uncomment

protocols = imap imaps pop3 pop3s

# line 211: uncomment and add

mail_location = maildir:~/Maildir

# line 762: add

mechanisms = plain login


# line 978: change like below

socket listen { # uncomment

#master {

# Master socket provides access to userdb information. It's typically

# used to give Dovecot's local delivery agent access to userdb so it

# can find mailbox locations.

#path = /var/run/dovecot/auth-master

#mode = 0600

# Default user/group is the one who started dovecot-auth (root)

#user =

#group =

#}

client { # uncomment

# The client socket is generally safe to export to everyone. Typical use

# is to export it to your SMTP server so it can do SMTP AUTH lookups

# using it.

path = /var/spool/postfix/private/auth-client

# uncomment and change

mode = 0660
# uncomment

user = postfix
# add

group = postfix
# add

}
# uncomment

}
# uncomment

[root@mail ~]# /etc/rc.d/init.d/dovecot start

Starting Dovecot Imap:


[ OK ]

[root@mail ~]# chkconfig dovecot on

Prepared By
W.V.Nuwan
(MCP,MCTS. MCITP, SCNA, CIOB(STUDENT MEMBER, RICS STUDENT
MEMBER )
CWTS® Certified Wireless Technology Specialist
Network Administrator

M 0778697738

Das könnte Ihnen auch gefallen