系统:centos7
组成软件:epel仓库、mariadb数据库、powerdns
步骤
1:安装epel仓库
yum install epel-release.noarch
2:安装mariaDB
yum -y install mariadb-server mariadb
3.设置服务开机启动和启动Mariadb
systemctl enable mariadb.service
systemcatl start mariadb.service
netstat -tlun 查看是否启动,如果看到3306服务启动了就说明Mariadb启动正常
4.设置Mariadb密码和安全加固
mysql_secure_installation
y 设置密码为shuyun2016
y
n
y
5.设置完成后安装powerdns
yum -y install pdns pdns-backend-mysql
5.进入数据库创建poserdns数据库
mysql -u roo -p
输入密码shuyun2016进入
MariaDB [(none)]> CREATE DATABASE powerdns; #创建名为powerdns的数据库
6.创建powerdns数据库用户
MariaDB [(none)]> GRANT ALL ON powerdns.* TO ‘powerdns‘@‘localhost‘ IDENTIFIED BY ‘shuyun’;
MariaDB [(none)]> GRANT ALL ON powerdns.* TO ‘powerdns‘@‘centos7.localdomain‘ IDENTIFIED BY ‘shuyun‘;
MariaDB [(none)]> FLUSH PRIVILEGES;
7.创建数据表1
MariaDB [(none)]> USE powerdns;
MariaDB [(none)]> 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)
);
8创建数据表2
MariaDB [(none)]> CREATE UNIQUE INDEX name_index ON domains(name);
MariaDB [(none)]> CREATE TABLE records (
id INT auto_increment,
domain_id INT DEFAULT NULL,
name VARCHAR(255) DEFAULT NULL,
type VARCHAR(6) DEFAULT NULL,
content VARCHAR(255) DEFAULT NULL,
ttl INT DEFAULT NULL,
prio INT DEFAULT NULL,
change_date INT DEFAULT NULL,
primary key(id)
);
9.创建数据表3
MariaDB [(none)]> CREATE INDEX rec_name_index ON records(name);
MariaDB [(none)]> CREATE INDEX nametype_index ON records(name,type);
MariaDB [(none)]> CREATE INDEX domain_id ON records(domain_id);
10.创建数据表4
MariaDB [(none)]> CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);
11.退出数据库配置powerdns
quit
vi /etc/pdns/pdns.conf
在文件里查找
#################################
# launch Which backends to launch and order to query them in
#
# launch=
然后在# launch=下面添加如下:
launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=shuyun
gmysql-dbname=powerdns
#如图
保存修改并且退出
12.把pdsn添加到系统启动项并启动服务
systemctl enable pdns.service
systemctl start pdns.service
13.安装poweradmin web管理器来管理powerdns
由于它是PHP写的我们需要安装PHP和apache
yum 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
安装pear包
yum -y install php-pear-DB php-pear-MDB2-Driver-mysql
14.把apache添加到启动服务并启动服务
systemctl enable httpd.service
systemctl start httpd.service
netstat -tlun #检查80端口是否启动
15.下载poweradmin
cd /var/www/html/ #进入html目录
wget http://downloads.sourceforge.net/project/poweradmin/poweradmin-2.1.7.tgz #下载poweradmin包
tar xfv poweradmin-2.1.7.tgz #加压缩poweradmin包
16.打开浏览器进入安装页面
http://172.19.0.3/poweradmin-2.1.7/install/
1.选择因为点下一步
2.因为我们在后台已经创建好powerdns数据库,这里直接点下一步
3.
username root passowrd shuyun2016 mysql hostname localhost 3306 powerdns PowerAdminPassowrd #回头poweradmin登陆的密码
下一步
4.
username powermarin passowrd shuyun hostmaster xian-dns primary nameserver dns1.localhost.com primary nameserver dns2.localhost.com
下一步
5.把页面显示的代码输入到数据库里面
mysq -u root -p
MariaDB [(none)]> GRANT SELECT, INSERT, UPDATE, DELETE ON powerdns.* TO ‘powermarin‘@‘localhost‘ IDENTIFIED BY ‘123qweasd‘;
6.回到网页点下一步然后把显示的php代码保存下来
下一步
7.把页面7的内容保存下来,有接下来的操作方法和登陆账户和密码
ow we have finished the configuration. If you want support for the URLs used by other dynamic DNS providers, run "cp install/htaccess.dist .htaccess" and enable mod_rewrite in Apache. You should (must!) remove the directory "install/" from the Poweradmin root directory. You will not be able to use Poweradmin if it exists. Do it now. After you have removed the directory, you can login to Poweradmin with username "admin" and password "PowerAdminPassword". You are highly encouraged to change these as soon as you are logged in.
8.进入/var/www/html/poweradmin-2.1.7
cp install/htaccess.dist .htaccess
rm -rf /var/www/html/poweradmin-2.1.7/install
9.进入/var/www/html/poweradmin-2.1.7/inc
vi config.inc.php
把保存的PHP代码复制进去然后退出保存
10.登陆powerdns
http://172.19.0.3/poweradmin-2.1.7/
admin
密码是:PowerAdminPassword
PHP文件
<?php
$db_host = ‘localhost‘; $db_user = ‘powermarin‘; $db_pass = ‘shuyun‘; $db_name = ‘powerdns‘; $db_type = ‘mysql‘; $db_layer = ‘PDO‘; $session_key = ‘khN^[email protected]&cuH-1&5CatC}pdXzx=mM]xL^8AiItH{g‘; $iface_lang = ‘en_EN‘; $dns_hostmaster = ‘xian-dns‘; $dns_ns1 = ‘dns1.localhost.com‘; $dns_ns2 = ‘dns2.localhost.com‘;
时间: 2024-10-19 09:38:12