安装MYDNS建立在MYSQL的基础上.所以你的前提也要安装该服务.
1 起步安装
在例子中我们假设使用域名为server1.example.com 跟随着设的 IP address 192.168.0.100. 这个的设置根据你自己的情况而改变.
2 安装条件
MyDNSConfig 的是基于PHP的基础上开发的.所以你的服务器一定要能支持PHP才能使用它. 它要用到 webserver PHP和 MySQL server. 在这里你也安装 phpMyAdmin好让你管理MYSQL:
用yum来安装:
#yum install httpd mysql-server php php-mysql php-mbstring phpMyAdmin
Start MySQL:
设置启动程序:
#chkconfig --levels 235 mysqld on
#/etc/init.d/mysqld start
设置你MYSQL的密码: MySQL root account:
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
现在我们来配置phpMyAdmin.
<Directory /usr/share/phpMyAdmin/> stanza):
#vi /etc/httpd/conf.d/phpMyAdmin.conf
#
# 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
# < Directory / usr / share / phpMyAdmin />
# order deny,allow
# deny from all
# allow from 127.0 . 0.1
# </ Directory >
# This directory does not require access over HTTP - taken from the original
# phpMyAdmin upstream tarball
#
< Directory / usr / share / phpMyAdmin / libraries >
Order Deny,Allow
Deny from All
Allow from None
</ Directory >
# This configuration prevents mod_security at phpMyAdmin directories from
# filtering SQL etc. This may break your mod_security implementation.
#
# < IfModule mod_security.c >
# < LocationMatch " /phpMyAdmin/(.+) " >
# SecFilterInheritance Off
# </ LocationMatch >
# </ IfModule >
Then we create the system startup links for Apache
然后我们来启动Apache:
#chkconfig --levels 235 httpd on
#/etc/init.d/httpd start
你可以打开IE http://server1.example.com/phpMyAdmin/ or http://192.168.0.100/phpMyAdmin/
输入你的root and root MySQL password.
3 安装配置 MyDNS
进入MySQL 建立数据库:
mysql -u root -p
GRANT SELECT, INSERT, UPDATE, DELETE ON mydns. * TO ' mydns ' @ ' localhost ' IDENTIFIED BY ' mydnspassword ' ;
GRANT SELECT, INSERT, UPDATE, DELETE ON mydns. * TO ' mydns ' @ ' localhost.localdomain ' IDENTIFIED BY ' mydnspassword ' ;
FLUSH PRIVILEGES;
quit;
下载MyDNS:
#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
安装MyDNS:
#cp - rf interface /* /usr/share/mydnsconfig/
#ln -s /usr/share/mydnsconfig/web/ /var/www/html/mydnsconfig安装MyDNS的MySQL Database:
现在配置MyDNS; 设置相映的数据库:
/*
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"] = 'ns1.example.com.'; // must be set if $conf['auto_create_ptr'] is 1. Don't forget the trailing dot!
$conf["default_mbox"] = 'admin.example.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;
?>
然后删除MyDNS的文件 /tmp directory:
#cd /tmp
#rm -rf MyDNSConfig-1.1.0/
#rm -f MyDNSConfig-1.1.0.tar.gz
4 安装 MyDNS
下载代码: download the mydns-mysql rpm package from http://mydns.bboy.net/download/ :
#wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
#rpm -ivh mydns-mysql-1.1.0-1.i386.rpm
打开 MyDNS 配置文件 /etc/mydns.conf, 相对应的数据做一些调整allow-axfr to yes, enable TCP (allow-tcp = yes), and specify a recursive resolver (i.e., a valid nameserver, e.g. from your ISP; e.g. recursive = 213.191.92.86)
#vi /etc/mydns.conf
## ## /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
Next, create the system startup links for MyDNS and start MyDNS:
下一步启动:
#chkconfig --levels 235 mydns on
#/etc/init.d/mydns start
打开你的IE,URL:http://<your_ip_address>/mydnsconfig/
就可以看到要你输入用户名和密码.Username: admin Password: admin
5 使用MyDNSConfig
登录:
添加新 Zone :
添加如下:
SOA
test.com.
Origin
Zone Transfers :
已添加好 你的新Zones (SOA) ,test.com.
下一个添加 Records tab:
添加新的Record button to create a record (A/MX/CNAME/...):
To create the A record www.test.com, fill in www in the Name field, select A as the Type, type in www.test.com's IP address in the Data field (e.g. 1.2.3.4), and specify the TTL (in seconds). The Preference/Priority field can be left empty for A records; it's needed for MX records:
After you've clicked on Save, you will find www.test.com in the list of records for the zone test.com:
That's it already - no restarts are required. You can now test if MyDNS can resolve www.test.com:
dig @localhost www.test.com
If all goes well, the output should look something like this:
[root@server1 ~]# dig @localhost www.test.com
; <<>> DiG 9.5.0a6 <<>> @localhost www.test.com
; (1 server found)
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 55393
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.test.com. IN A
;; ANSWER SECTION:
www.test.com. 86400 IN A 1.2.3.4
;; Query time: 24 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Mon Dec 3 23:47:14 2007
;; MSG SIZE rcvd: 46