LAMP实战案例:实现PowerDNS 应用部署

LAMP实战案例:实现PowerDNS 应用部署,第1张

LAMP实战案例:实现PowerDNS 应用部署 实现 PowerDNS 应用部署



PowerDNS官网:https://www.powerdns.com/
PowerDNS文档:https://doc.powerdns.com/
Poweradmin官网:http://www.poweradmin.org/



范例:CentOS 8 利用RPM包部署PowerDNS(目前20200311,不支持powerdns,缺少相关php包)

[root@centos8 ~]#yum install -y pdns pdns-backend-mysql  mariadb-server
[root@centos8 ~]#systemctl start mariadb
[root@centos8 ~]#mysql < pdns.sql
[root@centos8 ~]#vim /etc/pdns/pdns.conf
launch=gmysql
gmysql-host=localhost
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=powerdns
gmysql-password=magedu  

[root@centos8 ~]#grep -Ev "^#|^$" /etc/pdns/pdns.conf
launch=gmysql  #修改此行
gmysql-host=localhost  #以下行是增加
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=powerdns
gmysql-password=magedu
setgid=pdns  #以下两行不变
setuid=pdns
[root@centos8 ~]#systemctl enable --now pdns
[root@centos8 ~]#ss -ntlpu |grep pdns_server
udp    UNCONN   0        0                 0.0.0.0:53             0.0.0.0:*      users:(("pdns_server",pid=3073,fd=9))                                          
udp    UNCONN   0        0                    [::]:53                [::]:*      users:(("pdns_server",pid=3073,fd=10))                                         
tcp    LISTEN   0        128               0.0.0.0:53             0.0.0.0:*      users:(("pdns_server",pid=3073,fd=11))                                         
tcp    LISTEN   0        128                  [::]:53                [::]:*      users:(("pdns_server",pid=3073,fd=12))                                         
[root@centos8 ~]#yum -y install httpd php php-devel php-gd  php-ldap php-mysqlnd php-odbc php-pear php-xml php-xmlrpc  php-mhash gettext
[root@centos8 ~]#systemctl restart httpd



范例:CentOS 7 利用RPM包部署PowerDNS

#安装包:基于EPEL源
[root@centos7 ~]#yum install -y pdns pdns-backend-mysql mariadb-server
[root@centos7 ~]#systemctl enable --now  mariadb

#准备mariadb中的数据库,表和用户
[root@centos7 ~]#mysql
MariaDB [(none)]> CREATE DATAbase powerdns;
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'magedu';
#创建powerdns数据库中的表,参看下面文档实现
#https://doc.powerdns.com/md/authoritative/backend-generic-mysql/

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);

#配置PowerDNS使用mariadb作为后台数据存储
[root@centos7 ~]#vim /etc/pdns/pdns.conf,查找到包含launch= 的行,修改并添加下面的内容 
launch=gmysql  #修改此行
gmysql-host=localhost #以下行是增加的
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=powerdns 
gmysql-password=magedu

[root@centos7 ~]#grep -Ev "^#|^$" /etc/pdns/pdns.conf
launch=gmysql
gmysql-host=localhost
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=powerdns
gmysql-password=magedu
setgid=pdns
setuid=pdns

#启动服务
[root@centos7 ~]#systemctl enable --now pdns
[root@centos7 ~]#ss -ntl
State      Recv-Q Send-Q              Local Address:Port                             Peer Address:Port              
LISTEN     0      100                     127.0.0.1:25                                          *:*                  
LISTEN     0      50                              *:3306                                        *:*                  
LISTEN     0      128                             *:53                                          *:*                  
LISTEN     0      128                             *:22                                          *:*                  
LISTEN     0      100                         [::1]:25                                       [::]:*                  
LISTEN     0      128                          [::]:53                                       [::]:*                  
LISTEN     0      128                          [::]:22                                       [::]:*   

#安装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

[root@centos7 ~]#systemctl enable --now httpd
#下载poweradmin程序,并解压缩到相应目录
[root@centos7 ~]#wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz
[root@centos7 ~]#tar xvf poweradmin-2.1.7.tgz  -C /var/www/html
[root@centos7 ~]#cd /var/www/html
[root@centos7 ~]#mv poweradmin-2.1.7 poweradmin

访问下面地址,启动PowerAdmin的网页安装向导:

http://powerdns服务器IP/poweradmin/install/






提供先前配置的数据库详情,同时为Poweradmin设置管理员密码



为Poweradmin创建一个受限用户
说明:
Username:PowerAdmin用户名
Password:上述用户的密码
Hostmaster:当创建SOA记录指定默认主机管理员
Primary nameserver:主域名服务器
Secondary namesever:辅域名服务器



按照下面页面说明,在数据库中创建用户并授权

MariaDB [(none)]>GRANT SELECT, INSERT, UPDATE, DELETE ON powerdns.* TO 'poweradmin'@'localhost‘  IDENTIFIED BY 'magedu';



按下面页面说明,创建config.in.php文件内容

vim /var/www/html/poweradmin/inc/config.inc.php



安装完毕后



删除install目录

rm -rf /var/www/html/poweradmin/install/

登录http://powerdns服务器IP/poweradmin/

username:admin
password:magedu 参看第step 3






欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/3012869.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-09-28
下一篇 2022-09-28

发表评论

登录后才能评论

评论列表(0条)

保存