MyDNS-ng + mysql + MyDNSConfig(Web管理)

MyDNS-ng http://www.mydns-ng.com/

mydnsconfig:  MyDNSConfig Homepage   下载http://sourceforge.net/projects/mydnsconfig/files/mydnsconfig/


环境:Centos6.7(x64) + mydns-1.2.8.31 + MyDNSConfig-3.0.1/MyDNSConfig-1.1.0

所需包下载到 /usr/local/src


一、安装LAMP

yum install -y php php-mysql gcc mysql mysql-server mysql-devel httpd httpd-devel php-mbstring mysql-connector-odbc

chkconfig httpd on;

chkconfig mysql on;

service mysqld start

设置mysql root密码

mysql

mysql> use mysql;

mysql> update user set password=password('mima_123456') where user='root';

mysql> flush privileges;

mysql> quit


二、安装myDNS

cd /usr/local/src

tar -zxvf mydns-1.2.8.31.tar.gz

cd mydns-1.2.8.31

./configure --prefix=/usr/local/mydns --with-mysql-lib=/usr/lib64/mysql --with-zlib=/usr/lib64

make; make install


#创建mydns启动脚本

vi /etc/init.d/mydns

####

#! /bin/sh   

# mydns         Start the MyDNS server   

# Author:       Falko Timme <>.   

# chkconfig: - 80 75

# description: mydns


set -e   

PATH=/usr/local/mydns/sbin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin   

NAME=mydns   

DAEMON=/usr/local/mydns/sbin/$NAME   

DESC="MyDNS Server" 

SCRIPTNAME=/etc/init.d/$NAME   

# Gracefully exit if the package has been removed.   

test -x $DAEMON || exit 0   

case "$1" in 

  start)   

         echo -n "Starting $DESC: $NAME" 

         $DAEMON --background   

         echo "." 

         ;;   

   stop)   

         echo "Stopping $DESC: $NAME." 

         kill -9 `pidof $NAME` &> /dev/null   

         ;;   

   restart)   

         echo "Restarting $DESC: $NAME." 

         $0 stop && sleep 1   

         $0 start   

         ;;   

   *)   

         echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2   

         exit 1   

         ;;   

esac   

exit 0

####

chmod +x /etc/init.d/mydns

cp /usr/local/src/mydns-1.2.8.31/mydns.conf /etc

useradd -M -s /sbin/nologin mydns    创建运行mydns的帐号

修改 /etc/mydns.conf 中

user = nobody  ==>修改为 user = mydns

group = nogroup ==>修改为 group = mydns

chkconfig mydns on


三、安装MyDNSConfig-3.0.1

tar -zxvf MyDNSConfig-3.0.1.tar.gz

cd mydnsconfig/install


编辑 ./lib/install.lib.php 找到以下这段 

   if(stristr($content,'CentOS release 5.2 (Final)')) { 

   $distname = 'CentOS'; 

   $distver = '5.2'; 

   $distid = 'centos52'; 

   $distbaseid = 'fedora'; 

   swriteln("Operating System: CentOS 5.2 or compatible\n"); 

  } 

 

