1. Store
  2. Apps
  3. Hardware
  4. Support
  5. Solutions

ClearFoundation

Forums
Welcome, Guest
Howto - Virtualbox Headless on ClearOS
(1 viewing) 1 Guest
Go to bottomPage: 1...910111213141516
TOPIC: Howto - Virtualbox Headless on ClearOS
*****
#41534
Re:Howto - Virtualbox Headless on ClearOS 1 Year ago  
sorry for the extremely stupid question that that im gonna ask, that was somehow answered 2 posts ago:

Im currently Running COS 6.2 Community. And I would like to have a CentOS Guest OS virtualized, fully dedicated to downloads.

Which script should I run / install to install Virtual Box on my COS 6.2 box? The script on the first post of this thread?

Thank you very much in advance!
Mariano
Junior Boarder
Posts: 20
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#41695
Re:Howto - Virtualbox Headless on ClearOS 12 Months ago  
Mariano wrote:
sorry for the extremely stupid question that that im gonna ask, that was somehow answered 2 posts ago:

Im currently Running COS 6.2 Community. And I would like to have a CentOS Guest OS virtualized, fully dedicated to downloads.

Which script should I run / install to install Virtual Box on my COS 6.2 box? The script on the first post of this thread?

Thank you very much in advance!


I didn't use any of the scripts.

First do run "cat /proc/sys/kernel/osrelease" and you should see your kernel version. Mine is "2.6.32-220.17.1.v6.x86_64" so then I ran
yum install kernel-devel-2.6.32-220.17.1.v6.x86_64.
yum install glibc-common.x86_64 compat-glibc.x86_64 glibc.x86_64 glibc-devel.x86_64 glibc-headers.x86_64 glibc-static.x86_64 glibc-utils.x86_64
yum install kernel-devel gcc-c++

Wget is not installed by default, so install that;
yum -y install wget.x86_64

Needed to add a couple of repositories:
rpm --import elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh elrepo.org/elrepo-release-6-4.el6.elrepo.noarch.rpm
rpm --import apt.sw.be/RPM-GPG-KEY.dag.txt
wget pkgs.repoforge.org/rpmforge-release/rpmf...-2.el6.rf.x86_64.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

Then download Virtualbox:
wget download.virtualbox.org/virtualbox/4.1.1...0_rhel6-1.x86_64.rpm
yum localinstall VirtualBox-4.1-4.1.14_77440_rhel6-1.x86_64.rpm

export KERN_DIR=/usr/src/kernels/2.6.32-220.17.1.v6.x86_64/

Then finally I ran:
/etc/init.d/vboxdrv setup

For phpvirtualbox:
yum -y install php-soap.x86_64
yum -y install unzip
cd /var/www/html
wget phpvirtualbox.googlecode.com/files/phpvirtualbox-4.1-7.zip
unzip phpvirtualbox-4.1-7.zip

Here is where the vboxwevsev just will not run, and still have not had time to determine the cause. I just run "/usr/bin/vboxwebsrv" at the command line through webmin and it works, phpvirtualbox that is. Be sure to follow the instructions about creating the vbox user and groups and giving that user account a password.
sbn
Senior Boarder
Posts: 49
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#41702
Re:Howto - Virtualbox Headless on ClearOS 12 Months ago  
Now, i already completed all the steps (I installed the newest version 4.1.16), and when i run either vboxwebserver or usr/bin/vboxwebsrv, i get the following:

Code:

Oracle VM VirtualBox web service version 4.1.16
(C) 2005-2012 Oracle Corporation
All rights reserved.
VirtualBox web service 4.1.16 r78094 linux.x86 (May 22 2012 17:19:45) release lo                g
00:00:00.000 main     Log opened 2012-05-23T03:07:22.341025000Z
00:00:00.000 main     OS Product: Linux
00:00:00.000 main     OS Release: 2.6.32-220.17.1.el6.i686
00:00:00.000 main     OS Version: #1 SMP Tue May 15 17:45:22 MDT 2012
00:00:00.000 main     OS Service Pack: #1 SMP Tue May 15 17:45:22 MDT 2012
00:00:00.000 main     Executable: /usr/lib/virtualbox/vboxwebsrv
00:00:00.000 main     Process ID: 31529
00:00:00.000 main     Package type: LINUX_32BITS_RHEL_6
00:00:00.189 SQPmp    Socket connection successful: host = default (localhost),                 port = 18083, master socket = 8




