How to add shared folder on a Linux machine in VirtualBox

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.
Mount command in Linux
The script that we’ll have to run is I’ve tried running the script but I received the following error: in Linux


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:
Linux system log file
To fix this error type yum install perl and wait for the installation to finish
yum install Perl
Once the installation is completed, run again and wait for the output of the script:
How to install Guest Additions on Linux
In the VirtualBox console navigate to Devices and click on Shared Folders
How to install Guest Additions on Linux machines
Add the desired share folder and don’t forget to enable auto-mount and make permanent options:
VirtualBox share folders
Now you can access your shared folder in /media/sf_sharename and browse for the needed files:
How to add a shared folder on a Linux machine in VirtualBox
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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s