当前位置: 主页 > 服务器技术 > DNS服务器 > 在CentOS上安装MyDNS

在CentOS上安装MyDNS

时间:2010-3-12来源:互联网 点击:
操作系统:CentOS 5.0
需要套件:
httpd-devel-2.2.3-6.el5.centos.1
httpd-2.2.3-6.el5.centos.1
perl-DBD-MySQL-3.0007-1.fc6
mysql-5.0.22-2.1
php-mysql-5.1.6-12.el5
mysql-server-5.0.22-2.1
mysql-devel-5.0.22-2.1
php-common-5.1.6-12.el5
php-mbstring-5.1.6-12.el5
php-5.1.6-12.el5
php-pdo-5.1.6-12.el5
php-mysql-5.1.6-12.el5
php-cli-5.1.6-12.el5

上述套件用yum安装
下载MyDNS RPM套件
http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
下载MyDNSConfig套件
http://www.mydnsconfig.org/downloads.htm
笔者撰文时,MyDNSConfig版本为MyDNSConfig 1.1.0
MySQL
管理工具
http://www.phpmyadmin.net/home_page/index.php
自行下载适当版本

#service httpd start               #
启动Apache Server
#service mysqld start           #
启动MySQL
#chkconfig httpd on            #
设定成开机自动启动
#chkconfig mysqld on        #
设定成开机自动启动
#mysql -u root -p               #
root账号登入MySQL Server
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
CREATE DATABASE mydns;                    
建立mydns数据库
GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO ‘mydns‘@‘localhost‘ IDENTIFIED BY ‘mydnspassword‘;           
建立mydns账号及密码,仅供本机登入
GRANT SELECT, INSERT, UPDATE, DELETE ON mydns.* TO ‘mydns‘@‘localhost.localdomain‘ IDENTIFIED BY ‘mydnspassword‘;      
建立mydns账号及密码,可由外登入
FLUSH PRIVILEGES;
quit;
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
安装设定phpmyadmin MySQL 管理工具
#tar jxvf phpMyAdmin-2.9.1.1-all-languages-utf-8-only.tar.bz2
mv
#vi /var/www/html/phpmyadmin/config.inc.php
---------------------------------------------------------------------------------------------------------------------------
* Servers configuration
*/
$i = 1;
/*
* First server
*/
$i++;
/* Authentication type */
$cfg[‘Servers‘][$i][‘auth_type‘] = ‘http‘;
/* Server parameters */
$cfg[‘Servers‘][$i][‘host‘] = ‘localhost‘;
$cfg[‘Servers‘][$i][‘connect_type‘] = ‘tcp‘;
$cfg[‘Servers‘][$i][‘compress‘] = false;
/* Select mysqli if your server has it */
$cfg[‘Servers‘][$i][‘extension‘] = ‘mysql‘;
/* User for advanced features */
$cfg[‘Servers‘][$i][‘controluser‘] = ‘root‘;
$cfg[‘Servers‘][$i][‘controlpass‘] = ‘‘;
/* Advanced phpMyAdmin features */
$cfg[‘Servers‘][$i][‘pmadb‘] = ‘phpmyadmin‘;
$cfg[‘Servers‘][$i][‘bookmarktable‘] = ‘pma_bookmark‘;
$cfg[‘Servers‘][$i][‘relation‘] = ‘pma_relation‘;
$cfg[‘Servers‘][$i][‘table_info‘] = ‘pma_table_info‘;
$cfg[‘Servers‘][$i][‘table_coords‘] = ‘pma_table_coords‘;
$cfg[‘Servers‘][$i][‘pdf_pages‘] = ‘pma_pdf_pages‘;
$cfg[‘Servers‘][$i][‘column_info‘] = ‘pma_column_info‘;
$cfg[‘Servers‘][$i][‘history‘] = ‘pma_history‘;
/*
---------------------------------------------------------------------------------------------------------------------------
###
测试PHPMyAdmin###
http://mydns_ip/phpmyadmin

#tar xvfz MyDNSConfig-1.1.0.tar.gz
#cd MyDNSConfig-1.1.0
安装 MyDNSConfig:
#mkdir /usr/share/mydnsconfig
#cp -rf interface/* /usr/share/html/mydnsconfig/
#ln -s /usr/share/mydnsconfig/web/ /var/www/html/mydnsconfig

汇入MyDNSConfig SQL Database
#mysql -u root -p mydns < install/mydnsconfig.sql

编辑 MyDNSConfig 设定档
#vi /usr/share/mydnsconfig/lib/config.inc.php
----------------------------------------------------------------------------------------------------------------------------
        Database Settings
*/

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

