<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dusty</id>
	<title>OpenVZ Virtuozzo Containers Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.openvz.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dusty"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Dusty"/>
	<updated>2026-04-11T11:10:30Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Debian_template_creation&amp;diff=2981</id>
		<title>Talk:Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Debian_template_creation&amp;diff=2981"/>
		<updated>2007-04-10T06:29:53Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* Update document for Debian Etch */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== edit/symlink /etc/mtab, /proc/mounts ==&lt;br /&gt;
Does anybody have valuable information why this would make sense and if this is needed?&lt;br /&gt;
http://wiki.openvz.org/Debian_template_creation#Fix_.2Fetc.2Fmtab {{unsigned|Juggler|20:41, 13 February 2007}}&lt;br /&gt;
&lt;br /&gt;
: Linking /etc/mtab -&amp;gt; /proc/mounts is needed since VE's root filesystem is actually mounted from the [[Hardware Node]]. Thus, there is no appropriate record in /etc/mtab, so utilities like df fail to work (since they get a list of mounts from the /etc/mtab). After linking /etc/mtab to /proc/mounts, /etc/mtab shows all the mounts, including the one for root filesystem, so df works fine. --[[User:Kir|Kir]] 10:25, 14 February 2007 (EST)&lt;br /&gt;
&lt;br /&gt;
== problem with path ==&lt;br /&gt;
Hi all, &lt;br /&gt;
This is my first trial with openVZ and a wiki. Please give me some hints, if anything is wrong. Don't hesitate to correct my poor english.&lt;br /&gt;
&lt;br /&gt;
I just installed openVZ on a rather old test box with Debian. Installation failed at first and I suppose there is a wrong path statement used for the debian packages.&lt;br /&gt;
&lt;br /&gt;
When I came to &lt;br /&gt;
&amp;lt;code&amp;gt;vzctl start 777&amp;lt;/code&amp;gt;&lt;br /&gt;
I received the message&lt;br /&gt;
&amp;lt;code&amp;gt;Starting VE ...&lt;br /&gt;
VE private area /var/lib/vz/private/777 does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moving the directory 777 from /vz/private to /var/lib/vz/private solves this problem. &lt;br /&gt;
&lt;br /&gt;
Now I could start and enter the new VE. --(unsigned)&lt;br /&gt;
&lt;br /&gt;
This isn't a very good place to ask for help.  You should use the forum instead.  See the link for the forum in the sidebar on the left.  --[[User:Dusty|Dusty]] 19:00, 9 April 2007 (EDT)&lt;br /&gt;
&lt;br /&gt;
== Debian template creation ==&lt;br /&gt;
&lt;br /&gt;
For backward compablity to main OpenVZ:&lt;br /&gt;
&lt;br /&gt;
Create a symlink from /var/lib/vz to /vz&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # ln -s /var/lib/vz /vz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update document for Debian Etch ==&lt;br /&gt;
Updated.&lt;br /&gt;
&lt;br /&gt;
I'm not sure how to fit it in, but if your hardware node is Debian Etch, you don't have to make a temporary VE to create a template.  You can just chroot into it instead, which probably saves some hassle.  It's probably not worth making a whole new page for it and it'd probably cause confusion to add it to this document.  If someone knows what to do with that information, feel free to do something.  I always just use a chroot because it's so much easier for me.  But when I tried it on a RedHat box, it didn't quite work out for some interesting locale reason when installing the SSH package.&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Debian_template_creation&amp;diff=2980</id>
		<title>Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Debian_template_creation&amp;diff=2980"/>
		<updated>2007-04-10T06:19:25Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* Bootstrapping Debian */  Reword a sentence so the user doesn't think Debian is going to take over their computer's OS.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
This will download Debian Etch to a temporary location on your server.  Specify your architecture instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; if you're using something other than i386/x86.  For example, for AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; or for ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.  We use VE ID of 777 for this example; surely it can be any other unused ID.&lt;br /&gt;
 sudo debootstrap --arch i386 etch /vz/private/777 http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
== Preparing and starting the VE ==&lt;br /&gt;
&lt;br /&gt;
=== Setting VE config ===&lt;br /&gt;
First, we need a config for the [[VE]]:&lt;br /&gt;
 sudo vzctl set 777 --applyconfig vps.basic --save&lt;br /&gt;
&lt;br /&gt;
=== Setting VE OSTEMPLATE ===&lt;br /&gt;
Also, we need &amp;lt;tt&amp;gt;OSTEMPLATE&amp;lt;/tt&amp;gt; to be set in VE configuration file, for the [[vzctl]] to work properly.&lt;br /&gt;
&lt;br /&gt;
 sudo sh -c 'echo &amp;quot;OSTEMPLATE=debian-4.0&amp;quot; &amp;gt;&amp;gt; /etc/vz/conf/777.conf'&lt;br /&gt;
&lt;br /&gt;
=== Setting VE IP address ===&lt;br /&gt;
For the [[VE]] to be able to download updates from the Internet, we need a valid IP address for it:&lt;br /&gt;
 sudo vzctl set 777 --ipadd x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
{{Note|if you use private IP for the VE, you have to set up NAT as described in [[Using NAT for VE with private IPs]].}}&lt;br /&gt;
&lt;br /&gt;
=== Setting DNS server for VE ===&lt;br /&gt;
For the [[VE]] to be able to download updates from the Internet, we also need to specify a DNS for it:&lt;br /&gt;
 sudo vzctl set 777 --nameserver x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
=== Starting VE ===&lt;br /&gt;
Now start the VE:&lt;br /&gt;
 sudo vzctl start 777&lt;br /&gt;
&lt;br /&gt;
== Customizing the installation ==&lt;br /&gt;
A few things need to be done inside a newly created VE for it to become suitable for OpenVZ.  All those things are done inside the VE, so first command is:&lt;br /&gt;
 sudo vzctl enter 777&lt;br /&gt;
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Warning!'''  Do not run the commands below on the hardware node, they are only to be run within the VE!}}&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Get new security updates ===&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install some more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login ===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge modutils ppp pppoeconf pppoe pppconfig&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
Do not start some services, stick to bare minimum:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
 update-rc.d -f quotarpc remove&lt;br /&gt;
 update-rc.d -f exim4 remove&lt;br /&gt;
 update-rc.d -f inetd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
&lt;br /&gt;
We don't need an IP for the VE anymore, and we definitely do not need it in template cache, so remove it:&lt;br /&gt;
 sudo vzctl set 777 --ipdel all --save&lt;br /&gt;
&lt;br /&gt;
Also, remove DNS server and search domain information from ''/etc/resolv.conf'' file '''in VE''':&lt;br /&gt;
 sudo nano /vz/private/777/etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Stop the VE:&lt;br /&gt;
 sudo vzctl stop 777&lt;br /&gt;
&lt;br /&gt;
Go to the VE directory:&lt;br /&gt;
 cd /vz/private/777&lt;br /&gt;
&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Look at the resulting tarball to see its size is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Checking if template cache works ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
 sudo vzctl create 123456 --ostemplate debian-4.0-i386-minimal&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 123456&lt;br /&gt;
 sudo vzctl exec 123456 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 123456&lt;br /&gt;
 sudo vzctl destroy 123456&lt;br /&gt;
 sudo rm /etc/vz/conf/123456.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
Finally, let's remove the VE we used for OS template cache creation:&lt;br /&gt;
 sudo vzctl destroy 777&lt;br /&gt;
 sudo rm /etc/vz/conf/777.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Templates]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Debian_template_creation&amp;diff=2979</id>
		<title>Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Debian_template_creation&amp;diff=2979"/>
		<updated>2007-04-10T05:15:31Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* Bootstrapping Debian */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
This will download Debian Etch to your server.  Specify your architecture instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; if you're using something other than i386/x86.  For example, for AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; or for ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.  We use VE ID of 777 for this example; surely it can be any other unused ID.&lt;br /&gt;
 sudo debootstrap --arch i386 etch /vz/private/777 http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
== Preparing and starting the VE ==&lt;br /&gt;
&lt;br /&gt;
=== Setting VE config ===&lt;br /&gt;
First, we need a config for the [[VE]]:&lt;br /&gt;
 sudo vzctl set 777 --applyconfig vps.basic --save&lt;br /&gt;
&lt;br /&gt;
=== Setting VE OSTEMPLATE ===&lt;br /&gt;
Also, we need &amp;lt;tt&amp;gt;OSTEMPLATE&amp;lt;/tt&amp;gt; to be set in VE configuration file, for the [[vzctl]] to work properly.&lt;br /&gt;
&lt;br /&gt;
 sudo sh -c 'echo &amp;quot;OSTEMPLATE=debian-4.0&amp;quot; &amp;gt;&amp;gt; /etc/vz/conf/777.conf'&lt;br /&gt;
&lt;br /&gt;
=== Setting VE IP address ===&lt;br /&gt;
For the [[VE]] to be able to download updates from the Internet, we need a valid IP address for it:&lt;br /&gt;
 sudo vzctl set 777 --ipadd x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
{{Note|if you use private IP for the VE, you have to set up NAT as described in [[Using NAT for VE with private IPs]].}}&lt;br /&gt;
&lt;br /&gt;
=== Setting DNS server for VE ===&lt;br /&gt;
For the [[VE]] to be able to download updates from the Internet, we also need to specify a DNS for it:&lt;br /&gt;
 sudo vzctl set 777 --nameserver x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
=== Starting VE ===&lt;br /&gt;
Now start the VE:&lt;br /&gt;
 sudo vzctl start 777&lt;br /&gt;
&lt;br /&gt;
== Customizing the installation ==&lt;br /&gt;
A few things need to be done inside a newly created VE for it to become suitable for OpenVZ.  All those things are done inside the VE, so first command is:&lt;br /&gt;
 sudo vzctl enter 777&lt;br /&gt;
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Warning!'''  Do not run the commands below on the hardware node, they are only to be run within the VE!}}&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Get new security updates ===&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install some more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login ===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge modutils ppp pppoeconf pppoe pppconfig&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
Do not start some services, stick to bare minimum:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
 update-rc.d -f quotarpc remove&lt;br /&gt;
 update-rc.d -f exim4 remove&lt;br /&gt;
 update-rc.d -f inetd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
&lt;br /&gt;
We don't need an IP for the VE anymore, and we definitely do not need it in template cache, so remove it:&lt;br /&gt;
 sudo vzctl set 777 --ipdel all --save&lt;br /&gt;
&lt;br /&gt;
Also, remove DNS server and search domain information from ''/etc/resolv.conf'' file '''in VE''':&lt;br /&gt;
 sudo nano /vz/private/777/etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Stop the VE:&lt;br /&gt;
 sudo vzctl stop 777&lt;br /&gt;
&lt;br /&gt;
Go to the VE directory:&lt;br /&gt;
 cd /vz/private/777&lt;br /&gt;
&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Look at the resulting tarball to see its size is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Checking if template cache works ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
 sudo vzctl create 123456 --ostemplate debian-4.0-i386-minimal&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 123456&lt;br /&gt;
 sudo vzctl exec 123456 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 123456&lt;br /&gt;
 sudo vzctl destroy 123456&lt;br /&gt;
 sudo rm /etc/vz/conf/123456.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
