Forums

organetic
organetic
Offline
Resolved
-1 votes
Hello Guys!

Looking forward to find an easy and mature way of using virtualization to leverage ClearOS capacities, I think I have found one of the most innocuous path to leave ClearOS in it's "almost" original state.

So, here's the tutorial for enabling OpenVZ (the same technology using in Virtuozzo) in ClearOS 5.2

I have done a ClearOS installation with 2 hard disks with software raid1, for protection.
Just follow this guide http://www.clearcenter.com/support/documentation/clearos_enterprise_5.2/user_guide/configuring_partitions_and_raid

and don't forget to issue this command at the end:

# grub-install /dev/sdb

Otherwise, if the first hard disk fails, the second one won't boot.

Now, for the openVZ guide:


Update ClearOS to current packages

# yum update

Add repos for OpenVZ

# cd /etc/yum.repos.d/
# wget http://download.openvz.org/openvz.repo
# rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ

Install OpenVZ i686 kernel

# yum install ovzkernel vzctl

then

# reboot

Now log in to your machine as usual and you are running on OpenVZ kernel.
It's time to install VZdump, the utility to backup and restore virtual containers

Current versions of vzdump has dependency for cstream and perl-LockFile-Simple, both available via rpmforge. Below is how I got it to install and run on CentOS-5.5 x86 i386 architecture.

# wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
# rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
# yum --enablerepo=rpmforge install cstream perl-LockFile-Simple
# rpm -ivh http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm

It's necessary to export the location of the PVE libraries that vzdump requires. This can be added to ".bash_profile":

# export PERL5LIB=/usr/share/perl5/

The next step is we will install OVZ ( the OpenVZ management GUI ). The OVZ, is a web application that runs on Ruby on Rails. So you must have Ruby on Rails in your machine to use the OVZ. No problem, the installer will take care of everything.

# wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh

That’s all, then you can access it via web browser http://clearOS-IP:3000

To enter to and exit from the container using bash:

To enter container give the following command:

[host-node]# vzctl enter CTID
entered into container CTID
[container]#

To exit from container, just type exit and press Enter:

[container]# exit
exited from container VEID
[host-node]#

To backup a container, just change the dump folder bellow and choose the right container, in my case 102.

#vzdump --compress --dumpdir /home/backup --stop 102

To restore or clone a container, just change the backup file bellow and choose a new container, in my case 250.

vzdump --restore /home/vzdump-102.tgz 250

You can read more abot openVZ and it+s features on http://wiki.openvz.org/Main_Page

ATTENTION: This was made on a fresh ClearOS 5.2 SP1 - You can install OpenVZ on any running server, but please take care of backing up your stuff before doing it.

openVZ technology is suited to Linux based virtual guests only. To add windows guests, we still have to wait for a better integration of VirtualBox.

In case you change your kernel version and install openvz kernel PAE or enterprise, don't forget to uninstall and reinstall openVZ web panel by issuing the following commands:

wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh -s UNINSTALL=1

Then need to remove /tmp/ovz-web-panel.log file and try to install the panel again:
wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh

Well. This is it. if you prefer to copy and paste the whole commands so that things get installed automatically, just paste the following code at the bash terminal:


yum update
cd /etc/yum.repos.d/
wget http://download.openvz.org/openvz.repo
rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum install ovzkernel vzctl
reboot



after reboot


wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
yum --enablerepo=rpmforge install cstream perl-LockFile-Simple
rpm -ivh http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm
export PERL5LIB=/usr/share/perl5/
wget -O - [code]http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh

