Managing OpenVZ With HyperVM On CentOS 5.2
Author: Falko Timme
HyperVM is a multi-platform, multi-tiered, multi-server, multi-virtualization web based application that will allow you to create and manage different virtual machines each based on different technologies across machines and platforms. Currently it supports OpenVZ and Xen virtualization and is available for RHEL 4/5 as well as CentOS 4 and CentOS 5. This tutorial shows how to install it on a CentOS 5.2 server to control OpenVZ containers. I will also explain how to manage OpenVZ containers with HyperVM on a remote CentOS 5.2 server ("slave").
I do not issue any guarantee that this will work for you!
1 Preliminary Note
I'm using two empty CentOS 5.2 servers in this tutorial (empty because HyperVM will also install OpenVZ, so OpenVZ does not need to be installed right now):
- server1.example.com (IP 192.168.0.100): master
- server2.example.com (IP 192.168.0.102): slave
The slave is needed only if you want to control OpenVZ containers on remote servers with HyperVM (explained in an extra chapter).
I couldn't find out anything about HyperVM's license, neither on the HyperVM web site nor in the sources. It seems to be free, at least for a certain amount of controlled OpenVZ containers (according to http://lxlabs.com/store/). If you find out about its license and whether it's free or not, please let me know.
2 Installing A HyperVM Master
(The HyperVM master allows you to control OpenVZ containers on the master itself and on slave machines. Even if you don't want to run slave machines, you need a master!)
First we need to disable SELinux. Open /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
Afterwards we install HyperVM as follows:
sh ./hypervm-install-master.sh --virtualization-type=openvz
This will take quite some time as this also installs OpenVZ and some OpenVZ templates, so be patient. At the end, you should see something like this:
Downloaded: 7 files, 1.4G in 51m 21s (485 KB/s)
Executing Update Cleanup... Will take a long time to finish....
Congratuations. hyperVM has been installed succesfully on your server as master
You can connect to the server at https://<ip-address>:8887 or http://<ip-address>:8888
Please note that first is secure ssl connection, while the second is normal one.
The login and password are 'admin' 'admin'. After Logging in, you will have to change your password to something more secure
Thanks for choosing hyperVM to manage your Server, and allowing us to be of service
***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
You have mail in /var/spool/mail/root
Next we open /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.18.el5.028stab060.2PAE) root (hd0,0) kernel /vmlinuz-2.6.18-92.1.18.el5.028stab060.2PAE ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-92.1.18.el5.028stab060.2PAE.img title CentOS (2.6.18-92.1.1.el5) root (hd0,0) kernel /vmlinuz-2.6.18-92.1.1.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-92.1.1.el5.img title CentOS (2.6.18-92.el5) root (hd0,0) kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00 initrd /initrd-2.6.18-92.el5.img
Then we reboot the system:
That's it for the installation.
3 Using HyperVM
Now open a browser and go to https://192.168.0.100:8887 or http://192.168.0.100:8888.
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 HyperVM login form. Log in with the user admin and the password admin:
The first thing you are asked to do after the first login is to change the default password for admin: