This website is preserved for historical and scholarly reference and is no longer actively maintained.
VirtualBox Introduction and Setup
We will use VirtualBox and two Virtual Machines, one
is Ubuntu 16.04 and the second is Kali Linux.
- VM1: This should be the latest Ubuntu
16.04 ISO
- VM2: You can use either of these options for Kali - but the
OVA appears to be ideal for our purposes. I actually ran into a
few problems when trying to install the kali VM using the ISO
method. So I ended up deleting the VM and importing the
OVA. (Note: recently changed these links to point to
kali's site)
- An OVA is a standard VM format that is portable. One could
export a working VM (in any VMM including VMWare and
VirtualBox) in OVA format and effectively publish it -
making it available to others using an VMM that supports the
OVA format. Note that you should continue to use
VirtualBox on your laptop.
- To install the OVA do NOT create a new VM!! Simply
go to the VirtualBox manager, select File and Import
Appliance. Make sure to download the OVA to your
machine. Click the finder button and select the OVA
file. On my system, it took about 5 minutes to import.
See this page
from the VBox manual for instructions how to import an
existing VM in OVA format.
- After installing the OVA, it 's network is setup the same
as VM1. While you can't yet communicate directly
between the VMs, I suggest that you keep VM2 connected
to the outside world using NAT (the default setup) while you
become familiar with kali.
- The only account is root- the password should be toor
(root spelled backwards).
- The rest of this page is a bit out of date but it will point
you roughly in the correct direction. The key points are:
- Set each VM to use 2 CPUs (if your Host platform has >1)
- Setup 2 displays
- Setup bidirectional copy/paste buffers
- Make sure to install Guest Additions for both VMs
- Consult this page
to configure the network.
The following is a bit out of date but it does give further
details. If you have trouble with either VM, consult the virtualBox
documentation.
To setup your VM, please perform the following steps:
- Get familiar with the VirtualBox Documentation
- On your laptop, which is the Host OS, install the VirtualBox
Product (i.e., the Virtual Machine Manager (VMM)). The VMM
allows you to to create Virtual Machines (VMs) that you can then
use after you install an OS. VMs that have an installed OS are
called Guest OSs.
- Create a VM using the VirtualBox Manager program. You need to
setup that VM knowing what Guest OS you plan on installing.
Let's assume you are interested in installing one or more VMs
that are either Ubuntu or
Kali.
- Note that you can install a Guest OS with the Linux distro
ISO OR with a prepackaged VM . There are different formats,
but we will use Open Virtualizatoin Format (OVF).
- Download the ISO or OVF files on your Guest OS
- To install an ISO: Start the VM and point the installer to
the ISO. Go through the normal OS installation for the Guest
OS
- To install an OVF, make sure you have the appropriate ova
file, and then select file in the VirtuaBox Mgr and select
Import Appliance.
- Setup networking at the VMM level - select File and then
Preferences, and then networking. The first step is usually to
just get your VM connected to the Internet
- On your Guest OS, install any additional software packages
- Customize the virtual network at the VMM as needed
- Configure networking on your Guest OS as needed
For VM1, we are using ubuntu-16.04.3-desktop-amd64.iso
For VM2, we are using a Kali linux distro (specifically
kali-linux-2017.3-vbox-amd64) but we are using a prebuilt VM in
Open Virtualization format.....see below for instructions.
1 VirtualBox Downloads and Documentation
2 Installing a Guest OS on a VirtualBox VM
Step 1. Install VirtualBox on your Host OS.
Step 2. Create a VM
- Start the virtual box program on your Host OS
- In the VM VirtualBox Manager, select NEW and follow the steps
to create a new VM. You need to know what type of Guest OS -
Windows, freeBSD, Kali, Ubuntu ... and also if you want 32 or 64
bit Guest OSs.
- Increase memory size to 2Gbytes, tell it to create a
virtual drive NOW, a disk space of 20 GBytes (10 GBytes is
probably ok), select all the defaults (dynamic allocation,
VM file type VDI).
Step 3. Install a Guest OS
- For a Ubuntu VM, download the latest 64 bit LTS version from here
- Please use the 64-bit version.
- The file you download should be an iso file- you can
keep this file in the Downloads directory (or where ever you
downloaded it).
You do NOT need to burn an install CD.
- Install Linux by double clicking the new VM (VM1). It will
then ask for a startup disk - point it to the ISO file you
downloaded. Then follow the defaults throughout the Linux OS
installation.
- For Kali, download the prepackaged VM - from
here
- you can also issue a : wget
https://images.offensive-security.com/virtual-images/kali-linux-2017.3-vbox-amd64.ova
- From the VMM, select file and 'import Appliance, and then
select the finder window to point to the ova file. All
defaults should be fine
- Note- it is possible to achieve the same result by
installing with the 64 bit Kali ISO but the system will
likely be different so please install the OVA.
Step 4. Install the "Guest Additions" - which adds optimized
drivers to your Linux installation.
- Start your VM and select the 'Devices' option and then
'Insert Guest Options CD' - it should ask you if you want the
VM to run the install program - say yes.
- An alternative, in a Ubuntu guest, issue 'sudo apt-get
install virtualbox-guest-utils' and
- Note cd to the mnt of the CD image, Issue 'sudo
runasroot.sh' or 'sudo ./VboxLinuxAdditions.run' or
'sudo VboxLinuxAdditions-amd64.exe'
- See this page for help: https://www.virtualbox.org/manual/ch04.html
Step 4. Tweak your VM settings to enable these useful features::
- Make sure VM Manager is configured for CPU acceleration. Make
sure your VM is not running, from VirtualBox Mgt, select
Settings, and then System, and then Acceleration and Enable.
- If this is not selectable, then you should reboot your
computer, and go to BIOS setup to enable VM Acceleration.
- To allow the VM to operate on >1 physical CPUs
- VM Virtual Box Manager, select Settings and then System
and set number of processors
- To make it easy to transfer files between VMs and Host OS, I
create a Shared Folder
- On your VM, select Devices and Shared Folder.
- Make sure to create a folder on your Host OS first, and
then specify this as the shared folder. Indicate it is
permanent.
- On your VMs, issue a 'df -k' and you should see the
folder mounted. Note that you might need to use sudo to
access the folder.
- To allow cut and paste across your Host and Guests, enable
Bidirectional Drag and Drop in each VMs Settings, Select
General, and then Advanced - set shared Clipboard and DragNDrop
to bidirectional.
Step 5. Packages to install after a installing a Ubuntu VM
After a fresh install of Ubuntu, you should do a 'sudo apt
update'. Then issue 'sudo apt-get install xxx' the following (note
that some of these might already be on your system).. To see all
installed, 'apt-cache pkgnames', To see if a specific pkg is
installed, like iperf, 'apt-cache showpkg iperf', And if you know
the program you want to get but it is different from the package
name, you can try 'apt-cache showpkg iperf'.
- build-essential
- git-core
- vim
- wget
- curl
- bc
- inetutils-traceroute
- tcptrace
- dhcping
- xutils-dev
- iperf
- sysstat (to get mpstat)
- dos2unix
- source-highlight (to get check-regexp)
- snmp
- openssh-server - need to install and start to ssh into your VM
- sudo systemctl restart sshd.service
-
- To install Google Chrome, can't use apt-get. Instead,
download using wget to get local, then apt-get
- Step 1: get the chrome package using a debian deb file
:
-
- wget -N
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo apt-get -f install -y //the -f says fix dependencies,
-y will say yes to everything. this updates our software
- sudo apt install ./google-chrome-stable_current_amd64.deb
- sudo apt autoremove
The following are optionally
- GPSd package - a widely used client/server for obtaining
locations using GPS devices.
- To build programs that use the pcap libaray:
- sudo apt-get install libpcap-dev
- Xplot is a very useful plotting program
- sudo apt-get install xplot
- To get useful packet trace analysis tools
- wireshark-common (capinfos is very helpful)
- tcptrace (can generate useful summary + plots of tcp cxs)
- Octave is an open source system similar to matlab.
- Full install:
- sudo apt-get install octave
- If it was not in the main repos, you could setup the ppa.
- sudo apt-add-repository ppa:octave/stable
- sudo apt-get update
- sudo apt-get install octave
Step 6 Setup Networking on the VM
When installing just one VM, the default networking that is setup
by VirtualBox is sufficient. It allows the VM to reach the
Internet - but it does not allow any Hosts from an outside network
to reach the VM (unless the VM initiates the connection).
Refer to this page
for further information on network options.
Step 7 Additional setup through the command line interface
After virtualBox is installed, a set of helpful command line
programs are available on your Host OS. On a Windows Host OS,
these programs are located in C:\Program Files\Oracle\VirtualBox.
The main command line interface program is vboxmanage. I usually
add the path to my User Path environment (on Windows, Control
Panel, System, Advanced Settings and then Environment Variables).
Try 'VboxManage' for a list of all command options.
VboxManage list vms ; lists the names of your VMs.
VboxManage showvminfo VM1 ;shows all info for the VM named VM1
You can configure more properties and aspects of each VM through
the command line interface. Refer to the Users Manual for details.
Misc information
- To switch in and out of full screen, the default key sequence
is CNT-F
- Once operational, we will refer to the different screens as
follows:
- the main VirtualBox window that allows you to start/stop
and configure the VMs, will be referred to as VirtualBox
Manager, sometimes referred to as Mgr Window.
- The window that represents the VM (the specific VM name is
in the top portion of the window). We refer to this by a
specific VM name, such as VM1Window or sometimes as VM1.
- System wide configuration is done in the VirtualBox
Manager by selecting File and then Preferences. You can also
reach this configuration window from a VM Window. We refer
to this configuration window as System Config Window. For
example, the Network Preference allows specific types of
virtual networks to be created ... and in some cases further
VM configuration is required.
- VM configuration is found in several ways:
- From the Mgr Window, highlight the VM listed in the
set of VMs that have been configured, then select
Settings (or Machine).
- From a VM Window, select Machine and then Settings.
- A VirtualBox VM consists of three pieces:
- one or more hard disk images (VDI files),
- zero or more snapshots (VDI files)
- xml config files.
Snapshots, clones, and export/import
Three very useful capabilities provided by most VMM systems
are snapshots, clones, and export/imports.
- Snapshots are highly recommended- it is a way to fall back to
a recent, working instance of your VM. While it
might not happen frequently, you are likely to encounter some
sort of failure that might prevent your VM from booting ever
again (or .... it might require significant effort to restore
the corrupted system).
- A snapshot is equivalent to a backup of your system
- Porting a VM snapshot to another machine allows you to create
a customized VM, and then publishing it making it available to
others.
- To publish your VM, simple right click the VM in the
VMMManager and select clone.
- A clone is an exact copy of a VM, so after doing it you have
two virtual machines on your host, identical except for the
things that have to be different such as the UUIDs. If you are
developing a system this allows you to fork it, restore to a
former state, etc, or easily to put together a virtual
network of originally-identical machines. Because of the
UUIDs, in particular, you need to do this rather than just
make a file-copy of the VM directory.
- Export/Import an appliance
- An appliance is a complete VM (or indeed several of them)
compressed and packaged into a single file. The idea is that
you can then pass this single file (on a memory stick or XHD,
say) to someone else using a different physical machine. They
can then easily import your system to theirs, and they do not
need to do anything else to get it going. It is virtual
machine(s) packed into an archive for easy distribution to
others.
A clone is really designed for use on the same host, an
appliance for copying to a different one.
last updated: 4/11/2019