Date post: | 03-Jun-2018 |
Category: |
Documents |
Upload: | manaf-hasibuan |
View: | 234 times |
Download: | 1 times |
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 1/26
KVM and OpenVZ Virtualization And Cloud Computing With
Proxmox VE
Proxmox VE (virtual environment) is a distribution based on Debian Etch (x86_64); it provides anOpenSource 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 useto connect to the virtual machines). With Proxmox VE, you can even create a cluster of virtualizationhosts 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 smallcomputing 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 wantto 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 192.168.0.100) and a slave (server2.example.com, IP:192.168.0.101) 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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 2/26
Accept the Proxmox license agreement (GPL):
Select the hard drive on which you want to install Proxmox. Please note that all existing partitionsand data will be lost!
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 3/26
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. 192.168.0.100), netmask (e.g. 255.255.255.0), gateway (e.g. 192.168.0.1),and a nameserver (e.g. 145.253.2.75):
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 4/26
Afterwards, Proxmox is installed. The installer will automatically partition your hard drive usingLVM - 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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 5/26
After server1 has rebooted, you can open a browser and go to http://192.168.0.100/ - this will redirectyou to https://192.168.0.100/.
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 anexception... link:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 6/26
Click on Add Exception...:
The Add Security Exception window opens. In that window, click on the Get Certificate button firstand then on the Confirm Security Exception button:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 7/26
Afterwards, you will see the Proxmox login form. Type in root and the password you've created
during the installation:
This is how the Proxmox control panel looks:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 8/26
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 Proxmoxmaster (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 machinesfrom 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.192.168.0.101):
After the installation has finished, and the system has successfully rebooted, log in on the commandline (e.g. using PuTTY) on both server1 and server2.
On server1, run the following command:
server1:
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@server1cluster master successfully created
server1:~#
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 9/26
Then check the state of the cluster:
server1:
pveca -l
server1:~# pveca -lCID----IPADDRESS----ROLE-STATE--------UPTIME---LOAD----MEM---ROOT---DATA
1 : 192.168.0.100 M A 00:14 0.00 5% 1% 0%
server1:~#
On server2, do the following:
server2:
pveca -a -h 192.168.0.100
server2:~# pveca -a -h 192.168.0.100Generating 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@server2The authenticity of host '192.168.0.100 (192.168.0.100)' 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 '192.168.0.100' (RSA) to the list of known [email protected]'s password: <-- root password of server1.example.com
cluster node successfully created
server2:~#
That's it, you've just created a cluster. You can check that by running:
server2:
pveca -l
This should display both servers in the output:
server2:~# pveca -lCID----IPADDRESS----ROLE-STATE--------UPTIME---LOAD----MEM---ROOT---DATA
1 : 192.168.0.100 M S 00:15 0.00 5% 1% 0%
2 : 192.168.0.101 N S 00:04 0.08 15% 1% 0%server2:~#
Now go back to the Proxmox control panel on http://192.168.0.100/ (you don't need the control panelon server2.example.com!) and go to Cluster, and it should list both servers:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 10/26
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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 11/26
On the Download tab, you will see a list of templates provided by the Proxmox project that you candownload 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/ andthen to the admin, mail, system, or www folders...
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 12/26
... and download the desired templates to your local hard drive:
On the Local tab, you can then upload the templates to the Proxmox master:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 13/26
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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 14/26
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 ahostname (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. 192.168.0.102), 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 inone or two DNS servers (e.g. 145.253.2.75 and 213.191.92.86). Then click on create:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 15/26
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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 16/26
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...
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 17/26
... 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 PuTTY)).
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 18/26
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 virtualization):
The List tab should then show that the virtual machine is running on a different node:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 19/26
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 it...
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 20/26
... 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 onStart):
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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 21/26
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 XPguest:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 22/26
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 23/26
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 Onlinemigration and click on migrate:
The guest is migrated while it is running:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 24/26
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:
server1:
mkdir /backup
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 25/26
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 becreated. 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 (virtualmachine 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:
8/12/2019 KVM and OpenVZ Virtualization and Cloud Computing With Proxmox VE
http://slidepdf.com/reader/full/kvm-and-openvz-virtualization-and-cloud-computing-with-proxmox-ve 26/26