Hello everybody, In today's article we are going to show you the installation process of OpenVZ on Ubuntu 15.04. OpenVZ, is an open Source operating-system-level virtualization platform that provides a thin layer of virtualization on top of the underlying Operating System. It allows a physical server to run multiple isolated operating system instances, called containers, virtual private servers (VPSs), or virtual environments (Ves). The kernel used in OpenVZ is a Linux based kernel that is modified to add support for its containers. This modified linux kernel provides virtualization, isolation, checkpoints and resources management.
So, using OpenVZ Virtualization environment each virtual machine will efficiently share the CPU, Memory, Disk space, and network of your Physical server.
1) Prerequisites Check
In this tutorial we are going to setup OpenVZ on Ubuntu 15.04 64-Bit Operating System with minimal software packages installed on it.
The hardware resources depends upon the size of your infrastructure requirements while its minimum requirements of RAM is about 128 MB with atleast 4GB of free disk space. So, we are working on our test lab environment with following mentioned resources.
RAM: 2 GB
CPU: 2 CPUs
Disk: 20 GB
Static IP: xx.xx.xx.xx
2) Adding OpenVZ Repository
Once you are done with initial setup of your ubuntu server and are connected with the internet, login with root or sudo credentials and run the below command to add OpenVZ repository to your ubuntu server.
# cat < /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
Now we can directly download its key with below command.
# wget http://ftp.openvz.org/debian/archive.key
Once the import is complete, run the below command to add the imported archive key with below command.
# apt-key add archive.key
3) Installing OpenVZ Kernel
Before installing the OpenVZ kernel, let's update your system with latest updates and patches by running the following command.
# apt-get update
Now we are going to install OpenVZ kernel by running the below command for 64-bit operating system as shown.
# apt-get install linux-image-openvz-amd64
The OpenVZ installation process will ends up with grub configurations as show.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.0-15-generic
Found initrd image: /boot/initrd.img-3.19.0-15-generic
Found linux image: /boot/vmlinuz-2.6.32-openvz-042stab111.11-amd64
Found initrd image: /boot/initrd.img-2.6.32-openvz-042stab111.11-amd64
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
Setting up linux-image-openvz-amd64 (042stab111.11) ...
4) Configure Kernel Parameters
To configure the new kernel parameters on ubuntu we will change the sysctl variables in /etc/sysctl.conf file with some number lines as shown.
so, Open the file using your editor to configure the kernel parameters on it.
# vim /etc/sysctl.conf
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
After saving the changes close file and run the following command to apply the sysctl changes.
# sysctl -p
5) Installing OpenVZ Tools
Its a quite practice to install some user-level tools on OpenVZ before using it. vzstats is a tool that will helps your to gather OpenVZ usage statistics and vzquota will be used to assist in managing disk quota.
To install these tools simply run the following command in your ssh session.
# apt-get install vzctl vzquota ploop vzstat
6) Booting OpenVZ Kernel
At this point we are done with the initial setup of OpenVZ installation and its kernel parameters configurations. Now the only need left is to reboot your system and choose the OpenVZ kernel from the grub boot loader options.
So, after rebootng your system choose the Advance options for Ubuntu as shown in below image.
In the next window you will see all the latest and previously installed kernel versions including the OpenVZ, so here we change our required kernel to start OpenVZ.
Once your server is back with OpenVZ Virtualization kernel, make sure to configure the default configuration file of OpenVZ to make changes in the if required other than its default.
The default configuration file of OpenVZ can be found in the following location.
# vi /etc/vz/vz.conf
In this Linux howto tutorial we have learned the installation of OpenVZ on "Ubuntu Server" as a host where we can create multiple virtual Linux servers. While each new Linux VM in OpenVZ is isolated from the host and from each other. The virtualization technique used in OpenVZ does not use hardware virtualization like KVM, XEN or VMware. We hope hope you are now much more familiar with OpenVZ Virtualization and its setup on Ubuntu. So, feel free to get back to us in case of any difficulty.
You might also like
Category: UBUNTU HOWTO