Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

How would I go about installing virtualbox or vmware so I can run a virtual Windows XP / Server2008 on a gentoo server which doesnt run X, and that I have only SSH/FTP access to.

 

Is it possible??

  • 3 weeks later...
Posted

Hi Robert,

 

So you get a version of VBox from this century

 

echo "app-emulation/virtualbox-bin" >> /etc/portage/package.keywords

echo "app-emulation/virtualbox-modules" >> /etc/portage /package.keywords

emerge virtualbox-bin

 

Once that's installed, run the following commands to create the vm.

 

VBoxManage createvm -name "Test" -register

VBoxManage modifyvm "Test" -memory "256MB" -acpi on -boot1 dvd -nic1 nat

VBoxManage createvdi -filename "Test.vdi" -size 1000 -register

VBoxManage modifyvm "Test" -hda "Test.vdi"

VBoxManage registerimage dvd /root/install-x86-minimal-20090623.iso

VBoxManage modifyvm "Test" -dvd /root/install-x86-minimal-20090623.iso

 

Run this to start the virtual machine

 

VBoxHeadless -startvm "Test"

 

It'll be listening on port 3389 for an RDP Client unless you change this port in the VBoxHeadless command above.

 

I note you mention you only have SSH/SFTP access, I figure you could tunnel this over SSH or have a port opened or so but I've tested this out to run an installation of Gentoo internally in itself and it seems to work fine.

 

Worth a go.

  • Thanks 1
Posted

Thanks so much for that! Ive got openvpn setup now so am pretty much local now. Ill get right on trying this out.

 

Thanks again for all that time and effort.

Posted

OK so for the interest of everyone else thats gonna be doing this ill paste a detailed account of the stages.

 

oasis ~ # emerge -av virtualbox-bin 

These are the packages that would be merged, in order:

Calculating dependencies... done!

emerge: there are no ebuilds built with USE flags to satisfy "media-libs/libsdl[X]".
!!! One of the following packages is required to complete your request:
- media-libs/libsdl-1.2.13-r1 (Change USE: +X)
(dependency required by "app-emulation/virtualbox-bin-2.2.4" [ebuild])
(dependency required by "virtualbox-bin" [argument])

 

So i figure I needed the libsdl package installed...

 

oasis ~ # emerge -av libsdl

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] media-libs/libsdl-1.2.13-r1  USE="alsa audio esd joystick oss video xv -X -aalib -arts -custom-cflags -dga -directfb -fbcon -ggi -libcaca -nas -opengl -pulseaudio (-svga) -xinerama" 3,295 kB

Total: 1 package (1 new), Size of downloads: 3,295 kB

 

Once thats installed, I try to emerge vbox again..

 

oasis ~ # emerge -av virtualbox-bin 

These are the packages that would be merged, in order:

Calculating dependencies... done!

emerge: there are no ebuilds built with USE flags to satisfy "media-libs/libsdl[X]".
!!! One of the following packages is required to complete your request:
- media-libs/libsdl-1.2.13-r1 (Change USE: +X)
(dependency required by "app-emulation/virtualbox-bin-2.2.4" [ebuild])
(dependency required by "virtualbox-bin" [argument])

 

Failed again, so I look closer and i see the Change USE: +X line..

 

Am i right in thinking I need to change my make.conf to incluse USE +X and then remerge libsdl?

Posted

OK, so I changed /etc/make.conf to have USE=X rather than USE= -X

 

oasis ~ # emerge -av libsdl

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R   ] media-libs/libsdl-1.2.13-r1  USE="X* alsa audio esd joystick oss video xv -aalib -arts -custom-cflags -dga -directfb -fbcon -ggi -libcaca -nas -opengl -pulseaudio (-svga) -xinerama" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] 

 

So I install that again... and then try to emerge virtual box:

 

oasis ~ # emerge -av virtualbox-bin 

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] media-libs/libmng-1.0.10  USE="-lcms" 1,068 kB
[ebuild  N    ] app-emulation/virtualbox-modules-2.2.4  470 kB
[ebuild  N    ] app-emulation/virtualbox-bin-2.2.4  USE="additions chm -headless -sdk -vboxwebsrv" 44,399 kB

Total: 3 packages (3 new), Size of downloads: 45,937 kB

Would you like to merge these packages? [Yes/No] 

 

So far So good...

Posted

Once thats done I scroll up to see if theres any important messages, and take note of them just in case..

 

* To launch VirtualBox just type: "VirtualBox"
* 
* You must be in the vboxusers group to use VirtualBox.
* 
* For advanced networking setups you should emerge:
* net-misc/bridge-utils and sys-apps/usermode-utilities

 

* Starting with the 2.1 release a new kernel module was added,
* be sure to load all the needed modules.
* 
* Please add "vboxdrv" and "vboxnetflt" to:
* /etc/modules.autoload.d/kernel-2.6

 

Onwards we go..

Posted

oasis ~ # VBoxManage createvm -name "Test" -register 
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Virtual machine 'Test' is created and registered.
UUID: 34187ba8-7f1a-4db6-92f8-cf445f3259b9
Settings file: '/root/.VirtualBox/Machines/Test/Test.xml'

 

oasis ~ # VBoxManage modifyvm "Test" -memory "256MB" -acpi on -boot1 dvd -nic1 nat
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

 

oasis ~ # VBoxManage createvdi -filename "Test.vdi" -size 1000 -register
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Disk image created. UUID: c130be56-b0f2-4c2a-829d-c37b92f5cde3

 

oasis ~ # VBoxManage modifyvm "Test" -hda "Test.vdi"
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

 

oasis ~ # VBoxManage registerimage dvd /root/install-x86-minimal-20090623.iso
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

[!] FAILED calling virtualBox->OpenDVDImage(filepath, Guid(), dvdImage.asOutParam()) at line 6661!
[!] Primary RC  = NS_ERROR_FAILURE (0x80004005) - Operation failed
[!] Full error info present: true , basic error info present: true 
[!] Result Code = NS_ERROR_FAILURE (0x80004005) - Operation failed
[!] Text        = Could not open the CD/DVD image '/root/install-x86-minimal-20090623.iso' (VERR_FILE_NOT_FOUND)
[!] Component   = DVDImage, Interface: IDVDImage, {140fff03-e479-4194-8562-abc4f8171009}
[!] Callee      = IVirtualBox, {557a07bc-e6ae-4520-a361-4a8493199137}

 

Well, I dont have that ISO in that location, so that was obvious it was going to fail... Ill try my Windows 2003 Server image Ive just made.

 

oasis ~ # wget http://192.168.2.4/win2003serv.iso
--2009-07-02 18:08:16--  http://192.168.2.4/win2003serv.iso
Connecting to 192.168.2.4:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 596588544 (569M) [application/x-iso9660-image]
Saving to: `win2003serv.iso'

100%[=============================================================================================================================>] 596,588,544 11.2M/s   in 51s     

2009-07-02 18:09:07 (11.2 MB/s) - `win2003serv.iso' saved [596588544/596588544]

 

oasis ~ # VBoxManage registerimage dvd /root/win2003serv.iso 
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

 

oasis ~ # VBoxManage modifyvm "Test" -dvd /root/win2003serv.iso                  
VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

 

So far so good.. now to test if it runs...

Posted

oasis ~ # VBoxHeadless -startvm "Test" 
VirtualBox Headless Interface 2.0.2
(C) 2008 Sun Microsystems, Inc.
All rights reserved

Listening on port 3389

 

No errors. But I cant seem to get my ubuntu RDP to connect to it. Ill try in my XP VM.

 

And here it is in all its glory. Windows XP Virtual Machine, running on an Ubuntu Host, connecting over VPN, to a Gentoo server, running a virtual Windows 2003 Server setup.

 

NICE. Many thanks to kmount. :D

 

http://www.peninsulafm.com/virtualwow.png

Posted
couple of additional questions... im running the VBoxHeadless -startvm "Test" command in screen just now, so i can detatch from the terminal and leave it running.. is there any way to run it as a daemon, or even set it to run on startup? And also, Ive got 2003 serv up and running, sitting at the logon screen, how can i send a crtl-alt-del over rdp?
Posted

You can push it into the background by putting & after the command which should suffice.

 

Quick script to check whether it's running and if not could be the following. (Written kind of from memory so would be worth testing!)

 

VBoxManage -q list runningvms | grep "Test" || (VBoxHeadless -startvm "Test" &)

 

Depending upon what rdp client you're using, you should be able to set up a hotkey to push CTRL/ALT/DEL across or try CTRL ALT INSERT first.

  • Thanks 1
Posted

@RabbieBurns: Di you try (Righthand)Ctrl+Del? This is the default shortcut to send Ctrl+Alt+Del in VirtualBox.

 

Please do post on the wiki too... or ask EduTech or FN-GM REALLY nicely for a hand ;)

  • Thanks 1
Posted

ctrl-alt-ins worked on xp remote desktop, but in ubuntu I cant get anything working.

 

Do I need to install the virtualbox-toolbox thing as well for the client os so I can get proper resolution?

Posted
Ok, with messing with the settings in the terminal services client in ubuntu, I have managed to get ctrl-alt-del working by specifically choosing then en-uk keyboard, rather than the option to detect it :)
Posted

Sorry for another question.... but how would i get the new VM to have an IP address on the same network as the host, and be viewable from all other hosts on the network - rather than being NAT'd from the gentoo host IP?

 

Would that involve what I took a note of earlier?

For advanced networking setups you should emerge:

* net-misc/bridge-utils and sys-apps/usermode-utilities

Posted

Just knocked this up to simplify things for me.. Doesnt do any sanity checking for input or anything, but its a start...

 

#!/bin/bash
echo Create New VirtualBox Machine Helper
echo ------------------------------------
echo
echo -n "Enter a name for your machine: "
read MACHINENAME
echo -n "How much RAM should it have? (eg 512): "
read RAM
echo -n "How big HD to create? (eg 10000 = 10gb): "
read HDSIZE
echo -n "Do you need to register a new .iso? (Y/N): "
read REGISO
       if [ "$REGISO" = "Y" ] || [ "$REGISO" = "y" ]; then
               echo -n "Enter .iso file to register, including full path: "
               read NEWISO
               echo Registering new .iso ...
               VBoxManage registerimage dvd $NEWISO
       fi
echo -n "Enter .iso file to use for boot, including full path: "
read ISO
read -p "Press any key to start creating the Virtual Machine "
echo Creating machine...
VBoxManage createvm -name "$MACHINENAME" -register
echo Setting specs...
VBoxManage modifyvm "$MACHINENAME" -memory "$RAMMB" -acpi on -boot1 dvd -nic1 nat
echo Creating HD...
VBoxManage createvdi -filename "$MACHINENAME.vdi" -size $HDSIZE -register
echo Registering HD...
VBoxManage modifyvm "$MACHINENAME" -hda "$MACHINENAME.vdi"
echo Setting Boot CD...
VBoxManage modifyvm $MACHINENAME -dvd $ISO
echo All Done...
echo

 

also made this as well for new cd images:

 

#!/bin/bash
echo Virtualbox register new .iso image
echo ----------------------------------
echo -n "Enter image filename (including path): "
read iso
VBoxManage registerimage dvd $iso

 

Not sure if anyones as lazy as me, but posted these here anyway...

Posted

To install the Guest Additions, you need to register the .iso which is included...

 

VBoxManage registerimage dvd /opt/VirtualBox-2.0.2/additions/VBoxGuestAdditions.iso

 

and then assign it to the VM

 

VBoxManage controlvm "2003Server" dvdattach /opt/VirtualBox-2.0.2/additions/VBoxGuestAdditions.iso

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...