在CentOS 5.1上安装MyDNS和MyDNSConfig控制面板
版本1.0
作者:Falko Timme
在本教程中,我将介绍如何在CentOS 5.1上安装和配置MyDNS和MyDNSConfig。 MyDNS是使用MySQL数据库作为后端而不是配置文件的DNS服务器,例如Bind或djbdns。 优点是MyDNS只是从数据库中读取记录,当DNS记录更改或区域被创建/编辑/删除时,不必重新启动/重新加载。 可以通过安装访问同一数据库的MyDNS的第二个实例来轻松设置辅助Nameservers,或者更多冗余,使用MySQL主/从复制功能将数据复制到辅助Nameservers。
MyDNSConfig是一个易于使用的基于Web的MyDNS界面。 MyDNSConfig可以创建MyDNS中可用的所有类型的DNS记录,并添加用户管理和访问权限等功能。
我不会保证这将为您工作!
1初步说明
在本教程中,我使用IP地址为192.168.0.100
的hostname server1.example.com
。 这些设置可能会有所不同,因此您必须在适当的情况下更换它们。
2安装先决条件
首先,我们在CentOS系统上启用RPMforge存储库,因为在本教程中将要安装的一些软件包在官方CentOS 5.1存储库中不可用:
rpm -Uhv http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
MyDNSConfig是以PHP编写的MyDNS的基于Web的界面。 这需要一个启用了PHP的Web服务器和MySQL数据库服务器。 如果您已经安装了Apache,PHP和MySQL,则可以跳过此步骤。 我们还在这里安装phpMyAdmin,以便您有一个Web接口到MySQL数据库,以防您需要它:
yum install httpd mysql-server php php-mysql php-mbstring phpmyadmin
启动MySQL:
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
然后设置MySQL根帐户的密码:
mysqladmin -u root password yourrootsqlpassword
mysqladmin -h server1.example.com -u root password yourrootsqlpassword
现在我们配置phpMyAdmin。 我们更改Apache配置,以便phpMyAdmin允许连接不仅来自localhost(通过注释<Directory“/ usr / share / phpmyadmin”>
节):
vi /etc/httpd/conf.d/phpmyadmin.conf
# # Web application to manage MySQL # #<Directory "/usr/share/phpmyadmin"> # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 #</Directory> Alias /phpmyadmin /usr/share/phpmyadmin Alias /phpMyAdmin /usr/share/phpmyadmin Alias /mysqladmin /usr/share/phpmyadmin |
接下来,我们将phpMyAdmin中的身份验证从cookie
更改为http
:
vi /usr/share/phpmyadmin/config.inc.php
[...] /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'http'; [...] |
然后我们创建Apache的系统启动链接并启动它:
chkconfig --levels 235 httpd on
/etc/init.d/httpd start
现在您可以将浏览器指向http://server1.example.com/phpmyadmin/
或http://192.168.0.100/phpmyadmin/
,并使用用户名root
和新的root MySQL密码登录。
3安装MyDNSConfig
登录到MySQL并创建数据库:
mysql -u root -p
CREATE DATABASE mydns;
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;
使用您选择的密码替换上述命令中的mydnspassword
一词。
下载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
安装MyDNSConfig:
mkdir /usr/share/mydnsconfig
cp -rf interface/* /usr/share/mydnsconfig/
ln -s /usr/share/mydnsconfig/web/ /var/www/html/mydnsconfig
安装MyDNSConfig MySQL数据库:
mysql -u root -p mydns < install/mydnsconfig.sql
上述命令要求输入密码,请输入MySQL root用户的密码。
编辑MyDNSConfig配置; 请确保您填写正确的数据库设置:
vi /usr/share/mydnsconfig/lib/config.inc.php
<?php /* 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; ?> |
之后,从/ tmp目录
中删除MyDNSConfig安装程序:
cd /tmp
rm -rf MyDNSConfig-1.1.0/
rm -f MyDNSConfig-1.1.0.tar.gz