MyDNS安裝筆記
 
Lab環境:VMware 模擬PC
256MB RAM 8G HDD
作業系統: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安裝
下載MyDNSConfig套件
筆者撰文時,MyDNSConfig版本為MyDNSConfig 1.1.0
MySQL管理工具
自行下載適當版本
 
#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###
 
 
 
#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
 
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)
 
 
 
arrow
arrow
    全站熱搜
    創作者介紹
    創作者 Chang Wayne 的頭像
    Chang Wayne

    Wayne Blog

    Chang Wayne 發表在 痞客邦 留言(6) 人氣()