Saturday, 12 March 2016

INSTALL OPENVZ ON CENTOS 6.4



PARTITIONING:

Assume, I am using 1TB HDD. If you have very less disk space, Then set /boot 300M; / 10G ; swap 4G and rest of the space for /vz.

/boot    500M [Set It Primary Partion.]
/    100G
swap    16G
/vz    Remaning all
xxxx    20G

INSTALLING:

    ]# yum update -y
    ]# yum install wget vim
    ]# cd /etc/yum.repos.d/
    ]# wget http://download.openvz.org/openvz.repo
    ]# rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ
    ]# cd
    ]# mkdir download
    ]# cd download
    ]# wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab072.10/vzkernel-2.6.32-042stab072.10.x86_64.rpm
    ]# rpm -ivh vzkernel-2.6.32-042stab072.10.x86_64.rpm

[Alternet for above 2 steps : yum search vzkernel; yum install vzkernel ]

    ]# cp -rvp /etc/sysctl.conf /etc/sysctl.conf-bak
    ]# vim /etc/sysctl.conf
[Delete all lines and copy/paste contents of sysctl.conf from TLV10 etc.]
:wq

[Alternet for above step.]
---------------------------------------------------------------------------------------------------
]# vim /etc/sysctl.conf [Insure parameters are set as below.]

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


or



# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 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
# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 1

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

# Controls the use of TCP syncookies
net.ipv4.tcp_syncookies = 1

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-arptables = 0

# Controls the default maxmimum size of a mesage queue
kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes
kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes
kernel.shmmax = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296


:wq


# sysctl -p

---------------------------------------------------------------------------------------------------

    NOTE: The following step is important if the IP addresses of your virtual machines are from a different subnet than the host system's IP address. If you don't do this, networking will not work in the virtual machines!

]# vim /etc/sysconfig/selinux
       SELINUX=disabled   
    :wq

]# reboot

Now, make sure openvz kernel is booting by default in "/boot/grub/grub.conf" file.

    ]# uname -a
    ]# yum install vzctl vzquota
    ]# service vz start
    ]# chkconfig vz on
    ]# mkdir downloads


]# vim /etc/vz/vz.conf
       [...]
       NEIGHBOUR_DEVS=all
       [...]
    :wq
       


    ]# cd downloads/
    ]# ls
    ]# rpm -ivh cstream-2.7.4-3.el6.rf.x86_64.rpm
    ]# yum install perl
    ]# rpm -ivh perl-LockFile-Simple-0.207-1.el6.rf.noarch.rpm
    ]# ls
    ]# rpm -ivh vzdump-1.2-5.noarch.rpm
    ]# cd

Download Link:

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

For vzdump:
wget http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm


cd /vz/template/cache
wget http://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz

No comments: