CentOS 7 server installation and configuration DNS server PowerDNS/PowerAdmin

Source: Internet
Author: User
Tags anonymous create index flush install php pear vps mysql database nameserver

PowerDNS can run on a free open-source DNS server of Linux/Unix derivative version. It can be configured using different backend servers, including BIND-type Regional files and relational databases, or load balancing/failover algorithms. It can also be configured as a DNS recursion to run as an independent process on the server.

The latest version of the PowerDNS authorization server is 3.4.4, but the current version available in the EPEL repository is 3.4.3. I recommend that you install the one provided in the EPEL repository because this version has been tested in CentOS and Fedora. In this way, you can easily update PowerDNS in the future.

This article demonstrates how to install and configure MariaDB as the backend PowerDNS and its user-friendly Web management tool PowerAdmin.

For the purpose of writing this article, I will use the following servers:

Host Name: centos7.localhost
IP address: 192.168.0.102

Part 1: install PowerDNS with MariaDB backend

1. First, you need to enable the EPEL repository for your system, just use:

# Yum install epel-release.noarch

Enable Epel repository

2. The next step is to install the MariaDB server. Run the following command:

# Yum-y install mariadb-server mariadb

Install MariaDB server

3. Next, we will configure and enable MariaDB and set the boot start:

# Systemctl enable mariadb. service
# Systemctl start mariadb. service

Enable MariaDB boot

4. Now that the MariaDB service is running, we will set a password for MariaDB for security reinforcement and run the following command:

# Mysql_secure_installation

Do as instructed

/Bin/mysql_secure_installation: line 379: find_mysql_client: command not found
NOTE: running all parts of this script is recommended for all MariaDB
Servers in production use! Please read each step carefully!
In order to log into MariaDB to secure it, we'll need the current
Password for the root user. If you 've just installed MariaDB, and
You haven't set the root password yet, the password will be blank,
So you shoshould just press enter here.
Enter current password for root (enter for none): Press ENTER
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
Root user without the proper authorisation.
Set root password? [Y/n] y
New password: cipher Set New Password
Re-enter new password: your Repeat Above Password
Password updated successfully!
Reloading privilege tables ..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
To log into MariaDB without having to have a user account created
Them. This is intended only for testing, and to make the installation
Go a bit smoother. You shoshould remove them before moving into
Production environment.
Remove anonymous users? [Y/n] y ← Choose "y" to disable that user
... Success!
Normally, root shoshould only be allowed to connect from 'localhost'. This
Ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] n rows Choose "n" for no
... Skipping.
By default, MariaDB comes with a database named 'test' that anyone can
Access. This is also intended only for testing, and shocould be removed
Before moving into a production environment.
Remove test database and access to it? [Y/n] y then Choose "y" for yes
-Dropping test database...
... Success!
-Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.
Reload privilege tables now? [Y/n] y then Choose "y" for yes
... Success!
Cleaning up...
All done! If you 've completed all of the above steps, your MariaDB
Installation shoshould now be secure.
Thanks for using MariaDB!

5. After MariaDB is configured successfully, we can continue to install PowerDNS. Run the following command:

# Yum-y install pdns-backend-mysql

Install PowerDNS with MariaDB backend

6. The PowerDNS configuration file is located at/etc/pdns,Before editing, we will configure a MariaDB database for the PowerDNS service. First, we connect to the MariaDB server and create a database named powerdns:

# Mysql-u root-p
MariaDB [(none)]> create database powerdns;

Create a PowerDNS database

7. Next, we will create a database user named powerdns:

MariaDB [(none)]> grant all on powerdns. * TO 'powerdn' @ 'localhost' identified by 'tecmint123 ';
MariaDB [(none)]> grant all on powerdns. * TO 'powerdn' @ 'centos7. localdomain 'identified by 'teccmint123 ';
MariaDB [(none)]> flush privileges;

Create a PowerDNS user

Note: replace "tecmint123" with the actual password you want to set.

8. We will continue to create the database tables to be used by PowerDNS.Perform the following operations like stacked wood:

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)
);

Create a table named domains for PowerDNS

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)
);

Create a table records for PowerDNS

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 );

Create a table index

MariaDB [(none)]> create table supermasters (
Ip VARCHAR (25) not null,
Nameserver VARCHAR (255) not null,
Account VARCHAR (40) DEFAULT NULL
);

Create a table supermasters

You can run the following command to exit the MariaDB console:

MariaDB [(none)]> quit;

9. LastWe can continue to configure PowerDNS with MariaDB as the background. Open the PowerDNS configuration file:

# Vim/etc/pdns. conf

Search for rows like the following in the file:

#################################
# Launch Which backends to launch and order to query them in
    #
# Launch =

Put the following code after this:

Launch = gmysql
Gmysql-host = localhost
Gmysql-user = powerdns
Gmysql-password = user-pass
Gmysql-dbname = powerdns

