Code Listing 1.1: Install openvz-sources |
# emerge openvz-sources
|
After the openvz-sources are installed it's time to configure them using make menuconfig.
Code Listing 1.2: Configure openvz-sources |
# cd /usr/src/linux-<KERNELVERSION>-openvz-<OPENVZVERSION> # make menuconfig 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, update your boot loader and finally reboot to see if the kernel boots correctly.
Code Listing 1.3: Install the kernel |
(Building the kernel) # make (Installing) # make modules_install # cp arch/<arch>/boot/bzImage /boot/kernel-<KERNELVERSION>-openvz-<OPENVZVERSION> (Edit bootloader config file as required and) # reboot |
To maintain your virtual servers you need the vzctl package which contains all necessary programs and many useful features.
Code Listing 1.4: Install vzctl |
# emerge vzctl
|
The vzctl packages has installed an init script called vz. It will help you to start/stop virtual servers on boot/shutdown:
Code Listing 1.5: vzctl init script |
# rc-update add vz default # /etc/init.d/vz start |
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.
Note: 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. |
Code Listing 2.1: Convert stage tarball |
# cd /vz/template/cache # bunzip2 stage4-<arch>-<version>.tar.bz2 # mv stage4-tarball.tar gentoo-<arch>-<version>.tar # gzip gentoo-<arch>-<version>.tar # cd - |
Code Listing 2.2: Create VPS |
# vzctl create <vpsid> --ostemplate gentoo-<arch>-<version>
|
Note: Do not use vpsids <=100, they are reserved. |
You should be able to start and enter the vserver by using the commands below.
Code Listing 2.3: Test the virtual server |
# vzctl start <vpsid> # vzctl enter <vpsid> # ps ax PID TTY STAT TIME COMMAND 1 ? S 0:00 init [3] 20496 pts/0 S 0:00 /bin/bash -i 20508 pts/0 R+ 0:00 ps ax # logout |
The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.