Find the answer to your Linux question:
Results 1 to 1 of 1
This article deals with how to compile an an open Vz kernal on a centos5.2 platform. Hardware and os requirement's Pentium4, AMD64 for good performance 1gb Ram for 1to4 container ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie
    Join Date
    Apr 2008
    Location
    India
    Posts
    170

    Arrow [SOLVED] open vz kernal installation and management of (vps,containers) virtual priva


    This article deals with how to compile an an open Vz kernal on a centos5.2 platform.
    Hardware and os requirement's
    Pentium4, AMD64 for good performance
    1gb Ram for 1to4 container running on the sever 20 Gb HDD
    centos 5.0 or 5.2


    Steps:


    1. First set up the yum repositary by downloading the reopsitay from openvz website.
    [root@vm ~]#wget http://download.openvz.org/openvz.repo
    just plece it in the yum.repos.d directory


    2. Installing the kernal via yum
    [root@vm ~]#yum install ovzkernel


    3. setup the sysctl.conf file such that the ip is forwared and other kernal parametres are set
    net.ipv4.ip_forward = 1
    kernel.sysrq = 1
    Add the strings in the sysctl
    net.ipv4.conf.default.proxy_arp = 0
    net.ipv4.conf.default.send_redirects = 1
    net.ipv4.conf.all.send_redirects = 0


    4.sysctl -p



    5. Setting up the grub
    check the grub that the new kernal is placed correctly.
    #boot=/dev/hda
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title CentOS (2.6.18-92.1.13.el5.028stab059.6)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-92.1.13.el5.028stab059.6 ro root=LABEL=/ rhgb quiet
    initrd /initrd-2.6.18-92.1.13.el5.028stab059.6.img
    title CentOS (2.6.18-92.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-92.el5 ro root=LABEL=/ rhgb quiet
    initrd /initrd-2.6.18-92.el5.img


    6. Disable Selinux
    [root@vm ~]#vi /etc/sysconfig/selinux SELINUX=disabled
    7. Reboot the box


    8. check the kernal which is booted
    [root@vm ~]#uname -a
    Linux vm.davidserver.com 2.6.18-92.1.13.el5.028stab059.6 #1 SMP Fri Nov 14 20:22:51 MSK 2008 i686 athlon i386 GNU/Linux


    9.start the open vz service
    [root@vm ~]#service vz start


    10. installing the utilities via yum
    yum install vz*
    it will install all the utilities and commands for vz.


    11.Restart the vz once
    [root@vm ~]#service vz restart


    12.installing the template via yum
    yum install vztmpl-centos-4-2.0-2
    alernatively it can be downloaded too
    http://wiki.openvz.org/Download/template/precreated


    13.preparing the cache for the template
    [root@vm ~]#vzpkgcache


    14.list the packages installed
    [root@vm ~]#vzpkgls


    15.create the container
    [root@vm ~]#vzctl create 102 --ostemplate centos-4-i386-minimal


    16. Adding hostname for container
    [root@vm ~]#vzctl set 102 --hostname My works - Powered by CO.CC –save


    17. Adding ip for container
    [root@vm ~]#vzctl set 102 --ipadd 192.168.1.51 –save


    18. Adding nameserver to container
    [root@vm ~]#vzctl set 102 --nameserver 192.168.1.1 –save


    19.To start container while server reboot

    [root@vm ~]#vzctl set 102 --onboot yes --save


    20. starting the container
    [root@vm ~]#vzctl set 102 --userpasswd root:bigjoe


    21.listing the container
    [root@vm ~]# vzlist -a
    CTID NPROC STATUS IP_ADDR HOSTNAME
    102 3 running 192.168.1.51 www.davidanands.co.cc


    22. entering into the container that has been created
    [root@vm ~]# vzctl enter 102
    entered into CT 102
    [root@www /]#


    23. installing yum and other essential services to container
    [root@vm ~]# vzyum 102 install httpd
    [root@vm ~]# vzyum 102 install yum
    starting the httpd
    [root@vm ~]# vzctl exec 102 service httpd start


    24. Few commands


    To destroy a container
    1st stop the container
    [root@vm ~]#vzctl stop 102
    [root@vm ~]#vzctl destroy 102
    To check cpu utilization
    [root@vm ~]# vzcpucheck

    Current CPU utilization: 3000 Power of the node: 100697

    To set cpu limits such that cpu canot cross 10% usage

    [root@vm ~]# vzctl set 101 --cpulimit 10 –save


    Setting CPU limit: 10 Saved parameters for CT 101

    Resource calculation

    [root@vm /]# vzcalc -v 101

    Resource Current(%) Promised(%) Max(%)
    Low Mem 0.12 9.08 9.08
    Total RAM 0.35 n/a n/a
    Mem + Swap 0.12 7.86 n/a
    Alloc. Mem 0.16 9.82 18.97
    Num. Proc 0.04 n/a 2.93
    --------------------------------------------
    Memory 0.35 9.82 18.97


    Diskspace checking of the container
    [root@vm ~]# vzctl exec 101 df -h
    Filesystem Size Used Avail Use% Mounted on
    simfs 1.0G 104M 921M 11% /


    Taking backup of the containers


    download the utility form
    http://download.openvz.org/contrib/utils/vzdump/vzdump-1.0-2.noarch.rpm
    [root@vm ~]# vzdump 101
    INFO: starting backup for VPS 101 (/vz/private/101)
    WARN: online backup without suspend/snapshot
    WARN: this can lead to inconsistent data
    INFO: Creating archive '/vz/dump/vzdump-101.tar' (/vz/private/101)
    Total bytes written: 95262720 (91MiB, 68MiB/s)
    INFO: backup for VPS 101 finished successful (0.02 minutes)
    the dump loacation is
    [root@vm dump]# cd /vz/dump/
    [root@vm dump]# ls
    vzdump-101.log vzdump-101.tar


    Restoring the containers
    (dont try to restore on the same Ctid )
    [root@vm dump]# vzdump --restore /vz/dump/vzdump-101.tar 103
    INFO: extracting archive '/vz/dump/vzdump-101.tar'
    INFO: extracting configuration to '/etc/vz/conf/103.conf'
    INFO: restore successful
    [root@vm dump]# vzlist
    CTID NPROC STATUS IP_ADDR HOSTNAME
    102 3 running 192.168.1.51 My works - Powered by CO.CC
    [root@vm dump]# vzlist -a
    CTID NPROC STATUS IP_ADDR HOSTNAME
    101 - stopped 192.168.1.52 david.server.com
    102 3 running 192.168.1.51 My works - Powered by CO.CC
    103 - stopped 192.168.1.52 david.server.com


    Creating plans and managing allocation of resources via customized scripts
    This can be achieved by modifying the following scripts
    [root@vm ~]#cd /etc/sysconfig/vz-scripts

    [root@vm ~]#cp ve-vps.basic.conf-sample vps.basic.conf

    [root@vm ~]#cp ve-vps.light.conf-sample vps.light.conf
    After editing the file vps.basic.conf you can start creating containers

    [root@vm ~]#vzctl create 101 --ostemplate centos-4-i386-minimal --config vps.basic
    [root@vm ~]#vzctl set 101 --onboot yes --save
    The open vz documentation can be downloaded from the following location
    http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf
    Last edited by davidanand; 02-04-2009 at 11:20 AM.
    Regards
    David Anand
    -->Success is the list of failures ...!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •