Wednesday, September 22, 2010

How to install OpenVZ and Vtonf control panel in centos

SkyHi @ Wednesday, September 22, 2010
OpenVZ is an operating system-level virtualization technology based on the Linux kernel and operating system. OpenVZ allows a physical server to run multiple isolated operating systemopenvz instances, known as containers, Virtual Private Servers (VPSs), or Virtual Environments (VEs). It is similar to FreeBSD Jails and Solaris Zones.
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 file
vi  /etc/selinux/config  
Then look for the line bellow and make sure that is disabled
SELINUX=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.
An OS template cache is an OS template installed into a container and then packed into a gzipped tarball. Using such a cache, a new container can be created in a matter of minutes, if not seconds.
In the example bellow we used Slackware template, for other templates please visit this link.
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 start
Output
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 passwd 
Output:
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  102 
Output:
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 :
Open terminal and type the commands bellow ( Don`t forget to change the version of vtonf  vtonfinstaller.x.x-beta1.tar.gz to the current version you are trying to install)
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
 ./install
When 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-