Open main menu

OpenVZ Virtuozzo Containers Wiki β

Changes

Gentoo template creation

1,084 bytes added, 14:56, 3 May 2011
no edit summary
# tar xjf portage-latest.tar.bz2 -C /vz/private/777/usr
</pre>
 
== Host system portage tree and distfiles in read-only mode ==
 
You can safely share portage tree from the host system among all Gentoo VPSs by mounting it in read-only mode and defining dedicated <code>distfiles</code> directory. All files in regular <code>distfiles</code> directory will be also available to guest containers.
 
Create <code>/etc/vz/conf/vps.mount</code> to mount RO portage to all Gentoo guests or <code>/etc/vz/conf/<vps id>.mount</code> to mount portage tree only to particular container:
 
<pre>
#!/bin/bash
source /etc/vz/vz.conf
source ${VE_CONFFILE}
if [ -d /vz/root/$VEID/usr/portage ]; then
mount -n --bind -o ro /vz/portage /vz/root/$VEID/usr/portage
fi
</pre>
 
Make it executable:
 
<pre>
chmod u+x /etc/vz/conf/vps.mount
</pre>
 
 
Add the following strings to the <code>/vz/private/777/etc/make.conf</code>:
 
<pre>
PORTAGE_RO_DISTDIRS="/usr/portage/distfiles"
DISTDIR="/usr/portage_distfiles"
</pre>
 
You should update host-node portage tree on regular basis to keep it up to date because <code>emerge --sync</code> won't work inside guest container.
== Create the template cache file ==
Anonymous user