Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: How to Provision a OpenVZ Server  (Read 13205 times)

0 Members and 1 Guest are viewing this topic.

nidhinjo

  • Guest
How to Provision a OpenVZ Server
« on: March 09, 2018, 10:01:32 pm »
 Stage 1 :  Server Setup
------------------------------

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

2. Search  Available kernels

Code: [Select]
yum  search vzkernel
3 Install  kernel 

Code: [Select]
yum  install  vzkernel
         * it will  install  necessary packages for Openvz virtualization includes  vzctl ,vzquota etc
         
Code: [Select]
rmp -qa | grep  vzk*
     * verification command

4.Configure bootloader

Code: [Select]
     1 . /etc/grub.conf
     2 . edit   title  of   vzkernel  as OpenvZ 

5. Set Kernel  parameters and disable  SElinux

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

         
Code: [Select]
vi  /etc/sysconfig/selinux

 Once done with the above  set the SELinux

SELINUX=disabled


6. Now rebooting to  OpenVZ kernel

7.Check whether  Eth0 detected or not, if no refer below link for the 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
         d. Start  VM
             
Code: [Select]
vzctl start  CID
--------------------- :) --------------------------------------