<?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=Sawtooth</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=Sawtooth"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Sawtooth"/>
	<updated>2026-06-13T16:33:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Installation_on_Debian/old&amp;diff=6057</id>
		<title>Installation on Debian/old</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Installation_on_Debian/old&amp;diff=6057"/>
		<updated>2008-06-07T14:49:59Z</updated>

		<summary type="html">&lt;p&gt;Sawtooth: /* Repository setup */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OpenVZ consists of a kernel, user-level tools, and container templates.&lt;br /&gt;
&lt;br /&gt;
This guide tells how to install the kernel and the tools on [http://www.debian.org Debian] stable. &lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
=== Filesystems ===&lt;br /&gt;
It is recommended to use a separate partition for container private&lt;br /&gt;
directories (by default &amp;lt;code&amp;gt;/var/lib/vz/private/&amp;lt;CTID&amp;gt;&amp;lt;/code&amp;gt;). The reason why you should do so is that if you wish to use OpenVZ per-container disk quota, you won't be able to use usual Linux disk quotas on the same partition. Bear in mind that per-container quota in this context includes not only pure per-container quota but also usual Linux disk quota used in container, not on [[HN]].&lt;br /&gt;
&lt;br /&gt;
At least try to avoid using root partition for containers because the root user of container will be able to overcome the 5% disk space barrier in some situations. If the  HN root partition is completely filled, it will break the system.&lt;br /&gt;
&lt;br /&gt;
OpenVZ per-container disk quota is supported only for ext2/ext3 filesystems so use one of these filesystems (ext3 is recommended) if you need per-container disk quota.&lt;br /&gt;
&lt;br /&gt;
=== Repository setup ===&lt;br /&gt;
&lt;br /&gt;
At the moment two different repositories are online at http://download.openvz.org:&lt;br /&gt;
&lt;br /&gt;
; by Ola Lundqvist &amp;lt;opal@debian.org&amp;gt;&lt;br /&gt;
: (OpenVZ kernels only)&lt;br /&gt;
: apt-uri http://download.openvz.org/debian&lt;br /&gt;
&lt;br /&gt;
; by Thorsten Schifferdecker &amp;lt;tsd@debian.systs.org&amp;gt;&lt;br /&gt;
: apt-uri http://download.openvz.org/debian-systs&lt;br /&gt;
: (Mirror of OpenVZ Repository from http://debian.systs.org/)&lt;br /&gt;
&lt;br /&gt;
{{Note|The next steps use the repository at http://download.openvz.org/debian-systs; the actual OpenVZ Tools for Debian exist only as unstable builds, see http://packages.debian.org/vzctl}}&lt;br /&gt;
&lt;br /&gt;
{{Note|By default, on Ubuntu systems root tasks are executed with [https://help.ubuntu.com/community/RootSudo sudo]}}&lt;br /&gt;
&lt;br /&gt;
This can be achieved by the following commands, as root or as privileged &amp;quot;sudo&amp;quot; user&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo -e &amp;quot;\ndeb http://download.openvz.org/debian-systs etch openvz&amp;quot; &amp;gt;&amp;gt; /etc/apt/sources.list&lt;br /&gt;
# wget -q http://download.openvz.org/debian-systs/dso_archiv_signing_key.asc -O- | apt-key add - &amp;amp;&amp;amp; apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There is even an '''lenny''' repository with kernel 2.6.24. '''Use it at your own risk!'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# echo -e &amp;quot;\ndeb http://download.openvz.org/debian-systs lenny openvz&amp;quot; &amp;gt;&amp;gt; /etc/apt/sources.list&lt;br /&gt;
# wget -q http://download.openvz.org/debian-systs/dso_archiv_signing_key.asc -O- | apt-key add - &amp;amp;&amp;amp; apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Kernel installation ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In case you want to recompile the OpenVZ kernel yourself on Debian, see [[Compiling the OpenVZ kernel (the Debian way)]].}}&lt;br /&gt;
&lt;br /&gt;
First, you need to choose what kernel you want to install.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+'''OpenVZ Kernel list built with kernel config from http://download.openvz.org'''&lt;br /&gt;
! Kernel !! Description !! Hardware !! Debian Architecture&lt;br /&gt;
|-&lt;br /&gt;
! ovzkernel-2.6.18&lt;br /&gt;
| uniprocessor&lt;br /&gt;
| up to 4GB of RAM&lt;br /&gt;
| i386 and amd64&lt;br /&gt;
|-&lt;br /&gt;
! ovzkernel-2.6.18-smp&lt;br /&gt;
| symmetric multiprocessor&lt;br /&gt;
| up to 4 GB of RAM&lt;br /&gt;
| i386 and amd64&lt;br /&gt;
|-&lt;br /&gt;
! ovzkernel-2.6.18-enterprise&lt;br /&gt;
| SMP + PAE support + 4/4GB split&lt;br /&gt;
| up to 64 GB of RAM&lt;br /&gt;
| i386 only&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|+'''OpenVZ Kernel list built with official Debian kernel config and OpenVZ Settings'''&lt;br /&gt;
! Kernel !! Description !! Hardware !! Debian Architecture&lt;br /&gt;
|-&lt;br /&gt;
! fzakernel-2.6.18-686&lt;br /&gt;
| uni- and multiprocessor&lt;br /&gt;
| up to 4GB of RAM&lt;br /&gt;
| i386&lt;br /&gt;
|-&lt;br /&gt;
! fzakernel-2.6.18-686-bigmem&lt;br /&gt;
| symmetric multiprocessor&lt;br /&gt;
| up to 64 GB of RAM&lt;br /&gt;
| i386&lt;br /&gt;
|-&lt;br /&gt;
! fzakernel-2.6.18-amd64&lt;br /&gt;
| uni- and multiprocessor&lt;br /&gt;
| &lt;br /&gt;
| amd64&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # apt-get install &amp;lt;kernel&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&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, or execute update-grub; lines similar to these will be added to the &amp;lt;tt&amp;gt;/boot/grub/menu.lst&amp;lt;/tt&amp;gt; file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
  title           Debian GNU/Linux, kernel 2.6.18-ovz-028stab051.1-686&lt;br /&gt;
  root            (hd0,1)&lt;br /&gt;
  kernel          /vmlinuz-2.6.18-ovz-028stab051.1-686 root=/dev/sda5 ro vga=791&lt;br /&gt;
  initrd          /initrd.img-2.6.18-ovz-028stab051.1-686&lt;br /&gt;
  savedefault&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Note|per default on debian/ubuntu, a 2.6.22 kernel will boot before a 2.6.18, please check manually the grub boot order. See man update-grub for more details}}&lt;br /&gt;
&lt;br /&gt;
=== Rebooting into OpenVZ kernel ===&lt;br /&gt;
&lt;br /&gt;
{{Warning|Before you restart your Server, keep in mind, that your system has all needed modules enabled; booting from your harddisk (e.g. hardware modules, raid system(s), lvm2 etc). May you need a INITRD (initramdisk) or compile needed kernel modules statically in.}}&lt;br /&gt;
&lt;br /&gt;
Now reboot the machine and choose the OpenVZ Linux Kernel 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 user-level tools ==&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 containers (create, destroy, start, stop, set parameters etc.)&lt;br /&gt;
; vzquota&lt;br /&gt;
: A utility to manage quotas for containers. Mostly used indirectly (by vzctl).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 # [sudo] apt-get install vzctl vzquota&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Configuring ==&lt;br /&gt;
&lt;br /&gt;
=== sysctl ===&lt;br /&gt;
&lt;br /&gt;
There are 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;
{{Note|vzctl version from debian-systs, automate changing sysctl options for openvz}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[...]&lt;br /&gt;
&lt;br /&gt;
# On Hardware Node we generally need&lt;br /&gt;
# packet forwarding enabled and proxy arp disabled&lt;br /&gt;
&lt;br /&gt;
net.ipv4.conf.default.forwarding=1&lt;br /&gt;
net.ipv4.conf.default.proxy_arp = 0&lt;br /&gt;
net.ipv4.ip_forward=1&lt;br /&gt;
&lt;br /&gt;
# Enables source route verification&lt;br /&gt;
net.ipv4.conf.all.rp_filter = 1&lt;br /&gt;
&lt;br /&gt;
# Enables the magic-sysrq key&lt;br /&gt;
kernel.sysrq = 1&lt;br /&gt;
&lt;br /&gt;
# TCP Explict Congestion Notification&lt;br /&gt;
#net.ipv4.tcp_ecn = 0&lt;br /&gt;
&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;
&lt;br /&gt;
[...]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  # [sudo] sysctl -p&lt;br /&gt;
&lt;br /&gt;
{{Note|You can make a symlink from /var/lib/vz to /vz as backward&lt;br /&gt;
compatibility to OpenVZ as installed in other distributions&lt;br /&gt;
(Debian vz root directory is /var/lib/vz to be FHS-compliant.}}&lt;br /&gt;
&lt;br /&gt;
  # [sudo] ln -s /var/lib/vz /vz &lt;br /&gt;
&lt;br /&gt;
=== OS templates ===&lt;br /&gt;
&lt;br /&gt;
To install a container, you need OS template(s).&lt;br /&gt;
&lt;br /&gt;
Precreated templates can be found [http://download.openvz.org/contrib/template/precreated/ here].&lt;br /&gt;
&lt;br /&gt;
You can create your own templates, see &lt;br /&gt;
[[Debian template creation]], [[Ubuntu Gutsy template creation] and [[Category:Templates]].&lt;br /&gt;
&lt;br /&gt;
{{Note|Setup your prefered standard OS Template : edit the /etc/vz/vz.conf}}&lt;br /&gt;
&lt;br /&gt;
  # [sudo] apt-get install vzctl-ostmpl-debian&lt;br /&gt;
&lt;br /&gt;
== Additional User Tools ==&lt;br /&gt;
&lt;br /&gt;
; vzprocps&lt;br /&gt;
:    A set of utilities to provide system information (vzps and vztop)&lt;br /&gt;
&lt;br /&gt;
; [[vzdump]]&lt;br /&gt;
:    A utility to backup and restore container. &lt;br /&gt;
&lt;br /&gt;
  # [sudo] apt-get install vzprocps vzdump&lt;br /&gt;
&lt;br /&gt;
== Use it! ==&lt;br /&gt;
&lt;br /&gt;
After installing the OpenVZ kernel, user tools and a minimal OS template&lt;br /&gt;
to create a first container and do some&lt;br /&gt;
[[basic operations in OpenVZ environment]]. Read the [[download:doc/OpenVZ-Users-Guide.pdf]], browse this wiki.&lt;br /&gt;
&lt;br /&gt;
== SECURE IT ! ==&lt;br /&gt;
&lt;br /&gt;
Now comes a small advice from someone who got his debian 4.0 container hacked by some script kiddies with a ssh brute-force method within a day after deployment. I believed naively that iptables was active on boot of the container as I had used webmin inside the VE to activate iptables on boot. &lt;br /&gt;
&lt;br /&gt;
That is not so! Although webmin shows that iptables (Linux Firewall) is active on boot, it is not. You need to make a startup script for iptables as described further down. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now see what rules are already configured. Issue this command inside your container:&lt;br /&gt;
&lt;br /&gt;
 iptables -L&lt;br /&gt;
&lt;br /&gt;
The output will be similar to this:&lt;br /&gt;
&lt;br /&gt;
 Chain INPUT (policy ACCEPT)&lt;br /&gt;
 target     prot opt source               destination&lt;br /&gt;
 Chain FORWARD (policy ACCEPT)&lt;br /&gt;
 target     prot opt source               destination&lt;br /&gt;
 Chain OUTPUT (policy ACCEPT)&lt;br /&gt;
 target     prot opt source               destination&lt;br /&gt;
&lt;br /&gt;
This allows anyone access to anything from anywhere.&lt;br /&gt;
&lt;br /&gt;
=== New iptables rules ===&lt;br /&gt;
&lt;br /&gt;
Let's tighten that up a bit by creating a test iptables file:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/iptables.test.rules&lt;br /&gt;
&lt;br /&gt;
In this file enter some basic rules:&lt;br /&gt;
&lt;br /&gt;
 *filter&lt;br /&gt;
&lt;br /&gt;
 # Allows all loopback (lo0) traffic and drop all traffic to 127/8 that doesn't use lo0&lt;br /&gt;
 -A INPUT -i lo -j ACCEPT&lt;br /&gt;
 -A INPUT -i ! lo -d 127.0.0.0/8 -j REJECT&lt;br /&gt;
&lt;br /&gt;
 # Accepts all established inbound connections&lt;br /&gt;
 -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br /&gt;
&lt;br /&gt;
 # Allows all outbound traffic&lt;br /&gt;
 # You could modify this to only allow certain traffic&lt;br /&gt;
 -A OUTPUT -j ACCEPT&lt;br /&gt;
&lt;br /&gt;
 # Allows HTTP and HTTPS connections from anywhere (the normal ports for websites)&lt;br /&gt;
 -A INPUT -p tcp --dport 80 -j ACCEPT&lt;br /&gt;
 -A INPUT -p tcp --dport 443 -j ACCEPT&lt;br /&gt;
&lt;br /&gt;
 # Allows SSH connections for script kiddies&lt;br /&gt;
 # THE -dport NUMBER IS THE SAME ONE YOU SET UP IN THE SSHD_CONFIG FILE&lt;br /&gt;
 -A INPUT -p tcp -m state --state NEW --dport 30000 -j ACCEPT&lt;br /&gt;
&lt;br /&gt;
 # Now you should read up on iptables rules and consider whether ssh access &lt;br /&gt;
 # for everyone is really desired. Most likely you will only allow access from certain IPs.&lt;br /&gt;
&lt;br /&gt;
 # Allow ping&lt;br /&gt;
 -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT&lt;br /&gt;
&lt;br /&gt;
 # log iptables denied calls (access via 'dmesg' command)&lt;br /&gt;
 -A INPUT -m limit --limit 5/min -j LOG --log-prefix &amp;quot;iptables denied: &amp;quot; --log-level 7&lt;br /&gt;
&lt;br /&gt;
 # Reject all other inbound - default deny unless explicitly allowed policy:&lt;br /&gt;
 -A INPUT -j REJECT&lt;br /&gt;
 -A FORWARD -j REJECT&lt;br /&gt;
&lt;br /&gt;
 COMMIT&lt;br /&gt;
&lt;br /&gt;
That may look complicated, but look at each section at a time. You will see that it simply shuts all ports except the ones we have allowed - which in this case are ports 80 and 443 (the standard web browser ports) and the SSH port defined earlier.&lt;br /&gt;
&lt;br /&gt;
Activate these new rules:&lt;br /&gt;
&lt;br /&gt;
 iptables-restore &amp;lt; /etc/iptables.test.rules&lt;br /&gt;
&lt;br /&gt;
And see the difference:&lt;br /&gt;
&lt;br /&gt;
 iptables -L&lt;br /&gt;
&lt;br /&gt;
Now the output tells us that only the ports defined above are open. All the others are closed.&lt;br /&gt;
&lt;br /&gt;
Once you are happy, save the new rules to the master iptables file:&lt;br /&gt;
&lt;br /&gt;
 iptables-save &amp;gt; /etc/iptables.up.rules&lt;br /&gt;
&lt;br /&gt;
To make sure the iptables rules are started on a reboot we'll create a new file:&lt;br /&gt;
&lt;br /&gt;
 nano /etc/network/if-pre-up.d/iptables&lt;br /&gt;
&lt;br /&gt;
Add these lines to it:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 /sbin/iptables-restore &amp;lt; /etc/iptables.up.rules&lt;br /&gt;
&lt;br /&gt;
The file needs to be executable so change the permissions:&lt;br /&gt;
&lt;br /&gt;
 chmod +x /etc/network/if-pre-up.d/iptables&lt;br /&gt;
&lt;br /&gt;
[[Category: HOWTO]]&lt;br /&gt;
[[Category: Debian]]&lt;br /&gt;
[[Category: Installation]]&lt;/div&gt;</summary>
		<author><name>Sawtooth</name></author>
		
	</entry>
</feed>