PowerDNS
A DNS server that supports PHP Web Page Management and allows you to add DNS address records directly to the database, which is flexible and convenient.
See Information
Host Name |
Host Name recorded in PDNS |
Local ip Address |
Floating IP Address |
Operating system version |
Note 1 |
Note 2 |
Gd02-qa-plxt2-nodomain.ddns.vclound.com |
Pdnsweb.vclound.com |
10.0.3.105 |
192.168.86.172 |
CentOS 1, 5.8 |
Web Server (nginx, php) |
NULL |
Gd02-qa-plx2-ddns-web-99.vclound.com |
Pdnsdb.vclound.com |
10.0.3.99 |
Null |
CentOS 1, 6.5 |
Pdns SERVER + mysql5.5 |
NULL |
Download the ddns package
http://downloads.powerdns.com/releases/pdns-3.3.1.tar.gz
Download the webpage management page
wget https://github.com/downloads/poweradmin/poweradmin/poweradmin-2.1.6.tgz
Decompress the package to the/apps/dat/web directory.
[root@gd02-qa-plxt2-nodomain web]# cd /apps/dat/web[root@gd02-qa-plxt2-nodomain web]# tar xf poweradmin-2.1.6.tgz [root@gd02-qa-plxt2-nodomain web]# mv poweradmin-2.1.6 pdns
Note: The current compilation method is only applicable to my production environment. You can refer to and adjust it yourself.
See the following ddns-3.3.1.spec file, which integrates the automatic installation of pdns and poweradmin
Program name |
Installation path |
Function |
Poweradmin |
/Apps/dat/web/pdns/ |
Webpage management |
Pdns |
/Apps/sh/pdns |
Start Process |
NULL |
/Apps/conf/pdns. SQL |
Automatically add table scripts to the database |
NULL |
/Apps/conf/pdns. conf |
Configuration File |
Pdns_server |
/Apps/lib/pdns-3.3.1/sbin/pdns_server |
Server programs |
Ddns-3.3.1.spec files
Name: pdnsVersion: 3.3.1Release: 20140129.vipclound.centos65Summary: use for monitor openstack VM.Group: Applications/SystemLicense: GPLURL: http://downloads.powerdns.com/releases/pdns-3.3.1.tar.gzSource0: pdns-3.3.1.tar.bz2BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)#BuildRequires:#Requires:%define _prefix /apps/svr/pdns-3.3.1%define _exec-prefix /apps/svr/pdns-3.3.1%define _bindir /apps/svr/pdns-3.3.1/bin%define _sbindir /apps/svr/pdns-3.3.1/sbin%define _sysconfdir /apps/lib/pdns-3.3.1%define _includedir /apps/lib/pdns-3.3.1%define _libexecdir /apps/lib/pdns-3.3.1%define _infodir /apps/lib/pdns-3.3.1%define _oldincludedir /apps/lib/pdns-3.3.1%define _libdir /apps/lib/pdns-3.3.1%define _defaultdocdir /apps/lib/pdns-3.3.1%define _docdir /apps/lib/pdns-3.3.1%define _mandir /apps/lib/pdns-3.3.1%define _datadir /apps/lib/pdns-3.3.1%define _sharedstatedir /apps/lib/pdns-3.3.1%define _localstatedir /apps/lib/pdns-3.3.1%define _datarootdir /apps/lib/pdns-3.3.1%define _infodir /apps/lib/pdns-3.3.1%define _localedir /apps/lib/pdns-3.3.1%define _htmldir /apps/lib/pdns-3.3.1%define _dvidir /apps/lib/pdns-3.3.1%define _pdfdir /apps/lib/pdns-3.3.1%define _psdir /apps/lib/pdns-3.3.1%descriptionuse for dns server.%prep%setup -q%build%configure --enable-pdns_server --enable-tools --with-lua --with-boost=/usr --enable-pdns_server --enable-tools --with-dynmodules="gmysql" --with-mysql=/apps/svr/mysqlsed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtoolsed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtoolmake %{?_smp_mflags}%installrm -rf %{buildroot}make install DESTDIR=%{buildroot}mkdir %{buildroot}/apps/dat/web/pdns -pmkdir %{buildroot}/apps/sh -pmkdir %{buildroot}/apps/conf/pdns -pmkdir %{buildroot}/apps/run/zabbix -pcp -rp $RPM_BUILD_DIR/pdns-3.3.1/padmin/* %{buildroot}/apps/dat/web/pdns/.cp -rp $RPM_BUILD_DIR/pdns-3.3.1/conf/pdns.conf %{buildroot}/apps/conf/pdns/pdns.confcp -rp $RPM_BUILD_DIR/pdns-3.3.1/sh/pdns %{buildroot}/apps/sh/pdnscp -rp $RPM_BUILD_DIR/pdns-3.3.1/conf/pdns.sql %{buildroot}/apps/conf/pdns/pdns.sql%cleanrm -rf %{buildroot}%files%defattr(-,root,root,-)%doc%config /apps/dat/web/pdns/*%config /apps/conf/pdns/pdns.conf%config /apps/sh/pdns%config /apps/conf/pdns/pdns.sql%{_libdir}/*%{_mandir}/man8/*%{_bindir}/*%{_sbindir}/*%changelog* Wed Jan 29 2014 terrytsang <signmem@hotmail.com>-- use for vipclound.com ddns service
Note:
Lnmp architecture compilation (ignore description)
All software and library files are installed in the/apps and/apps/lib directories.
Mysql-5.5 version currently used
1. Install the dependency package
yum install -y lua-devel.x86_64 boost-devel
2. Run the rpm method to install pdns (use the -- nodeps parameter)
[root@gd02-qa-plx2-ddns-web-99 ~]# rpm -ivh --nodeps pdns-3.3.1-20140128.vipclound.centos65.x86_64.rpmPreparing... ########################################### [100%] 1:pdns ########################################### [100%]
3. See the $ SOURCE/sh/pdns file at compilation below.
#!/bin/sh# chkconfig: - 80 75# description: PDNS is a versatile high performance authoritative nameserver### BEGIN INIT INFO# Provides: pdns# Required-Start: $remote_fs $network $syslog# Required-Stop: $remote_fs $network $syslog# Should-Start:# Should-Stop:# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: PowerDNS authoritative server# Description: PowerDNS authoritative server### END INIT INFOset -econfigdir=/apps/conf/pdnsprefix=/apps/svr/pdns-3.3.1exec_prefix=${prefix}BINARYPATH=${exec_prefix}/binSBINARYPATH=${exec_prefix}/sbinSOCKETPATH=/apps/run/pdns/[ -f "$SBINARYPATH/pdns_server" ] || exit 0[ -r /etc/default/pdns ] && . /etc/default/pdnscd $SOCKETPATHsuffix=$(basename $0 | cut -d- -f2- -s)if [ -n "$suffix" ]then EXTRAOPTS=--config-name=$suffix PROGNAME=pdns-$suffixelse PROGNAME=pdnsfipdns_server="$SBINARYPATH/pdns_server $EXTRAOPTS" doPC(){ ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)}NOTRUNNING=0doPC ping || NOTRUNNING=$?case "$1" in status) if test "$NOTRUNNING" = "0" then doPC status echo $ret else echo "not running" exit 3 fi ;; stop) echo -n "Stopping PowerDNS authoritative nameserver: " if test "$NOTRUNNING" = "0" then doPC quit echo $ret else echo "not running" fi ;; force-stop) echo -n "Stopping PowerDNS authoritative nameserver: " killall -v -9 pdns_server echo "killed" ;; start) echo -n "Starting PowerDNS authoritative nameserver: " if test "$NOTRUNNING" = "0" then echo "already running" else if $pdns_server --daemon --guardian=yes --config-dir=$configdir then echo "started" else echo "starting failed" exit 1 fi fi ;; force-reload | restart) echo -n "Restarting PowerDNS authoritative nameserver: " if test "$NOTRUNNING" = "1" then echo "not running, starting" else echo -n stopping and waiting.. doPC quit sleep 3 echo done fi $0 start ;; reload) echo -n "Reloading PowerDNS authoritative nameserver: " if test "$NOTRUNNING" = "0" then doPC cycle echo requested reload else echo not running yet $0 start fi ;; monitor) if test "$NOTRUNNING" = "0" then echo "already running" else $pdns_server --daemon=no --guardian=no --control-console --loglevel=9 fi ;; dump) if test "$NOTRUNNING" = "0" then doPC list echo $ret else echo "not running" fi ;; show) if [ $# -lt 2 ] then echo Insufficient parameters exit fi if test "$NOTRUNNING" = "0" then echo -n "$2=" doPC show $2 ; echo $ret else echo "not running" fi ;; mrtg) if [ $# -lt 2 ] then echo Insufficient parameters exit fi if test "$NOTRUNNING" = "0" then doPC show $2 ; echo $ret if [ "$3x" != "x" ] then doPC show $3 ; echo $ret else echo 0 fi doPC uptime ; echo $ret echo PowerDNS daemon else echo "not running" fi ;; cricket) if [ $# -lt 2 ] then echo Insufficient parameters exit fi if test "$NOTRUNNING" = "0" then doPC show $2 ; echo $ret else echo "not running" fi ;; *) echo pdns [start\|stop\|force-reload\|reload\|restart\|status\|dump\|show\|mrtg\|cricket\|monitor] ;;esac
The file has fixed the problem that the previous version cannot start PDNS normally.
How to start after installation
/apps/sh/pdns start
Close
/apps/sh/pdns stop
4. Make sure that the mysqlclient.18.0 database file is used in the system, the database is authorized, and the SQL script is imported.
* Authorize the pdns user to access the pdns Database
mysql> create database pdns;Query OK, 1 row affected (0.00 sec)mysql> grant all on pdns.* to 'pdns'@'localhost' identified by 'pdns';Query OK, 0 rows affected (0.00 sec)mysql> grant all on pdns.* to 'pdns'@'127.0.0.1' identified by 'pdns';Query OK, 0 rows affected (0.00 sec)mysql> grant all on pdns.* to 'pdns'@'0.0.0.0' identified by 'pdns';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
2. Make sure that the mysqlclient.18.0 database file is used in the system, the database is authorized, and the SQL script is imported.
* Authorize the pdns user to access the pdns Database
mysql> create database pdns;Query OK, 1 row affected (0.00 sec)mysql> grant all on pdns.* to 'pdns'@'localhost' identified by 'pdns';Query OK, 0 rows affected (0.00 sec)mysql> grant all on pdns.* to 'pdns'@'127.0.0.1' identified by 'pdns';Query OK, 0 rows affected (0.00 sec)mysql> grant all on pdns.* to 'pdns'@'0.0.0.0' identified by 'pdns';Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
SQL required for importing pdns
[root@station140 mysql5]# /apps/svr/mysql5/bin/mysql -u pdns -ppdns pdns < /apps/conf/pdns/pdns.sql
5. Configure the pdns Server
/Apps/conf/pdns. conf
daemon=yesrecursor=192.168.86.37launch=gmysqlgmysql-host=127.0.0.1gmysql-user=pdnsgmysql-dbname=pdnsgmysql-password=pdns
6. Start the pdns Server
/apps/sh/pdns start
7. Test Method
A. Check whether port 53/tcp is in use. B. Check if the firewall is disabled. If selinux is disabled, c./etc/resolv. conf is directed to its own d. nslookup localhost. If yes, 127.0.0.1 is returned.
8. nginx STARTUP configuration is ignored, but you need to point webroot to/app/dat/web
9. Configure php
Modify only the following two parts:/apps/conf/php5/php. ini.
session.save_path = "/tmp/session" date.timezone Asia/Chongqing
Execute Command
mkdir /tmp/sessionchown apps:apps /tmp/session
10. Start nginx (start php slightly)
[root@gd02-qa-plxt2-nodomain /]# lsof -i:80COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEnginx 3105 root 7u IPv4 42727 0t0 TCP *:http (LISTEN)nginx 3106 apps 7u IPv4 42727 0t0 TCP *:http (LISTEN)
Configuration management can be performed through the interface
The above screenshot is used by POWERADMIN to install PDNS
After the installation is complete, you can see this management page
Add primary domain
Add Reverse Domain
How to add host records
You can call the add record button to ADD multiple domain names.
After adding the data, you can immediately call nslookup for verification. This is very convenient.