<?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=INFOMAN</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=INFOMAN"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/INFOMAN"/>
	<updated>2026-05-15T13:45:34Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=User:INFOMAN&amp;diff=3903</id>
		<title>User:INFOMAN</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=User:INFOMAN&amp;diff=3903"/>
		<updated>2008-01-07T01:20:10Z</updated>

		<summary type="html">&lt;p&gt;INFOMAN: New page: OpenVZ newbie&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OpenVZ newbie&lt;/div&gt;</summary>
		<author><name>INFOMAN</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Quick_installation_(legacy)&amp;diff=3902</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=3902"/>
		<updated>2008-01-07T01:06:05Z</updated>

		<summary type="html">&lt;p&gt;INFOMAN: There is nothing for debian on this page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This document briefly describes the steps needed to install OpenVZ on your (RPM based) machine. For '''Debian''' based systems see [[Installation on Debian]].&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;
[http://wiki.openvz.jp Japanese],&lt;br /&gt;
[[Quick_installation_(Spanish)|Spanish]].&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.swsoft.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;
# rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ&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 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;
&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. If you are installing on x86_64 CentOS or Fedora system, you may want to continue the setup process using the [[Install_OpenVZ_on_a_x86_64_system_Centos-Fedora|x86_64 guide]].&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>INFOMAN</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Category:Debian&amp;diff=3901</id>
		<title>Category:Debian</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Category:Debian&amp;diff=3901"/>
		<updated>2008-01-07T01:05:02Z</updated>

		<summary type="html">&lt;p&gt;INFOMAN: New page: Debian&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Debian&lt;/div&gt;</summary>
		<author><name>INFOMAN</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Ubuntu_Gutsy_template_creation&amp;diff=3900</id>
		<title>Ubuntu Gutsy template creation</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Ubuntu_Gutsy_template_creation&amp;diff=3900"/>
		<updated>2008-01-07T00:00:08Z</updated>

		<summary type="html">&lt;p&gt;INFOMAN: /* debootstrap */ 0.x versions do not contain scripts for gutsy&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: HOWTO]]&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
[[Category: Ubuntu]]&lt;br /&gt;
&lt;br /&gt;
This article summarizes the experience of creating Ubunty Gutsy Gibbon (a.k.a. 7.10) template for OpenVZ.&lt;br /&gt;
&lt;br /&gt;
Template creation is based on debootstrap, and the procedure is similar to [[Debian template creation]], but it differs in some subtle details.&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
=== debootstrap ===&lt;br /&gt;
You have to have a &amp;lt;code&amp;gt;debootstrap&amp;lt;/code&amp;gt; working for Gutsy, i.e. you should have&lt;br /&gt;
* &amp;lt;code&amp;gt;debootstrap&amp;lt;/code&amp;gt; and its dependencies&lt;br /&gt;
* &amp;lt;code&amp;gt;/usr/lib/debootstrap/scripts/gutsy&amp;lt;/code&amp;gt; file&lt;br /&gt;
&lt;br /&gt;
The simplest way to have it all is to work on an Ubuntu Gutsy system (be it on a real machine or inside a VE). If you don't have &amp;lt;code&amp;gt;debootstrap&amp;lt;/code&amp;gt; installed, this is the command to install it:&lt;br /&gt;
&lt;br /&gt;
 # apt-get install debootstrap&lt;br /&gt;
&lt;br /&gt;
On a Gentoo Linux, &amp;lt;code&amp;gt;debootstrap&amp;lt;/code&amp;gt; is also available, this is how you can install it:&lt;br /&gt;
&lt;br /&gt;
 # emerge \&amp;gt;=debootstrap-1.0.0&lt;br /&gt;
&lt;br /&gt;
Possible you will first need to add it to package.keywords.&lt;br /&gt;
&lt;br /&gt;
On a Fedora system (at least Fedora 8, not sure about earlier versions):&lt;br /&gt;
&lt;br /&gt;
 # yum install debootstrap&lt;br /&gt;
&lt;br /&gt;
=== vzctl ===&lt;br /&gt;
&lt;br /&gt;
You need vzctl-3.0.22 or later to work with Ubuntu Gutsy Gibbon. If vzctl-3.0.18 or earlier is used, you will not be able to run your Ubuntu Gutsy VE. See {{bug|662}} for details.&lt;br /&gt;
&lt;br /&gt;
Note: Older versions of vzctl are working if you install &amp;lt;code&amp;gt;sysvinit&amp;lt;/code&amp;gt; (which will remove &amp;lt;code&amp;gt;upstart&amp;lt;/code&amp;gt;). The only problem I had was the network did not start, so I added &amp;quot;/etc/init.d/networking restart&amp;quot; to /etc/re.local.&lt;br /&gt;
&lt;br /&gt;
== Creating template ==&lt;br /&gt;
&lt;br /&gt;
=== Running debootstrap ===&lt;br /&gt;
&lt;br /&gt;
Create a working directory:&lt;br /&gt;
&lt;br /&gt;
 [HW]# mkdir gutsy-chroot&lt;br /&gt;
