OpenVZ is an operating system-level virtualization technology based on the Linux kernel and operating system. OpenVZ allows a physical server to run multiple isolated operating system instances, called containers, virtual private servers (VPSs), or virtual environments (VEs).
OpenVZ comes with command line tools only.
Let’s start, here CTID representing the ID of a container(VPS – Virtual Private Server).
1. Command List of the running VPSs.
# vzlist
Result:
CTID NPROC STATUS IP_ADDR HOSTNAME
106 104 running xx.xx.xx.xx srv1.example.com
107 46 running xx.xx.xx.xx srv2.example.com
108 83 running xx.xx.xx.xx srv3.example.com
109 86 running xx.xx.xx.xx srv4.example.com
2. Command list of the running and stopped VPSs in an node.
This command lists all the VPSs in a node.
# vzlist -a
Result:
CTID NPROC STATUS IP_ADDR HOSTNAME
106 104 running xx.xx.xx.xx srv1.example.com
107 46 running xx.xx.xx.xx srv2.example.com
108 83 running xx.xx.xx.xx srv3.example.com
109 86 running xx.xx.xx.xx srv4.example.com
110 - stopped xx.xx.xx.xx srv5.example.com
3. To start a VPS
# vzctl start CTID
Example:
# vzctl start 110
4. To stop or shutdown a VPS
# vzctl stop CTID
Example:
# vzctl stop 110
5. To view the status of a VPS
# vzctl status CTID
Example:
# vzctl status 110
CTID 116 exist unmounted down
6. To enter a VPS
# vzctl enter CTID
Example:
# vzctl enter 106
entered into CT 106
7. Set hostname for a Server
# vzctl set CTID –hostname New_hostname –save
8. Add new IP to VPS
# vzctl set CTID –ipadd xx.xx.xx.xx –save
9. Delete IP from VPS
# vzctl set CTID –ipdel xx.xx.xx.xx –save
10. Reset root password of a VPS
# vzctl set CTID –userpasswd root:new_password –save
11. To add NameServer IPs to VPS
# vzctl set CTID –nameserver xx.xx.xx.xx –save
12. Delete a container
# vzctl destroy CTID
13. Suspending a container
# vzctl suspend CTID
14. Check all VPSs load averages
# vzlist -o vpsid,laverage
15. Exit from VPS
# exit
That’s it. 🙂