As compared to virtual machines such as VMware and paravirtualization technologies like Xen, OpenVZ is limited in that it requires both the host and guest OS to be Linux (although Linux distributions can be different in different containers). However, OpenVZ claims a performance advantage; according to its website, there is only a 1–3% performance penalty for OpenVZ
as compared to using a standalone server. One independent performance evaluation confirms this. Another shows more significant performance penaltie s depending on the metric used.
In this tutorial will show you how to install OpenVZ in CentOS and how to install Vtonf, another web interface for OpenVZ
I- Install OpenVZ:
1-First add openVZ repository to Centos:Open terminal and copy the commands:
wget http://download.openvz.org/openvz.reporpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ cp openvz.repo /etc.recpo.d
2-Install openvz kernel:
yum install ovzkernel
3- edit the /etc/systcl.conf
Open /etc/systcl.conf and add these lines:net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
4- Disable Selinux
To disable Selinux, first open the config filevi /etc/selinux/config
Then look for the line bellow and make sure that is disabledSELINUX=disabled
5- Install openvz tools and plugins
yum install vzctl vzquota
6- Restart openv Services:
service vz restart
II - Create Virtual OS /Containers
we have Openvz installed. Now is time to create a Virtual os /containers, for that we need to download an OS template.First cd the cache folder
cd /vz/template/cache
and download the template :
[root@localhost cache]# wget http://download.openvz.org/template/precreated/contrib/slackware-13.0-i386-minimal.tar.gz --2010-06-27 16:55:33-- http://download.openvz.org/template/precreated/contrib/slackware-13.0-i386-minimal.tar.gz Resolving download.openvz.org... 64.131.90.11 Connecting to download.openvz.org|64.131.90.11|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 39641862 (38M) [application/x-gzip] Saving to: `slackware-13.0-i386-minimal.tar.gz' 100%[===============================================================>] 39,641,862 4.48M/s in 14s 2010-06-27 16:55:47 (2.71 MB/s) - `slackware-13.0-i386-minimal.tar.gz' saved [39641862/39641862]
-
Lets create the VPS 102 now
vzctl create 102 --ostemplate slackware-13.0-i386-minimal --config basic
Output:Creating container private area (slackware-13.0-i386-minimal)
Performing postcreate actions
Container private area was created
- Make this VM(virtual machine start on boot)
[root@localhost cache]# vzctl set 102 --onboot yes --saveSaved parameters for CT 102make a Hostname for The machien:vzctl set 102 --hostname Hackers.example.com --saveGive Ip adress 192.168.0.130 to the machine: [root@localhost cache]# vzctl set 102 --ipadd 192.168.0.130 --saveSaved parameters for CT 102 [root@localhost cache]#
- Now start the VM machine 102
vzctl startOutput
102 Starting container ...Container is mountedAdding IP address(es): 192.168.0.130Setting CPU units: 1000Set hostname: Hackers.example.comContainer start in progress...
- Make a root password for the machine:
vzctl exec 102 passwdOutput:
New password: Zz123456
Re-enter new password: Zz123456
Changing password for root
Enter the new password (minimum of 5, maximum of 127 characters)Please use a combination of upper and lower case letters and numbers.Password changed
- Enter The slackware machine 102
vzctl enter 102Output:
entered into CT 102
root@Hackers:/# cat /etc/slackware-version
Slackware 13.0.0.0.0
Stop of start or Exit
More commands :
To restart use : vzctl restart To stop use : vzctl stop
to destroy the vm machine user : vzctl destro 102
For more commands use :vzctl -help
III- Install Vtonf a web interface manager for OpenVZ
VTONF is a Virtual private server (VPS) control panel. It is designed to perform VPS operations in a GNU/Linux server having OpenVZ virtualization technology. VTONF is a Free software distributed under GPL license.- Install Vtonf :
cd /tmp wget http://mesh.dl.sourceforge.net/sourceforge/vtonf/vtonfinstaller.x.x-beta1.tar.gz tar xvfz vtonfinstaller.1.0-beta1.tar.gz cd vtonfinstaller.x.x-beta1 ./installWhen Vtonf control panel installation is completed, you can login to the control panel using the following informations:
http://192.168.0.109:8001/ Login Name : admin Password : admin
REFERENCES
http://www.unixmen.com/linux-tutorials/1024-how-to-install-openvz-and-vtonf-control-panel-in-centos-