Sunday, July 7, 2013

OpenVz Server Setup

Stage 1 :  Server Setup
------------------------------


1 . Add the openVZ repository to  yum.
   
Code: [Select]
 a. cd /etc/yum.repos.d
     b. http://download.openvz.org/openvz.repo
     c. rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ

2. Search  Available kernels
    a.
Code: [Select]
yum  search vzkernel

3 Install  kernel 
    a.
Code: [Select]
yum  install  vzkernel 
         * it will  install  necessary packages for openvz virtualization inludes  vzctl ,vzquota etc
         * 
Code: [Select]
rmp -qa | grep  vzk*
    ---> verification command

4.Configure boot loader
     a . /etc/grub.conf
     b . edit   title  of   vzkernel  as OpenvZ   ( Just for  clarity  )

5. Set Kernel  parameters and disable  SElinux
   
       a.
Code: [Select]
vi  /etc/sysctl.conf
  and  set below parameter 
       

             
Quote
net.ipv4.ip_forward = 1
              net.ipv6.conf.default.forwarding = 1
              net.ipv6.conf.all.forwarding = 1
              net.ipv4.conf.default.proxy_arp = 0
             
Quote
# Enables source route verification
               net.ipv4.conf.all.rp_filter = 1
               # Enables the magic-sysrq key
                kernel.sysrq = 1
               # We do not want all our interfaces to send redirects
                 net.ipv4.conf.default.send_redirects = 1
                 net.ipv4.conf.all.send_redirects = 0
   
           b.
Code: [Select]
vi  /etc/sysconfig/selinux 
  and set 
Code: [Select]
SELINUX=disabled

6. Now rebooting to  OpenVz kernel
7.Check whether  Eth0 detected or not  ,if no refer below link  for  fix .
   
    http://in.myloth.com/forum/index.php?topic=17.0

8. Start OpenVz
     
Code: [Select]
/sbin/service vz start

Stage 2 : Templates
--------------------------


1. Download OS templates to  /vz/template/cache/
     Check http://wiki.openvz.org/Download/template/precreated

Stage 3 :  Setup VMs
---------------------------

 
 1. Create virtual  machines   ( CID --> Container ID )
         
Code: [Select]
vzctl create  CID  --ostemplate   template  --config-basic     
          vzctl set  CID  --onboot yes --save
  ---> To  start Vms on boot
 2. Configure VM
        a. add ip
           
Code: [Select]
 vzctl set  CID --ipadd ip --save
         b. No of sockets
             
Code: [Select]
 vzctl set CID  --numothersock  150 --save
         c. Set name server for  N/w access
               
Code: [Select]
vzctl set CID  --nameserver  IP --save
  ( our case  192.168.1.1 )
         d. Start  VM
               
Code: [Select]
vzctl start  CID 

No comments:

Post a Comment