Common OpenVZ Admin Tasks
vzctl act as a master tool for various tasks:
How Do I Set VPS Name to vps.foo.bar?
# vzctl set 10 --hostname vps.foo.bar --save
How Do I Set VPS IP Address?
# vzctl set 10 --ipadd 1.2.3.4 --save
How Do I Set VPS DNS Name Servers?
# vzctl set 10 --nameserver 8.8.8.8 --save
How Do I Set Disk Quota?
# vzctl set 10 --diskspace SoftLimitG:HardLimitG --save # vzctl set 10 --diskspace 2G:5G --save
How Do I Stop / Start / Restart VPS Servers?
# vzctl start 10 # vzctl restart 10 # vzctl stop 10
How Do I Run a Command For VPS?
You can run command as follows
# vzctl exec 10 w # vzctl exec 10 df # vzctl exec 10 date # vzctl exec 10 ps aux
How Do I Login Into VPS Server (container)?
Type the following command
# vzctl enter 10
To exit, simply type:
# exit
You can remotely login to your VPS using a ssh client itself or using putty:
$ ssh user@vps.foo.bar
How Do I Destroy VPS?
Type the following command to delete VPS:
# vzctl destroy 10