If i close the ssh shell, or if i just do ctrl+C, what will happen? Vritualbox will stop running? If so, should I install something like Screen or something to keep that running?


Thanks in advance!


EDIT 2:
Now, I restarted my server, and when I try to run vboxwebserver (or /usr/bin/vboxwebsrv), i get the following:

Code:

[root@gateway ~]# /usr/bin/vboxwebsrv
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (2.6.32-220.17.1.v6.i686) or it failed to
         load. Please recompile the kernel module and install it by

           sudo /etc/init.d/vboxdrv setup

         You will not be able to start VMs until this problem is fixed.
Oracle VM VirtualBox web service version 4.1.16



If I run: sudo /etc/init.d/vboxdrv setup as it says there, i get the follwing:

Code:

[root@gateway ~]# sudo /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS[FAILED]
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules                      [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong



Then I checked the vbox-install.log and I found the error to be:
Code:

Makefile:172: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again.  Stop.


Then I run: export KERN_DIR=/usr/src/kernels/2.6.32-220.17.1....

and finally run /etc/init.d/vboxdrv setup again, and now it says the following:

Code:

[root@gateway ~]# /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Uninstalling old VirtualBox DKMS kernel modules            [  OK  ]
Removing old VirtualBox pci kernel module                  [  OK  ]
Removing old VirtualBox netadp kernel module               [  OK  ]
Removing old VirtualBox netflt kernel module               [  OK  ]
Removing old VirtualBox kernel module                      [  OK  ]
Trying to register the VirtualBox kernel modules using DKMS[FAILED]
  (Failed, trying without DKMS)
Recompiling VirtualBox kernel modules                      [  OK  ]
Starting VirtualBox kernel modules                         [[b]FAILED[/b]]
  (modprobe vboxnetflt failed. Please use '[b]dmesg[/b]' to find out why)



When I run dmesg, hundreds of lines of errors appears.




EDIT 3:
Regarding to the phpvirtualbox. I created an user (vbox), asigned a usergroup (the one that says on the first page of this thread), and created a password to It.
But when i try to login to phpvirtualbox, i receive the following error:

Error logging in to vboxwebsrv.
Details:
Code:

Exception Object
(
    [message:protected] => Error logging in to vboxwebsrv.
    [string:Exception:private] => 
    [code:protected] => 64
    [file:protected] => /var/www/html/vbox/lib/vboxconnector.php
    [line:protected] => 188
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => /var/www/html/vbox/lib/auth/Builtin.php
                    [line] => 45
                    [function] => connect
                    [class] => vboxconnector
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [1] => Array
                (
                    [file] => /var/www/html/vbox/lib/ajax.php
                    [line] => 119
                    [function] => login
                    [class] => phpvbAuthBuiltin
                    [type] => ->
                    [args] => Array
                        (
                            [0] => vbox
                            [1] => ""vbox password"
                        )

                )

        )

    [previous:Exception:private] => 
)

Mariano
Junior Boarder
Posts: 20
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2012/05/23 00:01 By LilBigHorn.
The administrator has disabled public write access.
 
#42114
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 3 Weeks ago  
I had the same issue with dkms, I enabled the “clearos-epel” repository using the web GUI under “System” tab, “Software Repository”.
Then I went back to the command line, did a "yum update" and "yum install dkms". After that, I did the /etc/init.d/vboxdrv setup and it recompiled without any errors. I will do a write up on all the steps I did this evening, I just got it working perfectly!
Ryan Van Orden
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#42124
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 3 Weeks ago  
I had the same problem, it is a hitch between the 220.13 and 220.17 kernel.

This solved the problem for me, quite posible not all thins is nessesary for you, since I messed it up quite a bit first.

Will do a fresh install to check the right method.

