How to install OpenVZ in CentOS 6.4

I’ve used the CentOS-6.4-x86_64-minimal.iso image to install the OS.
A pretty good installation guide is located on the OpenVZ webpage.

You also need to upgrade kernel firmware to latest eg. here
i had to download and install kernel-firmware-2.6.32-358.23.2.el6.noarch.rpm
# yum install kernel-firmware-2.6.32-358.23.2.el6.noarch.rpm
The minimal installation does not have “wget” installed – so I’ve installed it first.
1
[root@centos ~]# yum install wget
After that you can follow the original instruction or use this shortcut
1
2
3
wget -P /etc/yum.repos.d/ http://ftp.openvz.org/openvz.repo
rpm --import http://ftp.openvz.org/RPM-GPG-Key-OpenVZ
yum install vzkernel vzctl vzquota ploop
Reboot

Install the OpenVZ Web Panel

https://code.google.com/p/ovz-web-panel/
1
wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh
..and here comes the first problem:
1
2
3
4
5
6
7
8
9
Complete!
ERROR:  http://gems.rubyforge.org/ does not appear to be a repository
ERROR:  could not find gem sqlite3 locally or in a repository
Checking presence of the command: ruby
Ruby version: 1.8.7
Checking presence of the command: gem
RubyGems version: 1.3.5
Checking Ruby SQLite3 support: ruby -e "require 'rubygems'" -e "require 'sqlite3'"
Fatal error: Ruby SQLite3 support not found. Please install it first.
The used gem source is unavailable. Let’s add a new one:
1
gem sources -a http://rubygems.org
The sources list is in a file in your home directory – I suggest to remove the not-working one
1
vi ~/.gemrc
After that let’s start the script again.
This time it worked but all connection to the port 3000 are blocked, so we need to add an IPTABLES rule
1
2
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
iptables-save
Right now the web panel should be available
Hints:
1)If any errors appear while adding new hosts about missing net/ssh or net/sftp simply install them:
1
2
gem install net-ssh
gem install net-sftp
2) The first time when I was testing OpenVZ using a netinst image I’ve unnecessarily updated the gem system resulting in this:
1
undefined method `source_index' for Gem:Module (NoMethodError)
The solution was to downgrade it:
1
gem update --system 1.8.25

TO RESET password of OVZ web panel

#ruby /opt/ovz-web-panel/script/runner -e production 'user = User.find_by_login("admin"); user.password = "admin"; user.save(false)'