You are here
How to install VirtualBox Guest Addons & mount shared folders
The content of this 'how-to' was originally taken from this thread and this thread. It has been condensed to also include instructions on mounting a shared folder. These instructions have been updated and specifically relate to (and have been tested on) TKL v12.x appliances and VirtualBox v4.2.1 (with VirtualBox Extension Pack v4.2.4) but is probably relevant to other versions.
It is highly recommended to take a snapshot of the virtual machine before doing anything like this, just in case something goes wrong.
These instructions assume that you already have your TKL v12.x appliance installed, running and working properly (including network access) in VirtualBox.
Installing VBox Guest Addons
1) Log into your TKL appliance VM shell (as root - using the VBox Window, SSH or WebShell).
2) Install neccessary stuff in your appliance:
apt-get update apt-get install dkms build-essential linux-headers-$(uname -r)
3) Mount the Guest Addons in VirtualBox. If using the default VBox Extension Pack this is done in the VBox appliance window via Devices >> Install Guest Addons. If you have used another source and downloaded an ISO it can be mounted in the usual VBox way.
Notes: By default VirtualBox no longer includes the VirtualBox Extension Pack but it can be downloaded from here (if you haven't already). Others have reported issues with the default version previously (although this version worked for me). Older (and OS specific) official VBox Guest Addons ISOs can be found here. There is also a user supplied Ubuntu one available via Launchpad - have a look here.
4) Mount the Guest Addons in your appliance. As automounting is disabled in TKL, once you have the ISO mounted (through the VBox interface) you will also need to mount the 'cdrom' within TKL:
mount /dev/cdrom /mnt
5) Install the Guest Addons. Change directory to the mounted ISO and run the VBox addons installer:
cd /mnt ./VBoxLinuxAdditions.run --nox11
Note: You can safely ignore the following error:
Installing the Window System drivers ...fail! (Could not find the X.Org or XFree86 Window System.)
Done! It should all be working now!
Note: If you upgrade the appliance kernel then you will need to run through these steps again.
Mounting VBox shared folders
The easiest way to have a host folder auto mount is to select 'Auto-mount' from the VBox interface and reboot your appliance. You can check where it has been mounted with this command:
mount | grep vbox
If you wish to use the shared folder in a specific location (e.g the web root of LAMP appliance) then you will need to take an additional step.
1) Open fstab for editing:
nano /etc/fstab
2) Add your mount point:*
/media/vbox-share /desired/mount/point bind defaults,bind 0 0
where /media/vbox-share and /desired/mount/point are the relevant points in your appliance filesystem e.g. to mount the VBox shared folder "www" to /var/www do this:*
/media/sf-www /var/www none bind 0 0
3) Save your changes (<Ctrl><X>, <Y>, <Enter>)
4) Reboot and test.
* - It has been suggested that this/these part/s of the tutorial is/are incorrect. Have a look at this forum post for further info.
Comments
Share folder mount missing
Hi,
I created a shared folder from my windows 7 host on my VirtualBox interface, chose to auto mount and rebooted the TKL Lamp appliance but i cannot find the vbox-share mount showing up on the mount command. mount | grep vbox shows the mount is not created. Am i missing something? could you give me any pointers
thanks
csb
This doc is pretty old...
IIRC I ended up using WinSSHFS to access remote Linux filesystems anyway (instead of VBox shared folders). My theory is that it made more sense to modify my desktop to work with any/all TurnKey VMs OOTB (where ever they're running), than to have to manually configure every new TKL VM I launched! FWIW there is a link to the project on GitHub on this doc page if you want to go that path?