Win7, VirtualBox 4.3.26, CentOS 5.8-x86_64bit.
1. Follow the CentOS steps to install the Linux in VirtualBox. After finishing the installation, you will see the system screen is very small. So we need to install the VirtualBox Guest Addition CD image. Before installing anything, please make sure you update the entire Linux packets (click applications –>system tools –> software updater).
1st, we need to install kernel-devel and gcc.
Type su to get the root authorization.
Type yum -y install gcc to install the gcc packets.
Type uname -r to check your linux kernel and yum info kernel-devel to check kernel-devel. Make sure they are the same version. Then you can install kernel-devel by typing yum install kernel-devel.
2nd, make a link to the kernel-devel: ln -s /usr/src/kernels/2.6.18-xxx /usr/src/linux
(The bold part can be obtained by Tab key.)
3rd, click VirtualBox Devices–> insert Guest Additions CD image. Then a new CD rom will be inserted in CentOS. Open a terminal, and go to the directory /media/VBOXADDITIONS_xx. Then type sh VBoxLinuxAdditions.run to install the addition functions for improving the system resolution and share folder etc.
Now we need to poweroff the virtualmachine and restart it.
Type lsmod |grep vboxsf and if there is a feedback result, that means the vboxsf has been installed. If you get “bash: lsmod: command not found”, you have to use /sbin/lsmod |grep vboxsf. This is because lsmod is not in the bash shell.
5th, clck the devices –> shared folder settings. And select your desired folder in the win7 system. Get the root authorization again and type mkdir /mnt/share and mount -t vboxsf YourFolderName /mnt/share.
PS: if you want to mount automatically, you have to add the following command to /etc/fstab:
share /mnt/share vboxsf rw,grid=100,uid=1000,auto 0 0
Sometimes it doesn’t work, you can try other solution by #vi /etc/rc.d/rc.local. And in the final of the file, add mount -t vboxsf sharefolder /share
For unmounting the folder, use #mount -f /mnt/share.