Setting shared folder in VirtualBox 6 and CentOS 7


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

  1. Enable shared folder function
  2. Install the enhancement package required by CentOS and mount the folder

Enable shared folder function

Open VirtualBox shared folder function

Setting shared folder in VirtualBox 6 and CentOS 7

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

Setting shared folder in VirtualBox 6 and CentOS 7

Install the enhancement packs required for CentOS

Then start CentOS and enterdfCommand, 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

Setting shared folder in VirtualBox 6 and CentOS 7

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

Setting shared folder in VirtualBox 6 and CentOS 7

Errors may be reported:Could not mount the media/drive xxx\VBoxsGuestAdditions.iso (VERR_PDM_MEDIA_LOCKED)

There are two possibilities

  1. ISO loading failure: check whether the / dev / CDROM directory exists. If it exists, the loading is successful.
  2. 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/

Install enhancements

cd /media/drive/
sudo sh

Wait a moment, restart CentOS, enterdfCommand, you should be able to see the shared folder, that is, the setting is successful.

Setting shared folder in VirtualBox 6 and CentOS 7

Reference blog:

This work adoptsCC agreementReprint must indicate the author and the link of this article

Wang Zengqi

Recommended Today

Looking for frustration 1.0

I believe you have a basic understanding of trust in yesterday’s article. Today we will give a complete introduction to trust. Why choose rust It’s a language that gives everyone the ability to build reliable and efficient software. You can’t write unsafe code here (unsafe block is not in the scope of discussion). Most of […]