/*
----------------------------------------------------------------------------------------------------------------------------
设定MyDNS设定档
#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 = 168.95.1.1                     # Location of recursive resolver
allow-axfr = no                                # Should AXFR be enabled?
allow-tcp = no                                 # 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
---------------------------------------------------------------------------------------------------------------------------
#serivce mydns start
#mydns
http://your_ip/mydnsconfig/

Testing
#netstat -na | grep udp                 #
查看udp有无启动
udp        0      0 123.123.123.123:53           0.0.0.0:*                      
udp        0      0 127.0.0.1:53                0.0.0.0:*           

#host www.hinet.net
www.hinet.net has address 61.219.38.89
www.hinet.net has address 203.66.88.89
#host www.cjw.xxx.com.tw
www.cjw.xxx.com.tw is an alias for dns.cjw.avc.com.tw.
dns.cjw.avc.com.tw has address 192.168.39.245

#mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 5.0.22
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the buffer.
mysql> use mydns
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------------+
| Tables_in_mydns |
+----------------------+
| rr                           |
| soa                         |
| sys_datalog            |
| sys_dbsync             |
| sys_filesync            |
| sys_group               |
| sys_user                  |
+-----------------------+
7 rows in set (0.00 sec)
mysql> SELECT * FROM rr;
+----+-------------+-----------------+------------------+--------------------+--------------------+-------+-------------------------+-----------+-------------------------+-----+---------+
| id   | sys_userid | sys_groupid    | sys_perm_user | sys_perm_group | sys_perm_other | zone   | name                         | type        | data                           | aux | ttl          |
+----+-------------+-----------------+------------------+--------------------+--------------------+-------+-------------------------+-----------+-------------------------+-----+---------+
| 14 |          1       |           0           | riud                  | riud                    |                            |    5     | mail.cjw.avc.com.tw. | A            | 192.168.0.1               |   0   | 86400 |
| 15 |          1       |           0           | riud                  | riud                    |                            |    5     | www                          | CNAME | dns.cjw.xxx.com.tw. |   0   | 86400 |
| 16 |          1       |           0           | riud                  | riud                    |                            |    5     | ftp                              | CNAME | dns.cjw.xxx.com.tw. |   0   | 86400 |
| 11 |          1       |           0           | riud                  | riud                    |                            |    6     | 1                                | PTR        | dns.cjw.xxx.com.tw. |   0   | 86400 |
| 12 |          1       |           0           | riud                  | riud                    |                            |    5     | dns.cjw.avc.com.tw.   | A            | 192.168.0.2              |   0   | 86400 |
| 13 |          1       |           0           | riud                  | riud                    |                            |    6     | 2                                | PTR        | mail.cjw.xxx.com.tw. |   0   | 86400 |
| 17 |          1       |           0           | riud                  | riud                    |                            |    5     | cjw.avc.com.tw.         | MX         | 192.168.39.246        | 10   | 86400 |
+----+-------------+-----------------+------------------+--------------------+--------------------+-------+-------------------------+-----------+-------------------------+------+--------+
7 rows in set (0.00 sec)

站长资讯网
. TAG: centos mydns 安装
推荐内容最近更新人气排行
关于我们 | 友情链接 | 网址推荐 | 常用资讯 | 网站地图 | RSS | 留言