Table of Contents

Welcome

Welcome to VirtualBox at Warp Speed Book Source code

Why am I here?

Either a search engine got you here, or you were redirected from virtualbox.guru. I guess what matters is what is here.

What is here?

A the collection of scripts to create and manage a virtualized environment using VirtualBox.

Scripts Index

About Scripts

The scripts were tested only on, Ubuntu 14.04 LTS (Trusty Tahr), running both on the host as well as the guest. The scripts are transferable to other Linux host and guest operating system, however they may require changes on other Linux flavors. In essence, you can run the scripts as-is on Trusty Tahr and possibly on earlier Ubuntu and Debian versions. If you are running VirtualBox on a non-Debian based system, you may need to step through each command line individually.

The scripts in the book are listed in the table below. They are numbered in the typical order in which they would apply when starting out to install, configure and maintain VirtualBox. They can however be run in any order except for the “set-folders”, “installvb” and “set-machine-folder” scripts.

Before installing VirtualBox, the scripts require that you identify and organize the VirtualBox folders. This is explained in the “Directory Structure” on the “VirtualBox Install” chapter. The “set-folders” script helps you achieve that and is a requirement to be run before all other scripts. Once the folders are organized, you can complete the install (using the install script). Right after that you will run the “set-machine-folder” script that links up the defined folder structure, to the VirtualBox install.

Some scripts need to be run as root while the majority of them require to be run as the VirtualBox user. The scripts have checks built into them so they are run under the correct user.

Some of the scripts (the install is a good example) require that you update the script configuration before running the script. For example, in the install script the “URL path” needs to be updated to the correct URL for downloads. The scripts have help specifying what is required to be modified before running them.

1 Scripts Index

Script Ch Description
005-set-folders 3.1 Configures the default VM folder structure
010-installvb 3.1 Install VirtualBox and Extension pack. Will upgrade VirtualBox to a new version as well.
020-set-machine-folder 3.1 Sets VM folder to the defined folder structure (via set-folders script)
030-create-vm 3.2 Creates a new VM using VirtualBox
031-create-win-vm 3.2 Creates a new Windows VM using VirtualBox
035-upgrade-ga 3.5 Install or Upgrade the Guest Additions on a VM
040-clone-vm 5.2 Clone a VM with new name and defined resources
050-list-vm 3.2 List the VMs registered. This script is called from other scripts or can be run directly
300-setup-shared-folder 5.7 Setup up VirtualBox shared folders with automount option
400-busy-chk-vm 6.2 Checks if a VM is busy or idle. This script is called by the backup script.
410-backup-rvms 6.3 Backup outer loop script - calls backup-vm-w for each running VM
420-backup-vm-w 6.3 Wrapper script for backup-vm to save output created from backup-vm to log folder
430-backup-vm 6.3 Main backup VM script. Update script configuration if required (optional)
510-rdp-auth-add 5.1 Setup RDP Authentication using VBoxAuthSimple
512-rdp-auth-del 5.1 Remove RDP Authentication
520-rdp-enc-setup 5.1 Setup RDP Encryption. Generate and save cert/keys
522-rdp-enc-add 5.1 Set Encryption Key/Cert define in rdp-enc-setup
524-rdp-enc-del 5.1 Delete Encryption Key/Cert
610-create-intnet 3.3 Create DHCP Network for Internal Network
700-show-hd-tree 3.6 List Disk Snapshot Hierarchy
710-setup-hugepages 6.4 Enabling Large Page (Huge page) in Guest
720-chg-disk-type 4.1 Change VM's disk type
722-add-disk 4.1 Add new disk to VM
725-chg-disk-loc 4.1 Change Disk File Location on host
30-snap-del-all 3.6 Delete all snapshots
810-cfg-autostart 5.3 Initial setup of configuring VM autostart
820-list-autostart 5.3 List auto-start status for individual VMs
830-toggle-autostart 5.3 Toggle individual VM auto-start between on and off
900-poweroff-vm 3.7 Safe Power-down VM and wait until VM is powered down
901-poweron-vm 3.7 Power-on VM and wait until VM has started

The backup script (400 to 430) requires to be scheduled under the VM user's crontab entry. To schedule via cron use the following:

# Crontab entry for backup
# Schedules daily backup of all running VMs at 3.20 am
20 03 * * * /home/path/avm/bin/410-backup-rvms.bash