Compiling and installing Postfix-2.10.10

Source: Internet
Author: User
Tags install openssl

First, uninstall the original postfix:

[[Email protected] ~]# service postfix stop

[Email protected] ~]# chkconfig postfix off

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

Second, in order to achieve virtual user authentication based on MySQL, first install MySQL(I am here by compiling the installation MySQL-5.6.33(Universal binary format))

1. unzip the downloaded package to /usr/local and enter this directory

[Email protected] ~]# tar XF mysql-5.6.33-linux-glibc2.5-i686.tar.gz-c/usr/local/

[Email protected] ~]# cd/usr/local/

2. Create a link to the extracted directory and enter this directory

[[email protected] local]# ln-sv mysql-5.6.33-linux-glibc2.5-i686 MySQL

[[Email protected] local]# CD MySQL

3. Create a MySQL user (make it a system user) and MySQL group

[[email protected] mysql]# groupadd-r-G 306 MySQL

[[email protected] mysql]# useradd-g 306-r-u 306 mysql

4. Make all files under MySQL belong to MySQL user and MySQL group

[Email protected] mysql]# chown-r mysql.mysql/usr/local/mysql/*

5. prepare a partition in advance to create a logical volume (I use /dev/sda5here) to create a logical volume on this partition and enable it to be mounted automatically for use.

[Email protected] mysql]# PVCREATE/DEV/SDA5

[Email protected] mysql]# vgcreate MYVG/DEV/SDA5

[Email protected] mysql]# lvcreate-n mydata-l 512M MYVG

[Email protected] mysql]# mke2fs-j/dev/myvg/mydata

#vim/etc/fstab, add the following:

/dev/myvg/mydata/mydata ext3 defaults 0 0

[Email protected] mysql]# Mkdir/mydata

[Email protected] mysql]# mount-a

6. Create a data directory and make it a MySQL user and MySQL group, no one else has permission

[Email protected] mysql]# Mkdir/mydata/data

[Email protected] mysql]# chown-r mysql:mysql/mydata/data/

[Email protected] mysql]# chmod o-rw/mydata/data/

7. prepare to install the required development environment

[[email protected] mysql]# yum-y install GCC

8. Ready to start Installation

[[email protected] MySQL] #scripts/mysql_install_db--user=mysql--datadir=/mydata/data

9. After the installation is complete, change the permissions of all files under /usr/local/mysql for Security

[Email protected] mysql]# chown-r root.

10. Prepare the startup script and enable it to boot automatically

[email protected] mysql]# CP support-files/mysql.server/etc/init.d/mysqld

[Email protected] mysql]# chkconfig--add mysqld

[Email protected] mysql]# chkconfig--list mysqld

11. Edit the database configuration file

[email protected] mysql]# CP support-files/my-default.cnf/etc/my.cnf

#vim/etc/my.cnf, modify and add the following:

DataDir =/mydata/data

12. Provide the environment variables required to execute the relevant commands

[Email protected] ~]# vim/etc/profile.d/mysql.sh

Add the following content:

Export path= $PATH:/usr/local/mysql/bin

13. Now that theMySQL service configuration is complete, you can start the test

[[Email protected] ~]# service mysqld start

Third, compile and install postfix,(I use postfix-2.10.10.tar.gzhere, related packages can go to postfix Website download)

1. Unzip

[Email protected] ~]# Tar XF postfix-2.10.10.tar.gz

[Email protected] ~]# CD postfix-2.10.10

2. Establish postfix and postdrop groups and users

[Email protected] postfix-2.10.10]# groupadd-g 2525 postfix

[Email protected] postfix-2.10.10]# useradd-g postfix-u 2525-s/sbin/nologin-m postfix

[Email protected] postfix-2.10.10]# groupadd-g 2526 postdrop

[Email protected] postfix-2.10.10]# useradd-g postdrop-u 2526-s/sbin/nologin-m postdrop

3. Install the required packages

[email protected] postfix-2.10.10]# Yum install Cyrus-sasl-devel

[email protected] postfix-2.10.10]# Yum install Db*-devel

[Email protected] postfix-2.10.10]# yum-y install Openssl-devel

4. Installation

[email protected] postfix-2.10.10]# 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 '

Interpretation:

Ccargs: Indicates the header file location,ccargs=-dhas_mysql indicates that the MYSQL -enabled connection can

-i/usr/include/mysql indicates the mysql header file location

-duse_sasl_auth enabling SASL authentication

-I/USR/INCLUDE/SASL indicates SASL header file Location

-DUSE_TLS enabling SMTP to support the Smtps Protocol

Auxlibs: Indicates the location of the library file,-l/usr/lib/mysql indicates the MySQL library file location

-lmysqlclient indicates the MySQL client library file

-lz compressing library files

-LM Module Library file

-lsslssl 's library file

[[email protected] postfix-2.10.10]# make

[[email protected] postfix-2.10.10]# make install

Follow the prompts below to enter the relevant path (the [] number is the default value, "]" After the input value, the omitted representation takes the default value )

Install_root: [/]/

TempDir: [/root/postfix-2.10.10]/tmp/postfix

Config_directory: []/etc/postfix

Command_directory: []/usr/sbin

Daemon_directory: []/usr/libexec/postfix

Data_directory: []/var/lib/postfix

Html_directory: [] No

Mail_owner: [] postfix

Mailq_path: []/usr/bin/mailq

Manpage_directory: []/usr/local/man

Newaliases_path: []/usr/bin/newaliases

Queue_directory: []/var/spool/postfix

Readme_directory: [] No

Sendmail_path: []/usr/sbin/sendmail

Setgid_group: [] Postdrop

You may encounter the following issues during this process:

Libmysqlclient.so.18:cannot open Shared object file:no such file or directory

1). First confirm whether there is libmysqlclient.so.18 this file under /usr/local/mysql/lib/ .

Ll/usr/local/mysql/lib/|grep libmysqlclient.so.18

2). Modify the ld.so.conf file

echo "/usr/local/mysql/lib" >>/etc/ld.so.conf

Then execute the ldconfig to make it effective

5. now it's time to start the service.

[[email protected] ~]# postfix start

Complete!


This article is from the "10917734" blog, please be sure to keep this source http://10927734.blog.51cto.com/10917734/1853337

Compiling and installing Postfix-2.10.10

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.