Installation
************

Compiling the source
====================

First, uncompress and unpack the distribution to a location of your choosing. The distribution will be extracted into a directory named mydns-VERSION.

Change directory into the distribution directory, then run the configure script to configure the package for your system.

The INSTALL file has full details on how the configure script works.  Run configure --help to output a summary of all options.

You'll probably be able to simply run the configure command with no additional arguments.

     $ ./configure

If you have both MySQL and PostgreSQL installed on your system, MyDNS chooses MySQL by default.  To tell MyDNS to use PostgreSQL instead of MySQL, run configure --without-mysql.

After the configuration process is complete, build the package.

     $ make

Then, if the build completed successfully, install the package.

     # make install

The mydns binary should now be installed in the sbin dir beneath the prefix provided to the configure script, if any.

By default, mydns is installed as /usr/local/sbin/mydns.

Creating the database
=====================

Now that you have installed MyDNS, you'll need to set up a database and access permissions.

To create a database called mydns on your database server:

MySQL:

     $ mysqladmin -h host -u username -p create mydns

PostgreSQL:

     $ createdb mydns

Creating the tables
===================

Next, create the tables in your database that will hold the DNS data.

Running mydns --create-tables will cause MyDNS to output CREATE TABLE statements appropriate for your database.

MySQL:

     $ mydns --create-tables | mysql -h host -u username -p mydns

PostgreSQL:

     $ mydns --create-tables | psql mydns

After you have created the tables, you should have two tables in your mydns database, called soa (see soa table) and rr (see rr table).

Database access
===============

Next, create a user that the MyDNS server can use to access the mydns database:

MySQL:

     $ mysql -h host -u username -p mydns
     mysql> GRANT SELECT ON mydns.* TO user@localhost IDENTIFIED BY 'password';

PostgreSQL:

     $ psql mydns
     mydns=# CREATE USER user WITH PASSWORD 'password';
     mydns=# GRANT SELECT ON soa,soa_id_seq TO user;
     mydns=# GRANT SELECT ON rr,rr_id_seq TO user;

Creating mydns.conf
===================

MyDNS probably won't start properly if it can't find its configuration file.  By default, the configuration file is called /etc/mydns.conf.

Running mydns --dump-config will output a set of configuration options suitable for using as your configuration file.  See Configuration.

So, for a fresh installation, this command will create your initial configuration file:

     # mydns --dump-config > /etc/mydns.conf

You should now edit your mydns.conf file.  Most defaults should be fine for most sites.

The values you are most likely to want to modify are the values for db-host and db-user, which should contain the database username and password that you created at the end of step 2.4. See Database access.