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/22.214.171.124/vzctl-126.96.36.199-1.i386.rpm wget http://download.openvz.org/utils/vzctl/188.8.131.52/vzctl-lib-184.108.40.206-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-220.127.116.11-1.i386.rpm alien -k vzctl-lib-18.104.22.168-1.i386.rpm # Install the Deb files dpkg -i vzctl_22.214.171.124-1_i386.deb dpkg -i vzctl-lib_126.96.36.199-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 echo “NEIGHBOUR_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.