In this guide provides instructions on setting up a basic virtual server using the OpenVZ Technology.
Install the sys-kernel/openvz-sources package:
emerge --ask sys-kernel/openvz-sources
Processor type and features ---> [*] Fair CPU scheduler [*] VCPU scheduler support File Systems ---> [*] Quota support <M> VPS filesystem <M> Virtuozzo Disk Quota support [ ] Unloadable Virtuozzo Disk Quota module [*] Per-user and per-group quota in Virtuozzo quota partitions OpenVZ ---> [*] Virtual Environment support <M> VE calls interface [ ] Enable sysfs support in Virtual Environments <M> VE networking [*] VE netfiltering <M> VE watchdog module
After you've built and installed the kernel (steps not covered in this article), update the boot loader and reboot to see if the kernel boots correctly.
To maintain your virtual servers you need the sys-cluster/vzctl package which contains all necessary programs and many useful features:
emerge --ask sys-cluster/vzctl
The vzctl packages has installed an init script called vz. It will help you to start/stop virtual servers on boot/shutdown:
rc-update add vz default
Creating a guest template
Since many hardware related commands are not available inside a virtual server, there has been a patched version of baselayout known as baselayout-vserver. However all required changes have been integrated into normal baselayout-2, eliminating the need for seperate vserver stages, profiles and baselayout. The only (temporary) drawback is that baselayout-2 is still considered to be in alpha stage and there are no stages with baselayout-2 available on the mirrors yet.
As soon as baselayout-2 is stable you can use a precompiled stage3/4 from one of our mirrors. In the meantime please download a stage3/4 from here.
Unfortunately vzctl does not understand bzip2 (yet?) and needs a different filename to recognize Gentoo as the distribution, so you have to convert the stage tarball.
Convert the stage tarball:
mv stage4-tarball.tar gentoo-<arch>-<version>.tar
vzctl create <vpsid> --ostemplate gentoo-<arch>-<version>
Do not use vpsids <=100, they are reserved.
Test the virtual server
You should be able to start and enter the vserver by using the commands below:
vzctl start <vpsid>
vzctl enter <vpsid>
PID TTY STAT TIME COMMAND 1 ? S 0:00 init  20496 pts/0 S 0:00 /bin/bash -i 20508 pts/0 R+ 0:00 ps ax
This page is based on a document formerly found on our main website gentoo.org.
The following people contributed to the original document: Benedikt Boehm (author) on March 22, 2007
They are listed here because wiki history does not allow for any external attribution. If you edit the wiki article, please do not add yourself here; your contributions are recorded on each article's associated history page.