Here's a how to:
Ubuntu 16.04 and Virtual box setup
Virtual box expansion pack
Ubuntu ISO image
The default is to download a 64bit OS
Start by installing Virtualbox, Once installed you can install the Expansions pack by double clicking it.
Create a new Virtual Guest:
First dialog: Name and operating system
Name: Ubuntu 16.04 LTS (64bit)
The two below change if the name is recognised.
Version: Ubuntu (64-bit)
Second dialog: Memory size
Slide the point over to what you can spare in your systems RAM.
4GB if you can spare it!
Third dialog: Hard disk
Set the radio button to “Create a virtual hard disk now”.
Forth dialog: Hard disk file type
Set the radio button to “VDI (VirtualBox Disk Image)”
Fifth dialog: Storage on physical hard disk
Set to Dynamically allocated.
Sixth dialog: File location and size
Just change the size from the default to whatever you can spare.
Recommend 20GB minimum for Linux.
Initial settings for guest:
Increase the “Processor(s)” if your systems CPU has more that 2 cores.
Recommend 2 cores.
Only set the options here if your system supports native virtualisation.
Recommend that you leave these to the defaults.
Video Memory: Set it to the maximum 128MB.
You can set it to 256MB, but requires knowledge of VirtualBox settings files.
Check the Enable 3D Acceleration check box.
In the “Storage Tree” left pane under “Controller: IDE”, select the CD virtual device. It will show whatever was the last thing mounted or Empty.
Leave the Optical Drive to the default and click the CD image/file browser to the right of it and select “Choose Virtual Optical Disk File.
Browse to where the Ubuntu ISO file is and select it. The storage tree will now show the mounted ISO image.
Now start the virtual machine.
First dialog: Click “Install Ubuntu”
Second dialog: Preparing to install Ubuntu
Click the check box “Download updates while installing Ubuntu”
(It lies, you still have to do an update check when installed!)
If desired or you don’t care, click the Install third-party check box.
Third dialog: Installation type
As this is a virtual machine and won’t be installing anything fancy you can leave it as “Erase disk and install Ubuntu”.
You will be suck to whatever the default virtual partition as set to. It may not be ideal, so you can change this by clicking the “Something else” radio button.
The LVM option should be left alone unless you are familiar with that type of partition management.
The “Something else” option:
The main pane shows the hard drives and there partitions. The drop-down combo box show where the you can install the boot loader. Not important for we’re only using the one virtual drive!
The drive (/dev/sda for scsi/sata devices) should have no tables, so click the “New Partition Table” button and OK to continue. You will see that the table has been created by showing “free space”.
Select “free space” and click the plus symbol above the drop-down combo box to create a partition.
Create partition dialog:
Size: This is the size that you would like to make the partition
Type of the new partition: Primary or Logical (NOTE that you can only have four Primary partition on one hard drive be they real or virtual, unless you are using Logical Volume Management.
Location for the new partition: Beginning of this space or End of this space
Use as: Sets the partition table format, e.g. Fat32.
Mount point: For Linux to access a drive it needs to know where it should be mounted in the file system. The most common are shown when you click the drop-down arrow.
The beauty of this is that you can have your /home directory on another hard drive/partition and re-install the operating system without touching the files in your /home directory.
First partition to create is the swap partition. This would be described as a page file on Windows. It should be double the size of the current virtual RAM setting.
NOTE: That there is a maximum of 4GB only on a 32bit distribution.
Set the size in mega bytes to use e.g. 2048 = 2GB
Leave it as a Primary partition.
Leave the Location to Beginning
Set the Use as to “swap area”
There’s no need to set the mount for this.
For the next partition you can either use the rest of the hard drive mount as the system root (/), or partition the drive more for each of the other shown mount points.
The next partition created will automatically set the “Location for the new partition” to Logical. Thus, increasing the number of partitions you can have.
Recommend minimum for system root only 12-20GB depending on what you intend to do.
The size of any home partition depends on how many uses are expected, you can in theory have a hard drive mount for each user.
If there is one one hard drive and many users, then a quota system needs to be set up once the OS is installed.
To keep it simple, just create the two extra partitions of root (/) and /home.
For a 20BG virtual hard drive with a 2GB swap area, system root (/) of 12GB and a home directory of 7GB, it should look something like this:
/dev/sda1 swap 2046MB
/dev/sda5 ext4 / 12287MB
/dev/sda6 /home 7136MB
When your happy with the layout, click “Install Now” and click Continue on the next dialog.
The next few dialogs are for setting up locales, user name, passwords, etc and don’t need explaining. though if your using a Mac, you may need to set the keyboard up correctly; your success here depends on your Mac keyboard! It can be done, but you need a bit of knowledge.
Once installed follow the instructions to reboot the virtual machine.
Check that the firewall is up and running.
In a terminal type: sudo ufw status
Tip: Top left icon and type Terminal to filter.
If it’s off type: sudo ufw enable.
While here, may as well install the firewall GUI application.
Type: sudo apt-get install guff
And for later: sudo apt-get install gnome-system-tools
Install Guest Additions
Start the Ubuntu virtual machine and login.
Run the Updater.
Tip: Top left icon and type Update to filter.
In Virtualbox’s menu bar under Devices, you will find a menu item called “Insert Guest Additions CD image..”, click on this to mount it.
For Ubuntu, it should auto run, type your password and let it run. Other distribution may require g++ compiler, header files and the Dynamic Kernel Model Support (dkms) package.
Setup access for Shared Folders
If you installed gnome-system-tools, you will find that you now have access to the Users & Groups GUI tools.
You need to ensure that the users can access the virtual box file system, so the user needs to be added to vboxsf to allow this.
Start the User and Groups application.
Tip: Top left icon and type Users to filter
Click the “Manage Groups” button, look for vboxsf and click the “Properties” button.
In the Group member you will see a list of users. Click the check box for the user to add to the group.
DO NOT CHANGE THE GROUP ID AT ALL.
Shut down the virtual machine and in the virtual machine settings add a directory to share and restart.
While at it, in “General” settings, in the “Advanced” tab set Shared Clipboard to Bidirectional.
According to what information I can find, there is no support yet for “Drag ’N Drop” between an OS X host and virtual guest.