1. Subscriptions
  2. Services
  3. Hardware
  4. Support

ClearFoundation

Forums
Welcome, Guest
Howto - Virtualbox Headless on ClearOS
(1 viewing) 1 Guest
Go to bottomPage: 12345678...14
TOPIC: Howto - Virtualbox Headless on ClearOS
****
#2834
Howto - Virtualbox Headless on ClearOS 2 Years, 1 Month ago  
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
Code:

yum groupinstall "Development Tools"
yum install kernel-devel



Download the RPM for RHEL5 i386
Code:

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

Code:

/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 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

Code:

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
Code:

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
Code:

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.
Code:

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)
Code:

VBoxHeadless --startvm "WindowsXP" &



To detach the DVD iso (i.e. eject it) use the following
Code:

VBoxManage modifyvm "WindowsXP" --dvd none


You may also try - if the VM is running
Code:

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
Code:

VBoxManage openmedium dvd /usr/share/virtualbox/VBoxGuestAdditions.iso
VBoxManage modifyvm "WindowsXP" --dvd /usr/share/virtualbox/VBoxGuestAdditions.iso



Enjoy!
For more configuration options refer to 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
Tim Burgess
Moderator
Posts: 4209
graph
User Online Now Click here to see the profile of this user
Last Edit: 2010/02/15 08:36 By timb80.
The administrator has disabled public write access.
 
#2847
Re: Howto - Virtualbox Headless on ClearOS 2 Years, 1 Month ago  
Tim,

thanks for this howto! will be using this for sure.

regards,
Ruud.
Ruud van Lent
Gold Boarder
Posts: 194
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2984
Re:Howto - Virtualbox Headless on ClearOS 2 Years, 1 Month ago  
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
Geert Decorte
Junior Boarder
Posts: 25
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#2989
Re:Howto - Virtualbox Headless on ClearOS 2 Years, 1 Month ago  
Hi Geert, yes doing it the other way round is a good idea too. I wonder though which has the smaller footprint as a server OS, Ubuntu or ClearOS without any extra packages?

Also, which version are you using? 3.1.2
Tim Burgess
Moderator
Posts: 4209
graph
User Online Now Click here to see the profile of this user
Last Edit: 2010/01/07 14:30 By timb80.
The administrator has disabled public write access.
 
#2995
Re:Howto - Virtualbox Headless on ClearOS 2 Years, 1 Month ago  
I don't know if it will be possible to compare both

This is my virtual OS

Code:


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

Code:


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
Geert Decorte
Junior Boarder
Posts: 25
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#3672
permissions problem 2 Years ago  
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?
Dominik Schmid
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#3674
Re: permissions problem 2 Years ago  
Hi Dominik, sounds like one of the files or directories (probably the Machines directory) has the wrong permissions within the /home/vbox/.VirtualBox folder

You could check with 'ls -lap'. Mine are all owned by the vbox user, and allusers group
Tim Burgess
Moderator
Posts: 4209
graph
User Online Now Click here to see the profile of this user
The administrator has disabled public write access.
 
#3676
Re:Howto - Virtualbox Headless on ClearOS 2 Years ago  
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.
Dominik Schmid
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
#3677
Re:Howto - Virtualbox Headless on ClearOS 2 Years ago  
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:-
Code:

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

Tim Burgess
Moderator
Posts: 4209
graph
User Online Now Click here to see the profile of this user
Last Edit: 2010/01/18 10:12 By timb80.
The administrator has disabled public write access.
 
#4751
Re:Howto - Virtualbox Headless on ClearOS 2 Years ago  
Why this happens ?!
Code:

yum install "Development Tools"
Loading "protect-packages" plugin
Loading "kmod" plugin
Setting up Install Process
Parsing package install arguments
No package Development Tools available.
Nothing to do

Luis Galhardo
Fresh Boarder
Posts: 10
graphgraph
User Offline Click here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 12345678...14
  get the latest posts directly to your desktop