&lt;br /&gt;
Run debootstrap to install a minimal Ubunty Gutsy system into that directory:&lt;br /&gt;
&lt;br /&gt;
 [HW]# debootstrap [--arch ''ARCH''] gutsy gutsy-chroot &lt;br /&gt;
&lt;br /&gt;
If ARCH of VE0 is equal to VE, you can skip the --arch option, but if you need to build an OS template for another ''ARCH'', specify it explicitly:&lt;br /&gt;
* for AMD64/x86_64, use &amp;lt;code&amp;gt;amd64&amp;lt;/code&amp;gt;&lt;br /&gt;
* for IA64, use &amp;lt;code&amp;gt;ia64&amp;lt;/code&amp;gt;&lt;br /&gt;
* for i386 &amp;lt;code&amp;gt;i386&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Preparing/starting a VE ===&lt;br /&gt;
&lt;br /&gt;
Now then you have an installation created by &amp;lt;code&amp;gt;debootstrap&amp;lt;/code&amp;gt;, you can run it as a VE. In the example below VE ID of 777 is used; of course you can use any other non-allocated ID.&lt;br /&gt;
&lt;br /&gt;
{{Note|an alternative way is using chroot instead of running a VE. This is not recommended because of security concerns.}}&lt;br /&gt;
&lt;br /&gt;
==== Moving installation to VE private area ====&lt;br /&gt;
&lt;br /&gt;
You should move the contents of gutsy-chroot directory into new VE private area, like this:&lt;br /&gt;
&lt;br /&gt;
 # mv gutsy-chroot /vz/private/777&lt;br /&gt;
&lt;br /&gt;
==== Setting VE config ====&lt;br /&gt;
An initial config for the [[VE]] is needed:&lt;br /&gt;
 # vzctl set 777 --applyconfig vps.basic --save&lt;br /&gt;
&lt;br /&gt;
==== Setting VE OSTEMPLATE ====&lt;br /&gt;
Also, we need &amp;lt;code&amp;gt;OSTEMPLATE&amp;lt;/code&amp;gt; to be set in VE configuration file, for the [[vzctl]] to work properly.&lt;br /&gt;
&lt;br /&gt;
 # echo &amp;quot;OSTEMPLATE=ubuntu-7.10&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;
 # 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 the 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;
 # vzctl set 777 --nameserver x.x.x.x --save&lt;br /&gt;
&lt;br /&gt;
Instead of &amp;lt;code&amp;gt;x.x.x.x&amp;lt;/code&amp;gt;, specify the same IP that you have in your &amp;lt;code&amp;gt;/etc/resolv.conf&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
==== Starting VE ====&lt;br /&gt;
Now start the VE:&lt;br /&gt;
 # vzctl start 777&lt;br /&gt;
&lt;br /&gt;
=== Modify the installation ===&lt;br /&gt;
&lt;br /&gt;
You have to do some things in order to modify the installation to better suit the environment it will be run in (i.e. a VE).&lt;br /&gt;
&lt;br /&gt;
First, enter a VE:&lt;br /&gt;
 # vzctl enter 777&lt;br /&gt;
&lt;br /&gt;
{{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;
==== Remove unneeded packages ====&lt;br /&gt;
&lt;br /&gt;
Some packages does not make sense in a VE, or are really optional. Remove those:&lt;br /&gt;
&lt;br /&gt;
 [VE]# dpkg -P ubuntu-minimal wpasupplicant wireless-tools \&lt;br /&gt;
   udev pcmciautils initramfs-tools volumeid console-setup \&lt;br /&gt;
   xkb-data usbutils mii-diag alsa-base alsa-utils ethtool \&lt;br /&gt;
   module-init-tools linux-sound-base console-tools \&lt;br /&gt;
   console-terminus busybox-initramfs libvolume-id0 \&lt;br /&gt;
   ntpdate eject libasound2 pciutils tasksel tasksel-data \&lt;br /&gt;
   laptop-detect&lt;br /&gt;
&lt;br /&gt;
{{Note|On removing the deb-package &amp;quot;module-init-tools&amp;quot;, a fake-modprobe is needed for IPv6 adresses, see below!}}&lt;br /&gt;
&lt;br /&gt;
Note that the above list of packages may be too extensive. Say, if you want to use &amp;lt;code&amp;gt;tasksel&amp;lt;/code&amp;gt; tool, do not remove it — but then you have to let laptop-detect stay.&lt;br /&gt;
&lt;br /&gt;
Clean up after udev:&lt;br /&gt;
&lt;br /&gt;
 [VE]# rm -fr /lib/udev&lt;br /&gt;
&lt;br /&gt;
==== Disable getty ====&lt;br /&gt;
On a usual Linux system, getty is running on a virtual terminals, which a VE does not have. So, having getty running doesn't make sense; more to say, it complains it can not open terminal device and this clutters the logs.&lt;br /&gt;
&lt;br /&gt;
So, first of all we stop all getty processes:&lt;br /&gt;
&lt;br /&gt;
 [VE]# initctl stop tty{1,2,3,4,5,6}&lt;br /&gt;
&lt;br /&gt;
Next, we disable running getty. This can be done in two ways:&lt;br /&gt;
&lt;br /&gt;
First way:&lt;br /&gt;
 [VE]# rm /etc/event.d/tty*&lt;br /&gt;
&lt;br /&gt;
Second way:&lt;br /&gt;
 [VE]# dpkg -P system-services&lt;br /&gt;
&lt;br /&gt;
Second way can be dangerous for future versions of system-services, but it's OK for now since the only service they carry is running gettys.&lt;br /&gt;
&lt;br /&gt;
====  Set sane permissions for /root directory ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# chmod 700 /root&lt;br /&gt;
&lt;br /&gt;
==== Disable root login ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# usermod -L root&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== &amp;quot;fake-modprobe&amp;quot; needed for IPv6 adresses ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# ln -s /bin/true /sbin/modprobe&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;On setup IPv6, the command &amp;quot;modprobe -Q IPv6&amp;quot; is called, which fails without the &amp;quot;fake-modprobe&amp;quot;&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Get new security updates ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# apt-get update &amp;amp;&amp;amp; apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
&amp;lt;small&amp;gt;This didn't show anything for me, but might do something in the future.&amp;lt;/small&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Install some more packages ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# apt-get install ssh quota&lt;br /&gt;
&lt;br /&gt;
Feel free to add packages which you want to have in a default template to this command.&lt;br /&gt;
&lt;br /&gt;
==== Fix SSH host keys ====&lt;br /&gt;
This is only useful if you installed SSH above.  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;
&lt;br /&gt;
&amp;lt;!-- please DO NOT remove &amp;lt;pre&amp;gt;...&amp;lt;/pre&amp;gt; pair of tags below,&lt;br /&gt;
     otherwise quotes after -N (-N '') are not visible --&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&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/sh&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;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Disable &amp;lt;code&amp;gt;sync()&amp;lt;/code&amp;gt; for syslog ====&lt;br /&gt;
&lt;br /&gt;
Turn off doing &amp;lt;tt&amp;gt;sync()&amp;lt;/tt&amp;gt; on every write for &amp;lt;code&amp;gt;syslog&amp;lt;/code&amp;gt;'s log files, to improve overall I/O performance.&lt;br /&gt;
In Ubuntu this is already done for most log files and levels, so you can omit this step if you know what you are doing.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- DO NOT remove &amp;lt;pre&amp;gt; here, it's useful --&amp;gt;&lt;br /&gt;
 &amp;lt;pre&amp;gt;[VE]# sed -i -e 's@\([[:space:]]\)\(/var/log/\)@\1-\2@' /etc/syslog.conf&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Fix &amp;lt;code&amp;gt;/etc/mtab&amp;lt;/code&amp;gt; ====&lt;br /&gt;
Link &amp;lt;code&amp;gt;/etc/mtab&amp;lt;/code&amp;gt; to &amp;lt;code&amp;gt;/proc/mounts&amp;lt;/code&amp;gt;, so &amp;lt;code&amp;gt;df&amp;lt;/code&amp;gt; and friends will work:&lt;br /&gt;
 [VE]# rm -f /etc/mtab&lt;br /&gt;
 [VE]# ln -s /proc/mounts /etc/mtab&lt;br /&gt;
&lt;br /&gt;
After that, it would make sense to disable &amp;lt;code&amp;gt;mtab.sh&amp;lt;/code&amp;gt; script which messes with &amp;lt;code&amp;gt;/etc/mtab&amp;lt;/code&amp;gt;:&lt;br /&gt;
 [VE]# update-rc.d -f mtab.sh remove&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Disable some services ====&lt;br /&gt;
&lt;br /&gt;
In most of the cases you don't want klogd to run -- the only exception is if you configure iptables to log some events -- so you can disable it:&lt;br /&gt;
&lt;br /&gt;
 [VE]# update-rc.d -f klogd remove&lt;br /&gt;
&lt;br /&gt;
==== Hostname ====&lt;br /&gt;
Set proper hostname:&lt;br /&gt;
 [VE]# echo &amp;quot;localhost&amp;quot; &amp;gt; /etc/hostname&lt;br /&gt;
&lt;br /&gt;
==== Set /etc/hosts ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# echo &amp;quot;127.0.0.1 localhost.localdomain localhost&amp;quot; &amp;gt; /etc/hosts&lt;br /&gt;
&lt;br /&gt;
==== Add ptys to /dev ====&lt;br /&gt;
&lt;br /&gt;
This is needed in case /dev/pts will not me mounted after VE start. In case /dev/ttyp* and /dev/ptyp* files are present, and LEGACY_PTYS support is enabled in the kernel, vzctl will still be able to enter VE.&lt;br /&gt;
&lt;br /&gt;
 [VE]# cd /dev &amp;amp;&amp;amp; /sbin/MAKEDEV ptyp&lt;br /&gt;
&lt;br /&gt;
==== Remove nameserver(s) ====&lt;br /&gt;
&lt;br /&gt;
Remove DNS entries:&lt;br /&gt;
 [VE]# &amp;gt; /etc/resolv.conf&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;
 [VE]# apt-get clean&lt;br /&gt;
&lt;br /&gt;
==== Cleaning up log files ====&lt;br /&gt;
&lt;br /&gt;
 [VE]# cd /var/log&lt;br /&gt;
 [VE]# &amp;gt; messages; &amp;gt; auth.log; &amp;gt; kern.log; &amp;gt; bootstrap.log&lt;br /&gt;
 [VE]# &amp;gt; dpkg.log; &amp;gt; syslog; &amp;gt; daemon.log; &amp;gt; apt/term.log&lt;br /&gt;
 [VE]# rm -f *.0 *.1&lt;br /&gt;
&lt;br /&gt;
==== Anything else? ====&lt;br /&gt;
&lt;br /&gt;
Think of what else could be done to better suit your needs.&lt;br /&gt;
&lt;br /&gt;
==== Exit from the VE ====&lt;br /&gt;
&lt;br /&gt;
Now everything is done.  Exit from the template and go back to the hardware node.&lt;br /&gt;
&lt;br /&gt;
 [VE]# exit&lt;br /&gt;
&lt;br /&gt;
== Preparing for and packing template cache ==&lt;br /&gt;
&lt;br /&gt;
The following commands are to be run in the host system (i.e. not inside a VE).&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;
 [HW]# vzctl set 777 --ipdel all --save&lt;br /&gt;
&lt;br /&gt;
Stop the VE:&lt;br /&gt;
 [HW]# vzctl stop 777&lt;br /&gt;
&lt;br /&gt;
Change dir to the VE private:&lt;br /&gt;
 [HW]# 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;arch&amp;gt; with your architecture (i386, amd64, ia64, etc). '''Note the space and the dot at the end of the command'''.&lt;br /&gt;
 [HW]# tar czf /vz/template/cache/ubuntu-7.10-&amp;lt;arch&amp;gt;-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   53M Nov 15 12:40 ubuntu-7.10-i386-minimal.tar.gz&lt;br /&gt;
&lt;br /&gt;
== Testing template cache ==&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;
 [HW]# vzctl create 123456 --ostemplate ubuntu-7.10-&amp;lt;arch&amp;gt;-minimal&lt;br /&gt;
&lt;br /&gt;
Now make sure that your new VE it works:&lt;br /&gt;
 [HW]# vzctl start 123456&lt;br /&gt;
 [HW]# vzctl exec 123456 ps axf&lt;br /&gt;
&lt;br /&gt;
You should see that a few processes are running.&lt;br /&gt;
&lt;br /&gt;
Other tests that could be done are:&lt;br /&gt;
 [HW]# vzctl enter 123456&lt;br /&gt;
 [VE]# ps axf&lt;br /&gt;
 [VE]# mount&lt;br /&gt;
 [VE]# dpkg -l&lt;br /&gt;
 [VE]# logout&lt;br /&gt;
 [HW]#&lt;br /&gt;
&lt;br /&gt;
Feel free to do more tests.&lt;br /&gt;
&lt;br /&gt;
== Final cleanup ==&lt;br /&gt;
Stop and remove the test VE you just created:&lt;br /&gt;
 [HW]# vzctl stop 123456&lt;br /&gt;
 [HW]# vzctl destroy 123456&lt;br /&gt;
 [HW]# rm -f /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;
 [HW]# vzctl destroy 777&lt;br /&gt;
 [HW]# rm -f /etc/vz/conf/777.conf.destroyed&lt;br /&gt;
&lt;br /&gt;
== Updating the template cache ==&lt;br /&gt;
&lt;br /&gt;
See [[Updating Ubuntu template]]&lt;/div&gt;</summary>
		<author><name>INFOMAN</name></author>
		
	</entry>
</feed>