CentOS7 Bind DNS Server Installation

1 Host Preparation

1.1 Disable SeLinux

[root@dns ~]# setenforce 0
[root@dns ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

1.2 Shutdown firewall

[root@dns ~]# systemctl stop firewalld
[root@dns ~]# systemctl disable firewalld

2 Install PHP + Mysql

2.1 Install Mysql

2.1.1 UnInstall the existing mysql or mariadb.

[root@dns ~]# rpm -qa | grep -i mysql | xargs rpm -e --allmatches --nodeps 
warning: /etc/yum.repos.d/mysql-community.repo saved as /etc/yum.repos.d/mysql-community.repo.rpmsave
[root@dns ~]# 

2.1.2 Install the latest mysql version

[root@dns ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[root@dns ~]# yum localinstall mysql57-community-release-el7-11.noarch.rpm 
[root@dns resources]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community                  45
mysql-tools-community/x86_64      MySQL Tools Community                       59
mysql57-community/x86_64          MySQL 5.7 Community Server                 247
[root@dns resources]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community   disabled
mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community   disabled
mysql-connectors-community/x86_64  MySQL Connectors Community    enabled:     45
mysql-tools-community/x86_64       MySQL Tools Community         enabled:     59
mysql-tools-preview/x86_64         MySQL Tools Preview           disabled
mysql55-community/x86_64           MySQL 5.5 Community Server    disabled
mysql56-community/x86_64           MySQL 5.6 Community Server    disabled
mysql57-community/x86_64           MySQL 5.7 Community Server    enabled:    247
mysql80-community/x86_64           MySQL 8.0 Community Server    disabled
[root@dns ~]# yum install mysql-community-server

2.1.3 Start Mysql

[root@dns ~]# systemctl start mysqld
[root@dns ~]# systemctl enable mysqld
[root@dns ~]# grep 'temporary password' /var/log/mysqld.log
2018-03-20T07:16:17.630381Z 1 [Note] A temporary password is generated for root@localhost: jWrVwB(ex0wD
[root@dns ~]# mysql -uroot -p
[root@dns ~]# ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';

2.2 Install PHP

2.2.1 Uninstall the existing PHP

[root@dns ~]# 
[root@dns ~]# 
[root@dns ~]# rpm -qa | grep -i php | xargs rpm -e --allmatches --nodeps 

2.2.2 Install PHP

[root@dns ~]# yum -y install epel-release
[root@dns ~]# yum -y install php php-fpm
[root@dns ~]# php -v
PHP 5.4.16 (cli) (built: Mar  7 2018 13:34:47) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

2.2.3 Install PHP-MySQL

[root@dns ~]# yum install php-mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.oit.uci.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: repo1.sea.innoscale.net
 * updates: mirrors.cat.pdx.edu
 * webtatic: sp.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Processing Dependency: php-pdo(x86-64) = 5.4.16-43.el7_4.1 for package: php-mysql-5.4.16-43.el7_4.1.x86_64
--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: php-mysql-5.4.16-43.el7_4.1.x86_64
--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: php-mysql-5.4.16-43.el7_4.1.x86_64
--> Running transaction check
---> Package mysql-community-libs-compat.x86_64 0:5.7.21-1.el7 will be installed
---> Package php-pdo.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                         Arch                       Version                               Repository                             Size
==============================================================================================================================================================
Installing:
 php-mysql                                       x86_64                     5.4.16-43.el7_4.1                     updates                               101 k
Installing for dependencies:
 mysql-community-libs-compat                     x86_64                     5.7.21-1.el7                          mysql57-community                     2.0 M
 php-pdo                                         x86_64                     5.4.16-43.el7_4.1                     updates                                99 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 2.2 M
Installed size: 9.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): php-pdo-5.4.16-43.el7_4.1.x86_64.rpm                                                                                            |  99 kB  00:00:00     
(2/3): php-mysql-5.4.16-43.el7_4.1.x86_64.rpm                                                                                          | 101 kB  00:00:00     
(3/3): mysql-community-libs-compat-5.7.21-1.el7.x86_64.rpm                                                                             | 2.0 MB  00:00:04     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         514 kB/s | 2.2 MB  00:00:04     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : mysql-community-libs-compat-5.7.21-1.el7.x86_64                                                                                            1/3 
  Installing : php-pdo-5.4.16-43.el7_4.1.x86_64                                                                                                           2/3 
  Installing : php-mysql-5.4.16-43.el7_4.1.x86_64                                                                                                         3/3 
  Verifying  : php-pdo-5.4.16-43.el7_4.1.x86_64                                                                                                           1/3 
  Verifying  : php-mysql-5.4.16-43.el7_4.1.x86_64                                                                                                         2/3 
  Verifying  : mysql-community-libs-compat-5.7.21-1.el7.x86_64                                                                                            3/3 

Installed:
  php-mysql.x86_64 0:5.4.16-43.el7_4.1                                                                                                                        

Dependency Installed:
  mysql-community-libs-compat.x86_64 0:5.7.21-1.el7                                     php-pdo.x86_64 0:5.4.16-43.el7_4.1                                    

Complete!
[root@dns ~]# 
[root@dns ~]# php -i | grep client
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
MYSQL_LIBS => -L/usr/lib64/mysql -lmysqlclient 
[root@dns ~]# 
[root@dns ~]# php -i | grep Client
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
Client API version => 5.6.37
Client API library version => 5.6.37
Client API header version => 5.5.56-MariaDB
Client API version => 5.6.37
[root@dns ~]# 

Here, you will find the Mysql Header version mismatch with the lib version. We will get "Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50547 Library:50631" this error.
So we need to update the php-mysql client.

[root@dns ~]# yum remove php-mysql
Loaded plugins: fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package php-mysql.x86_64 0:5.4.16-43.el7_4.1 will be erased
--> Processing Dependency: php-mysql for package: namedmanager-www-1.9.0-2.el7.centos.noarch
--> Running transaction check
---> Package namedmanager-www.noarch 0:1.9.0-2.el7.centos will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                Arch                         Version                                   Repository                                Size
==============================================================================================================================================================
Removing:
 php-mysql                              x86_64                       5.4.16-43.el7_4.1                         @updates                                 232 k
Removing for dependencies:
 namedmanager-www                       noarch                       1.9.0-2.el7.centos                        @jethrocarr-custom                       9.0 M

Transaction Summary
==============================================================================================================================================================
Remove  1 Package (+1 Dependent package)

Installed size: 9.2 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : namedmanager-www-1.9.0-2.el7.centos.noarch                                                                                                 1/2 
NamedManager has been removed, but the MySQL database and user will need to be removed manually.
  Erasing    : php-mysql-5.4.16-43.el7_4.1.x86_64                                                                                                         2/2 
  Verifying  : namedmanager-www-1.9.0-2.el7.centos.noarch                                                                                                 1/2 
  Verifying  : php-mysql-5.4.16-43.el7_4.1.x86_64                                                                                                         2/2 

Removed:
  php-mysql.x86_64 0:5.4.16-43.el7_4.1                                                                                                                        

Dependency Removed:
  namedmanager-www.noarch 0:1.9.0-2.el7.centos                                                                                                                

Complete!
[root@dns ~]# yum install php-mysqlnd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.oit.uci.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: repo1.sea.innoscale.net
 * updates: mirror.hostduplex.com
 * webtatic: sp.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package php-mysqlnd.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                               Arch                             Version                                       Repository                         Size
==============================================================================================================================================================
Installing:
 php-mysqlnd                           x86_64                           5.4.16-43.el7_4.1                             updates                           174 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package

Total download size: 174 k
Installed size: 461 k
Downloading packages:
php-mysqlnd-5.4.16-43.el7_4.1.x86_64.rpm                                                                                               | 174 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : php-mysqlnd-5.4.16-43.el7_4.1.x86_64                                                                                                       1/1 
  Verifying  : php-mysqlnd-5.4.16-43.el7_4.1.x86_64                                                                                                       1/1 

Installed:
  php-mysqlnd.x86_64 0:5.4.16-43.el7_4.1                                                                                                                      

Complete!
[root@dns ~]# php -i|grep Client  
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
Client API library version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
Client API version => mysqlnd 5.0.10 - 20111026 - $Id: e707c415db32080b3752b232487a435ee0372157 $
[root@dns ~]# 
[root@dns ~]# 
[root@dns ~]# 

2.2.4 Install httpd

[root@dns ~] yum install -y httpd

3 Install namedmanager

3.1 Install namedmanager repo

May need to add the proxy setting for this repo due to the GFW.

[root@dns ~] rpm import http://repos.jethrocarr.com/jethrocarr_signing_key.gpg
[root@dns ~] wget -O /etc/yum.repos.d/jethrocarr-c7-public.repo [http://repos.jethrocarr.com/config/centos/7/jethrocarr-c7-public.repo](http://repos.jethrocarr.com/config/centos/7/jethrocarr-c7-public.repo)
[root@dns ~] 

3.2 Install namedmanager-www

[root@dns ~]# yum install -y namedmanager-www
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.oit.uci.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: repo1.sea.innoscale.net
 * updates: mirror.hostduplex.com
 * webtatic: sp.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package namedmanager-www.noarch 0:1.9.0-2.el7.centos will be installed
--> Processing Dependency: php-xml for package: namedmanager-www-1.9.0-2.el7.centos.noarch
--> Processing Dependency: php-soap for package: namedmanager-www-1.9.0-2.el7.centos.noarch
--> Processing Dependency: php-ldap for package: namedmanager-www-1.9.0-2.el7.centos.noarch
--> Processing Dependency: php-intl for package: namedmanager-www-1.9.0-2.el7.centos.noarch
--> Processing Dependency: perl-DBD-MySQL for package: namedmanager-www-1.9.0-2.el7.centos.noarch
--> Running transaction check
---> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed
---> Package php-intl.x86_64 0:5.4.16-43.el7_4.1 will be installed
---> Package php-ldap.x86_64 0:5.4.16-43.el7_4.1 will be installed
---> Package php-soap.x86_64 0:5.4.16-43.el7_4.1 will be installed
---> Package php-xml.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                Arch                         Version                                    Repository                               Size
==============================================================================================================================================================
Installing:
 namedmanager-www                       noarch                       1.9.0-2.el7.centos                         jethrocarr-custom                       1.0 M
Installing for dependencies:
 perl-DBD-MySQL                         x86_64                       4.023-5.el7                                base                                    140 k
 php-intl                               x86_64                       5.4.16-43.el7_4.1                          updates                                  97 k
 php-ldap                               x86_64                       5.4.16-43.el7_4.1                          updates                                  52 k
 php-soap                               x86_64                       5.4.16-43.el7_4.1                          updates                                 158 k
 php-xml                                x86_64                       5.4.16-43.el7_4.1                          updates                                 126 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package (+5 Dependent packages)

Total download size: 1.6 M
Installed size: 10 M
Downloading packages:
(1/6): php-soap-5.4.16-43.el7_4.1.x86_64.rpm                                                                                           | 158 kB  00:00:00     
(2/6): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm                                                                                           | 140 kB  00:00:00     
(3/6): php-intl-5.4.16-43.el7_4.1.x86_64.rpm                                                                                           |  97 kB  00:00:00     
(4/6): php-xml-5.4.16-43.el7_4.1.x86_64.rpm                                                                                            | 126 kB  00:00:00     
(5/6): namedmanager-www-1.9.0-2.el7.centos.noarch.rpm                                                                                  | 1.0 MB  00:00:01     
php-ldap-5.4.16-43.el7_4.1.x86 FAILED                                          
http://mirrors.cat.pdx.edu/centos/7.4.1708/updates/x86_64/Packages/php-ldap-5.4.16-43.el7_4.1.x86_64.rpm: [Errno 12] Timeout on http://mirrors.cat.pdx.edu/centos/7.4.1708/updates/x86_64/Packages/php-ldap-5.4.16-43.el7_4.1.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
Trying other mirror.
(6/6): php-ldap-5.4.16-43.el7_4.1.x86_64.rpm                                                                                           |  52 kB  00:00:00     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                          53 kB/s | 1.6 MB  00:00:30     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : perl-DBD-MySQL-4.023-5.el7.x86_64                                                                                                          1/6 
  Installing : php-intl-5.4.16-43.el7_4.1.x86_64                                                                                                          2/6 
  Installing : php-xml-5.4.16-43.el7_4.1.x86_64                                                                                                           3/6 
  Installing : php-ldap-5.4.16-43.el7_4.1.x86_64                                                                                                          4/6 
  Installing : php-soap-5.4.16-43.el7_4.1.x86_64                                                                                                          5/6 
  Installing : namedmanager-www-1.9.0-2.el7.centos.noarch                                                                                                 6/6 
Reloading httpd...
Redirecting to /bin/systemctl reload httpd.service
Job for httpd.service invalid.
Run cd /usr/share/namedmanager/resources/; ./autoinstall.pl to install the SQL database.
  Verifying  : php-soap-5.4.16-43.el7_4.1.x86_64                                                                                                          1/6 
  Verifying  : php-ldap-5.4.16-43.el7_4.1.x86_64                                                                                                          2/6 
  Verifying  : php-xml-5.4.16-43.el7_4.1.x86_64                                                                                                           3/6 
  Verifying  : php-intl-5.4.16-43.el7_4.1.x86_64                                                                                                          4/6 
  Verifying  : namedmanager-www-1.9.0-2.el7.centos.noarch                                                                                                 5/6 
  Verifying  : perl-DBD-MySQL-4.023-5.el7.x86_64                                                                                                          6/6 

Installed:
  namedmanager-www.noarch 0:1.9.0-2.el7.centos                                                                                                                

Dependency Installed:
  perl-DBD-MySQL.x86_64 0:4.023-5.el7    php-intl.x86_64 0:5.4.16-43.el7_4.1    php-ldap.x86_64 0:5.4.16-43.el7_4.1    php-soap.x86_64 0:5.4.16-43.el7_4.1   
  php-xml.x86_64 0:5.4.16-43.el7_4.1    

Complete!
[root@dns ~]#

3.3 Install namedmanager-bind

[root@dns ~]# yum install namedmanager-bind
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.s.uw.edu
 * epel: mirror.sfo12.us.leaseweb.net
 * extras: mirror.chpc.utah.edu
 * updates: mirror.hostduplex.com
 * webtatic: uk.repo.webtatic.com
Resolving Dependencies
--> Running transaction check
---> Package namedmanager-bind.noarch 0:1.9.0-2.el7.centos will be installed
--> Processing Dependency: php-process for package: namedmanager-bind-1.9.0-2.el7.centos.noarch
--> Running transaction check
---> Package php-process.x86_64 0:5.4.16-43.el7_4.1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==============================================================================================================================================================
 Package                                 Arch                         Version                                   Repository                               Size
==============================================================================================================================================================
Installing:
 namedmanager-bind                       noarch                       1.9.0-2.el7.centos                        jethrocarr-custom                       100 k
Installing for dependencies:
 php-process                             x86_64                       5.4.16-43.el7_4.1                         updates                                  56 k

Transaction Summary
==============================================================================================================================================================
Install  1 Package (+1 Dependent package)

Total download size: 155 k
Installed size: 507 k
Is this ok [y/d/N]: y
Downloading packages:
(1/2): php-process-5.4.16-43.el7_4.1.x86_64.rpm                                                                                        |  56 kB  00:00:00     
namedmanager-bind-1.9.0-2.el7. FAILED                                          
https://repos.jethrocarr.com/pub/jethrocarr/linux/centos/7/jethrocarr-custom/x86_64/namedmanager-bind-1.9.0-2.el7.centos.noarch.rpm: [Errno 12] Timeout on https://repos.jethrocarr.com/pub/jethrocarr/linux/centos/7/jethrocarr-custom/x86_64/namedmanager-bind-1.9.0-2.el7.centos.noarch.rpm: (28, 'Operation timed out after 30001 milliseconds with 0 out of 0 bytes received')
Trying other mirror.
(2/2): namedmanager-bind-1.9.0-2.el7.centos.noarch.rpm                                                                                 | 100 kB  00:00:01     
--------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                         4.9 kB/s | 155 kB  00:00:31     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : php-process-5.4.16-43.el7_4.1.x86_64                                                                                                       1/2 
  Installing : namedmanager-bind-1.9.0-2.el7.centos.noarch                                                                                                2/2 

BIND/NAMED CONFIGURATION

NamedManager BIND components have been installed, you will need to install
and configure bind/named to use the configuration file by adding the
following to /etc/named.conf:

#
# Include NamedManager Configuration
#

include "/etc/named.namedmanager.conf";


NAMEDMANAGER BIND CONFIGURATION

You need to set the application configuration in /etc/namedmanager/config-bind.php

  Verifying  : php-process-5.4.16-43.el7_4.1.x86_64                                                                                                       1/2 
  Verifying  : namedmanager-bind-1.9.0-2.el7.centos.noarch                                                                                                2/2 

Installed:
  namedmanager-bind.noarch 0:1.9.0-2.el7.centos                                                                                                               

Dependency Installed:
  php-process.x86_64 0:5.4.16-43.el7_4.1                                                                                                                      

Complete!
[root@dns ~]#

4 Install bind-chroot

4.1 Install bind9

4.1.1 Install bind9

[root@dns ~]# yum install -y bind

4.1.2 Disable bind9

We will use bind-chroot to manage bind9, so need to disable bind9 itself.

[root@dns ~]# systemctl status named
[root@dns ~]# systemctl stop named
[root@dns ~]# systemctl disable named

4.2 Install bind-chroot

4.2.1 Install the bind-chroot

[root@dns ~]# yum install bind-chroot

4.2.2 Initialize the chroot env

To mount the chroot's shell script to the chroot folder.

[root@dns ~]# /usr/libexec/setup-named-chroot.sh /var/named/chroot on
[root@dns ~]# systemctl start named-chroot
[root@dns ~]# systemctl enable named-chroot
[root@dns ~]# 

4.2.3 Create needed files

[root@dns ~]# touch /var/named/chroot/var/named/data/cache_dump.db               
[root@dns ~]# touch /var/named/chroot/var/named/data/named_stats.txt             
[root@dns ~]# touch /var/named/chroot/var/named/data/named_mem_stats.txt         
[root@dns ~]# touch /var/named/chroot/var/named/data/named.run                   
[root@dns ~]# mkdir /var/named/chroot/var/named/dynamic             //create this folder if not exists 
[root@dns ~]# touch /var/named/chroot/var/named/dynamic/managed-keys.bind    

4.2.4 Change the privileges for the chroot's files

[root@dns ~]# chmod -R 777 /var/named/chroot/var/named/data                                
[root@dns ~]# chmod -R 777 /var/named/chroot/var/named/dynamic                             
[root@dns ~]# ln /etc/named.namedmanager.conf var/named/chroot//etc/named.namedmanager.conf
[root@dns ~]# chown named:named /etc/named.namedmanager.conf                               
[root@dns ~]#  
[root@dns ~]# 

5 Configure the settings

5.1 Named's settings

File Path: /var/named/chroot/etc/named.conf

[root@dns ~]# vi /var/named/chroot/etc/named.conf
options {
    listen-on port 53 { any; }; // Modify here
    listen-on-v6 port 53 { ::1; };
    directory   "/var/named";
    dump-file   "/var/named/data/cache_dump.db";
    statistics-file "/var/named/data/named_stats.txt";
    memstatistics-file "/var/named/data/named_mem_stats.txt";
    allow-query     { any; }; // Modify here
......
include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
include "/etc/named.namedmanager.conf";  // Added this line

5.2 Bind's settings

File Path: /var/named/chroot/etc/named.conf

[root@dns ~]# vi /etc/namedmanager/config-bind.php
......
$config["api_url"]      = "http://192.168.0.21/namedmanager";           // Modify here Application Install Location
$config["api_server_name"]  = "dns.gemii.cc";               // Modify here Name of the DNS server (important: part of the authentication process)
$config["api_auth_key"]     = "dns";                    // Modify here API authentication key, this key will be used in the manager portal.
......
$config["bind"]["version"]      = "9";                  // version of bind (currently only 9 is supported, although others may work)
$config["bind"]["reload"]       = "/usr/sbin/rndc reload";      // command to reload bind config & zonefiles
$config["bind"]["config"]       = "/var/named/chroot/etc/named.namedmanager.conf";  // Modify here. configuration file to write bind config too
$config["bind"]["zonefiledir"]      = "/var/named/chroot/var/named/";           // Modify here. directory to write zonefiles too
//$config["bind"]["config"]     = "/etc/named.namedmanager.conf";   // configuration file to write bind config too
//$config["bind"]["zonefiledir"]        = "/var/named/";            // directory to write zonefiles too
                                        // note: if using chroot bind, will often be /var/named/chroot/var/named/
$config["bind"]["verify_zone"]      = "/usr/sbin/named-checkzone";      // Used to verify each generated zonefile as OK
$config["bind"]["verify_config"]    = "/usr/sbin/named-checkconf";      // Used to verify generated NamedManager configuration
......

5.3 httpd's Settings

File path: /etc/httpd/conf/httpd.conf

[root@dns ~]# vi /etc/httpd/conf/httpd.conf
......
ServerName dns.gemii.cc:80
......

    AllowOverride none
#    Require all denied

......

6 Import the DB Scripts

6.1 Configure the DB Settings

File Path: /usr/share/namedmanager/resources/autoinstall.pl

[root@dns ~]# cd /usr/share/namedmanager/resources/
[root@dns ~]# vi autoinstall.pl
.......
# default settings 
# (only need to change these if you are doing development work)
my $db_user     = "root";       # name of user to be used to create data
my $db_name     = "namedmanager";   # name of the DB to create
my $db_host     = "localhost";      # MySQL server

my $db_bs_user      = "namedmanager";   # name of the aoconf user to create
my $db_bs_password  = "1qaz!QAZ";# Modify here random_password(10); # random password to generate
......

6.2 Import DB Settings

[root@dns resources]# ./autoinstall.pl 
autoinstall.pl

This script setups the NamedManager database components:
 * NamedManager MySQL user
 * NamedManager database
 * NamedManager configuration files

THIS SCRIPT ONLY NEEDS TO BE RUN FOR THE VERY FIRST INSTALL OF NAMEDMANAGER.
DO NOT RUN FOR ANY OTHER REASON

Please enter MySQL root password (if any): 1qaz!QAZ
Searching ../sql/ for latest install schema...
../sql//version_20131222_install.sql is the latest file and will be used for the install.
Importing file ../sql//version_20131222_install.sql
Creating user...
Updating configuration file...
DB installation complete!

You can now login with the default username/password of setup/setup123 at http://localhost/namedmanager
[root@dns resources]

6.3 Restart the Services to enable the settings

[root@dns resources]# 
[root@dns resources]# systemctl restart httpd
[root@dns resources]# systemctl restart mysqld
[root@dns resources]# systemctl restart named-chroot
[root@dns resources]# 

7 Configure the DNS Settings in the Portal

7.1 Log into the Portal

Login the portal https://192.168.0.21/namedmanager/ with setup/setup123.

image.png

7.2 Configure the NamedManager

Click "Configuration"


image.png

7.3 Add a domain

Path "Domains/zones -> View Domains, -> Add New Domain".


image.png

7.4 Add a Name Server

Path "Name Servers -> View Name Servers, -> Add Name Server".


image.png

7.4 Add A records for the domain

Path "Domains/zones -> View Domains", then select "gemii.cc", then click "domain records" .
Add the records as you need.


image.png

7.5 Add Reverse records for the domain

Path "Domains/zones -> View Domains", then click "Add New Domain".


image.png

Then you will find the reverse domain in the domain list.


image.png

Then click "Domain Records". Add the reverse records for the standard domain records.


image.png

7.5 Enable the domain records

Waiting for about 1m, or restart the "mysqld" and "named-chroot", we will get the status to be green "status_synced".

image.png

7.6 Check the dns server.

Choose one server, change the network's DNS server.

image.png
[root@lb1 network-scripts]# systemctl daemon-reload 
[root@lb1 network-scripts]# systemctl restart network
[root@lb1 network-scripts]# 
[root@lb1 network-scripts]# ping gitlab.gemii.cc
PING gitlab.gemii.cc (192.168.0.64) 56(84) bytes of data.
64 bytes from gitlab.gemii.cc (192.168.0.64): icmp_seq=1 ttl=64 time=23.7 ms
64 bytes from gitlab.gemii.cc (192.168.0.64): icmp_seq=2 ttl=64 time=38.4 ms
^C
--- gitlab.gemii.cc ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 23.775/31.136/38.497/7.361 ms
[root@lb1 network-scripts]# 

你可能感兴趣的:(CentOS7 Bind DNS Server Installation)