OpenVZ – List of general commands

A few days ago i was writing about how to create a VPS on the free OpenVZ platform which is almost identical to Virtuozzo.

Here is a list of commands “good to know” for everyone who starts using OpenVZ, this will work even if you have HyperVM installed:

[root@test /]#vzctl start 101 // start the VPS 101

[root@test /]#vzctl stop 101 // stop 101 VPS

[root@test /]#vzctl restart 101 // restart 101 VPS

[root@test /]#vzctl enter 101 // enter into 101 VPS

[root@101 /]#exit // log out from 101 VPS

[root@test /]#vzlist // display the list of active VPS’s

[root@test /]#vzlist -a // display the list of all VPS’s

[root@test /]#vzctl destroy 101 // destroy the VPS (good idea to stop it first)

[root@test /]#vzcalc -v 101 // show resources usage on VPS

[root@test /]#vzctl exec 101 df -m // execute commands against the VPS(in this case ‘df -m’)

[root@test /]#vzyum 101 -y update // run yum update on VPS

[root@test /]#vzyum 101 -y install package // install package using yum on VPS

[root@test /]#vzrpm 101 -Uvh package // install package using rpm on VPS

Most of the commands are used from inside the Node to run commands against a VPS(@test is the node server).
If you run commands directly on the VPS then you do not need this commands, yo will use the Linux/Unix distribution specific commands like on any other server.