postfix + mariadb
来源:互联网 发布:软件工程项目选题 编辑:程序博客网 时间:2024/06/10 05:36
postfix + mariadb
1.配置数据库
[root@westos-mail ~]# ls
anaconda-ks.cfg Downloads phpMyAdmin-3.4.0-all-languages.tar.bz2 Templates
Desktop mail Pictures Videos
Documents Music Public
[root@westos-mail ~]# mv phpMyAdmin-3.4.0-all-languages.tar.bz2/var/www/html/
[root@westos-mail ~]# cd /var/www/html/
[root@westos-mail html]# ls
phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@westos-mail html]# tar jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@westos-mail html]# ls
phpMyAdmin-3.4.0-all-languages phpMyAdmin-3.4.0-all-languages.tar.bz2
[root@westos-mail html]# rm -fr *.bz2
[root@westos-mail html]# ls
phpMyAdmin-3.4.0-all-languages
[root@westos-mail html]# mv phpMyAdmin-3.4.0-all-languages/ myadmin
[root@westos-mail html]# ls
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]#
2.
[root@westos-mail ~]# rm -fr /etc/postfix/main.cf ##删除主配置文件
[root@westos-mail ~]# yum reinstall postfix.x86_64 –y ##重新下载postfix 使得其保持纯粹的实验环境
[root@westos-mail ~]# vim /etc/postfix/main.cf ##编辑主配置文件
[root@westos-mail ~]# systemctl restart postfix.service
[root@westos-mail ~]#
[root@westos-mail ~]# yum install httpd php php-mysql mariadb-server-y ##下载数据库所需要的相关软将
[root@westos-mail ~]# systemctl start mariadb ##开启数据库服务
[root@westos-mail ~]# vim /etc/my.cnf ##编辑配置文件
[root@westos-mail ~]# systemctl restart mariadb.service
[root@westos-mail ~]# mysql_secure_installation ##给mriadb用户加密
[root@westos-mail ~]# mysql -u root –p ##指定用户root登陆mriadb
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 24
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.
MariaDB [(none)]> create user postuser@localhost identified by'redhat'; ##创建数据库用户postuser
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> grant select,update,insert on email.* topostuser@localhost; ##给用户postuser 授予相应的权利
Query OK, 0 rows affected (0.01 sec)
MariaDB [(none)]> quit
Bye
[root@westos-mail ~]# mysql -u postuser -p ##使用新建用户postuser登陆mriadb
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 25
Server version: 5.5.35-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current inputstatement.
MariaDB [(none)]> select * from email.emailuser; ##查看email.emailuser表
+-------------+----------+---------+-------------------+
| username | password |domain | maildir |
+-------------+----------+---------+-------------------+
| sun@sun.com | sun | sun.com |/sun.com/sun/ |
+-------------+----------+---------+-------------------+
1 row in set (0.00 sec)
MariaDB [(none)]> quit
Bye
[root@westos-mail ~]# cd /etc/postfix/
[root@westos-mail postfix]# ls
access generic.db recip sender.db
access.db header_checks recip.db transport
canonical main.cf relocated virtual
generic master.cf sender virtual.db
[root@westos-mail postfix]# vim mailuser.cf ##用户名称查询
hosts = localhost ##数据库所在主机
user = postuser ##登陆数据库的用户
password = redhat ##登陆数据库的密码
dbname = email ##postfix要查询的名字
table = emailuser ##postfix要查询的表的名字
select_field = username ##postfix要查询的字段
where_field = username ##用户给定postfix的查询条件
~
~
[root@westos-mail postfix]# vim /etc/postfix/main.cf
[root@westos-mail postfix]# vim mailuser.cf
[root@westos-mail postfix]# cp mailuser.cf maildomain.cf
[root@westos-mail postfix]# cp mailuser.cf mailbox.cf
[root@westos-mail postfix]# ls
access generic.db mailuser.cf recip.db transport
access.db header_checks main.cf relocated virtual
canonical mailbox.cf master.cf sender virtual.db
generic maildomain.cf recip sender.db
[root@westos-mail postfix]# vim maildomain.cf ##用户域名查询
hosts = localhost ##数据库所在主机
user = postuser ##登陆数据库的用户
password = redhat ##登陆数据库的密码
dbname = email ##postfix要查询的名字
table = emailuser ##postfix要查询的表的名字
select_field = domain ##postfix要查询的字段
where_field = domain ##用户给定postfix的查询条件
~
[root@westos-mail postfix]# vim mailbox.cf ##用户邮箱位置查询
hosts = localhost
user = postuser
password = redhat
dbname = email
table = emailuser
select_field = maildir
where_field = username
~
[root@westos-mail postfix]# postmap -q "sun@sun.com"mysql:/etc/postfix/mailuser.cf
sun@sun.com
[root@westos-mail postfix]# postmap -q "sun.com"mysql:/etc/postfix/maildomain.cf
sun.com
[root@westos-mail postfix]# postmap -q "sun@sun.com"mysql:/etc/postfix/mailbox.cf
/mnt/sun.com/sun/
[root@westos-mail postfix]#
###############配置 postfix#############################
[root@westos-mail ~]# groupadd -g 666 vmail
[root@westos-mail ~]# postconf -e "virtual_mailbox_base =/home/vmail" ##设定虚拟用户的邮件目录
[root@westos-mail ~]# postconf -e "virtual_uid_maps =static:666" ##设定虚拟用户建立文件的uid
[root@westos-mail ~]# postconf -e "virtual_gid_maps =static:666" ##设定虚拟用户建立文件的gid
[root@westos-mail ~]# postconf -e "virtual_alias_maps =mysql:/etc/postfix/mailuser.cf"
[root@westos-mail ~]# postconf -e "virtual_mailbox_domains =mysql:/etc/postfix/maildomain.cf"
[root@westos-mail ~]# postconf -e "virtual_mailbox_maps =mysql:/etc/postfix/mailbox.cf"
[root@westos-mail ~]# ll /etc/postfix/mailuser.cf
-rw-rw-r-- 1 root root 132 May 21 04:20 /etc/postfix/mailuser.cf
[root@westos-mail ~]# ll /etc/postfix/maildomain.cf
-rw-rw-r-- 1 root root 128 May 21 04:21 /etc/postfix/maildomain.cf
[root@westos-mail ~]# ll /etc/postfix/mailbox.cf
-rw-rw-r-- 1 root root 131 May 21 04:22 /etc/postfix/mailbox.cf
[root@westos-mail ~]# systemctl restart postfix
[root@westos-mail ~]# cd /home/vmail/
[root@westos-mail vmail]# ls
[root@westos-mail vmail]# mail sun@sun.com
Subject: ceshi
you are a good boy!!!
.
EOT
[root@westos-mail vmail]# mailq
Mail queue is empty
[root@westos-mail vmail]# ls
sun.com
[root@westos-mail vmail]# cd sun.com
[root@westos-mail sun.com]# ls
sun
[root@westos-mail sun.com]# cat sun
cat: sun: Is a directory
[root@westos-mail sun.com]# cd sun
[root@westos-mail sun]# ls
cur new tmp
[root@westos-mail sun]#
- postfix + mariadb
- postfix + mariadb
- mail postfix postfix+mariadb
- POSTFIX+MARIADB postfix空壳邮件
- mail,postfix,postpix+mariadb,dovecot,dovecot+mariadb,postfix空壳邮件
- postfix邮件服务+mariadb数据库
- CentOS 7使用Postfix、Dovecot及MariaDB搭建邮箱服务器
- Linux学习篇第三章之~postfix & mariadb
- Postfix
- postfix
- postfix
- postfix
- postfix
- postfix
- mariaDB
- MariaDB
- MariaDB
- mariaDB
- 【BZOJ】2738 矩阵乘法 整体二分+树状数组
- AOP execution表达式
- LeetCode 387. First Unique Character in a String (查重、计数器)
- System.Linq.Expressions.Expression使用案例
- Linux下调用系统终端命令popen()
- postfix + mariadb
- 相机模型与多视几何
- 图解归并排序算法(java版)
- 挂载磁盘 以及 磁盘扩容
- USACO-Section1.1 Friday the Thirteenth
- Apache+Tomcat实现负载均衡及集群(session同步)--三、动静分离(2)使用mod_proxy
- jdbc-批操作和元数据
- Apache+Tomcat实现负载均衡及集群(session同步)--四、负载均衡(1)使用mod_jk
- 2017东北四省赛G题