Gentoo Wiki



Howto to Get WebVZ 2.0 on Gentoo to Administrate OpenVZ

Original author: --Pongraczi 10:47, 18 September 2008 (UTC)

FIXME: Because this is my first contribution to the public in this site, please change the format, content etc. if it necessary. Including my English, thank you.


WebVZ is a WebGUI for OpenVZ. Its feature list is long enough to feel something warm inside when you read it, so, my advice, give it a try.


I have some gentoo based virtual environments and I googled around to find a good and comfortable way to manage them via a web interface.
I found webvz, which is an excellent tool to manage your openvz based virtual environment, even to recreate (remaster) a template from an existing VE, migrate it to an other machine, check and modify its resource parameterse etc.

After I downloaded the tool (1.5 before and now 2.0) I started to use it and I found gentoo use different path and status than centos for example.
So, I modified the code a little bit and I create a link to my gentoo style config directory.

Needed packages

You will need ruby and rails, there is no need apache or other webserver with sqlite3 support, etc.
If you use gentoo, you know, how to install them ;)
You will need the latest packages from ruby etc., so, a portage sync is highly recommended.
We will adjust webvz later to meet our actual version, such as rails.

Code: emerge deps
emerge --sync
emerge -pv ruby rails sqlite3-ruby rubygems sqlite

Get and untar WebVZ 2.0

Visit the website and get the latest version (now it is 2.0):
Or download it directly from sourceforge:

Code: Get webvz
tar xzfv webvz.2.0.tar.gz
cd webvz.2.0

Step 1 - Version check

Check your system using eselect rails list and set up the latest (in my system it is the 2.1.1).
See below.

Code: Set up the right rails to use
eselect rails list
Available Ruby on Rails versions:
 [1]   rails-2.1.1
 [2]   rails-2.0.4
eselect rails set 1
eselect rails show
Current Ruby on Rails version:

Edit config/environment.rb to tell webvz what is the current version of rails. I changed it to 2.1.1 from 2.1.0:

Code: Change the version to meet your version

RAILS_GEM_VERSION = '2.1.1' unless defined? RAILS_GEM_VERSION

Step 2 - VZ status check

To detect openvz is running or stopped on our gentoo box, we need to modify app/controllers/application.rb at line 48, where webvz try to figure out, what is the current status of openvz. The correct term is started or whatever, depends on your settings and customization. Check it by invoking /etc/init.d/vz status.

Code: What to change at line 48
--- unless @status.include?("running")
+++ unless @status.include?("started")

Step 3 - Setup the correct path - easy way

Gentoo use the /etc/vz/ path to its config files etc. Check your system to get a picture about the directory layout.
WebVZ try to access to the config directory in an other path, so, we simply build that path to "make our system webvz compatible".

Code: Creating link to the config directory
mkdir /etc/sysconfig
ln -s /etc/vz/conf /etc/sysconfig/vz-scripts

Congratulation, it is done!

Now it is time to cross your fingers and launch webvz :)
If everything went well, your system is ready to start webvz and you will find this tool very comfortable. Even, you are familiar in command line, it is really good to manage >10 VEs.

Launch WebVZ

Only thing you have to do to start the server. You can do it using your console as root.

Code: Launching webvz 2.0
cd webvz.2.0/script
ruby server
 => Booting WEBrick... 
 => Rails 2.1.1 application started on
 => Ctrl-C to shutdown server; call with --help for options
 [2008-09-18 10:27:23] INFO  WEBrick 1.3.1 
 [2008-09-18 10:27:23] INFO  ruby 1.8.6 (2008-08-11) [x86_64-linux] 
 [2008-09-18 10:27:23] INFO  WEBrick::HTTPServer#start: pid=7066 port=3000 
The DL driver for sqlite3-ruby is deprecated and will be removed 
in a future release. Please update your installation to use the 
Native driver.

Yes, as you can see, gentoo gave a big fat warning to prepare problems in the future ;)
Use the default username and password to login and look around in your new cockpit :)

Warning: If you use it on a production system, you have to protect WebVZ using firewall to avoid the unauthorized access to your system. Hide it behind a firewall or whatever you can do to avoid "accidents".

If something goes wrong

I think, if you are familiar in gentoo (in fact, I am sure), you will have no problem to track down, what is the problem with your system configuration and you can manage it by yourself.

Just for a quick reference, see my installed packages and used USE flags. I think, this part is only beautiful for gentoo people :)

  1. eix -I ruby

[I] dev-lang/ruby

    Available versions:  (1.8)  1.8.6_p111 (~)1.8.6_p111-r1 1.8.6_p114 (~)1.8.6_p286 (~)1.8.6_p287 (~)1.8.6_p287-r1 [M](~)1.8.7_p72
       {berkdb cjk debug doc emacs examples gdbm ipv6 rubytests socks5 ssl threads tk xemacs}
    Installed versions:  1.8.6_p287-r1(1.8)(10:15:44 09/18/08)(berkdb gdbm ssl -debug -doc -emacs -examples -ipv6 -rubytests -socks5 -threads -tk -xemacs)
    Description:         An object-oriented scripting language

[I] dev-ruby/ruby-config

    Available versions:  0.3 0.3.1 0.3.2
    Installed versions:  0.3.2(20:37:52 04/28/08)
    Description:         Utility to switch the ruby interpreter being used

[I] dev-ruby/rubygems

    Available versions:  0.8.11-r6 0.9.4-r2 (~)1.0.1 (~)1.1.0 1.1.1 (~)1.2.0 {doc examples server}
    Installed versions:  1.2.0(10:15:58 09/18/08)(-doc -server)
    Description:         Centralized Ruby extension management system

[I] dev-ruby/sqlite-ruby

    Available versions:  (~)2.2.3 2.2.3-r1 {doc}
    Installed versions:  2.2.3-r1(15:18:03 07/05/08)(-doc)
    Description:         An extension library to access a SQLite database from Ruby

[I] dev-ruby/sqlite3-ruby

    Available versions:  1.1.0 (~)1.2.1 {doc swig}
    Installed versions:  1.2.1(20:39:55 04/28/08)(-doc -swig)
    Description:         An extension library to access a SQLite database from Ruby

[I] app-admin/eselect-rails

    Available versions:  0.10 0.11 (~)0.12
    Installed versions:  0.12(10:15:52 09/18/08)
    Description:         Manages Ruby on Rails symlinks

[D] dev-ruby/rails

    Available versions:  
       (1.2)   1.2.6
       (2)     2.0.2
       (2.1)   (~)2.1.0
       {doc fastcgi mysql postgres sqlite sqlite3}
    Installed versions:  2.0.4(2)(10:17:16 09/18/08)(-doc -fastcgi)
                         2.1.1(2.1)(10:17:10 09/18/08)(-doc -fastcgi)
    Description:         ruby on rails is a web-application and persistance framework
Retrieved from ""

Last modified: Sun, 21 Sep 2008 06:21:00 +0000 Hits: 416