How to install OpenVZ under CentOS4.6_x86_64

We have three Servers installed CentOS4.6_x86_64, for special usage, I installed OpenVZ on these servers, and the following is the note I took when I tried to install OpenVZ.

# cd /etc/yum.repos.d
# wget http://download.openvz.org/openvz.repo
# rpm –import http://download.openvz.org/RPM-GPG-Key-OpenVZ
# yum install ovzkernel.x86_64
Note : When using a 64-bit processor and operating system, you need only select the SMP or non-SMP version. 64-bit linux can access the entire 64Gb of ram in ZONE_NORMAL (low memory). PAE and 4GB/4GB splitting are only needed for 32-bit OS, and so are not necessary and are disabled by default in 64-bit kernels.

when yum update or yum install ovzkernel.x86_64, maybe you will meet this error,

–> Running transaction check
–> Processing Conflict: lksctp-tools conflicts kernel >= 2.6.10
–> Finished Dependency Resolution
Error: lksctp-tools conflicts with kernel >= 2.6.10

You may need to remove the lksctp rpm (#rpm -e lksctp-tools) if you’re still stuck in a dependency loop.

After successfully installed ovzkernel.x86_64, the default boot kernel would be set to
title CentOS (2.6.18-92.1.13.el5.028stab059.6)
if not, please modify default parameter.

modify /boot/grub/menu.list
title CentOS (2.6.18-92.1.13.el5.028stab059.6)
root (hd0,2)
kernel /vmlinuz-2.6.18-92.1.13.el5.028stab059.6 ro root=/dev/VolGroup00/LogVol00
initrd /initrd-2.6.18-92.1.13.el5.028stab059.6.img

to
title OpenVZ(2.6.18-92.1.13.el5.028stab059.6)
root (hd0,2)
kernel /vmlinuz-2.6.18-92.1.13.el5.028stab059.6 ro root=/dev/VolGroup00/LogVol00

initrd /initrd-2.6.18-92.1.13.el5.028stab059.6.img

modify /etc/sysctl.conf

# 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

modify /etc/sysconfig/selinux:
SELINUX=disabled

reboot into openvz kernel

#yum install vzctl.x86_64 vzquota.x86_64
#service vz start
#chkconfig vz on

References:
http://wiki.openvz.org/Quick_installation
http://www.howtoforge.org/installing-and-using-openvz-on-centos5.2-p2

Leave a Reply