Change "user-pass" to the actual password you set earlier. The configuration is as follows:

Configure PowerDNS

Save the changes and exit.

10. Now, we will start and add PowerDNS to the system startup list:

# Systemctl enable pdns. service
# Systemctl start pdns. service

Enable and start PowerDNS

In this step, your PowerDNS server is up and running.



I also found a tutorial on PowerDNS on the Internet, which is also good and worthy of reference.

Use PowerDNS to build a free DNS server with PowerDNS installation configuration


For various reasons, many of our users may need to build their own DNS servers. There are various ways to build these servers. Old Zuo is lucky to have access to the free and open-source PowerDNS system, it can help us build free DNS servers on Windows and Linux. The introduction of PowerDNS is similar to that of the public. The original statement is copied from the left. PowerDNS is a cross-platform open-source DNS service component. PowerDNS supports both Windows and Linux/Unix versions. In Windows, PowerDNS can use an Access mdb file to record DNS information. In Linux/Unix, MySQL can be used to record DNS information. "

I used to see the introduction and installation methods in a foreign Blog. However, because the information may be outdated, or the old technology is not as good as a human being, it takes two days to complete the setup, then re-install the VPS. The article has been written. At least I can ensure that this PowerDNS build process is carried out under my own successful drills. This article is based on centos 6 32-bit and is recorded as follows.

1. Install MYSQL service components

Because PowerDNS uses the MYSQL database to store data, it is necessary to build a MYSQL database environment.

Yum-y install mysql-server # install MYSQL
Chkconfig -- levels 235 mysqld on # set startup
/Etc/init. d/mysqld start

Modify the mysql password of the root user

Mysqladmin-u root passwordmyrootpassword

2. Install PowerDNS

Yum install wget
Wget http://soft.laozuo.org/powerdns/epel-release-6-8.noarch.rpm
Rpm-Uvh./epel-release-6-8.noarch.rpm

Yum install pdns-backend-mysql

Connect to MYSQL and create a database

Mysql-u root-p

After the connection, enter the password we set above to log on to MYSQL, and then create a database and a user

Create database powerdns; # create a database

# Create a database user power_user and set www.laozuo.org as the password. When we set it, change it to our own password.

Grant all onpowerdns. * to 'Power _ user' @ 'localhost' identified by 'www .laozuo.org ';
Flush privileges;

# Creating a data table

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 ));

Create unique index name_index on domains (name );
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 ));

Create index rec_name_index on records (name );
Create index nametype_index on records (name, type );
Create index domain_id on records (domain_id );

Create table supermasters (
Ip varchar (25) not null,
Nameserver varchar (255) not null,
Account varchar (40) default null );

# Exit the current MYSQL management

Quit;

3. Edit the vi/etc/pdns. conf configuration file.

Launch = gmysql
Gmysql-host = 127.0.0.1
Gmysql-user = power_user
Gmysql-password = www.laozuo.org
Gmysql-dbname = powerdns

Add the above to the end of pdns. conf. Make sure to modify the above database user name and password as compared to the above settings.

Set automatic start of PowerDNS

Chkconfig -- levels 235 pdns on
/Etc/init. d/pdns start

So far, we have installed POWERDNS, and we need to install the WEB management interface later.

4. Install the PowerAdmin management platform

A-install the PHP environment

Yum-y install httpd 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

Set apache startup

Chkconfig -- levels 235 httpd on
/Etc/init. d/httpd start

B-two support components required for the installation environment

Yum install php-pear-DB php-pear-MDB2-Driver-mysql

C-install PowerAdmin

Above A, B are completed PowerAdmin need to support the environment, here we install the latest poweradmin-2.1.7 version package

Cd/tmp
Wgethttp: // soft.laozuo.org/powerdns/poweradmin-2.1.7.tgz

Tar zxvfpoweradmin-2.1.7
Music poweradmin-2.1.7/var/www/html/poweradmin
Touch/var/www/html/poweradmin/inc/config. inc. php
Chown-R apache: apache/var/www/html/poweradmin/

We pilot the temporary folder tmp to download and decompress the latest poweradmin-2.1.7, and then move to the VAR/WWW/HTML directory.

After this is done, we can use our own vps ip address/poweradmin/install/to open the POWERDNS installation wizard.

Fifth, install the PowerAdmin Wizard

As shown in the preceding figure, select the first English language. You can select CHINESE when setting up Account logon.

Enter the set database information and set the password for the Poweradmin panel.

Set Database user information and DNS domain name server information.

After confirming, delete the install/directory file and log on to the POWERDNS console at IP address/poweradmin.

Panel Management Username admin. The password is set previously. You can select the CHINESE panel.

So far, we have seen that all PowerDNS has been installed, and you can log on to the management interface. Because it is a demo operation, we use the root information here in the database. If we really need to set up a separate user information to ensure account security. For how to use it, if you have time to write a supplementary application method in the future, you will usually be able to think about it yourself.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.