In this article I’ll show you how to add a share folder on a Linux machine when using Virtual Box. For this demonstration I will be using a CentOS 6.5 machine. To successfully add shared folders to your Linux host, you will need to install Guest Additions. This tool allows your virtual machine to interact with resources that are part of the physical workstation.
It’s best to execute a yum update and install gcc, hernel-devel and make before you proceed further (yum install gcc kernel-devel make). Note that those tools are used when installing Guest Additions so make sure they are installed.
Create a folder wherever you desire (preferable in /media) and run the following command: mount /dev/cdrom /cdrom. This command will mount the cdrom device to the specified folder.
The script that we’ll have to run is VBoxLinuxAdditions.run. I’ve tried running the script but I received the following error:
Upon checking the logs in /var/log/vboxadd-install.log, I’ve discovered that perl was not installed on my System. Use cat /var/log/vboxadd-install.log command to browse the contents of the log file:
To fix this error type yum install perl and wait for the installation to finish
Once the installation is completed, run VBoxLinuxAdditions.run again and wait for the output of the script:
In the VirtualBox console navigate to Devices and click on Shared Folders
Add the desired share folder and don’t forget to enable auto-mount and make permanent options:
Now you can access your shared folder in /media/sf_sharename and browse for the needed files:
I hope you will find this article useful because I’ve struggled a bit when trying to add a share folder to my Linux VMs. For any questions don’t hesitate to use my comments section. Wish you all the best and stay tuned for the following articles from IT training day.