您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > bind+mysql搭建智能DNS
bind+mysql+web管理详细配置全过程yum-yinstallgccgcc-c++gcc-g77flexbisonautoconfautomakebzip2-develzlib-develncurses-devellibjpeg-devellibpng-devellibtiff-develfreetype-develpam-devel本人在AS3.0RH9.0下安装没问题需要的软件包如下:mysql-4.1.9.tar.gzhttp://www.mysql.combind-9.3.1.tar.gzhttp://www.isc.org/prodUCts/BIND/mysql-bind-0-1.tgzhttp://sourceforge.net/projects/mysql-bind/httpd-2.0.54.tar.gzphp-4.3.11.tar.gz1.安装mysql-4.1.9.tar.gzcd/roottarxfzmysql-4.1.9.tar.gz\\解压缩cdmysql-4.1.9./configure--prefix=/usr/local/mysql--with-charset=gbk\\配置安装到/usr/local/mysql支持中文gbkmake\\编译时间比较长看你机器的配置高低了,大概12分钟左右。makeinstallgroupaddmysql\\建立mysql组useraddmysql-gmysql\\建立mysql用户并且加入到mysql组中./scripts/mysql_install_db--user=mysql\\初始化表并且规定用mysql用户来访问初始化表以后就开始给mysql和root用户设定访问权cd/usr/local/mysqlchown-Rroot.\\设定root能访问/usr/local/mysqlchown-Rmysqlvar\\设定mysql用户能访问/usr/local/mysql/var,里面存的是mysql的数据库文件chown-Rmysqlvar/.\\设定mysql用户能访问/usr/local/mysql/var下的所有文件chown-Rmysqlvar/mysql/.\\设定mysql用户能访问/usr/local/mysql/var/mysql下的所有文件chgrp-Rmysql.\\设定mysql组能够访问/usr/local/mysql/usr/local/mysql/bin/mysqld_safe--user=mysql&\\运行mysql12814以上提示表示mysql运行正常。/usr/local/mysql/bin/mysqladmin-urootpassWord*****\\修改mysql密码默认为空密码----------------------------------------------------------------------------------mysql安装全部完成2.安装apachecd/roottarxfzhttpd-2.0.54.tar.gz\\解压缩cdhttpd-2.0.54./configure--prefix=/usr/local/httpd--enable-module=most--enable-shared=max\\配置apachemakemakeinstall/usr/local/httpd/bin/httpd-l\\察看编译进apache的模块Compiledinmodules:core.cmod_Access.cmod_auth.cmod_include.cmod_log_config.cmod_env.cmod_setenvif.cprefork.chttp_core.cmod_mime.cmod_status.cmod_autoindex.cmod_asis.cmod_cgi.cmod_negotiation.cmod_dir.cmod_imap.cmod_actions.cmod_userdir.cmod_alias.cmod_so.c#以上提示表示apache支持dso方式了。这样就可以用dso的方式把php的模块加进来。--------------------------------------------------------------------------------apache安装完成3.安装phpcd/roottarxfzphp-4.3.11.tar.gzcdphp-4.3.11./configure--with-mysql=/usr/local/mysql--with-apxs2=/usr/local/httpd/bin/apxs\\配置指定安装的apache和mysql的路径makemakeinstallcpphp.ini-dist/usr/local/lib/php.ini\\将php.ini-dist复制到/usr/local/lib/,并重命名为php.ini为了让Apache能够直接解析php,我们还要进行一些配置.vi/usr/local/httpd/conf/httpd.conf在httpd.conf文件中,添加AddTypeapplication/x-httpd-php.phpAddTypeapplication/x-httpd-php-source.phps应该将以上两句添加在其他AddType之后。确保文件中有以下一句话,没有就自己添加在所有LoadModule之后。LoadModulephp4_modulemodules/libphp4.so好了,在vi中使用:wq保存httpd.conf文件,退出vi。启动apacheserver:/usr/local/httpd/bin/apachectlstart------------------------------------------------------------------------php安装配置完成4.安装bindtarxfzvbind-9.3.1.tar.gztarxfzvmysql-bind-0-1.tgzcpmysql-bind-0.1/mysqldb.cbind-9.3.1/bin/namedcpmysql-bind-0.1/mysqldb.hbind-9.3.1/bin/named/includecdbind-9.3.1vibin/named/Makefile.in将DBDRIVER_OBJS=DBDRIVER_SRCS=DBDRIVER_INCLUDES=DBDRIVER_LIBS=如下配置DBDRIVER_OBJS=mysqldb.@O@DBDRIVER_SRCS=mysqldb.cDBDRIVER_INCLUDES=-I'/usr/local/mysql/include/mysql'DBDRIVER_LIBS=-L'/usr/local/mysql/lib/mysql'-lmysqlclient-lz-lcrypt-lnsl-lm-lc-lnss_files-lnss_dns-lresolv-lc-lnss_files-lnss_dns-lresolv修改main.c文件vibin/named/main.c找到/**Addcallstoregistersdbdrivershere.*//*xxdb_init();*/添加mysqldb_init();找到/**Addcallstounregistersdbdrivershere.*//*xxdb_clear();*/添加mysqldb_clear();./configure--prefix=/usr/local/named--enable-threads#--enable-threads开启多线程处理能力makemakeinstallcd/usr/local/namedmkdiretc建立etc目录sbin/rndc-confgenetc/rndc.conf生成rndc控制命令的key文件cdetctail-10rndc.confhead-9seds/#\//gnamed.conf从rndc.conf文件中提取named.conf用的key自动在/usr/local/named/etc生成named,conf文件建立localhost.zone文件vilocalhost.zone$TTL86400$ORIGINlocalhost.@1DINSOA@root(42;serial(d.adams)3H;refresh15M;retry1W;eXPiry1D);minimum1DINNS@1DINA127.0.0.1建立named.local文件vinamed.local$TTL86400@INSOAlocalhost.root.localhost.(1997022700;Serial28800;Refresh14400;Retry3600000;Expire86400);MinimumINNSlocalhost.1INPTRlocalhost.dig命令直接生成named.root文件dignamed.root配置named.conf增加如下内容:controls{inet127.0.0.1port953*directivebelow.PreviousversionsofBINDalwaysasked*questionsusingport53,butBIND9.31usesanunprivileged*portbydefault.*///query-sourceaddress*port53;24,9};////acachingonlynameserverconfig//zone.IN{typehint;filenamed.root;};zonelocalhostIN{typemaster;filelocalhost.zone;allow-update{none;};};zone0.0.127.in-addr.arpaIN{typemaster;filenamed.local;allow-update{none;};};zonemydomain.com{typemaster;databasemysqldbdnsdbmydomainlocalhostrootpasswd;配置你的数据库名,表名,MYSQL主机,MYSQL用户,MYSQL密码};zone19.202.220.in-addr.arpa{typemaster;databasemysqldbdnsdbptrlocalhostrootpasswd;配置你的数据库名,表名,MYSQL主机,MYSQL用户,MYSQL密码};--------------------------------------------------------------------------------BIND安装完成5.我是用MYSQLADMIN来建立数据库的和倒数据的,APACHE下安装MYSQLADMIN我这里就不详细讲了。到我的站点http://www.sy165.cn/soft/myadmin.tar下载解压缩到APACHE可访问的目录下就OK了参照mysql-bind-0-1目录下的README建立数据库dnsdb正向解析数据库mydomain表结构CREATETABLEmydomain(namevarchar(255)defaultNULL,ttlint(11)defaultNULL,rdtypevarchar(255)defaultNULL,rdatavarchar(255)defaultNULL)TYPE=MyISAM;以下是正向解析示范可以直接倒入INSERTINTOmydomainVALUES('mydomain.com',259200,'SOA','mydomain.com.www.mydomain.com.20030918128800720
本文标题:bind+mysql搭建智能DNS
链接地址:https://www.777doc.com/doc-834 .html