Saturday 13 February 2016

OpenVZ Server Provisioning

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

1 . Add the openVZ repository to  yum.
  

===============
 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.
===============
yum  search vzkernel
===============

3 Install  kernel  
    a.
===============
yum  install  vzkernel
===============
         * it will  install  necessary packages for openvz virtualization inludes  vzctl ,vzquota etc
         *

===============
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.
==============
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.
====
vi  /etc/sysconfig/selinux
====
  and set
====
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
      
=====
/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 )
        
====
vzctl create  CID  --ostemplate   template  --config-basic    
          vzctl set  CID  --onboot yes --save
====
  ---> To  start Vms on boot

 2. Configure VM
        a. add ip
            
====
 vzctl set  CID --ipadd ip --save
====
         b. No of sockets
            
====
 vzctl set CID  --numothersock  150 --save
====
         c. Set name server for  N/w access
              
====
vzctl set CID  --nameserver  IP --save
====
  ( our case  192.168.1.1 )
         d. Start  VM
              
====
vzctl start  CID
====

No comments:

Post a Comment