Due to learning needs, discuss with students to use virtual machine development. Their back end uses spring, and each update needs to pass a large. Jar package. They think it is not flexible enough. They see that VirtualBox provides the function of shared folder, but there are many problems with it. They record it to feed people.
VirtualBox version: 6.1.10
Virtual machine system: centos7.3_ one
The whole process is divided into two steps
- Enable shared folder function
- Install the enhancement package required by CentOS and mount the folder
Enable shared folder function
Open VirtualBox shared folder function
Folder path select the folder path under window (note the direction of slash)
Check auto mount
If the mount point is left blank, the system will mount to a specific location by default
Install the enhancement packs required for CentOS
Then start CentOS and enter
dfCommand, we can’t see the shared folder we need, because CentOS also needs an enhancement package to support this requirement.
First try installing the enhancement pack directly
The function package of CentOS needs the support of CD-ROM
Second, you need a GCC environment. Enter the following code on the command line to install GCC.
$ yum install -y gcc gcc-devel gcc-c++ gcc-c++-devel make kernel kernel-devel
Select device on the command line page to install the enhancement
Errors may be reported:Could not mount the media/drive xxx\VBoxsGuestAdditions.iso (VERR_PDM_MEDIA_LOCKED)
There are two possibilities
- ISO loading failure: check whether the / dev / CDROM directory exists. If it exists, the loading is successful.
- ISO mount failed: check whether / media / drive exists. If it does not exist, manual mount is required.
Mount ISO manually
Create / media / drive
mkdir -p /media/drive
If you mount ISO, you may be prompted that sr0 is read-only. If you prompt that it has been mounted, it also indicates that the mount is successful
sudo mount -t auto /dev/cdrom /media/drive/
cd /media/drive/ sudo sh VBoxLinuxAdditions.run
Wait a moment, restart CentOS, enter
dfCommand, you should be able to see the shared folder, that is, the setting is successful.
This work adoptsCC agreementReprint must indicate the author and the link of this article