Setting up a Virtualmin-controlled Ubuntu 12.04 LTS Precise Pangolin server on Linode


Linode is one of the best low-cost Virtual Private Server Hosts available, offering Xen VPS Hosting for a number of popular operating systems. With the release of Ubuntu 12.04 LTS, I felt that it was past time that I upgraded my webserver (the one that runs this website, actually!), and document the little tweaks that I discovered along the way.

What we’re setting up

  • Ubuntu 12.04 LTS
  • A standard LAMP Stack (Linux, Apache, MySQL, PHP)
  • BIND DNS resolution—combined with Virtualmin below, you’ll be able to manage your own domains!
  • Linode reverse-DNS resolution
  • Virtualmin / Webmin backend server management

Step One: Nameserver Configuration

Log on to your domain registrar and set the nameservers for your domain to

We’ll be using Linode’s nameservers as our primary DNS providers because they’ll stay up even when the server is down—taking advantage of redundancy where we can. Since it takes a while for this DNS setting to propagate, this should be done well before any of the other parts of this tutorial.

Step Two: Linode Configuration

Setting up the slave zone
Log into Linode’s dashboard, and add your domain (hereafter referred to as to the DNS manager. Configure it as “Slave Zone”, and set the master server IP to the IP of your server. This will allow Linode to mirror your server’s DNS settings.

Deploying Ubuntu 12.04 LTS

Deploy Ubuntu 12.04 LTS to your Linode, using the standard “Deploy a Linux Distribution” Option. This will take a short while, and you’ll be asked to supply an administrator password to the system.

Once that’s done, remember to set up the reverse-DNS setting, available in the “Remote Access” tab. This should be set to, although it isn’t particularly important. Also, enable IPv6; it’s used internally for DNS resolution and will cause issues if disabled.

While you’re here, take note of the IP configuration settings listed. The important values are the public IPs / masks, the default gateway, and the DNS resolvers.

Step Three: Ubuntu Configuration

Alright, now it’s time to actually begin to set up the server. All commands following will be given with the assumption that you are running as the root user. DO NOT use the root account as your primary login; it should be reserved for system administration roles as much as is possible.

Setting up the hostname

Edit /etc/hostname with your favorite editor and set it to your hostname of choice. The file should look something like this:


Afterwards, run the command

$ hostname -F /etc/hostname

to set it across the system.

Then, edit /etc/hosts to enable localhost resolution. The first two lines should look something like this: localhost
your-ip-address hostname

If you have trouble with this, take a look at Linode’s full guide here with regards to setting the hostname and hosts file.

To test, the command

$ hostname

should print the hostname of the server, and

$ hostname -f

should print (or whatever you set as your Fully Qualified Domain Name).

Setting up a static IP
For some reason, Linode defaults its nodes to use DHCP; this will not work well with our BIND9 DNS server. So, using the settings you got from the Remote Access tab on the Dashboard, configure your /etc/network/interfaces file:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
 address your-ip-address-here
 gateway your-gateway-address-here

Edit May 1, 2012: Use Resolvconf directly instead of removing it.

View old version here: Expand

Since Ubuntu ships with a dynamic resolver that only really works when you’re using DHCP, we’re going to replace it with a static /etc/resolv.conf:

$ apt-get remove resolvconf

Configure the newly-static resolv.conf:

$ cat /etc/resolv.conf
nameserver dns-resolver-1-ip-here
nameserver dns-resolver-2-ip-here
options rotate

Ubuntu now ships with a dynamic resolv.conf manager called resolvconf, which handles editing /etc/resolv.conf for us. Thus, instead of editing /etc/resolv.conf, we can edit /etc/resolvconf/resolv.conf.d/base

$ cat /etc/resolvconf/resolv.conf.d/base
nameserver dns-resolver-1-ip-here
nameserver dns-resolver-2-ip-here
options rotate

Now, reload the resolvconf (or restart the server, since you’ve changed networking settings)

$ service resolvconf restart

Further details on resolv.conf and network interface configuration can be found in Linode’s documentation here.

Configuring the timezone

We can just use dpkg-reconfigure for this:

dpkg-reconfigure tzdata

Installing LAMP

Since Ubuntu is debian-based, the installation of LAMP is remarkably simple:

$ apt-get update
$ apt-get install lamp-server^

should do it—just follow the instructions that it gives you.

Installing Virtualmin and Webmin

Unfortunately, since Ubuntu 12.04 LTS just came out, Virtualmin doesn’t officially support it yet, but we can install it anyways!

Start by copying /etc/issue to a backup, so that we can trick Virtualmin into believing it’s installing on Ubuntu 10.04 LTS:

$ cp /etc/issue /etc/issue-bak

Edit /etc/issue, and replace “Ubuntu 12.04 LTS n l” with “Ubuntu 10.04.02 LTS”

Virtualmin depends on an scponly shell which Ubuntu has, for some reason, removed from the Precise Pangolin repositories. Nevertheless, we can just install the version from Oneiric, which works fine:

$ cd /tmp
$ wget
$ dpkg -i scponly_4.8-4.1_i386.deb

Installing virtualmin itself: Virtualmin has kindly provided an install script for us, so we’ll just use that

$ cd /tmp
$ wget
$ chmod u+x
$ /tmp/

Now that that’s all done, we can revert our /etc/issue file back to what it should be

$ mv /etc/issue-bak /etc/issue

Setting up the Virtualmin Configuration

Initial configuration

Log on to your-ip-address:10000 to access the Virtualmin configuration panel. It should walk you through some initial setup options—you don’t need to change any of these.

After that’s done, go to Virtualmin→System Settings→Server Templates→BIND DNS Domains and find the Additional Manually Configured Nameservers box. Add these lines:

Also, make sure that the option “Add sub-domain DNS records to parent’s domain” is set to “Yes”.

This will set up the Linode nameservers as slaves, and allow them to request zone transfers (AXFR and AXFR-style IXFR)

Now, go to Webmin→Servers→BIND DNS Server→Default Zone and set “Notify Slaves of Changes” to “Yes”.

To see if Linode is successfully duplicating your zone, view the syslog and watch for AXFR / IXFR transfers:

$ tail -f /var/log/syslog

BIND will automatically inform Linode when you’ve made a change to your DNS configuration.

Setting up your first Virtual Server

This part is pretty simple: just click “Create Virtual Server” on the Virtualmin dashboard, and give it the domain The rest should be handled for you.
After it’s been constructed, go to Virtualmin→Server Configuration→DNS Records and add a new A record for, pointing at the IP Address of your hostname. This will serve as the primary forward-DNS for your server.

Final notes

Yay! You’ve set up a Ubuntu/Virtualmin-powered Linode, and you’re ready to host a website. Since BIND and Virtualmin are configured to create a new zone for each virtual server, the DNS configuration should be largely automatic—no more needing to set all the A records yourself.

There is one caveat, however: Linode’s Slave DNS Zones are configured NOT to allow subdomains to be controlled by separate DNS zones.

This means that if you want to serve a different website for a domain and its subdomain (“” and “”, for example), you will need to configure “” as a SUB-SERVER in Virtualmin. Otherwise, Linode will NOT request the DNS records, and you will not be able to access the subdomain.

To configure email virus and spam scanning, take a look at Ubuntu’s official Amavis tutorial here.

10 Responses to “Setting up a Virtualmin-controlled Ubuntu 12.04 LTS Precise Pangolin server on Linode”

    • Robert Ying

      Thanks, I’ve made the change in the article. Silly me for messing it up.

    • Robert Ying

      I edited the guide to use resolvconf properly, instead of just removing it like I did before. Editing /etc/resolvconf/resolv.conf.d/base changes the base file that resolveconf works from, so it’s effectively the new /etc/resolv.conf.

  1. Dear webmaster, thank you for writing that article on I had a good time while reading this. I wish you all the best, Gregor!

  2. I just grabbed the install script today and ran it: wget

    I got as far as installing my dependencies (after FQDN setup)

    apt-get –config-file apt.conf.noninteractive -y –force-yes install postfix postfix-pcre webmin usermin ruby libapache2-mod-ruby libxml-simple-perl libcrypt-ssleay-perl unzip zip quota

    Which fails and halts the script.

    E: Opening configuration file apt.conf.noninteractive – ifstream::ifstream (2: No such file or directory)

    Any help would be appreciated.

    • Robert Ying

      Did you configure /etc/issue to pretend that your server is running Ubuntu 10.04 LTS? The 12.04 support in the install script is still new and somewhat buggy, so using the older install method is significantly more reliable.

  3. I’m having some issues enabling the disk quotas using virtualmin, any insights?

  4. Just to let you know, you can remove the step about changing /etc/issue. Virtualmin now supports 12.04 LTS. – Thanks for the article works a treat. And once complete I had to reboot the server for the configuration check to tell me that everything was ready to go.

  5. Kayvan


    Greate article, just one thing, why install LAMP before virtualmin when it does this any ways?


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>