DNS Server를 하나 구성하고 싶어 기웃거리던중 대표적인 DNS로 꼽히는 BIND를 설치해보기로 했다. 
PowerDNS나 dnsmasq도 있으나, 각각 너무 크거나 단순해서 적당히 복잡하고 유명한 BIND를 선택했다. BIND는 여러 버전이 있어 왔지만, 현재 사용되는건 BIND9이고 보통 BIND라고만 하면 BIND9이라고 생각하면 되는것 같다.

CentOS8.2 minimal VM을 한대 구성해서 아래와 같이 진행 내용을 기록한다.

환경
CentOS Linux release 8.2.2004
4.18.0-193.el8.x86_64

BIND9 설치
wget https://downloads.isc.org/isc/bind9/9.16.4/bind-9.16.4.tar.xz
tar xvf bind-9.16.4.tar.xz
cd bind-9.16.4
./configure

 에러발생
configure: error: in `/opt/bind-9.16.4':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

centos 설치시 minimal로 설치하는 바람에 C compiler가 없다. 
gcc를 설치한다.
yum install gcc

다시 에러발생
configure: error: Python >= 2.7 or >= 3.2 and the PLY package are required for dnssec-keymgr and other Python-based tools. PLY may be available from your OS package manager as python-ply or python3-ply; it can also be installed via pip. To build without Python/PLY, use --without-python.

python도 없다.. python을 설치한다. ply가 필요한거지만, python 설치시 기본 패키지로 설치되는듯 하다.
친숙한 3.6버전으로
yum install python36
pip3 install ply

다시 에러발생
configure: error: libuv not found

yum 으로 libuv를 받아도 정상적으로 인식하지 않는다.
이슈를 보니 라이브러리가 필요한것으로 libuv-devel이 필요하다.
centos 기본 repository에는 libuv-devel이 없으나, epel repository에는 있다. 
yum install epel-release
yum install libuv-devel

다시 에러발생
checking whether compiling and linking against OpenSSL works... no
configure: error: in `/opt/bind-9.16.4':
configure: error: OpenSSL/LibreSSL not found
See `config.log' for more details

openssl관련에러, DNSSEC을 위해서 필요한것 같다. 사용할일은 없을 것 같긴하지만 우선 받는다.
openssl은 있을것이고 openssl-devel이 필요하다.
yum install openssl-devel

다시에러
checking for sys/capability.h... no
configure: error: sys/capability.h header is required for Linux capabilities support. Either install libcap or use --disable-linux-caps.

libcap-devel을 받아준다.
yum install libcap-devel

성공했다.
Configuration summary:
-------------------------------------------------------------------------------
Optional features enabled:
    GSS-API (--with-gssapi)
    Print backtrace on crash (--enable-backtrace)
    Use symbol table for backtrace, named only (--enable-symtable)
    DNSSEC validation active by default (--enable-auto-validation)
    Dynamically loadable zone (DLZ) drivers:
        None
-------------------------------------------------------------------------------
Features disabled or unavailable on this platform:
    Small-system tuning (--with-tuning)
    Allow 'dnstap' packet logging (--enable-dnstap)
    GeoIP2 access control (--enable-geoip)
    DNS Response Policy Service interface (--enable-dnsrps)
    Allow 'fixed' rrset-order (--enable-fixed-rrset)
    Using PKCS#11 for Public-Key Cryptography (--with-native-pkcs11)
    Very verbose query trace logging (--enable-querytrace)
    Use GNU libtool (--with-libtool)
    CMocka Unit Testing Framework (--with-cmocka)
    XML statistics (--with-libxml2)
    JSON statistics (--with-json-c)
    LMDB database to store configuration for 'addzone' zones (--with-lmdb)
    IDN support (--with-libidn2)
-------------------------------------------------------------------------------
Configured paths:
    prefix: /usr/local
    sysconfdir: ${prefix}/etc
    localstatedir: ${prefix}/var
-------------------------------------------------------------------------------
Compiler: gcc
    gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5)
    Copyright (C) 2018 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
-------------------------------------------------------------------------------
For more detail, use --enable-full-report.
===============================================================================

이제 빌드해준다.
make

그리고 설치
make install

설치상태 확인
BIND 9.16.4 (Stable Release) <id:0849b42>
running on Linux x86_64 4.18.0-193.el8.x86_64 #1 SMP Fri May 8 10:59:10 UTC 2020
built by make with defaults
compiled by GCC 8.3.1 20191121 (Red Hat 8.3.1-5)
compiled with OpenSSL version: OpenSSL 1.1.1c FIPS  28 May 2019
linked to OpenSSL version: OpenSSL 1.1.1c FIPS  28 May 2019
compiled with zlib version: 1.2.11
linked to zlib version: 1.2.11
threads support is enabled


default paths:
  named configuration:  /usr/local/etc/named.conf
  rndc configuration:   /usr/local/etc/rndc.conf
  DNSSEC root key:      /usr/local/etc/bind.keys
  nsupdate session key: /usr/local/var/run/named/session.key
  named PID file:       /usr/local/var/run/named/named.pid
  named lock file:      /usr/local/var/run/named/named.lock

정상적으로 설치 완료되면 다음은 셋팅후 실행이다.
yum이나 apt등 package manager로 설치하는 경우 기본적인 config 파일이 존재하는데 빌드해서 설치하면 config 파일이 전혀 없어 하나씩 구성해야 한다.


'준슝 > homelab' 카테고리의 다른 글

raspberry pi4 에서 php build 하기  (0) 2020.03.22
raspberry pi4 에서 php build 하기

php를 받고 ./configure 해서 빌드를 시작한다.
하는 중에 아래 에러 발생
configure: error: Package requirements (libxml-2.0 >= 2.7.6) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

libxml2-dev를 받았다
apt install libxml2-dev

다시 빌드하는데 아래 에러발생
configure: error: Package requirements (sqlite3 > 3.7.4) were not met:


No package 'sqlite3' found


Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.


Alternatively, you may set the environment variables SQLITE_CFLAGS
and SQLITE_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

sqlite3를 받아준다.

apt install sqlite3

그런데 repository의 버전이 3.27.2-3 이 최신이다. 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
sqlite3 is already the newest version (3.27.2-3).

sqlite를 쓰지 않을것 같으니 그냥 제외하기로했다.
./configure --without-sqlite3

그런데 실패한다 ㅠㅠ
그래서 그냥 최신을 받아보기로 했다.

혹시 모르니 설치된 sqlite3는 제거한다.
apt remove sqlite3
https://www.sqlite.org/download.html 에서 최신을 받은후 빌드해본다.
./configure
make
make install
빌드에 7분 정도 시간이 소요된뒤에 완료되었다.

sqlite3 --version
버전을 확인해보니 잘 설치 된것을 확인할 수 있었다.

3.32.0 2020-03-12 17:54:39 ea914bec81c49625072fc9d23faa048300f3a0421e069d303b7203edcdfb3743

다시 php로 돌아가서 ./configure를 시도했다.
성공
혹시모르니 설치전에 미리 apt로 설치된 php를 제거해줬다.
apt remove php-common php7.3-common
apt autoremove

이제  빌드해보자. 
make
30분 정도 소요후 빌드 완료되었다.
안내 되는 대로 make test를 해봤는데 시간이 꽤 걸려서 contribute를 하고 싶은게 아니면 굳이 할 필요 없는것 같다.
make install
설치를 마무리 했다.
php --version
잘 설치 된 것을 확인 할 수 있었다.
PHP 7.4.3 (cli) (built: Mar 17 2020 23:50:46) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

내친김에 apache도 설치해본다.
./configure
또 에러가 발생했다.
checking for APR... no
configure: error: APR not found.  Please read the documentation.
 APR은 Apache Portable Runtime이라고 한다.

arp를 설치해주자.
./configure
마지막 로그에 보면 에러가 발생한것처럼 보이나, 무시해도 되는듯 하다.
rm: cannot remove 'libtoolT': No such file or directory
빌드해주자
make
make install
별다른 에러 없이 완료
다시 httpd에 돌아가서 configure를 해보니
checking for APR-util... no
configure: error: APR-util not found.  Please read the documentation.
APR-util 도 있구나..
같이 설치해준다.
./configure --with-apr=/usr/local/apr/
위에 설치 해줬을때 나온 경로로 옵션을 줘야 하는것 같다. 옵션을 주지 않으면 아래와 같은 에러를 뱉는다.
checking for APR... no
configure: error: APR could not be located. Please use the --with-apr option.
그럼 빌드하자
make
make install
다시 httpd에서 configure 하니 에러.
checking for pcre-config... false
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
pcre.. Perl Compatible Regular Expressions 이라고 한다. 
길어지는것 같으니.. 에러만 나열하면서 쭉 설치를 진행해봤다
결국 모든 패키지들이 아래와 같은 순서로 진행되었고, 필요하다는 패키지들만 설치하면서 진행하면 된다.
wget <package>
tar zxvf <package>
cd <package_directory>
# README / INSTALL 파일 확인
./configure
make
make install

설치된 패키지 위치는 /usr/local/apache2 이고, 이쪽에 있는 bin을 사용해야한다. 필요시 path에 추가해서 사용하면 되겠다.
path는 각 계정 (내 경우는 root)의 home 디렉터리에 있는 rc파일에 넣어준다. (.bashrc, .zshrc 등)

apachectl 을 사용하려보니 아래에러가 발생한다.
/usr/local/apache2/bin/httpd: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or directory
LIB 경로를 추가해주자.
library는 /etc/environment에 추가해줬다.
LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
혹시같은 에러가 발생하면 logout후 다시 로그인해주면 된다.
lynx 관련 에러 발생시 lynx도 설치해준다.

다 해놓고, apache에  php7_module설치를 못해서 좀 헤매었다.
결국 아래옵션을 주고 php를 다시 빌드했다.
apache를 설치한 뒤에 그 경로를 옵션으로 주었다.
./configure --with-apxs2=/usr/local/apache2/bin/apxs
make; make install


'준슝 > homelab' 카테고리의 다른 글

BIND9 DNS 설치하기  (0) 2020.07.01

+ Recent posts