当前位置: 首页 > 工具软件 > BIND 10 > 使用案例 >

Bind服务器升级

刘和玉
2023-12-01

本文讲解bind服务器升级安装的相关细节。

1.备份目前数据和配置

2.复制新版本bind到设备上

3.查看当前版本号

先确定当前bind的运行位置。

[root@redhat1 ~]# ps -ef |grep named

named 30279 1 0 15:03 ? 00:00:00 /usr/sbin/named -u
named -t /var/named/chroot root 30516 30448 0 15:42 pts/1
00:00:00 grep named

使用完整路径查看版本号和编译参数。注意:named -V不一定等价于/usr/sbin/named -V。

[root@redhat1 named]# /usr/sbin/named -v

BIND 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6

4.查看GCC是否已经安装

yum search gcc |grep –color ‘^gcc’

gcc-c++.x86_64 : C++ support for GCC
gcc-gnat.x86_64 : Ada 95 support for GCC
gcc-java.x86_64 : Java support for GCC
gcc-objc.x86_64 : Objective-C support for GCC
gcc-objc++.x86_64 : Objective-C++ support for GCC
gcc.x86_64 : Various compilers (C, C++, Objective-C, Java, …)
gcc-gfortran.x86_64 : Fortran support

5.查看当前bind的编译参数

不是每个版本的都支持named -V,如果能够查看到编译参数,则编译的时候使用之前的编译参数,否则,需要通过其他方法确定之前版本的编译参数。

[root@redhat1 named]# named -V

BIND 9.8.2rc1-RedHat-9.8.2-0.17.rc1.el6_4.6 built with
‘–build=x86_64-redhat-linux-gnu’ ‘–host=x86_64-redhat-linux-gnu’
‘–target=x86_64-redhat-linux-gnu’ ‘–program-prefix=’ ‘–prefix=/usr’
‘–exec-prefix=/usr’ ‘–bindir=/usr/bin’ ‘–sbindir=/usr/sbin’
‘–sysconfdir=/etc’ ‘–datadir=/usr/share’ ‘–includedir=/usr/include’
‘–libdir=/usr/lib64’ ‘–libexecdir=/usr/libexec’
‘–sharedstatedir=/var/lib’ ‘–mandir=/usr/share/man’
‘–infodir=/usr/share/info’ ‘–with-libtool’ ‘–localstatedir=/var’
‘–enable-threads’ ‘–enable-ipv6’ ‘–with-pic’ ‘–disable-static’
‘–disable-openssl-version-check’ ‘–with-dlz-ldap=yes’
‘–with-dlz-postgres=yes’ ‘–with-dlz-mysql=yes’
‘–with-dlz-filesystem=yes’ ‘–with-gssapi=yes’ ‘–disable-isc-spnego’
‘–with-docbook-xsl=/usr/share/sgml/docbook/xsl-stylesheets’
‘–enable-fixed-rrset’ ‘build_alias=x86_64-redhat-linux-gnu’
‘host_alias=x86_64-redhat-linux-gnu’
‘target_alias=x86_64-redhat-linux-gnu’ ‘CFLAGS= -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector –param=ssp-buffer-size=4 -m64 -mtune=generic’ ‘CPPFLAGS= -DDIG_SIGCHASE’ using OpenSSL version: OpenSSL 1.0.0 29 Mar 2010 using libxml2 version: 2.7.6

6.关闭当前DNS服务器

[root@redhat1 /]# /etc/init.d/named stop

7.解压压缩包

[root@redhat1 /]# tar xzvf bind-9.9.9-P4.tar.gz
[root@redhat1 /]# cd bind-9.9.9-P4
[root@redhat1 bind-9.9.9-P4]# vim README #可以查看bind各个版本之间的区别

8.检测/设置编译参数(参数需要根据named -V做相关调整)

./configure是用来检测你的安装平台的目标特征的。比如它会检测你是不是有CC或GCC,它是个shell脚本。默认二进制文件会被放在/usr/local/bin and /usr/local/sbin文件夹中,并且在 /etc查找他们的配置文件。named进程启动时默认会读取/var/named.conf文件中的directory参数。

可以使用./configure –help来查看可用的编译选项的含义。
[root@redhat1 bind-9.9.9-P4]# ./configure –help

以下是部分参数的含义:

1.所有bind相关文件的根目录

–prefix=PREFIX
install architecture-independent files inPREFIX[/usr/local]

2.配置文件存放目录
如果没有指定–prefix参数,–sysconfdir == /etc

–sysconfdir=DIR
read-only single-machine data [PREFIX/etc]

3.数据存放目录
如果没有指定–prefix参数,–localstatedir == /var

–localstatedir=DIR
modifiable single-machine data [PREFIX/var]

9.编译

make是用来编译的,它从Makefile中读取指令,然后编译。
[root@redhat1 bind-9.9.9-P4]# make

10.安装

make install是用来安装的,它也从Makefile中读取指令,安装到指定的位置。
[root@redhat1 bind-9.9.9-P4]# make install

11.查看版本信息,确认是否安装成功

[root@redhat1 named]# named -V

12.在前台运行bind服务器

Run the server in the foreground and force all logging to stderr.
[root@redhat1 named]#named -g

13.RNDC查看bind状态

[root@redhat1 bind-9.9.9-P4]# rndc status

version: 9.8.2rc1-RedHat-9.8.2-0.47.rc1.el6_8.3 CPUs found: 1 worker
threads: 1 number of zones: 7 debug level: 0 xfers running: 0 xfers
deferred: 0 soa queries in progress: 0 query logging is OFF recursive
clients: 0/0/1000 tcp clients: 0/100 server is up and running

14.查看named进程

[root@redhat1 bind-9.9.9-P4]# ps -ef|grep named

named 12214 1 0 09:40 ? 00:00:00 /usr/sbin/named-sdb -u
named -t /var/named/chroot root 12225 64616 0 09:40 pts/0
00:00:00 grep named

15.查询本地DNS服务

尝试做本地解析。
[root@redhat1 bind-9.9.9-P4]# dig @127.0.0.1 . NS

; <<>> DiG 9.8.1-P1 <<>> @127.0.0.1 . NS ; (1 server found) ;; global
options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status:
NOERROR, id: 50092 ;; flags: qr rd ra; QUERY: 1, ANSWER: 13,
AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION: ;. IN NS

;; ANSWER SECTION: . 101119 IN NS
a.root-servers.net. . 101119 IN NS
f.root-servers.net. . 101119 IN NS
l.root-servers.net. . 101119 IN NS
i.root-servers.net. . 101119 IN NS
m.root-servers.net. . 101119 IN NS
g.root-servers.net. . 101119 IN NS
j.root-servers.net. . 101119 IN NS
d.root-servers.net. . 101119 IN NS
k.root-servers.net. . 101119 IN NS
h.root-servers.net. . 101119 IN NS
e.root-servers.net. . 101119 IN NS
c.root-servers.net. . 101119 IN NS
b.root-servers.net.

;; Query time: 0 msec ;; SERVER: 127.0.0.1#53(127.0.0.1) ;; WHEN: Wed
Nov 9 07:12:57 2016 ;; MSG SIZE rcvd: 228

解析成功,至此Bind服务器升级成功。

 类似资料: