john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

Virtualbox winxp host centos5 guest netinstall virtualbox recursively

virtualbox-winxp-host-centos5-guest-netinstall-then-install-virtualbox

REMEMBER TO USE THE RIGHT CONTROL KEY ON THE KEYBOARD TO "RELEASE" your mouse if it gets "stolen" by vbox centos install (which has no mouse) Or you can use: ctl+alt+del -> cancel to force the os out of the current app and back again.

ALSO, IF YOU'RE CURIOUS, use the GUI to change a setting then open up the vm.xml file in notepad and see what it says... but don't go changing things in there without a backup first! (AND better to just use the virtualbox command line utilities, VBoxManage)


GUI start virtualbox -> create new machine

824MB RAM setup 20GB dynamic hard drive (faster to setup) afterwards choose settings -> add centos netinstall iso to media manager - set as "current" ensure NAT is the default internet setting but pick a gigabit adapter =] set hard drive as SATA 0 (with an extra SATA ACHI controller)

start up virtual machine with iso in virtual cdrom (tab key to navigate menus in text install mode)

choose DHCP (using NAT anyways as it is Vbox Default)

http setup...

www.mirrorservice.org /sites/mirror.centos.org/5.3/os/i386/

looking for: stage2.img

wait 5-10 minutes... retrieving the "images/stage2.img" file (over the net!)

Chose "VNC" just to see what it's like (more functionality?) "The VNC server is now running... Please connect to 10.0.2.15:1" -oops make sure you have a vnc viewer! BUT AHHH! it's NAT, so that won't work?

ok... back to "text install" (if it HAD been vbox bridged and centos static ip...)

ctl+c kills the installation and reboots the virtual machine


create a custom layout (I hate LVM's and I don't need the complexity in a VirtualMachine) /dev/sda sda1 = / =20GB 1 big root, no swap no nothing

GRUB - no password on /sda1 -install on MBR unless dual booting (e.g. winxp), in which case create a /boot partition

configure eth0 for DHCP (for now) but manual hostname (e.g. centos5)

root password...


YAY! CUSTOMIZE SOFTWARE we'll go with BASE and EDITORS F2 for group details... use google "linux man atmu" etc. on the HOST machine to figure out...

-hmmm... I can remove obviously not needed stuff on my virtual server, even from BASE:

bluez-utils (linux bluetooth protocol stack) irda (infra-red) wireless-tools

NOTE THE SERVER CONFIGURATION TOOLS ARE GUI - SO NOT CHOSEN...

ADDED: hardlink, gparted PRINTING SUPPORT

I generally prefer to install things manually (or have a script run yum a lot)...

again wait 30-40 minutes (depending on the power of your system) - because it's a netinstall! (says 728MB - that doesn't sound right... yeesh! what a "minimal" BASE)

Devices -> Unmount cdrom and then hit enter to reboot


Watch the vbox console start up with grub and then the new centos5 installation... log in as "root" and root password

halt


change virtual machine settings to give it a bridged network card...

(c:\program files\sun\xVM VirtualBox ... why the heck did sun include all of those spaces and capital letters!)

VBoxManage >> vboxmanual.txt (so we can read all of the required parameters)

VBoxManage modifyvm centos5 -nic1 bridged -bridgeadapter1 "Dell Wireless 1390 WLAN Mini-Card"

NOTE: IT TAKES THE DEVICE NAME OF THE ADAPTER, NOT THE 'NAME' wIRELESS OR LOCAL AREA CONNECTION BIT...


OR IF you're super security conscious you could leave it as NAT but you'll have to setup port forwarding:

to setup PORT FORWARDING so that virtualbox listens and forwards packets "All TCP to port 2222 on the host will forward to port 22 on the guest."

VBoxManage setextradata "vmname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/Protocol" TCP VBoxManage setextradata "vmname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/GuestPort" 22 VBoxManage setextradata "vmname" "VBoxInternal/Devices/e1000/0/LUN#0/Config/guestssh/HostPort" 2222


If we want to peek at the "console" session of our virtual machine we need to setup RDP access on a different port than Windows XP default 3389

VBoxManage modifyvm centos5 -vrdpport 3388 -vrdpauthtype null


Now we start it from the command line

VBoxHeadless -startvm dsl

rdp into localhost:3388 (or your ip address, 192.168.1.100:3388) and watch... disconnect X when done.

OR SSH into centos5 vm (needs to have vbox vm bridged eth) and install virtualbox! (on windows I use putty portable)

of course for SSH to work you'll need to know what IP address it has/gets - since it's Bridged and we've set it up CENTOS5 as DHCP that will take some trickiness (or the RDP solution above to peek)


In my particular case it's good to use RDP because centos5 booted up with a configuration menu... examining Network shows us, yes, it's set as DHCP firewall shows only SSH is allowed as incoming (even that will have to be secured right away in a production environment as port 22 is too well known)

Log in as root (you do remember your password, right?) and then use "ip addr show" to find your DHCP ip address.

rather than go through my normal production steps of securing the system (ssh to different port, setup another sudo user, no root login on ssh, then removing rdp access to the VM, etc.) we'll go straight to the point of this exercise...


Recursively keep installing centos5 and virtualbox!

yum install elinks

elinks http://virtualbox.org

"browse" using the text browser in ssh to Downloads -> Virtualbox 3.0.4 for Linux hosts -> RHEL/Centos5

press enter on it and then choose to save it (tab key to navigate menus)

You must first install the following packages otherwise you'll get "error: Failed dependencies:" libxslt.so.1 is needed by VirtualBox-3.0.4_50677_rhel5-1.i386

yum install libSDL-1.2.so.0 yum install libxslt.so.1 yum install gcc yum install kernel-devel export KERN_DIR=/usr/src/kernels/2.6.18-128.4.1.el5-i686/

rpm -ivh VirtualBox-3.0.4_50677_rhel5-1.i386.rpm

and done!

(IF YOU UPGRADE YOUR KERNEL YOU WILL "BREAK" THE KERNEL HEADERS AND WILL HAVE TO RECOMPILE THE VIRTUALBOX KERNEL MODULE...) /etc/init.d/vboxdrv setup


adduser username passwd username usermod -aG vboxusers username

yum install screen log out as root


ssh in again as the normal user (username)

free gives me 740MB RAM df gives me 1.62GB usage the host winxp centos5.vdi is 2.2GB

elinks http://damnsmalllinux.org -> Downloads -> nearest mirror -> current -> dsl.4.4.iso


create our test virtual machine (which is inside of a running virtual machine)

VBoxManage createvm -name dsl -register VBoxManage openmedium dvd /home/username/dsl-4.4.10.iso VBoxManage modifyvm dsl -dvd /home/username/dsl-4.4.10.iso VBoxManage modifyvm dsl -memory 256MB -boot1 dvd

VBoxManage modifyvm dsl -nic1 bridged -bridgeadapter1 eth0 VBoxManage modifyvm dsl -vrdpport 3387 -vrdpauthtype null

VBoxManage showvminfo dsl

VBoxHeadless -startvm dsl

ctl+a+d //detach from screen (so that we can exit ssh but leave virtualbox running!)

hmmm... except since my centos5 is non gui... I don't see anything and don't know what ip address


  • « Vmware converter resize a virtual windows partition
  • Virtualbox windows2003 guest »

Published

Feb 6, 2010

Category

virtualization

~1052 words

Tags

  • centos5 8
  • guest 11
  • host 8
  • netinstall 2
  • recursively 1
  • virtualbox 36
  • virtualization 87
  • winxp 5