2007년 5월 29일 화요일

mySQL Bind 설치..

Bind정보를 파일로 보다는 DB로 가지고 있는게 더 좋지...해보자..

Step 1.  mySQL Bind를 다운로드 받는다.
http://sourceforge.net/project/downloading.php?group_id=103722&use_mirror=nchc&filename=mysql-bind-0-1.tgz&40318992
여기서 받았음

Step 2.  서버로 옮긴 후 앞축을 풀었다.
tar -xvzf mysql-bind-0-1.gz

Step 3. mysqldb.c 와 mysqldb.h 를
 bind9/bin/named , bind9/bin/named/include 에 복사 한다.

Step 4. bin/named/Makefile.in 내부에 DBDRIVER_OBJS and DBDRIVER_SRCS 라인을 추가 한다.
(e.g. add mysqldb.c to DBDRIVER_SRCS and mysqldb.@O@ to DBDRIVER_OBJS).

Step 5. mysql_config --cflags 의 결과에 DBDRIVER_INCLUDES 추가한다.
DBDRIVER_INCLUDES = -I'/usr/include/mysql'

Step 6. mysql_config --libs의 결과에 DBRIVER_LIBS 구가
DBDRIVER_LIBS = -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files -lns
s_dns -lresolv

#---------------------------------
#
# Add database drivers here.
#
DBDRIVER_OBJS = mysqldb.c
DBDRIVER_SRCS = mysqldb.@O@
DBDRIVER_INCLUDES = -I'/usr/include/mysql'
DBDRIVER_LIBS = -L'/usr/lib/mysql' -lmysqlclient -lz -lcrypt -lnsl -lm -lc -lnss_files -lnss_dns -lresolv -lc -lnss_files -lnss_dns -lresolv
#---------------------------------



Step 7. bind9/bin/named/main.c 의 내부에 mysqldb.h를 인쿨르드 한다. ( #include "mysqldb.h" )

7-1. main.c의 setup() 내부에 mysqldb_init() 추가
       ns_server_create(ns_g_mctx, &ns_g_server) 앞에 있어야 함
7-2. cleanup()에 mysqldb_clear() 추가

Unregistration should be in cleanup(), by adding the call mysqldb_clear()

Step 8 Bind 새로 설치
You should now be able to change to your BIND directory and build BIND with the commands

./configure
make
make install

ENTRY IN NAMED.CONF
===================

zone "mydomain.com" {
  type master;
  notify no;
  database "mysqldb dbname tablename hostname user password";
};

zone 파일을 변경해야 한다
In the database line, dbname is the name of the MySQL database,
tablename is the name of the table for this domain/zone,
hostname is the name of the database host,
user and password are for access to the database.

DATABASE SCHEMA
===============

You should create a database for the driver and add one table for each domain. The following SQL will create a table for one domain.
 Change mydomain to something that will represent the domain more clearly.

CREATE TABLE mydomain (
  name varchar(255) default NULL,
  ttl int(11) default NULL,
  rdtype varchar(255) default NULL,
  rdata varchar(255) default NULL
) TYPE=MyISAM;


INSERT INTO mydomain VALUES ('mydomain.com', 259200, 'SOA', 'mydomain.com. www.mydomain.com. 200309181 28800 7200 86400 28800');
INSERT INTO mydomain VALUES ('mydomain.com', 259200, 'NS', 'ns0.mydomain.com.');
INSERT INTO mydomain VALUES ('mydomain.com', 259200, 'NS', 'ns1.mydomain.com.');
INSERT INTO mydomain VALUES ('mydomain.com', 259200, 'MX', '10 mail.mydomain.com.');
INSERT INTO mydomain VALUES ('w0.mydomain.com', 259200, 'A', '192.168.1.1');
INSERT INTO mydomain VALUES ('w1.mydomain.com', 259200, 'A', '192.168.1.2');
INSERT INTO mydomain VALUES ('mydomain.com', 259200, 'Cname', 'w0.mydomain.com.');
INSERT INTO mydomain VALUES ('mail.mydomain.com', 259200, 'Cname', 'w0.mydomain.com.');
INSERT INTO mydomain VALUES ('ns0.mydomain.com', 259200, 'Cname', 'w0.mydomain.com.');

댓글 없음:

댓글 쓰기