Linux学习篇第三章之~postfix & mariadb

-----------------------------------------------------------------postfix+mariadb-----------------------------------------------------------------------
1.重新配置postfix

[[email protected] postfix]# mv /etc/postfix/main.cf /mnt

[[email protected] postfix]# yum install postfix -y
[[email protected] postfix]# vim /etc/postfix/main.cf

[[email protected] postfix]# systemctl restart postfix

2.安装数据库

[[email protected] postfix]# yum install httpd php php-mysql mariadb-server -y
[[email protected] postfix]# systemctl restart mariadb
[[email protected] postfix]# vim /etc/my.cnf
[[email protected] postfix]# systemctl restart mariadb.service
[[email protected] postfix]# mysql_secure_installation
[[email protected] postfix]# cd /var/www/html
tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
rm -fr *.bz2
[[email protected] html]# mv phpMyAdmin-3.4.0-all-languages/ myadmin
[[email protected] html]# cd myadmin
[[email protected] myadmin]# cp config.sample.inc.php config.inc.php
[[email protected] myadmin]# vim config.inc.php
[[email protected] myadmin]# systemctl restart httpd

3.测试

访问172.25.254.143/myadmin

Linux学习篇第三章之~postfix & mariadb

写入数据

Linux学习篇第三章之~postfix & mariadb

Linux学习篇第三章之~postfix & mariadb

4.vim /etc/postfix/mailuser.cf         ##用户名称查询

 hosts = localhost                              ##数据库所在主机
 user = postuser                                 ##登陆数据库的用户
 password = postuser                        ##登陆数据库的密码
 dbname = email                               ##postfix要查询的名称
 table = emailuser                             ##postfix要查询的表的名称
 select_field = username                  ##postfix要查询的子段

 where_field = username                 ##用户给定postfix的查询条件

测试:

Linux学习篇第三章之~postfix & mariadb

5.vim /etc/postfix/maildomain.cf      ##用户域名查询

Linux学习篇第三章之~postfix & mariadb

测试:

Linux学习篇第三章之~postfix & mariadb 

6.vim /etc/postfix/mailbox.cf          ##用户邮箱位置查询
 Linux学习篇第三章之~postfix & mariadb 

测试:

Linux学习篇第三章之~postfix & mariadb


----------------------------------------------------------------配置Postfix--------------------------------------------------------------------
 groupadd -g 666 vmail
 useradd -s /sbin/nologin -u 666 vmail -g 666
 postconf -e "virtual_mailbox_base = /home/vmail"      ##设定虚拟用户的邮件目录
 postconf -e "virtual_uid_maps = static:666"                   ##虚拟用户建立文件的uid
 postconf -e "virtual_gid_maps = static:666"                   ##虚拟用户建立文件的gid
 postconf -e "virtual_alias_maps = mysql:/etc/postfix/mailiuser.cf"
 postconf -e "virtual_mailbox_domains = myaql:/etc/postfix/maildomain.cf"
 postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mailbox.cf"

 systemctl restart postfix           
    
Linux学习篇第三章之~postfix & mariadb

主配置文件:

Linux学习篇第三章之~postfix & mariadb