Centos6.4 Configuring the Mail server postfix3.0.1 (a)

Source: Internet
Author: User

Mail server Deployment

1 Compiling and installing postfix

www.postfix.org

① because CentOS already has a postfix

[Email protected] ~]# Rpm-qa|grep postfixpostfix-2.6.6-2.2.el6_1.x86_64

So we have to uninstall it first

[Email protected] ~]# rpm-e postfix--nodeps

② get the source installation package from www.postfix.org

③ Unpacking Package

[Email protected] ~]# tar xf postfix-3.0.1.tar.gz [[email protected] ~]# CD postfix-3.0.1

④ Add user Postfix,postdrop before installation and enable dependent services to boot SASLAUTHD

[Email protected] ~]# groupadd-g 2525 postfix[[email protected] ~]# useradd-g 2525-u 2525-m-s/sbin/nologin postfix[ [Email protected] ~]# groupadd-g 2526 postdrop[[email protected] ~]# useradd-u 2526-g 2526-m-s/sbin/nologin postdrop
[[Email protected] ~]# service SASLAUTHD startstarting saslauthd: [OK][[email P Rotected] ~]# chkconfig SASLAUTHD on

⑤ Compiling and installing

[email protected] postfix-3.0.1]# make makefiles ' Ccargs=-dhas_mysql-i/usr/local/mysql/include-duse_sasl_auth-duse _cyrus_sasl-i/usr/include/sasl-duse_tls ' auxlibs=-l/usr/local/mysql/lib-lmysqlclient-lz-lrt-lm-l/usr/lib64/ Sasl2-lsasl2-lssl-lcrypto '

Attention:

1 if a/usr/bin/ld:cannot find-lmysqlclient error occurs, make sure that your MySQL path library specifies the correct

2 If error occurs while loading shared Libraries:libpcre.so.1:cannot open shared object File:error 40, make sure that/usr/local/lib has a pointer to L ibpcre.so.0.0.1 the link, and then be sure to Ldconfig, I got it for half an hour.

3 Please confirm each folder you can see the specific content, such as 64 to be modified to lib64

Eventually all interactions have default values to succeed

Postfix:warning:smtputf8_enable is true, but EAI support is not compiled in


Warning:you still need to edit myorigin/mydestination/mynetworks

Parameter Settings in/etc/postfix/main.cf.


See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html

For information about dialup sites or about sites inside a firewalled

Network.


Btw:check your/etc/aliases file and is sure to set up aliases

That's send mail for root and postmaster to a real person, then run

/usr/bin/newaliases.

⑥ provides SYSV service script/etc/rc.d/init.d/postfix for Postfix:

#!/bin/bash## postfix      postfix mail transfer agent##  chkconfig: 2345 80 30# description: Postfix is a Mail  transport agent, which is the program #               that moves mail from one machine  to another.# processname: master# pidfile: /var/spool/postfix/pid/master.pid#  config: /etc/postfix/main.cf# config: /etc/postfix/master.cf# source function  library.  /etc/rc.d/init.d/functions# source networking configuration.  /etc/sysconfig/network# check that networking is up. [  $NETWORKING  =  "No"  ] && exit 3[ -x /usr/sbin/postfix  ] | |  exit 4[ -d /etc/postfix ] | |  exit 5[ -d /var/spool/postfix ] | |  exit 6retval=0prog= "Postfix" Start ()  {# start daemons.echo -n $ "Starting  postfix:  "        /usr/bin/newaliases >/dev/null  2>&1/usr/sbin/postfix start 2>/dev/null 1>&2 &&  success | |  failure $ "$prog  start" retval=$? [  $RETVAL  -eq 0 ] && touch /var/lock/subsys/postfix         echoreturn  $RETVAL}stop ()  {  # Stop  daemons.echo -n $ "shutting down postfix: "/usr/sbin/postfix stop 2>/dev/ null 1>&2 && success | |  failure $ "$prog  stop" retval=$? [  $RETVAL  -eq 0 ] && rm -f /var/lock/subsys/postfixechoreturn   $RETVAL}reload () &nbsP {echo -n $ "reloading postfix: "/usr/sbin/postfix reload 2>/dev/null 1 >&2 && success | |  failure $ "$prog  reload" retval=$?echoreturn  $RETVAL}abort ()  {/usr/sbin/postfix  abort 2>/dev/null 1>&2 && success | |  failure $ "$prog  abort" return $?} Flush ()  {/usr/sbin/postfix flush 2>/dev/null 1>&2 && success  | |  failure $ "$prog  flush" return $?} Check ()  {/usr/sbin/postfix check 2>/dev/null 1>&2 && success  | |  failure $ "$prog  check" return $?} Restart ()  {stopstart}# See how we were called.case  "$"  in   Start) Start;   stop) stop;;   restart) Stopstart;;   reload) reload;;   abort) abort;;   flush) flush;;  &nbspcheck) check;;   status)   status master;;   condrestart) [ -f /var/lock/subsys/postfix ] && restart | |  :;;   *) echo $ "Usage: $0 {start|stop|restart|reload|abort|flush|check|status|condrestart} "Exit 1esacexit $?"




Then give execute permission for this script:

[Email protected] postfix]# vim/etc/rc.d/init.d/postfix[[email protected] postfix]# chmod +x/etc/rc.d/init.d/postfix


Add the Postfix service to the list of services:

[[email protected] postfix-3.0.1] #chkconfig--add postfix


Set it to start automatically:

# chkconfig Postfix on

Test

[Email protected] postfix]# service postfix restart

Shutting down postfix: [OK]

starting postfix: [OK]


If the error postfix:warning:smtputf8_enable is true, but the EAI support was not compiled in, web-based EAI is multilingual, then set the smtpputf8_enable to No

[Email protected] postfix-3.0.1]# postconf "smtputf8_enable = no" [[email protected] postfix-3.0.1]# postfix start
[Email protected] postfix-3.0.1]# postfix startpostfix/postfix-script:starting the Postfix mail system

We found Port 25th on the monitor, OK.

[[Email protected] postfix-3.0.1]# netstat -tnplactive internet connections   (only servers) proto recv-q send-q local address                Foreign Address              state       pid/program  name   tcp        0       0 0.0.0.0:49198                0.0.0.0:*                    LISTEN      1604/rpc.statd       tcp        0      0  0.0.0.0:111                 0.0.0.0:*                    LISTEN       1524/rpcbind        tcp         0      0 0.0.0.0:22                   0.0.0.0:*                     listen      1810/sshd            tcp        0      0  127.0.0.1:631               0.0.0.0 :*                    listen       1665/cupsd          tcp         0      0 0.0.0.0:25                   0.0.0.0:*                    LISTEN       32725/master        tcp         0      0 :::111                       :: :*                          listen      1524/rpcbind         tcp        0      0 :::80                         :::*                          LISTEN       1834/httpd          tcp         0      0 :::22                        :::*                           listen      1810/sshd            tcp        0      0 :::58038                      :::*                          listen      1604/rpc.statd       tcp        0       0 ::1:631                      :::*                          LISTEN       1665/cupsd          tcp         0      0 :::3306                      :::*                           listen      27743/mysqld

Specifically, you can open the log file to view/var/log/maillog

And then

[[email protected] postfix]# newaliases start alias function

2 Configuring the Mail server

Control process: MASTER.CF

Master configuration file: main.cf

You can usually modify the configuration file with the postconf command

postconf-d Display the default settings

Postconf-n Display of modified content

POSTCONF-M Supported lookup Table model

POSTCONF-A display of supported SASL client plug-in types

POSTCONF-E parameter=value: Update values


SMTP Status code:

1XX: Pure Information

2XX: Correct

3XX: Operation not completed

4XX: Transient error

5XX: Permanent Error


SMTP protocol command:

Helo (SMTP)

EHLO (ESMTP)

Mail from: Description sender

RCPT TO: Specify recipients

Data


Alias: Mail Alias

/etc/aliases


By default, Postfix will relay to the local segment, as configured under Centos6.4 Configure Mail server postfix3.0.1 (ii)

This article is from the "Learning Path of Kai Learning" blog, please make sure to keep this source http://qixue.blog.51cto.com/7213178/1665721

Centos6.4 Configuring the Mail server postfix3.0.1 (a)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.