Installing And Using OpenVZ On Debian Wheezy (AMD64) - Page 3

2.3 Installing From Proxmox Packages

Add the following line to /etc/apt/sources.list:

vi /etc/apt/sources.list
[...]
# PVE packages provided by proxmox.com
deb http://download.proxmox.com/debian wheezy pve

Add the Proxmox key to apt:

wget -O- "http://download.proxmox.com/debian/key.asc" | apt-key add -

Update the packages database:

apt-get update && apt-get dist-upgrade

Install the OpenVZ kernel, vzctl, and vzquota as follows:

apt-get install pve-firmware pve-kernel-2.6.32-20-pve vzctl vzquota vzprocps

Next we have to make sure that the correct kernel (the OpenVZ kernel) is booted when you restart the system. In the output of the last command, you should see something like this:

Setting up pve-firmware (1.0-22) ...
Setting up pve-kernel-2.6.32-20-pve (2.6.32-100) ...
update-initramfs: Generating /boot/initrd.img-2.6.32-20-pve
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-3.2.0-4-amd64
Found initrd image: /boot/initrd.img-3.2.0-4-amd64
Found linux image: /boot/vmlinuz-2.6.32-20-pve
Found initrd image: /boot/initrd.img-2.6.32-20-pve
done

This means there is also another kernel on the system (3.2.0), and the openVZ kernel (2.6.32) is not the first in the list. So to make the OpenVZ kernel the default kernel, we have two options - adjust the default kernel in GRUB (recommended) or remove the non-VZ kernel(s).

To adjust the default kernel in GRUB, open /etc/default/grub...

vi /etc/default/grub

... and modify the GRUB_DEFAULT line (counting starts with 0; because each kernel comes also with a recovery mode, our OpenVZ kernel is the third kernel, so we need to put in 2 here):

[...]
GRUB_DEFAULT=2
[...]

Update GRUB afterwards:

update-grub

To remove the default kernel, run...

apt-get remove linux-image-amd64 linux-image-3.2.0-4-amd64

... and update GRUB:

update-grub

Now that we have made sure the correct kernel will boot, we can go on.

Create a symlink from /var/lib/vz to /vz to provide backward compatibility:

ln -s /var/lib/vz /vz

Open /etc/sysctl.conf and make sure that you have the following settings in it:

vi /etc/sysctl.conf
[...]
net.ipv4.conf.all.rp_filter=1
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.default.forwarding=1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.ip_forward=1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.eth0.proxy_arp=1
[...]

If you need to modify /etc/sysctl.conf, run

sysctl -p 

afterwards.

The following step is important if the IP addresses of your virtual machines are from a different subnet than the host system's IP address. If you don't do this, networking will not work in the virtual machines!

Open /etc/vz/vz.conf and set NEIGHBOUR_DEVS to all:

vi /etc/vz/vz.conf
[...]
# Controls which interfaces to send ARP requests and modify APR tables on.
NEIGHBOUR_DEVS=all
[...]

Install vzdump:

apt-get install vzdump

Finally, reboot the system:

reboot

If your system reboots without problems, then everything is fine!

Run

uname -r

and your new OpenVZ kernel should show up:

root@server1:~# uname -r
2.6.32-20-pve
root@server1:~#

Now create the following configuration templates for OpenVZ containers:

vi /etc/vz/conf/ve-basic.conf-sample
#  Copyright (C) 2000-2011, Parallels, Inc. All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

# UBC parameters (in form of barrier:limit)
KMEMSIZE="14372700:14790164"
LOCKEDPAGES="2048:2048"
PRIVVMPAGES="65536:69632"
SHMPAGES="21504:21504"
NUMPROC="240:240"
PHYSPAGES="0:unlimited"
VMGUARPAGES="33792:unlimited"
OOMGUARPAGES="26112:unlimited"
NUMTCPSOCK="360:360"
NUMFLOCK="188:206"
NUMPTY="16:16"
NUMSIGINFO="256:256"
TCPSNDBUF="1720320:2703360"
TCPRCVBUF="1720320:2703360"
OTHERSOCKBUF="1126080:2097152"
DGRAMRCVBUF="262144:262144"
NUMOTHERSOCK="360:360"
DCACHESIZE="3409920:3624960"
NUMFILE="9312:9312"
AVNUMPROC="180:180"
NUMIPTENT="128:128"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="2G:2.2G"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="1000"
vi /etc/vz/conf/ve-light.conf-sample
#  Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

# UBC parameters (in form of barrier:limit)
# Primary parameters
AVNUMPROC="15:15"
NUMPROC="40:40"
NUMTCPSOCK="40:40"
NUMOTHERSOCK="40:40"
VMGUARPAGES="1725:unlimited"
# Secondary parameters
KMEMSIZE="1740800:1847296"
TCPSNDBUF="159744:262144"
TCPRCVBUF="159744:262144"
OTHERSOCKBUF="135168:237568"
DGRAMRCVBUF="135168:196608"
OOMGUARPAGES="1725:unlimited"
# Auxiliary parameters
LOCKEDPAGES="4:4"
SHMPAGES="1152:1152"
PRIVVMPAGES="7680:8448"
NUMFILE="512:512"
NUMFLOCK="50:60"
NUMPTY="4:4"
NUMSIGINFO="256:256"
DCACHESIZE="196608:202752"

PHYSPAGES="0:unlimited"
NUMIPTENT="16:16"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="1G:1.1G"
DISKINODES="80000:88000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="250"
vi /etc/vz/conf/ve-unlimited.conf-sample
#  Copyright (C) 2000-2008, Parallels, Inc. All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

# UBC parameters (in form of barrier:limit)
# Primary parameters
AVNUMPROC="unlimited"
NUMPROC="unlimited"
NUMTCPSOCK="1801439850948198"
NUMOTHERSOCK="1801439850948198"
VMGUARPAGES="unlimited"
# Secondary parameters
KMEMSIZE="unlimited"
#TCPSNDBUF="2147483647:2147483647"
TCPSNDBUF="4611686018427387903:9223372036854775807"
TCPRCVBUF="4611686018427387903:9223372036854775807"
OTHERSOCKBUF="4611686018427387903:9223372036854775807"
DGRAMRCVBUF="unlimited"
OOMGUARPAGES="unlimited"
# Auxiliary parameters
LOCKEDPAGES="unlimited"
SHMPAGES="unlimited"
PRIVVMPAGES="unlimited"
NUMFILE="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
DCACHESIZE="unlimited"

PHYSPAGES="0:unlimited"
NUMIPTENT="unlimited"

# Disk quota parameters (in form of softlimit:hardlimit)
DISK_QUOTA="no"
vi /etc/vz/conf/ve-vswap-1024m.conf-sample
#  Copyright (C) 2000-2011, Parallels, Inc. All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

# This config is valid for VSwap-enabled kernel (which currently means
# any RHEL6-based kernel, i.e. 042test* or 042stab*).

# UBC parameters (in form of barrier:limit)
PHYSPAGES="0:1G"
SWAPPAGES="0:2G"
KMEMSIZE="466M:512M"
DCACHESIZE="233M:256M"
LOCKEDPAGES="512M"
PRIVVMPAGES="unlimited"
SHMPAGES="unlimited"
NUMPROC="unlimited"
VMGUARPAGES="0:unlimited"
OOMGUARPAGES="0:unlimited"
NUMTCPSOCK="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
TCPSNDBUF="unlimited"
TCPRCVBUF="unlimited"
OTHERSOCKBUF="unlimited"
DGRAMRCVBUF="unlimited"
NUMOTHERSOCK="unlimited"
NUMFILE="unlimited"
NUMIPTENT="unlimited"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="2G:2.2G"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="1000"
vi /etc/vz/conf/ve-vswap-256m.conf-sample
#  Copyright (C) 2000-2011, Parallels, Inc. All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

# This config is valid for VSwap-enabled kernel (which currently means
# any RHEL6-based kernel, i.e. 042test* or 042stab*).

# UBC parameters (in form of barrier:limit)
PHYSPAGES="0:256M"
SWAPPAGES="0:512M"
KMEMSIZE="116M:128M"
DCACHESIZE="58M:64M"
LOCKEDPAGES="128M"
PRIVVMPAGES="unlimited"
SHMPAGES="unlimited"
NUMPROC="unlimited"
VMGUARPAGES="0:unlimited"
OOMGUARPAGES="0:unlimited"
NUMTCPSOCK="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
TCPSNDBUF="unlimited"
TCPRCVBUF="unlimited"
OTHERSOCKBUF="unlimited"
DGRAMRCVBUF="unlimited"
NUMOTHERSOCK="unlimited"
NUMFILE="unlimited"
NUMIPTENT="unlimited"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="2G:2.2G"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="1000"
vi /etc/vz/conf/ve-vswap-512m.conf-sample
#  Copyright (C) 2000-2011, Parallels, Inc. All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#

# This config is valid for VSwap-enabled kernel (which currently means
# any RHEL6-based kernel, i.e. 042test* or 042stab*).

# UBC parameters (in form of barrier:limit)
PHYSPAGES="0:512M"
SWAPPAGES="0:1G"
KMEMSIZE="233M:256M"
DCACHESIZE="116M:128M"
LOCKEDPAGES="256M"
PRIVVMPAGES="unlimited"
SHMPAGES="unlimited"
NUMPROC="unlimited"
VMGUARPAGES="0:unlimited"
OOMGUARPAGES="0:unlimited"
NUMTCPSOCK="unlimited"
NUMFLOCK="unlimited"
NUMPTY="unlimited"
NUMSIGINFO="unlimited"
TCPSNDBUF="unlimited"
TCPRCVBUF="unlimited"
OTHERSOCKBUF="unlimited"
DGRAMRCVBUF="unlimited"
NUMOTHERSOCK="unlimited"
NUMFILE="unlimited"
NUMIPTENT="unlimited"

# Disk quota parameters (in form of softlimit:hardlimit)
DISKSPACE="2G:2.2G"
DISKINODES="200000:220000"
QUOTATIME="0"

# CPU fair scheduler parameter
CPUUNITS="1000"
Share this page:

0 Comment(s)