Sunday, September 6th, 2009
Here are commands to help adjust the RAM for an OpenVZ VPS:
64MB Guaranteed, 128MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages $((64 * 64)) --save
vzctl set ${cid} --privvmpages $((64 * 128)) --save
256MB Guaranteed, 512MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages $((256 * 256)) --save
vzctl set ${cid} --privvmpages $((256 * 512)) --save
512MB Guaranteed, 1024MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages $((512 * 512)) --save
vzctl set ${cid} --privvmpages $((512 * 1024)) --save
1024MB Guaranteed, 2048MB Burstable
cid=1000
vzctl set ${cid} --vmguarpages $((1024 * 1024)) --save
vzctl set ${cid} --privvmpages $((1024 * 2048)) --save
Sunday, September 6th, 2009
I still use a lot of NFS connections on my equipment and when I create OpenVZ VPS systems I need them to have access to NFS. Here are the steps I use:
From the Host Node (HN):
modprobe nfs
vzctl set 101 --features "nfs:on" --save
From the VPS:
yum -y install nfs-utils nfs-utils-lib
chkconfig --levels 345 portmap on
/etc/init.d/portmap start
Sunday, September 6th, 2009
Here is my quick-and dirty way to build DNS servers using OpenVZ, CentOS and Bind/Named. This assumes you are creating a new server via OpenVZ. Although Bind is easy to admin with the configuration files recently I have found it is easier to simply admin the zones with Webmin. This setup will create the VPS, install Bind and install Webmin.
Create the VPS:
cid=1161
cd /vz/template/cache/
wget http://download.openvz.org/template/precreated/centos-5-x86_64.tar.gz
vzctl create ${cid} --ostemplate centos-5-x86_64 --config vps.basic
vzctl set ${cid} --hostname [HOSTNAMEHERE] --save
vzctl set ${cid} --ipadd [IP] --save
vzctl set ${cid} --nameserver [IP] --save
vzctl start ${cid}
vzctl exec ${cid} passwd
vzctl enter ${cid}
From inside the VPS I install bind and webmin
yum -y install bind bind-chroot bind-libs bind-utils caching-nameserver
cd /root
wget http://prdownloads.sourceforge.net/webadmin/webmin-1.480-1.noarch.rpm
rpm -Uvh webmin-1.480-1.noarch.rpm
Now I simply visit webmin’s panel and tap in any new zones (or copy over our zones from another box).
OpenVZ and virtual serving makes this time-consuming task of bringing new boxes up a simple task!
Saturday, September 5th, 2009
There are a few tutorials out there on installing OpenVZ in CentOS 5.3. Here are the steps I use to install OpenVZ on a brand new installation of CentOS 5.3:
Note: this tutorial / walkthrough is for use 64 bit only
- Update the box via yum
- Install the OpenVZ Repository and grab the GPG key
- Install OpenVZ
- Install OpenVZ Controller and Quota system
- Configure the local system for the OpenVZ kernel
- Update OpenVZ’s ARP Settings
- Disable SELINUX
- Reboot
yum -y update
cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum -y install ovzkernel.x86_64
yum -y install vzctl.x86_64 vzquota.x86_64
Now; we need to configure the sysctl.conf file for OpenVZ
perl -pi -e 's/net\.ipv4\.ip_forward = 0/net\.ipv4\.ip_forward = 1/' /etc/sysctl.conf
perl -pi -e 's/kernel\.sysrq = 0/kernel\.sysrq = 1/' /etc/sysctl.conf
echo -e "\n\nnet.ipv4.conf.default.proxy_arp = 0\nnet.ipv4.conf.all.rp_filter = 1\nnet.ipv4.conf.default.send_redirects = 1\nnet.ipv4.conf.all.send_redirects = 0\nnet.ipv4.icmp_echo_ignore_broadcasts=1\nnet.ipv4.conf.default.forwarding=1\nkernel.ve_allow_kthreads=1\n" >> /etc/sysctl.conf
perl -pi -e 's/NEIGHBOUR_DEVS=detect/NEIGHBOUR_DEVS=all/' /etc/vz/vz.conf
Disable SELINUX
vi /etc/sysconfig/selinux
Reboot the machine