Centos7 搭建 Powerdns +PowerAdmin + Mysql
介绍
Mysql 配置安装
- 下载并安装mysql
# wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
# yum install -y mysql80-community-release-el7-2.noarch.rpm
# yum install -y mysql-community-server
备注:官网YUM的rpm的安装包链接
- 启动mysql
# systemctl enable mysqld
# systemctl start mysqld
- 配置mysql 和表结构
创建 powerdns 用户并授权本地登录,密码为helloworld
# grep 'temporary password' /var/log/mysqld.log (查看mysql root 初始密码)
2019-04-12T09:33:42.903384Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: TJuJ+ok<w3Mr
# mysql -u root -p (登录)
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Mysql@elmeast2019'; (修改数据库密码,要求:大小写字母+数字+特殊符号,可通过‘set global validate_password.policy=0;’ 和 ‘set global validate_length.policy=1;’ 减小密码复杂度,注意安全问题)
mysql> CREATE DATABASE powerdns;
mysql> CREATE USER 'powerdns'@'localhost' IDENTIFIED BY 'helloworld';
mysql> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost';
mysql> FLUSH PRIVILEGES;
构建表结构
mysql> use powerdns;
mysql> 创建表结构; (参考以下链接)
创建表结构参考(以PowerDNS Authoritative Server 4.0 参考)
创建表结构过程,可能遇到字段长度问题,可根据实际情况做调整。(4.1 和4.2 表结构存在调整,在后续操作poweradmin 界面会报错 ,推荐4.0)
至此,mysql 配置完成
PowerDns 配置安装
- powerdns 安装
# yum install -y pdns pdns-backend-mysql
可能不存在pdns 包 ,请执行(存在则忽略):
# yum install epel-release yum-plugin-priorities -y
# curl -o /etc/yum.repos.d/powerdns-auth-master.repo https://repo.powerdns.com/repo-files/centos-auth-master.repo
- 配置pdns.conf
# vim /etc/pdns/pdns.conf
launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=helloworld
gmysql-dbname=powerdns
- 开机启动 + 启动
systemctl enable pdns
systemctl start pdns
备注:通过 systemctl status pnds 查看pdns是否正常启动,如果不正常启动,通过journalctl -xe 查看具体报错信息,如果完全按照以上配置mysql ,会存在一个报错(和mysql 版本相关),发现pdns 无法正常启动。报错信息如下:
[root@localhost pdns]# journalctl -xe
gmysql Connection failed: Unable to connect to database: Authentication plugin 'caching_sha2_password' cannot be loaded: /usr/lib64/my

发现是由于MySQL在8.0后验证方式由mysql_native_password变为caching_sha2_password (以前配置过几次,没有报错,这次用了最新的mysql 8.0 ,竟然还遇到坑。。。)
调整即可
alter user powerdns@localhost identified with mysql_native_password by 'helloworld';
- 测试
# yum install -y bind-utils
# dig @127.0.0.1

备注:status 为REFUSED 或者NOERROR 均可
PowerAdmin 配置安装
- 安装httpd 和PHP 环境
# yum -y install httpd php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mcrypt php-mhash gettext
# yum install php-pear-DB php-pear-MDB2-Driver-mysql
- apache开机启动 + 启动
systemctl enable httpd.service
systemctl start httpd.service
- 安装PowerAdmin
# cd /var/www/html
# git clone https://github.com/poweradmin/poweradmin.git
# chown -R apache:apache /var/www/html/poweradmin/
- 网页导向配置
浏览器打开配置导向:http://192.168.1.238:80/poweradmin/install/




step 5 此处上文“mysql 安装配置” 已执行

step 6
写入/var/www/html/poweradmin/inc/config.inc.php (需要手动创建),

step 7 删除install 目录,rm -rf /var/www/html/poweradmin/install/

登录(可选择中英文)

PowerAdmin 举例应用(配置ww.test.jia.com A 记录)




参考链接
https://github.com/poweradmin/poweradmin
https://cloud.tencent.com/developer/article/1098794
https://doc.powerdns.com/md/authoritative/backend-generic-mysql/
本文档详细介绍了如何在Centos7上配置和安装PowerDNS、PowerAdmin以及Mysql。内容包括Mysql的安装与授权,PowerDNS的配置与启动,以及PowerAdmin的安装和应用示例,如设置A记录。
2148

被折叠的 条评论
为什么被折叠?