Finally, let's remove the VE we used for OS template cache creation:&lt;br /&gt;
 sudo vzctl destroy 777&lt;br /&gt;
 sudo rm /etc/vz/conf/777.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Templates]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User_talk:Dusty/Debian_template_creation&amp;diff=2978</id>
		<title>User talk:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User_talk:Dusty/Debian_template_creation&amp;diff=2978"/>
		<updated>2007-04-10T05:14:30Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Delete me, please.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2977</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2977"/>
		<updated>2007-04-10T05:14:12Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Delete me, please.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Debian_template_creation&amp;diff=2976</id>
		<title>Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Debian_template_creation&amp;diff=2976"/>
		<updated>2007-04-10T05:13:46Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Updated for Debian Etch release&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;.  Specify your architecture instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; if you're using something other than i386/x86.  For example, for AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; or for ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.  We use VE ID of 777 for this example; surely it can be any other unused ID.&lt;br /&gt;
 sudo debootstrap --arch i386 etch /vz/private/777 http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
== Preparing and starting the VE ==&lt;br /&gt;
&lt;br /&gt;
=== Setting VE config ===&lt;br /&gt;
First, we need a config for the [[VE]]:&lt;br /&gt;
 sudo vzctl set 777 --applyconfig vps.basic --save&lt;br /&gt;
&lt;br /&gt;
=== Setting VE OSTEMPLATE ===&lt;br /&gt;
Also, we need &amp;lt;tt&amp;gt;OSTEMPLATE&amp;lt;/tt&amp;gt; to be set in VE configuration file, for the [[vzctl]] to work properly.&lt;br /&gt;
&lt;br /&gt;
 sudo sh -c 'echo &amp;quot;OSTEMPLATE=debian-4.0&amp;quot; &amp;gt;&amp;gt; /etc/vz/conf/777.conf'&lt;br /&gt;
&lt;br /&gt;
=== Setting VE IP address ===&lt;br /&gt;
For the [[VE]] to be able to download updates from the Internet, we need a valid IP address for it:&lt;br /&gt;
 sudo vzctl set 777 --ipadd x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
{{Note|if you use private IP for the VE, you have to set up NAT as described in [[Using NAT for VE with private IPs]].}}&lt;br /&gt;
&lt;br /&gt;
=== Setting DNS server for VE ===&lt;br /&gt;
For the [[VE]] to be able to download updates from the Internet, we also need to specify a DNS for it:&lt;br /&gt;
 sudo vzctl set 777 --nameserver x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
=== Starting VE ===&lt;br /&gt;
Now start the VE:&lt;br /&gt;
 sudo vzctl start 777&lt;br /&gt;
&lt;br /&gt;
== Customizing the installation ==&lt;br /&gt;
A few things need to be done inside a newly created VE for it to become suitable for OpenVZ.  All those things are done inside the VE, so first command is:&lt;br /&gt;
 sudo vzctl enter 777&lt;br /&gt;
 export PATH=/sbin:/usr/sbin:/bin:/usr/bin&lt;br /&gt;
&lt;br /&gt;
{{Note|'''Warning!'''  Do not run the commands below on the hardware node, they are only to be run within the VE!}}&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Get new security updates ===&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install some more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login ===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge modutils ppp pppoeconf pppoe pppconfig&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
Do not start some services, stick to bare minimum:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
 update-rc.d -f quotarpc remove&lt;br /&gt;
 update-rc.d -f exim4 remove&lt;br /&gt;
 update-rc.d -f inetd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
&lt;br /&gt;
We don't need an IP for the VE anymore, and we definitely do not need it in template cache, so remove it:&lt;br /&gt;
 sudo vzctl set 777 --ipdel all --save&lt;br /&gt;
&lt;br /&gt;
Also, remove DNS server and search domain information from ''/etc/resolv.conf'' file '''in VE''':&lt;br /&gt;
 sudo nano /vz/private/777/etc/resolv.conf&lt;br /&gt;
&lt;br /&gt;
Stop the VE:&lt;br /&gt;
 sudo vzctl stop 777&lt;br /&gt;
&lt;br /&gt;
Go to the VE directory:&lt;br /&gt;
 cd /vz/private/777&lt;br /&gt;
&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-minimal.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Look at the resulting tarball to see its size is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Checking if template cache works ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
 sudo vzctl create 123456 --ostemplate debian-4.0-i386-minimal&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 123456&lt;br /&gt;
 sudo vzctl exec 123456 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 123456&lt;br /&gt;
 sudo vzctl destroy 123456&lt;br /&gt;
 sudo rm /etc/vz/conf/123456.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
Finally, let's remove the VE we used for OS template cache creation:&lt;br /&gt;
 sudo vzctl destroy 777&lt;br /&gt;
 sudo rm /etc/vz/conf/777.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Templates]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2975</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2975"/>
		<updated>2007-04-10T04:41:32Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''This is just a working area to make sure I've got my facts straight.'''  It works great on a Debian hardware node, but not so great on RedHat.  We might really have to create a temporary VE instead of using the chroot.  Pitty.&lt;br /&gt;
&lt;br /&gt;
---&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;.  Specify your architecture instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; if you're using something other than i386/x86.  For example, for AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; or for ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
 cd ..&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 123456 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 123456&lt;br /&gt;
 sudo vzctl exec 123456 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 123456&lt;br /&gt;
 sudo vzctl destroy 123456&lt;br /&gt;
 sudo rm /etc/vz/conf/123456.conf.destroyed&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2974</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2974"/>
		<updated>2007-04-10T04:27:02Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;.  Specify your architecture instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; if you're using something other than i386/x86.  For example, for AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; or for ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
 cd ..&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 123456 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 123456&lt;br /&gt;
 sudo vzctl exec 123456 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 123456&lt;br /&gt;
 sudo vzctl destroy 123456&lt;br /&gt;
 sudo rm /etc/vz/conf/123456.conf.destroyed&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2973</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2973"/>
		<updated>2007-04-10T04:23:04Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;:&lt;br /&gt;
 sudo debootstrap etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
''Or'' you can (but probably shouldn't need to) specify the architecture manually using one of these commands instead:&lt;br /&gt;
&lt;br /&gt;
To specify i386/x86 architecture:&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
For AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt;.  For ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
 cd ..&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 123456 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 123456&lt;br /&gt;
 sudo vzctl exec 123456 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 123456&lt;br /&gt;
 sudo vzctl destroy 123456&lt;br /&gt;
 sudo rm /etc/vz/conf/123456.conf.destroyed&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2972</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2972"/>
		<updated>2007-04-10T04:20:28Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;:&lt;br /&gt;
 sudo debootstrap etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
''Or'' you can (but probably shouldn't need to) specify the architecture manually using one of these commands instead:&lt;br /&gt;
&lt;br /&gt;
To specify i386/x86 architecture:&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
For AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt;.  For ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
 cd ..&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 12345 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 12345&lt;br /&gt;
 sudo vzctl exec 12345 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 12345&lt;br /&gt;
 sudo vzctl destroy 12345&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2971</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2971"/>
		<updated>2007-04-10T04:12:09Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  It's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;:&lt;br /&gt;
 sudo debootstrap etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
''Or'' you can (but probably shouldn't need to) specify the architecture manually using one of these commands instead:&lt;br /&gt;
&lt;br /&gt;
To specify i386/x86 architecture:&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
For AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt;.  For ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 12345 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 12345&lt;br /&gt;
 sudo vzctl exec 12345 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 12345&lt;br /&gt;
 sudo vzctl destroy 12345&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2970</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2970"/>
		<updated>2007-04-10T04:11:51Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  Even though it's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.osuosl.org/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;:&lt;br /&gt;
 sudo debootstrap etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
''Or'' you can (but probably shouldn't need to) specify the architecture manually using one of these commands instead:&lt;br /&gt;
&lt;br /&gt;
To specify i386/x86 architecture:&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.osuosl.org/debian/&lt;br /&gt;
&lt;br /&gt;
For AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt;.  For ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.osuosl.org/debian/ etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 12345 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 12345&lt;br /&gt;
 sudo vzctl exec 12345 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 12345&lt;br /&gt;
 sudo vzctl destroy 12345&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2969</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2969"/>
		<updated>2007-04-10T04:08:08Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  Even though it's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.oregonstate.edu/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available on the [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584 OpenVZ Forum].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 cd /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;:&lt;br /&gt;
 sudo debootstrap etch etch-temp http://debian.oregonstate.edu/debian/&lt;br /&gt;
&lt;br /&gt;
''Or'' you can (but probably shouldn't need to) specify the architecture manually using one of these commands instead:&lt;br /&gt;
&lt;br /&gt;
To specify i386/x86 architecture:&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.oregonstate.edu/debian/&lt;br /&gt;
&lt;br /&gt;
For AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt;.  For ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.oregonstate.edu/debian etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Set sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 12345 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 12345&lt;br /&gt;
 sudo vzctl exec 12345 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 12345&lt;br /&gt;
 sudo vzctl destroy 12345&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2968</id>
		<title>User:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty/Debian_template_creation&amp;diff=2968"/>
		<updated>2007-04-10T04:00:45Z</updated>

		<summary type="html">&lt;p&gt;Dusty: New page: (this is just a working area to make sure I've got my facts straight)  These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to c...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;(this is just a working area to make sure I've got my facts straight)&lt;br /&gt;
&lt;br /&gt;
These are rough instructions of how to manually create basic Debian Etch (4.0) template cache, which can be used to create OpenVZ [[VE]]s based on Debian Etch (4.0).&lt;br /&gt;
&lt;br /&gt;
'''Notes:'''&lt;br /&gt;
* You shouldn't be running as root, but as a user that is permitted to use sudo instead.  Even though it's a dangerous idea, run as root at your peril.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;/vz&amp;lt;/tt&amp;gt;, you might really need to use &amp;lt;tt&amp;gt;/var/lib/vz&amp;lt;/tt&amp;gt; instead, especially on a Debian Etch host.&lt;br /&gt;
* Anywhere you see &amp;lt;tt&amp;gt;http://debian.oregonstate.edu/debian/&amp;lt;/tt&amp;gt;, you can substitute your favorite Debian mirror.  ([http://www.debian.org/mirror/list List of official Debian Mirrors])&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
You need to have a working copy of &amp;lt;tt&amp;gt;debootstrap&amp;lt;/tt&amp;gt; running on your hardware node.&lt;br /&gt;
&lt;br /&gt;
For Debian:&lt;br /&gt;
 sudo apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
For Gentoo:&lt;br /&gt;
 sudo emerge debootstrap&lt;br /&gt;
&lt;br /&gt;
For other distros you might need to install it from sources, or search for an appropriate package for your distribution.  An RPM is available from [http://forum.openvz.org/index.php?t=tree&amp;amp;th=142&amp;amp;mid=584].&lt;br /&gt;
&lt;br /&gt;
== Bootstrapping Debian ==&lt;br /&gt;
Change to a directory where you'll have about 200MB of usable space and the ability to run executables.  Depending on your configuration, &amp;lt;tt&amp;gt;/tmp&amp;lt;/tt&amp;gt; might be set &amp;lt;tt&amp;gt;noexec&amp;lt;/tt&amp;gt; which would mean you'd have to use some other location.  I'm going to use &amp;lt;tt&amp;gt;/vz/private&amp;lt;/tt&amp;gt; for this.&lt;br /&gt;
&lt;br /&gt;
 chdir /vz/private&lt;br /&gt;
&lt;br /&gt;
Download Debian Etch to a directory called &amp;quot;etch-temp&amp;quot;:&lt;br /&gt;
 sudo debootstrap etch etch-temp http://debian.oregonstate.edu/debian/&lt;br /&gt;
&lt;br /&gt;
''Or'' you can (but probably shouldn't need to) specify the architecture manually using one of these commands instead:&lt;br /&gt;
&lt;br /&gt;
To specify i386/x86 architecture:&lt;br /&gt;
 sudo debootstrap --arch i386 etch etch-temp http://debian.oregonstate.edu/debian/&lt;br /&gt;
&lt;br /&gt;
For AMD64/x86_64, use &amp;lt;tt&amp;gt;amd64&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt;.  For ia64, use &amp;lt;tt&amp;gt;ia64&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Inside the template ==&lt;br /&gt;
The following actions are all performed inside the template.  To get inside, run this:&lt;br /&gt;
 sudo chroot etch-temp&lt;br /&gt;
&lt;br /&gt;
=== Set Debian repositories ===&lt;br /&gt;
 cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
 deb http://debian.oregonstate.edu/debian etch main contrib&lt;br /&gt;
 deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
 EOF&lt;br /&gt;
&lt;br /&gt;
=== Update and upgrade packages ===&lt;br /&gt;
This will update the available packages list, upgrade installed packages with security updates, and install the new packages that are listed below.  Feel free to add your own.&lt;br /&gt;
 apt-get update&lt;br /&gt;
 apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
=== Install more packages ===&lt;br /&gt;
Installing packages could be an interactive process so the system might ask some questions.  You can install more packages if you'd like.  For example:&lt;br /&gt;
 apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
=== Put sane permissions for &amp;lt;tt&amp;gt;/root&amp;lt;/tt&amp;gt; directory ===&lt;br /&gt;
 chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
=== Disable root login===&lt;br /&gt;
This will disable root login by default.&lt;br /&gt;
 usermod -L root&lt;br /&gt;
&lt;br /&gt;
=== Disable getty ===&lt;br /&gt;
Disable running &amp;lt;tt&amp;gt;getty&amp;lt;/tt&amp;gt;s on terminals as a VE does not have any:&lt;br /&gt;
 sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
&lt;br /&gt;
=== Disable &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; for syslog ===&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;tt&amp;gt;syslog&amp;lt;/tt&amp;gt;'s log files, to improve I/O performance:&lt;br /&gt;
 sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
&lt;br /&gt;
=== Fix &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
Link &amp;lt;tt&amp;gt;/etc/mtab&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;/proc/mounts&amp;lt;/tt&amp;gt;, so &amp;lt;tt&amp;gt;df&amp;lt;/tt&amp;gt; and friends will work:&lt;br /&gt;
 rm -f /etc/mtab&lt;br /&gt;
 ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
=== Remove some unneeded packages ===&lt;br /&gt;
If you have any packages you'd like to remove, now's the time for it.  Here's an example:&lt;br /&gt;
 dpkg --purge fortune-mod fortunes-min&lt;br /&gt;
&lt;br /&gt;
=== Disable services ===&lt;br /&gt;
If there are any services you'd like to disable, do that now.  Here's an example:&lt;br /&gt;
 update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
=== Fix SSH host keys ===&lt;br /&gt;
This is only useful if you installed SSH.  Each individual [[VE]] should have its own pair of SSH host keys.  The code below will wipe out the existing SSH keys and instruct the newly-created [[VE]] to create new SSH keys on first boot.&lt;br /&gt;
 rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
 cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
 ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
 rm -f \$0&lt;br /&gt;
 EOF&lt;br /&gt;
 chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
&lt;br /&gt;
=== Clean packages cache ===&lt;br /&gt;
After installing packages, you'll have some junk packages laying around in your cache.  Since you don't want your template to have those, this command will wipe them out.&lt;br /&gt;
 apt-get clean&lt;br /&gt;
&lt;br /&gt;
=== Get out of the template ===&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
 exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
Now create a cached OS tarball.  In the command below, you'll want to replace &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; with your architecture (i386, amd64, ia64, etc).&lt;br /&gt;
&lt;br /&gt;
 cd etch-temp&lt;br /&gt;
 sudo tar -zcf /vz/template/cache/debian-4.0-i386-basic.tar.gz .&lt;br /&gt;
&lt;br /&gt;
Check to make sure the filesize of the resulting tarball is sane:&lt;br /&gt;
 # ls -lh /vz/template/cache&lt;br /&gt;
 -rw-r--r--  1 root root  51M Apr 10 03:16 debian-4.0-i386-basic.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Dispose of the temporary template directory ==&lt;br /&gt;
You're done with the template directory.  Remove it.&lt;br /&gt;
 sudo rm -Rf etch-temp &lt;br /&gt;
&lt;br /&gt;
== Use your new template ==&lt;br /&gt;
We can now create a VE based on the just-created template cache.  Be sure to change &amp;lt;tt&amp;gt;i386&amp;lt;/tt&amp;gt; to your architecture just like you did when you named the tarball above.&lt;br /&gt;
&lt;br /&gt;
 sudo vzctl create 12345 --ostemplate debian-4.0-i386-basic&lt;br /&gt;
&lt;br /&gt;
Now make sure that it works:&lt;br /&gt;
 sudo vzctl start 12345&lt;br /&gt;
 sudo vzctl exec 12345 ps ax&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running as expected.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 sudo vzctl stop 12345&lt;br /&gt;
 sudo vzctl destroy 12345&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User_talk:Dusty/Debian_template_creation&amp;diff=2967</id>
		<title>User talk:Dusty/Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User_talk:Dusty/Debian_template_creation&amp;diff=2967"/>
		<updated>2007-04-10T03:14:59Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Raw commands&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install debootstrap&lt;br /&gt;
cd /var/lib/vz/private&lt;br /&gt;
debootstrap etch etch-temp http://debian.oregonstate.edu/debian/&lt;br /&gt;
chroot etch-temp&lt;br /&gt;
cat &amp;lt;&amp;lt;EOF &amp;gt; /etc/apt/sources.list&lt;br /&gt;
deb http://debian.oregonstate.edu/debian etch main contrib&lt;br /&gt;
deb http://security.debian.org etch/updates main contrib&lt;br /&gt;
EOF&lt;br /&gt;
apt-get update&lt;br /&gt;
apt-get upgrade&lt;br /&gt;
apt-get install ssh quota&lt;br /&gt;
chmod 700 /root&lt;br /&gt;
usermod -L root&lt;br /&gt;
sed -i -e '/getty/d' /etc/inittab&lt;br /&gt;
sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&lt;br /&gt;
rm -f /etc/mtab&lt;br /&gt;
ln -s /proc/mounts /etc/mtab&lt;br /&gt;
update-rc.d -f klogd remove&lt;br /&gt;
rm -f /etc/ssh/ssh_host_*&lt;br /&gt;
cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''&lt;br /&gt;
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''&lt;br /&gt;
rm -f \$0&lt;br /&gt;
EOF&lt;br /&gt;
chmod a+x /etc/rc2.d/S15ssh_gen_host_keys&lt;br /&gt;
apt-get clean&lt;br /&gt;
exit&lt;br /&gt;
cd etch-temp&lt;br /&gt;
tar -zcf ../../template/cache/debian-4.0-i386-basic.tar.gz *&lt;br /&gt;
cd ..&lt;br /&gt;
rm -Rf etch-temp&lt;br /&gt;
cd /root&lt;br /&gt;
vzctl create 12345 --ostemplate=debian-4.0-i386-basic&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Zimbra_on_OpenVZ_on_Debian&amp;diff=2966</id>
		<title>Talk:Zimbra on OpenVZ on Debian</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Zimbra_on_OpenVZ_on_Debian&amp;diff=2966"/>
		<updated>2007-04-09T23:27:03Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* Debian Etch has been released */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debian Etch has been released ==&lt;br /&gt;
&lt;br /&gt;
Update this document for the new version of Debian which has gone stable.  It might be as simple as changing the version number and reference to &amp;quot;sarge&amp;quot;, but maybe not?&lt;br /&gt;
&lt;br /&gt;
--[[User:Dusty|Dusty]] 19:27, 9 April 2007 (EDT)&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Installation_on_Debian/old&amp;diff=2965</id>
		<title>Talk:Installation on Debian/old</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Installation_on_Debian/old&amp;diff=2965"/>
		<updated>2007-04-09T23:26:40Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;info about needed modules in kernel-config&lt;br /&gt;
&lt;br /&gt;
info about &amp;quot;Yet Another mkInitRD&amp;quot; yaid tools creating initrd-files&lt;br /&gt;
&lt;br /&gt;
== ip_forward setup ==&lt;br /&gt;
&lt;br /&gt;
 If you want network access for the virtual server then you need to enable IP forwarding.&lt;br /&gt;
 Set &amp;quot;ip_forward&amp;quot; to yes in /etc/network option.&lt;br /&gt;
 # editor /etc/network/options&lt;br /&gt;
&lt;br /&gt;
: /etc/network/options is deprecated. ip_forward may be enabled in /etc/sysctl.conf by adding the line &amp;quot;net.ipv4.ip_forward=1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Debian Etch has been released ==&lt;br /&gt;
&lt;br /&gt;
Sarge is no longer stable and has been replaced by Etch.  This document needs to be updated for Etch&lt;br /&gt;
&lt;br /&gt;
* References to Sarge need to be updated to use Etch instead.&lt;br /&gt;
* Lenny is the new Debian testing.  If you wish to continue to have a testing section listed, update it for Lenny.  Otherwise remove the testing section.&lt;br /&gt;
* Use the official Debian mirrors to get the OpenVZ packages.&lt;br /&gt;
&lt;br /&gt;
--[[User:Dusty|Dusty]] 19:26, 9 April 2007 (EDT)&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Installation_on_Debian/old&amp;diff=2964</id>
		<title>Talk:Installation on Debian/old</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Installation_on_Debian/old&amp;diff=2964"/>
		<updated>2007-04-09T23:26:17Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* Debian Etch has been released */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;info about needed modules in kernel-config&lt;br /&gt;
&lt;br /&gt;
info about &amp;quot;Yet Another mkInitRD&amp;quot; yaid tools creating initrd-files&lt;br /&gt;
&lt;br /&gt;
== ip_forward setup ==&lt;br /&gt;
&lt;br /&gt;
 If you want network access for the virtual server then you need to enable IP forwarding.&lt;br /&gt;
 Set &amp;quot;ip_forward&amp;quot; to yes in /etc/network option.&lt;br /&gt;
 # editor /etc/network/options&lt;br /&gt;
&lt;br /&gt;
: /etc/network/options is deprecated. ip_forward may be enabled in /etc/sysctl.conf by adding the line &amp;quot;net.ipv4.ip_forward=1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Debian Etch has been released ==&lt;br /&gt;
&lt;br /&gt;
Sarge is no longer stable and has been replaced by Etch.  This document needs to be updated for Etch&lt;br /&gt;
&lt;br /&gt;
* References to Sarge need to be updated to use Etch instead.&lt;br /&gt;
* Lenny is the new Debian testing.  If you wish to continue to have a testing section listed, update it for Lenny.  Otherwise remove the testing section.&lt;br /&gt;
* Use the official Debian mirrors to get the OpenVZ packages.&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Installation_on_Debian/old&amp;diff=2963</id>
		<title>Talk:Installation on Debian/old</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Installation_on_Debian/old&amp;diff=2963"/>
		<updated>2007-04-09T23:24:14Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Debian Etch has been released&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;info about needed modules in kernel-config&lt;br /&gt;
&lt;br /&gt;
info about &amp;quot;Yet Another mkInitRD&amp;quot; yaid tools creating initrd-files&lt;br /&gt;
&lt;br /&gt;
== ip_forward setup ==&lt;br /&gt;
&lt;br /&gt;
 If you want network access for the virtual server then you need to enable IP forwarding.&lt;br /&gt;
 Set &amp;quot;ip_forward&amp;quot; to yes in /etc/network option.&lt;br /&gt;
 # editor /etc/network/options&lt;br /&gt;
&lt;br /&gt;
: /etc/network/options is deprecated. ip_forward may be enabled in /etc/sysctl.conf by adding the line &amp;quot;net.ipv4.ip_forward=1&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Debian Etch has been released ==&lt;br /&gt;
&lt;br /&gt;
Sarge is no longer stable and has been replaced by Etch.  This document needs to be updated for Etch and references to Sarge need to be updated to use Etch instead.  Lenny is the new Debian testing.&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Zimbra_on_OpenVZ_on_Debian&amp;diff=2962</id>
		<title>Talk:Zimbra on OpenVZ on Debian</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Zimbra_on_OpenVZ_on_Debian&amp;diff=2962"/>
		<updated>2007-04-09T23:22:23Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Debian Etch has been released&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Debian Etch has been released ==&lt;br /&gt;
&lt;br /&gt;
Update this document for the new version of Debian which has gone stable.  It might be as simple as changing the version number and reference to &amp;quot;sarge&amp;quot;, but maybe not?&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:Dusty&amp;diff=2961</id>
		<title>User:Dusty</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:Dusty&amp;diff=2961"/>
		<updated>2007-04-09T23:18:38Z</updated>

		<summary type="html">&lt;p&gt;Dusty: New page: I'm an OpenVZ user.  I couldn't live without it.  I use OpenVZ on quite a few servers for both business and personal use.  I use Debian Etch GNU/Linux for all of my hardware nodes except f...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;I'm an OpenVZ user.  I couldn't live without it.&lt;br /&gt;
&lt;br /&gt;
I use OpenVZ on quite a few servers for both business and personal use.&lt;br /&gt;
&lt;br /&gt;
I use Debian Etch GNU/Linux for all of my hardware nodes except for one server where I am forced to use RHEL3.  I thank Ola Lundqvist for providing and maintaining Debian packages for OpenVZ utilities and going through the effort to make sure they are provided through the official Debian repositories.&lt;br /&gt;
&lt;br /&gt;
Except for a couple special servers, I always custom-compile my kernel and disable kernel module support.  It is important for me that OpenVZ works with kernel module support disabled.  Right now, it it requires major tweaking of the /etc/init.d/vz script for that to work.&lt;br /&gt;
&lt;br /&gt;
I always use a custom-created Debian VPS template for my VPSes.  For that, debootstrap is very important and useful.&lt;br /&gt;
&lt;br /&gt;
I tend to do some advanced things with my VPS configurations and sometimes require custom scripts to make certain things happen correctly.  For example, I have stored in my individual VPS .conf files the necessary settings for port forwarding through the hardware node to the VPS for certain tasks as well as defining the SNAT IP address if necessary.  I then have scripts that read the individual VPS and global .conf files that perform specific tasks like port forwarding, firewall settings, and disk mounting.&lt;br /&gt;
&lt;br /&gt;
I don't use .mount and .umount scripts because they don't quite do the job as needed.  Sometimes the command needs to be run on a global level (re-setting the global firewall) or on a frequent basis (checking mounts for status and/or availability).  Also, having all the settings in a single .conf file per VPS and a single .conf for hardware node global is very useful for portability between servers.&lt;br /&gt;
&lt;br /&gt;
I wish OpenVZ was in the mainstream kernel.  It'd make deploying new servers and upgrading existing kernels a much simpler task, especially when I try to stay as Debian-standard as possible.&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Debian_template_creation&amp;diff=2960</id>
		<title>Talk:Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Debian_template_creation&amp;diff=2960"/>
		<updated>2007-04-09T23:00:24Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* problem with path */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== edit/symlink /etc/mtab, /proc/mounts ==&lt;br /&gt;
Does anybody have valuable information why this would make sense and if this is needed?&lt;br /&gt;
http://wiki.openvz.org/Debian_template_creation#Fix_.2Fetc.2Fmtab {{unsigned|Juggler|20:41, 13 February 2007}}&lt;br /&gt;
&lt;br /&gt;
: Linking /etc/mtab -&amp;gt; /proc/mounts is needed since VE's root filesystem is actually mounted from the [[Hardware Node]]. Thus, there is no appropriate record in /etc/mtab, so utilities like df fail to work (since they get a list of mounts from the /etc/mtab). After linking /etc/mtab to /proc/mounts, /etc/mtab shows all the mounts, including the one for root filesystem, so df works fine. --[[User:Kir|Kir]] 10:25, 14 February 2007 (EST)&lt;br /&gt;
&lt;br /&gt;
== problem with path ==&lt;br /&gt;
Hi all, &lt;br /&gt;
This is my first trial with openVZ and a wiki. Please give me some hints, if anything is wrong. Don't hesitate to correct my poor english.&lt;br /&gt;
&lt;br /&gt;
I just installed openVZ on a rather old test box with Debian. Installation failed at first and I suppose there is a wrong path statement used for the debian packages.&lt;br /&gt;
&lt;br /&gt;
When I came to &lt;br /&gt;
&amp;lt;code&amp;gt;vzctl start 777&amp;lt;/code&amp;gt;&lt;br /&gt;
I received the message&lt;br /&gt;
&amp;lt;code&amp;gt;Starting VE ...&lt;br /&gt;
VE private area /var/lib/vz/private/777 does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moving the directory 777 from /vz/private to /var/lib/vz/private solves this problem. &lt;br /&gt;
&lt;br /&gt;
Now I could start and enter the new VE. --(unsigned)&lt;br /&gt;
&lt;br /&gt;
This isn't a very good place to ask for help.  You should use the forum instead.  See the link for the forum in the sidebar on the left.  --[[User:Dusty|Dusty]] 19:00, 9 April 2007 (EDT)&lt;br /&gt;
&lt;br /&gt;
== Debian template creation ==&lt;br /&gt;
&lt;br /&gt;
For backward compablity to main OpenVZ:&lt;br /&gt;
&lt;br /&gt;
Create a symlink from /var/lib/vz to /vz&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # ln -s /var/lib/vz /vz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update document for Debian Etch ==&lt;br /&gt;
&lt;br /&gt;
Debian Etch has been released and this document needs updated for the new version.&lt;br /&gt;
&lt;br /&gt;
* Etch does have proper AMD64 support now&lt;br /&gt;
* Use &amp;quot;etch&amp;quot; instead of &amp;quot;sarge&amp;quot; everywhere.&lt;br /&gt;
* Update for any Etch-specific cases (I don't know of any yet)&lt;br /&gt;
* Update/remove any Sarge-specific cases that no longer apply (I don't know of any yet)&lt;br /&gt;
* Instead of recommending that people use the .de mirror, link to a list of mirrors maybe?&lt;br /&gt;
&lt;br /&gt;
If someone gets to it before I do, great!  If not, I'm hoping that I'll update the document after I've done this task a few times in production, which I'm doing quite a bit this week.  Thanks!&lt;br /&gt;
&lt;br /&gt;
--[[User:Dusty|Dusty]] 18:58, 9 April 2007 (EDT)&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Debian_template_creation&amp;diff=2959</id>
		<title>Talk:Debian template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Debian_template_creation&amp;diff=2959"/>
		<updated>2007-04-09T22:58:30Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Update document for Debian Etch&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== edit/symlink /etc/mtab, /proc/mounts ==&lt;br /&gt;
Does anybody have valuable information why this would make sense and if this is needed?&lt;br /&gt;
http://wiki.openvz.org/Debian_template_creation#Fix_.2Fetc.2Fmtab {{unsigned|Juggler|20:41, 13 February 2007}}&lt;br /&gt;
&lt;br /&gt;
: Linking /etc/mtab -&amp;gt; /proc/mounts is needed since VE's root filesystem is actually mounted from the [[Hardware Node]]. Thus, there is no appropriate record in /etc/mtab, so utilities like df fail to work (since they get a list of mounts from the /etc/mtab). After linking /etc/mtab to /proc/mounts, /etc/mtab shows all the mounts, including the one for root filesystem, so df works fine. --[[User:Kir|Kir]] 10:25, 14 February 2007 (EST)&lt;br /&gt;
&lt;br /&gt;
== problem with path ==&lt;br /&gt;
Hi all, &lt;br /&gt;
This is my first trial with openVZ and a wiki. Please give me some hints, if anything is wrong. Don't hesitate to correct my poor english.&lt;br /&gt;
&lt;br /&gt;
I just installed openVZ on a rather old test box with Debian. Installation failed at first and I suppose there is a wrong path statement used for the debian packages.&lt;br /&gt;
&lt;br /&gt;
When I came to &lt;br /&gt;
&amp;lt;code&amp;gt;vzctl start 777&amp;lt;/code&amp;gt;&lt;br /&gt;
I received the message&lt;br /&gt;
&amp;lt;code&amp;gt;Starting VE ...&lt;br /&gt;
VE private area /var/lib/vz/private/777 does not exist&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Moving the directory 777 from /vz/private to /var/lib/vz/private solves this problem. &lt;br /&gt;
&lt;br /&gt;
Now I could start and enter the new VE.&lt;br /&gt;
&lt;br /&gt;
== Debian template creation ==&lt;br /&gt;
&lt;br /&gt;
For backward compablity to main OpenVZ:&lt;br /&gt;
&lt;br /&gt;
Create a symlink from /var/lib/vz to /vz&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # ln -s /var/lib/vz /vz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Update document for Debian Etch ==&lt;br /&gt;
&lt;br /&gt;
Debian Etch has been released and this document needs updated for the new version.&lt;br /&gt;
&lt;br /&gt;
* Etch does have proper AMD64 support now&lt;br /&gt;
* Use &amp;quot;etch&amp;quot; instead of &amp;quot;sarge&amp;quot; everywhere.&lt;br /&gt;
* Update for any Etch-specific cases (I don't know of any yet)&lt;br /&gt;
* Update/remove any Sarge-specific cases that no longer apply (I don't know of any yet)&lt;br /&gt;
* Instead of recommending that people use the .de mirror, link to a list of mirrors maybe?&lt;br /&gt;
&lt;br /&gt;
If someone gets to it before I do, great!  If not, I'm hoping that I'll update the document after I've done this task a few times in production, which I'm doing quite a bit this week.  Thanks!&lt;br /&gt;
&lt;br /&gt;
--[[User:Dusty|Dusty]] 18:58, 9 April 2007 (EDT)&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Virtual_Ethernet_device&amp;diff=2510</id>
		<title>Virtual Ethernet device</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Virtual_Ethernet_device&amp;diff=2510"/>
		<updated>2006-11-18T06:26:44Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''Virtual ethernet device''' is an ethernet-like device which can be used inside a [[VE]]. Unlike&lt;br /&gt;
[[venet]] network device, veth device has a MAC address. Due to this, it can be used in configurations, when veth is bridged to ethX or other device and VE user fully sets up his networking himself, &lt;br /&gt;
including IPs, gateways etc.&lt;br /&gt;
&lt;br /&gt;
Virtual ethernet device consist of two ethernet devices - one in [[VE0]] and another one &lt;br /&gt;
in VE. These devices are connected to each other, so if a packet goes to one&lt;br /&gt;
device it will come out from the other device.&lt;br /&gt;
&lt;br /&gt;
== Virtual ethernet device usage ==&lt;br /&gt;
&lt;br /&gt;
=== Kernel module ===&lt;br /&gt;
First of all, make sure the &amp;lt;code&amp;gt;vzethdev&amp;lt;/code&amp;gt; module is loaded:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# lsmod | grep vzeth&lt;br /&gt;
vzethdev                8224  0&lt;br /&gt;
vzmon                  35164  5 vzethdev,vznetdev,vzrst,vzcpt&lt;br /&gt;
vzdev                   3080  4 vzethdev,vznetdev,vzmon,vzdquota&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case it is not loaded, load it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# modprobe vzethdev&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You might want to add the module to &amp;lt;code&amp;gt;/etc/init.d/vz script&amp;lt;/code&amp;gt;, so it will be loaded during startup.&lt;br /&gt;
&lt;br /&gt;
=== Adding veth to a VE ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl set &amp;lt;VEID&amp;gt; --veth_add &amp;lt;dev_name&amp;gt;,&amp;lt;dev_addr&amp;gt;,&amp;lt;ve_dev_name&amp;gt;,&amp;lt;ve_dev_addr&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here &lt;br /&gt;
* &amp;lt;tt&amp;gt;dev_name&amp;lt;/tt&amp;gt; is ethernet device name in the [[VE0|host system]]&lt;br /&gt;
* &amp;lt;tt&amp;gt;dev_addr&amp;lt;/tt&amp;gt; is its MAC address&lt;br /&gt;
* &amp;lt;tt&amp;gt;ve_dev_name&amp;lt;/tt&amp;gt; is an ethernet device name in the VE&lt;br /&gt;
* &amp;lt;tt&amp;gt;ve_dev_addr&amp;lt;/tt&amp;gt; is its MAC address&lt;br /&gt;
&lt;br /&gt;
MAC addresses must be entered in XX:XX:XX:XX:XX:XX format. Note that this option&lt;br /&gt;
is incremental, so devices are added to already existing ones.&lt;br /&gt;
&lt;br /&gt;
==== Examples ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl set 101 --veth_add veth101.0,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After executing this command &amp;lt;tt&amp;gt;veth&amp;lt;/tt&amp;gt; device will be created for VE 101 and veth configuration will be saved to a VE configuration file.&lt;br /&gt;
Host-side ethernet device will have &amp;lt;tt&amp;gt;veth101.0&amp;lt;/tt&amp;gt; name and &amp;lt;tt&amp;gt;00:12:34:56:78:9A&amp;lt;/tt&amp;gt; MAC address.&lt;br /&gt;
VE-side ethernet device will have &amp;lt;tt&amp;gt;eth0&amp;lt;/tt&amp;gt; name and &amp;lt;tt&amp;gt;00:12:34:56:78:9B&amp;lt;/tt&amp;gt; MAC address.&lt;br /&gt;
{{Note|Use random MAC addresses. Do not use MAC addresses of real eth devices, because this can lead to collisions.}}&lt;br /&gt;
&lt;br /&gt;
=== Removing veth from a VE ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl set &amp;lt;VEID&amp;gt; --veth_del &amp;lt;dev_name&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here &amp;lt;tt&amp;gt;dev_name&amp;lt;/tt&amp;gt; is the ethernet device name in the [[VE0|host system]].&lt;br /&gt;
&lt;br /&gt;
==== Example ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
vzctl set 101 --veth_del veth101.0 --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
After executing this command veth device with host-side ethernet name veth101.0 will be removed from VE 101 and veth configuration will be updated in VE config file.&lt;br /&gt;
&lt;br /&gt;
== Common configurations with virtual ethernet devices ==&lt;br /&gt;
Module &amp;lt;tt&amp;gt;vzethdev&amp;lt;/tt&amp;gt; must be loaded to operate with veth devices.&lt;br /&gt;
&lt;br /&gt;
=== Simple configuration with virtual ethernet device ===&lt;br /&gt;
&lt;br /&gt;
==== Start a VE ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl start 101&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add veth device to VE ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl set 101 --veth_add veth101.0,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Configure devices in VE0 ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# ifconfig veth101.0 0&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv4/conf/veth101.0/forwarding&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv4/conf/veth101.0/proxy_arp&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv4/conf/eth0/forwarding&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv4/conf/eth0/proxy_arp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Configure device in VE ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl enter 101&lt;br /&gt;
[ve-101]# /sbin/ifconfig eth0 0&lt;br /&gt;
[ve-101]# /sbin/ip addr add 192.168.0.101 dev eth0&lt;br /&gt;
[ve-101]# /sbin/ip route add default dev eth0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add route in [[VE0]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# ip route add 192.168.0.101 dev veth101.0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Virtual ethernet device with IPv6 ===&lt;br /&gt;
&lt;br /&gt;
==== Start [[VE]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl start 101&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add veth device to [[VE]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl set 101 --veth_add veth101.0,00:12:34:56:78:9A,eth0,00:12:34:56:78:9B --save&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Configure devices in [[VE0]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# ifconfig veth101.0 0&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv6/conf/veth101.0/forwarding&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv6/conf/eth0/forwarding&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv6/conf/all/forwarding&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Configure device in [[VE]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# vzctl enter 101&lt;br /&gt;
[ve-101]# /sbin/ifconfig eth0 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Start router advertisement daemon (radvd) for IPv6 in VE0 ====&lt;br /&gt;
First you need to edit radvd configuration file. Here is a simple example of &amp;lt;tt&amp;gt;/etc/radv.conf&amp;lt;/tt&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
interface veth101.0&lt;br /&gt;
{&lt;br /&gt;
        AdvSendAdvert on;&lt;br /&gt;
        MinRtrAdvInterval 3;&lt;br /&gt;
        MaxRtrAdvInterval 10;&lt;br /&gt;
        AdvHomeAgentFlag off;&lt;br /&gt;
&lt;br /&gt;
        prefix 3ffe:2400:0:0::/64&lt;br /&gt;
        {&lt;br /&gt;
                AdvOnLink on;&lt;br /&gt;
                AdvAutonomous on;&lt;br /&gt;
                AdvRouterAddr off;&lt;br /&gt;
        };&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
interface eth0&lt;br /&gt;
{&lt;br /&gt;
        AdvSendAdvert on;&lt;br /&gt;
        MinRtrAdvInterval 3;&lt;br /&gt;
        MaxRtrAdvInterval 10;&lt;br /&gt;
        AdvHomeAgentFlag off;&lt;br /&gt;
&lt;br /&gt;
        prefix 3ffe:0302:0011:0002::/64&lt;br /&gt;
        {&lt;br /&gt;
                AdvOnLink on;&lt;br /&gt;
                AdvAutonomous on;&lt;br /&gt;
                AdvRouterAddr off;&lt;br /&gt;
        };&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, start radvd:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# /etc/init.d/radvd start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add IPv6 addresses to devices in [[VE0]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# ip addr add dev veth101.0 3ffe:2400::212:34ff:fe56:789a/64&lt;br /&gt;
[host-node]# ip addr add dev eth0 3ffe:0302:0011:0002:211:22ff:fe33:4455/64&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Virtual ethernet devices can be joined in one bridge ===&lt;br /&gt;
Perform steps 1 - 4 from Simple configuration chapter for several VEs and/or veth devices&lt;br /&gt;
&lt;br /&gt;
==== Create bridge device ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# brctl addbr vzbr0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add veth devices to bridge ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# brctl addif vzbr0 veth101.0&lt;br /&gt;
...&lt;br /&gt;
[host-node]# brctl addif vzbr0 veth101.n&lt;br /&gt;
[host-node]# brctl addif vzbr0 veth102.0&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
[host-node]# brctl addif vzbr0 vethXXX.N&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Configure bridge device ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# ifconfig vzbr0 0&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv4/conf/vzbr0/forwarding&lt;br /&gt;
[host-node]# echo 1 &amp;gt; /proc/sys/net/ipv4/conf/vzbr0/proxy_arp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Add routes in [[VE0]] ====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[host-node]# ip route add 192.168.101.1 dev vzbr0&lt;br /&gt;
...&lt;br /&gt;
[host-node]# ip route add 192.168.101.n dev vzbr0&lt;br /&gt;
[host-node]# ip route add 192.168.102.1 dev vzbr0&lt;br /&gt;
...&lt;br /&gt;
...&lt;br /&gt;
[host-node]# ip route add 192.168.XXX.N dev vzbr0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thus you'll have more convinient configuration, i.e. all routes to VEs will be through this bridge and VEs can communicate with each other even without these routes.&lt;br /&gt;
&lt;br /&gt;
=== Virtual ethernet devices + VLAN ===&lt;br /&gt;
This configuration can be done by adding vlan device to the previous configuration.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Virtual network device]]&lt;br /&gt;
* [[Differences between venet and veth]]&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/hints-daemons-radvd.html Linux IPv6 HOWTO, a chapter about radvd]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Networking]]&lt;br /&gt;
[[Category: HOWTO]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Quick_installation_(legacy)&amp;diff=2496</id>
		<title>Quick installation (legacy)</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Quick_installation_(legacy)&amp;diff=2496"/>
		<updated>2006-11-13T08:20:27Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document briefly describes the steps needed to install OpenVZ on your machine.&lt;br /&gt;
&lt;br /&gt;
This document is also available in the following languages: [http://forum.openvz.org/index.php?t=tree&amp;amp;amp;goto=35&amp;amp;amp;#msg_35 French],  [http://forum.openvz.org/index.php?t=tree&amp;amp;amp;goto=1805&amp;amp;amp;#msg_1805 German].&lt;br /&gt;
&lt;br /&gt;
OpenVZ consists of a kernel, user-level tools, and VE templates. This guide tells how to install the kernel and the tools.&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
This guide assumes you are running recent release of Fedora Core (like FC5) or RHEL/CentOS 4. Currently, OpenVZ kernel tries to support the same hardware that Red Hat kernels support. For full hardware compatibility list, see [http://www.virtuozzo.com/en/products/virtuozzo/hcl/ Virtuozzo HCL].&lt;br /&gt;
&lt;br /&gt;
=== Filesystems ===&lt;br /&gt;
It is recommended to use a separate partition for VEs private directories (by default /vz/private/&amp;lt;veid&amp;gt;). The reason why you should do so is that if you wish to use OpenVZ per-VE disk quota, you won't be able to use usual Linux disk quotas on the same partition. Bear in mind, that per-VE quota in this context includes not only pure per-VE quota, but also usual Linux disk quota used in VE, not on HN.&lt;br /&gt;
&lt;br /&gt;
At least try to avoid using root partition for VEs, because the root user of VE will be able to overcome 5% disk space barrier in some situations. This way HN root partition can be completely filled and it will break the system.&lt;br /&gt;
&lt;br /&gt;
OpenVZ per-VE disk quota is supported only for ext2/ext3 filesystems. So use one of these filesystems (ext3 is recommended) if you need per-VE disk quota.&lt;br /&gt;
&lt;br /&gt;
=== rpm or yum? ===&lt;br /&gt;
&lt;br /&gt;
In case you have yum utility available on your system, you may want to use it effectively to install and update OpenVZ packages. In case you don't have yum, or don't want to use it, you can use plain old rpm. Instructions for both rpm and yum are provided below.&lt;br /&gt;
&lt;br /&gt;
=== yum pre-setup ===&lt;br /&gt;
If you want to use yum, you should set up OpenVZ yum repository first.&lt;br /&gt;
&lt;br /&gt;
Download [http://download.openvz.org/openvz.repo openvz.repo] file and put it to your &amp;lt;code&amp;gt;/etc/yum.repos.d/&amp;lt;/code&amp;gt; repository. This can be achieved by the following commands, as root:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# cd /etc/yum.repos.d&lt;br /&gt;
# wget http://download.openvz.org/openvz.repo&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you can not cd to /etc/yum.repos.d, it means either yum is not installed on your system, or yum version is too old. In that case, just stick to rpm installation method.&lt;br /&gt;
&lt;br /&gt;
== Kernel installation ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In case you want to recompile the kernel yourself rather than use the one provided by OpenVZ, see [[kernel build]].}}&lt;br /&gt;
&lt;br /&gt;
First, you need to choose what “flavor” of the kernel you want to install. Please refer to [[Kernel flavors]] for more information.&lt;br /&gt;
&lt;br /&gt;
=== Using yum ===&lt;br /&gt;
Run the following command&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# yum install ovzkernel[-flavor]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;[-flavor]&amp;lt;/code&amp;gt; is optional, and can be &amp;lt;code&amp;gt;-smp&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-enterprise&amp;lt;/code&amp;gt;. Refer to [[kernel flavors]] for more info.&lt;br /&gt;
&lt;br /&gt;
=== Using rpm ===&lt;br /&gt;
Get the kernel binary RPM from the [http://openvz.org/download/kernel/ Download » Kernel] page, or directly from [http://download.openvz.org/kernel/ download.openvz.org/kernel], or from one of its [[Download mirrors|mirrors]]. You need only one kernel RPM so please [[Kernel flavors|choose the appropriate one]] depending on your hardware.&lt;br /&gt;
&lt;br /&gt;
Next, install the kernel RPM you chose:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -ihv ovzkernel[-flavor]*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here &amp;lt;code&amp;gt;[-flavor]&amp;lt;/code&amp;gt; is optional, and can be &amp;lt;code&amp;gt;-smp&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;-enterprise&amp;lt;/code&amp;gt;. Refer to [[kernel flavors]] for more info.&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;tt&amp;gt;rpm -U&amp;lt;/tt&amp;gt; (where &amp;lt;tt&amp;gt;-U&amp;lt;/tt&amp;gt; stands for ''upgrade'') should '''not''' be used, otherwise all currently installed kernels will be uninstalled.}}&lt;br /&gt;
&lt;br /&gt;
== Configuring the bootloader ==&lt;br /&gt;
&lt;br /&gt;
In case GRUB is used as the boot loader, it will be configured automatically: lines similar to these will be added to the &amp;lt;tt&amp;gt;/boot/grub/grub.conf&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title Fedora Core (2.6.8-022stab029.1)&lt;br /&gt;
       root (hd0,0)&lt;br /&gt;
       kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 quiet rhgb vga=0x31B&lt;br /&gt;
       initrd /initrd-2.6.8-022stab029.1.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Change &amp;lt;tt&amp;gt;Fedora Core&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;OpenVZ&amp;lt;/tt&amp;gt; (just for clarity reasons, so the OpenVZ kernels will not be mixed up with non-OpenVZ ones). Remove extra arguments from the kernel line, leaving only the &amp;lt;tt&amp;gt;root=...&amp;lt;/tt&amp;gt; parameter. The modifed portion of &amp;lt;tt&amp;gt;/etc/grub.conf&amp;lt;/tt&amp;gt; should look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
title OpenVZ (2.6.8-022stab029.1)&lt;br /&gt;
        root (hd0,0)&lt;br /&gt;
        kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5&lt;br /&gt;
        initrd /initrd-2.6.8-022stab029.1.img&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
Please make sure the following steps are performed before rebooting into OpenVZ kernel.&lt;br /&gt;
&lt;br /&gt;
=== sysctl ===&lt;br /&gt;
&lt;br /&gt;
There is a number of kernel parameters that should be set for OpenVZ to work correctly. These parameters are stored in &amp;lt;tt&amp;gt;/etc/sysctl.conf&amp;lt;/tt&amp;gt; file. Here is the relevant part of the file; please edit it accordingly.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# On Hardware Node we generally need&lt;br /&gt;
# packet forwarding enabled and proxy arp disabled&lt;br /&gt;
net.ipv4.ip_forward = 1&lt;br /&gt;
net.ipv4.conf.default.proxy_arp = 0&lt;br /&gt;
# Enables source route verification&lt;br /&gt;
net.ipv4.conf.all.rp_filter = 1&lt;br /&gt;
# Enables the magic-sysrq key&lt;br /&gt;
kernel.sysrq = 1&lt;br /&gt;
# TCP Explict Congestion Notification&lt;br /&gt;
#net.ipv4.tcp_ecn = 0&lt;br /&gt;
# we do not want all our interfaces to send redirects&lt;br /&gt;
net.ipv4.conf.default.send_redirects = 1&lt;br /&gt;
net.ipv4.conf.all.send_redirects = 0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== SELinux ===&lt;br /&gt;
&lt;br /&gt;
SELinux should be disabled. To that effect, put the following line to &amp;lt;code&amp;gt;/etc/sysconfig/selinux&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SELINUX=disabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Conntracks ===&lt;br /&gt;
&lt;br /&gt;
In the stable OpenVZ kernels (those that are 2.6.8-based) netfilter connection tracking for [[VE0]] is disabled by default. If you have a stateful firewall enabled on the host node (it is there by default) you should either disable it, or enable connection tracking for [[VE0]].&lt;br /&gt;
&lt;br /&gt;
To enable conntracks for VE0, add the following line to &amp;lt;code&amp;gt;/etc/modprobe.conf&amp;lt;/code&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
options ip_conntrack ip_conntrack_enable_ve0=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|In kernels later than 2.6.8, connection tracking is enabled by default.}}&lt;br /&gt;
&lt;br /&gt;
== Rebooting into OpenVZ kernel ==&lt;br /&gt;
&lt;br /&gt;
Now reboot the machine and choose &amp;quot;OpenVZ&amp;quot; on the boot loader menu. If the OpenVZ kernel has been booted successfully, proceed to installing the user-level tools for OpenVZ.&lt;br /&gt;
&lt;br /&gt;
== Installing the utilities ==&lt;br /&gt;
&lt;br /&gt;
OpenVZ needs some user-level tools installed. Those are:&lt;br /&gt;
&lt;br /&gt;
; vzctl&lt;br /&gt;
:    A utility to control OpenVZ VPSs (create, destroy, start, stop, set parameters etc.)&lt;br /&gt;
; vzquota&lt;br /&gt;
:    A utility to manage quotas for VPSs. Mostly used indirectly (by vzctl).&lt;br /&gt;
&lt;br /&gt;
=== Using yum ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# yum install vzctl vzquota&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using rpm ===&lt;br /&gt;
&lt;br /&gt;
Download the binary RPMs of these utilities from [http://openvz.org/download/utils/ Download » Utils], or directly from [http://download.openvz.org/utils/ download.openvz.org/utils], or from one of its [[Download mirrors|mirrors]]. Install them:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# rpm -Uhv vzctl*.rpm vzquota*.rpm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If rpm complains about unresolved dependencies, you'll have to satisfy them first, then repeat the installation.&lt;br /&gt;
&lt;br /&gt;
When all the tools are installed, start the OpenVZ subsystem.&lt;br /&gt;
&lt;br /&gt;
== Starting OpenVZ ==&lt;br /&gt;
&lt;br /&gt;
As root, execute the following command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# /sbin/service vz start&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will load all the needed OpenVZ kernel modules. This script should also start all the VPSs marked to be auto-started on machine boot (there aren't any yet).&lt;br /&gt;
&lt;br /&gt;
During the next reboot, this script should be executed automatically.&lt;br /&gt;
&lt;br /&gt;
== Next steps ==&lt;br /&gt;
&lt;br /&gt;
OpenVZ is now set up on your machine. To load OpenVZ kernel by default, edit the default line in the /boot/grub/grub.conf file to point to the OpenVZ kernel. For example, if the OpenVZ kernel is the first kernel mentioned in the file, put it as default 0. See man grub.conf for more details.&lt;br /&gt;
&lt;br /&gt;
The next step is to prepare the [[OS template]]: please continue to [[OS template cache preparation]] document.&lt;br /&gt;
&lt;br /&gt;
[[Category: Installation]]&lt;br /&gt;
[[Category: HOWTO]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Using_NAT_for_container_with_private_IPs&amp;diff=2494</id>
		<title>Talk:Using NAT for container with private IPs</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Using_NAT_for_container_with_private_IPs&amp;diff=2494"/>
		<updated>2006-11-13T03:26:04Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Using_NAT_for_container_with_private_IPs&amp;diff=2493</id>
		<title>Using NAT for container with private IPs</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Using_NAT_for_container_with_private_IPs&amp;diff=2493"/>
		<updated>2006-11-13T03:25:40Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Usually you supply public IP addresses to your VEs. Sometimes you don't want to do it (lack of IPs, etc.). This article describes how to use private IP addresses for VEs.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
IP forwarding should be turned on on hardware node in order for VE networking to work. Make sure it is turned on.&lt;br /&gt;
&lt;br /&gt;
== How to provide access for VE to Internet ==&lt;br /&gt;
&lt;br /&gt;
To enable the [[VE]]s, which have only internal IP addresses, to access the Internet, SNAT (Source Network Address Translation, also known as IP masquerading) should be configured on the [[Hardware Node]]. This is ensured by the standard Linux &amp;lt;tt&amp;gt;iptables&amp;lt;/tt&amp;gt; utility. To perform a simple SNAT setup, execute the following command on the [[Hardware Node]]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# iptables -t nat -A POSTROUTING -s src_net -o eth0 -j SNAT --to ip_address&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;src_net&amp;lt;/tt&amp;gt; is a range of IP addresses of VEs to be translated by SNAT, and &amp;lt;tt&amp;gt;ip_address&amp;lt;/tt&amp;gt; is the external IP address of your [[Hardware Node]]. Multiple rules are allowed, for example, in case you wish to specify several ranges of IP addresses. If you are using a number of physical network interfaces on the [[Hardware Node|Node]], you may need to specify a different interface for outgoing connections, e.g. &amp;lt;tt&amp;gt;-o eth2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
To make all IP addresses to be translated by SNAT (not only the ones of [[VE]]s with private addresses), you should type the following string:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to ip_address&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|If the above is not working then check if one of the following solutions does the trick.}}&lt;br /&gt;
1. If you are using stable (currently 2.6.8-based) kernel, then to enable SNAT for the VEs on your local network you need to explicitly enable connection tracking in [[VE0]]. Make sure that the following string is present in the &amp;lt;tt&amp;gt;/etc/modprobe.conf&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
options ip_conntrack ip_conntrack_enable_ve0=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|in kernels later than 2.6.8, connection tracking is enabled by default}}&lt;br /&gt;
&lt;br /&gt;
In case it is not, add this string to the file by means of any text editor (for example, vi). This setting is not needed for kernels more recent than 2.6.8, since connection tracking for [[VE0]] is enabled by default in those kernels.&lt;br /&gt;
&lt;br /&gt;
2. For unknown reasons the above didn't work on a Debian host. The solution is to do it in an init.d script as follows:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
modprobe ip_conntrack ip_conntrack_enable_ve0=1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make sure that this module is loaded before any of the other iptables-modules are loaded! Also remember that if this module is loaded without the option, unloading and reloading doesn't work! You need to reboot the computer.&lt;br /&gt;
&lt;br /&gt;
{{Note|in kernels later than 2.6.8, connection tracking is enabled by default}}&lt;br /&gt;
&lt;br /&gt;
== How to provide access from Internet to a VE ==&lt;br /&gt;
&lt;br /&gt;
In addition, to make some services in VE with private IP address be accessible from the Internet, DNAT (Destination Network Address Translation) should be configured on the [[Hardware Node]]. To perform a simple DNAT setup, execute the following command on the [[Hardware Node]]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# iptables -t nat -A PREROUTING -p tcp -d ip_address --dport port_num \&lt;br /&gt;
  -i eth0 -j DNAT --to-destination ve_address:dst_port_num &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;tt&amp;gt;ve_address&amp;lt;/tt&amp;gt; is an IP address of the VE, &amp;lt;tt&amp;gt;dst_port_num&amp;lt;/tt&amp;gt; is a tcp port which requires service use, &amp;lt;tt&amp;gt;ip_address&amp;lt;/tt&amp;gt; is the external (public) IP address of your [[Hardware Node]], and &amp;lt;tt&amp;gt;port_num&amp;lt;/tt&amp;gt; is a tcp port of [[Hardware Node]], which will be used for Internet connections to private VE service. Note that this setup makes the service which is using &amp;lt;tt&amp;gt;port_num&amp;lt;/tt&amp;gt; on the [[Hardware Node]] be unaccessible from the Internet. Also note that SNAT translation is required too.&lt;br /&gt;
&lt;br /&gt;
For example, if you need a web server in a VE to be accessible from outside and, at the same time, keep a web server on the [[Hardware Node]] be accessible, use the following config:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# iptables -t nat -A PREROUTING -p tcp -d ip_address --dport 8080 \&lt;br /&gt;
  -i eth0 -j DNAT --to-destination ve_address:80&lt;br /&gt;
# iptables -t nat -A POSTROUTING -s ve_address -o eth0 -j SNAT --to ip_address&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After applying this, you'll see VE' web server at &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;http://ip_address:8080/&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;iptables&amp;lt;/tt&amp;gt; utility allows to set up more complex rules for Network Address Translation, involving various protocols and ports. If you wish to get more information on this, consult the numerous Internet sites (e.g. [http://www.netfilter.org netfilter.org]) and tutorials devoted to this issue.&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
* [http://www.netfilter.org netfilter.org]&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Networking]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Shared_webhosting&amp;diff=2492</id>
		<title>Shared webhosting</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Shared_webhosting&amp;diff=2492"/>
		<updated>2006-11-13T02:45:17Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* The problem */  Grammar fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{roughstub}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The problem ==&lt;br /&gt;
&lt;br /&gt;
One of the problems with shared webhosting (i.e. different people with each his/her own webpages) is that modern script languages such as PHP, Python, or Perl are too powerful. For example take the following PHP script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
function get_content($filename) {&lt;br /&gt;
  $handle = fopen($filename, 'r');&lt;br /&gt;
  echo fread($handle, filesize($filename));&lt;br /&gt;
  fclose($handle);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
get_content('/home/ppuk34/www/forum/config.inc.php');&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With PHP you could use open_basedir to prevent this, but there are more ways. For example [http://mgeisler.net/php-shell/ PHP Shell], a script that is [http://mgeisler.net/downloads/phpshell/SECURITY often mis-used] by people with not-so-good intentions. Or think about the [http://www.f-secure.com/v-descs/santy_a.shtml Santy-worm] which mis-used phpBB. Again there is a solution in the form of safe_mode, but lots of PHP scripts break if you enable this. For Python, Perl, or CGI-scripts there are no easy ways and you have to use wrappers or other tricks to chroot these.&lt;br /&gt;
&lt;br /&gt;
== The solution ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Shared hosting1.png|345px|right|The OpenVZ way of shared webhosting]]&lt;br /&gt;
&lt;br /&gt;
You can waste hours of time in securing all the possible things you don't want in your shared webhosting environment. And unless you are very familiar with all the things modern scripting languages can do, you probably miss dozens of alternative routes. In this process you frustrate your clients, because security always means that legitimate things break. As a side effect of your hard work, you can waste hours of extra time in educating your users. But in the end most users don't care about security, unless they are themselves victims of a compromised host. Learning the hard way is by far the most effective method. One possible solution is dedicated webhosting, but most users don't have the experience to maintain a server or it is way to expensive for them.&lt;br /&gt;
&lt;br /&gt;
The main problem with shared webhosting is that by its very nature all files which are served through the web are public. Apache for example uses only one account to read all files. As said, you can use tricks with CGI wrappers to execute the scripting languages under its own credentials. However this kind of security depends on the wrappers ability to securely separate the users. We all know that if this is broken &amp;amp;mdash; and most often it will be broken &amp;amp;mdash; the result is a higher clearance on the underlying filesystem. For most systems you need more than one wrapper, so the number of possible security problems grow. The ultimate user separation is in the kernel and you can view the modifications OpenVZ has done in this light. Instead of CGI wrappers we go one step higher and give every user its own minimal server. In the rest of this article we describe how shared webhosting with OpenVZ could be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Minimal server ===&lt;br /&gt;
&lt;br /&gt;
Create an VEx with your favorite distro. Give it an internal IP-address in one of the ranges 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16. Then strip away all unnecessary init.d scripts so only the bare minimum is started. That means as a minimum syslogd and ssh so the account holder can upload his/her files through SCP/SFTP in his/her own minimal server. For this to work you need to set up [[Using NAT for VE with private IPs|destination NAT on VE0]] from high numbered ports to port 22 on the given private IP address:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dnat=&amp;quot;-j DNAT --to-destination&amp;quot;&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -P PREROUTING ACCEPT&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10122 $dnat 192.168.13.101:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10222 $dnat 192.168.13.102:22&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other thing you want for webhosting is of course a webserver as well. To minimize the amount of needed memory, we choose [http://www.lighttpd.net/ Lighttpd] instead of the common Apache. Then configure the scripting language of your choice to run under this webserver. It is possible to use different languages/setups for different accounts as well. Also problematic CGI-scripts are not problematic anymore...&lt;br /&gt;
&lt;br /&gt;
=== MySQL server ===&lt;br /&gt;
&lt;br /&gt;
Most webhosting accounts use MySQL, but if you prefer another database server, go ahead. Create a new VEx with a lot more resources and again an internal IP-address. Now configure the accounts. As an extra security measure you can use the internal IP-address as well.&lt;br /&gt;
&lt;br /&gt;
=== Proxy webserver ===&lt;br /&gt;
&lt;br /&gt;
Because we have only one public IP-address, we need an trick to access every minimal server based on the hostname in the HTTP request. For SSH we used different ports, but that is not an option for websites. Again we create an VEx with an internal IP-address. On this server we install Lighttpd as well, because the proxying is very simple. If someone has an working example with Apache, please add. First we must forward port 80 to this server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dnat=&amp;quot;-j DNAT --to-destination&amp;quot;&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -P PREROUTING ACCEPT&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP -d &amp;amp;lt;external IP-address&amp;gt; --dport 80 $dnat 192.168.13.11:80&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10122 $dnat 192.168.13.101:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10222 $dnat 192.168.13.102:22&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we create for every website an section in /etc/lighttpd/lighttpd.conf as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$HTTP[&amp;quot;host&amp;quot;] == &amp;quot;ve101.armorica.tk&amp;quot; {&lt;br /&gt;
  proxy.server  = ( &amp;quot;&amp;quot; =&amp;gt; ( ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;192.168.13.101&amp;quot; ) ) )&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can map more names to the same IP-address if needed. The last step is to add mod_proxy to the server.modules section.&lt;br /&gt;
&lt;br /&gt;
=== Other applications ===&lt;br /&gt;
&lt;br /&gt;
Create for other applications as mail, make sure that the minimal servers use this one for sending mail from webpages, DNS etc. VEx as needed. The resulting server is shown in the figure above.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Shared_webhosting&amp;diff=2491</id>
		<title>Shared webhosting</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Shared_webhosting&amp;diff=2491"/>
		<updated>2006-11-13T02:44:20Z</updated>

		<summary type="html">&lt;p&gt;Dusty: Spelling fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{roughstub}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The problem ==&lt;br /&gt;
&lt;br /&gt;
One of the problems with shared webhosting (i.e. different people with each his/her own webpages) is that modern script languages such as PHP, Python or Perl are to powerful. For example take the following PHP script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
function get_content($filename) {&lt;br /&gt;
  $handle = fopen($filename, 'r');&lt;br /&gt;
  echo fread($handle, filesize($filename));&lt;br /&gt;
  fclose($handle);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
get_content('/home/ppuk34/www/forum/config.inc.php');&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With PHP you could use open_basedir to prevent this, but there are more ways. For example [http://mgeisler.net/php-shell/ PHP Shell], a script that is [http://mgeisler.net/downloads/phpshell/SECURITY often mis-used] by people with not-so-good intentions. Or think about the [http://www.f-secure.com/v-descs/santy_a.shtml Santy-worm] which mis-used phpBB. Again there is a solution in the form of safe_mode, but lots of PHP scripts break if you enable this. For Python, Perl or CGI-scripts there are no easy ways and you have to use wrappers or other tricks to chroot these.&lt;br /&gt;
&lt;br /&gt;
== The solution ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Shared hosting1.png|345px|right|The OpenVZ way of shared webhosting]]&lt;br /&gt;
&lt;br /&gt;
You can waste hours of time in securing all the possible things you don't want in your shared webhosting environment. And unless you are very familiar with all the things modern scripting languages can do, you probably miss dozens of alternative routes. In this process you frustrate your clients, because security always means that legitimate things break. As a side effect of your hard work, you can waste hours of extra time in educating your users. But in the end most users don't care about security, unless they are themselves victims of a compromised host. Learning the hard way is by far the most effective method. One possible solution is dedicated webhosting, but most users don't have the experience to maintain a server or it is way to expensive for them.&lt;br /&gt;
&lt;br /&gt;
The main problem with shared webhosting is that by its very nature all files which are served through the web are public. Apache for example uses only one account to read all files. As said, you can use tricks with CGI wrappers to execute the scripting languages under its own credentials. However this kind of security depends on the wrappers ability to securely separate the users. We all know that if this is broken &amp;amp;mdash; and most often it will be broken &amp;amp;mdash; the result is a higher clearance on the underlying filesystem. For most systems you need more than one wrapper, so the number of possible security problems grow. The ultimate user separation is in the kernel and you can view the modifications OpenVZ has done in this light. Instead of CGI wrappers we go one step higher and give every user its own minimal server. In the rest of this article we describe how shared webhosting with OpenVZ could be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Minimal server ===&lt;br /&gt;
&lt;br /&gt;
Create an VEx with your favorite distro. Give it an internal IP-address in one of the ranges 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16. Then strip away all unnecessary init.d scripts so only the bare minimum is started. That means as a minimum syslogd and ssh so the account holder can upload his/her files through SCP/SFTP in his/her own minimal server. For this to work you need to set up [[Using NAT for VE with private IPs|destination NAT on VE0]] from high numbered ports to port 22 on the given private IP address:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dnat=&amp;quot;-j DNAT --to-destination&amp;quot;&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -P PREROUTING ACCEPT&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10122 $dnat 192.168.13.101:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10222 $dnat 192.168.13.102:22&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other thing you want for webhosting is of course a webserver as well. To minimize the amount of needed memory, we choose [http://www.lighttpd.net/ Lighttpd] instead of the common Apache. Then configure the scripting language of your choice to run under this webserver. It is possible to use different languages/setups for different accounts as well. Also problematic CGI-scripts are not problematic anymore...&lt;br /&gt;
&lt;br /&gt;
=== MySQL server ===&lt;br /&gt;
&lt;br /&gt;
Most webhosting accounts use MySQL, but if you prefer another database server, go ahead. Create a new VEx with a lot more resources and again an internal IP-address. Now configure the accounts. As an extra security measure you can use the internal IP-address as well.&lt;br /&gt;
&lt;br /&gt;
=== Proxy webserver ===&lt;br /&gt;
&lt;br /&gt;
Because we have only one public IP-address, we need an trick to access every minimal server based on the hostname in the HTTP request. For SSH we used different ports, but that is not an option for websites. Again we create an VEx with an internal IP-address. On this server we install Lighttpd as well, because the proxying is very simple. If someone has an working example with Apache, please add. First we must forward port 80 to this server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dnat=&amp;quot;-j DNAT --to-destination&amp;quot;&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -P PREROUTING ACCEPT&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP -d &amp;amp;lt;external IP-address&amp;gt; --dport 80 $dnat 192.168.13.11:80&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10122 $dnat 192.168.13.101:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10222 $dnat 192.168.13.102:22&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we create for every website an section in /etc/lighttpd/lighttpd.conf as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$HTTP[&amp;quot;host&amp;quot;] == &amp;quot;ve101.armorica.tk&amp;quot; {&lt;br /&gt;
  proxy.server  = ( &amp;quot;&amp;quot; =&amp;gt; ( ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;192.168.13.101&amp;quot; ) ) )&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can map more names to the same IP-address if needed. The last step is to add mod_proxy to the server.modules section.&lt;br /&gt;
&lt;br /&gt;
=== Other applications ===&lt;br /&gt;
&lt;br /&gt;
Create for other applications as mail, make sure that the minimal servers use this one for sending mail from webpages, DNS etc. VEx as needed. The resulting server is shown in the figure above.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Shared_webhosting&amp;diff=2490</id>
		<title>Shared webhosting</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Shared_webhosting&amp;diff=2490"/>
		<updated>2006-11-13T02:43:26Z</updated>

		<summary type="html">&lt;p&gt;Dusty: /* The solution */ Spelling fixes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{roughstub}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The problem ==&lt;br /&gt;
&lt;br /&gt;
One of the problems with shared webhosting (i.e. different people with each his/her own webpages) is that modern script languages such as PHP, Python or Perl are to powerfull. For example take the following PHP script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
&lt;br /&gt;
function get_content($filename) {&lt;br /&gt;
  $handle = fopen($filename, 'r');&lt;br /&gt;
  echo fread($handle, filesize($filename));&lt;br /&gt;
  fclose($handle);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
get_content('/home/ppuk34/www/forum/config.inc.php');&lt;br /&gt;
&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With PHP you could use open_basedir to prevent this, but there are more ways. For example [http://mgeisler.net/php-shell/ PHP Shell], a script that is [http://mgeisler.net/downloads/phpshell/SECURITY often mis-used] by people with not-so-good intentions. Or think about the [http://www.f-secure.com/v-descs/santy_a.shtml Santy-worm] which mis-used phpBB. Again there is a solution in the form of safe_mode, but lots of PHP scripts break if you enable this. For Python, Perl or CGI-scripts there are no easy ways and you have to use wrappers or other tricks to chroot these.&lt;br /&gt;
&lt;br /&gt;
== The solution ==&lt;br /&gt;
&lt;br /&gt;
[[Image:Shared hosting1.png|345px|right|The OpenVZ way of shared webhosting]]&lt;br /&gt;
&lt;br /&gt;
You can waste hours of time in securing all the possible things you don't want in your shared webhosting environment. And unless you are very familiar with all the things modern scripting languages can do, you probably miss dozens of alternative routes. In this process you frustrate your clients, because security always means that legitimate things break. As a side effect of your hard work, you can waste hours of extra time in educating your users. But in the end most users don't care about security, unless they are themselves victims of a compromised host. Learning the hard way is by far the most effective method. One possible solution is dedicated webhosting, but most users don't have the experience to maintain a server or it is way to expensive for them.&lt;br /&gt;
&lt;br /&gt;
The main problem with shared webhosting is that by its very nature all files which are served through the web are public. Apache for example uses only one account to read all files. As said, you can use tricks with CGI wrappers to execute the scripting languages under its own credentials. However this kind of security depends on the wrappers ability to securely separate the users. We all know that if this is broken &amp;amp;mdash; and most often it will be broken &amp;amp;mdash; the result is a higher clearance on the underlying filesystem. For most systems you need more than one wrapper, so the number of possible security problems grow. The ultimate user separation is in the kernel and you can view the modifications OpenVZ has done in this light. Instead of CGI wrappers we go one step higher and give every user its own minimal server. In the rest of this article we describe how shared webhosting with OpenVZ could be implemented.&lt;br /&gt;
&lt;br /&gt;
=== Minimal server ===&lt;br /&gt;
&lt;br /&gt;
Create an VEx with your favorite distro. Give it an internal IP-address in one of the ranges 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16. Then strip away all unnecessary init.d scripts so only the bare minimum is started. That means as a minimum syslogd and ssh so the account holder can upload his/her files through SCP/SFTP in his/her own minimal server. For this to work you need to set up [[Using NAT for VE with private IPs|destination NAT on VE0]] from high numbered ports to port 22 on the given private IP address:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dnat=&amp;quot;-j DNAT --to-destination&amp;quot;&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -P PREROUTING ACCEPT&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10122 $dnat 192.168.13.101:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10222 $dnat 192.168.13.102:22&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The other thing you want for webhosting is of course a webserver as well. To minimize the amount of needed memory, we choose [http://www.lighttpd.net/ Lighttpd] instead of the common Apache. Then configure the scripting language of your choice to run under this webserver. It is possible to use different languages/setups for different accounts as well. Also problematic CGI-scripts are not problematic anymore...&lt;br /&gt;
&lt;br /&gt;
=== MySQL server ===&lt;br /&gt;
&lt;br /&gt;
Most webhosting accounts use MySQL, but if you prefer another database server, go ahead. Create a new VEx with a lot more resources and again an internal IP-address. Now configure the accounts. As an extra security measure you can use the internal IP-address as well.&lt;br /&gt;
&lt;br /&gt;
=== Proxy webserver ===&lt;br /&gt;
&lt;br /&gt;
Because we have only one public IP-address, we need an trick to access every minimal server based on the hostname in the HTTP request. For SSH we used different ports, but that is not an option for websites. Again we create an VEx with an internal IP-address. On this server we install Lighttpd as well, because the proxying is very simple. If someone has an working example with Apache, please add. First we must forward port 80 to this server:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dnat=&amp;quot;-j DNAT --to-destination&amp;quot;&lt;br /&gt;
&lt;br /&gt;
iptables -t nat -P PREROUTING ACCEPT&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP -d &amp;amp;lt;external IP-address&amp;gt; --dport 80 $dnat 192.168.13.11:80&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10122 $dnat 192.168.13.101:22&lt;br /&gt;
iptables -t nat -A PREROUTING -p TCP --dport 10222 $dnat 192.168.13.102:22&lt;br /&gt;
...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then we create for every website an section in /etc/lighttpd/lighttpd.conf as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$HTTP[&amp;quot;host&amp;quot;] == &amp;quot;ve101.armorica.tk&amp;quot; {&lt;br /&gt;
  proxy.server  = ( &amp;quot;&amp;quot; =&amp;gt; ( ( &amp;quot;host&amp;quot; =&amp;gt; &amp;quot;192.168.13.101&amp;quot; ) ) )&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can map more names to the same IP-address if needed. The last step is to add mod_proxy to the server.modules section.&lt;br /&gt;
&lt;br /&gt;
=== Other applications ===&lt;br /&gt;
&lt;br /&gt;
Create for other applications as mail, make sure that the minimal servers use this one for sending mail from webpages, DNS etc. VEx as needed. The resulting server is shown in the figure above.&lt;br /&gt;
&lt;br /&gt;
[[Category:HOWTO]]&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Talk:Using_NAT_for_container_with_private_IPs&amp;diff=2489</id>
		<title>Talk:Using NAT for container with private IPs</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Talk:Using_NAT_for_container_with_private_IPs&amp;diff=2489"/>
		<updated>2006-11-13T02:38:12Z</updated>

		<summary type="html">&lt;p&gt;Dusty: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There is a mention of &amp;quot;ip_conntrack_enable_ve0&amp;quot; here.  I know the new kernels (&amp;gt;= 2.6.15) are using &amp;quot;ip_conntrack_disable_ve0&amp;quot; instead and having it connnection tracking enabled by default.  This document should probably be updated to state whatever necessary instructions differences for those new kernel versions.  I'd do it, but I'm not confident in my precise knowledge of the issue.  Thanks!  --[[User:Dusty|Dusty]] 21:38, 12 November 2006 (EST)&lt;/div&gt;</summary>
		<author><name>Dusty</name></author>
		
	</entry>
</feed>