Install Openvz on Scientific Linux 6.x (RHEL 6.x)

This how-to covers the installation of OpenVZ with the RHEL6 kernel on a headless “Basic Server” version of Scientific Linux (SL) 6.x. The Scientific Linux distribution is basically Redhat Enterprise Linux 6, recompiled from source.  This doc assumes that you already have a properly working installation of Scientific Linux.

For installation help with Scientific Linux, their site has a good step-by-step install guide here:
www.scientificlinux.org/distributions/6x/installing/install-guide-full.html

So, after SL6 has been installed, it’s time to install OpenVZ.

As root, download the yum repo for OpenVZ

# cd /etc/yum.repos.d
# wget http://download.openvz.org/openvz.repo

Import the GPG key
# rpm –import  http://download.openvz.org/RPM-GPG-Key-OpenVZ

You need to modify the default openvz.repo file to enable the RHEL6 OpenVZ kernel.  The default openvz.repo enables the RHEL5 kernel.

# nano /etc/yum.repos.d/openvz.repo

On line 20 (or so) under the [openvz-kernel-rhel5] branch, disable the RHEL5 repo:
Change “enabled=1″ to “enabled=0″

On line 50 under the [openvz-kernel-rhel6] development branches, enable the RHEL6 repo:
Change “enabled=0″ to “enabled=1″

Save and exit.

We also want to exclude updating the SL6 kernel since we will be using the OpenVZ kernels from here on out.  Add the following line to the “sl.repo and sl-update.repo files (located in /etc/yum.repos.d/

exclude=kernel kernel-smp kernel-enterprise

Save and update your server.
# yum update

Install the OpenVZ kernel
# yum install vzkernel

Note: This will also install vzquota and vzctl as dependencies.

Reboot system to apply the new kernel

Modify the grub menu.lst to reflect the OpenVZ kernel
# nano /boot/grub/menu.lst

For example, change the title “Scientific Linux (2.6.32-042stab021.1)” to”OpenVZ: Scientific Linux (2.6.32-042stab021.1)”

Exit and save.

Modify the sysctl.conf file.  Append the following (in italics):

# 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

Save the file and apply the modified configuration.
# sysctl -p

Disable SELinux
# nano /etc/sysconfig/selinux

Change “SELINUX=enforcing” to “SELINUX=disabled”

We will also want to be able to backup (dump) and restore our virtual environments, so we’ll need to install vzdump.

Vzdump has two dependencies, cstream and perl-LockFile-Simple.
You can either install these each by hand or install them via RPMforge repo.

To install the vzdump dependencies by hand (as root):

# cd
# wget http://pkgs.repoforge.org/cstream/cstream-2.7.4-3.el6.rf.i686.rpm
# wget http://pkgs.repoforge.org/perl-LockFile-Simple/perl-LockFile-Simple-0.207-1.el6.rf.noarch.rpm

# rpm -ivh cstream-2.7.4-3.el6.rf.i686.rpm
# rpm -ivh perl-LockFile-Simple-0.207-1.el6.rf.noarch.rpm

To install the vzdump dependencies via RPMForge repo:

Download  and install the RHEL6 RPMForge release:
#wget http://apt.sw.be/redhat/el6/en/i386/rpmforge/RPMS/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
# rpm -i  rpmforge-release-0.5.2-2.el6.rf.i686.rpm

Import the gpg key:
# wget http://apt.sw.be/RPM-GPG-KEY.dag.txt
# rpm –import RPM-GPG-KEY.dag.txt

Update
# yum update

Install the dependencies for vzdump:
# yum install perl-LockFile-Simple cstream

Now, download and install vzdump:
# wget http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm
# rpm -ivh vzdump-1.2-4.noarch.rpm

Done.  Now you have nice shiny RHEL6 based OpenVZ Host.

3 comments to Install Openvz on Scientific Linux 6.x (RHEL 6.x)

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>