Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Gentoo template creation

148 bytes added, 14:01, 27 July 2006
Categorized; more formatting; fixed headers to be in the simple form
This page is about making a template cache for OpenVZ VE from Gentoo linuxLinux. The method is basically the same as described in article [[Slackware template creation]] article.
===Downloading Download stage3===
We shall make the template from stage3 file. OpenVZ OS template should be an archive of root of the working system, but without the kernel and some files. You can download stage3 from the nearest mirror here: http://www.gentoo.org/main/en/mirrors.xml.
===Create directory for the new VPS VE and unarchive stage3 there:===
<pre>
</pre>
===Creating Create VE config===
Now you need to create the configuration file for the VE, 777.conf:
</pre>
===Editing Edit config===
Add to the /etc/vz/conf/777.conf:
</pre>
===Make /etc/mtab a symlink to /proc/mounts.===
<pre>
rm -f /vz/private/777/etc/mtab
ln -s /proc/mounts /vz/private/777/etc/mtab
</pre>
===Editing Edit /etc/fstab===
<pre>
echo "proc /proc proc defaults 0 0" > /vz/private/777/etc/fstab
</pre>
We need only <precode>echo "proc /proc proc defaults 0 0" > /vz/private/777/etc/fstab</precode>We need only /proc to mounted at the boot time.
===Editing Edit inittab===
Edit <code>/etc/inittab</code>, put putting a hashmark (#) before the lines containing:
<pre>c?:1235:respawn:/sbin/agetty 38400 tty? linux</pre>
This prevents from starting <code>getty </code> and login.
===Editing Edit /etc/shadow===
Edit <code>/vz/private/777/etc/shadow</code>, change root's password in the first line to an exclamation mark (!):
<pre>root:!:10071:0:::::</pre>
This will disable the root login until the password changed with <code>vzctl set 777 VEID --userpasswd root:password</code>
===Editing Edit /etc/init.d/checkroot===
We have to clean this script and make them dummy, because we don't need mount or check root.
</pre>
===Editing Edit /sbin/rc===
Comment line number 141:
<pre>try mount -n ${mntcmd:--t sysfs sysfs /sys}</pre>
This prevents from attepting to mount <code>/sys</code>.
===Setting Set up udev===
Delete /lib/udev-state/devices.tar.bz2 and create some device nodes needed to enter VPS:
</pre>
===TestingTest===
<pre>
</pre>
===Making Make distfiles и and portage tree of the host system available in VPS.a VE===
To install software into VPS a VE with portage you should mount /usr/portage into VPS VE with "bind" option. Do this after VPS VE starts:
<pre>
</pre>
Now, to install package into VPS a VE you just need enter there by chroot or <code>vzctl enter </code> andrun
<pre>
</pre>
while you have all the needed files in the <code>/usr/portage/distfiles </code> of host system.
For security reasons hold this directories mounted only while you are installing software into VPSa VE.
===Creating Create the cache file===
<pre>
</pre>
===Testing Test the new cache file===
<pre>
If it started, and you can ssh in, congratulations, you've got a working Gentoo template!
 
[[Category: HOWTO]]
[[Category: Templates]]