更改为 

   if(stristr($content,'CentOS release 6.7 (Final)')) { 

   $distname = 'CentOS'; 

   $distver = '6.7'; 

   $distid = 'centos52';  ## 此处不要改 

   $distbaseid = 'fedora'; 

   swriteln("Operating System: CentOS 6.7 or compatible\n"); 

不改安装时会报错:

PHP Notice: Undefined variable: distver in /tmp/ispconfig3_install/install/lib/install.lib.php on line 135 

PHP Notice: Undefined variable: distid in /tmp/ispconfig3_install/install/lib/install.lib.php on line 135 

PHP Notice: Undefined variable: distbaseid in /tmp/ispconfig3_install/install/lib/install.lib.php on line 35 

Linux Distribution of Version not recognized. 


php -q install.php     #执行安装脚本

################################################## 

This will start the MyDNSConfig 3 installer: 

server1:/tmp/mydnsconfig/install# php -q install.php 


-------------------------------------------------------------------------------- 

__  __       _____  _   _  _____  _____             __ _ 

|  \/  |     |  __ \| \ | |/ ____|/ ____|           / _(_) 

| \  / |_   _| |  | |  \| | (___ | |     ___  _ __ | |_ _  __ _ 

| |\/| | | | | |  | | . ` |\___ \| |    / _ \| '_ \|  _| |/ _` | 

| |  | | |_| | |__| | |\  |____) | |___| (_) | | | | | | | (_| | 

|_|  |_|\__, |_____/|_| \_|_____/ \_____\___/|_| |_|_| |_|\__, | 

         __/ |                                             __/ | 

        |___/                                             |___/ 

-------------------------------------------------------------------------------- 


>> Initial configuration 

Operating System: Debian Lenny/Sid or compatible 

    Following will be a few questions for primary configuration so be careful. 

    Default values are in [brackets] and can be accepted with <ENTER>. 

    Tap in "quit" (without the quotes) to stop the installer. 


Select language (en,de) [en]: <-- ENTER 

Installation mode (standard,expert) [standard]: <-- ENTER 

Full qualified hostname (FQDN) of the server, eg server1.domain.tld  [server1.example.com]: <-- ENTER 

MySQL server hostname [localhost]: <-- ENTER 

MySQL root username [root]: <-- ENTER 

MySQL root password []: <-- your rootsql password 

MySQL database to create [dbmydnsconfig]: <-- ENTER 

MySQL charset [utf8]: <-- ENTER 

Configuring MyDNS 

Configuring Apache 

Configuring Firewall 

Installing MyDNSConfig 

MyDNSConfig Port [8080]: <-- ENTER 

Installing Crontab 

no crontab for root 

Restarting services ... 

Restarting web server: apache2 ... waiting . 

Installation completed. 

server1:/tmp/mydnsconfig/install# 

The installer automatically configures all underlying services, so no manual configuration is needed. 

Afterwards you can access MyDNSConfig 3 under http://server1.example.com:8080/ or http://192.168.0.100:8080/. Log in with the username admin and the password admin (you should change the default password after your first login): 


------------------------------------------------------------------------ 

最后可能会提示http启动失败 

修改一下配置文件 

#vim /etc/http/conf/httpd.conf 

在该配置文件的最后三行,注释 NAMESERVER *:80  和NAMESERVER *:443两行 

(如果按以上操作之后还是失败,最后一行改成Include /etc/httpd/conf/sites-enabled/*.vhost

) 

注:以上执行

1、新建了数据库dbmydnsconfig,并新建了mysql帐号ispconfig,使用复杂密码

2、新建apache站点,目录 /usr/local/ispconfig (/var/www/ispconfig 软链接到 /usr/local/ispconfig/interface/web)

3、修改 /etc/mydns.conf配置中连接mysql的帐号、密码、库


再重启httpd、启动 mydns(注意:/etc/mydns.conf配置文件中确定 soa-table = dns_soa、rr-table = dns_rr)

http://ip:8080 访问 

登录用户名和密码 admin

wKiom1Y0NL6Sbr4kAAIyaLPwm-Q614.jpg



四、如果想使用MyDNSConfig-1.1.0做WEB管理,安装也差不多


1、创建数据库及用户

mysql> create database mydns;

mysql> grant all on mydns.* to mydns@localhost identified by '123456'; 

mysql> flush privileges; 


tar xvfz MyDNSConfig-1.1.0.tar.gz -C /usr/loacl/src

cd /usr/local/src/MyDNSConfig-1.1.0

mkdir /usr/share/mydnsconfig

cp -rf interface/* /usr/share/mydnsconfig/

ln -s /usr/share/mydnsconfig/web/ /var/www/html/mydns


创建域表以及记录表等,这里直接可以使用MyDNSConfig自带的脚本来快速创建

# mysql -u mydns -p mydns < install/mydnsconfig.sql


编辑MyDNSConfig 的配置文件

#vim /usr/share/mydnsconfig/lib/config.inc.php(修改认证密码即可)


$conf["db_type"] = 'mysql';

$conf["db_host"] = 'localhost';

$conf["db_database"] = 'mydns';

$conf["db_user"] = 'mydns';

$conf["db_password"] = '123456';

注:如果安装目录与上面的不一样,修改 $conf["rootpath"]的值


修改/etc/mydns.conf 连接数据库信息(db-host、db-user、db-password)

最后启动httpd、mydns

访问 http://Server_IP/mydns     (帐号、密码为 amdin )

wKiom1Y0P4qiZy86AAF9mr23k7c397.jpg

你可能感兴趣的:(mysql,+,+,MyDNS-NG)