Centos7.6下部署PowerDNS

DNS服务作为生产环境的中必备的两个服务之一,是必须要部署的。在centos的base仓库中带有的bind可以做到简单的DNS服务的实现。但是PowerDns提供了一个非常通俗易懂的web界面,即使是没有部署过的小白用户也能够轻易上手。PowerDNS 是一个跨平台的开源DNS服务组件,它是高性能的域名服务器,除了支持普通的BIND配置文件,PowerDNS还可以从MySQL,Oracle,PostgreSQL等的数据库读取数据等。

部署环境准备

关闭selinux和防火墙

[[email protected] ~]#setenforce 0
[[email protected] ~]#systemctl stop firewalld
[[email protected] ~]#systemctl disable firewalld

配置yum源

[[email protected] ~]#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[[email protected] ~]#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] ~]#yum install -y epel-release

部署Mariadb数据库存储PowerDNS的后端数据

安装mariadb服务

[[email protected] ~]#yum install -y mariadb-server

修改配置文件

[[email protected] ~]#vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
#更改字符集和禁止主机名解析
init_connect=‘SET collation_connection = utf8_unicode_ci‘
init_connect=‘SET NAMES utf8‘
character-set-server=utf8
collation-server=utf8_unicode_ci
skip-character-set-client-handshake
skip_name_resolve=on

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d

启动服务

[[email protected] ~]#systemctl enable mariadb.service
[[email protected] ~]#systemctl start mariadb.service

查看字符集是否修改成功

[[email protected] ~]#mysql
MariaDB [(none)]> show variables like "%character%";show variables like "%collation%";
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | utf8                       |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

+----------------------+-----------------+
| Variable_name        | Value           |
+----------------------+-----------------+
| collation_connection | utf8_unicode_ci |
| collation_database   | utf8_unicode_ci |
| collation_server     | utf8_unicode_ci |
+----------------------+-----------------+

创建powerdns数据库

MariaDB [(none)]> CREATE DATABASE powerdns;
MariaDB [(none)]> GRANT ALL ON powerdns.* TO ‘powerdns‘@‘localhost‘ IDENTIFIED BY ‘centos‘;
MariaDB [(none)]> FLUSH PRIVILEGES;

创建必要的数据库表

#以下全部复制至数据库命令行中即可
MariaDB [(none)]>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);

flush privileges;

检查所有的表是否创建成功

MariaDB [powerdns]> show tables;
+--------------------+
| Tables_in_powerdns |
+--------------------+
| comments           |
| cryptokeys         |
| domainmetadata     |
| domains            |
| records            |
| supermasters       |
| tsigkeys           |
+--------------------+

检查下使用powerdns是否正常登录

[[email protected] ~]#mysql -upowerdns -hlocalhost -pcentos;
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.56-MariaDB MariaDB Server

Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| powerdns           |
+--------------------+
2 rows in set (0.00 sec)

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)

安装并配置PowerDNS

安装PowerDNS

[[email protected] ~]#yum install -y pdns pdns-backend-mysql

更改配置文件

[[email protected] ~]#vim /etc/pdns/pdns.conf
launch=gmysql
gmysql-host=localhost
gmysql-port=3306
gmysql-dbname=powerdns
gmysql-user=powerdns
gmysql-password=centos

启动服务

[[email protected] ~]#systemctl enable pdns.service
[[email protected] ~]#systemctl start pdns.service

安装PowerAdmin来管理PowerDNS

安装必要的软件包

[[email protected] ~]#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-mcrypt php-mhash gettext

启动http服务

[[email protected] ~]#systemctl start httpd.service
[[email protected] ~]#systemctl enable httpd.service

下载poweradmin放置到http的工作目录中

[[email protected] ~]#cd /var/www/html/
[[email protected] ~]#wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz
[[email protected] ~]#tar xf poweradmin-2.1.7.tgz
[[email protected] html]#mv poweradmin-2.1.7 dns

安装poweradmin,访问网页http://192.168.8.134/dns/install/






把上面的文件写入到文件中

[[email protected] html]#vim dns/inc/config.inc.php
<?php

$db_host        = ‘localhost‘;
$db_user        = ‘poweradmin‘;
$db_pass        = ‘poweradmin‘;
$db_name        = ‘powerdns‘;
$db_type        = ‘mysql‘;
$db_layer       = ‘PDO‘;

