基于LAMP架构部署PowerDNS web端
2020-01-14 06:30
375 查看
实现 PowerDNS 应用部署
文章目录
实验准备:
centos7干净环境(centos8暂时不能做缺少依赖包) poweradmin-2.1.7包
- 需要的包
[root@centos7 ~]$ll total 320 -rw-r--r-- 1 root root 296469 Jul 10 2014 poweradmin-2.1.7.tgz
开始实验:
- 下载需要的服务
[root@centos7 ~]$yum install pdns pdns-backend-mysql mariadb-server -y
- 启动服务建立数据库和服务用户授权
[root@centos7 ~]$systemctl start mariadb.service [root@centos7 ~]$mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> create database powerdns; # 创建数据库 Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> grant all on powerdns.* to 'powerdns'@'localhost' identified by 'taotaobao'; # 建立用户并授权 Query OK, 0 rows affected (0.00 sec)
- 参考官方文档建表
# https://doc.powerdns.com/md/authoritative/backend-generic-mysql/ # 官方文档路径 CREATE DATABASE powerdns; GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'magedu'; # 如果在之前就建好库和用户授权这两步就不要做了 use powerdns CREATE TABLE domains ( id INT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, master VARCHAR(128) DEFAULT NULL, last_check INT DEFAULT NULL, type VARCHAR(6) NOT NULL, notified_serial INT DEFAULT NULL, account VARCHAR(40) DEFAULT NULL, PRIMARY KEY (id) ) Engine=InnoDB; CREATE UNIQUE INDEX name_index ON domains(name); CREATE TABLE records ( id BIGINT AUTO_INCREMENT, domain_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(10) DEFAULT NULL, content VARCHAR(64000) DEFAULT NULL, ttl INT DEFAULT NULL, prio INT DEFAULT NULL, change_date INT DEFAULT NULL, disabled TINYINT(1) DEFAULT 0, ordername VARCHAR(255) BINARY DEFAULT NULL, auth TINYINT(1) DEFAULT 1, PRIMARY KEY (id) ) Engine=InnoDB; CREATE INDEX nametype_index ON records(name,type); CREATE INDEX domain_id ON records(domain_id); CREATE INDEX recordorder ON records (domain_id, ordername); CREATE TABLE supermasters ( ip VARCHAR(64) NOT NULL, nameserver VARCHAR(255) NOT NULL, account VARCHAR(40) NOT NULL, PRIMARY KEY (ip, nameserver) ) Engine=InnoDB; CREATE TABLE comments ( id INT AUTO_INCREMENT, domain_id INT NOT NULL, name VARCHAR(255) NOT NULL, type VARCHAR(10) NOT NULL, modified_at INT NOT NULL, account VARCHAR(40) NOT NULL, comment VARCHAR(64000) NOT NULL, PRIMARY KEY (id) ) Engine=InnoDB; CREATE INDEX comments_domain_id_idx ON comments (domain_id); CREATE INDEX comments_name_type_idx ON comments (name, type); CREATE INDEX comments_order_idx ON comments (domain_id, modified_at); CREATE TABLE domainmetadata ( id INT AUTO_INCREMENT, domain_id INT NOT NULL, kind VARCHAR(32), content TEXT, PRIMARY KEY (id) ) Engine=InnoDB; CREATE INDEX domainmetadata_idx ON domainmetadata (domain_id, kind); CREATE TABLE cryptokeys ( id INT AUTO_INCREMENT, domain_id INT NOT NULL, flags INT NOT NULL, active BOOL, content TEXT, PRIMARY KEY(id) ) Engine=InnoDB; CREATE INDEX domainidindex ON cryptokeys(domain_id); CREATE TABLE tsigkeys ( id INT AUTO_INCREMENT, name VARCHAR(255), algorithm VARCHAR(50), secret VARCHAR(255), PRIMARY KEY (id) ) Engine=InnoDB; CREATE UNIQUE INDEX namealgoindex ON tsigkeys(name, algorithm); # 查看建好的表 MariaDB [(none)]> use powerdns; Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [powerdns]> show tables; +--------------------+ | Tables_in_powerdns | +--------------------+ | comments | | cryptokeys | | domainmetadata | | domains | | records | | supermasters | | tsigkeys | +--------------------+ 7 rows in set (0.00 sec)
- 修改dns配置文件
[root@centos7 ~]$vim /etc/pdns/pdns.conf ################################# # launch Which backends to launch and order to query them in launch=gmysql # 找到这行加上下面的配置 gmysql-host=localhost gmysql-port=3306 gmysql-dbname=powerdns gmysql-user=powerdns gmysql-password=taotaobao # 一定要对应数据库的设置
- 启动服务
[root@centos7 ~]$systemctl enable --now pdns # 设为开机启动并启动服务 [root@centos7 ~]$ss -ntul Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port udp UNCONN 0 0 *:53 *:* udp UNCONN 0 0 :::53 :::* tcp LISTEN 0 50 *:3306 *:* tcp LISTEN 0 128 *:53 *:* tcp LISTEN 0 128 *:22 *:* tcp LISTEN 0 100 127.0.0.1:25 *:* tcp LISTEN 0 128 :::53 :::* tcp LISTEN 0 128 :::22 :::* tcp LISTEN 0 100 ::1:25 :::* # 四个53端口就对了 # 分别由TCP、UDP监管 [root@centos7 ~]$ss -ntlpu |grep pdns_server udp UNCONN 0 0 *:53 *:* users:((pdns_server",pid=26251,fd=5)) udp UNCONN 0 0 :::53 :::* users:((pdns_server",pid=26251,fd=6)) tcp LISTEN 0 128 *:53 *:* users:((pdns_server",pid=26251,fd=7)) tcp LISTEN 0 128 :::53 :::* users:((pdns_server",pid=26251,fd=8))
- 安装httpd和php相关包
[root@centos7 ~]$ yum -y install httpd php php-devel php-gd php-mcrypt php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-mbstring php-mhash gettext php-mysqlnd.x86_64 [root@centos7 ~]$systemctl enable --now httpd # 启动服务并设为开机启动
- 解压poweradmin-2.1.7
[root@centos7 ~]$tar xvf poweradmin-2.1.7.tgz -C /var/www/html/ # 解压到主站点目录下 [root@centos7 ~]$cd /var/www/html/ [root@centos7 html]$mv poweradmin-2.1.7 poweradmin # 改名隐藏版本号 [root@centos7 html]$ll total 4 drwxrwxr-x 10 root root 4096 Jul 5 2014 poweradmin
- 访问web界面安装向导
# 后面必须加install http://powerdns服务器IP/poweradmin/install/
- 选择语言
- 填写数据库信息 (这一步结束报错,报缺少PDO的时候下载php-mysqlnd包)
- web界面管理dns服务器
- 授权刚刚建立的普通用户(复制给的命令)
- 数据库授权
[root@centos7 html]$mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 8 Server version: 5.5.60-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE -> ON powerdns.* -> TO 'admin'@'localhost' -> IDENTIFIED BY 'taotaobao'; Query OK, 0 rows affected (0.00 sec)
- 设置powerdns访问数据库和指明powerdns所管理的域名
# 在这个目录下创建 [root@centos7 inc]$pwd /var/www/html/poweradmin/inc [root@centos7 inc]$vim config.inc.php [root@centos7 inc]$cat config.inc.php <?php $db_host = 'localhost'; $db_user = 'admin'; $db_pass = 'taotaobao'; $db_name = 'powerdns'; $db_type = 'mysql'; $db_layer = 'PDO'; $session_key = 'exZ4WCH~6Afn41%k(rWUaT]44aA$w^iAS{b-%$JlBuHc$['; $iface_lang = 'en_EN'; $dns_hostmaster = 'admin.taotaobao.org'; $dns_ns1 = 'master.taotaobao.org'; $dns_ns2 = 'slave.taotaobao.org';
- 安装完成删除install目录
[root@centos7 inc]$rm -rf /var/www/html/poweradmin/install/
- 去掉install登录
- web界面搭完dns查询
[root@centos8 ~]#dig www.taotaobao.org @192.168.39.7 ; <<>> DiG 9.11.4-P2-RedHat-9.11.4-16.P2.el8 <<>> www.taotaobao.org @192.168.39.7 ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 10717 ;; flags: qr rd; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 1680 ;; QUESTION SECTION: ;www.taotaobao.org. IN A ;; Query time: 3 msec ;; SERVER: 192.168.39.7#53(192.168.39.7) ;; WHEN: Sat Dec 14 05:24:07 CST 2019 ;; MSG SIZE rcvd: 46
- 点赞
- 收藏
- 分享
- 文章举报
相关文章推荐
- 基于LAMP架构部署web应用系统
- 基于LAMP平台的网站架构(或Web系统架构)
- 基于LAMP平台的网站架构(或Web系统架构)
- [跟我学中小企业架构部署]之四:WEB服务器LAMP部署
- 部署web架构(LAMP)和部署论坛
- LAMP分离式之web服务器负载均衡架构之基于NFS共享式Discuz论坛
- 基于LAMP平台的网站架构(或Web系统架构)
- Openssl:构建CA的过程并实现web服务基于https访问的网络架构
- 基于模块类型php部署LAMP
- linux -- 基于mysql tomcat 部署web项目
- Web服务搜索与执行引擎(四)——基于(三)的系统架构设计
- ParaViewWeb基于本地服务的环境部署
- 部署LAMP架构及其应用
- Web安全实践(2)基于http的web架构剖析
- 基于REST与Web架构的构想
- ZH奶酪:LAMP环境中如何重新部署一个Yii2.0 web项目
- 基于Dubbo的分布式系统架构(五):在Linux操作系统上手工部署Dubbo服务
- 第三章:高性能Web宏观架构之代理服务器Keepalived安装部署
- 基于Hosted Web Core 方式部署Web Role
- 一起谈.NET技术,基于.NET的大型Web站点StackOverflow架构分析