Vous êtes sur la page 1sur 27

KVM & OpenVZ Virtualization And Cloud Computing With

Proxmox VE
Version 1.0
Author: Falko Timme <ft [at] falkotimme [dot] com>
Last edited 01/29/2009

Proxmox VE (virtual environment) is a distribution based on Debian Etch (x86_64); it provides an OpenSource
virtualization platform for running virtual machines (OpenVZ and KVM) and comes with a powerful, web-
based control panel (it includes a web-based graphical console that you can use to connect to the virtual
machines). With Proxmox VE, you can even create a cluster of virtualization hosts and create/control virtual
machines on remote hosts from the control panel. Proxmox VE also supports live migration of virtual machines
from one host to the other. This guide shows how you can use Proxmox VE to control KVM and OpenVZ
virtual machines and how to create a small computing cloud with it.

I do not issue any guarantee that this will work for you!

1 Preliminary Note

Proxmox VE is an x86_64 distribution, so you cannot install it on an i386 system. Also, if you want to use
KVM, your CPU must support hardware virtualization (Intel VT or AMD-V) - this is not needed if you ust
want to use OpenVZ.

In this tutorial I will create a small cluster of two machines, the Proxmox master (server1.example.com with the
IP and a slave (server2.example.com, IP: so that I can demonstrate the live
migration feature and also the creation and management of virtual machines on remote hosts through Proxmox
VE. Of course, it is perfectly fine to run Proxmox VE on just one host.

2 Installing Proxmox VE On server1.example.com (Master)

Download the latest Proxmox VE ISO image from http://pve.proxmox.com/wiki/Downloads, burn it onto a CD,
and boot your system from it. Press ENTER at the boot prompt:
Accept the Proxmox license agreement (GPL):

Select the hard drive on which you want to install Proxmox. Please note that all existing partitions and data will
be lost!
Select your country, time zone, and keyboard layout:

Type in a password (this is the root password that allows you to log in on the shell and also to the Proxmox web
interface) and your email address:
Now we come to the network configuration. Type in the hostname (server1.example.com in this example), IP
address (e.g., netmask (e.g., gateway (e.g., and a nameserver (e.g.

Afterwards, Proxmox is installed. The installer will automatically partition your hard drive using LVM - that's
why there is no partition dialogue in the installer. Proxmox uses LVM because that allows to create snapshot
backups of virtual machines.
Reboot the system afterwards:

After server1 has rebooted, you can open a browser and go to - this will redirect you to

If you're using Firefox 3 and use HTTPS, Firefox will complain about the self-signed certificate, therefore you
must tell Firefox to accept the certificate - to do this, click on the Or you can add an exception... link:
Click on Add Exception...:

The Add Security Exception window opens. In that window, click on the Get Certificate button first and then
on the Confirm Security Exception button:
Afterwards, you will see the Proxmox login form. Type in root and the password you've created during the

This is how the Proxmox control panel looks:

3 Creating A Cluster By Adding A Slave (server2.example.com) (Optional)

(You can skip this chapter if you want to run Proxmox on just one host.)

You can create a cluster or computing cloud by adding one or multiple slave servers to the Proxmox master
(server1.example.com). Such a cloud allows you to create and manage virtual machines on remote hosts from
the Proxmox control panel, and you can even do live migration of virtual machines from one host to another.

I will now show you how to add a second host, server2.example.com, and create a cluster.

Install Proxmox on server2.example.com, just as you did on server1. When you come to the networking
section, fill in server2.example.com and make sure you use a different IP (e.g.

After the installation has finished, and the system has successfully rebooted, log in on the command line (e.g.
using PuTTY) on both server1 and server2.

On server1, run the following command:


pveca -c

server1:~# pveca -c
Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ce:bf:a2:cd:69:23:e4:78:fc:05:db:fc:55:ef:52:1d root@server1
cluster master successfully created
Then check the state of the cluster:


pveca -l

server1:~# pveca -l
1 : M A 00:14 0.00 5% 1% 0%

On server2, do the following:


pveca -a -h

server2:~# pveca -a -h

Generating public/private rsa key pair.
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ea:ad:21:fc:5d:9b:af:ab:fb:0d:72:72:c7:94:23:ca root@server2
The authenticity of host ' (' can't be established.
RSA key fingerprint is 7c:17:8c:35:9c:be:60:6b:56:97:2a:0b:72:60:57:09.
Are you sure you want to continue connecting (yes/no)? <-- yes
Warning: Permanently added '' (RSA) to the list of known hosts.
root@'s password: <-- root password of server1.example.com
cluster node successfully created

That's it, you've just created a cluster. You can check that by running:


pveca -l

This should display both servers in the output:

server2:~# pveca -l
1 : M S 00:15 0.00 5% 1% 0%
2 : N S 00:04 0.08 15% 1% 0%

Now go back to the Proxmox control panel on (you don't need the control panel on
server2.example.com!) and go to Cluster, and it should list both servers:
4 Adding Appliance Templates

Before we can create OpenVZ containers, we must add at least one OS template to our system (for KVM
guests, you can add ISO files, although this is not necessary - KVM guests can as well be installed directly from
an OS CD or DVD).

Go to Appliance Templates. You will see two tabs, Local and Download:
On the Download tab, you will see a list of templates provided by the Proxmox project that you can download
directly to the system...

... - at least theoretically - the problem is that the links are too old and not working anymore:
That's why we have to use the Local tab. You can go to http://download.proxmox.com/appliances/ and then to
the admin, mail, system, or www folders...

... and download the desired templates to your local hard drive:
On the Local tab, you can then upload the templates to the Proxmox master:

You can as well upload ISO images that can be used for the creation of KVM guests. To delete a template or
ISO file, click on the red arrow in front of it and select Delete:
5 Creating OpenVZ Containers

To create an OpenVZ container, go to Virtual Machines > Create...

... and fill in the form. Select Container (OpenVZ) and then the template that you want to use. Specify a
hostname (e.g. vm1.example.com), the amount of memory and swap, a root password, select Virtual Network
(venet) and specify an IP address for the container (e.g., fill in a VMID, select a cluster node (if
you haven't created a cluster (see chapter 3), you can select only the master, not any remote systems), specify if
the container should automatically be started when the host boots, and fill in one or two DNS servers (e.g. and Then click on create:
The container is then created...

... and it should be listed on the List tab afterwards. The container is stoppped; to start it, click on the container:
This will open a page where you can control that container. To start it, click on the Start button:

You should then see the link Open VNC console - if you click on it...
... a browser-based console opens from where you can control the virtual machine (this is especially useful for
desktop machines; if the virtual machine is a server, you can as well connect to it using SSH (e.g. with

6 Creating Virtual Machines On Remote Systems In The Cluster

If you've created a cluster (see chapter 3), you can also create virtual machines on remote systems that belong to
the cluster - just select a remote node under Cluster Node when you create a virtual machine (the screenshot
shows this for OpenVZ, however, this works for KVM guests as well as long as the node supports hardware

The List tab should then show that the virtual machine is running on a different node:

7 Creating KVM Guests

If the CPU supports hardware virtualization (Intel VT or AMD-V), you have the possibility to create KVM
guests in addition to OpenVZ containers. Just select Fully virtualized (KVM) in the Type drop-down menu, and
then either select the cdrom device or one of the ISO images that you've uploaded (if any) from the Installation
Media drop-down menu. There are no network settings to be set as this will have to be done directly in the
KVM guest. Make sure you select the correct Guest Type (Linux 2.6, Windows XP, etc.):

The KVM guest should be listed on the List tab afterwards; as always with new guests, it is stopped. Click on
... to get to its management page; click on the Start button there (if you've selected to install the guest from CD-
ROM, please insert the OS CD or DVD into the target system's CD drive before you click on Start):

Then click on the Open VNC console link...

... to connect ot the graphical console of the guest; you should now be able to complete the OS installation just
as if it was a physical system:
7.1 Installing Windows XP

KVM allows you also to install Windows guests. Select cdrom device from the Installation Media drop-down
menu and Windows XP from the Guest Type drop-down menu:

Insert the Windows XP CD into the target system's CD drive, start the guest, and connect to its graphical console. You
can now follow the Windows installation wizard to install a Windows XP guest:
8 Live Migration

If you've set up a Proxmox cluster (see chapter 3), you can migrate running guests from one node to the other.
Just go to Virtual Machines > Migrate, select the guest, the source and target node, check Online migration and
click on migrate:

The guest is migrated while it is running:

Afterwards, the List page shows that it's now running on another node:

9 Backups

With Proxmox VE, you can create cron jobs to back up your virtual machines. Before we can create backups,
we need to create a backup directory, e.g. /backup. Go to the command line of server1 and run:


mkdir /backup

In the Proxmox control panel, go to Backup and click on the red arrow in front of Backup Jobs; then select
Create new job:
Select the cluster node and then the virtual machines from that node that you'd like to back up. Specify /backup as the
destination directory, and select the days and the time when you want the backups to be created. Under Mode, you can
select snapshot (LVM snapshots, zero downtime), suspend (virtual machines will be suspended for a short period of
time when the backup is created) and stop (virtual machine will be completely stopped). I recommend to use snapshot
here, especially if you cannot afford any downtime:

Afterwards, you can see the backup cron job on the Backup page:
10 Links

 Proxmox VE: http://pve.proxmox.com/wiki/Main_Page

 OpenVZ: http://wiki.openvz.org/
 KVM: http://kvm.qumranet.com/kvmwiki