웹사이트 검색

RHEL/CentOS 7에서 'PowerDNS'(MariaDB 포함) 및 'PowerAdmin'을 설치하고 구성하는 방법


PowerDNS는 많은 Linux/Unix 파생 제품에서 실행되는 DNS 서버입니다. BIND 스타일 영역 파일, 관계형 데이터베이스 또는 로드 밸런싱/장애 조치 알고리즘을 포함한 다양한 백엔드로 구성할 수 있습니다. 또한 서버에서 별도의 프로세스로 실행되는 DNS 반복자로 설정할 수도 있습니다.

PowerDNS Authoritative 서버의 최신 버전은 3.4.4이지만 현재 EPEL 저장소에서 사용 가능한 버전은 3.4.3입니다. 이 버전은 CentOS 및 Fedora에서 테스트되었으므로 EPEL 저장소용 버전을 설치하는 것이 좋습니다. 이렇게 하면 나중에 PowerDNS를 쉽게 업데이트할 수도 있습니다.

이 문서에서는 MariaDB 백엔드와 친숙한 웹 인터페이스 관리 도구인 PowerAdmin을 사용하여 마스터 PowerDNS 서버를 설치하고 설정하는 방법을 보여 드리고자 합니다. PowerDNS.

이 기사에서는 다음과 같은 서버를 사용합니다.

Hostname: centos7.localhost 
IP Address 192.168.0.102

1단계: MariaDB 백엔드로 PowerDNS 설치

1. 먼저 서버에 대해 EPEL 저장소를 활성화해야 하며 다음을 사용하면 됩니다.

yum install epel-release.noarch 

2. 다음 단계는 MariaDB 서버를 설치하는 것입니다. 다음 명령을 실행하면 쉽게 수행할 수 있습니다.

yum -y install mariadb-server mariadb

3. 다음으로 시스템 부팅 시 MySQL을 활성화하고 시작하도록 구성하겠습니다.

systemctl enable mariadb.service
systemctl start mariadb.service

4. 이제 MySQL 서비스가 실행되었으므로 다음을 실행하여 MariaDB에 대한 비밀번호를 보호하고 설정하겠습니다.

mysql_secure_installation
설명을 따르세요
/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 should 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:  ← Set New Password
Re-enter new password:  ← 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 for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y ← Choose “y” to disable that user
 ... Success!

Normally, root should 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 ← 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 should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y ← 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 ← Choose “y” for yes
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

5. MariaDB 구성이 성공적으로 완료되면 PowerDNS 설치를 계속 진행할 수 있습니다. 이는 다음을 실행하여 쉽게 완료됩니다.

yum -y install pdns pdns-backend-mysql

6. PowerDNS의 구성 파일은 /etc/pdns/pdns에 있지만 이를 편집하기 전에 다음에 대한 MySQL 데이터베이스를 설정하겠습니다. PowerDNS 서비스. 먼저 MySQL 서버에 연결하고 powerdns라는 이름의 데이터베이스를 생성합니다.

mysql -u root -p
MariaDB [(none)]> CREATE DATABASE powerdns;

7. 다음으로 powerdns라는 데이터베이스 사용자를 생성합니다.

MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'localhost' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> GRANT ALL ON powerdns.* TO 'powerdns'@'centos7.localdomain' IDENTIFIED BY 'tecmint123';
MariaDB [(none)]> FLUSH PRIVILEGES;

참고:tecmint123”을 설정에 사용하려는 실제 비밀번호로 바꾸세요.

8. PowerDNS에서 사용하는 데이터베이스 테이블을 생성하는 작업을 진행합니다. 해당 블록을 블록별로 실행합니다.

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

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

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

MariaDB [(none)]> CREATE TABLE supermasters (
ip VARCHAR(25) NOT NULL,
nameserver VARCHAR(255) NOT NULL,
account VARCHAR(40) DEFAULT NULL
);

이제 다음을 입력하여 MySQL 콘솔을 종료할 수 있습니다.

MariaDB [(none)]> quit;

9. 마지막으로 MySQL을 백엔드로 사용하는 방식으로 PowerDNS 구성을 진행할 수 있습니다. 이를 위해 다음 위치에 있는 PowerDNS 구성 파일을 엽니다.

vim /etc/pdns/pdns.conf 

해당 파일에서 다음과 같은 줄을 찾으세요.

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

그 직후에 다음 코드를 입력하세요.

launch=gmysql
gmysql-host=localhost
gmysql-user=powerdns
gmysql-password=user-pass
gmysql-dbname=powerdns

앞서 설정한 실제 비밀번호로 'user-pass'를 변경하세요. 내 구성은 다음과 같습니다.

변경 사항을 저장하고 종료합니다.

10. 이제 시스템 부팅 시 시작되는 서비스 목록에 PowerDNS를 시작하고 추가하겠습니다.

systemctl enable pdns.service 
systemctl start pdns.service 

이제 PowerDNS 서버가 실행 중입니다. PowerDNS에 대한 자세한 내용은 http://downloads.powerdns.com/documentation/html/index.html에서 제공되는 설명서를 참조하세요.