≡ Menu

Step by Step Installation & Settings OpenVZ on CentOS

1. Before starting the installation of OpenVZ OpenVZ add the first repo to yum configuration (installation using yum).

cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ

2. OpenVZ repository has several different kernel versions, (for more details check here: http://wiki.openvz.org/Kernel_flavors ), or use the command:

yum search ovzkernel

Here’s an example of the output

[[email protected] yum.repos.d]# yum search ovzkernel
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* Base: ftp.halifax.rwth-aachen.de
* OpenVZ kernel-RHEL5: openvz.proserve.nl
* updates: ftp.halifax.rwth-aachen.de
* addons: ftp.halifax.rwth-aachen.de
* openvz-utils: openvz.proserve.nl
* Extras: ftp.halifax.rwth-aachen.de
openvz-kernel-rhel5 100% |=========================| 951 B 00:00
primary.xml.gz 100% |=========================| 22 kB 00:00
openvz-ker: ################################################## 14/14
openvz-utils 100% |=========================| 951 B 00:00
primary.xml.gz 100% |=========================| 6.7 kB 00:00
openvz-uti: ################################################## 26/26
ovzkernel-ent.i686 : The Linux kernel compiled for huge mem capable machines.
ovzkernel-PAE.i686 : The Linux kernel compiled for PAE capable machines.
ovzkernel-ent-devel.i686 : Development package for building kernel modules to match the ent kernel.
ovzkernel-PAE-devel.i686 : Development package for building kernel modules to match the PAE kernel.
ovzkernel.i686 : Virtuozzo Linux kernel (the core of the Linux operating system)
ovzkernel-xen.i686 : The Linux kernel compiled for Xen VM operations
ovzkernel-xen-devel.i686 : Development package for building kernel modules to match the kernel.
ovzkernel-devel.i686 : Development package for building kernel modules to match the kernel.
[[email protected] yum.repos.d]#

3. Select an appropriate version of the OpenVZ kernel handle links by your machine. Then install

yum install ovzkernel

The installation process should automatically updates the GRUB bootloader settings. Make sure the new settings have been added, go to the settings of the bootloader with your favorite text editor (I use nano),

nano /boot/grub/menu.lst

for example setting its GRUB bootloader like the following :

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS OpenVZ (2.6.18-53.1.19.el5.028stab053.14)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-53.1.19.el5.028stab053.14 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-53.1.19.el5.028stab053.14.img
title CentOS (2.6.18-92.1.1.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.1.1.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-92.1.1.el5.img
title CentOS (2.6.18-92.el5)
        root (hd0,0)
        kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00
        initrd /initrd-2.6.18-92.el5.img

4. Next install some additional tools for OpenVZ users

yum install vzctl vzquota

5. Open /etc/sysctl.conf

nano /etc/sysctl.conf

make sure it is setting like the following:

[...]
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
kernel.sysrq = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts=1
net.ipv4.conf.default.forwarding=1
[...]

To modify sysctl settings, use the command

sysctl -p

Important : This step is very important, if we are different ip virtual machine with the IP subnet the host system. If it does not perform the following steps networking will not work on the virtual machine we just created.

6. Buka /etc/vz/vz.conf dan set NEIGHBOUR_DEVS ke all:

nano /etc/vz/vz.conf

for Seting NEIGHBOUR_DEVS

[...]
NEIGHBOUR_DEVS=all
[...]

7. OpenVZ mengharus disable SELinux in condition. Open /etc/sysconfig/selinux and set the value of SELinux to disabled.

nano /etc/sysconfig/selinux

for Seting SELinux:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

8. Reboot the system

reboot

9. Up here, if the process does not appear reboot error, means that OpenVZ installation process has been completed and successful.

10. Check to make sure OpenVZ OpenVZ kernel has been installed properly.

uname -r

for Kernel OpenVZ installed:

[[email protected] ~]# uname -r
2.6.18-53.1.19.el5.028stab053.14
[[email protected] ~]#

11. There is no step to eleven, please oprek oprek own-though more striking

credit: http://www.howtoforge.com/installing-and-using-openvz-on-centos5.2

{ 0 comments… add one }

Leave a Comment

CAPTCHA
*