Because ClearOS has such a small footprint it actually makes quite a good VM server for various guest OS's.
There are threads on VMWare in the forum, and how to get that setup - so i'd thought i'd have a go with VirtualBox which also has a headerless function which can be viewed using standard Windows Remote Desktop. This makes it great for running remote OS's
The latest version of VirtualBox is 3.1.2 however this version made some config changes from 3.0.x to the way in which storage controllers and resources are called up (long story short to enable more than one DVD drive etc)...I had more success with the tried and tested 3.0.12 method so this Howto is based around that version. Hopefully in future we'll be able to update this with the newer version. Be careful when googling for info as the syntax changed between versions.
INSTALLATION
First up you will need the devel tools to enable the kernel modules to be compiled during install. If you are running the PAE kernel, replace with kernel-PAE-devel
Download the RPM for RHEL5 i386
Installation will create a group called vboxusers, we need to add a user to this group, or create a seperate vbox specific user. I went for the latter as I wanted to keep it separate from my other accounts. User is named 'vbox' for example, we also then add the user to the vboxusers group
VirtualBox is not LDAP aware so these need to be system user / accounts, hence the -r flag for useradd. It should create a user with an SID < 500 so that it is not removed by the system at a later date.
This should confirm that you user has been created and associated with the group
cat /etc/passwd | grep vbox
cat /etc/group | grep vbox
CREATE AND CONFIGURE A VM
Now on to the fun bit...! Creating a VM ( I won't touch on importing your own *.vdi or *.ovf appliances here, have a read of the VirtualBox manual over here for clues http://www.virtualbox.org/manual/UserManual.html
First switch to the new user, then we will start to create the VM. Note using the GUI is so much easier but we don't want the overheads of the full X system so stick with it it will start to make some sense
Again NOTE sysntax has changed for the new 3.1.2 version, this applies to 3.0.12
Outline steps are:- switch to vbox user (all configuration is by default stored in /home/vbox/.VirtualBox/ subfolders
Create the VM name and register it, remember this or write it down, I called mine Windows XP
This should return without error. The VM will be created under /home/vbox/.VirtualBox/Machines/...you can of course symlink this to another directory on the system if you wish
Now to setup some basic parameters for the VM. We are using 512MB, boot DVD first, use basic bridged connection with the LAN interface to give it internet access. You can also specifcy --nic2 etc...or --nic1 nat. See VBoxManage man page for full config details
Now to create the VM HD, set to 10GB, and stored under /home/vbox/.VirtualBox/HardDisks/. We then assign this HD to our VM as the primary HD device hda
Next step to register our installation ISO with VirtualBox (this is akin to the media manager if you've used the GUI before). We then register this as the DVD drive associated with our VM. The ISO can live anywhere on your system as long as vbox can read it.
START YOUR VM
Thats it! a basic config that should now get a VM install running. To start our VM headerless we now run the following, and then connect remotely using Windows Remote Desktop to ClearOS (port 3389 is used by default). Note the & at the end, this will force it to run in the background, so you should ensure you shutdown the VM correctly or use VBoxManage to control / save the states on exit)
To detach the DVD iso (i.e. eject it) use the following
You may also try - if the VM is running
GUEST ADDITIONS
Now I found that the display and mouse did not correlate very well until I install the guest additions. So....register and attach the guest additons ISO, then boot your VM and run the installer from within the OS
Enjoy!
For more configuration options refer to http://www.virtualbox.org/manual/UserManual.html#vboxmanage-modifyvm Particularly for increasing the video card memory size, NIC options etc.
TIPS - To be completed....
Want to see a VM config? use VBoxManage showvminfo "WindowsXP"
Want to see HD config? use VBoxManage showhdinfo harddiskname.vdi
Want to change Video RAM allocated to VM? use VBoxManage modifyvm "WindowsXP" --vram 128MB
Want to enable USB and USB2.0? use VBoxManage modifyvm "WindowsXP" --usb on --usbehci on
Want to shutdown a VM? use VBoxManage controlvm "WindowsXP" acpipowerbutton (for instant off, use poweroff)
Need to press CTRL-ALT-DEL to login over RDP? it's locked solely to the local machine, so use CTRL-ALT-END instead
Want to see other ostypes? use VBoxManage list ostypes
There are threads on VMWare in the forum, and how to get that setup - so i'd thought i'd have a go with VirtualBox which also has a headerless function which can be viewed using standard Windows Remote Desktop. This makes it great for running remote OS's
The latest version of VirtualBox is 3.1.2 however this version made some config changes from 3.0.x to the way in which storage controllers and resources are called up (long story short to enable more than one DVD drive etc)...I had more success with the tried and tested 3.0.12 method so this Howto is based around that version. Hopefully in future we'll be able to update this with the newer version. Be careful when googling for info as the syntax changed between versions.
INSTALLATION
First up you will need the devel tools to enable the kernel modules to be compiled during install. If you are running the PAE kernel, replace with kernel-PAE-devel
yum groupinstall "Development Tools"
yum install kernel-devel
Download the RPM for RHEL5 i386
cd /var/tmp
wget http://download.virtualbox.org/virtualbox/3.0.12/VirtualBox-3.0.12_54655_rhel5-1.i386.rpm
yum localinstall VirtualBox-3.0.12_54655_rhel5-1.i386.rpm
Installation will create a group called vboxusers, we need to add a user to this group, or create a seperate vbox specific user. I went for the latter as I wanted to keep it separate from my other accounts. User is named 'vbox' for example, we also then add the user to the vboxusers group
/usr/sbin/useradd -r -m vbox
/usr/sbin/usermod -a -G vboxusers vbox
VirtualBox is not LDAP aware so these need to be system user / accounts, hence the -r flag for useradd. It should create a user with an SID < 500 so that it is not removed by the system at a later date.
This should confirm that you user has been created and associated with the group
cat /etc/passwd | grep vbox
cat /etc/group | grep vbox
CREATE AND CONFIGURE A VM
Now on to the fun bit...! Creating a VM ( I won't touch on importing your own *.vdi or *.ovf appliances here, have a read of the VirtualBox manual over here for clues http://www.virtualbox.org/manual/UserManual.html
First switch to the new user, then we will start to create the VM. Note using the GUI is so much easier but we don't want the overheads of the full X system so stick with it it will start to make some sense
Again NOTE sysntax has changed for the new 3.1.2 version, this applies to 3.0.12
Outline steps are:- switch to vbox user (all configuration is by default stored in /home/vbox/.VirtualBox/ subfolders
Create the VM name and register it, remember this or write it down, I called mine Windows XP
su vbox
VBoxManage createvm --name "WindowsXP" --ostype "WindowsXP" --register
This should return without error. The VM will be created under /home/vbox/.VirtualBox/Machines/...you can of course symlink this to another directory on the system if you wish
Now to setup some basic parameters for the VM. We are using 512MB, boot DVD first, use basic bridged connection with the LAN interface to give it internet access. You can also specifcy --nic2 etc...or --nic1 nat. See VBoxManage man page for full config details
VBoxManage modifyvm "WindowsXP" --memory "512MB" --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 eth0
Now to create the VM HD, set to 10GB, and stored under /home/vbox/.VirtualBox/HardDisks/. We then assign this HD to our VM as the primary HD device hda
VBoxManage createhd --filename "WinXP.vdi" --size 10000 --remember
VBoxManage modifyvm "WindowsXP" --hda "WinXP.vdi"
Next step to register our installation ISO with VirtualBox (this is akin to the media manager if you've used the GUI before). We then register this as the DVD drive associated with our VM. The ISO can live anywhere on your system as long as vbox can read it.
VBoxManage openmedium dvd /full/path/to/iso.iso
VBoxManage modifyvm "WindowsXP" --dvd /full/path/to/iso.iso
START YOUR VM
Thats it! a basic config that should now get a VM install running. To start our VM headerless we now run the following, and then connect remotely using Windows Remote Desktop to ClearOS (port 3389 is used by default). Note the & at the end, this will force it to run in the background, so you should ensure you shutdown the VM correctly or use VBoxManage to control / save the states on exit)
VBoxHeadless --startvm "WindowsXP" &
To detach the DVD iso (i.e. eject it) use the following
VBoxManage modifyvm "WindowsXP" --dvd none
You may also try - if the VM is running
VBoxManage controlvm "WindowsXP" dvdattach none
GUEST ADDITIONS
Now I found that the display and mouse did not correlate very well until I install the guest additions. So....register and attach the guest additons ISO, then boot your VM and run the installer from within the OS
VBoxManage openmedium dvd /usr/share/virtualbox/VBoxGuestAdditions.iso
VBoxManage modifyvm "WindowsXP" --dvd /usr/share/virtualbox/VBoxGuestAdditions.iso
Enjoy!
For more configuration options refer to http://www.virtualbox.org/manual/UserManual.html#vboxmanage-modifyvm Particularly for increasing the video card memory size, NIC options etc.
TIPS - To be completed....
Want to see a VM config? use VBoxManage showvminfo "WindowsXP"
Want to see HD config? use VBoxManage showhdinfo harddiskname.vdi
Want to change Video RAM allocated to VM? use VBoxManage modifyvm "WindowsXP" --vram 128MB
Want to enable USB and USB2.0? use VBoxManage modifyvm "WindowsXP" --usb on --usbehci on
Want to shutdown a VM? use VBoxManage controlvm "WindowsXP" acpipowerbutton (for instant off, use poweroff)
Need to press CTRL-ALT-DEL to login over RDP? it's locked solely to the local machine, so use CTRL-ALT-END instead
Want to see other ostypes? use VBoxManage list ostypes
Share this post:
Responses (157)
-
Accepted Answer
-
Accepted Answer
Interesting,
I run ClearOS as a Virtual Headless on a minimal installed Ubuntu Server.
Makes a good move for backing up my ClearOs system, even on the fly migrate it to another computer, without rewriting all proper customisations I've done.
It makes also a separation possible between my internal network and the "public" part.
Geert -
Accepted Answer
-
Accepted Answer
I don't know if it will be possible to compare both
This is my virtual OS
Model AMD Athlon(tm) 64 X2 Dual Core Processor 4400+
CPU Speed 1 GHz
Cache Size 512.00 KB
System Bogomips 2004.84
this is the ubuntu server
Model AMD Athlon(tm) 64 X2 Dual Core Processor 4400+
CPU Speed 1 GHz
Cache Size 512.00 KB
System Bogomips 2004.84
I have a dual core processor, but I'm planning to replace this machine for a Mac Mini (Low power consumption)
I'm still using 3.04 for now, but will upgrade soon.
Geert -
Accepted Answer
Many thanks for the instructions, this is exactly what I intend to do if our management lets me kick out the ageing Windows server in order to run the few Windows only services I can't replace with Linux alternatives (such as license servers).
I have come across a problem trying to create a new VM as the underprivileged "vbox" user. I keep on getting the message "ERROR: failed to initialize COM!". As root I can create a VM without any problem, but I'd rather not. Any idea on how I can solve this? -
Accepted Answer
-
Accepted Answer
Thanks for the lightning fast reply! The permissions hint made me realize that the vbox home directory had never existed to begin with. I just created it and now things work fine.
One small detail though: instead of --ostype=WindowsXP I had to use --ostype "WindowsXP" or else the createvm command would throw an error. -
Accepted Answer
Ahh ok thanks i'll amend the syntax above, as a general note you can remove the quotation marks for all items that don't include spaces
For information, other permitted OS types are:-
VBoxManage list ostypes | grep ID
ID: Other
ID: Windows31
ID: Windows95
ID: Windows98
ID: WindowsMe
ID: WindowsNT4
ID: Windows2000
ID: WindowsXP
ID: WindowsXP_64
ID: Windows2003
ID: Windows2003_64
ID: WindowsVista
ID: WindowsVista_64
ID: Windows2008
ID: Windows2008_64
ID: Windows7
ID: Windows7_64
ID: WindowsNT
ID: Linux22
ID: Linux24
ID: Linux24_64
ID: Linux26
ID: Linux26_64
ID: ArchLinux
ID: ArchLinux_64
ID: Debian
ID: Debian_64
ID: OpenSUSE
ID: OpenSUSE_64
ID: Fedora
ID: Fedora_64
ID: Gentoo
ID: Gentoo_64
ID: Mandriva
ID: Mandriva_64
ID: RedHat
ID: RedHat_64
ID: Turbolinux
ID: Ubuntu
ID: Ubuntu_64
ID: Xandros
ID: Xandros_64
ID: Linux
ID: Solaris
ID: Solaris_64
ID: OpenSolaris
ID: OpenSolaris_64
ID: FreeBSD
ID: FreeBSD_64
ID: OpenBSD
ID: OpenBSD_64
ID: NetBSD
ID: NetBSD_64
ID: OS2Warp3
ID: OS2Warp4
ID: OS2Warp45
ID: OS2eCS
ID: OS2
ID: DOS
ID: Netware
ID: L4
ID: QNX -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
You can't directly remove the whole group "development tools" but you can remove most of the RPM's it installs
see the attached thread
http://www.clearfoundation.com/index.php?option=com_kunena&Itemid=232&func=view&id=712&catid=40#712
You can safely remove kernel-devel if you wish -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
I will amend the how to so that it uses yum, then it will pick up the libSDL dependancy, must already be on my system!
You only need to install the relevant kernel-devel or kernel-PAE-devel rpm, as Carl posted above
BSOD > To automate startup of a VM you can add the line to /etc/rc.local, but will need to pass user credentials so that it doesn't startup as root. Something like the following will run as user vbox
su vbox -c '/usr/bin/VBoxHeadless --startvm myvmname'
-
Accepted Answer
-
Accepted Answer
-
Accepted Answer
VirtualBox is a pretty good solution, however there are a few caveats: it won't automatically start your VMs and it won't automatically save the state at shutdown. Also, support for W7 is still lacking. However the autostart you can solve by employing the following solution:
http://vboxtool.sourceforge.net/
Now since you will be running these services headless, you need to be extra cautious when you enable RDS, to add yourself as a remote user.
Thanks. -
Accepted Answer
GREAT HowTo ! Thanks.
One suggestion for newbie: how do I determine which kernel I am running ? (regular or PAE)
And -- with a fresh install of ClearOS5.1 -- I ran into a problem when executing "yum localinstall Virtual...".
Total download size: 96 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: Header V4 DSA signature: NOKEY, key ID 6dfbcbae
Public key for VirtualBox-3.0.12_54655_rhel5-1.i386.rpm?e=1267227605&h=a9d6f71f94533a29522812450ecddb0e
TIA for any help. -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
I have struggled for an entire day trying to get the USB function to work in the WindowsXP guest without success. Much searching the forums and googling. "lsusb" and "VBoxManage list usbhost" show the device (MagicJack) on the host. I've tried USB filters (and of course "--usb on" and "--usbehci on"). I've installed GuestAdditions. The guest, in general, works fairly well, and I've learned to use bridged networking so that the guest has access to the internal network ( I need to switch that later to the external one ), so that way RemoteDesktop is working well.
I've also played with a usb memory stick (w/o filters, but usbattach instead) ... no success.
In the guest, under Device Manager, the USB controller shows up (82801FB).
When I try "VBoxManage controlvm "WindowsXP" usbattach /proc/bus/usb/002/002" while the guest is already up and running I get the error " USB device <XXXXX> with UUID {YYYYY} is being exclusively used by the host computer".
In frustration I tried unplugging and re-plugging the device; on the host this causes the Device# to change, although it stays on the same bus#.
SOOO ... any hints (better: full procedural instructions) to get the MagicJack USB device working inside the WinXP guest would be appreciated.
TIA. -
Accepted Answer
*D'OH* flood protection deleted my reply,
Anyhow - looks like you have tried most things - I don't use USB drives here so can't test. The filter concept seems a little complicated!
One thing I do know you cannot mount the drive on the guest if already in use on the host. You may need to check it's not mounted already? -
Accepted Answer
Yeah, it is "claimed" (rather than mounted) already by the host, as indicated with the status "Busy" or (in the case of a filtered device) "Unavailable" when doing a "VBoxManage list usbhost". That's one of the issues. But have not yet figured out how to "unclaim" it. (It's not actually auto-mounted like it might be in Ubuntu.)
I did a COMPLETE re-install (new vm name & vdi) of the WinXP system overnight, then added the GuestAdditions first before activating the USB. And what do you know (but ONE TIME ONLY) I was able to see the flash memory stick in the freshly-installed Guest. But since then ... bupkes! Have tried many other things but will need to stop soon and resume over the weekend.
Now messing with permissions (devgid and "10-vboxdrv.rules" and "50-udev.rules" in "/etc/udev/rules.d/").
One of the troubles also is that I am no Linux guru. So much of the web advice that is particular to a specific distribution may not apply to CentOS.
Thanks for listening and any more hints ... -
Accepted Answer
Update: ALRIGHT! B) Got something ... of course it breaks something. hmy:
In THIS post linuxguy gives a valuable NewRule suggestion. It works (the one time I tried it so far). When I insert the flash memory stick it no longer shows up under "lsusb", meaning it's invisible to the host (i.e. it is not "claimed"). Using "VBoxManage list usbhost" shows the device as "Busy".
And it also works the same way with the MagicJack device. But an additional "usbdetach" and "usbattach" is needed for it to "boot" (do its MagicJack thing). Then it trips up ... a third cycle is needed, then you can make phone calls. Yeah ! :woohoo:
The downside is that this NewRule applies to all USB devices inserted to the host. I need to find a way around this. For now I don't mind that all USB devices become visible to the Guest only, but long term that's no good. May be the filtering mechanism or a more complicated rule will help. And that may fix the multiple attach/detach cycles required. For now I need to take a break on this. -
Accepted Answer
-
Accepted Answer
Guest shutdown: On the Host I think you should be able to use
VBoxManage controlvm <vm_name> acpipowerbutton
I am planning to incorporate this into the shutdown/reboot sequence, including the case where an APC UPS triggers a shutdown during a longer power-outage. Not yet sure how long a delay may be required to ensure complete shutdown of the Guest before the Host powers down (or reaches a critical run-level (Linux Host) in case of shares being in use).
Don't know how this code is issued on a non-linux Host. -
Accepted Answer
-
Accepted Answer
I use this setup to run a "Windows 2000" Setup. Everything is working fine but I still have the two issues mentioned in this text
GUEST ADDITIONS
Now I found that the display and mouse did not correlate very well until I install the guest additions. So....register and attach the guest additons ISO, then boot your VM and run the installer from within the OS
Code:
VBoxManage openmedium dvd /usr/share/virtualbox/VBoxGuestAdditions.iso
VBoxManage modifyvm "ExquiseLab" --dvd /usr/share/virtualbox/VBoxGuestAdditions.iso
I both executed these commands without errors. Restarting my virtual machine "ExquiseLab" did not help. Do I need to reinstall Windows 2000 ? If not, were can I find the instruction/documentation to solved my double mouse pointer and bad Video display
Found the solution.... myself ;-)
Go to -> my computer
Diskdrive D was mounted with VBoxGuestAdditions -> Run setup & Reboot
Maybe helpfull for others -
Accepted Answer
-
Accepted Answer
-
Accepted Answer
Hi, For one time only:-
VBoxHeadless startvm myvmname --vrdpport 12345
For permanent setting
VBoxManage modifyvm myvmname --vrdpport 12345
VBoxHeadless startvm myvmname
More details here
http://www.virtualbox.org/manual/ch08.html#vboxmanage-modifyvm-other -
Accepted Answer
Thanks for helping me change the port on my config. Your Tip works fine.
Running in a next problem.....
Trying to run 2 session parallel. (individual there is no problem)
Session 1 is Windows2000pro -> port 3398
Session 2 is WindowsXP -> port 3390
Using mRemote as a client for these machines
When both started on a dual core machine (Shuttle K45 mainboard), I do get a 'system freeze'. Even ClarkConnect is not reacting anymore.
a) Is it possible to run simulations server instances ?
b) How to debug this ?
Thanks again in advance
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »