19.06.2015 Views

ADMIN

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Virtualization<br />

OpenVZ<br />

Figure 3: I installing OpenVZ from the package sources for Ubuntu 8.04 – the<br />

last version of Ubuntu to officially include an OpenVZ kernel. The only package<br />

needed for this was the linux‐openvz meta-package.<br />

Figure 4: The OpenVZ developers provide container templates for various guest<br />

systems; this makes installing a guest system a quick and easy experience.<br />

Templates from the community are also available.<br />

should have at least 5GB of hard disk<br />

space, a fair amount of RAM (at least<br />

4GB), and enough swap space.<br />

Starting OpenVZ<br />

Installing OpenVZ is simple. Users on<br />

RPM-based operating systems such as<br />

RHEL or CentOS can simply include<br />

the Yum repository specified in the<br />

quick install manual on the project<br />

homepage. Ubuntu 8.04 users will<br />

find a linux‐openvz meta-package<br />

in the multiverse repository, which<br />

installs the required OpenVZ kernel,<br />

including the kernel modules and<br />

header files (Figure 3). At the time of<br />

writing, no OpenVZ kernel was available<br />

for Ubuntu 10.04. If you are interested<br />

in using OpenVZ with a current<br />

version of Ubuntu, you will find<br />

a prebuilt deb package in Debian’s<br />

unstable branch. To install type:<br />

detailed information on this, refer to<br />

the sysctl section in the quick install<br />

guide, which covers providing network<br />

access to the guest systems, involving<br />

setting up packet forwarding<br />

for IPv4 [5]. Then, you need to reboot<br />

with the new kernel. If you edit<br />

sysctl after rebooting, you can reload<br />

by typing sudo sysctl ‐p. Typing<br />

sudo /etc/init.d/vz start<br />

wakes up the virtualization machine.<br />

Next, you should make sure all the<br />

OpenVZ services are running; this is<br />

done easily (on Ubuntu) by issuing:<br />

sudo sysv‐rc‐conf ‐list vz<br />

If the tool is missing, you can type<br />

sudo apt‐get install sysconfig<br />

to install it. Debian and Red Hat users<br />

can run the legacy chkconfig tool. A<br />

check of service vz status should<br />

now tell you that OpenVZ is running.<br />

Container Templates<br />

OpenVZ users don’t need to install<br />

an operating system in the traditional<br />

sense of the word. The most convenient<br />

approach to set up OpenVZ<br />

containers is with templates (i.e.,<br />

tarballs with a minimal version of the<br />

distribution you want to use in the<br />

container). Administrators can create<br />

templates themselves, although it’s<br />

not exactly trivial [6]. Downloading<br />

prebuilt templates [7] and copying<br />

them to the template folder is easier:<br />

sudo cp path_to_template U<br />

/var/lib/vz/template/cache<br />

Besides templates provided by the<br />

OpenVZ team, the page also offers<br />

sudo dpkg ‐i linux‐base_2.6.32‐10_all.debU<br />

linux‐image‐2.6.32‐4‐openvz‐686_U<br />

2.6.32‐10_i386.deb<br />

The sudo apt‐get ‐f install command<br />

will automatically retrieve any<br />

missing packages. You will also need<br />

to install the vzctl tool, which has a<br />

dependency for vzquota.<br />

Before setting up the containers and<br />

configuring the OpenVZ host environment,<br />

you need to modify a few<br />

kernel parameters that are necessary<br />

to run OpenVZ in the /etc/sysctl.<br />

conf file on the host system. For more<br />

Figure 5: A couple of clear-cut commands are used for creating and starting a VE and for entering the VE.<br />

54 Admin 01 www.admin-magazine.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!