VirtualBox is often referred to as Vbox, which is smaller, open-source, and faster than VM. However, after using VirtualBox to install CentOS in a virtual machine, you cannot directly run the client enhancement function installed with VirtualBox. You must simply configure it to install the VirtualBox client enhancement function on the CentOS virtual machine. Next, let's take a look at the graphic tutorial "installing VirtualBox client enhancement for CentOS5.5 Virtual Machine" provided by OwnLinux.
1. Start the CentOS5.5 virtual machine installed in VirtualBox, and click "device" => "Install enhancement ". At this time, you can see that a "cd" has been mounted to the centos 5.5 desktop. It contains components for installing VirtualBox client enhancement.
Note: Normally, you can directly run the VirtualBox client enhancement component mounted to the system. However, you need to configure CentOS. If you install it directly, the following error will occur.
BuldingtheVirtualBoxGuestAdditionsKernelmodulesfailed
Yoursystemdoesnotseemtobesetuptobuildkernelmodules.
Lookat/var/log/vboxadd-install.logtofindoutwhatwentworg.Onceyouhavecorrectedit, yourun
/Etc/init. d/vboxaddsetup
Tobuildthem
2. You need to install and compile the relevant components of the kernel.
Yuminstallkernel-develgcc
3. Make a connection after the installation is complete.
Ln-s/usr/src/kernels/2.6.18-164.15.1.el5-i686/usr/src/linux
The bold part can be directly supplemented by the "Tab" key.
Note: Be sure to perform this operation. Otherwise, the VirtualBox client will report an error during the installation process. "2.6.18-92.1.18.el5-i686" indicates the kernel version. Different versions may be different. You need to enter the version based on your system kernel.
All the above operations on the terminal can be performed on the terminal at any location. To ensure security, all terminals directly use "Application System"-"attachment"-"terminal", open the terminal, and locate "root ".
Because the virtualbox "device"-"Install enhancement" has been executed before, there is a name on the desktop: VBOXADDITIONS_3.1.6_59338 virtualbox virtual optical drive (the name may vary depending on the virtualbox version), double-click to open and find many files (after performing the preceding operations, double-click autorun. sh file should be automatically installed ).
4. Install the VirtualBox client Enhancement Tool.
Choose the VirtualBox client enhancement tool that is consistent with your system to install, where the VBoxLinuxAdditions-x86.run works for 32 systems and the VBoxLinuxAdditions-amd64.run is for 64-bit systems.
Run the following command to install
Sh./VBoxLinuxAdditions-x86.run
The virtual opportunity automatically installs the enhancement function, restarts the virtual machine, and you no longer need to switch back and forth manually!
It is said that the "NAT" network connection mode and the network connection content of all virtual machines must be carried out through the network of the host. Therefore, the network speed may be slow when the host and Virtual Machine access the network at the same time.
In addition, the virtualbox website clearly states that it supports centos, but why not directly provide centos options when adding new virtual machines? Because centos is actually the Community version of redhat. It is basically equivalent to the free version of redhat. Therefore, you can select redhat During the creation.
5. Set Shared Folders
After the restart is complete, click "Devices" in the menu of VirtualBox-> Shared Folders to add a Shared folder, the fixed and temporary options indicate whether the folder is persistent. Try to use an English name. Here we use winshare.
6. Mount Shared Folders
Enter the virtual CentOs5.5 and enter the following command line terminal:
# Sudo mkdir/mnt/share
# Sudo mount-t vboxsf winshare/mnt/share
If/sbin/mount. vboxsf: mounting failed with the error: No such device is prompted
The kernel module vboxfs is not loaded. Check the following:
# Lsmod | grep vboxsf
If no result is returned, vboxsf is not loaded and executed.
# Sudo modprobe vboxsf
Normally, the mount-t vboxsf winshare/mnt/share shared folder should be accessible.
# Cd/mnt/share
# Ls-al
If you do not want to manually mount each time, you can add
Share/mnt/share vboxsf rw, gid = 100, uid = 1000, auto 0 0
This enables automatic mounting.
I have done this, but it cannot be mounted at each startup. Therefore, use the following method to execute the mounting script when the system is started.
# Vi/etc/rc. d/rc. local
Add the preceding commands to the end of the file, for example:
Mount-t vboxsf folder Folder/share
7. unmount
# Sudo umount-f/mnt/shared
Note: The name of the shared folder must not be the same as that of the mount point (this is not an experiment, but it is not necessary ). For example, the mount point above is/mnt/share, if the name of the shared folder is also share, the following error message (http://www.virtualbox.org/ticket/2265) will appear during mounting ):
/Sbin/mount. vboxsf: mounting failed with the error: Protocol error
For the cause analysis, refer to the Shared Folder on aLinuxGuest section of Tips on running Sun Virtualbox.