Saturday, February 25, 2012

Basic OpenVz Commands


1] To Start the VPS.
[root@server ~]# vzctl start 101

2] To Stop the VPS.
[root@server ~]# vzctl stop 101

3] To stop the VPS quickly and forcefully.
[root@server ~]# vzctl stop 101 –fast

4] To restart the VPS.
[root@server ~]# vzctl restart 101

5] To destroy VPS.
[root@server ~]# vzctl destroy 101 (good idea to stop it first)

6] To enter into VPS.
[root@server ~]# vzctl enter 101

7] To logout from VPS.
[root@101 ~]# exit

8] To display the list of active VPS's.
[root@server ~]# vzlist

9] To display the list of all VPS.
[root@server ~]# vzlist -a

10] To check the status of a VPS.
[root@server ~]# vzctl status 101

11] To show resource usage on VPS.
[root@server ~]# vzcalc -v 101

12] Execute commands against the VPS.
[root@server ~]# vzctl exec 101 df -h

13] To set the Hostname of a VPS.
[root@server ~]# vzctl set 101 --hostname server.linuxhome.in --save

14] To set new IP to the VPS.
[root@server ~]# vzctl set 101 --ipadd 192.168.1.1 --save

15] To remove IP of VPS.
[root@server ~]# vzctl set 101 --ipdel 192.168.1.1 --save

16] To set the nameserver for VPS.
[root@server ~]# vzctl set 101 --nameserver 192.168.1.254 --save

17] To set root password of VPS.
[root@server ~]# vzctl set 101 --userpasswd root:test
18] To set boot status.
[root@server ~]# vzctl set 101 --onboot yes --save

19] To check CPU Power and Utilization.
[root@server ~]# vzcpucheck -v

20] To set the number of CPUs available to a VPS.
[root@server ~]# vzctl set 101 --cpus 2 --save

21] To set the minimum and maximum CPU limits.
[root@server ~]# vzctl set 101 --cpuunits 1500 --cpulimit 4 --save

22] To check Container's Resources Usage.
[root@server ~]# vzcalc -v 101

23] To set quota & hardisk space.
[root@server ~]# vzctl set 101 --diskspace 10G:11G --save

24] To check the disk quota of a VPS.
[root@server ~]# vzquota stat 101 -t

25] To check memory consumption.
[root@server ~]# vzmemcheck -v

26] To assign disk inodes.
[root@server ~]# vzctl set 101 --diskinodes 90000:91000 --save

27] To run yum update on VPS.
[root@server ~]# vzyum 101 -y update

28] To install package using yum on VPS.
[root@server ~]# vzyum 101 -y install vsftpd*

29] To install package using rpm on VPS.
[root@server ~]# vzrpm 101 -Uvh vsftpd*

30] To find out the templates installed on your system.
[root@server ~]# vzpkgls

No comments: