I’ve been playing with OpenVZ, which is an opensource fork of what is now Parallels Virtuozzo, essentially its a container system similar to FreeBSD jails, or Solaris zones.
I have managed to install it inside of VirtualBox running CentOS 5.3 64-bit, using these instructions from the CentOS Wiki, which basically boils down to: disable SELinux, enable IP forwarding, stop yum overwriting the OpenVZ kernel with the CentOS one, then, as root (on the host node):
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum install ovzkernel.x86_64 vzctl vzquota
Then I installed the pre-created Ubuntu 8.04 64-Bit template, allocating 512Mb guaranteed/1024Mb burstable RAM, OpenDNS servers, 50Gb disk space; on the host node as root again:
vzctl create 101 --ostemplate ubuntu-8.04-x86_64 --conf vps.basic --ipadd 192.168.0.129 --hostname vps.synapticconsulting.com
vzctl set 101 --save --name vps --nameserver "184.108.40.206 220.127.116.11" --diskspace 50G:50G --capability sys_time:on --vmguarpages 262144:9223372036854775807 --privvmpages 262144:9223372036854775807 --kmemsize 536870912:536870912
vzctl start 101
Then I rsync’ed this server inside of it! Everything seems to work – web, database, email, firewall etc. I also updated the rsync scripts as I forgot to add the “–numeric-ids” flag and the -p (keep permissions) flag, which meant restoring from it was setting the wrong permissions on files, i.e. the MySQL files were owned by the sudo user, as it was taking the permissions from my desktop machine!
So I’ve now got Fedora running VirtualBox, inside which is CentOS running OpenVZ, inside which is Ubuntu!
Next I’m going to try to rsync the live VPS with the local one (i.e. without access to the host node, with both VPS’s running) which I could then clone – basically tar up the /vz/private/101/ directory and /etc/vz/conf/101.conf file and migrate to another host node.
Update: I’ve got rsync working between the local and remote VPS’s, so could easily migrate to another VPS provider, or even have some sort of failover/load-balancing system – using rsync from cron and round-robin DNS for example.