$session_key        = ‘[email protected]~!&IN8i58qlp2B(bEMTxZ3DmdHJYIqOref%C&[email protected]$yh‘;

$iface_lang     = ‘en_EN‘;

$dns_hostmaster     = ‘‘;
$dns_ns1        = ‘192.168.8.134‘;
$dns_ns2        = ‘192.168.8.134‘;

删除安装目录

[[email protected] html]#rm dns/install/* -rf

登录界面

账号admin,密码为上面设置的密码123456

原文地址:https://blog.51cto.com/14163901/2419815

时间: 2024-10-03 18:35:02

Centos7.6下部署PowerDNS的相关文章

Centos7.4下部署PowerDNS的操作记录

之前已经介绍了DNS环境的部署过程,这里说下PowerDNS的使用及部署,PowerDNS 是一个跨平台的开源DNS服务组件,它是高性能的域名服务器,除了支持普通的BIND配置文件,PowerDNS还可以从MySQL,Oracle,PostgreSQL等的数据库读取数据.PowerDNS安装了Poweradmin,能实现Web管理DNS记录,非常的方便. 一.部署以MariaDB作为后端数据的PowerDNS系统 1)关闭防火墙和selinux [[email protected] ~]# ca

CentOS7.4下部署hadoop3.1.1

CentOS7.4下部署hadoop3.1.1 契机 由于工作原因要部署hadoop的集群,习惯使用最新的稳定版本2018年的时候由于时间紧破部署了2.7.2版本,最新由于又要部署有研究了一下3.x的部署.这次 研究通了,在这里记录一下,防止以往. 本次部署的是一个可用的集群,不是高可用的,因为高可用的hadoop还要部署zookeeper和ha,搞可用的hadoop以后有需要再研究. 准备工作 规划 软件 软件 版本 位数 说明 Jdk Jdk1.8 64位 稳定版本 Centos Cento

Centos7.2下部署Java开发环境

1.安装JDK 如果以前安装过JDK,想要重新安装可执行如下命令进行卸载,这里安装的是JDK1.8: 先查询: rpm -qa|grep jdk 然后再通过下面命令进行卸载 rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.2.el7_2.x86_64(注意这里nodeps后面的那串名称是通过上面命令查询出来的,查出几个卸载几个) 安装JDK,有2种途径下载: ①:可以直接到官网下载http://www.oracle.com/

CentOS7.0下部署Postfix Sasl Dovecot Openwebmail服务(唐杰)

http://note.youdao.com/noteshare?id=3249001a4c4fd024545581f0284e82c5

CentOS7.0下部署NFS网络文件系统(唐杰)

http://note.youdao.com/noteshare?id=91241102e3df37e44d24134af2053f11

Centos7下部署Nginx

一.续Centos7下部署Node,Nginx安装部署: Nginx选择安装的是编译版(附下载地址:https://nginx.org/download/),根据自己的系统环境选择. 1.进入保存下载文件的路径,cd进入文件保存路径,命令: cd /usr/local/src 2.下载文件,我这选择最新版本nginx-1.13.11.命令: wget https://nginx.org/download/nginx-1.13.11.tar.gz 3.解压到特定文件夹下,进行解压,执行命令: ta

Centos7.4下用Docker-Compose部署WordPress

原文:Centos7.4下用Docker-Compose部署WordPress 前言 最近在学习Docker相关知识,通过阅读第一本Docker书后,正想着手实战用一下这个技术,但又不太敢直接在项目环境下动手.考虑足足三秒钟之后决定买个阿里云ECS搭建一个属于自己的基于Docker的WordPress博客Daniel Fu's hut传送门. 本博客搭建环境(阿里云ECS的购买与基本的安全组配置等工作在文中省略,各位看官可自行研究): 阿里云ECS Centos 7.4 部署工具: Docker

CentOS7下部署rsync服务

说明: 在CentOS7下部署rsync服务和在CentOS6上部署基本上是一样的,只是CentOS7自带了rsyncd启动脚本,由systemd管理而已. rsync服务端配置 [[email protected] ~]# rpm -qa|grep rsync rsync-3.0.9-17.el7.x86_64 [[email protected] ~]# uname -r 3.10.0-514.el7.x86_64 [[email protected] ~]# systemctl stop

在虚拟机环境(CentOS7系统)下将kubernetes中部署服务成功,但在虚拟机外部无法访问到服务

在CentOS7环境下,kubernetes单机版环境,成功部署一个服务,在虚拟机中访问服务没问题,下面这样: curl http://172.27.73.26:8888/eureka-server/default/master {"name":"eureka-server","profiles":["default"],"label":"master","version&qu