Install OpenVZ the perfect match for a development Environment

I recently discover OpenVZ and it appear that it is my most efficient development tool.

A development tool?

Yes it’s true you needs to setup a quick LAMP but you don’t have a
physical server to setup the hole thing and start working. There is nothing there, take one
of your old server that runs nothing and you know you can format and install a fresh copy of
Debian Squeeze, run a couple of command line and Voilà. You have a perfect destroyable
virtualization server to play with.

At the office I use an old Dell box something like  a Pentium 2.4 Ghz with 2.5 Gig of RAM
and I run 10 servers at the time without any problems. The reason is “it’s just Development”!
I don’t have anything critical on that box, so performance is not a matter but you would be so
surprise in a good way of the actual performance of this box. I have about 3-4 users using the
box for different purpose and now one is complaining about performance issue.

The main advantages I see with this box is, let say your boss come to your desk and tell you
something like: “We are thinking in adding an advertisement service like OpenX or any other
software that could give us this ability.” Your first though was, ok it’s easy I will download the
php software unzip it under a directory and there you go you have your OpenX installed. Yes it
is true, but on which LAMP do I set it, do I have to modify an existing server, could it cause any
problem? The easy  answer is use OpenVZ, add a virtual container running on the distribution
you are most confortable with install your LAMP and deploy your OpenX software. If the project
goes this will buy you some times on planning the installation of real server, otherwise if the idea
doesn’t go forward destroy the container and that’s it.

So my point was that with OpenVZ first you have a very good virtualization system, that give you the
possibility to install many Linux distribution running all on the same kernel, plus you can create,
update and delete any container has you which without having to reinstall everytime a physical machine.
This way you can deploy a test server or delete an old model you tried before.

To complete my post of the day here is my bash script to install OpenVZ on a fresh install of Debian Squeeze.
If you want to get help on installing a fresh copy of Debian follow this article from the Super Team at Howtoforge.com
The Perfect Server – Debian Squeeze (Debian 6.0)
(Notice: Stop after step 7, you don’t need anything else from this article to install OpenVZ. Just login on your server through SSH and run the script below.)

#!/bin/sh
# Install OpenVz
# Get some tools
apt-get install alien build-essential vim-nox nmon --yes
# Get the latest installation file for vzctl
cd
wget http://download.openvz.org/utils/vzquota/3.0.12/vzquota-3.0.12-1.i386.rpm
wget http://download.openvz.org/utils/vzctl/3.0.25.2/vzctl-3.0.25.2-1.i386.rpm
wget http://download.openvz.org/utils/vzctl/3.0.25.2/vzctl-lib-3.0.25.2-1.i386.rpm
cd /vz/template/cache
wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz
cd
# convert RPM to Deb
alien -k vzquota-3.0.12-1.i386.rpm
alien -k vzctl-3.0.25.2-1.i386.rpm
alien -k vzctl-lib-3.0.25.2-1.i386.rpm
# Install the Deb files
dpkg -i vzctl_3.0.25.2-1_i386.deb
dpkg -i vzctl-lib_3.0.25.2-1_i386.deb
dpkg -i vzquota_3.0.12-1_i386.deb
# Install openvz kernel
apt-get install linux-image-openvz-686 linux-image-2.6-openvz-686 --yes
# Copy this in /etc/sysctl.conf
echo "net.ipv4.conf.all.rp_filter=1" >> /etc/sysctl.conf
echo "net.ipv4.icmp_echo_ignore_broadcasts=1" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.forwarding=1" >> /etc/sysctl.conf
echo "net.ipv4.conf.default.proxy_arp = 0" >> /etc/sysctl.conf
echo "net.ipv4.ip_forward=1" >> /etc/sysctl.conf
echo "kernel.sysrq = 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.conf.eth0.proxy_arp=1" >> /etc/sysctl.conf
# Run the new configuration
sysctl -p
# Edit the vz settings
sed -i/NEIGHBOUR_DEVS/d” /etc/vz/vz.conf
echoNEIGHBOUR_DEVS=all” >>/etc/vz/vz.conf
# Start OpenVz on boot
update-rc.d vz defaults

Here we are now we can start creating a container but that is for another post.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Anti-Spam Quiz: