首页 LAMP教程LAMP实战案例:实现PowerDNS 应用部署

LAMP实战案例:实现Discuz!应用部署

PHP的加速器配置介绍

运维派隶属马哥教育旗下专业运维社区,是国内成立最早的IT运维技术社区,欢迎关注公众号:yunweipai
领取学习更多免费Linux云计算、Python、Docker、K8s教程关注公众号:马哥linux运维

实现 PowerDNS 应用部署

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

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

LAMP实战案例:实现PowerDNS 应用部署插图(1)

范例: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

LAMP实战案例:实现PowerDNS 应用部署插图(2)

范例: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/

LAMP实战案例:实现PowerDNS 应用部署插图(3)
LAMP实战案例:实现PowerDNS 应用部署插图(4)

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

LAMP实战案例:实现PowerDNS 应用部署插图(5)

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

LAMP实战案例:实现PowerDNS 应用部署插图(6)

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

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

LAMP实战案例:实现PowerDNS 应用部署插图(7)

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

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

LAMP实战案例:实现PowerDNS 应用部署插图(8)

安装完毕后

LAMP实战案例:实现PowerDNS 应用部署插图(9)

删除install目录

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

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

username:admin
password:magedu 参看第step 3

LAMP实战案例:实现PowerDNS 应用部署插图(10)
LAMP实战案例:实现PowerDNS 应用部署插图(11)

本文链接:http://www.yunweipai.com/36080.html

LAMP实战案例:实现Discuz!应用部署

PHP的加速器配置介绍

网友评论comments

发表评论

邮箱地址不会被公开。

暂无评论

Copyright © 2012-2021 YUNWEIPAI.COM - 运维派 京ICP备16064699号-6
扫二维码
扫二维码
返回顶部