Perintah dasar OpenVZ

kali ini GemarOprek akan membahas Perintah dasar OpenVZ, sekedar untuk anda ketahui OpenVZ adalah adalah sebuah platform virtualisasi berbasis Linux dan berdasarkan Linux Kernel. OpenVZ memungkinkan sebuah server fisik untuk menjalankan beberapa contoh sistem operasi terpencil dikenal sebagai kontainer.

OpenVZ hanya dapat menjalankan sistem operasi berbasis linux seperti Centos, Fedora, Gentoo, dan Debian. Salah satu kelemahan dari pengguna OpenVZ tidak dapat melakukan modifikasi kernel.

Semua server virtual harus bergaul dengan versi kernel host berjalan pada. Namun karena tidak memiliki overhead dari hypervisor benar sangat cepat dan efisien melalui KVM, Xen, KVM, VMware dan Cloud.

Namun disini saya akan membahas beberapa perintah yang umum digunakan openvz, yaitu

Perintah dasar OpenVZ

VZ Information To list all the running/stopped VPS in the node

vzlist -a

To list all the running VPS in the node

vzlist

To display the templates present in the server

vzpkgls

Creating a VPS To create a VPS with VEID 101 and ostemplate fedora-core-4 with vps.basic configuration

vzctl create 101 --ostemplate fedora-core-4 -.config vps.basic

Deleting a VPS To destroy a VPS with VEID 101

vzctl destroy 101

Configuring VPS (The changes are saved in /etc/vz/conf/<VEID>.conf) To automatically boot when a node is up

vzctl set 101 --onboot yes --save

To set hostname

vzctl set 101 --hostname test101.my.org --save

To add an IP address

vzctl set 101 --ipadd 10.0.186.1 --save

To delete an IP address

vzctl set 101 --ipdel 10.0.186.1 --save

To set the name servers

vzctl set 101 --nameserver 192.168.1.165 --save

To set the root password of VPS 101

vzctl set 101 --userpasswd root:password

To set shortname for VPS

vzctl set 101 --name test101 --save

Start/Stop/Restart VPS To start a VPS

vzctl start 101

To start a disabled VPS

vzctl start 101 --force

To stop a VPS

vzctl stop 101

To restart a VPS

vzctl restart 101

To know the status of a VPS

vzctl status 101

To get the details of the VPS like VEID, ClassID, number of processes inside each VPS and the IP addresses of VPS

cat /proc/vz/veinfo

To enter into a VPS 101

vzctl enter 101

To execute a command in VPS 101

vzctl exec 101 command --- replace command with the command you need to execute
vzctl exec 101 df -h

Managing Disk Quotas To assign disk quotas – First limit is soft limit, second limit is hard limit

vzctl set 101 --diskspace 10485760 --save ==>> for setting 10GB
OR
vzctl set 101 --diskspace 1048576 --save ==>> for setting 1GB

To assign disk inodes

vzctl set 101 --diskinodes 90000:91000 --save

To check the disk quota of a VPS

vzquota stat 101 -t

Managing CPU quota To display the available CPU power

vzcpucheck

To set the number of CPUs available to a VPS

vzctl set 101 --cpus 2 --save

To set the minimum and maximum CPU limits

vzctl set 101 --cpuunits nnnn --cpulimit nn --save
(cpuunits is a an absolute number (fraction of power of the node) and cpulimit is taken as percentage)

Managing memory quota To display memory usage

vzmemcheck -v

To set kmem

vzctl set 101 --kmemsize 2211840:2359296 --save

To set privvmpages

vzctl set 101 --privvmpages 2G:2G --save

Other Commands To copy/clone a VPS

vzmlocal -C <source_veid>:<desitnation_veid>

To disable a VPS

vzctl set 101 --disabled yes

To enable a VPS

vzctl set 101 --disabled no

To suspend a VPS

vzctl suspend 101

To resume a VPS

vzctl resume 101

To run yum update on a VPS

vzyum 101 -y update

To install a package using yum on VPS

vzyum 101 -y install package

To install a package using rpm on VPS

vzrpm 101 -ivh package

atau anda dapat melihat dokumentasi lengkap Perintah dasar OpenVZ pada link ini http://download.openvz.org/doc/OpenVZ-Users-Guide.pdf

Write a Comment

Your email address will not be published.

16 − two =

%d bloggers like this: