Windows XP Windows 7 Windows 2003 Windows Vista Windows教程綜合 Linux 系統教程
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟件教程
 Windows教程網 >> Linux系統教程 >> Linux系統常見問題解答 >> powerdns 安裝部署備忘

powerdns 安裝部署備忘

日期:2017/1/20 17:44:42      編輯:Linux系統常見問題解答

 PowerDNS

  一種 DNS 服務器, 優點, 支持 PHP 網頁管理, 支持直接在數據庫中添加 DNS 地址記錄, 比較靈活, 方便

  參見信息

  主機名PDNS 中記錄的主機名本機 ip 地址浮動 IP 地址操作系統版本備注 1備注2

  gd02-qa-plxt2-nodomain.ddns.vclound.compdnsweb.vclound.com10.0.3.105192.168.86.172centOS 5.8網頁服務器(nginx, php) NULL

  gd02-qa-plx2-ddns-web-99.vclound.compdnsdb.vclound.com10.0.3.99nullcentOS 6.5pdns 服務器+mysql5.5NULL

  下載 ddns 軟件包

  http://downloads.powerdns.com/releases/pdns-3.3.1.tar.gz

  下載網頁管理頁面

  wget https://github.com/downloads/poweradmin/poweradmin/poweradmin-2.1.6.tgz

  解壓至 /apps/dat/web 目錄下

  [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

  注明: 當前編譯方法只適合於我的生產環境, 各位可參考並進行自行調整 參見 下面 ddns-3.3.1.spec 文件, 該 rpm 包整合了 pdns (程序) 與 poweradmin (網頁管理) 的自動安裝

  程序名稱安裝路徑作用

  poweradmin/apps/dat/web/pdns/網頁管理

  pdns/apps/sh/pdns啟動進程

  NULL/apps/conf/pdns/pdns.sql數據庫自動添加表腳本

  NULL/apps/conf/pdns/pdns.conf配置文件

  pdns_server/apps/lib/pdns-3.3.1/sbin/pdns_server服務端程序

  ddns-3.3.1.spec 文件

  Name: pdns

  Version: 3.3.1

  Release: 20140129.vipclound.centos65

  Summary: use for monitor openstack VM.

  Group: Applications/System

  License: GPL

  URL: http://downloads.powerdns.com/releases/pdns-3.3.1.tar.gz

  Source0: pdns-3.3.1.tar.bz2

  BuildRoot: %(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

  %description

  use 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/mysql

  sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool

  sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

  make %{?_smp_mflags}

  %install

  rm -rf %{buildroot}

  make install DESTDIR=%{buildroot}

  mkdir %{buildroot}/apps/dat/web/pdns -p

  mkdir %{buildroot}/apps/sh -p

  mkdir %{buildroot}/apps/conf/pdns -p

  mkdir %{buildroot}/apps/run/zabbix -p

  cp -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.conf

  cp -rp $RPM_BUILD_DIR/pdns-3.3.1/sh/pdns %{buildroot}/apps/sh/pdns

  cp -rp $RPM_BUILD_DIR/pdns-3.3.1/conf/pdns.sql %{buildroot}/apps/conf/pdns/pdns.sql

  %clean

  rm -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

  -- use for vipclound.com ddns service

  注:

  lnmp 架構編譯(忽略描述)

  所有的軟件, 庫文件都安裝到 /apps 與 /apps/lib 目錄中

  當前使用 mysql-5.5 版本

  1. 安裝依賴包

  yum install -y lua-devel.x86_64 boost-devel

  2. rpm 方法安裝 pdns (注意使用 --nodeps 參數)

  [root@gd02-qa-plx2-ddns-web-99 ~]# rpm -ivh --nodeps pdns-3.3.1-20140128.vipclound.centos65.x86_64.rpm

  Preparing... ########################################### [100%]

  1:pdns ########################################### [100%]

  3. 參見下面編譯時的 $SOURCE/sh/pdns 文件

  #!/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 INFO

  set -e

  configdir=/apps/conf/pdns

  prefix=/apps/svr/pdns-3.3.1

  exec_prefix=${prefix}

  BINARYPATH=${exec_prefix}/bin

  SBINARYPATH=${exec_prefix}/sbin

  SOCKETPATH=/apps/run/pdns/

  [ -f "$SBINARYPATH/pdns_server" ] || exit 0

  [ -r /etc/default/pdns ] && . /etc/default/pdns

  cd $SOCKETPATH

  suffix=$(basename $0 | cut -d- -f2- -s)

  if [ -n "$suffix" ]

  then

  EXTRAOPTS=--config-name=$suffix

  PROGNAME=pdns-$suffix

  else

  PROGNAME=pdns

  fi

  pdns_server="$SBINARYPATH/pdns_server $EXTRAOPTS"

  doPC()

  {

  ret=$($BINARYPATH/pdns_control $EXTRAOPTS $1 $2 2> /dev/null)

  }

  NOTRUNNING=0

  doPC 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

Copyright © Windows教程網 All Rights Reserved