วันพุธที่ 27 กรกฎาคม พ.ศ. 2554

List of general commands and usage OpenVZ

Its easy use OpenVZ to create a new container of VPS. Bellow we listing all of OpenVZ general commands and usage. You must have OpenVZ installed on your server host node.

Creating a new VPS

// Create new VPS 101 with the template centos-5.2-default
vzctl create 101 –ostemplate centos-5.2-default
// Add IP a.b.c.d to the VPS 101
vzctl set 101 –ipadd a.b.c.d –save
// Remove IP a.b.c.d from VPS 101
vzctl set 101 –ipdel a.b.c.d –save
// Add the nemaserver a.b.c.d to VPS 101
vzctl set 101 –nameserver a.b.c.d –save
// Set password 123456 for the 101 VPS
vzctl set 101 –userpasswd root:123456
// Set the VPS to start on server reboot
vzctl set 101 –onboot yes –save
// Allocate diskspace to the VPS 101 10G:11G means Softquota:Hardquota
vzctl set 101 –diskspace 10G:11G –save
// Add IP a.b.c.d to the VPS 101 and set the nameservers a.b.c.d to VPS 101
vzctl set 101 –ipadd a.b.c.d –nameserver a.b.c.d –save

Controling a VPS

// Start the VPS 101
vzctl start 101
// Stop 101 VPS
vzctl stop 101
// Restart 101 VPS
vzctl restart 101
// Enter into 101 VPS
vzctl enter 101
// Display the list of active VPS.s
vzlist
// Display the list of all VPS.s
vzlist -a
// Destroy the VPS (good idea to stop it first)
vzctl destroy 101
// Show resources usage on VPS
vzcalc -v 101
// Execute commands against the VPS (in this case .df -m.)
vzctl exec 101 df -m
// Run yum update on VPS
vzyum 101 -y update
// Install package using yum on VPS
vzyum 101 -y install package
// Install package using rpm on VPS
vzrpm 101 -ivh package

Other details good to know

The templates are located under /vz/template/cache
When creating a new VPS you have to use the full template name eg. if the archived template name is “centos-4-i386-default-4.7-20082227.tar.gz” the template name you will have to use is “centos-4-i386-default-4.7-20082227″
The configuration files for every VPS is located under /etc/vz/conf/VPSID.conf
This file can be modified to suit your needs for every VPS but a VPS restart will be needed. Based on /etc/vz/conf/VPSID.conf basic config files for VPS can be created and saved somewhere on the server and can be used when creating new VPS’s to automatic allocate this settings on new VPS’s.
To create a VPS using a saved config file use this command:
vzctl create 101 –ostemplate centos-5-i386-default –config vps.basic
If you need more templates you can download them from: http://wiki.openvz.org/Download/template/precreated
More details about OpenVZ can be found at: http://wiki.openvz.org !

OpenVZ Web Panel

ได้ของเล่นไหม่อีกแล้วครับ OpenVZ Web Panel ถามว่ามันคืออะไร มันคือ Web Control Panel ที่ใช้ควบคุม OpenVZ นั่นเอง จะได้ไม่ต้องไปยุ่งยากในการ Command line ในการจัดการ
ใช้ตัวนี้แล้วช่วยได้ขึ้นเยอะเลยครับ ตัวอย่างหน้าตาก็แบบนี้



วิธีการติดตั้งบน CentOS 5.X
# yum install gcc make ruby ruby-devel sqlite sqlite-devel ruby-rdoc
# wget http://github.com/albertsj1/Misc-Scripts/raw/master/install_gems.sh
# chmod +x ./install_gems.sh
# ./install_gems.sh
# gem install sqlite3-ruby –version ‘= 1.2.4′
# wget -O – http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sudo sh
พอติดตั้งเสร็จก็เข้าใช้งานผ่านทาง Browser ครับที่ URL นี้
http://{IP Address}:3000
Username และ Password คือ admin ครับ

OpenVZ Virtualization vs Xen Paravirtualization (VPS)

OpenVZ เป็นระบบปฏิบัติการแพลตฟอร์ม virtualization ระดับ kernel Linux เป็นเทคโนโลยีเสมือน (OS Virtualization) แพลตฟอร์มลินุกซ์เชิงพาณิชย์ (Virtuozzo) ซึ่งเป็นผลิตภัณฑ์ของบริษัทผู้ผลิต SWsoft หากติดตั้งบน Linux ก็จะได้ทุก Distribution ของ Linux

Xen เป็นแพลตฟอร์ม paravirtualization ซึ่งคล้ายกับการจำลองฮาร์ดแวร์. Paravirtualization ทำงานโดยการสร้างส่วนติดต่อระหว่างระบบปฏิบัติการสิ่งแวดล้อมเสมือนจริงและ ฮาร์ดแวร์ที่ queues และตอบสนองการร้องขอระบบปฏิบัติการจากระบบปฏิบัติการแก้ไขเพื่อโต้ตอบกับ interface paravirtualization.


ข้อแตกต่าง

OpenVZ
- การใช้ทรัพยากรน้อยลง
- หน่วยความจำจำกัด (พื้นที่ไม่สามารถสลับไ้ด้)
- จำกัดการแก้ไข netfilter (iptables)
- TOP 7 เป็นระบบปฏิบัติการที่เป็นที่นิยม (Hosting) สนับสนุน cPanel WHM / DirectAdmin และ HostInABox


Xen
- ใช้ทรัพยากรมาก
- จำกัดพื้นที่หน่วยความจำ
- เข้าถึงการจัดการเรื่องไฟล์เวอร์ (Full iptables)
- TOP 5 เป็นระบบปฏิบัติการที่เป็นที่นิยม (Hosting) สนับสนุน WHM / cPanel และ DirectAdmin

คำแนะนำ

แนะนำ OpenVZ VPS สำหรับความเร็วและความมั่นคง (Web Hosting)

แนะ นำ Xen VPS สำหรับความยืดหยุ่น เมื่อสถานการณ์ที่ต้องใช้หน่วยความจำมากๆ เกิดขึ้น จึงเหมาะสำหรับโฮสต์ที่ใช้ในการพัฒนา Java (ERP) เป็นต้น Xen VPS จึงเหมาะกับ Tomcat, JBoss, GlassFish, Geronimo.



***OpenVZ ใช้ทรัพยากรน้อยกว่า Xen

Ref.
http://vpslink.com/openvz-vps/
http://vpslink.com/xen-vps/
http://vpslink.com/compare/openvz-vs-xen-vps-hosting/