ºìÁªLinuxÃÅ»§
Linux°ïÖú

fedora 8ÏÂMyDNSµÄ°²×°£¨×ª£©

·¢²¼Ê±¼ä:2007-12-22 10:28:29À´Ô´:ºìÁª×÷Õß:basiozwq
MyDNSÊÇÒ»ÖÖÒÔMySQLÊý¾Ý¿âΪºǫ́µÄDNS·þÎñÆ÷£¬ËüʹÓÃÊý¾Ý¼Ç¼µÄ¸ñÊ½Ìæ´úÅäÖÃÎļþ¸ñʽµÄ´«Í³DNS·þÎñÆ÷¡£ÀýÈ磺BIND¡£MyDNS·þÎñÆ÷µÄ°²×°ÅäÖú͹ÜÀí¸ü¼Ó¼òµ¥ÈÝÒ×ʵÏÖ £¬¶øÇÒ¸üÈÝÒ×Àí½â¡£Ó봫ͳºÍ»ùÓÚÅäÖÃÎļþµÄDNS·þÎñÆ÷Ïà±È£¬³õѧÕ߸üÄÜ¿ìËÙÈëÃÅ¡£MyDNS´ÓMySQLÊý¾Ý¿âÖжÁÈ¡¼Ç¼£¬µ±¼Ç¼»òÇøÓòÔö¼Ó¡¢Ð޸ġ¢É¾³ýµÄʱºò²»ÓÃÖØÐÂÆô¶¯¡¢¼ÓÔØ·þÎñÆ÷¡£MyDNSConfigÊÇʹÓÃWEBµÄMyDNSÅäÖýӿڣ¬Ëü¿ÉÒÔ´´½¨ËùÓÐÀàÐ͵ÄMyDNS¼Ç¼¡£
²½Ö裺
1¡£ÅäÖÃÍøÂç½Ó¿Ú¡£
ÔÚÕâÀïÎҵĵçÄÔÖ÷»úÃûΪ "wkg.com",IPµØÖ·ÊÇ192.168.1.102¡£ÕâÊǸöÈ˵ÄÉèÖã¬ÇëÒÀÕÕÄãµÄʵ¼ÊÇé¿ö½øÐÐÉèÖá£
2¡£ÅäÖÃÈí¼þ»·¾³¡£
MyDNSConfig ÊÇ»ùÓÚPHPµÄ»ù´¡ÉÏ¿ª·¢µÄ¡£ËùÒÔÄãµÄ·þÎñÆ÷Ò»¶¨ÒªÄÜÖ§³ÖPHPºÍMySQL²ÅÐС£ËüÒªÓõ½ Apache PHPºÍ MySQL ¡££¨Èç¹ûÄãÒѾ­°²×°ºÍÅäÖúÃÁËËüÃǵϰ¿ÉÒÔÌø¹ýÕâÒ»²½ £©ÔÚÕâÀïÄãÒ²Òª°²×° phpMyAdminÀ´¹ÜÀíMySQL¡£
2.1£º°²×°¸÷ÖÖÈí¼þ£ºÊ¹ÓÃyumÃüÁîÀ´°²×°¼È¿ÉÒÔ½â¾öÒÀÀµÐÔÎÊÌ⣬Ҳ¿ÉÒԵõ½¸üа汾µÄÈí¼þ¡£
# yum install httpd mysql-server php php-mysql php-mbstring phpMyAdmin
2.2£ºÆô¶¯MySQLÊý¾Ý¿â(start mysql database)
# chkconfig --levels 235 mysqld on //ÈÃMySQLÔÚ·þÎñÆ÷Æô¶¯Ê±×Ô¶¯Æô¶¯
# /etc/init.d/mysqld start
2.2£ºÉèÖÃMySQL µÄroot Óû§ÃÜÂë
# mysqladmin -u root password yourrootsqlpassword
# mysqladmin -h wkg.com -u root password yourrootsqlpassword
2.3: ÏÖÔÚÎÒÃÇÀ´ÅäÖà phpMyAdmin¡£ÐÞ¸ÄApacheÅäÖÃÎļþ£¬ÔÊÐí phpMyAdminÄÜͨ¹ý±ðµÄÖ÷»ú·ÃÎÊ£¬²»ÊÇÖ»ÄÜÔÚlocalhost¿ÉÒÔ·ÃÎÊ¡££¨×¢Ïúµô£©
gedit /etc/httpd/conf.d/phpMyAdmin.conf (Ò²¿ÉÒÔÓÃvi ±à¼­Æ÷À´±à¼­£©
Ð޸ĺóµÄphpMyAdmin.conf ÈçÏ£º
[table=98%][tr][td] # phpMyAdmin - Web based MySQL browser written in php
#
# Allows only localhost by default
#
# But allowing phpMyAdmin to anyone other than localhost should be considered
# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
#
# order deny,allow
# deny from all
# allow from 127.0.0.1
#


# This directory does not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#

Order Deny,Allow
Deny from All
Allow from None


# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
#
#
# SecFilterInheritance Off
#

#
[/td][/tr][/table]
2.4£º´´½¨Æô¶¯ÏîºÍÆô¶¯Apache
# chkconfig --levels 235 httpd on
# /etc/init.d/httpd start

ÏÖÔÚ¿ÉÒÔÔÚä¯ÀÀÆ÷Öдò¿ª£ºhttp://wkg.com/phpMyAdmin/ »òÕß http://192.168.1.102/phpMyAdmin/ ʹÓÃÄãµÄРroot MySQLÃÜÂëµÇ½½øÈ¥¡£
3 °²×°MyDNSConfig (Installing MyDNSConfig)3.1 µÇ¼MySQLºÍ´´½¨Êý¾Ý¿â£¬´´½¨Êý¾Ý¿âÓû§ºÍÊÚȨ
££ mysql -u root -p
mysql> CREATE DATABASE mydns;
mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO 'mydns'@'localhost' IDENTIFIED BY 'mydnspassword';
mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO 'mydns'@'localhost.localdomain' IDENTIFIED BY 'mydnspassword';
//ÒÔÉÏÁ½ÌõÓï¾äµÄ×÷ÓÃÊÇ´´½¨Óû§²¢ÊÚȨ¡£
mysql> FLUSH PRIVILEGES;
mysql> quit;
×¢£ºmydnspasswordÊÇÄãн¨µÄMySQLÓû§µÄÃÜÂ룬Çë¸ù¾Ý×Ô¼ºµÄʵ¼ÊÇé¿öÉèÖá£
3.2 ÏÂÔØºÍ°²×° MyDNSConfig£º
££ cd /tmp
££ wget http://mesh.dl.sourceforge.net/sourceforge/mydnsconfig/MyDNSConfig-1.1.0.tar.gz
££ tar xvfz MyDNSConfig-1.1.0.tar.gz
££ cd MyDNSConfig-1.1.0
££ mkdir /usr/share/mydnsconfig

££ cp -rf interface/* /usr/share/mydnsconfig/
££ ln -s /usr/share/mydnsconfig/web/ /var/www/html/mydnsconfig
[color=black]3.3°²×°
[/color]MyDNSConfig MySQL Database£¨ÔÚÉÏÃæµÄ»ù´¡ÉÏ£©
££ mysql -u root -p mydns < install/mydnsconfig.sql
»áÌáʾÊäÈëÓû§ÃÜÂë¡£ÊäÈëÄãµÄMySQL root Óû§ÃÜÂë¡£¼´¿ÉÍê³É¶ÔÓ¦Êý¾Ý¿âµÄÈË´´½¨¡£
3.4±à¼­MyDNSConfigµÄÅäÖÃÎļþ
gedit /usr/share/mydnsconfig/lib/config.inc.php
[table=98%][tr][td] /*
Copyright (c) 2005, Till Brehm, Falko Timme, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
ini_set('register_globals',0);
$conf["app_title"] = "MyDNSConfig";
$conf["app_version"] = "1.1.0";

$conf["rootpath"] = "/usr/share/mydnsconfig";
$conf["fs_div"] = "/"; // File system divider, \\ on windows and / on linux and unix
$conf["classpath"] = $conf["rootpath"].$conf["fs_div"]."lib".$conf["fs_div"]."classes";
$conf["temppath"] = $conf["rootpath"].$conf["fs_div"]."temp";

/*
Database Settings
*/

$conf["db_type"] = 'mysql';
$conf["db_host"] = 'localhost';
$conf["db_database"] = 'mydns';
$conf["db_user"] = 'mydns';
$conf["db_password"] = 'mydnspassword';

/*
External programs
*/
$conf["programs"]["wput"] = $conf["rootpath"]."/tools/wput/wput";

/*
Themes
*/
$conf["theme"] = 'grey';
$conf["html_content_encoding"] = 'text/html; charset=iso-8859-1';
$conf["logo"] = 'themes/default/images/mydnsconfig_logo.gif';
/*
Default Language
*/
$conf["language"] = 'en';

/*
Auto Load Modules
*/
$conf["start_db"] = true;
$conf["start_session"] = true;
/*
DNS Settings
*/
$conf["auto_create_ptr"] = 1; // Automatically create PTR records?
$conf["default_ns"] = 'wkg.com.'; // must be set if $conf['auto_create_ptr'] is 1. Don't forget the trailing dot!
$conf["default_mbox"] = 'root.wkg.com.'; // Admin email address. Must be set if $conf['auto_create_ptr'] is 1. Replace "@" with ".". Don't forget the trailing dot!
$conf["default_ttl"] = 86400;
$conf["default_refresh"] = 28800;
$conf["default_retry"] = 7200;
$conf["default_expire"] = 604800;
$conf["default_minimum_ttl"] = 86400;
?>[/td][/tr][/table]
3.5Íê³ÉÉÏÃæµÄÉèÖÃÖ®ºó´Ó /tmp Ŀ¼ÖÐɾ³ýMyDNSConfig

# cd /tmp
# rm -rf MyDNSConfig-1.1.0/
# rm -f MyDNSConfig-1.1.0.tar.gz

4:°²×° MyDNS
4.1 ´Ó http://mydns.bboy.net/download/ ÏÂÔØ mydns-mysql RPM°ü ²¢°²×°Ëü
££ wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
££ rpm -ivh mydns-mysql-1.1.0-1.i386.rpm
4.2 ´ò¿ªMyDNS ÅäÖÃÎļþ /etc/mydns.conf,Ïà¶ÔÓ¦µÄÊý¾Ý¿â×öһЩµ÷Õû[font=Courier New]allow-axfr[/font] to [font=Courier New]yes[/font], enable TCP ([font=Courier New]allow-tcp = yes[/font]), and specify a recursive resolver (i.e., a valid nameserver, e.g. from your ISP; e.g. [font=Courier New]recursive = 213.191.92.86[/font])
££ gedit /etc/mydns.conf
ÐÞ¸ÄÖ®ºóΪÈçÏ£º
[table=95%][tr][td] ##
## /etc/mydns.conf
## Wed Jan 18 17:18:48 2006
## For more information, see mydns.conf(5).
##


# DATABASE INFORMATION

db-host = localhost # SQL server hostname
db-user = mydns # SQL server username
db-password = mydnspassword # SQL server password
database = mydns # MyDNS database name


# GENERAL OPTIONS

user = nobody # Run with the permissions of this user
group = nobody # Run with the permissions of this group
listen = * # Listen on these addresses ('*' for all)
no-listen = # Do not listen on these addresses


# CACHE OPTIONS

zone-cache-size = 1024 # Maximum number of elements stored in the zone cache
zone-cache-expire = 60 # Number of seconds after which cached zones expires
reply-cache-size = 1024 # Maximum number of elements stored in the reply cache
reply-cache-expire = 30 # Number of seconds after which cached replies expire


# ESOTERICA

log = LOG_DAEMON # Facility to use for program output (LOG_*/stdout/stderr)
pidfile = /var/run/mydns.pid # Path to PID file
timeout = 120 # Number of seconds after which queries time out
multicpu = 1 # Number of CPUs installed on your system
recursive = 213.191.92.86 # Location of recursive resolver
allow-axfr = yes # Should AXFR be enabled?
allow-tcp = yes # Should TCP be enabled?
allow-update = no # Should DNS UPDATE be enabled?
ignore-minimum = no # Ignore minimum TTL for zone?
soa-table = soa # Name of table containing SOA records
rr-table = rr # Name of table containing RR data
soa-where = # Extra WHERE clause for SOA queries
rr-where = # Extra WHERE clause for RR queries[/td][/tr][/table]

ÏÂÒ»²½´´½¨Æô¶¯¶ÔÏó£¬ÈÃϵͳÆô¶¯Ê±Æô¶¯MyDNS.
# chkconfig --levels 235 mydns on
# /etc/init.d/mydns start
4.3ÓÃä¯ÀÀÆ÷´ò¿ªURL£ºhttp:///mydnsconfig/
È»ºóÓÃĬÈϵÄÓû§ÃûºÍÃÜÂë½øÐеǼ£¬Ä¬ÈϵÄÓû§ÃûºÍÃÜÂëÊÇadmin¡£¿ÉÒÔÔÚ System > UsersÐÞ¸ÄÄãµÄÓû§ÃÜÂë¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