Editing Gentoo template creation
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
== Download stage3 == | == Download stage3 == | ||
− | We will make the template from a stage3 file. An OpenVZ OS template should be an archive (.tar.gz) of the root of a working system, but without the kernel and some files. You can download stage3 from the nearest mirror | + | We will make the template from a stage3 file. An OpenVZ OS template should be an archive (.tar.gz) of the root of a 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. |
− | or | + | or here [http://distfiles.gentoo.org/releases/x86/current-stage3/ |
+ | ] | ||
− | + | == Create directory for the new container and unarchive stage3 == | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == Create | ||
<pre> | <pre> | ||
− | |||
mkdir /vz/private/1001 | mkdir /vz/private/1001 | ||
− | tar - | + | tar -xjf /root/stage3-i686-20111213.tar.bz2 -C /vz/private/1001 |
</pre> | </pre> | ||
Line 42: | Line 21: | ||
</pre> | </pre> | ||
− | Gentoo users wil see warning, but nothing to | + | Gentoo users wil see warning, but nothing to wary just ignore it |
<pre> | <pre> | ||
WARNING: /etc/vz/conf/1001.conf not found: No such file or directory | WARNING: /etc/vz/conf/1001.conf not found: No such file or directory | ||
</pre> | </pre> | ||
− | + | == Edit CT Config == | |
+ | |||
+ | Add the following to <code>/etc/vz/conf/1001.conf</code>: | ||
<pre> | <pre> | ||
− | + | echo 'OSTEMPLATE="gentoo"' >>/etc/vz/conf/1001.conf | |
− | |||
− | |||
− | |||
</pre> | </pre> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Creation of container at end of this HowTo obeys quota limits and might exceed | Creation of container at end of this HowTo obeys quota limits and might exceed | ||
those limits set in <code>vps.basic</code> by default (at least encountered with Gentoo | those limits set in <code>vps.basic</code> by default (at least encountered with Gentoo | ||
10.1 release). Thus it might be required to increase limits now. The following | 10.1 release). Thus it might be required to increase limits now. The following | ||
− | values are providing 2 | + | values are providing 2 GiByte soft limit with 2.5 GiByte hard limit: |
− | + | <pre> | |
− | + | DISKSPACE="2097152:2621440" | |
− | + | </pre> | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | But if you using Gentoo 11.2 release and future you can skip the increasing the disk space limits, by deafult you have 2 GiByte soft limit and 2.3 GiByte hard limit. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
After that you copy that configuration file turning it into a sample configuration for later use: | After that you copy that configuration file turning it into a sample configuration for later use: | ||
− | + | <pre> | |
+ | # cp /etc/vz/conf/1001.conf /etc/vz/conf/ve-gentoo.conf-sample | ||
+ | </pre> | ||
== Make /etc/mtab a symlink to /proc/mounts == | == Make /etc/mtab a symlink to /proc/mounts == | ||
Line 155: | Line 115: | ||
</pre> | </pre> | ||
− | Gentoo 11.2 release have an option in | + | Gentoo 11.2 release have an option in /vz/private/1001/etc/rc.conf |
just uncoment rc_sys and type "openvz" and it disables init scripts | just uncoment rc_sys and type "openvz" and it disables init scripts | ||
<pre> | <pre> | ||
− | |||
rc_sys="openvz" | rc_sys="openvz" | ||
</pre> | </pre> | ||
Line 186: | Line 145: | ||
</pre> | </pre> | ||
− | |||
If you want to enable udev read on. | If you want to enable udev read on. | ||
Line 226: | Line 184: | ||
<pre> | <pre> | ||
− | vzctl start | + | vzctl start 777 |
− | vzctl enter | + | vzctl enter 777 |
</pre> | </pre> | ||
Line 249: | Line 207: | ||
<pre> | <pre> | ||
− | vzctl stop | + | vzctl stop 777 |
</pre> | </pre> | ||
Line 259: | Line 217: | ||
<pre> | <pre> | ||
− | mkdir /vz/root/ | + | mkdir /vz/root/777/usr/portage |
− | mount -o bind /usr/portage /vz/root/ | + | mount -o bind /usr/portage /vz/root/777/usr/portage |
</pre> | </pre> | ||
Line 266: | Line 224: | ||
<pre> | <pre> | ||
− | mount -n -o bind /usr/portage/distfiles /vz/root/ | + | mount -n -o bind /usr/portage/distfiles /vz/root/777/usr/portage/distfiles |
</pre> | </pre> | ||
Line 279: | Line 237: | ||
For security reasons, you should have these directories mounted only while installing software into a container. | For security reasons, you should have these directories mounted only while installing software into a container. | ||
− | {{Note|you have to <code>umount /vz/root/ | + | {{Note|you have to <code>umount /vz/root/777/usr/portage/distfiles</code> before trying to stop your container.}} |
+ | |||
== Dedicated installation of portage == | == Dedicated installation of portage == | ||
Line 285: | Line 244: | ||
If you decide not to share portage with host as described before, you'll still need a portage installed into your container. | If you decide not to share portage with host as described before, you'll still need a portage installed into your container. | ||
− | Get latest snapshot of portage tree from your favourite mirror (http://www.gentoo.org/main/en/mirrors.xml) and extract it into <code>/vz/private/ | + | Get latest snapshot of portage tree from your favourite mirror (http://www.gentoo.org/main/en/mirrors.xml) and extract it into <code>/vz/private/777/usr</code>: |
<pre> | <pre> | ||
− | # wget | + | # wget <your-mirro>/snapshots/portage-latest.tar.bz2 |
− | # tar xjf portage-latest.tar.bz2 -C /vz/private/ | + | # tar xjf portage-latest.tar.bz2 -C /vz/private/777/usr |
</pre> | </pre> | ||
Line 314: | Line 273: | ||
− | Add the following strings to the <code>/vz/private/ | + | Add the following strings to the <code>/vz/private/777/etc/make.conf</code>: |
<pre> | <pre> | ||
Line 321: | Line 280: | ||
</pre> | </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. | + | 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 == | == Create the template cache file == | ||
<pre> | <pre> | ||
− | cd /vz/private/ | + | cd /vz/private/777/ |
tar --numeric-owner -czf /vz/template/cache/gentoo.tar.gz * | tar --numeric-owner -czf /vz/template/cache/gentoo.tar.gz * | ||
</pre> | </pre> |