Installing MyDNS And The MyDNSConfig Control Panel On CentOS 6.4
============================================
Server IP:- 66.85.156.87
Hostname :- dns.example.com
In this tutorial I will describe how to install and configure MyDNS and MyDNSConfig on CentOS 6.4.
MyDNS is a DNS server that uses a MySQL database as backend instead of configuration files like, for example, Bind or djbdns.
The advantage is that MyDNS simply reads the records from the database, and it does not have to be restarted/reloaded when DNS records change or zones are created/edited/deleted.
A secondary nameserver can be easily set up by installing a second instance of MyDNS that accesses the same database or, to be more redundant,
uses the MySQL master / slave replication features to replicate the data to the secondary nameserver.
MyDNSConfig is an easy to use web-based interface to MyDNS. MyDNSConfig can create all types of DNS records that are available in MyDNS,
and adds features like user management and access privileges.
Installation:-
First we enable the RPMforge repository on our CentOS system as some of the packages that we are going to install.
Create download directory
[root@server~]# mkdir download
[root@server~]# cd download/
[root@server~]# wget http://apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@server~]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
MyDNSConfig is a web-based interface to MyDNS written in PHP. This requires a webserver with PHP enabled and the MySQL database server.
Lets we setup LAMP Server for this.
Installing Apache2 With PHP5 And MySQL Support On CentOS 6.4 (LAMP)
[root@server~]# yum install mysql mysql-server
[root@server~]# chkconfig mysqld on
[root@server~]# /etc/init.d/mysqld start
[root@server~]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] <-- ENTER
New password: <-- yourrootsqlpassword
Re-enter new password: <-- yourrootsqlpassword
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <-- ENTER
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <-- ENTER
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <-- ENTER
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <-- ENTER
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[root@server~]# yum install httpd
[root@server~]# chkconfig httpd on
[root@server~]# /etc/init.d/httpd start
Now direct your browser and you should see the Apache2 placeholder page: [e.g http://192.168.0.100]
[root@server~]# yum install php*
[root@server~]# /etc/init.d/httpd restart
The document root of the default web site is /var/www/html. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.
[root@server~]# vi /var/www/html/info.php
<?php
phpinfo();
?>
:wq
[root@server~]# /etc/init.d/httpd restart
Now we call that file in a browser (e.g. http://192.168.0.100/info.php)
Ensure below packages are installed.
php-mysql php-gd php-imap php-ldap php-mbstring php-odbc php-pear php-xml php-xmlrpc php-pecl-apc
if now then you need to install manually with yum install command
phpMyAdmin:-
is a web interface through which you can manage your MySQL databases.
First we enable the RPMforge repository on our CentOS system as phpMyAdmin is not available in the official CentOS 6.4 repositories:
Import the RPMforge GPG key:
[root@server~]# rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
[root@server~]# yum install http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm
[root@server~]# yum install phpmyadmin
Now we configure phpMyAdmin. We change the Apache configuration so that phpMyAdmin allows connections not just from localhost (by commenting out the <Directory "/usr/share/phpmyadmin"> stanza):
[root@server~]# 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
Next we change the authentication in phpMyAdmin from 'cookie' to 'http':
[root@server~]# vi /usr/share/phpmyadmin/config.inc.php
[...]
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'http';
[...]
:wq
[root@server~]# /etc/init.d/httpd restart
Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/
3 Installing MyDNSConfig:-
==========================
Log in to MySQL and create the database:
[root@server~]# mysql -u root -p
<Enter MySQL Password>
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;
OR
CREATE USER 'mydns'@'%' IDENTIFIED BY 'Mysql@212';
grant all on *.* to 'mydns'@'%' with grant option;
flush privileges;
Replace the word mydnspassword in the above commands with a password of your choice.
Download MyDNSConfig:
[root@server~]# cd download
[root@server~]# wget http://liquidtelecom.dl.sourceforge.net/project/mydnsconfig/mydnsconfig/MyDNSConfig-3.0.1/MyDNSConfig-3.0.1.tar.gz
[root@server~]# tar -xvfz MyDNSConfig-1.1.0.tar.gz
[root@server~]# cd MyDNSConfig-1.1.0
Install MyDNSConfig:
[root@server~]# mkdir /usr/share/mydnsconfig
[root@server~]# cp -rf interface/* /usr/share/mydnsconfig/
[root@server~]# ln -s /usr/share/mydnsconfig/web/ /var/www/html/mydnsconfig
Install the MyDNSConfig MySQL Database:
[root@server~]# mysql -u root -p mydns < install/mydnsconfig.sql
The command above asks for a password, please enter the password of the MySQL root user.
Edit the MyDNSConfig configuration; please make sure you fill in the correct database settings:
[root@server~]# vim /usr/share/mydnsconfig/lib/config.inc.php
Database Settings
*/
$conf["db_type"] = 'mysql';
$conf["db_host"] = 'localhost'; --> keep as it
$conf["db_database"] = 'mydns';
$conf["db_user"] = 'mydns';
$conf["db_password"] = 'mydnspassword';
/*
:wq
Afterwards, you can remove the downloaded MyDNSConfig installer from the download directory:
[root@server~]# cd download
[root@server~]# rm -rf MyDNSConfig-1.1.0/
[root@server~]# rm -f MyDNSConfig-1.1.0.tar.gz
[root@server~]# wget http://mydns.bboy.net/download/mydns-mysql-1.1.0-1.i386.rpm
[root@server~]# rpm -ivh mydns-mysql-1.1.0-1.i386.rpm
Open the MyDNS configuration file /etc/mydns.conf, fill in the correct database details, allow zone transfers by setting 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) so that MyDNS can answer queries for domains that it isn't authoritative for:
OR
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
[root@server~]# vim /etc/mydns.conf
Next, create the system startup links for MyDNS and start MyDNS:
[root@server~]# chkconfig mydns on
[root@server~]# /etc/init.d/mydns start
Finally, we need to fix the system startup links for MyDNS. MyDNS depends on MySQL, so MyDNS must start after MySQL has started, otherwise it will fail. The default startup links for MyDNS make it start before MySQL which is wrong, so we fix this as follows:
[root@server~]# cd /etc/rc.d/rc3.d
[root@server~]# mv S52mydns S99mydns << --- here name will be differenet please check proper
[root@server~]# cd /etc/rc.d/rc4.d
[root@server~]# mv S52mydns S99mydns << --- here name will be differenet please check proper
[root@server~]# cd /etc/rc.d/rc5.d
[root@server~]# mv S52mydns S99mydns << --- here name will be differenet please check proper
MySQL uses the startup links S64mysql, so renaming the MyDNS startup links from S52mydns to S99mydns makes sure that MyDNS starts after MySQL.
The basic installation of MyDNS and MyDNSConfig is now finished. To log in to the MyDNSConfig interface, open a web browser and enter enter the following URL:
http://<your_ip_address>/mydnsconfig/
Replace <your_ip_address> with the IP address of your server.
The default username and password of MyDNSConfig are:
Username: admin
Password: admin
Don't forget to change the password after login under System > Users.
######### Reference Links ##############
http://www.howtoforge.com/installing-mydns-mydnsconfig-centos-5.1 <---- For MyDNS Installation
http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-centos-6.4-lamp <---- For LAMP Installation
https://www.howtoforge.com/installing-mydns-mydnsconfig-fedora8-p2
No comments:
Post a Comment