Rabu, 28 Januari 2015

How to Install Openvz on CentOs


CentOS is one of the most popular free and open source server operating systems. OpenVZ is a popular open source system for creating virtual private servers. Combine the two together, and you have a low-cost yet powerful VPS system. The following is a brief installation guide to get OpenVZ running on CentOS.

Add the OpenVZ repository to Yum:

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

Edit openvz.repo and disable the [openvz-kernel-rhel5] repository (enabled=0) and enable the [openvz-kernel-rhel6] repository.

Install the OpenVZ kernel:

Search using:
#yum search vzkernel

Choose the kernel you want and install:
yum install vzkernel

(This should automatically update Grub to your new kernel. If not, you may need to manually edit your grub configuration).

Install OpenVZ user tools:

#yum install vzctl vzquota

Edit /etc/sysctl.conf and ensure you have these settings:
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

If your IP addresses for your virtual machines will be on a different subnet than your host machine, you need to make sure you have this in /etc/vz/vz.conf:

NEIGHBOUR_DEVS=all

Disable SELinux bye editing /etc/sysconfig/selinux:

# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
SELINUX=disabled

Reboot

You should now have a working OpenVZ installation. You should then test it to verify that the kernel is running and that you are able to create containers.

Tidak ada komentar:

Posting Komentar