Install WebVZ 2.0 On Debian Etch To Administrate OpenVZ

Want to support HowtoForge? Become a subscriber!
 
Submitted by shuaibzahda (Contact Author) (Forums) on Tue, 2008-09-16 12:24. :: Debian | OpenVZ | Virtualization

Install WebVZ 2.0 On Debian Etch To Administrate OpenVZ

Created/Modified by Edward Tobia to work with WebVZ 2.0. Credits to Mike J (mike.j@rewt.ch) for the WebVZ 1.5 installation instructions as they helped make this version possible!

1.1 Beginnings:

First you must have OpenVZ installed and configured. You can find a tutorial to do this on HowtoForge (http://www.howtoforge.com/installing-and-using-openvz-on-debian-etch). Because of a small problem/error in Debian Etch, it is not possible to update the Rubygems system because a Require in the gems is missing. But we can solve it with a simple edit of the file. WebVZ is one of the simplest and most powerful web management tools for OpenVZ.

 

2.0 Needed Packages:

We must install some additional packages to get WebVZ running. WebVZ does not need a web server, because they deliver it with WebRick.

Let's start...

main:~# apt-get install ruby rubygems libsqlite3-ruby sqlite3 irb1.8 libopenssl-ruby1.8 libreadline-ruby1.8 rdoc1.8 nano

You must say Yes to the installation.

 

2.1 Solve Debian error:

To solve the error on Debian, so that we can update gems you must do the following:

main:~# nano /usr/bin/gem

Edit the file so that it looks like this:

#!/usr/bin/env ruby

#--

# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.

# All rights reserved.

# See LICENSE.txt for permissions.

#++

require 'rubygems'

require 'rubygems/gem_runner'

require 'rubygems/open-uri'

Gem.manage_gems

required_version = Gem::Version::Requirement.new(">= 1.8.0")

unless required_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))

puts "Expected Ruby Version #{required_version}, was #{RUBY_VERSION}"

exit(1)

end

# We need to preserve the original ARGV to use for passing gem options

# to source gems. If there is a -- in the line, strip all options after

# it...its for the source building process.

args = !ARGV.include?("--") ? ARGV.clone : ARGV[0...ARGV.index("--")]

Gem::GemRunner.new.run(args)

Save the file with CTRL + X and type Y to save.

 

2.2 Update Gems:

Type in your console the following to update Gems, without the update WebVZ doesn't run....

main:~# gem update --system

You need to install Rails 2.1.0:

main:~# gem install -v=2.1.0 rails

 

3.0 Configuring WebVZ:

Use the following commands to get WebVZ:

main:~# wget http://ovh.dl.sourceforge.net/sourceforge/webvz/webvz.2.0.tar.gz

Extract the downloaded archive:

main:~# tar -xzvf webvz.2.0.tar.gz

Go into the WebVZ directory:

main:~# cd webvz.2.0

Because of some small changes on the Debian System we need to set some softlinks in our system & create a few directories. Do it exactly as shown, otherwise WebVZ is not usable:

main:~/webvz.2.0# ln -s /var/lib/vz /vz

main:~/webvz.2.0# ln -s /usr/bin/irb1.8 /usr/bin/irb

main:~/webvz.2.0# mkdir /etc/sysconfig

main:~/webvz.2.0# ln –s /etc/vz/conf /etc/sysconfig/vz-scripts

 

3.1 Starting and Setting up WebVZ:

To start WebVZ you can start the server with this command. You can put it in your init.d or start-up scripts if you wish for it to boot up on every start-up.

main:~/webvz.2.0# ruby script/server

If all is well a message will come and say WebRick is started on port 3000.

Now we must connect with a web browser to http://[youripaddress]:3000. Log in with

Username: admin
Passwort: admin123

First of all to secure WebVZ, we need to create an own account. Log in with your account details and destroy the admin account.

 

3.2 After Installation Problems - Fixes:

After installation is complete and you have the WebRick server running you may encounter the following error when logging in/using WebVZ:

