KVM and OpenVZ Virtualization in ProxMox
In my previous
post I wrote about my company's research for a good enterprise
virtualization environment which supports most of the Linux and Windows
operating systems as guests. We ended up choosing the ProxMox VE and I spent quite a
bit of time testing and configuring it. One of the first actual implementation
tasks I was faced with was virtualizing our Redmine TKL appliance. Since
ProxMox provides two completely separate virtualization methods - KVM and OpenVZ container virtualization, I
had to decide which one to use. Due to its nature, OpenVZ works only with Linux
OSes, but it's supposed to have a better performance and use less resources, so
it seemed like the way to go. The VM creation procedure in ProxMox seems pretty
straightforward. For KVM one just needs to upload an ISO installation image of
the desired OS, configure its parameters (CPU cores, memory, drive space,
etc.), open the console via web management and follow the usual routine like on
a physical machine. For OpenVZ, it's even easier, one just needs to upload an
OpenVZ template, configure parameters and the system is immediatelly up and
running. A walk in the park as they would say...well, yes, but where can one
find the OpenVZ templates?
The quest for OpenVZ templates
ProxMox itself provides quite a few of them here and there
are many at the OpenVZ template
download page as well. This ProxMox related article
suggested checking the Parallels
website too, after all they are the creators of OpenVZ and their commercial
product Parallels Virtuozzo
Containers is built on top of OpenVZ, with more features and better
functionality. Apparently, they do offer a load of templates here,
but I couldn't find any info on both OpenVZ and Parallels website whether those
templates were compatible or can be used with OpenVZ. Additionally, all those
templates were "so called" EZ templates, something Parallels started using since their 3.0 version.
Unlike its standard full package templates in the previous versions, it's
basically a metadata file with only the information about the necessary
packages, which are then installed via Virtuozzo
command-line utilities. The thing is that OpenVZ has similar, although much
more basic utilities, but they
state that they are no longer
supported making me wonder whether they can be used to create OpenVZ
templates from Parallels EZ templates. Anyway, although supporting all the
major Linux distros and application packages (like Joomla, Wordpress, etc.)
neither the ProxMox, OpenVZ or Parallels list of templates contained anything
related to TKL. At this point it seemed more likely that there are no
precreated templates for TKL and the idea of creating one didn't seem like an
easy task according to this ProxMox
forum discussion.
TKL - OpenVZ Template creation
Still hoping to find a ready-to-use template, I started browsing the TKL
forums and found this
post. It had instructions how to create an OpenVZ template for any
appliance, but that looked complex to me, plus there were some reservations
expressed about whether it would work with all the appliances. Searching furter
through related posts, I finally managed to find 2 different sourceforge
projects (turnkeylinuxovz and
turnkeylinuxcom)
with a dozen of precreated templates. Unfortunatelly none of them contained
Redmine, which meant going back and trying to figure out the whole procedure
from that article. It involves utilizing a TKLPatch, a set of scripts
for customizing and extending any TKL appliance. The instructions here
explain more about how to use it. Combining all this and putting 2 and 2
together, here are the exact steps that I did:
1. Installed TKL Core
appliance as a virtual machine. I used ProxMox for this - IMPORTANT NOTE! -
the first time I tried it I installed TKL Core as OpenVZ by using a template
from turnkeylinuxcom and
the scripts didn't work, there were errors. In my second attempt I downloaded
TKL
Core ISO image and virtualized it under KVM and everything run fine. I'm
sure any other full virtualization method would work (the article suggested
Virtual Box). I used KVM since I had it already available under ProxMox.
2. Installed TKL Patch via following commands:
apt-get update
apt-get install tklpatch
3. Downloaded TKL
Redmine appliance ISO image and copied it to the TKL Core virtual machine,
to the folder /tkl-openvz/ that I
previously created.
4. Downloaded Kit
for OpenVZ from that article, unpacked it. It contains 3 files - tkliso2ovz and tklpatch-gen-ovztemplate scripts, which I
copied to /usr/local/bin/ as per
instructions and tklovz.tar.gz, which
I placed in the same folder as TKL Redmine ISO image.
5. I went into the /tkl-openvz/ that I created and run the following
command:
tkliso2ovz turnkey-redmine-11.1-lucid-x86.iso
6. The command produced the following OpenVZ template file in the same
folder:
turnkey-redmine-11.1-lucid-x86-ovz.tar.gz
7. I tried to upload that file to the ProxMox list of OpenVZ templates, but
got an error due to ProxMox specific naming convention requirement:
<OS>
-
<OSVERSION>
-
<NAME>_<VERSION>_<ARCH>.tar.gz
I renamed my file to:
ubuntu-10.04.1-turnkey-redmine_11.1_i386.tar.gz
and ProxMox accepted it.
8. Finally I started the VM in ProxMox, it was instantly functional without
any installation procedure which is characteristic for OpenVZ. We run the TKLBAM restore
process and all our Redmine data appeared within few seconds. We tested it
further and everything seemed to work okay.
Universal Solution
That's it, I guess the procedure should work for any TKL appliance. The
previously mentioned forum post did say that there may be problems, they
specifically mentioned the Redmine appliance, but the scripts seem to have been
updated since and the last remark is from January 2011, so I hope they fixed
all the errors in the meantime. In any case, we've been running our Redmine for
almost a month now without any problems.