Monday, March 28 2011, 04:19 PM
Share this post:
Responses (8)
  • Accepted Answer

    Thursday, July 18 2013, 11:53 AM - #Permalink
    Resolved
    0 votes
    Paul wrote:
    Now my first worry is that it appears I need to replace the kernel so my question is what implications are there for having auto update enabled on ClearOS as if a new kernel is released will it replace my OpenVz kernel?

    We have been experimenting with various cloud providers over the last few months. We released the Amazon EC2 beta and now have systems running on Linode and Elastichosts. The Linode test system uses a Linux 3.9.3 kernel -- the VPS boots the kernel and than magically hands off to ClearOS. The kernel updates happen normally on the ClearOS system, but those ClearOS kernels are never used.

    Any thoughts? Especially about using a different kernel from the ClearOS one.

    The Bandwidth Manager app won't work in this kind of environment since we patch the kernel for that - http://www.linuximq.net/ Everything else seems to be working fine, but there are likely some gotchas floating around. Keep us posted!

    By the way, if anyone wants to try ClearOS on linode.com, just send me a PM and I'll take the time to write a howto or even just write Linode Stackscript.
    The reply is currently minimized Show
  • Accepted Answer

    Paul
    Paul
    Offline
    Thursday, July 18 2013, 10:45 AM - #Permalink
    Resolved
    0 votes
    Hi All

    Sorry to revive such an old thread but this seemed the right place to ask. I have seen numerous web hosting companies where you can hire / buy a VPS server and I am interested in how you go about setting this up. I even used one briefly a few years ago and it was less than 20 minutes from me filling in a web form and paying to me having SSH access. So to start I thought I would look at installing OpenVz on my ClearOS 6.4 server.

    Now my first worry is that it appears I need to replace the kernel so my question is what implications are there for having auto update enabled on ClearOS as if a new kernel is released will it replace my OpenVz kernel?

    Once I have installed OpenVz and tried a few templates out I will go on to look at Control Panels. I have discounted HyperVM as it doesnt look like it works on Centos 6.

    My eventual aim is to understand the whole setup and provisioning process just for my own knowledge really.

    Any thoughts? Especially about using a different kernel from the ClearOS one.

    Thanks
    Paul
    The reply is currently minimized Show
  • Accepted Answer

    lelik
    lelik
    Offline
    Tuesday, February 14 2012, 01:59 PM - #Permalink
    Resolved
    0 votes
    Organetic,

    Could you please describe how you share NICs between your host and your containers?

    As most people use ClearOS in a gateway mode, you probably have at least 2 NICs in your server.
    1st = External, DHCP from your ISP, used by the host exclusively / not visible for the containers
    2nd = Internal, static, used by the host and shared by the containers.

    Ideally, you might even have 3 NICs.
    1st = External, DHCP from your ISP, used by host exclusively / not visible by the containers
    2nd = Internal, static, used by host exclusively / not visible by the containers.
    3nd = Internal, static, same subnet as 2nd, shared by the containers.

    Could you please post your setup / setting?
    Thanks.
    The reply is currently minimized Show
  • Accepted Answer

    lelik
    lelik
    Offline
    Tuesday, February 14 2012, 04:44 AM - #Permalink
    Resolved
    0 votes
    Nik,

    I believe you misunderstood the Organetic's approach to the OpenVZ + ClearOS combination.
    He installed ClearOS on a physical server / host and then added ability to create OpenVZ containers on it.
    ClearOS appliance itself IS NOT virtualized though. But you get add the ability to add other virtual servers.
    If your purpose is just to run several servers on the same physical machine this approach could work for you.
    Hope it is helpful.
    The reply is currently minimized Show
  • Accepted Answer

    Nik
    Nik
    Offline
    Thursday, February 02 2012, 01:46 AM - #Permalink
    Resolved
    0 votes
    Thank you Organetic for this really useful post!

    I am trying to get virtualised instances of ClearOS running on OpenVZ.
    By this I mean I want multiple containers - with each container being a separate instance of ClearOS.

    I have read and re-read this post, and I still can't tell whether it addresses my needs or not.

    You describe how to make an existing ClearOS installation (host) virtualised using OpenVZ, but you don't say how you create your subsequent containers (guests), nor what OS or template you put in them.
    Do you use a CentOS-5 template, or do you do something else that allows you to get ClearOS running inside the new container?

    Having created the master container based on ClearOS, is it now (relatively) easy to create further containers each of which are also ClearOS instances?

    I have been trying to build a ClearOS template - and have (mostly) succeeded.
    My approach was to install a compatible host on my server (eg CentOS-5), install ovz-web-panel (as per your great instructions here), and then try to create new containers with my hand-built ClearOS template.

    However, you approach is significantly easier, if it actually achieves what I want.

    So - are you able to create new ClearOS containers - and if so, how are you doing that?
    Ie, what template do you use - or do you create the container in some other way, without templates?

    Thank you for any insight you can provide.

    Cheers!
    Nik
    The reply is currently minimized Show
  • Accepted Answer

    organetic
    organetic
    Offline
    Thursday, April 14 2011, 10:42 AM - #Permalink
    Resolved
    0 votes
    I just read this, on a post by the user "zzz" at the VirtualBox user forum:

    http://forums.virtualbox.org/viewtopic.php?f=7&t=33268&sid=2e2f861ef1cd88301fe4c41e7b12931f&start=15

    Re: VirtualBox guest USB inoperative on RHEL 5.5 64-bit host
    by zzz » 7. Oct 2010, 00:03

    This comment relates mostly to CENTOS/REDHAT distributions. As mentioned in many previous posts the problem is usually with the permissions on usbfs. Centos mounts the usbfs first thing during boot. Once /proc/bus/ubs is mounted, its permissions cannot (so I have heard) really be changed. Thus, changing fstab or several other suggestions do not seem to work with this operating system. It turns out the the original mount is in /etc/rc.d/rc.sysinit. All you have to do is edit this file and add the group and its permissions to the mount instruction. Here is an example, of the changes where the group id is devgid=501 which is the group id of vboxusers.

    In /etc/rc.d, edit rc.sysinit
    Replace the two lines
    mount -n -t usbfs /proc/bus/usb /proc/bus/usb and
    modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb
    With
    modprobe usbcore >/dev/null 2>&1 && mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664
    mount -n -t usbfs /proc/bus/usb /proc/bus/usb -o devgid=501,devmode=664

    Note that you can get the gid of vboxusers by doing "grep vboxusers /etc/group". If it is not 501, then replace 501 with the correct gid. Also, make sure that you are a member of the group: "gpasswd -a youruserid vboxusers"
    The reply is currently minimized Show
  • Accepted Answer

    organetic
    organetic
    Offline
    Monday, April 04 2011, 04:41 PM - #Permalink
    Resolved
    0 votes
    I also advise you to install BackupPC from Tim's repository.

    You can install it the following way:

    # yum --enablerepo=timb install BackupPC
    # service webconfig restart

    With this installed, you can enable backup strategies for all virtual machines.

    The folders where the virtual machines are located are:

    OpenVZ - /vz
    VirtualBox - /home/vbox

    I advise you to make a partition strategy when installing CleaOS, where you create a VZ partition only for openVZ virtual machines, and a home partition for both VirtualBox files and the ClearOS user files.

    For copying data from another folder on the network and populate your server, you can always use:
    rsync -av /source/folder /destination/folder
    The reply is currently minimized Show
  • Accepted Answer

    organetic
    organetic
    Offline
    Tuesday, March 29 2011, 05:44 PM - #Permalink
    Resolved
    0 votes
    Now I'm also enabling VirtualBox on it... My intention is to have a quasi-proxmox machine, tied with ClearOS.

    So, from the information I have collected.

    After installing openVZ according to the previous post:

    # yum install gcc
    # yum install make
    # cd /var/tmp

    Download the kernel development packages according to the OVZ kernel you have installed, in my case it's i686.

    # wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab085.3/ovzkernel-devel-2.6.18-238.5.1.el5.028stab085.3.i686.rpm

    # yum localinstall ovzkernel-devel-2.6.18-238.5.1.el5.028stab085.3.i686.rpm

    Now, we begin to instal VirtualBox

    # wget http://download.virtualbox.org/virtualbox/4.0.4/VirtualBox-4.0-4.0.4_70112_rhel5-1.i386.rpm
    # yum localinstall --nogpgcheck VirtualBox-4.0-4.0.4_70112_rhel5-1.i386.rpm

    # wget http://download.virtualbox.org/virtualbox/4.0.4/Oracle_VM_VirtualBox_Extension_Pack-4.0.4-70112.vbox-extpack
    # VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.4-70112.vbox-extpack

    Also, I will install vboxtools. The latest one is a hack to work on Virtualbox 4

    # wget http://downloads.sourceforge.net/project/vboxtool/vboxtool/0.4/vboxtool-0.4.zip
    # unzip vboxtool-0.4.zip
    # cd /var/tmp/script
    # wget http://rankkihovi.rautakanki.net/~sampo/vboxtool/vboxtool-28122010
    # mv vboxtool-28122010 vboxtool

    answer y (yes)

    now we have to copy things to the right place and make it executable

    # cp vboxtoolinit /etc/init.d/
    # chmod +x /etc/init.d/vboxtoolinit
    # cp vboxtool /usr/local/bin/
    # chmod +x /usr/local/bin/vboxtool

    activate it on boot

    # chkconfig --add vboxtoolinit
    # chkconfig --levels 2345 vboxtoolinit on

    # mkdir /etc/vboxtool

    now, we create the conf files

    # nano /etc/vboxtool/machines.conf

    in this file we list what virtual machines we want to control and what RDP port to use.
    here is what mine looks like

    Windows XP,3389

    exit and save

    So now we create a new file "/etc/vboxtool/vboxtool.conf" and in that file we put

    # nano /etc/vboxtool/vboxtool.conf

    vbox_user='vbox'

    There are other config options you can use in both files but ill let you read about them yourself, the above is enough to get you up and running.

    Issue the following command:
    # vboxtool autostart

    Create a user "vbox" and add to the "vboxusers" group
    # /usr/sbin/useradd -r -m vbox
    # /usr/sbin/usermod -a -G vboxusers vbox

    Now, let's install the web console

    Update php (Thanks Tim)

    To install the repo first install the public key (yes all RPM's will now be signed):-
    Code:
    rpm --import ftp://www.timburgess.net/RPM-GPG-KEY-TimB.txt

    Then install the release RPM (by default the 'timb' and 'timb-testing' repo's will be disabled)
    Code:
    wget ftp://www.timburgess.net/repo/clearos/5.2/os/timb-release-1-0.noarch.rpm
    rpm -Kv timb-release-1-0.noarch.rpm
    rpm -Uvh timb-release-1-0.noarch.rpm

    # yum --enablerepo=timb upgrade php
    # yum --enablerepo=timb install php-soap
    # service httpd restart
    # php -v

    now edit the virtualbox web service file like this:

    # nano /etc/default/virtualbox

    VBOXWEB_USER='vbox'
    VBOXWEB_PORT='18083'
    VBOXWEB_HOST='localhost'

    and save it

    Download and unzip phpVirtualBox
    # cd /var/tmp
    # wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-5.zip
    # unzip phpvirtualbox-4.0-5.zip

    Empty /var/www/html and move everything to webserver root
    # mkdir /var/www/html/vbox
    # mv phpvirtualbox-4.0-5/* /var/www/html/vbox/

    Create a vbox user password (eg vbox001)
    # passwd vbox

    Edit config.php
    # nano /var/www/html/vbox/config.php-example

    var $username = 'vbox';
    var $password = 'vbox001';

    save it as config.php

    test the vBoxwebserver now

    su vbox

    vboxwebsrv -v

    if everything seems ok, cancel it with CTRL+X

    Now start the VirtualBox webserver
    # su vbox -c '/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null'

    And then, enable autostart for the VBoxWebserver

    # touch /etc/rc.d/start.vboxwebsrv
    # echo '#!/bin/bash' >> start.vboxwebsrv
    # echo "su vbox -c '/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null'" >> start.vboxwebsrv
    # chmod +x /etc/rc.d/start.vboxwebsrv
    # echo '/etc/rc.d/start.vboxwebsrv' >> /etc/rc.d/rc.local

    Finally, lets correct the permissions for the USB devices to work ok:

    As root:

    cd /dev/bus/usb
    chgrp vboxusers -R *
    chmod g+rwX -R *

    And thats it now point your browser to the IP address of the ClearOS machine ;)

    Here you have the code, to make a script.



    yum update
    cd /etc/yum.repos.d/
    wget http://download.openvz.org/openvz.repo
    rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
    yum install ovzkernel-ent vzctl
    reboot





    wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
    rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm

    yum --enablerepo=rpmforge install cstream perl-LockFile-Simple
    rpm -ivh http://download.openvz.org/contrib/utils/vzdump/vzdump-1.2-4.noarch.rpm
    export PERL5LIB=/usr/share/perl5/
    wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh

    cd /var/tmp
    yum install gcc
    yum install make

    wget http://download.openvz.org/kernel/branches/rhel5-2.6.18/028stab085.3/ovzkernel-devel-2.6.18-238.5.1.el5.028stab085.3.i686.rpm

    yum localinstall ovzkernel-devel-2.6.18-238.5.1.el5.028stab085.3.i686.rpm

    wget http://download.virtualbox.org/virtualbox/4.0.4/VirtualBox-4.0-4.0.4_70112_rhel5-1.i386.rpm
    yum localinstall --nogpgcheck VirtualBox-4.0-4.0.4_70112_rhel5-1.i386.rpm
    wget http://download.virtualbox.org/virtualbox/4.0.4/Oracle_VM_VirtualBox_Extension_Pack-4.0.4-70112.vbox-extpack
    VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.0.4-70112.vbox-extpack

    wget http://downloads.sourceforge.net/project/vboxtool/vboxtool/0.4/vboxtool-0.4.zip
    unzip vboxtool-0.4.zip
    cd /var/tmp/script
    wget http://rankkihovi.rautakanki.net/~sampo/vboxtool/vboxtool-28122010
    mv vboxtool-28122010 vboxtool
    cp vboxtoolinit /etc/init.d/
    chmod +x /etc/init.d/vboxtoolinit
    cp vboxtool /usr/local/bin/
    chmod +x /usr/local/bin/vboxtool
    chkconfig --add vboxtoolinit
    chkconfig --levels 2345 vboxtoolinit on
    mkdir /etc/vboxtool
    nano /etc/vboxtool/machines.conf
    nano /etc/vboxtool/vboxtool.conf
    vboxtool autostart

    /usr/sbin/useradd -r -m vbox
    /usr/sbin/usermod -a -G vboxusers vbox
    passwd vbox
    rpm --import ftp://www.timburgess.net/RPM-GPG-KEY-TimB.txt
    wget ftp://www.timburgess.net/repo/clearos/5.2/os/timb-release-1-0.noarch.rpm
    rpm -Kv timb-release-1-0.noarch.rpm
    rpm -Uvh timb-release-1-0.noarch.rpm
    yum --enablerepo=timb upgrade php
    yum --enablerepo=timb install php-soap
    service httpd restart
    php -v
    nano /etc/default/virtualbox
    cd /var/tmp
    wget http://phpvirtualbox.googlecode.com/files/phpvirtualbox-4.0-5.zip
    unzip phpvirtualbox-4.0-5.zip
    mkdir /var/www/html/vbox
    mv phpvirtualbox-4.0-5/* /var/www/html/vbox/
    nano /var/www/html/vbox/config.php-example
    su vbox -c '/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null'
    touch /etc/rc.d/start.vboxwebsrv
    echo '#!/bin/bash' >> start.vboxwebsrv
    echo "su vbox -c '/usr/bin/vboxwebsrv -b --logfile /dev/null >/dev/null'" >> start.vboxwebsrv
    chmod +x /etc/rc.d/start.vboxwebsrv
    echo '/etc/rc.d/start.vboxwebsrv' >> /etc/rc.d/rc.local



    Enjoy!
    The reply is currently minimized Show
Your Reply