VirtualBox#

Import a .ova file #

If you have a Virtual Machine (VM) that has a .ova extension here’s what to do to use it with Virtualbox

  • Install virtualbox https://www.virtualbox.org/wiki/Downloads

  • Open Virtualbox, then go to file –> Import appliance –> Open appliance and select your .ova file

  • Then click Continue then Import

  • It may take several minutes to import

  • Once it’s done just select your machine and click on Show to run it

Shared folder #

Manual method #

https://www.virtualbox.org/manual/ch04.html#idp91444064 If you want to transfer files between your computer (host) and your Virtual Machine (guest) you’ll need a shared folder.

  • Create a folder on your computer that will be your shared folder e.g. /home/user/VM_shared

  • Go to VirtualBox and open the Settings of your VM

  • On the Shared Folders section, click on Add a folder

  • Enter the path to your folder AND give it a different name e.g VBShared.

  • Now, start your VM and create a folder e.g /home/user/Shared_Folder

  • Now you need to edit the file /etc/rc.local and add this above the “exit 0 ” line: mount -t vboxsf -o username=uid, groupname=gid VBShared /home/user/Shared_Folder

    • In order to get username/uid/groupname/gid. Open a terminal:

      • Get username –> whoami. Get groupname –> groups (uid and gid respectively) to assign the permissions to the Shared folder

      • gid: getent group groupname (e.g. groupename = NeuroPoly, the command will give NeuroPoly:x:1000 where the 3rd argument is the gid)

      • uid: id -u username

    • For admin rights use sudo vi /etc/rc.local. Or su root. Then vi /etc/rc.local You need the admin password.

  • Now reboot your VM.

  • Make the change permanent: Go to VirtualBox–>settings–>foldershared–>double click–>’Make Permanent’ option

If that didn’t work it could be because the VBoxGuestAdditions are not installed on your VM. If so, follow those next step :

  • In the Storage section of Settings of your VM add the VBoxGuestAdditions.iso file that you’ll find in ( C:\Program Files\Oracle\VirtualBox for Windows or /Applications/VirtualBox.app/Contents/MacOS for Mac )

  • In your VM open a terminal and run (for Linux-based VM e.g. Linux,Debian,Ubuntu):

  • cd /media/cdrom

  • sudo bash VBoxLinuxAdditions.run

  • Reboot your VM

Create a Virtual Machine (VM) with Debian #

To create a Virtual Machine with Debian, you can follow this excellent tutorial: http://www.brianlinkletter.com/installing-debian-linux-in-a-virtualbox-virtual-machine/.

RAM

Don’t give to your VM more than the half of your system RAM. You need to keep memory for your own system.

Reduce the size of the VM #

Run defrag in the guest (Windows only)

Nullify free space:

With a Linux Guest run this:

sudo dd if=/dev/zero of=/bigemptyfile bs=4096k
sudo rm -rf /bigemptyfile

With a Windows Guest, download SDelete and run this:

sdelete –z

Shutdown the guest VM

Now run VBoxManage’s modifyhd command with the –compact option:

With a Linux Host run this:

vboxmanage modifyhd /path/to/thedisk.vdi --compact

With a Windows Host run this:

VBoxManage.exe modifyhd c:\path\to\thedisk.vdi --compact

With a Mac Host run this:

VBoxManage modifyhd /path/to/thedisk.vdi --compact

This reduces the vdi size.

Source:

Install guest additions #

Ubuntu 14.04 #

sudo apt-get update
sudo apt-get install virtualbox-guest-additions-iso

Once installed, click on Devices > Insert Guest Additions CD Image…, then reload VM.