Managing OpenVZ With HyperVM On CentOS 5.2 - Page 3

Want to support HowtoForge? Become a subscriber!
 
Submitted by falko (Contact Author) (Forums) on Tue, 2009-02-03 19:06. ::

4 Installing A HyperVM Slave

Now we want to install a HyperVM slave on our server2.example.com and control it from the HyperVM control panel on our master (server1.example.com). This is how we do it:

server2:

First we need to disable SELinux. Open /etc/sysconfig/selinux...

vi /etc/sysconfig/selinux

... and set SELINUX to disabled:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted

Run

setenforce 0

afterwards.

Afterwards we install the HyperVM slave as follows:

wget http://download.lxlabs.com/download/hypervm/production/hypervm-install-slave.sh
sh ./hypervm-install-slave.sh --virtualization-type=openvz

The installation won't take long because no container templates need to be downloaded (the templates are stored on the master). At the end, you should see something like this:

Executing Update Cleanup... Will take a long time to finish....
Congratuations. hyperVM has been installed succesfully on your server as slave
You should open the port 8889 on this server, since this is used for the communication between master and slave
To access this slave, go admin->slaves->add slave, give the ip/machine name of this server. The password is 'admin'. The slave will appear in the list of slaves, and you can access it just like you access localhost

***There is one more step you have to do to make this complete. Open /etc/grub.conf, and change the 'default=1' line to 'default=0', and reboot this machine. You will be rebooted into the openvz kernel and will able to manage vpses from the hyperVM interface
[root@server2 ~]#

Next we open /etc/grub.conf...

vi /etc/grub.conf

... and change default=1 to default=0 so that the OpenVZ kernel is the default kernel:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-92.1.13.el5.028stab059.6PAE)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.1.13.el5.028stab059.6PAE ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-92.1.13.el5.028stab059.6PAE.img
title CentOS (2.6.18-53.1.4.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-53.1.4.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-53.1.4.el5.img
title CentOS (2.6.18-53.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-53.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-53.el5.img

Then we reboot the system:

reboot

That's it for the installation.

Now we can add our new HyperVM slave to the HyperVM control panel. Click on the Servers icon on the HyperVM Home:

Click on the Add Server tab:

Fill in the IP address of the slave (192.168.0.102) and its HyperVM password (the default password is admin). Then click on Add:

You should now see the slave on the Servers overview page (in addition to localhost):

Before we can create an OpenVZ container on the slave, we need to define a second IP pool that we can use on the slave:

(We don't have to define another resource plan - we can use the one we've created before.)

Now go to Virtual Machines > Add Openvz to create a new container on the slave. Fill in a name and IP address for the container as well as a hostname, then select the slave in the Server drop-down menu and finally an OS template:

Afterwards, you should find the new container on the Virtual Machines overview page.

You can start/stop it by clicking on the bulb in the S column:

 

5 Links


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Vikas Saini (not registered) on Tue, 2009-06-23 03:03.

This article is really awesome ! I followed all instructions on my centos 5.3 dedicated server and everything went fine.........

 Now, I have my own VPS on my own dedicated server... This helps me to reduce cpanel cost from $36 to $14 :) :) ............

Submitted by Anonymous (not registered) on Sat, 2009-05-02 03:53.

Hello,

HyperVM and lxadmin Licenses

If we use HyperVM 5 VPS and lxadmin 40 domain for demo or testing purpose its free.

All production HyperVM systems charges 50cents/VPS/month.

if we use Lxadmin with HyperVM it is $3/month for unlimited domains

VPS managed by different virtualization manager is $18/month

Submitted by Life Tester (not registered) on Sun, 2009-02-22 22:21.
but please look into the advanced topics as well: importing/moving VMs, reconnecting servers, selecting another master? :-)
Submitted by Rob (not registered) on Tue, 2009-02-03 20:04.
The documentation for Hypervm leaves much to be asked.. You have done the community a great service once again.. Thanks
Submitted by eXcalibre (not registered) on Thu, 2010-08-19 05:02.

This thread is still very much alive as the exact same process works for future versions of centos too.

It's worth mentioning that there are more templates available to install along with the default centos5 template.


http://wiki.openvz.org/Download/template/precreated


place the downloaded .gz files in the /vm/templates/cache/  folder in order to select them when creating a new Machine/Container.


Great Tut BTW


at the time of writing these are the templates available from the above link

centos-4-x86.tar.gz  
centos-4-x86_64.tar.gz 
centos-5-x86-devel.tar.gz  
centos-5-x86.tar.gz  
centos-5-x86_64-devel.tar.gz  
centos-5-x86_64.tar.gz  
debian-3.1-x86.tar.gz  
debian-4.0-x86.tar.gz 
debian-4.0-x86_64.tar.gz 
debian-5.0-x86.tar.gz  
debian-5.0-x86_64.tar.gz  
fedora-9-x86.tar.gz  
fedora-9-x86_64.tar.gz  
fedora-10-x86.tar.gz  
fedora-10-x86_64.tar.gz  
fedora-11-x86.tar.gz  
fedora-11-x86_64.tar.gz 
fedora-12-x86.tar.gz  
fedora-12-x86_64.tar.gz 
fedora-13-x86.tar.gz 
fedora-13-x86_64.tar.gz 
suse-11.1-x86.tar.gz  
suse-11.1-x86_64.tar.gz  
ubuntu-7.10-x86.tar.gz 
ubuntu-7.10-x86_64.tar.gz  
ubuntu-8.04-x86.tar.gz  
ubuntu-8.04-x86_64.tar.gz 
ubuntu-8.10-x86.tar.gz  
ubuntu-8.10-x86_64.tar.gz 
ubuntu-9.04-x86.tar.gz 
ubuntu-9.04-x86_64.tar.gz  
ubuntu-9.10-x86.tar.gz 
ubuntu-9.10-x86_64.tar.gz 
ubuntu-10.04-x86.tar.gz  
ubuntu-10.04-x86_64.tar.gz


Enjoy