Could not find table 'users'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/sqlite3_adapter.rb:29:in `table_structure'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/
core_ext/object/misc.rb:28:in `returning'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/sqlite3_adapter.rb:28:in `table_structure'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
connection_adapters/sqlite_adapter.rb:189:in `columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1145:in `columns'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1158:in `column_names'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1171:in `column_methods_hash'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1714:in `all_attributes_exists?'
/usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/
inflector.rb:283:in `all?'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1714:in `each'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1714:in `all?'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1714:in `all_attributes_exists?'
/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/
base.rb:1613:in `method_missing'
app/models/user.rb:13:in `authunticate'
app/controllers/login_controller.rb:16:in `sign_in'

This is a problem with the SQLite3 Adapter that comes with activerecord-2.1.0; I have created a fix in which you must apply the following commands in ssh:

main:~# rm -f /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb

main:~# cd /usr/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/

main:~# wget http://www.eurosrv.com/sqlite3_adapter.rb

This should/will fix the SQLite3 problem with databases not being found.

Everything should now work perfectly!


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by Pawel (not registered) on Fri, 2010-03-05 12:47.

Hello

 I just install your soft on two my servers on debian

 On One server all working fine but on other no`t i have problem with making new VPS or to see conffiguration files i can`t change Memory on container....

 Can you upload main:~# wget http://www.eurosrv.com/sqlite3_adapter.rb One more time

 

 Thanks

 Pawel Urbanowicz

Submitted by Anonymous (not registered) on Thu, 2009-05-07 10:30.

I've found the tar.gz on:

http://kent.dl.sourceforge.net/sourceforge/webvz/webvz.2.0.tar.gz

Submitted by Michael A Cooper (not registered) on Wed, 2009-01-07 00:37.
Can this be done on CentOS 5.2?
Submitted by Michael Cooper (not registered) on Sun, 2008-11-16 19:36.
I was just wondering if this same WebVZ install applies to CentOS 5.2 as well?
Submitted by oktitani (registered user) on Fri, 2009-03-13 15:59.

I had the following Troubles installing WebVZ on CentOS 5.2

  • The URL http://localhost gives me in a browser (after renaming public/index.html)

  Routing Error
  No route matches "/" with {:method=>:get}

  • http://localhost/menu allows me to login with the default admin account, but if I click e.g. "Users" the browser output says (http://localhost/user/list)

    NoMethodError in UserController#list
        undefined method `authorize' for #<UserController:0x2aaaac9e88c0>
 

Submitted by oktitani (registered user) on Tue, 2009-03-17 17:37.
The problem was solved by unzipping the WebVZ tar file again. The command rails /path/to/app caused the problem.
Submitted by Sebas (not registered) on Thu, 2008-10-09 10:09.

On ubuntu 8.04 I was getting /usr/bin/gem:10:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
to solve this problem I did:
selected pre-release and unsupported packages in Software Sources.
apt-get remove ruby*
apt-get clean
apt-get install ruby rubygems
It helped me, you could try without selecting pre-release and unsupported packages, just some apt-get magic.
On debian i think same magic will work in case of error, just skip update --system stage.

Submitted by Rob (not registered) on Tue, 2008-09-23 15:15.
ruby script/server -d runs as daemon
Submitted by Rob (not registered) on Tue, 2008-09-23 14:53.
For Ubuntu 8.04, I had the "Solve Debian error" was not working for me. So I removed all rubygem packages, installed Ruby Gems from http://rubyforge.org/frs/?group_id=126 (extract, cd, then run "ruby setup.rb"), and installed rails from http://rubyonrails.org/down using gem install -v=2.1.0 rails. Now I just need to figure out how to run this as a daemon.
Submitted by snapo (registered user) on Tue, 2008-09-16 14:49.
thanks a lot for helping so great opensource project's to live... i haven't had the time to do the second tutorial btw. i havent time to use webvz 2.0 ;=) but now i would try it. Good Job man....