<?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=PavelVinogradov</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=PavelVinogradov"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/PavelVinogradov"/>
	<updated>2026-06-13T23:46:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_a_CentOS_5.0_Template&amp;diff=5840</id>
		<title>Creating a CentOS 5.0 Template</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_a_CentOS_5.0_Template&amp;diff=5840"/>
		<updated>2008-04-25T18:52:08Z</updated>

		<summary type="html">&lt;p&gt;PavelVinogradov: Update formating&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: HOWTO]]&lt;br /&gt;
[[Category: Templates]]&lt;br /&gt;
{{wikify}}&lt;br /&gt;
&lt;br /&gt;
# Install a system (virtual or physical) with the default CentOS installation that you wish to package. This could be a minimal distro or the default distro or even something custom.&lt;br /&gt;
# Once the OS has been installed, you need to '''tar''' the contents of the OS.&lt;br /&gt;
## First, create a file called '''/tmp/exclude''' and add the following lines to it:&lt;br /&gt;
#:  .bash_history&lt;br /&gt;
#:  lost+found&lt;br /&gt;
#:  /dev/*&lt;br /&gt;
#:  /mnt/*&lt;br /&gt;
#:  /tmp/*&lt;br /&gt;
#:  /proc/*&lt;br /&gt;
#:  /sys/*&lt;br /&gt;
#:  /usr/src/*&lt;br /&gt;
## Now, tar the OS file up by typing: '''tar –czvf /tmp/centos-5.0-&amp;lt;ARCH&amp;gt;-&amp;lt;DISTRO&amp;gt;-image.tar.gz / –X #: /tmp/exclude''' where &amp;lt;'''ARCH'''&amp;gt; represents the system architecture ('''i386''' or &lt;br /&gt;
#: '''x86_64''') and &amp;lt;'''DISTRO'''&amp;gt; represents the distribution (default, minimal, etc.).&lt;br /&gt;
## Now transfer the file over to the OpenVZ server into '''/vz/template/cache''' folder.&lt;br /&gt;
# On the OpenVZ server create a “dummy” container by creating a folder called '''/vz/private/50''' &lt;br /&gt;
#: and copying the '''/etc/vz/conf/ve-vps.basic.conf-sample''' to '''/etc/vz/conf/50.conf'''.&lt;br /&gt;
#: '''NOTE''': 50 is the CTID for the container. You can choose any unused CTID on the OpenVZ server.&lt;br /&gt;
# Now create a new folder called '''/vz/template/centos/5.0/&amp;lt;ARCH&amp;gt;/config''' again where &lt;br /&gt;
#: &amp;lt;'''ARCH'''&amp;gt; represents the system architecture.&lt;br /&gt;
# Create a file in the folder called rpm and add the following line:&lt;br /&gt;
#:  43&lt;br /&gt;
# Create a file called '''yum.conf''' in the folder and add the following lines:&lt;br /&gt;
#:  [main]&lt;br /&gt;
#:  &lt;br /&gt;
#:  cachedir=/vz/template/centos/5.0/&amp;lt;ARCH&amp;gt;/yum-cache/&lt;br /&gt;
#:  &lt;br /&gt;
#:  reposdir=/dev/null&lt;br /&gt;
#:  &lt;br /&gt;
#:  installonlypkgs=&lt;br /&gt;
#:  &lt;br /&gt;
#:  [centos5-base]&lt;br /&gt;
#:  name=CentOS 5 - &amp;lt;ARCH&amp;gt; - Base&lt;br /&gt;
#:  &lt;br /&gt;
#:  baseurl=http://mirror.centos.org/centos/5/os/&amp;lt;ARCH&amp;gt;/&lt;br /&gt;
#:  &lt;br /&gt;
#:  enabled=1&lt;br /&gt;
#:  &lt;br /&gt;
#:  gpgcheck=1&lt;br /&gt;
#:  &lt;br /&gt;
#:  [centos5-updates-released]&lt;br /&gt;
#:  &lt;br /&gt;
#:  name=CentOS 5 - &amp;lt;ARCH&amp;gt; - Released Updates&lt;br /&gt;
#:  &lt;br /&gt;
#:  baseurl=http://mirror.centos.org/centos/5/updates/&amp;lt;ARCH&amp;gt;/&lt;br /&gt;
#:  &lt;br /&gt;
#:  enabled=1&lt;br /&gt;
#:  &lt;br /&gt;
#:  gpgcheck=1&lt;br /&gt;
# Copy '''/etc/vz/dists/centos-4.conf''' to '''/etc/vz/dists/centos-5.0.conf'''.&lt;br /&gt;
# Change to the '''/vz/private/50''' folder and then run the command '''gunzip –dc /vz/template/cache/centos-5.0-&amp;lt;ARCH&amp;gt;-&amp;lt;DISTRO&amp;gt;-image.tar.gz | tar –xvf''' – to unpack the base image to the folder.&lt;br /&gt;
# Make sure you are in the '''/vz/private/50''' folder.&lt;br /&gt;
# Edit '''etc/shadow''' and remove the replace the '''root''' password with !! instead of the hashed value.&lt;br /&gt;
# Edit the '''etc/inittab''' file and comment out the lines that respawn '''/sbin/mingetty''' on '''tty1''' through '''tty6'''. Just put a # at the beginning of the line.&lt;br /&gt;
# Remove the '''etc/mtab''' file and then create a symbolic link by typing '''ln –s /proc/mounts etc/mtab'''.&lt;br /&gt;
# Remove all of the lines from '''etc/fstab''' except for the line that mounts '''/dev/pts'''.&lt;br /&gt;
# Edit '''etc/rc.d/rc.sysinit''' and comment out the line that starts '''/sbin/start_udev''' by placing a # at the beginning of the line.&lt;br /&gt;
# Now create device nodes by typing:&lt;br /&gt;
#:  mknod dev/ptmx c 5 2&lt;br /&gt;
#:  mkdir dev/pts&lt;br /&gt;
#:  /sbin/MAKEDEV –d /vz/private/50/dev ttyp ptyp&lt;br /&gt;
#:  mknod dev/null c 1 3&lt;br /&gt;
#:  mknod dev/urandom c 1 9&lt;br /&gt;
# Create the '''var/lock/rpm''' folder.&lt;br /&gt;
# If you wish to disable IPv6, do the following:&lt;br /&gt;
## Edit '''etc/sysconfig/network''' and set '''NETWORKING_IPV6''' to '''no'''.&lt;br /&gt;
## Add the following lines to '''etc/modprobe.d/blacklist''':&lt;br /&gt;
#:  blacklist ipv6&lt;br /&gt;
#:  blacklist net-pf-10&lt;br /&gt;
# Disable any physical NICs by modifying the '''etc/sysconfig/network-scripts/ifcfg-ethX''' files (where '''X''' is the interface number starting from '''0''') and setting '''ONBOOT''' to '''no'''.&lt;br /&gt;
# Now you’re ready to start the template. Type '''vzctl start 50''' and wait for it to start.&lt;br /&gt;
# You can install additional packages into the container by typing '''vzyum 50 install &amp;lt;package&amp;gt;''' at the prompt where &amp;lt;'''package'''&amp;gt; represents the name of the software package you wish to install.&lt;br /&gt;
# Finally, you should turn off unnecessary services.&lt;br /&gt;
## Enter the container by typing '''vzctl enter 50'''.&lt;br /&gt;
## View the services that are set to run at startup by typing '''chkconfig --list | grep 5:on'''.&lt;br /&gt;
## Disable any unwanted service by typing '''chkconfig --levels 2345 &amp;lt;service&amp;gt;''' off where &amp;lt;'''service'''&amp;gt; represents the service to disable.&lt;br /&gt;
#: Services that you can (and should) turn off without harm are acpid, apmd, kudzu, and  microcode_ctl.&lt;br /&gt;
# Exit the container by typing '''exit''' at the prompt.&lt;br /&gt;
# Stop the container by typing '''vzctl stop 50'''.&lt;br /&gt;
# Finally, package up the new template by typing '''tar –czvf /vz/template/cache/centos-5.0-&amp;lt;ARCH&amp;gt;-&amp;lt;DISTRO&amp;gt;.tar.gz'''.&lt;br /&gt;
# The template is ready for use.&lt;/div&gt;</summary>
		<author><name>PavelVinogradov</name></author>
		
	</entry>
</feed>