DNS安装bind+webmin
1.系统初始化配置yum
#添加访问互联路由
cat > /etc/resolv.conf <<EOF
nameserver 114.114.114.114
nameserver 8.8.8.8
EOFcat /etc/resolv.conf#设置为阿里云yum源rm -rf /etc/yum.repos.d/bak && mkdir -p /etc/yum.repos.d/bak && mv /etc/yum.repos.d/* /etc/yum.repos.d/bakcurl -o /etc/yum.repos.d/CentOS-7.repo http://mirrors.aliyun.com/repo/Centos-7.repoyum clean all && yum makecachecd /etc/yum.repos.d#CentOS7使用/etc/rc.d/rc.local设置开机自动启动
chmod +x /etc/rc.d/rc.local#安装依赖包
yum -y install vim net-tools lrzsz unzip gcc telnet wget sshpass ntpdate ntp curl
2.安装bind
yum install -y bind*#开机自启
systemctl enable namedsystemctl restart namedsystemctl status named
3.安装webmin
cat > /etc/yum.repos.d/webmin.repo <<EOF
[Webmin]name=Webmin Distribution Neutralbaseurl=http://download.webmin.com/download/yumenabled=1
EOF#下载jcameron-key.asc密钥文件wget http://www.webmin.com/jcameron-key.asc --no-check-certificate#添加GPG密钥rpm --import jcameron-key.asc#2.安装webmin
yum -y install webmin#开机自启
systemctl enable webminsystemctl restart webminsystemctl status webmin
4.登入webmin
https://2xx.x.xx.10:10000
用服务器账户密码 登入
root
b!Maaa$eLvbT5DR^mkBasd
5.二进制安装bind-9.18.17
安装包下载rpm下载地址:https://pkgs.org/download/bind 输入Bind搜索,依赖bind-utils、bind-libs、bind-licenserpm安装时才需要安装依赖rpm所有版本下载地址:
http://rpm.pbone.net/index.php3?stat=3&limit=1&srodzaj=1&dl=40&search=bind-9.9&field[]=1&field[]=2tar所有版本下载地址:ftp://ftp.isc.org/isctar下载地址:https://ftp.isc.org/isc/bind9/9.18.17/bind-9.18.17.tar.gz可视化管理插件:https://gitee.com/opendevops/codo-dnsyum -y install net-tools vim gcc* tcpdump cmake bind-utils zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel libxml* git wget libtool yum install -y epel-release libuv libuv-devel libcap-devel libcap-devel libnghttp2-devel userspace-rcu-devel xz -d bind-9.18.17.tar.xztar xvf bind-9.*.tarcd /root/bind-9.*./configure --prefix=/usr/local/named #安装
make && make install#查看版本
/usr/local/named/sbin/named -v#创建运行用户-设置不能登入
groupadd named
useradd -g named -s /sbin/nologin namedmkdir /usr/local/named/zones #保存dns zone配置文件的目录
mkdir /usr/local/named/log #保存日志就新建这个目录
touch /usr/local/named/etc/named.conf #保存DNS配置文件cd /usr/local/named/etc/
/usr/local/named/sbin/rndc-confgen > rndc.conf
cat rndc.conf > rndc.key
chmod 777 /usr/local/named/zones/
tail -10 rndc.conf | head -9 | sed s/#\ //g > named.confln -s /usr/local/named/etc/named.conf /etc/named.confchown -R named:named /usr/local/named/
chown -R named:named /var/named/cat /dev/null > /var/log/messages/usr/local/named/sbin/named -u named -c /usr/local/named/etc/named.confps -ef|grep namedcat /var/log/messages
6.设置二进制开机自启
vim /etc/profile
export PATH=$PATH:/usr/local/named/bin/# 刷新环境变量,立即生效
source /etc/profilemkdir -p /etc/named# 编译安装目录:/usr/local/named
# 配置⽂件: /usr/local/named/named.conf
mkdir /etc/named
ln -s /usr/local/named/etc/named.conf /etc/named/# 在系统服务目录里创建 named.service 文件cat > /lib/systemd/system/named.service << EOF
[Unit]
Description = named.server
After = network.target[Service]
Type = forking
ExecStart = /usr/local/named/sbin/named -u named -c /usr/local/named/etc/named.conf
PrivateTmp = true[Install]
WantedBy = multi-user.target
EOF# 开机自启named服务
systemctl enable named# 启动named服务
systemctl start named && systemctl status named# 关闭named服务
systemctl stop named && systemctl status named# 重启named服务
systemctl restart named && systemctl status named# 查看named服务状态
systemctl status named
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!
