Вы находитесь на странице: 1из 4

Tutorial VirtualBox 3.

1 Beginners guide

On the disc
VirtualBox OSE

The graphical
VirtualBox application
interface

VirtualBox 3.1 a beginners


guide solution for server, desktop and embedded use
VirtualBox 3.1 is a professional-quality virtualisation

Welcome to Suns VirtualBox 3.1 version of VirtualBox extends its reach from
virtualisation application. This tutorial embedded systems to the desktop and all
starts you off with VirtualBox installation, the way into the data centre.
proceeds through the complete creation of
a Linux virtual machine, continues with an
explanation of virtual machine networking Resources
and nishes by editing your virtual machines A Linux host VirtualBox works on a variety of
distributions
memory settings. VirtualBox employs full
CPU A newer AMD or Intel, single- or multi-core
Advisor virtualisation, which means that guest
operating systems reside in a full virtual Memory 2 to 4GB RAM, or enough to
Ken Hess has over 15 years computer complete with hard disk, display
comfortably run your host and guests
experience with
adaptor, network adaptor, CD/DVD drive,
Disk space Enough to create your guests
Linux and more virtual disk drives (4GB+ each)
than ten years with serial ports, sound card and USB ports. A guest OS VirtualBox supports a large
various virtualisation This free technology puts virtualisation in number of guest operating systems
technologies He has
used VirtualBox since the hands of anyone who owns a computer, The VirtualBox software
version 1.x regardless of skill level or experience. This www.virtualbox.org/wiki/Downloads

40 www.linuxuser.co.uk Imagine Publishing Ltd


No unauthorised copying or distribution

040-043_LUD_85 PK.indd 40 25/2/10 16:21:06


VirtualBox 3.1 a beginners guide
Installing and using the virtualisation solution
TUTORIal

01 Installing VirtualBox
Lets begin your foray into virtualisation
by installing the VirtualBox software.
02 Launching VirtualBox
To use VirtualBox, you must launch it
from a menu in your graphical interface (KDE,
03 VirtualBox registration
After you accept the licence
agreement, youll see a prompt on your screen
You should install the software via your GNOME, XFCE) or from a command line. In KDE to register VirtualBox. If you have a Sun Online
distributions installer, if possible. and GNOME, VirtualBox is in the System or account, enter your information into the
For Debian-based systems, use: System Tool menu. From the command line, form and select Register. If you dont have
$ sudo apt-get install virtualbox-3.1 issue the command: an account, fill in the information and select
For rpm-based distributions, use: $ VirtualBox & Register. You may also choose to register at
$ yum install virtualbox-3.1 You must type the command exactly as shown another time by selecting Cancel.
If your distribution doesnt have a 3.1.x VirtualBox or the application will fail to launch. Remember
version, then point your favourite browser to that filenames are case-sensitive. The & allows
www.virtualbox.org/wiki/Downloads and you to launch a program into background mode
download the appropriate package for your and release your prompt. Before you see the
distribution. The packages listed on the VirtualBox application, youre presented with
Downloads page are for i386 (32-bit) operating a licence agreement, which you must accept.
systems and AMD64 for 64-bit operating systems Scroll down to the bottom of the agreement and
using AMD or Intel-based CPUs. Shown below is then click I Agree to continue.
the actual system dialog during installation.
# rpm -i VirtualBox-3.1-3.1.2_56127_
rhel5-1.x86_64.rpm
warning: VirtualBox-3.1-3.1.2_56127_
rhel5-1.x86_64.rpm: Header V4 DSA
signature: NOKEY, key ID 6dfbcbae
Creating group vboxusers. VM users must be
member of that group!
No precompiled module for this
kernel found -- trying to build one.
Messages
emitted during module compilation
will be logged to /var/log/vbox-
06 Virtual Machine name and
operating system selection
Enter a name for your virtual machine in the
install.log. Name field. You may name your VM anything
Success! you wish, but keep it short and descriptive. This
name appears in the VirtualBox virtual machine

04 The VirtualBox application


Your initial impression of VirtualBox
might be forgettable due to its rather empty
05 Creating your first virtual machine
Click the New button in the
VirtualBox application to launch the Virtual
Inventory window. Next, select the operating
system for your VM with the drop-down list.
And, finally, select the particular distribution or
appearance, but that will soon change. This Machine Creation Wizard. This wizard leads OS version from the Version drop-down list. If
application is from where youll create and you through the virtual machine creation your Linux distribution isnt listed, use a generic
manage your virtual machines. Before you leap process that youll see in the next few steps. one designated Linux (kernel version) or Other
headlong into virtual machine creation, you Click Next to continue through the wizard. Linux. Click Next to continue.
need access to a CD/DVD or an ISO image of
an operating system. You may use any Linux
distribution, OpenSolaris, FreeBSD or Windows.
Although you can create a virtual machine
without a guest operating system readily
available, you must know which operating system
you wish to install into your new virtual machine
prior to building it.

Imagine Publishing Ltd 41 www.linuxuser.co.uk


No unauthorised copying or distribution

040-043_LUD_85 PK.indd 41 25/2/10 16:22:43


Tutorial VirtualBox 3.1 Beginners guide

08 Virtual hard disk selection


You can either create a new hard disk
or select an existing one for your new virtual
09 Virtual Disk Creation Wizard
By selecting Create new hard disk
on the previous screen, youve launched the

07 Memory allocation
On this screen, youll allocate an amount
of RAM to your virtual machine. The application
machine. Since this is your first VM, select Create
new hard disk. This is the VMs first hard disk and
you must select Boot Hard Disk (Primary Master)
Virtual Disk Creation Wizard. This wizard helps
you allocate an amount of your host systems
disk space to the new VM. Click Next to begin
provides a recommended amount of RAM for or the VM wont boot. Like the memory allocation that process.
your selections from the previous screen. You selection, there is a recommended size for your
may change this recommendation, as shown new disk, as shown below. You may accept or
below. Make your selection by using the slider adjust that recommended size on the screen.
bar or entering the amount in the numeric field. Click Next to continue.
Click Next after making your selection.

10 Hard disk storage type


Here, youll select the disk storage type
for your new VM: dynamic or fixed. For best
11 Virtual disk location and size
Now its time to choose a name for your
new virtual disk, its location and its size. The
virtual machine performance, select fixed-size name doesnt matter; you can name it anything
storage. While the dynamically expanding type you want, but it should include the name
uses less space originally, its performance, of the VM in some form and a size for quick
when expanding, is poor. You should only select reference. We chose the same name as the
dynamically expanding if your host system has VM and the default location, which is in your
a limited amount of space for virtual machines. home directory under .VirtualBox/HardDisks.
Click Next to accept your selections. The Virtual Machine description file (XML) resides in your home directory under .VirtualBox/
Machines/VM Name. For this example, the full path is /home/khess/.VirtualBox/Machines/
Ubuntu-9.10/Ubuntu-9.10.xml. Select a size for your virtual disk by using the slider bar or by
entering the size into the numeric field. Click Next when finished.

12 Virtual disk creation summary


Youve successfully defined the virtual disk
for your new VM, but theres one step remaining
in the process: to create the disk. When you click
Finish on this screen, VirtualBox creates the disk.
It might take a few minutes depending on the
speed of your system and the size that you chose.
Click Finish to create the disk.

13 Creating virtual disk progress


VirtualBox now allocates the specified amount of your host systems
disk space to a single file that represents your new VMs disk (VM Name.vdi). Our
15 Virtual machine inventory screen
Youve built your new virtual machine, but it isnt usable
yet: its like a freshly built physical machine with no operating
example disk name is Ubuntu-9.10.vdi. system. Before moving on, lets have a look at the new VM and
its hardware complement. Right now we only have one VM, but it

14 Create new virtual machine


summary
Once VirtualBox finishes creating your new VMs
is through the Inventory screen that you interact with your VMs.
In the left-hand pane youll see your VM listed. In the right-hand
pane, you see the VMs current list of installed hardware. Each
hard disk, youll see the Summary screen (as listed hardware component (in blue) is a hyperlink that launches
shown on the right). You may go back and change another screen where you add, edit, delete or modify that virtual
your VMs settings or click Finish, create the VM component. In our example, well have to select Storage to place
and change it later in the main interface. Click an operating system CD or DVD into the host computers drive or
Finish to create this virtual machine. direct the VM to use a downloaded ISO file from which to boot.

42 www.linuxuser.co.uk Imagine Publishing Ltd


No unauthorised copying or distribution

040-043_LUD_85 PK.indd 42 25/2/10 16:23:28


VirtualBox 3.1 a beginners guide
Installing and using the virtualisation solution
TUTORIal

16 Adding a CD/DVD image


to a virtual machine
On the main screen, select the
17 Virtual Media Manager
The Virtual Media Manager
maintains a repository of your virtual
18 Storage properties
screen
This screen shows you the
Storage link in the right-hand disk images, ISO files and floppy disk selected ISO image file from
pane. The Storage properties images. The CD/DVD Images window which youll boot your new VM.
window will now open, in order already has focus, but is empty. If you have a physical CD or DVD,
to display your options. In the Select the Add button to open a file instead of an ISO file, select
Storage Tree window, select the system browse window. Browse your CD/DVD device using the
Empty CD/DVD drive icon. Select to your bootable ISO image for the drop-down box in the Attributes
the folder icon under Attributes to operating system you wish to install, section of this screen. Click
browse to open the Virtual Media select it and click OK to return to the OK to accept your choice and
Manager window. Storage properties screen. return to the main screen.

19 Starting the virtual machine


From the main VirtualBox screen,
select your virtual machine and click the
22 Creating a bridged network connection
In this step, youll change your NAT connection to
a bridged one. A bridged connection maps your virtual NIC
Start button to power up your VM. This to your hosts physical NIC, giving that adaptor full network
procedure is equivalent to powering up functionality. Using the drop-down lists for each parameter,
a physical machine with a bootable CD change NAT to Bridged Adapter. Click Advanced to make
or DVD in the CD/DVD drive. The virtual sure that the virtual adaptor maps to a virtual NIC type
machine launches in its own window (PCnet-FAST III (Am79C973)). If all goes well, on your next
and operates independently of the main boot of this VM, this NIC will collect an IP Address from
VirtualBox application. Once booted, a DHCP server and
proceed through the installation as you connect to the network
would for any physical system. When without issue. If not,
you begin working with virtual machines, power down the VM,
note that the virtual machine grabs return to this screen
your mouse and keyboard focus away from your host operating system. This means that while and select a different
youre working with a VM, your mouse and keyboard only work inside the VM window. Press adaptor type from the
your right Ctrl keyboard button to release that focus back to your host operating system. list until you find one
Clicking your mouse in the virtual machine window returns the focus back to the VM. that works properly.

20 The running virtual machine


When a virtual machine is running, as shown on the
right, you cant change any of the hardware components
23 Adjusting virtual machine memory
The final steps in this tutorial are to show you how
to adjust the RAM (or any piece of hardware) for your virtual
for that virtual machine. The same rule applies to physical machine. Power off the VM to continue. Select System from
machines: you cant change a network interface card your VMs Details window in the main VirtualBox interface.
(NIC), add RAM or alter any hardware while the system is Adjust the amount of memory for the virtual machine. Click
in the running state. Youll notice too that the hardware OK when finished. Its that simple to change the amount of
components are now black and not clickable links, showing RAM in your system.
you that the hardware is in locked mode.

21 Working with network


settings
24 Inspecting
your
changes
One of the most frustrating pain points You can see your
for the virtualisation neophyte is virtual changes reflected in
networking. When you create a new the Details section of
VM, its primary network interface your VM (as shown
(NIC) starts out in NAT mode: network on right). When youre
address translation. This means that the satisfied with the
NIC works for certain types of network changes, click the
traffic, but the VM cant fully participate Start button to power
in some network activities. To edit the up your VM using the
VMs primary NIC, power off the VM by changes youve made.
using the appropriate shutdown method
for its OS. When your VMs power is off, select the Network link from the Inventory screen to
open the Network Settings window, as shown above.

Imagine Publishing Ltd 43 www.linuxuser.co.uk


No unauthorised copying or distribution

040-043_LUD_85 PK.indd 43 25/2/10 16:23:52

Вам также может понравиться