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

来源:互联网 发布:企业网络推广方法 编辑:程序博客网 时间:2024/06/06 11:17
-----------------------------------------------------------------postfix+mariadb-----------------------------------------------------------------------
1.重新配置postfix

[root@westos-mail postfix]# mv /etc/postfix/main.cf /mnt

[root@westos-mail postfix]# yum install postfix -y
[root@westos-mail postfix]# vim /etc/postfix/main.cf

[root@westos-mail postfix]# systemctl restart postfix

2.安装数据库

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

3.测试

访问172.25.254.143/myadmin


写入数据


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的查询条件

测试:


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

测试:

 

6.vim /etc/postfix/mailbox.cf          ##用户邮箱位置查询
  

测试:


----------------------------------------------------------------配置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           
    

主配置文件: