/  8
 
Virtualization using openVZ and easyVZ
By: Showayb A A Zahda
 It is one of the most interesting and exciting things to run many operating systems at thesame time on a single computer. You can probably test some software on differentenvironments without the need to buy several computers. Or you can have several serversat the same machine running different services in which you distribute the job of theservices into different operating systems. And having a stronger security.Of course that is possible and doable using virtualization. Virtualization is basicallyrunning several operating systems at the same time on top of one operating system. Theyall share the resources of the machine like CPU, RAM, Hard disk, etc. Each system willrun in its environment and will not affect other systems. Moreover, we can connect all of them using the virtual network.In this humble tutorial I will explain for you how to use virtualization to run severaloperating systems on Linux box. I will use openVZ and on top of it I will use the GUIeasyVZ to make the virtualization look prettier and nicer.To start, you need to have your kernel compiled with openVZ. Check that using
#uname -a
The output should look something like Linux ... 2.6.18-8.1.8.el5.028stab038.1 ..The most important part is 028stab038, if you do not have this (the numbers might bedifferent on your machine) you need to update your kernel using yum. So, make sure youare connected to the Internet. To update the kernel you need first to update your yumrepository.
#cd /etc/yum.repos.d#wget http://download.openvz.org/openvz.repo#cd
Till now you have just updated your repository so as to use it for yum.
#yum -y install ovzkernel
 
After this step is done, you several things will change beside the kernel update. One of them is the boot loader. I am using Centos 5, so my boot loader is GRUB. What happensis that the yum installer will add extra entry to
/boot/grub/grub.con
looks like
title Cenros (2.6.8-022
stab
029.1)root (hd0,0)kernel /vmlinuz-2.6.8-022stab029.1 roroot=/dev/sda5initrd /initrd-2.6.8-022stab029.1.img
Note the “stab” in the entryI believe you know how to edit GRUB configuration file to make this entry the defaultboot option.After this step we have to make some changes on some configuration files to make ourvirtualization runs with no problem.First file to be edited is the system control file. /etc/sysctl.conf 
// change these entries# On Hardware Node we generally need# packet forwarding enabled and proxy arp disablednet.ipv4.ip_forward = 1# Enables the magic-sysrq keykernel.sysrq = 1# Enables source route verificationnet.ipv4.conf.all.rp_filter = 1net.ipv4.conf.default.proxy_arp = 0// add these entries at the bottomnet.ipv4.conf.default.proxy_arp = 0net.ipv4.conf.default.send_redirects = 1net.ipv4.conf.all.send_redirects = 0
Do not forget to save the file.Now the next file to be changed is
/etc/sysconfig/selinuxSELINUX=disabled
Make sure that selinux is disabled.Ok by now your virtualization is half way, you need to reboot your machine.
 
#reboot
After your reboot is completed. you need to ensure that you have booted to the correctkernel
#uname -a
The output should look something like Linux ... 2.6.18-8.1.8.el5.028stab038.1 ..Now is the time to install the tools of openVZ.#
yum -y install vzctl vzquota vzpkg
After the installation is completed we can start our service of virtualization.
#/etc/init.d/vz startor#service vz start
Until here we have our virtualization program setup and running. Let's see how this thingwork.In openVZ as other virtualization tools, you must have images of your operating systemsthat you want to run on the host machine. The host machine is the machine that you arerunning every thing on. So, in openVZ the operating system is called template. What isinside a template? You can have the whole operating system and tools in the templateand you can have the minimum number of tools as well. It is customizable. In thistutorial we will use one template that has been done by the openVZ people and do ourexperiments on it.In order to get ready made templates you can search them using yum
#yum search vztmpl
This will give you some output like this
vztmpl-centos-4.i386 2.0-2openvz-utilsMatched from:vztmpl-centos-4vztmpl-fedora-7.i386 1.1-1openvz-utilsMatched from:

Share & Embed

More from this user

Add a Comment

Characters: ...