1. yum remove kernel-devel
2. yum remove kernel-headers
3. yum remove kernel-2.6.32-220.13.1.v6.x86_64 (Think this wil do it)
4. yum update
5. yum --enablerepo=* install kernel-devel
5. yum --enablerepo=* install dkms
6. cd /lib/modules/`uname -r`
7. ls -l (The build is read since the kernel have once again changed.
8. rm -vf build
9. ln -s /usr/src/kernels/2.6.32-220.17.1.v6.x86_64 build
10. /etc/init.d/vboxdrv setup

I had to install the extension pack once again to get the vrde -remote desktop to work again
Should not, maybe I have reinstaled the vbox to try to get it running.

11. VBoxManage extpack install /path/th/your/extension/pach/Oracle_VM_VirtualBox_Extension_Pack-4.1.16-78094.vbox-extpack

12. su vobx (the vbox users you have made)
13. VBoxHeadless --startvm Win7 & (Change Win7 to your virtual os)

Working.
Sigurd J Ingvaldsen
Junior Boarder
Posts: 22
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#42127
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 3 Weeks ago  
Here is my write-up, hopefully it helps out. If you can make this into a script, that would be awesome <hint hint>

I finally got this to work with ClearOS 6.2 and VirtualBox 4.1 running Windows 7 64 bit as the guest OS. Had a few challenges (including the kernel-devel and kernel-headers). I did not install the web interface for virtualbox, I found I did not need it for my particular install. There are probably some things that can be done easier, please comment when you see them. Thank you everyone for your posts, they helped to find answers to the issues. If you try this out, please remember post your findings as well, it may help the next person...

I will mention one big lesson I learned the hard way, DO NOT do a “yum update” before you register your ClearOS system. It trips something that AUTO-UPGRADES you to the professional version and ELIMINATES THE OPTION OF COMMUNITY VERSION. I had to reload from scratch to register it properly as a community version. The good news is, because of this lesson, I was able to verify that the steps worked for me on the second time too!

Here are the steps. I did everything using: SSH, Firefox and rdesktop on an Ubuntu box.
First, REGISTER YOUR SYSTEM, then get to the command line.

The following steps will update your system using yum, add a virtualbox repository from oracle to your system and install all the other misc stuff you'll need.

##update the system. If you haven't registered your system, do it before doing this update if you want to run the community version (last reminder, I promise).
Code:

yum update -y 



We need to change directories to where the repository files are stored . We are going to download a new repository here so yum will “automagically” find it the next time you update.
Code:

cd /etc/yum.repos.d/ 


Install wget so you can download the file for the new repository
Code:

yum install wget -y 


Download the repository file from virtualbox.
Code:

wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo 


Change driectories back to the root directory so nothing else gets downloaded here by accident.
Code:

cd /root


Now that you have a new repository, it will need to be checked and updated.
Code:

yum update -y 


Get some dependencies
Code:

yum groupinstall "Development Tools" -y 
yum install php-soap gcc dkms kernel-devel -y 


This command came from Tim in another thread but seems to help virtualbox compile correctly because it uses the v6 kernel-headers as opposed the the el6 kernel-headers in the standard repository. See the thread for details... www.clearfoundation.com/component/option.../func,view/id,40819/
Code:

yum --enablerepo=clearos-dev install kernel-devel-`uname -r` kernel-headers-`uname -r` 


Create a vbox system user with a home directory
Code:

/usr/sbin/useradd -r -m vbox 


Create group and add vbox to it
Code:

/usr/sbin/usermod -a -G vboxusers vbox 


Install VirtualBox 4.1 using yum virtualbox.org repository
Code:

yum install VirtualBox-4.1.x86_64 -y 



Now, this is the part that I forgot about BOTH times. I got errors with virtualbox, as noted in the posts previous to this one. Even though the command to install dkms is listed above (and I thought that it did install), virtualbox has issues with it. To fix it, I enabled the “clearos-epel” repository using the web GUI under “System” tab, “Software Repository”. With the new repo, you;ll need another update:
Code:

yum update -y 


Now you will need to install dkms (again?)
Code:

yum install dkms -y


Recompile virtualbox drivers with the new dkms. The recompile didn't have any errors this time.
Code:

/etc/init.d/vboxdrv setup


Also, in 4.1, there is an expansion pack that adds functionality into the machine like RDP. You will neeed to download it from virtualbox.org and install it. Go to the website www.virtualbox.org/wiki/Downloads look up the extension pack and update the address below to match your version. Here is the link for the one I used:
Code:

wget http://download.virtualbox.org/virtualbox/4.1.16/Oracle_VM_VirtualBox_Extension_Pack-4.1.16-78094.vbox-extpack


Use vboxmanage to install it.
Code:

VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-4.1.16-78094.vbox-extpack



So now I had it set up, I needed a machine. Here goes....

First of all, create a new system user called vbox and a group for them.
Code:

/usr/sbin/useradd -r -m vbox
/usr/sbin/usermod -a -G vboxusers vbox


I needed a Windows 7 iso file to load this thing so I converted the installation CD to an iso. Put the CD into your ClearOS machine. Don't worry, it doesn't really catch on fire when the “essence of pure evil” touches your machine. It may smolder though.. Anyway, here's the command to convert the CD to an ISO:
Code:

dd if=/dev/cdrom of=/home/vbox/windows7.iso


Change directories to where it was created and then change the ownership to vbox to avoid “issues”
Code:

cd /home/vbox/
chown vbox:vbox /home/vbox/windows7.iso


You now need to change your user to vbox instead of root, so the rest of these commands are as the user vbox.
Code:

su vbox 


virtualbox creates it's working directory with a space in the name. Spaces can cause you some headaches if they are not escaped. Make a new working directory and and configure virtualbox to use it as the working directory to store virtual machines.
Code:

Mkdir /home/vbox/vms
VBoxManage setproperty machinefolder /home/vbox/vms/ 


Create and register your new virtual machine. The new machine will be stored in the directory you just created.
Code:

VBoxManage createvm --name "Windows7" –register 


This one modifies the new vm and creates a lot of hardware. I set it with 2 gig of ram (2048) since it's not going to be really used heavily, just occasionally for remote access for a Windows user.
First issue I had was it would not run saying something about not 64 bit. AMD FX 4-core “Unlocked” processor and seems to meet all the specs. Wound up being the “ioacpi” setting, it needed to be turned on.
I also had some issues with Windows finding the nic driver at first too so I changed the nictype. There are a few different ones, this one seemed to work so...
I tried using both bridged and nat connections. Ultimately, I didn't need a bridged network on this device so nat worked fine.
Here is the initial command with all the stuff that made mine work:
Code:

VBoxManage modifyvm "Windows7" --memory 2048 --cpus 1 --ioacpi on --acpi on --boot1 dvd --nic1 nat --nictype1 82545EM --ostype "Windows7_64" 


This will create a 40 gig drive for your machine. If you want bigger, just change the 40960 to something higher. (multiples of 1024)
Code:

VBoxManage createhd --filename "HDD-Windows7.vdi" --size 40960 --remember


Now add a controller fot the hard drive
Code:

VBoxManage storagectl "Windows7" --name "storage-ctrl" --add sata 


Attach the new hard drive to the machine
Code:

VBoxManage storageattach "Windows7" --storagectl "storage-ctrl" --port 0 --device 0 --type hdd --medium /home/vbox/vms/Windows7/HDD-Windows7.vdi 


This changed the RPD port to 3389.
Code:

VBoxManage modifyvm "Windows7" --vrde on --vrdeport 3389 


Add the iso file to the machine as it's CDROM
[codeVBoxManage storageattach "Windows7" --storagectl "storage-ctrl" --port 1 --device 0 --type dvddrive --medium /home/vbox/]windows7.iso[/code]
This starts up the machine. Once it's started, use remote desktop or rdesktop to connect by pluggin in your clearos ip followed by the port. Example on Ubuntu: rdesktop 192.168.1.1:3389 and now install Windows 7 from the CD you attached using your RDP session.
Code:

VBoxHeadless --startvm "Windows7" -vrde on -vrdeproperty TCP/Ports=3389 & 



FINALLY, setup autostart. You will want to be root on this one. Type exit if you are still using the vbox user and you should be root again. You will need to add in the following line to the end of /etc/rc.d/rc.local. I used nano: Copy and paste the following at the bottom:
/bin/su -l vbox -c '/usr/bin/VBoxHeadless --startvm Windows7 2>&1 &'
Press CTRL + o to save and CTRL + x to exit when you are done.
Code:

Nano /etc/rc.d/rc.local



If all went well, when you restart your ClearOS system, the virtual machine will startup automagically as well. If the virtual machine is running whenyou want ot reboot, it is probably a good idea to log into it and shut it down before initiating a reboot. I have “LogMeIn” installed in the Windows 7 machine and it comes on-line a few minutes after the server boots up. At this point, the RDP session is pretty much just to check progress if it fails to show “on line” in LogMeIn.

That's about it. If you find a better way, please post it. Thanks again for all the other posts that got it working.
Ryan Van Orden
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#42129
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 3 Weeks ago  
Good write up. Thanks.

A couple of comments. "Development Tools" no longer exist in 6.2 which is why you had to do the line after. The alternative is here

If you are enabling repos generally disabled or adding external repos it is best to leave them disabled and then selectively enable them when required. So, when you enabled clearos-epel you may be better advised to add the "--enable-repo clearos-epel" to your yum commands. You may also want to change the "enabled=1" to "enabled=0" in virtualbox-repo and only selectively enable it. Then when you do an "yum install virtualbox" you enable both the clearos-devel and virtualbox repos. it *may* get round your dkms issue.
Nick Howitt
Platinum Boarder
Posts: 4128
graphgraph
User Online Now Click here to see the profile of this user
Last Edit: 2012/06/20 12:58 By NickH.
The administrator has disabled public write access.
 
#42215
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 2 Weeks ago  
After following post, I installed virtual box, but after i started the vm, windows xp loads all drivers during its setup, and then setip gets stuck on "setup is starting windows"

What could that be? I have tried multuple iso's

Thx
Makc
Senior Boarder
Posts: 46
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#42227
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 2 Weeks ago  
@Nick,
Thanks for the comments, I will address those repo so they don't break anything else. You are 100% correct. I seem to have lost sight of "standard practices in Linux" being "so overwhelmed" with getting this project to work. Thanks for bringing me back...

*************************
Makc wrote:
After following post, I installed virtual box, but after i started the vm, windows xp loads all drivers during its setup, and then setip gets stuck on "setup is starting windows"

What could that be? I have tried multuple iso's

Thx


@Makc
Assuming that everything is working on the host, it will be in your guest's settings. My first thought is that it might have to do with ioacpi. Try turning ioacpi off and see if it makes a difference. Here's the command, change "vmname" to your guest's name.
Code:

VBoxManage modifyvm "vmname"  --ioacpi off



On my first attempt, my vm (windows 7 64) would start loading windows and just reboot. After some more tweeking to the guest, another attempt said that Windows 7 could not load because it was not a 64 bit environment (even though my host hardware meets all the requirements). I also had to change the guest network adapter type (once it actually booted up) so that my guest could find a network driver. They seem to have changed quite a few things in VirtualBox as far as the guest machine parameters. You will probably need to tinker with a few of the guest machine settings to figure out what will work for yours.

Below is the VirtualBox Forum site. Research some of the guest parameters there and try them out. Worst case, you may need to "re-create" your vm a few times. There are quite a few discussions concerning 32bit vs 64bit using: apic, ioapic, PAE/NX, etc. Most of the posts refer to "using the GIU" to change guest settings but since your's is headless, the "VBoxManage modifyvm" command is probably going to be your best friend.
virtualbox forums

Hopefully that gives you a starting place...
Ryan Van Orden
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#42243
Re:Howto - Virtualbox Headless on ClearOS 11 Months, 2 Weeks ago  
Thanks for all who helped. I Finally got my guest os installed and working great. Phew, what a process. But again, thanks

Im running into another issue though. I created a flexshare of files I have stored on the clearos box, and after mapping my share drives in my guest os, I opened a folder and to my surprise for some reason my unicode characters (russian characters) are appearing as under scores (______ ___ .mp3) only the tracks that have either numbers or english characters show up and work great.

For example.

If you navigate to
z:\myfiles\mytracks\10______.mp3 I get my song (10______.mp3)

But if I connect through FTP. I get
ftp://myfiles/mytracks/10песня.mp3

Seems some Unicode option needs to be selected in clear os or something. I have already enabled "Russian" in the regional language and settings on my guest os and restarted it.

Thanks
Makc
Senior Boarder
Posts: 46
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1...910111213141516
  get the latest posts directly to your desktop