Compilation and installation of mail server postfix

Source: Internet
Author: User

Installation environment: redhat5.8 2.6.18-194.el5 i386

MySQL 5.6.25 (mysql> SELECT VERSION ();)

Before installation

Close SendMail service sendmail stop &&chkconfig sendmail off

Installing the GCC environment yum-y install gcc+

Confirm that the development environment is installed;

Development Libraries

Development Tools

Start the MYSQLD database service. Service mysqld Start

Start SASLAUTHD Services Service SASLAUTHD start

Add postsfix Account: Groupadd-g 2525 postfix

Useradd-g 2525-u 2525-s/sbin/nologin-m postfix

Add Postdrop user group Groupadd-g 2526 postdrop

Useradd-g 2526-u 2526-s/sbin/nologin-m postdrop

Start installing Postfix

3. Unzip the source package tar XF postfix-2.10.8.tar.gz

2. Enter the unpacked folder to execute: 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-lm-l/usr/lib/sasl2-lsasl2-lssl-lcrypto '

      Description:

      -i/usr/local/mysql/include indicates the MySQL header file path

      auxlibs=-l/usr/local/mysql/lib indicates the MySQL library file path

      -duse_sasl_auth Enable SASL support

      -I/USR/INCLUDE/SASL indicates the SASL header file path

      -DUSE_TLS Support Smtps protocol

Errors that may be encountered during the makefile process:

[ALLDIG.O] Error 127 missing GCC environment

3.make **make Install

Installation path and some configuration instructions at the time of installation:

Install_root: [/]/

TempDir: [/root/postfix-2.10.8]/tmp/postfix temporary file directory during installation

Config_directory: []/etc/postfix configuration file directory

Command_directory: []/usr/sbin binary Files directory

Daemon_directory: []/usr/libexec/postfix

Data_directory: []/var/lib/postfix

Html_directory: []/usr/local/apache/htdocs HTML file directory

Mail_owner: [] postfix

Mailq_path: []/usr/bin/mailq

Manpage_directory: []/usr/local/man man file

Newaliases_path: []/usr/bin/newaliases

Queue_directory: []/var/spool/postfix

Readme_directory: [] No

Sendmail_path: []/usr/sbin/sendmail

Setgid_group: [] Postdrop

Possible errors during make install:

Libpcre.so.1 file Missing Ln-s/usr/local/lib/libpcre.so.1/lib

libmysqlclient.so.18 file missing ln-s/usr/local/mysql/lib/libmysqlclient.so.18/usr/lib/libmysqlclient.so.18

4. Provide SysV startup script

Vi/ettc/init.d/postfix


#!/bin/bash

#

# postfix postfix Mail Transfer Agent

#

# chkconfig:2345 80 30

# Description:postfix is a Mail Transport Agent, which are the program \

# That's moves mail from the 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 are up.

[$NETWORKING = "No"] && exit 3


[-x/usr/sbin/postfix] | | Exit 4

[-d/etc/postfix] | | Exit 5

[-d/var/spool/postfix] | | Exit 6


Retval=0

Prog= "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

Echo

Return $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/postfix

Echo

Return $RETVAL

}


Reload () {

Echo-n $ "Reloading postfix:"

/usr/sbin/postfix Reload 2>/dev/null 1>&2 && Success | | Failure $ "$prog Reload"

Retval=$?

Echo

Return $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 () {

Stop

Start

}


# See how we were called.

Case "$" in

Start

Start

;;

Stop

Stop

;;

Restart

Stop

Start

;;

Reload

Reload

;;

Abort

Abort

;;

Flush

Flush

;;

Check

Check

;;

Status

Status Master

;;

Condrestart)

[-f/var/lock/subsys/postfix] && Restart | | :

;;

*)

echo $ "Usage: $ {Start|stop|restart|reload|abort|flush|check|status|condrestart}"

Exit 1

Esac


Exit $?


# END

Give x permission chmod +x/etc/init.d/postfix

Add Postfix to the list of services: Chkconfig--add postfix

Configuration file for Postfix

Master core process, configuration file/etc/postfix/master.cf

Mail Configuration/etc/postfix/main.cf

Parameter = value: The parameter must be shelf written, a line beginning with a white space character is considered a continuation of the previous line

SMTP protocol command (primitive)

Helo

Ehlo

Mail from:

RCPT TO

< /span>     data

.

Start the service test services Postfix start

[[Email protected] postfix-2.10.8]# telnet localhost 25

Trying 127.0.0.1 ...

Connected to Localhost.localdomain (127.0.0.1).

Escape character is ' ^] '.

Localhost.localdomain ESMTP Postfix

Helo localhost

Localhost.localdomain

Mail From:[email protected]

2.1.0 Ok

RCPT To:root

2.1.5 Ok

Data

354 END data with <CR><LF>.<CR><LF>

Subject:are you ready?

Hahhahaha

.

2.0.0 ok:queued as C4dea3f52d8

Quit

221 2.0.0 Bye

Connection closed by foreign host.


Compilation and installation of mail server postfix

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.