Install your own virtual machine

(versión en español)

This article opens a section dedicated to virtualization of a server to host virtual machines. Now is very popular in the world of hosting to use a virtual machine as a virtual private server (VPS). Thus, from a server with high processing power, memory, hard disk, multiple virtual private servers can be created.

In this first article I will try libvirt with kvm hypervisor,

Libvirt is a toolkit that interacts with multiple virtualization hypervisors, KVM, Xen, Hyper-V or VM-Ware.

Both libvirt and KVM installs easily on most Linux distributions, and also can be installed on other operating systems like FreeBSD. There is also a beta client for Windows.

KVM is installed as kernel module and uses native virtualization of the processors that have hardware virtualization support.

Libvirt provides a series of commands on the command line for manage server virtualization of the host (create, pause, shutdown or delete a virtual machine).

In addition, there is a GUI (virt-manager) for libvirt, which greatly facilitates the installation and management of a virtualized server.

1.- Instalation

For example, in Ubuntu just run:

$: aptitude install kvm libvirt-bin

It is normal that when you install these packages, a bridge is created (network interface bridge) that allows virtual servers to access Internet.

If you also want to install libvirt GUI, you can install it on Ubuntu with this command:

$: aptitude install virt-manager

With this would have a virtualized host server (or host) ready to host a number of virtual servers. To start, just run virt-manager on the command line:

$: virt-manager (must be the windows environment running).

You should see a window like the following on your screen.

virtual machine

Then click on the menu “File” and then “Add conection”.

virtual machine create conection

and choose the type of hypervisor and connection type, local or remote via ssh, etc …

Finally just double-ckick the connection created to connect to the host server.

virtual machine

2.- Download OS iso image.

Now i’m going to describe how you create a virtual machine with the libvirt, kvm and virt-manager kit

First of all, you must get an image of the operating system you want to have your virtual machine.

The easiest way is to download the image from the official website of the distribution you want to install.

You can also use the command ‘dd’ of Linux to make an iso image of the cd or dvd of the Linux distribution you want to install:

dd if=/dev/dvd of=dvd.iso

Then, add the iso to the pool of server images, in order to have it available when it be needed. To create a group, do right-click on the connection, choose the option “Details” and choose the tab “Storage”. With the button with the symbol “+” you can add a pool and insert the operating system iso.

virtual machine

3.- Set up storage.

Now you have to create the storage device where you will install the operating system of the virtual machine. Usually done in an image file. If the host has lvm2, a logical volume can be created and installed the OS in it.

Working with volumes is much more versatile, since you can clone an image of a server to take hot backups of a whole virtual machine.

As with the iso of operating systems, you can create a pool for volumes so that everything stays more organized.

4.- Install a virtual machine.

To install a new virtual machine, just right-click and click on “New” option in the emerging sub-menu.

virtual machine

You should see a window like this:

virtual machine

Put the name of the virtual machine, select the first option and click on “Fordward”

In the next window that appears, select “Use ISO image”. Then another window will be displayed with a pool of images and a pool of storage device we created earlier. Select the operating system image you downloaded earlier.

virtual machine

Then click on “Forward”.

In the next window choose the amount of RAM and CPU you want available to the virtual machine

<img class="aligncenter size-medium wp-image-284" title="virt8" src="http://labs.conekia.com/wp-content/uploads/2012/09/virt8-300×266.png" alt="virtual machine" width="300" height="266" srcset="http://labs acheter viagra 10.conekia.com/wp-content/uploads/2012/09/virt8-300×266.png 300w, http://labs.conekia.com/wp-content/uploads/2012/09/virt8-337×300.png 337w, http://labs.conekia.com/wp-content/uploads/2012/09/virt8.png 449w” sizes=”(max-width: 300px) 100vw, 300px” />

Click on “Forward”.

Then select the type of storage for the virtual machine. An image file on the host server’s hard disk, a logical volume (LVM), etc…

virtual machine

Click on “Forward”.

Finally, click “Finish” on the next screen. You can deploy the The Advanced Options Tab and change the values that are there. I advise you to use KVM as virtualization type.

virtual machine

Then the virtual machine will be created and a new window will be displayed with an opened console, so you can install the operating system. You must install it in the same way as a normal server.

virtual machine

In the same window you’ll see more tabs to pause and turn off the virtual machine and you will see the details.

From the main window you can also start, stop, clone or even delete the virtual machine if it is no longer needed.

ADVANTAGES

– Both libvirt and virt-manager are free.
– Both are easy to install on most Linux distributions.
– Support lvm, so it is very easy to make clones of virtual machines in production, for backup, migrate, etc..

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *