To tell the truth, Postfix Mail server Building is a very troublesome thing, need to configure and debug between various software. Before writing this article, I also build test not less than 10 times to the whole process to pass, today just have time to record the entire construction process.
Before we formally install the postfix, let's start by introducing the preparatory work that needs to be done before the build.
first, the Domain name analysis
Because the mail server is involved in the domain name of a lot of problems, so here we first introduce the relevant configuration of domain name resolution.
We need to add MX, TXT and related A records in the domain name resolution console, in the usual domain name resolution process, the most used is dnspod and million nets, the following are introduced below.
Dnspod configuration, as follows:
If the MX and TXT configuration records for Dnspod are not clear, you can view the following connections:
MX Record configuration Https://support.dnspod.cn/Kb/showarticle/tsid/33
txt record configuration Https://support.dnspod.cn/Kb/showarticle/tsid/34
Million network configuration, as follows:
Note: We are now the primary domain ilanni.com resolution to a server, mail resolves to the B server, so we are now unable to follow the dnspod and million Web tutorial configuration.
Test that the MX and TXT records are resolved correctly, as follows:
Second,
lamp
Environment installation
In order to better use the postfix, we also need to install PHP, MySQL, Apache and other related software, we are now installed.
Execute the following command on the CENTOS6:
RPM-IVH http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
RPM-UVH https://mirror.webtatic.com/yum/el6/latest.rpm
Yum-y install mysql-server mysql mysql-devel php56w php56w-fpm php56w-mysql php56w-common php56w-gd php56w-mbstring php56 W-mcrypt php56w-devel php56w-xml php56w-imap php56w-pear php56w-snmp
Execute the following command on the CENTOS7:
RPM-IVH http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
RPM-UVH http://ftp.iij.ad.jp/pub/linux/fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm && RPM-UVH http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Yum-y install--enablerepo=remi--enablerepo=remi-php56 mysql-server mysql mysql-devel php php-opcache php-pecl-apcu php -devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-phpunit php-pecl-xdebug php-pecl-xhprof php-pdo php-pear php-fpm PHP-CLI php-xml php-bcmath php-process php-gd Php-common
When the above installation is complete, we have to do other operations.
Start the MySQL database and modify the root user password for MySQL. As follows:
/etc/init.d/mysqld start
/usr/bin/mysqladmin-u root password ' 123456 '
Create the Postfix database and the Postfix user as follows:
Mysql-uroot-p ' 123456 '-e "CREATE database postfix default character set UTF8 collate utf8_bin;" && Mysql-uroot -P ' 123456 '-e ' grant all on postfix.* to ' postfix ' @ '% ' identified by ' postfix '; "
Delete the host with an empty user name, as follows:
Mysql-uroot-p ' 123456 ' mysql-e "delete from user where user= ';"
Refresh the MySQL permissions as follows:
Mysql-uroot-p ' 123456 '-e "flush privileges;"
Test whether the Postfix user can link mysql as follows:
Mysql-upostfix-ppostfix
Set up MySQL, Apache boot, as follows:
Chkconfig mysqld on
Chkconfig httpd on
Third, host name modification
Once the lamp is configured, we will now begin to modify the hostname as follows:
Vim/etc/sysconfig/network
Networking=yes
hostname= mai.ilanni.com
Networking_ipv6=no
Peerntp=no
gateway=121.196.247.247
The above changes require us to restart the server to take effect, in order to display the latest host name more quickly. We can modify the following commands as follows:
Hostname mai.ilanni.com
View the modified host name as follows:
Hostname
Iv. Create a mail-only user
For subsequent management convenience, we use a user of the system to map the user to the mail server, which is a virtual user for postfix.
Prior to this, we need to add a special user Vmail who cannot log on to the system and specify user groups and user IDs, which can also be defined by the user.
Use the following command to create the following:
Groupadd-g Vmail
Useradd-g vmail-u 5000-s/sbin/nologin vmail
So far, Postfix's preparations have been completed.
Slime: Preparation of postfix mail server Setup