First OpenVZ installation


This weekend I finally got around to checking out OpenVZ. With lots of prodding from Scott, not to mention lots of help from Scott, I got this thing installed rather quickly. I pretty much followed Scott's latest article Intro to OpenVZ: Part II. I started with installing CentOS 4.4 using the custom minimalist install and updated everything. BTW this machine is an old Dell 2Ghz with 512MB RAM and 40GB drive. My plan is to actually use one of the virtual private servers (VPS) as a production backup server. Other VPS's would be just for fun and possibly exploration of other distributions.

So in short after having my bare bones install here is my quick and dirty easy to follow steps from Scott's article:

  1. cd /etc/yum.repos.d
  2. wget
  3. yum install ovzkernel
  4. nano -w /etc/sysctl.conf with these changes:
  5. # On Hardware Node we generally need
    # packet forwarding enabled and proxy arp disabled
    net.ipv4.ip_forward = 1
    net.ipv4.conf.default.proxy_arp = 0
    # Enables source route verification
    net.ipv4.conf.all.rp_filter = 1
    # Enables the magic-sysrq key
    kernel.sysrq = 1
    # TCP Explict Congestion Notification
    # net.ipv4.tcp_ecn = 0
    # we do not want all our interfaces to send redirects
    net.ipv4.conf.default.send_redirects = 1
    net.ipv4.conf.all.send_redirects = 0
  6. Set the default kernel in grub to the new one
  7. Reboot using the new kernel
  8. yum install vzctl vzquota
  9. service vz start
  10. yum install vzpkg vzyum vzrpm43-python vzrpm44-python
  11. yum install vztmpl-centos-4
  12. nano -w /vz/template/centos/4/i386/config/default.list appending this:
  13. yum
  14. vzpkgcache -f centos-4
  15. vzctl create 101 --ostemplate centos-4 --config vps.basic
  16. vzctl set 101 --ipadd --save
  17. vzctl set 101 --hostname vps101 --save
  18. vzctl set 101 --nameserver --nameserver --save
  19. vzctl set 101 --userpasswd root:areallycoolpassword
  20. vzctl set 101 --onboot yes --save
  21. vzctl start 101
  22. vzctl enter 101

Okay so that is it in a nutshell. Then this is where I start getting into trouble with my wild ideas. I mentioned wanting to make this my backup server and I normally use Dirvish, but this time I want to try out BackupPC. Now I also have a nice 300GB drive I have used for my backups and I planned on just mounting it inside this new VPS. Problem is I couldn't figure out how to give it enough diskspace quota. The most it would give was from my 40GB drive and that was a 34GB quota. So I called Scott and pretty much just decided to do LVM (logical volume management) and merge the drives together to make it look like one big drive. This however entailed starting from scratch again as I'm pretty lazy when it comes to trying to figure out installing something like this after the fact.

So I find my single CentOS CD and attempt to boot it but my crappy old Dell has an abused CD-R drive. So I borrow the one out of another Dell and off we go. So when I get back to the point I was last, I run this:

vzctl set 101 --diskspace  315621376:315621376 --save

This gives me 301GB disk space to work with in my VPS. Problem is I was told by Scott there is an rpm for BackupPC but currently there are no rpm's for CentOS. So this brings me to another task... create another VPS with a distribution that includes rpm package management for BackupPC. I found out the hard way that these guys are yet another that uses caps in their package name and caused me a bit of headache searching for it.

I picked FC-5 for the new VPS as it seems to be the latest to carry BackupPC. To do this I needed to build the template similar to building the CentOS template above.

yum install vztmpl-fedora-core-5

The rest was pretty much as stated above. Of course I forgot to edit the default.list and had to later go back and update the cache after already creating the VPS with FC5. So I needed yum installed on this to fill in the blanks and Scott to the rescue again; I could install this from the host with:

vzyum 102 install yum

This is it for now. I have yet to configure BackupPC. I will have to blog about it later.