OpenVZ OS level virtualization
OpenVZ คือ server virtualization solution ในระดับ OS level หรือเรียกว่า containers virtualization อีกตัวหนึ่งที่น่าสนใจ OpenVZ นิยมนำใช้กับ Virtual Private Servers (VPSs) ซึ่งแต่ละ Virtual Private Server จะเรียกว่า container และแต่ละ container จะทำหน้าที่เป็นเหมือน stand-alone server ตัวหนึ่ง ที่สามารถ reboot, root access, users, IP addresses, memory, processes, files, applications, system libraries and configuration files.

ข้อดีของ OS level virtualization มี overhead ที่น้อย ดังนั้นจึงมีประสิทธิภาพที่ดีกว่าพวก VMWare และยังสามารถทำ live migration ได้อีกด้วย แต่ก็มีข้อเสียคือรองรับได้แค่ Linux OS เท่านั้น

ขั้นตอนการ install OpenVZ บน CentOS

  1. download repo ของ OpenVZ และ import RPM Key ด้วยคำสั่งด้านล่าง
    [shell]
    [root@Ezylinux ~]# wget -O /etc/yum.repos.d/openvz.repo http://download.openvz.org/openvz.repo
    [root@Ezylinux ~]# rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ
    [/shell]
  2. Install OpenVZ kernel
    [shell][root@Ezylinux ~]# yum install vzkernel[/shell]
  3. จากนั้นให้แก้ไขค่า config ที่ไฟล์ sysctl.conf
    [shell][root@Ezylinux ~]# vi /etc/sysctl.conf[/shell]

    [shell]
    net.ipv4.ip_forward = 1
    net.ipv6.conf.default.forwarding = 1
    net.ipv6.conf.all.forwarding = 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
    [/shell]

  4. อย่าลืมปิด SELinux ด้วยครับ
    [shell][root@Ezylinux ~]# vi /etc/sysconfig/selinux[/shell]
    SELINUX=disabled
  5. สำหรับ kernel version 2.6.8-based หรือต่ำกว่า แล้วเปิด firewall ด้วยให้เพิ่ม option ที่ไฟล์ /etc/modprobe.conf ตามด้านล่างไปด้วย
    [shell]options ip_conntrack ip_conntrack_enable_ve0=1[/shell]
  6. รันคำสั่งเพื่อ install vzctl vzquota (เผื่อคำสั่ง yum install ด้านบนไม่ได้ install ให้)
    [shell][root@Ezylinux ~]# yum install vzctl vzquota[/shell]
  7. ขั้นตอนสุดท้าย ให้ enable vz service และ reboot เพื่อโหลด vzkernel ขึ้นมาแทน kernel ปัจจุบัน
    [shell][root@Ezylinux ~]# chkconfig vz on[/shell]
    [shell][root@Ezylinux ~]# reboot[/shell]

สำหรับ ขอจบแค่นี้ก่อนในบทความต่อไปจะเขียนถึงวิธีการสร้าง VM ใน openVZ ครับ