Difference between revisions of "Installation on Debian 8"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(Download OS templates: ctcreate to ctctl)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
This document briefly describes the steps needed to install OpenVZ 6 (legacy) on your Debian 8 "Jessie" machine.
+
This is a guide to install OpenVZ 6 (legacy) on your [https://en.wikipedia.org/wiki/Devuan Devuan 1 "Jessie"] or Debian 8 "Jessie" machine (both amd64 or i386).
  
{{Out|Current commercial version of OpenVZ ([[Virtuozzo]] 7) is not installable on Debian GNU/Linux because is developed as an independent distribution}}
+
{{Out|Current commercial version of OpenVZ ([[Virtuozzo]] 7) is not installable on Devuan or Debian because is developed as an independent GNU/Linux distribution}}
  
== Requirements ==
+
= '''Volumes and file systems''' =
  
This guide assumes you are running '''Debian 8 "Jessie" ''' for '''AMD64''' or '''i686'''.
+
* It is recommended to use a separate partition for containers (by default '''/var/lib/vz''') and format it to '''ext4'''.
 +
* btrfs mounted filesystems cannot be formatted with modern features as: mixed-bg, extref, skinny-metadata, no-holes ([[Installation on Debian 9#btrfs|More details]]).
  
== Partitions and /vz file system ==
+
= '''Change Systemd to SystemV''' =
 
+
'''Only needed for Debian''' (Devuan already works with SystemV by default). '''Warning:''' This operation can make some desktop software to stop working.
It is recommended to use a separate partition for containers (by default '''/var/lib/vz''') and format it to '''ext4'''.
 
 
 
== Change Systemd to SystemV ==
 
 
 
{{Note|Warning! This operation can make some software to stop working, such as desktop environments.}}
 
  
 
  sudo apt-get install sysvinit-core sysvinit-utils
 
  sudo apt-get install sysvinit-core sysvinit-utils
  sudo apt-get remove systemd
+
# Must boot with SystemV to release Systemd
 +
sudo reboot
 +
  sudo apt-get --autoremove remove systemd
 +
echo -e 'Package: *systemd*\nPin: release *\nPin-Priority: -1\n' | sudo tee /etc/apt/preferences.d/avoid-systemd
  
* Other recipes at [http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation without-systemd.org]
+
* More recipes at [http://without-systemd.org/wiki/index.php/How_to_remove_systemd_from_a_Debian_jessie/sid_installation without-systemd.org]
  
== Register OVZ updated repository ==
+
= '''Register OVZ updated repository''' =
  
 
  RepoFile=/etc/apt/sources.list.d/openvz.list
 
  RepoFile=/etc/apt/sources.list.d/openvz.list
 
  RepoUrl=http://download.openvz.org/debian
 
  RepoUrl=http://download.openvz.org/debian
 
  echo "deb $RepoUrl jessie main" | sudo tee "$RepoFile"
 
  echo "deb $RepoUrl jessie main" | sudo tee "$RepoFile"
  echo "#deb $RepoUrl jessie-test main" | sudo tee "$RepoFile"
+
  echo "#deb $RepoUrl jessie-test main" | sudo tee -a "$RepoFile"
 
  echo "deb $RepoUrl wheezy main" | sudo tee -a "$RepoFile"
 
  echo "deb $RepoUrl wheezy main" | sudo tee -a "$RepoFile"
 
  wget -qO - http://ftp.openvz.org/debian/archive.key | sudo apt-key add -
 
  wget -qO - http://ftp.openvz.org/debian/archive.key | sudo apt-key add -
Line 31: Line 30:
  
 
{{Note|The second line with jessie-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.}}
 
{{Note|The second line with jessie-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.}}
{{Note|For more info about Debian repositories, see http://download.openvz.org/debian.}}
+
For more info about Debian repositories, see http://download.openvz.org/debian
  
== Install packages ==
+
= '''Install packages''' =
  
 
  KPackage="linux-image-openvz-$(dpkg --print-architecture)"
 
  KPackage="linux-image-openvz-$(dpkg --print-architecture)"
Line 44: Line 43:
 
  VE_STOP_MODE=stop
 
  VE_STOP_MODE=stop
  
== sysctl ==
+
* Only Devuan: link to be recognised as Debian
 +
if [ -f /etc/devuan_version ] ; then sudo ln -s /etc/devuan_version /etc/debian_version ; fi
  
There are a number of kernel parameters that should be set for OpenVZ to work correctly. These parameters are stored in <tt>/etc/sysctl.conf</tt> file. Here are the relevant portions of the file; please edit accordingly.
+
= '''Reboot into OpenVZ kernel''' =
  
<pre>
+
{{Note|At boot manager, in "Advanced options for Devuan GNU+Linux", you will find kernels named "2.6.32-openvz". Select the first listed.}}
# 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
 
</pre>
 
 
 
== Help the project ==
 
 
 
This is an OpenVZ component you can install to gather OpenVZ usage and hardware statistics, in order to improve the project.
 
 
 
sudo apt-get install vzstats
 
 
 
== Reboot into OpenVZ kernel ==
 
  
 
  sudo reboot
 
  sudo reboot
  
{{Note|If you don't see a boot manager entry with word "'''openvz'''", you must choose "'''Advanced options'''" to select there first ''openvz'' listed kernel.}}
+
Check the OpenVZ processes are running:
 
 
Check that the OpenVZ processes are running:
 
 
  sudo ps ax | grep -v 'grep' | grep 'vzmond'
 
  sudo ps ax | grep -v 'grep' | grep 'vzmond'
  
 
== Set OpenVZ as default to boot ==
 
== Set OpenVZ as default to boot ==
  
Because of GRUB2 default criteria, default kernel to boot can still be the one from Debian's repository (non OVZ). If you want to change this behaviour, once you've booted fine into OpenVZ kernel, you can remove other unuseful kernels:
+
Because of GRUB2 default criteria, default kernel to boot can still be the one from Devuan's repository (non OVZ). Probably you don't want this behaviour; once you've booted fine into OpenVZ kernel, you can remove other unuseful kernels:
  
 
  Packages="$(aptitude search ~i~nlinux-image- --display-format '%p' | grep -ve 'openvz')"
 
  Packages="$(aptitude search ~i~nlinux-image- --display-format '%p' | grep -ve 'openvz')"
  sudo apt-get remove $Packages
+
  sudo apt-get --autoremove remove $Packages
sudo apt-get autoremove
+
 
 +
(requires aptitude)
  
== Download OS templates ==
+
= Download OS templates =
  
 
This step is optional, vzctl is able to download templates on demand.
 
This step is optional, vzctl is able to download templates on demand.
  
An OS template is a Linux distribution installed into a container
+
An OS template is a GNU distribution for Linux, installed into a container
 
and then packed into a gzipped tarball. Using such a cache, a new container
 
and then packed into a gzipped tarball. Using such a cache, a new container
 
can be created in a minute.
 
can be created in a minute.
Line 104: Line 78:
 
  sudo vztmpl-dl --gpg-check debian-8.0-x86_64-minimal
 
  sudo vztmpl-dl --gpg-check debian-8.0-x86_64-minimal
  
Alternatively, you can also download precreated template caches from [http://openvz.org/download/template/cache Downloads » Templates » Precreated], or from one of the [https://mirrors.openvz.org/ mirrors]. Put those tarballs '''as-is (no unpacking needed)''' to the <tt>/vz/template/cache/</tt> directory.
+
Alternatives:
 +
* Download precreated template caches from [[Download/template/precreated|Download » Template » Precreated]] or from one of the [https://mirrors.openvz.org/ mirrors]. Put those tarballs '''as-is (no unpacking needed)''' to the <tt>/vz/template/cache/</tt> directory.
 +
* '''[https://downloads.actiu.net/ctctl/ ctctl]''' helper to create Debian (or derivative) container without template (caches it as a local template). This tool manages unprivileged LXC containers too.
  
== Next steps ==
+
= Next steps =
  
 
OpenVZ is now set up on your machine. Follow on to [[basic operations in OpenVZ environment]] document.
 
OpenVZ is now set up on your machine. Follow on to [[basic operations in OpenVZ environment]] document.
  
== See also ==
+
= See also =
* [[Installation on Debian 7]] very-old-stable (SystemV by default, supported)
+
* [[Installation on Debian 7]] very-old-stable (Wheezy, SystemV by default)
 
* [[Installation on Debian 9]]
 
* [[Installation on Debian 9]]
  
Line 117: Line 93:
 
[[Category: HOWTO]]
 
[[Category: HOWTO]]
 
[[Category: Debian]]
 
[[Category: Debian]]
 +
[[Category: Devuan]]

Latest revision as of 09:25, 28 January 2020

This is a guide to install OpenVZ 6 (legacy) on your Devuan 1 "Jessie" or Debian 8 "Jessie" machine (both amd64 or i386).

Current commercial version of OpenVZ (Virtuozzo 7) is not installable on Devuan or Debian because is developed as an independent GNU/Linux distribution

Volumes and file systems[edit]

  • It is recommended to use a separate partition for containers (by default /var/lib/vz) and format it to ext4.
  • btrfs mounted filesystems cannot be formatted with modern features as: mixed-bg, extref, skinny-metadata, no-holes (More details).

Change Systemd to SystemV[edit]

Only needed for Debian (Devuan already works with SystemV by default). Warning: This operation can make some desktop software to stop working.

sudo apt-get install sysvinit-core sysvinit-utils
# Must boot with SystemV to release Systemd
sudo reboot
sudo apt-get --autoremove remove systemd
echo -e 'Package: *systemd*\nPin: release *\nPin-Priority: -1\n' | sudo tee /etc/apt/preferences.d/avoid-systemd

Register OVZ updated repository[edit]

RepoFile=/etc/apt/sources.list.d/openvz.list
RepoUrl=http://download.openvz.org/debian
echo "deb $RepoUrl jessie main" | sudo tee "$RepoFile"
echo "#deb $RepoUrl jessie-test main" | sudo tee -a "$RepoFile"
echo "deb $RepoUrl wheezy main" | sudo tee -a "$RepoFile"
wget -qO - http://ftp.openvz.org/debian/archive.key | sudo apt-key add -
sudo apt-get update
Yellowpin.svg Note: The second line with jessie-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.

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

Install packages[edit]

KPackage="linux-image-openvz-$(dpkg --print-architecture)"
sudo apt-get --install-recommends install $KPackage vzdump ploop initramfs-tools
if [ ! -d /vz ] ; then sudo ln -s /var/lib/vz/ /vz ; fi
  • Create file /etc/vz/vznet.conf with the following line:
EXTERNAL_SCRIPT="/usr/sbin/vznetaddbr"
  • Optionally you can set containers completely stop when service stops at /etc/vz/vz.conf
VE_STOP_MODE=stop
  • Only Devuan: link to be recognised as Debian
if [ -f /etc/devuan_version ] ; then sudo ln -s /etc/devuan_version /etc/debian_version ; fi

Reboot into OpenVZ kernel[edit]

Yellowpin.svg Note: At boot manager, in "Advanced options for Devuan GNU+Linux", you will find kernels named "2.6.32-openvz". Select the first listed.
sudo reboot

Check the OpenVZ processes are running:

sudo ps ax | grep -v 'grep' | grep 'vzmond'

Set OpenVZ as default to boot[edit]

Because of GRUB2 default criteria, default kernel to boot can still be the one from Devuan's repository (non OVZ). Probably you don't want this behaviour; once you've booted fine into OpenVZ kernel, you can remove other unuseful kernels:

Packages="$(aptitude search ~i~nlinux-image- --display-format '%p' | grep -ve 'openvz')"
sudo apt-get --autoremove remove $Packages

(requires aptitude)

Download OS templates[edit]

This step is optional, vzctl is able to download templates on demand.

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

OpenvzKey="$(echo $(sudo gpg --batch --search-keys security@openvz.org 2>&1 | grep -ie ' key.*created' | sed -e 's|key|@|g' | cut -f 2 -d '@') | cut -f 1 -d ' ' | cut -f 1 -d ',')"
sudo gpg --recv-keys $OpenvzKey
sudo vztmpl-dl --gpg-check --list-remote
# Example:
sudo vztmpl-dl --gpg-check debian-8.0-x86_64-minimal

Alternatives:

  • Download precreated template caches from Download » Template » Precreated or from one of the mirrors. Put those tarballs as-is (no unpacking needed) to the /vz/template/cache/ directory.
  • ctctl helper to create Debian (or derivative) container without template (caches it as a local template). This tool manages unprivileged LXC containers too.

Next steps[edit]

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

See also[edit]