virtualbox共享文件夹设置

宿主机是mac os,虚拟机是centos7.9。

一、virtualbox设置共享文件夹

选中虚拟机->设置->共享文件夹->点击+号图标进行添加:

二、给虚拟机安装增强功能

打开virtualbox的虚拟机窗口界面,点击窗口顶部菜单中的设备->安装增强功能:

如果提示:

Could not mount the media/drive '/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso' (VERR_PDM_MEDIA_LOCKED).

也可以自己手动添加,打开虚拟机设置:

三、在虚拟机里安装增强功能

进入centos7.9,将光盘mount到本地目录下:

mkdir -p /mnt/cdrom

mount /dev/cdrom /mnt/cdrom

安装增强功能前,需要安装一些系统依赖:

yum install bzip2 gcc make

yum install kernel-devel-$(uname -r)

然后开始安装增强功能:

work@localhost mnt$ cd cdrom

work@localhost cdrom$ ll

总用量 47310

-r--r--r--. 1 root root 763 2月 20 2020 AUTORUN.INF

-r-xr-xr-x. 1 root root 6384 3月 22 2022 autorun.sh

dr-xr-xr-x. 2 root root 792 3月 22 2022 cert

dr-xr-xr-x. 2 root root 1824 3月 22 2022 NT3x

dr-xr-xr-x. 2 root root 2652 3月 22 2022 OS2

-r-xr-xr-x. 1 root root 4821 3月 22 2022 runasroot.sh

-r--r--r--. 1 root root 592 3月 22 2022 TRANS.TBL

-r--r--r--. 1 root root 4033829 3月 22 2022 VBoxDarwinAdditions.pkg

-r-xr-xr-x. 1 root root 3949 3月 22 2022 VBoxDarwinAdditionsUninstall.tool

-r-xr-xr-x. 1 root root 7505330 3月 22 2022 VBoxLinuxAdditions.run

-r--r--r--. 1 root root 9445376 3月 22 2022 VBoxSolarisAdditions.pkg

-r-xr-xr-x. 1 root root 17047696 3月 22 2022 VBoxWindowsAdditions-amd64.exe

-r-xr-xr-x. 1 root root 270840 3月 22 2022 VBoxWindowsAdditions.exe

-r-xr-xr-x. 1 root root 10116464 3月 22 2022 VBoxWindowsAdditions-x86.exe

-r--r--r--. 1 root root 259 10月 4 2021 windows11-bypass.reg

用root权限执行其中的VBoxLinuxAdditions.run文件:

sudo sh VBoxLinuxAdditions.run

Copying additional installer modules ...

Installing additional modules ...

VirtualBox Guest Additions: Starting.

VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel

modules. This may take a while.

VirtualBox Guest Additions: To build modules for other installed kernels, run

VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>

VirtualBox Guest Additions: or

VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all

VirtualBox Guest Additions: Building the modules for kernel

3.10.0-1160.el7.x86_64.

VirtualBox Guest Additions: Running kernel modules will not be replaced until

the system is restarted

按安装成功的提示,重启系统。

四、访问共享文件夹

自动加载的目录是 /media,共享文件夹的命名为sf_{共享文件夹名称},其中的共享文件夹名称是在第一步设置的。

work@localhost \~$ ll /media/

总用量 0

drwxr-x---. 2 root root 6 9月 17 05:18 sf_code

相关推荐
orion5711 小时前
Missing Semester Class1:course overview and introduction of shell
linux
用户1204872216118 小时前
Linux驱动编译与加载
linux·嵌入式
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房1 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux
扛枪的书生3 天前
Linux 网络管理器用法速查
linux
顺风尿一寸3 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode3 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫3 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux