CSE SunLAB VirtualBox Owner's Manual

advertisement
CSE SunLAB VirtualBox Owner's Manual
Notes concerning setting up and running virtual machines on SunLAB
workstations using the VirtualBox product
Introduction
This document was prepared as an aid to CSE265 students setting up virtual machines on
the CSE department's Sun workstations. It includes general information about using the
VirtualBox product, as well as guidance that is specific to the CSE department's network,
specific host machines, and CSE265 course requirements.
The VirtualBox product is referred to as VBOX hereafter.
Getting started
Disk space considerations:
At least a few GB of disk space are needed to set up a even a small virtual machine. Your
departmental /home directory is way too small for installation of a VBOX VM; hence, you have
been assigned additional disk space on one (and only one) of the SunLAB workstations; your
additional disk space is specific to a single machine, and you will be doing all of your work on
that machine. Other machines in the lab will not be able to access this disk space.
SunLAB machine assignments are:
ajf211
ariel
alc308
caliban
amp6
callisto
ark410
dactyl
awg211
dactyl
bss310
eris
cjb510
eris
drp212 ganymede
dsh210
iapetus
eem409
io
fjk211
jupiter
gmd412
jam510
khr210
mpm308
ndw210
rmm211
saw207
spk210
srk210
zrc210
kiviuq
mars
mercury
nereid
puck
saturn
sycorax
tethys
titania
triton
Your work directory on your assigned machine is /export/cse265/$login (where
$login is your login ID).
VBOX's default behavior is to set up VM disk images in your home directory. Your first task is
to point its notion of 'default locations' to your additional disk space.
Please note that, absent an incomplete for this class, your work directory will be removed
after exams are finished.
Firing up VBOX
The VBOX command-line interfaces provide more granular controls than the GUI, but the GUI
is simpler to operate and is a better place to start.
In an X-Windows environment, the VirtualBox command will launch the VBOX GUI.
An aside: If you are connecting remotely, X-forwarding over SSH will work, but the remote
connection will work better if you do not use an encrypted connection. This is accomplished
with the use of the xhost command on your local machine, and manually setting the
DISPLAY variable to the appropriate value on the Sun machine:
Local:
xhost +sunlab.cse.lehigh.edu
Remote:
DISPLAY=sandbox12-1:0; export DISPLAY
On first starting the VBOX GUI, you need to scroll to the bottom of the license and accept it,
and you do not need to register. VBOX will create a .VirtualBox directory in your home
directory to store registration information.
An aside: If you're working at one of the SunLAB machines you will also want to change the
default Host key (File / Input) to the AltGraph key (right) or Find key (left) before you start any
VMs. The role of the Host key is discussed later.
First task: Change default storage folders
File / Preferences / General / Default Hard Disk Folder: Change to
/export/cse265/$login/Disks, creating the last directory node at the appropriate point.
Make the same change to the Default Machine Folder, also creating a Machine directory.
An aside: This can also be accomplished from the command line with:
mkdir /export/cse265/$login/Disks
VBoxManage setproperty hdfolder /export/cse265/$login/Disks
mkdir /export/cse265/$login/Machines
VBoxManage setproperty machinefolder \
/export/cse265/$login/Machines
About virtual disks
File / Virtual Media Manager (or Control-D) will launch the, well, Virtual Media Manager.
This sub-application is a means to create / destroy virtual hard disks and to connect ISO and
floppy disk images for use by your running instance of VBOX. All will be empty when you
start. With the HardDisk tab selected, selecting the Add button (or Insert key) will (should)
show your revised default hard disk folder. Selecting the New button (or Control-N) will
launch the New Virtual Disk Wizard.
You can, if you wish, create a disk now for use later. Please note the descriptions of
dynamically expanding and fixed-size storage disks on the 'create disk' panel.
Dynamically expanding disks are preferable when host disk space is tight, but run-time
expansion means they will be slower than fixed-size disks when they expand.
Fixed-size disks allocate all disk storage space on the host when initialized (this can take a
number of minutes, roughly 5 for a 20G disk), but disk access within the VM will be faster.
The capacity of both dynamic and fixed disk images is set when they are created. There are
no options to expand the capacity of an existing disk image. It is possible to attach more than
one disk to a VBOX VM, however.
These features are essentially identical to the virtual disks created by VMware's products.
VMware has an additional feature; virtual disk images can be broken into 2G segments
(which can be useful when defragmenting the host disk, or moving images between
machines).
Attaching an ISO image for installation
An ISO image can be attached as a CDROM. Although it is possible to do that for an
installation when your VM first boots, for present purposes it will be simpler if you use Virtual
Disk Manager to identify an ISO image (or images) that you want to use. Please do that now.
You will find ISOs for some Linux and Unix distributions at /ftp/media. Connect to one or more
of them with Virtual Disk Manager.
Building a Virtual Machine with the VBOX GUI
Step 1: Defining the machine instance
From the VBOX main panel, Control-N (or hit the New button) to start the New Machine
Wizard.
The machine name becomes the default name for the files describing the machine and a hard
disk (if you create one during the installation). The operating system and version labels
simply determine what logo appears for the machine, and provides some default values for
later use.
Please limit all of your VMs to 768M of RAM, max, for reasons that will be discussed later.
Either select an existing hard disk or create a new one.
Step 2: Tuning parameters
Take a moment to review the details of your new machine in the right-hand panel. We're
going to disable the USB sub-system (you will discover shortly that it doesn't work in this
release on Solaris), and tweak some other details.
With your new VM selected, select Settings (Control-S or right-click or the orange Settings
button). You're going to get a warning about the USB sub-system; check 'do not show this
message again'.
Take a look at the settings on the System page. For reasons discussed later, please should
limit your VM to a single CPU.
Increase display memory to 32MB, and enable Remote Display. Change the Remote Display
Port to a number in the range of 5000 to 6000. There is necessarily a one-to-one relationship
between running VMs and their RDP port numbers; you will want to make certain that your
RDP server ports do no collide with other VMs on the same machine, whether they are run by
you or other students working on the same machine. The Null authentication method simply
lets anyone in; change that option to Guest
On the Storage tab, select the CDROM that you connected earlier as the CD/DVD device.
Turn off audio.
Networking is complicated. We're going to skip that topic for the moment. The default
settings will work, as is, for the present.
Serial ports and USB should be disabled. Shared folders are a topic for another time. Hit the
OK button.
Step 3: Fire it up
Use the Start button to get your machine running.
You will see two 'notice' screens. both are modal; the VM won't start running until you have
responded.
The first notice screen concerns the 'host key'. The host key becomes very important to
interactive use of the VM shortly; for the present, you should be aware of its existence.
There might be merit to reading the VBOX documentation at this point concerning the uses of
the Host key and the significance of the icons at the bottom margin.
The second notice concerns the fact that you've turned off audio. You probably don't need to
look at this screen again.
Since your CDROM precedes your hard disk in the boot order, the installer for your selected
OS should start. If it doesn't start, you might want to reboot the virtual machine (not the host
machine) using Host+R or the Machine menu and hit F12 during POST (Question: Can a
virtual machine really POST?) and select the CDROM as the boot device. If you neglected to
attach a CDROM image, use the CloseWindow button to power-off the virtual machine or
(better) right-click on the CDROM image at the bottom margin and attach an ISO before
rebooting.
Complete the installation procedure for your OS.
Step 4: Regaining control of your mouse
Once installation starts, you might lose the ability to move your mouse cursor off of the
guest's screen. Virtual machines psh V x
resent a dilemma for mice; that is, who has
control of the mouse pointer at any given moment, the guest OS or the host. The Host key
will release the mouse.
Step 5: Rebooting
When your guest installation is complete, you will want to 'eject' the ISO image so as to avoid
re-booting into the installer. This is most simply accomplished by right-clicking the CDROM
button at the bottom of the guest (or use the Devices / CDROM menu option) and unmounting
the ISO image once your machine starts to reboot. (There are other ways to do this, for the
record.)
Step 6: Install guest tools
Both VMware and VBOX provide software components to be installed on the guest after basic
installation is complete. While your VM is (if all has gone well so far) a functional machine,
these software components (VBOX refers to them as 'Guest Additions') provide much
functionality that is useful in a desktop environment. It should be noted that the Guest
Additions are somewhat annoying; you will need to repeat the installation procedure on every
VM for each new release of VBOX (or VMware). Linux guest suffer a supplemental
annoyance; kernel updates commonly break the guest additions, requiring that the additions
be rebuilt for each new kernel.
The Host-D key or Devices / Install Guest Additions menu option will auto-magically connect
the guest additions ISO to a running VM as the VM's CDROM. The mounting location
depends on the OS, but it Is commonly mounted below /media.
For Linux guests, installation if the guest additions is accomplished by opening a terminal
window and, as root, running “sh VBoxLinuxAdditions-x86.run” at the appropriate
location. (You may need to install more software on your virtual machine before this runs
correctly.) Other OSes might require different guest additions packages from those present
on the media.
On 'server-class' VMs, there is often little use for the added functionality provided by the guest
additions.
A word on constraints
While everyone understands the general principles of polite behavior, it's not always obvious
where the boundaries of impolite or obnoxious live in any given situation. Here's some
guidance as it pertains to running VBOX machines on the SunLAB workstations.
All of the machines that are assigned for your use are quad-core hyper-threading Xeons with
6G of RAM. Due to hyper-threading, the machines will report (via /usr/sbin/psrinfo) that there
are 8 CPUs present. Most of the machines have a single CSE265 person assigned to the
machine, some have two. The SunLAB machines are also being actively used for a number
of other CSE courses and graduate research work, and that work must be able to continue
without undue interference.
You have permission to run as many VMs as you want until ½ of the 8 CPUs and ½ of the
physical RAM are committed. Where more than one person is assigned, this limit is to be
applied as the aggregate usage of both. Polite behavior includes turning off your VMs when
they are not in actual use; by this mechanism and a bit of cooperative scheduling, those who
are doubled-up on a single machine can still have some access to ½ of the machine
resources.
More fun:
•
Connect to your running VM via RDP (rdesktop is installed on the Suns).
•
Clone a hard disk and use it to construct a new VM.
•
sys-unconfig first is helpful.
•
Configure a new VM from scratch using VBoxManage
•
Start a VM with VBoxHeadless.
•
Note: The machine's console is the RDP device; confirm that you've got a
working RDP client before trying this.
•
Teleport a running VM to localhost. Interesting, eh?
•
Got any ideas for how differencing disks might be useful?
All of these topics (and more) are discussed in the documentation.
Nothing done yet on networking
At present all VMs are expected to boot DHCP. No MACs are assigned for DHCP use.
Download