<?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=Jiadar</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=Jiadar"/>
	<link rel="alternate" type="text/html" href="https://wiki.openvz.org/Special:Contributions/Jiadar"/>
	<updated>2026-05-15T20:57:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_a_Red_Hat_Template_with_mach&amp;diff=6380</id>
		<title>Creating a Red Hat Template with mach</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_a_Red_Hat_Template_with_mach&amp;diff=6380"/>
		<updated>2008-08-27T15:14:32Z</updated>

		<summary type="html">&lt;p&gt;Jiadar: &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;
Using the &amp;quot;mach&amp;quot; program you can easily create a minimal template for virtually any Red Hat OS. The following example creates a template for Centos 5.2 i386. &lt;br /&gt;
&lt;br /&gt;
# Install mach on the host node or your build server&lt;br /&gt;
#: yum install mach&lt;br /&gt;
# Edit /etc/mach/conf to use the OS version / architecture you want&lt;br /&gt;
# Setup the chroot&lt;br /&gt;
#: mach setup base&lt;br /&gt;
# Setup any additional packages you want in the chroot&lt;br /&gt;
#: mach yum install yum vim-minimal passwd ssh-clients openssh-server&lt;br /&gt;
# Run the script below in the chroot directory (/var/lib/mach/roots/template-name)&lt;br /&gt;
# Package the template into /vz/template/cache&lt;br /&gt;
#: cd /var/lib/mach/roots/template-name&lt;br /&gt;
#: tar czf /vz/template/cache/template-name.tar.gz .&lt;br /&gt;
# At this point I create a &amp;quot;template&amp;quot; VE and do any other additional configuration inside the running VE, verify that it works, etc. Then I repackage it again. &lt;br /&gt;
&lt;br /&gt;
'''Script to turn mach chroot into vz template:'''&lt;br /&gt;
&lt;br /&gt;
Run these commands from /var/lib/mach/root/template. Replace the ROOT_PWD_HASH with your root password hash with your own hash if you want to set the password for the template. (otherwise, you can vzctl enter VEID and change the password). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OS=$(basename $(pwd))&lt;br /&gt;
alias rm=rm&lt;br /&gt;
sed -i -e /getty/d etc/inittab&lt;br /&gt;
sed -i -e /sbin\\/start_udev/d etc/rc.sysinit&lt;br /&gt;
sed -i -e 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' etc/ssh/sshd_config&lt;br /&gt;
#sed -i -e &amp;quot;s/root:.:/root:ROOT_PWD_HASH:/g&amp;quot; etc/passwd&lt;br /&gt;
echo &amp;quot;PS1='[\u@\h \W]\$'&amp;quot; &amp;gt;&amp;gt; /etc/profile&lt;br /&gt;
rm etc/mtab&lt;br /&gt;
ln -s /proc/mounts etc/mtab&lt;br /&gt;
mknod dev/ptmx c 5 2&lt;br /&gt;
mkdir dev/pts&lt;br /&gt;
/sbin/MAKEDEV -d dev ttyp ptyp&lt;br /&gt;
mknod dev/null c 1 3&lt;br /&gt;
mknod dev/urandom c 1 9&lt;br /&gt;
mknod dev/tty c 5 0&lt;br /&gt;
mkdir -p var/lock/rpm&lt;br /&gt;
ln -s /etc/init.d /s&lt;br /&gt;
mkdir -p /var/lib/mach/roots/$OS/var/lib/yum/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jiadar</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.openvz.org/index.php?title=Creating_a_Red_Hat_Template_with_mach&amp;diff=6379</id>
		<title>Creating a Red Hat Template with mach</title>
		<link rel="alternate" type="text/html" href="https://wiki.openvz.org/index.php?title=Creating_a_Red_Hat_Template_with_mach&amp;diff=6379"/>
		<updated>2008-08-27T15:12:38Z</updated>

		<summary type="html">&lt;p&gt;Jiadar: New page: Using the &amp;quot;mach&amp;quot; program you can easily create a minimal template for virtually any Red Hat OS. The following example creates a template for Centos 5.2 i386.   # Install mach on the host n...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Using the &amp;quot;mach&amp;quot; program you can easily create a minimal template for virtually any Red Hat OS. The following example creates a template for Centos 5.2 i386. &lt;br /&gt;
&lt;br /&gt;
# Install mach on the host node or your build server&lt;br /&gt;
#: yum install mach&lt;br /&gt;
# Edit /etc/mach/conf to use the OS version / architecture you want&lt;br /&gt;
# Setup the chroot&lt;br /&gt;
#: mach setup base&lt;br /&gt;
# Setup any additional packages you want in the chroot&lt;br /&gt;
#: mach yum install yum &lt;br /&gt;
edit /etc/mach/conf to use the centos i386 extras template&lt;br /&gt;
run mach setup base&lt;br /&gt;
mach yum install yum vim-minimal passwd ssh-clients openssh-server&lt;br /&gt;
# Run the script below in the chroot directory (/var/lib/mach/roots/template-name)&lt;br /&gt;
# Package the template into /vz/template/cache&lt;br /&gt;
#: cd /var/lib/mach/roots/template-name&lt;br /&gt;
#: tar czf /vz/template/cache/template-name.tar.gz .&lt;br /&gt;
# At this point I create a &amp;quot;template&amp;quot; VE and do any other additional configuration inside the running VE, verify that it works, etc. Then I repackage it again. &lt;br /&gt;
&lt;br /&gt;
''Script to turn mach chroot into vz template:''&lt;br /&gt;
&lt;br /&gt;
Run these commands from /var/lib/mach/root/template. Replace the ROOT_PWD_HASH with your root password hash with your own hash if you want to set the password for the template. (otherwise, you can vzctl enter VEID and change the password). &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
OS=$(basename $(pwd))&lt;br /&gt;
alias rm=rm&lt;br /&gt;
sed -i -e /getty/d etc/inittab&lt;br /&gt;
sed -i -e /sbin\\/start_udev/d etc/rc.sysinit&lt;br /&gt;
sed -i -e 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' etc/ssh/sshd_config&lt;br /&gt;
#sed -i -e &amp;quot;s/root:.:/root:ROOT_PWD_HASH:/g&amp;quot; etc/passwd&lt;br /&gt;
echo &amp;quot;PS1='[\u@\h \W]\$'&amp;quot; &amp;gt;&amp;gt; /etc/profile&lt;br /&gt;
rm etc/mtab&lt;br /&gt;
ln -s /proc/mounts etc/mtab&lt;br /&gt;
mknod dev/ptmx c 5 2&lt;br /&gt;
mkdir dev/pts&lt;br /&gt;
/sbin/MAKEDEV -d dev ttyp ptyp&lt;br /&gt;
mknod dev/null c 1 3&lt;br /&gt;
mknod dev/urandom c 1 9&lt;br /&gt;
mknod dev/tty c 5 0&lt;br /&gt;
mkdir -p var/lock/rpm&lt;br /&gt;
ln -s /etc/init.d /s&lt;br /&gt;
mkdir -p /var/lib/mach/roots/$OS/var/lib/yum/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jiadar</name></author>
		
	</entry>
</feed>