Welcome to 96MB, please Login or Create an account to get full access to the forums.
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to install OpenVZ

Offline jarland Posted 03-25-2013, 11:28 PM -
Post: #1
Moderator
52 Posts
Reputation: 3
This is a bash script to install OpenVZ on a dedicated server running CentOS 6. I stole this from github and remove some of the excess. I also combined it with some of Tim's (from Hostigation) cent6.sh script. This sits in my personal collection of scripts. No harm in taking the easy way out on a task that can get repetitive.

Code:
#!/bin/bash
yum update -y
yum install -y wget
cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum install -y vzkernel.x86_64
yum install -y vzctl vzquota
sed -i 's/kernel.sysrq = 0/kernel.sysrq = 1/g' /etc/sysctl.conf
sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf
echo 'net.ipv4.conf.default.proxy_arp = 0' >> /etc/sysctl.conf
echo 'net.ipv4.conf.all.rp_filter = 1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.send_redirects = 1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.all.send_redirects = 0' >> /etc/sysctl.conf
echo 'net.ipv4.icmp_echo_ignore_broadcasts=1' >> /etc/sysctl.conf
echo 'net.ipv4.conf.default.forwarding=1' >> /etc/sysctl.conf
sysctl -p
sed -i 's/NEIGHBOUR_DEVS=detect/NEIGHBOUR_DEVS=all/g' /etc/vz/vz.conf
sed -i 's/SELINUX=enabled/SELINUX=disabled/g' /etc/sysconfig/selinux
cd /vz/template/cache
wget http://download.openvz.org/template/precreated/centos-6-x86_64.tar.gz
yum install -y ntp
ntpdate -u us.pool.ntp.org
chkconfig ntpd on
service iptables stop
service ip6tables stop
chkconfig iptables off
chkconfig ip6tables off
(This post was last modified: 03-25-2013, 11:29 PM by jarland.)
Back to top Find Quote
Offline matthewvz Posted 03-26-2013, 04:45 PM -
Post: #2
Junior Member
23 Posts
Reputation: 0
Very nice!
Back to top WWW Find Quote
Offline coreymanshack Posted 05-07-2013, 10:10 AM -
Post: #3
Member
79 Posts
Reputation: 0
Thank you. I've been meaning to add this to my scripts and this post just prompted me to do exactly that. Although - why turn off iptables?
(This post was last modified: 05-07-2013, 10:11 AM by coreymanshack.)
Back to top Find Quote
Offline jarland Posted 05-27-2013, 02:29 PM -
Post: #4
Moderator
52 Posts
Reputation: 3
(05-07-2013, 10:10 AM)coreymanshack Wrote: Thank you. I've been meaning to add this to my scripts and this post just prompted me to do exactly that. Although - why turn off iptables?

Right after install on a CentOS 6 system, iptables will block forwarding. This could be solved with:
iptables -D FORWARD 1

Some people also prefer not to use iptables, so it just gives you a clean slate to figure out what you want to do.
Back to top Find Quote


Forum Jump:

User(s) browsing this thread
1 Guest(s)

© 2012 96MB

Community software by MyBB

Premium Theme by ThemeFreak