Difference between revisions of "OpenVZ"

From WA2IAC Wiki
Jump to: navigation, search
m (CentOS 6.4 sysctl.conf Example)
m (Create a Container)
Line 34: Line 34:
  
 
==== Create a Container ====
 
==== Create a Container ====
 +
 +
===== Simple Example =====
 
Become root on the host machine. Once the defaults are set, creating a container is as simple as:
 
Become root on the host machine. Once the defaults are set, creating a container is as simple as:
 
<pre>
 
<pre>
Line 59: Line 61:
 
Pretty simple! Now lets start flipping switches and twisting knobs...
 
Pretty simple! Now lets start flipping switches and twisting knobs...
  
<b>A More Complex Example...</b>
+
===== A More Complex Example =====
  
 
To specify the distro and config of the CT, Execute the following commands to view the templates and distros available:
 
To specify the distro and config of the CT, Execute the following commands to view the templates and distros available:
Line 81: Line 83:
 
# vzctl set 101 --ipadd 1.2.3.4 --nameserver 5.6.7.8 --save
 
# vzctl set 101 --ipadd 1.2.3.4 --nameserver 5.6.7.8 --save
 
</pre>
 
</pre>
 +
 +
===== Example Demonstrating Configuration Controls =====
 +
 +
Here is a more practical example, demonstrating some of the controls available... If you're going to rebuild the server, make a script. To roll the same basic config over and over, use command line substitution to allow specifying the Container ID.
 +
 +
<pre>
 +
vzctl create 103 --ostemplate centos-6-x86_64 --config basic
 +
vzctl set 103  --ipadd 10.1.38.45  --nameserver 10.63.255.1 --save
 +
vzctl set 103 --ram 10G --onboot yes --save
 +
vzctl set 103 --cpus 4 --save
 +
vzctl set 103 --diskspace 20G --save
 +
vzctl start 103
 +
vzctl enter 103
 +
</pre>
 +
 +
===== Networking Hints ======
 +
Remember to provide connectivity for the IP address aliases you are creating on the physical host. While experimenting, you may wish to turn off iptables to avoid frustration. Don't forget to create rules and turn it on again soon!
  
 
=== Installation on CentOS 6.3 ===
 
=== Installation on CentOS 6.3 ===

Revision as of 16:21, 23 September 2013