Difference between revisions of "Basic operations in OpenVZ environment"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(886 -> VEID)
(Add languages selection)
 
(16 intermediate revisions by 8 users not shown)
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.
+
<languages />
 +
<translate>
 +
<!--T:1-->
 +
This article assumes you have already [[Quick installation|installed OpenVZ]]. If not, follow the link to perform the steps needed.
  
To create and start a [[VE]], run the following commands:
+
== Create and start a container == <!--T:2-->
 +
 
 +
<!--T:3-->
 +
To create and start a [[container]], run the following commands:
 
<pre>
 
<pre>
[host-node]# vzctl create VEID --ostemplate osname
+
[host-node]# vzctl create CTID --ostemplate osname
[host-node]# vzctl set VEID --ipadd a.b.c.d --save
+
[host-node]# vzctl set CTID --ipadd a.b.c.d --save
[host-node]# vzctl start VEID
+
[host-node]# vzctl set CTID --nameserver a.b.c.d --save
 +
[host-node]# vzctl start CTID
 
</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.
+
<!--T:4-->
 +
Here <tt>CTID</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]].
  
 +
<!--T:5-->
 
Example:
 
Example:
 
<pre>
 
<pre>
 
[host-node]# vzctl create 101 --ostemplate fedora-core-5-minimal
 
[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 --ipadd 10.1.2.3 --save
 +
[host-node]# vzctl set 101 --nameserver 10.0.2.1 --save
 
[host-node]# vzctl start 101
 
[host-node]# vzctl start 101
 
</pre>
 
</pre>
  
Your freshly-created VE should be up and running now; you can see its processes:
+
<!--T:6-->
 +
Your freshly-created [[container]] should be up and running now; you can see its processes:
  
 +
<!--T:7-->
 
<pre>
 
<pre>
[host-node]# vzctl exec VEID ps ax
+
[host-node]# vzctl exec CTID ps ax
 
</pre>
 
</pre>
  
To enter VE give the following command:
+
== Enter to and exit from the container == <!--T:8-->
 +
 
 +
<!--T:9-->
 +
To enter [[container]] give the following command:
 
<pre>
 
<pre>
[host-node]# vzctl enter VEID
+
[host-node]# vzctl enter CTID
entered into VPS VEID
+
entered into container CTID
[ve]#
+
[container]#
 
</pre>
 
</pre>
  
To exit from VE, just type <code>exit</code> and press enter:
+
<!--T:10-->
 +
To exit from [[container]], just type <code>exit</code> and press Enter:
 
<pre>
 
<pre>
[ve]# exit
+
[container]# exit
exited from VPS VEID
+
exited from container VEID
 
 
 
[host-node]#
 
[host-node]#
 
</pre>
 
</pre>
  
To stop VE:
+
== Stop and destroy the container == <!--T:11-->
  
 +
<!--T:12-->
 +
To stop [[container]]:
 +
 +
<!--T:13-->
 
<pre>
 
<pre>
[host-node]# vzctl stop VEID
+
[host-node]# vzctl stop CTID
Stopping VPS ...
+
Stopping container ...
VPS was stopped
+
Container was stopped
VPS is unmounted
+
Container is unmounted
 
</pre>
 
</pre>
  
And to destroy VE:
+
<!--T:14-->
 +
And to destroy [[container]]:
 
<pre>
 
<pre>
[host-node]# vzctl destroy VEID
+
[host-node]# vzctl destroy CTID
Destroying VPS private area: /vz/private/VEID
+
Destroying container private area: /vz/private/CTID
VPS private area was destroyed
+
Container private area was destroyed
 
</pre>
 
</pre>
 +
 +
<!--T:15-->
 +
Now, when you know how to manage your [[container]], learn about [[Resource management]].
 +
</translate>
  
 
[[Category: Installation]]
 
[[Category: Installation]]
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]

Latest revision as of 01:29, 30 December 2015

<languages /> <translate> This article assumes you have already installed OpenVZ. If not, follow the link to perform the steps needed.

Create and start a container

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

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

Here CTID 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 CTID ps ax

Enter to and exit from the container

To enter container give the following command:

[host-node]# vzctl enter CTID
entered into container CTID
[container]#

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

[container]# exit
exited from container VEID
[host-node]#

Stop and destroy the container

To stop container:

[host-node]# vzctl stop CTID
Stopping container ...
Container was stopped
Container is unmounted

And to destroy container:

[host-node]# vzctl destroy CTID
Destroying container private area: /vz/private/CTID
Container private area was destroyed

Now, when you know how to manage your container, learn about Resource management. </translate>