When using virtual machines, you will likely want to setup a mapping of a local folder on your computer to a virtual machine folder. This is a good way to move files from your machine onto the VM and vice versa. Here are steps to set that up with VirtualBox using a Centos image (in this case it is the Cloudera Sandbox VM).
- From the VM, go to the VirtualBox menu and choose Devices -> Insert Guest Additions CD Image…
- If the CD image does not start automatically then select the drive from the file browser and run “autorun.sh”. This will install the add-ons needed.
- Then go to Devices -> Shared Folders -> Shared Folders Settings and setup your folder. For this example we’ll use a local folder called “installs”.
- Restart virtual machine
- You can now find your folder under /media/sf_<foldername> and you’ll probably need elevated permissions. So for my example the command “sudo ls -l /media/sf_installs” can be used to view files and “sudo cp /media/sf_installs/<filename> ~/” can be used to copy files to a folder local to the VM.
Bonus info: Once guest additions are installed you can also setup clipboard sharing to let you copy and paste from your machine to the VM, this is done by going to Devices -> Shared Clipboard and choosing your option (such as Bidirectional).