HowTo Install VirtualBox: Difference between revisions

From MediaWiki
Jump to navigationJump to search
Line 68: Line 68:
* Look up the IP address associated with each running VM
* Look up the IP address associated with each running VM


Here is the script (save to a file named: ''VBoxListIps''):
Here is the script that runs on both Linux and Mac (save to a file named: ''VBoxListIps''):


  #!/bin/bash
  #!/bin/bash

Revision as of 09:15, 27 September 2013

Determining What Versions of VirtualBox Are Available

There are often multiple versions of VirtualBox for you to choose from. Use the following command to determine the current set of choices:

[root@rice ~]# yum list | grep VirtualBox
VirtualBox-4.0.x86_64                    4.0.2_69518_fedora13-1         @virtualbox
VirtualBox-3.1.x86_64                    3.1.8_61349_fedora13-1         virtualbox
VirtualBox-3.2.x86_64                    3.2.12_68302_fedora13-1        virtualbox
[root@rice ~]#

Alternatively one can use (2012-09-13):

[root@d630 ~]# /usr/bin/yum --disablerepo=* --enablerepo=virtualbox list available  2>&1;
Loaded plugins: fastestmirror, filter-data, keys, langpacks, list-data, presto,
              : refresh-packagekit
Determining fastest mirrors
Skipping filters plugin, no data
Available Packages
VirtualBox-4.1.x86_64           4.1.22_80657_fedora16-1               virtualbox
VirtualBox-4.2.x86_64           4.2.0_RC4_80667_fedora16-1            virtualbox
[root@d630 ~]#

Installing VirtualBox 4.0 on a NST v2.13.0 System

The following commands can be used to install VirtualBox onto a NST system (as of 2009-Oct-26 using v2.11.0 of the NST distribution).

yum -y install kernel-devel gcc
yum -y install VirtualBox-4.0

Installing on a NST v2.11.0 System

The following commands can be used to install VirtualBox onto a NST system (as of 2009-Oct-26 using v2.11.0 of the NST distribution).

yum -y install kernel-devel gcc
cd /etc/yum.repos.d
wget -nH http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
yum -y install VirtualBox-4.0

After Installation

Add Users to vboxusers Group

For every user you want to grant access to VirtualBox, you should add that user account to the vboxusers group. This can be done through the Users and Groups GUI tool (under the System | Administration menu on a GNOME desktop), or by using a text editor and directly editing your /etc/group file. For example after adding users pat and dianne, you should a line similar to the following line in your /etc/group file (you may see a number other than 512):

vboxusers:x:512:pat,dianne

Note: If a user is logged in when you add them to the vboxusers group, make sure you have them logout and then back in before running VirtualBox.

Adding Extension Packs

Oracle has introduced the concept of extension packs starting with the 4.0 release of VirtualBox. You should be able to find these extension pack(s) by googling for "oracle vm virtualbox extension pack". At the time of this writing, there was a single USB 2.0 extension pack available.

You must be logged in as the root user to install a extension pack. The following demonstrates the command used to install the USB 2.0 extension pack:

VirtualBox Oracle_VM_VirtualBox_Extension_Pack-4.0.2-69518.vbox-extpack

Starting VirtualBox

From the GNOME desktop, you can find the Oracle VM VirtualBox launcher under the Applications | System Tools menu. Alternatively, you can start VirtualBox directly from the command line using the command:

VirtualBox

Listing IP Addresses of Running Virtual Machines

VirtualBox makes it a bit tricky to find the IP address allocated to each of your running machines. The following short script makes use of the VBoxManage command to:

  • Get a list of all the running VMs
  • Look up the IP address associated with each running VM

Here is the script that runs on both Linux and Mac (save to a file named: VBoxListIps):

#!/bin/bash
#
#  List IP addresses of running VMs

# Create quoted array of VirtualBox running VMs (need quotes as 
# VMs can have spaces in names)
eval "declare runningVms=($(VBoxManage list runningvms | \
  sed -e 's,^\(".*"\) {.*}$,\1,'))";

# Look up IP address for each VM

for vm in "${runningVms[@]}"; do
  declare ip=$(VBoxManage guestproperty get "${vm}" "/VirtualBox/GuestInfo/Net/0/V4/IP" 2>/dev/null | awk -- '{ print $2; }');

  printf "%-15s %s\n" "${ip}" "${vm}";
done

Here is an example of the output from the script on a system with three running virtual machines:

taco-e:Downloads pkb$ VBoxListIps
192.168.1.80    VaiDev6c
192.168.1.82    dev18-32
192.168.1.112   tlp-el6
taco-e:Downloads pkb$

VirtualBox FAQ

See section: " VirtualBox Frequently Asked Questions"