Compile and install Postfix and use SASL for client authentication

Source: Internet
Author: User
Tags mx record

Compile and install Postfix

As mentioned in previous articles, MTA software commonly used in Linux currently includes Sendmail, Qmail, Exim, and Postfix. Although the most commonly used MTA is sendmail, the functions implemented by Sendmail are far less powerful than the Postfix function, and the Postfix is compatible with Sendmail, which is more efficient and safer than sendmail. the Postfix adopts a modular design. Therefore, Postfix is becoming increasingly popular due to its many advantages. Therefore, this chapter describes how to use Postfix to build a server and use SASL to provide the authentication function for the client.


Follow these steps to build an email server using Postfix:

1. Preparations before installing Postfix:

1. I think you have sent emails. When sending emails, we generally specify the recipient format as follows: [email protected],

Therefore, when sending an email, the customer first searches for the MX record in the domain on the DNS server, the MX record finds the email server in the domain (that is, the record of the MX host ). Therefore, before installation, You need to configure DNS parameters. Here I will not detail how to configure these parameters, Just configure MX,, PTR record (the email server supports reverse resolution. Assume that the domain here is mongo.com, the mail server is mail.mongo.com, and the record is 192.168.108.20.


2. Install the RPM package used for the following development:

Development Libraries

Development Tools

Legacy Software Development

X software development


3. Install the required RPM package, which includes the following:

Httpd, MySQL, MySQL-server, MySQL-devel, OpenSSL-devel, Dovecot, Perl-DBD-MySQL, TCL, TCL-devel, libart_lgpl, libart_lgpl-devel, libtool-ltdl, libtool-ltdl-devel, exact CT


4. Disable sendmail (the default system mail server software is sendmail and enabled), and disable the function that automatically starts when the system starts.

# Service Sendmail stop

# Chkconfig Sendmail off



2. Install mysql-5.5.28

1. File System for data storage preparation


Create a new logical volume and mount it to a specific directory. The process is not provided here.


Assume that the Mount directory of the logical volume is/mydata, and then create the/mydata/data directory as the directory for storing Mysql Data.


2. Create a user to run the process securely:


# Groupadd-r MySQL

# Useradd-G mysql-r-s/sbin/nologin-m-D/mydata/Data MySQL

# Chown-r MYSQL: MySQL/mydata/Data


3. Install and initialize the mysql-5.5.28

# Tar xf mysql-5.5.28-linux2.6-i686.tar.gz-C/usr/local

# Cd/usr/local

# Ln-SV mysql-5.5.28-linux2.6-i686 MySQL

# Cd MySQL

# Chown-r MYSQL: MySQL.

# Scripts/mysql_install_db -- user = MySQL -- datadir =/mydata/Data

(# Initialize the database as MySQL and specify the data storage location)

# Chown-r root. # (change the owner of the MySQL directory to root to prevent the MySQL process from being cracked and grant all MySQL permissions)


4. Configure the file for MySQL

# Cd/usr/local/MySQL

# Cp support-files/my-large.cnf/etc/My. CNF

Note: This directory contains multiple configuration files, which must be selected based on your memory.

These profiles are available in the/usr/local/MySQL/support-Files directory, my-small.cnf, my-medium.cnf, my-large.cnf, and more. Here I chose my-large.cnf as my configuration file

Edit/etc/My. CNF, find the [mysqld] section, and modify the thread_concurrency value to multiply the number of your CPUs by 2. For example, use the following line:
Thread_concurrency = 2

You also need to add the following lines to specify the storage location of Mysql Data Files:
Datadir =/mydata/Data

 

It is described here. There are multiple MySQL configuration files, so the order in which MySQL loads the configuration files is:

/Etc/My. CNF ---->/etc/MySQL/My. CNF ---> $ basedir/My. CNF ---> ~ /. My. CNF


5. Run the sysv service script for MySQL.

# Cd/usr/local/MySQL

# Cp support-files/MySQL. Server/etc/rc. d/init. d/mysqld

# Chmod + x/etc/rc. d/init. d/mysqld


6. Add to service list

Chkconfig -- add mysqld

If You Want To Enable Automatic startup of mysqld, you can use the chkconfig mysqld on command to implement

 

After completing the preceding six steps, you can install MySQL and test it.


To use MySQL installation to comply with the system usage specifications and export its development components to the system, perform the following steps:
7. output the MySQL man manual to the man command search path:

Edit/etc/man. config and add the following lines:
Manpath/usr/local/MySQL/man

 

8. output the MySQL header file to the system header file path/usr/include:

This can be achieved through simple creation links:
# Ln-SV/usr/local/MySQL/include/usr/include/MySQL


9. output the MySQL database file to the system database search path:

# Echo '/usr/local/MySQL/lib'>/etc/lD. So. conf. d/MySQL. conf

Then let the system reload the system database:
# Ldconfig


9. Modify the PATH environment variable so that the system can directly use MySQL-related commands.

You can create a file ending with *. Sh in the/etc/profile. d/directory.

# Vim/etc/profile. d/mysqld. Sh

# Add the following lines:

Export Path = $ path:/usr/local/MySQL/bin

In this way, MySQL can directly use its related commands without entering an absolute path.

This article is from the "how to learn from Linux" blog!

Compile and install Postfix and use SASL for client authentication

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.