Installation on Debian 7

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search

This document briefly describes the steps needed to install OpenVZ on your Debian 7 "Wheezy" machine. For RHEL/Centos 6 based systems, please see Quick installation.

A commercial version of OpenVZ is available, which simplifies installation with a single disk as well as supports networked installation using PXE boot. To learn more about Parallels Cloud Server and request a free trial, please see http://www.parallels.com/products/pcs/

Requirements[edit]

This guide assumes you are running Debian 7 "Wheezy" for AMD64 or i686.

/vz file system[edit]

It is recommended to use a separate partition for containers (by default /var/lib/vz) and format it to ext4.

apt pre-setup[edit]

Yellowpin.svg Note: For more info about Debian repositories, see http://download.openvz.org/debian.

Run the following:

cat << EOF > /etc/apt/sources.list.d/openvz-rhel6.list
deb http://download.openvz.org/debian wheezy main
# deb http://download.openvz.org/debian wheezy-test main
EOF
Yellowpin.svg Note: The second line with wheezy-test is commented out. This is a testing repo with newer kernels and possibly tools. Enable it if you want to stay on a bleeding edge of technology.

Import GPG key used for signing repository:

wget ftp://ftp.openvz.org/debian/archive.key
apt-key add archive.key

Update the local cache:

apt-get update

Kernel installation[edit]

Limited OpenVZ functionality is supported when you run a recent 3.x kernel (check vzctl for upstream kernel), so OpenVZ kernel installation is optional but still highly recommended.

# apt-get install linux-image-openvz-amd64

Or, if you still have i686:

# apt-get install linux-image-openvz-686

System configuration[edit]

Please make sure the following steps are performed before rebooting into OpenVZ kernel.

sysctl[edit]

There are a number of kernel parameters that should be set for OpenVZ to work correctly. These parameters are stored in /etc/sysctl.conf file. Here are the relevant portions of the file; please edit accordingly.

# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 1
net.ipv6.conf.default.forwarding = 1
net.ipv6.conf.all.forwarding = 1
net.ipv4.conf.default.proxy_arp = 0

# Enables source route verification
net.ipv4.conf.all.rp_filter = 1

# Enables the magic-sysrq key
kernel.sysrq = 1

# We do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

Tools installation[edit]

Before installing tools, please read about vzstats and opt-out if you don't want to help the project.

OpenVZ needs some user-level tools installed:

# apt-get install vzctl vzquota ploop vzstats

Reboot into OpenVZ kernel[edit]

Now reboot the machine and choose an entry with word "openvz" in the boot loader menu (it should be default choice).

Download OS templates[edit]

Yellowpin.svg Note: this step is optional, vzctl is able to download templates on demand.

An OS template is a Linux distribution installed into a container and then packed into a gzipped tarball. Using such a cache, a new container can be created in a minute.

Download precreated template caches from Downloads » Templates » Precreated, or directly from download.openvz.org/template/precreated, or from one of the mirrors. Put those tarballs as-is (no unpacking needed) to the /vz/template/cache/ directory.

Next steps[edit]

OpenVZ is now set up on your machine. Follow on to basic operations in OpenVZ environment document.

See also[edit]