Why I want to send this article, the although many search for similar configuration tutorial, but the deep pit, also always is how many points you will see, there is no tutorial can run successfully, in accordance with the steps to finish
I have to double wall * * * out for tutorial,
Eventually I compiled, is leave a note for himself, and as long as according to the tutorial I finish the server can be normal use, all mail client can connect webmail can easily added to support, then I will continue to send how to install Roundcube
Installation steps
1. Update the system components
2. Create a mail system required account
3. Install MariaDB database
4. Install the Apache and php7
5. Install PostfixAdmin (mail server account and domain name management platform)
6. Install and configure the Postfix parameters (mail server)
7. Install and configure Dovecot parameters (mail receiving server)
8. To install and configure Spamassassin parameters (spam filter plugin)
9. Configuration Postfix enable Spamassassin
1. Update the system components
Yum update & amp; & Yum install wget nano
Individuals prefer the nano style of a text editor, if you like please fell free to use vi vim,
2. Create a mail system required account
Useradd - r - 150 - u g mail - d/var//sbin/nologin vmail - s - c "Virtual mail User" vmail
The mkdir -p/var/vmail
Chmod -r 770/var/vmail
Chown -r vmail: mail/var/vmail
For security reasons, we create a new account all he is the owner of the mailbox,
3. Install MariaDB database
Yum install mariadb server
-The default version can, can also install the latest version by other means,
Systemctl start mariadb. Service
Systemctl enable mariadb. Service
Set up and start the database server boot,
Mysql_secure_installation
Run a database installation command
Mysql - uroot - p
MariaDB [(none)] & gt; The CREATE DATABASE postfixadmin;
MariaDB [(none)] & gt; GRANT ALL PRIVILEGES ON postfixadmin. * TO 'postfixadmin' @ 'localhost' IDENTIFIED BY 'strong_password';
MariaDB [(none)] & gt; FLUSH PRIVILEGES;
MariaDB [(none)] & gt; \ q
Database and account authorization required to start the PostfixAdmin
4. Install the apache and php7
Yum install PHP PHP, mysql, PHP - imap PHP - mbstring PHP - common HTTPD
5. Install PostfixAdmin
The latest version supports three types of database schema, MySQL/MariaDB, PostgreSQL, SQLite
Considering the enterprise applications need a quick response, we use MariaDB here
Wget - q - O - "https://sourceforge.net/projects/postfixadmin/files/postfixadmin/postfixadmin-3.2/postfixadmin-3.2.tar.gz" | tar - XZF - C/var/WWW/HTML
Download and unpack the latest version of PostfixAdmin to web root directory/var/WWW/HTML
The nano/var/WWW/HTML/postfixadmin - 3.2/config. Inc., a PHP
Open the configuration file
$CONF [' configured]=true;
$CONF [' database_type]='mysqli';
$CONF/' database_host='localhost'
$CONF/' database_user='postfixadmin';
$CONF/' database_password='strong_password';
$CONF [' database_name]='postfixadmin';
$CONF [' domain_path]='NO';
$CONF [' domain_in_mailbox]='YES';
Chown -r apache:/var/WWW/HTML/postfixadmin - 3.2
Modify the directory owner for the apache user
Run the installer https://your server IP/postfixadmin - 3.2/public/setup. PHP
May lack of some components package, need to install, just warning message does not affect installation to use, as long as it doesn't appear error
Fill in the installation of the secret key, the first according to confirmed that generates a series of long secret key copying secret key section to the configuration file $CONF [' setup_password]=secret key string file
And then you can correct installation,
6. Install and configure the Postfix
Yum install postfix
Install package
The mkdir -p/etc/postfix/SQL/
Create with mysql with statement of the configuration file
The nano/etc/postfix/SQL/mysql_virtual_alias_domain_catchall_maps cf
User=postfixadmin
Password=strong_password
Hosts=localhost
Dbname=postfixadmin
Query=SELECT goto the FROM alias, alias_domain WHERE alias_domain. Alias_domain='% d' and alias. Address=CONCAT (' @ ', alias_domain target_domain) and alias. Active=1 and alias_domain. Active='1'
The nano/etc/postfix/SQL/mysql_virtual_alias_domain_mailbox_maps cf
User=postfixadmin
Password=strong_password
Hosts=localhost
Dbname=postfixadmin
Query=SELECT maildir FROM mailbox, alias_domain WHERE alias_domain. Alias_domain='% d' and mailbox. The username=CONCAT (' % u ', '@', alias_domain. Target_domain) and mailbox. Active=1 and alias_domain. Active='1'
The nano/etc/postfix/SQL/mysql_virtual_alias_domain_maps cf
User=postfixadmin
Password=strong_password
Hosts=localhost
Dbname=postfixadmin
Query=SELECT goto the FROM alias, alias_domain WHERE alias_domain. Alias_domain='% d' and alias. Address=CONCAT (' % u ', '@', alias_domain. Target_domain) and alias. Active=1 and alias_domain. Active='1'
The nano/etc/postfix/SQL/mysql_virtual_alias_maps cf
User=postfixadmin
Password=strong_password
Hosts=localhost
Dbname=postfixadmin
Query=SELECT goto the FROM alias WHERE address='% s' AND active=' 1 '
# expansion_limit=100
The nano/etc/postfix/SQL/mysql_virtual_domains_maps cf
User=postfixadmin
Password=strong_password
Hosts=localhost
Dbname=postfixadmin
Query=SELECT domain FROM the domain WHERE domain='% s' AND active=' 1 '
# query=SELECT domain FROM the domain WHERE domain='% s'
# optional query to use the when relaying for backup MX
# query=SELECT domain FROM the domain WHERE domain='% s' AND backupmx=' 0 'AND active=' 1 '
# expansion_limit=100
The nano/etc/postfix/SQL/mysql_virtual_mailbox_limit_maps cf
User=postfixadmin
Password=strong_password
Hosts=localhost
Dbname=postfixadmin
Query=SELECT quota FROM mailbox WHERE the username='% s' AND active=' 1 '
The nano/etc/postfix/SQL/mysql_virtual_mailbox_maps cf
User=postfixadmin
Password=strong_password
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull