This website is preserved for historical and scholarly reference and is no longer actively maintained.
VirtualBox Introduction and Setup
For the current semester, please note the following:
- CPSC3600 students will need to install one VM (call it VM1) - a ubuntu 16.04 distro (specifically, ubuntu-16.04.3-desktop-amd64.iso )
- CPSC 4240/6240 students will need to install VM1 and a second VM (VM2), - a Kali linux distro (specifically kali-linux-2017.3-vbox-amd64.iso) BUT, we are installing the VirtualBox applicance that is based on that iso.
NOTE: Please do not try to use VMware, KVMs, or other Virtual Machine systems. Each VMM implements virtual networking differently. You will be doing activities involving our VMs that take into account the details of VirtualBox'es networking design and implementation.
To setup your VM, please do the following steps (all described below).
- 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 Addtions" - 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. .
- This is an example .bashrc for Ubuntu 16.04 that provides some helpful alias's and functions : ./bashrc
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
- iperf3
- 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.
Additional VirtualBox Items
Here are a few items that might be helpful
- 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.
- Snapshots are highly recommended- it is a way to fall back on a recent and 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).
- Porting a VM snapshot to another machine allows you to create a customized VM, and then publishing it making it available to others.
- A VirtualBox VM consists of three pieces: one or more hard disk images (VDI files), zero or more snapshots (VDI files) and xml config files.
- To publish your VM, simple right click the VM in the VMMManager and select clone.
Pointers to additional Ubuntu documentation that might be helpful
last updated: 6/24/2018