Migrating a DNS server to PowerDNS

Today I had to migrate a customer’s DNS server to a new server… This because the old server (a very old plesk instance) was end of life.

As I have very good experiences with PowerDNS, we decided to migrate from Bind (Named) to PowerDNS.

PowerDNS provides you with the utilities to do so, but I did not find a straight forward way to export/import zones from Bind into PowerDNS.

Installation of PowerDNS and PowerAdmin (a PowerDNS Gui) is out of the scope of this document, so I assume you already have a working PowerDNS server.

These are the steps I had to perform to migrate from the Plesk 8.2 server to PowerDNS:

1) First of all, you need to allow zone transfer (AXFR) on your bind server from your new PowerDNS server IP. You need to change the contents of /etc/named.conf in something like this (add the allow-transfer lines in the Options block.

2) Reload or restart named to take effect:

3)Test a zone transfer, eg:

4) Now that you know zone transfer is working, create a list of domains that your Bind server is ‘serving’.  In my case i have to remove some extra .lock and .saved_by_psa files from my listing. If you use this tutorial, your command can look differently of course.

If needed: check if the domains in bind still use your old nameservers… (do not polute your new powerDNS server :))

Then delete all domains from /root/domainlist.dns if they not valid anymore
5) Import your zones by:
a) Create Zone Import SQL scripts

From these generated files, remove duplicate SOA records from all import files:

If needed: change TTLs:

Depending if your imported zones need to be set as NATIVE or MASTER

Change extra stuff with sed, like hostmaster and so on

b) Test import into mysql

c) Verify in poweradmin and drop the imported zone (or you’ll get an import error on the next step, which is not bad or something… but hey :))

d) Import all your zones, if you like what you have done:


Install PHP 5.2 on Ubuntu 12.04 LTS

Remark: you should already have switched to PHP5.3 and heck, even 5.4…. but some old projects aren’t worth the dev time to update the code to PHP 5.3 or 5.4.

Having issues with your PHP 5.2 legacy websites after migrating them to new hardware and OS releases, which normally run on PHP5.3 or 5.4?

The best way to install PHP5.2 is by adding Karmic repositories to your apt sources. This way, you can simply install PHP 5.2 from package.

An easy way to add the sources is by running a small shell script that:

1) Creates a list of all your currently installed PHP packages.

2) Create the karmic.list files sources.list.d, holding the correct repo’s

3) Create a prefences file in /etc/apt/preferences.d, that pins your PHP version to the PHP5.2 version.

This script is copy pasted from Khalid:

There are of course other ways of installing PHP5.2 on Ubuntu 12.04 LTS, but this one works for me… and I have had no issues so far on my servers and sites..

Credits to: Randy Fay and Khalid


Due to the fact that karmic is no longer in the Archive repo’s, the script needs a little change (replace archive by old-releases)




Today we had a crashed server that needed to be reinstalled. We had some problem with the PIN priority, packages installed still were 5.3.10… Bugger.

But looking a little further, you can use apt-mark hold to ‘pin’ package version to the installed packages.

So we had to install the PHP5.2 packages and ‘hold’ them to that version using:





Install PHP 5.4 on Ubuntu 12.04 LTS

This post shows you how to install PHP 5.4 on Ubuntu 12.04 LTS.

To install PHP 5.4, I asked my good friend Google who is maintaining a PHP PPA (Personal Package Archive) for Ubuntu 12.04 LTS.

Ondřej Surý is one of the people who does this. Since Ondrey is pretty active on developing this stuff, this is one of the repo’s to follow 🙂 (he also accepts donations for his hard work)

Now, via SSH, you can simply install PHP 5.4 by isuing the following command:

If you get an error the add-apt-repository is not available on your system:

Et voila… your server is now running PHP 5.4, which is said to be 25% faster than PHP 5.3.