Contents |
This page is under construction.
This HOWTO REQUIRES a LINK-4 or higher VPS.
This HOWTO guides your through the creation of a ISP caliber virtual hosting environment with a MySQL database backend called from the PowerDNS nameserver and Postfix/Courier email server.
Start from a clean installation of Ubuntu 6.10 Standard.
Locales should be set so that you aren't confused by strange pearl errors while installing packages; so run:
$ locale-gen en_US $ locale-gen en_US.UTF-8
Edit your apt-sources list.
$ vi /etc/apt/sources.list
deb http://us.archive.ubuntu.com/ubuntu edgy main restricted deb-src http://us.archive.ubuntu.com/ubuntu edgy main restricted deb http://us.archive.ubuntu.com/ubuntu edgy-updates main restricted deb-src http://us.archive.ubuntu.com/ubuntu edgy-updates main restricted deb http://archive.ubuntu.com/ubuntu/ edgy multiverse universe main restricted deb-src http://archive.ubuntu.com/ubuntu/ edgy multiverse universe main restricted deb http://security.ubuntu.com/ubuntu edgy-security main restricted deb-src http://security.ubuntu.com/ubuntu edgy-security main restricted deb http://security.ubuntu.com/ubuntu edgy-security universe deb-src http://security.ubuntu.com/ubuntu edgy-security universe
Update your installation
$ apt-get update $ apt-get upgrade
Install some handy tools
$ apt-get install curl build-essential
Setup /etc/hosts for your domain and nameservers.
$ vi etc/hosts
127.0.0.1 localhost localhost.localdomain 209.59.209.72 papyromancer papyromancer.com 64.79.206.105 ns1.papyromancer.com 209.59.207.106 ns2.papyromancer.com # The following lines are desirable for IPv6 capable hosts # (added automatically by netbase upgrade) ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Install MySQL, Apache, and PHP
apt-get install mysql-server mysql-admin apache2 php5 libapache2-mod-php5 libapache2-mod-auth-mysql php5-mysql phpmyadmin
Set a password for the MySQL root User
mysqladmin -u root password [yourrootsqlpassword]
Install PowerDNS
$ apt-get install pdns pdns-backend-mysql pdns-doc
Setup pdns.conf
$ vi /etc/powerdns/pdns.conf
Add the following lines to the end of pdns.conf
launch=gmysql gmysql-host=127.0.0.1 gmysql-user=pdns gmysql-dbname=pdns
$ vi /tmp/pdns.sql
Insert the following text into pdns.sql
create table domains ( id INT auto_increment, name VARCHAR(255) NOT NULL, master VARCHAR(20) DEFAULT NULL, last_check INT DEFAULT NULL, type VARCHAR(6) NOT NULL, notified_serial INT DEFAULT NULL, account VARCHAR(40) DEFAULT NULL, primary key (id) )type=InnoDB; CREATE UNIQUE INDEX name_index ON domains(name); CREATE TABLE records ( id INT auto_increment, domain_id INT DEFAULT NULL, name VARCHAR(255) DEFAULT NULL, type VARCHAR(6) DEFAULT NULL, content VARCHAR(255) DEFAULT NULL, ttl INT DEFAULT NULL, prio INT DEFAULT NULL, change_date INT DEFAULT NULL, primary key(id) )type=InnoDB; CREATE INDEX rec_name_index ON records(name); CREATE INDEX nametype_index ON records(name,type); CREATE INDEX domain_id ON records(domain_id); create table supermasters ( ip VARCHAR(25) NOT NULL, nameserver VARCHAR(255) NOT NULL, account VARCHAR(40) DEFAULT NULL ); GRANT SELECT ON supermasters TO pdns; GRANT ALL ON domains TO pdns; GRANT ALL ON records TO pdns;
Create the pdns MySQL database
$ mysqladmin -u root -p create pdns
Enter your root MySQL password
Load the PDNS database schema
$ mysql -u root -p pdns < /tmp/pdns.sql
Now go to the vpslink control panel and shutdown, then start your server
Log back into your server.
Run pdns in monitor mode.
$ /etc/init.d/pdns stop $ /etc/init.d/pdns monitor
Start up another ssh session into your server and see if the nameserver is available
$ host papyromancer.com 127.0.0.1
Using domain server: Name: 127.0.0.1 Address: 127.0.0.1#53 Aliases: Host papyromancer.com not found: 2(SERVFAIL)
Now load a record for your domain into the database
# mysql pdns
mysql> INSERT INTO domains (name, type) values ('papyromancer.com', 'NATIVE');
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'papyromancer.com','localhost ahu@ds9a.nl 1','SOA',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'papyromancer.com','dns-us1.powerdns.net','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'papyromancer.com','dns-eu1.powerdns.net','NS',86400,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'www.papyromancer.com','199.198.197.196','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'mail.papyromancer.com','195.194.193.192','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'localhost.papyromancer.com','127.0.0.1','A',120,NULL);
INSERT INTO records (domain_id, name, content, type,ttl,prio)
VALUES (1,'papyromancer.com','mail.papyromancer.com','MX',120,25);$ apt-get install postfix postfix-mysql postfix-doc courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl postfix-tls libsasl2 libsasl2-modules libsasl2-modules-sql openssl