1 Objectives

You are going to install Linux from a CD-ROM image. This is the simplest installation method and can be used to install any operating system such as Windows.

The Linux distribution we will use is called "Turnkey Linux" and we have chosen it because it is very quick to install and is available with a choice of ready-to-run applications, in this case we've chosen Wordpress.

NOTE: all the commands in this exercise are run as the root user. If you are logged in as a regular user, use sudo -s to get a root shell.

$ sudo -s

2 Preparation

2.1 Cluster setup - MASTER ONLY

Before we create and install VMs, we need to change default settings in the cluster (this should have been done before, but we're doing it to be safe).

Do this on the MASTER node:

# gnt-cluster modify -H kvm:kernel_path=,initrd_path=,vnc_bind_address=

This ensures that instances boot directly from their own disk images, not using a kernel on the host, and allows allows VNC consoles to connect across the network.

2.2 Installing OS definition - ALL NODES

Ganeti requires an "OS definition" - a collection of scripts which ganeti uses to create, export and import an operating system.

We will install one called ganeti-os-noop. It gets its name from "no operation" - it's a dummy script that does nothing. It's up to you to start the VM with a CD image attached.

First, create a file /etc/apt/sources.list.d/grnet.list containing the following line:

deb http://repo.noc.grnet.gr/ wheezy main

Now add the repository signing key:

# wget -O - http://repo.noc.grnet.gr/grnet.gpg.key | apt-key add -

Finally, install the package:

# apt-get update
# apt-get install ganeti-os-noop

Once this has been done on all nodes on the cluster, then on the master node you can run the following command to check it's available:

# gnt-os list
noop                    << THIS ONE IS NEW

If not, use gnt-os diagnose to help work out what the problem is.

2.3 Distributing ISO images - ALL NODES

If using DRBD, the ISO images used for CD installs must be present on all nodes in the cluster, in the same path.

You could copy them to local storage on the master node, and then use gnt-cluster copyfile to distribute them to local storage on the other nodes. However to make things simpler, we've made all the ISO images available on an NFS share (Network File Service), which you can connect to.

On every node, create a empty directory /iso:

# mkdir /iso

And now mount the file share:

# apt-get install nfs-common
# mount s1.ws.nsrc.org:/iso /iso

Check that you can see the shared files:

# ls /iso

3 Install a VNC Viewer (client)

Install a VNC Viewer application on your laptop. (Note that RealVNC does not appear to work with KVM)

4 Creation of instance - EVERYONE ON MASTER NODE

Note: each pair of people working together can create their own instance. However you will all have to log into the MASTER node of your cluster to perform these commands.

For example, if you working on host3 then you will have to login to host1 (your cluster's master node). You will then create a VM called wordpress3 and instruct ganeti to create it on your host using the flag -n host3.ws.nsrc.org

4.1 Create instance

Run the following command to create an instance. Note that we don't start it yet, because we want to temporarily attach the CD-ROM image at start time.

# gnt-instance add -t plain -o noop \
    -s 2G -B minmem=256M,maxmem=512M \
    -n hostN.ws.nsrc.org \
    --no-start --no-name-check --no-ip-check \

... replacing N with your group's master node and X with your own host number.


You will see some messages about creating the instance being created.

Now use gnt-instance list to see that the instance was created properly:

# gnt-instance list -o +network_port

Instance    Hypervisor OS   Primary_node      Status     Memory Network_port
wordpressX  kvm        noop hostN.ws.nsrc.org ADMIN_down      - 11XXX

Make a note of the Network_port - you'll need this to connect to the VNC console shortly.

4.2 Start with CD attached

Start the VM using the following command, which attaches the CD-ROM image temporarily and boots from it:

# gnt-instance start \
    -H boot_order=cdrom,cdrom_image_path=/iso/turnkey-wordpress-13.0-wheezy-amd64.iso \

Waiting for job 125 for wordpressX ...

Check that your VM status has changed from "ADMIN_down" to "running":

# gnt-instance list -o +network_port

On your laptop, open a VNC viewer application and point it at <Primary_node>:<Network_port>. If you have previously set a console password you'll be prompted for it.

NOTE: if you get a "kernel panic" then for the purposes of this workshop it may be necessary to update the version of qemu-kvm in your host:

  apt-get install -t wheezy-backports qemu-kvm

Shut down your guest:

  gnt-instance shutdown --timeout=0 wordpressX

Then start it again using the long line shown above with boot_order=cdrom.

4.3 Install Turnkey

If you see the Turnkey splash screen then hit Enter to start installation (it will do this automatically after 30 seconds anyway).

With Turnkey Linux, only a few questions now have to be answered to complete the installation. Use Tab to move between fields.

At this point you should get a configuration screen saying "WORDPRESS appliance services" giving URLs with the IP address which your machine has picked up via DHCP.

Point your laptop's web browser at the first URL to login. You will see additional URLs for web shell, Webmin and PHPMyAdmin - you can try those too.

Your installation is complete. As long as you remember your VM's IP address you can disconnect the VNC console now.

4.4 Notes on Turnkey Linux

Turnkey has a simple set of options from the console for configuring IP address, rebooting and shutting down. If you go into "Advanced Menu" and then "Quit" you will get a regular Linux console login. Login as root and then type "confconsole" if you want to get back into the configuration screen.

4.5 Use ssh

Your VM should have an openssh server already installed.

Hence from your laptop you should now be able to log in to your VM on the IP address shown previously.

4.6 Shutdown

To shut down the instance from the Ganeti master node, you can issue the following command:

# gnt-instance shutdown wordpressX

This will send ACPI shutdown request (similar to pressing the power button on a modern PC) and wait up to 2 minutes for the shutdown sequence to complete.

Congratulations! The remainder of this worksheet is extra information in case you finish early, or which you can review at your leisure later

5 Changing networks

You don't have to run this, but if you want to you can.

Moving the network interface 0 to another network:

# gnt-instance modify --net 0:modify,link=br-lan wordpressX

This lets you connect your instance's eth0 network interface onto a different bridge.

You'll need to reboot the instance after you made the change:

# gnt-instance reboot wordpressX

Then you'll have to get into the VM's VNC console to find out what IP address it has picked up on the new network.

When you've finished, change it back again.