Difference between revisions of "Basic operations in OpenVZ environment"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Added sections)
m (VE->container)
Line 1: Line 1:
 
This article assumes you have already [[Quick installation|installed OpenVZ]] and prepared the [[OS template cache]](s). If not, follow the links to perform the steps needed.
 
This article assumes you have already [[Quick installation|installed OpenVZ]] and prepared the [[OS template cache]](s). If not, follow the links to perform the steps needed.
  
== Create and start a VE ==
+
== Create and start a container ==
  
To create and start a [[VE]], run the following commands:
+
To create and start a [[container]], run the following commands:
 
<pre>
 
<pre>
 
[host-node]# vzctl create VEID --ostemplate osname
 
[host-node]# vzctl create VEID --ostemplate osname
Line 11: Line 11:
 
</pre>
 
</pre>
  
Here <tt>VEID</tt> is the numeric ID for the VE; <tt>osname</tt> is the name of the OS template for the VE, and <tt>a.b.c.d</tt> is the IP address to be assigned to the VE.
+
Here <tt>VEID</tt> is the numeric ID for the [[container]]; <tt>osname</tt> is the name of the OS template for the [[container]], and <tt>a.b.c.d</tt> is the IP address to be assigned to the [[container]].
  
 
Example:
 
Example:
Line 21: Line 21:
 
</pre>
 
</pre>
  
Your freshly-created VE should be up and running now; you can see its processes:
+
Your freshly-created [[container]] should be up and running now; you can see its processes:
  
 
<pre>
 
<pre>
Line 27: Line 27:
 
</pre>
 
</pre>
  
== Enter to and exit from the VE ==
+
== Enter to and exit from the container ==
  
To enter VE give the following command:
+
To enter [[container]] give the following command:
 
<pre>
 
<pre>
 
[host-node]# vzctl enter VEID
 
[host-node]# vzctl enter VEID
Line 36: Line 36:
 
</pre>
 
</pre>
  
To exit from VE, just type <code>exit</code> and press enter:
+
To exit from [[container]], just type <code>exit</code> and press enter:
 
<pre>
 
<pre>
 
[ve]# exit
 
[ve]# exit
Line 44: Line 44:
 
</pre>
 
</pre>
  
== Stop and destroy the VE ==
+
== Stop and destroy the container ==
  
To stop VE:
+
To stop [[container]]:
  
 
<pre>
 
<pre>
Line 55: Line 55:
 
</pre>
 
</pre>
  
And to destroy VE:
+
And to destroy [[container]]:
 
<pre>
 
<pre>
 
[host-node]# vzctl destroy VEID
 
[host-node]# vzctl destroy VEID
Line 62: Line 62:
 
</pre>
 
</pre>
  
Now, when you know how to manage your [[VE]], learn about [[Resource management]].
+
Now, when you know how to manage your [[container]], learn about [[Resource management]].
  
 
[[Category: Installation]]
 
[[Category: Installation]]
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]

Revision as of 21:43, 25 February 2008

This article assumes you have already installed OpenVZ and prepared the OS template cache(s). If not, follow the links to perform the steps needed.

Create and start a container

To create and start a container, run the following commands:

[host-node]# vzctl create VEID --ostemplate osname
[host-node]# vzctl set VEID --ipadd a.b.c.d --save
[host-node]# vzctl set VEID --nameserver a.b.c.d --save
[host-node]# vzctl start VEID

Here VEID is the numeric ID for the container; osname is the name of the OS template for the container, and a.b.c.d is the IP address to be assigned to the container.

Example:

[host-node]# vzctl create 101 --ostemplate fedora-core-5-minimal
[host-node]# vzctl set 101 --ipadd 10.1.2.3 --save
[host-node]# vzctl set 101 --nameserver 10.0.2.1 --save
[host-node]# vzctl start 101

Your freshly-created container should be up and running now; you can see its processes:

[host-node]# vzctl exec VEID ps ax

Enter to and exit from the container

To enter container give the following command:

[host-node]# vzctl enter VEID
entered into VPS VEID
[ve]#

To exit from container, just type exit and press enter:

[ve]# exit
exited from VPS VEID

[host-node]#

Stop and destroy the container

To stop container:

[host-node]# vzctl stop VEID
Stopping VPS ...
VPS was stopped
VPS is unmounted

And to destroy container:

[host-node]# vzctl destroy VEID
Destroying VPS private area: /vz/private/VEID
VPS private area was destroyed

Now, when you know how to manage your container, learn about Resource management.