骑士注册 登录
Linux 中国◆开源社区 返回首页

rayklaus的个人空间 https://linux.cn/space/31197 [收藏] [复制] [分享] [RSS]

日志

centos7 使用named和namedmanager搭建可WEB管理的DNS服务器

已有 145 次阅读2019-08-25 18:10 |个人分类:环境搭建

DNS服务器搭建

1. 环境配置

Centos7

#yum install bind bind-chroot

#yum install  mysql-server php php-soap php-mysql php-intl php-xml php-cli php-soap php-intl

#yum install wget net-tools vim lsof

#rpm --import http://repos.jethrocarr.com/jethrocarr_signing_key.gpg

#wget -O /etc/yum.repos.d/jethrocarr-c7-public.repo \

http://repos.jethrocarr.com/config/centos/7/jethrocarr-c7-public.repo

#yum install namedmanager-www

#yum install namedmanager-bind

#wget http://repo.mysql.com/mysql80-community-release-el7.rpm

#yum localinstall mysql80-community-release-el7-3.noarch.rpm

#yum update

#yum install mysql-community-server

#service mysqld restart

#service httpd restart

#lsof -i:80

#lsof -i:3306

##查看mysql安装时默认密码并验证

#grep "password" /var/log/mysqld.log

##修改密码命令

Mysql>ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new password';

#/usr/share/namedmanager/resources/autoinstall.pl

##mysql8.0创建用户失败,需要手动创建用户

否则报错: Unable to connect to DB:Access denied for user 'namedmanager'@'localhost' (using password: YES)

Mysql>create user "namedmanager"@"localhost" identified by "1qaz@WSX";

##授权

Mysql>GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , INDEX , ALTER , CREATE TEMPORARY TABLES, LOCK TABLES ON `namedmanager` . * TO 'namedmanager'@'localhost';

#修改namedmanager配置文件,vim /etc/namedmanager/config.php

##配置httpd权限,红色部分注释掉 vim /etc/httpd/conf/httpd.conf

##否则出现:You don't have permission to access /namedmanager on this server.

#ln /etc/named.namedmanager.conf /var/named/chroot/etc/named.namedmanager.conf 

#查看mysql数据库用户

Mysql>SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;

#查看数据库

Mysql>show databases; 

配置:

vim /etc/httpd/conf/httpd.conf

/etc/namedmanager/config-bind.php

/var/named/chroot/etc/named.conf

#重启服务service named-chroot restart

#添加开机启动项systemctl enable named httpd mysqld

补充:

Named->named-chroot需要的操作

# ln /etc/named.namedmanager.conf /var/named/chroot/etc/named.namedmanager.conf

# chown named:named /var/named/chroot/etc/named.namedmanager.conf

# cp -rv /usr/share/doc/bind-9.8.2/sample/etc/* /var/named/chroot/etc/

# cp -rv /usr/share/doc/bind-9.8.2/sample/var/* /var/named/chroot/var/

## bind chroot 的目录中创建相关文件

touch /var/named/chroot/var/named/data/cache_dump.db

touch /var/named/chroot/var/named/data/named_stats.txt

touch /var/named/chroot/var/named/data/named_mem_stats.txt

touch /var/named/chroot/var/named/data/named.run

mkdir /var/named/chroot/var/named/dynamic

touch /var/named/chroot/var/named/dynamic/managed-keys.bind 

## Bind 锁定文件设置为可写

chmod -R 777 /var/named/chroot/var/named/data

chmod -R 777 /var/named/chroot/var/named/dynamic

[root@localhost ~]# vi /var/named/chroot/etc/named.conf

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

# 提示: 当前需要修改 named.conf , 添加 include "/etc/named.namedmanager.conf";

 

参考:

1. https://repos.jethrocarr.com/

2. https://github.com/jethrocarr/namedmanager/wiki/Installation

3. http://repo.mysql.com/

 

 

 

返回顶部

分享到微信

打开微信,点击顶部的“╋”,
使用“扫一扫”将网页分享至微信。