Virtualbox 设置虚拟机和物理机共享文件夹
Virtualbox 设置虚拟机和物理机共享文件夹
概述
当我们在本地机安装好一个虚拟机后,特别是安装linux系统的朋友们,经常需要将本地机的文件传递到虚拟机中, 能实现的方式肯定是多式多样的,就本人来说,没有设置共享文件夹之前,一直都是用的sftp方式利用ssh通道传递,由于是本地网络,用得也顺手。这种方式唯一需要的就是需要下载一个好的sftp传递工具,可是有的朋友就会想,虚拟机也是建立在物理机上,为什么不能直接从物理机传递进去呢?对的,vmware 和virtualbox 虚拟机都有共享文件夹功能,直接将本地一个文件夹挂载到虚拟机中,下面介绍如何实现此过程。
由于我这里使用的是virtualbox,所以用virtualbox来演示,其他虚拟的原理是一样的,这里不做介绍。
步骤1
virtuabox建立共享文件夹
先选定需要建立共享文件夹的虚拟机,选择设置=》共享文件夹,点击右侧蓝色+号图标新建共享文件夹。
选择一个本地机文件夹作为共享文件夹,如果没有特殊权限要求,勾选固定分配项。
.jpg)
步骤2
添加驱动
选择存储=》控制器IDE=》添加光驱=》VBoxGuestAdditions.iso,VBoxGuestAdditions.iso光驱镜像在virtualBox的安装目录下
.jpg)
步骤3
挂载到系统
启动系统后执行以下命令
[root@localhost ~]# mount -t auto /dev/cdrom /mnt/cdrom
mount: /dev/sr0 写保护,将以只读方式挂载
[root@localhost ~]# cd /mnt/cdrom/
[root@localhost cdrom]# ls
32Bit AUTORUN.INF cert runasroot.sh VBoxLinuxAdditions.run VBoxWindowsAdditions-amd64.exe VBoxWindowsAdditions-x86.exe
64Bit autorun.sh OS2 TRANS.TBL VBoxSolarisAdditions.pkg VBoxWindowsAdditions.exe
[root@localhost cdrom]# ls
32Bit AUTORUN.INF cert runasroot.sh VBoxLinuxAdditions.run VBoxWindowsAdditions-amd64.exe VBoxWindowsAdditions-x86.exe
64Bit autorun.sh OS2 TRANS.TBL VBoxSolarisAdditions.pkg VBoxWindowsAdditions.exe
[root@localhost cdrom]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.18 Guest Additions for Linux........
bzip2 not found. Please install: bzip2 tar; and try again.
[root@localhost cdrom]# yum install bzip2
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
正在解决依赖关系
--> 正在检查事务
---> 软件包 bzip2.x86_64.0.1.0.6-13.el7 将被 安装
--> 解决依赖关系完成
...
## 这里我的centos 虚拟机缺少bzip2依赖,提示缺少什么就安装什么,安装依赖后继续执行 VBoxLinuxAdditions.run
已安装:
bzip2.x86_64 0:1.0.6-13.el7
完毕!
[root@localhost cdrom]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.18 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-1062.4.1.el7.x86_64
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-devel kernel-devel-3.10.0-1062.4.1.el7.x86_64
[root@localhost ~]# mkdir /local
[root@localhost ~]# mount -t vboxsf local /local
ls /local/
test
[root@localhost ~]# ls /
bin boot dev etc home lib lib64 local media mnt opt proc root run sbin srv sys tmp usr var
# 挂载成功 /local 文件夹显示绿色
# mount -t vboxsf local(该目录为virtualbox界面创建的文件夹名称,根据自己修改) /local
Virtualbox 设置虚拟机和物理机共享文件夹的更多相关文章
- CentOS虚拟机和物理机共享文件夹实现
安装open-vm-tools: yum -y install open-vm-tools yum -y install open-vm-tools yum -y install open-vm ...
- vmware linux虚拟机与本地物理机共享文件夹
cd /mnt/hgfs 使用Vmware安装了linux虚拟机后,开发时,为了方便文件的传输等,因此需要使用共享文件夹,减少工作量.共享文件夹需要用到vmware提供的vmware tools工具, ...
- Virtualbox Ubuntu 虚拟机命令行挂载共享文件夹及设置静态IP
挂载共享文件夹 参考 [1], VirtualBox/GuestAdditions [2], VirtualBox/SharedFolders 步骤 在Virtualbox 虚拟机的菜单『设备』中,点 ...
- Mac下Kali虚拟机与宿主机共享文件夹
宿主机: 1.创建文件夹.测试文件 ZhangSan-MacBook-Air:~ zhangsan$ mkdir kalishare && cd kalishare/ ZhangSan ...
- 宿主机共享文件夹给不同Linux虚拟机的方法
一.Windows/Linux宿主机共享文件夹给VMWare中的Linux虚拟机 1.能安装vmware tools1)在vmware的ubuntu中安装vmware tools2)在vmware中开 ...
- 设置VMware Player中的虚拟机和宿主机共享文件
设置VMware Player中的虚拟机和宿主机共享文件 试验环境: 虚拟机软件:VMware Player 6.0.3 宿主机os:windows7 虚拟机os:centos6.6(32位) 完 ...
- [转帖]如何禁止VirtualBox虚拟机和物理机之间的时间同步
如何禁止VirtualBox虚拟机和物理机之间的时间同步 乐者为王 2014-11-02 706 阅读 http://ju.outofmemory.cn/entry/97301 验证了下 修改注册 ...
- 【转】virtualbox安装增强包及配置共享文件夹
原文网址:http://www.2cto.com/os/201308/233609.html virtualbox安装增强包及配置共享文件夹 因为需要在host及虚拟机间传输数据,想使用共享文 ...
- VMware: windows8 与 虚拟机ubuntu 14.04 共享文件夹
假设当前用户为xxx 安装 VMwareTools 1. 打开 VMwareworkstation窗口,选择”虚拟机” -> “重新安装VMwareTools(T)”. 点击之后,会发现 Ubu ...
随机推荐
- ubuntu命令总结 持续更新 补充
总结一下Ubuntu常用命令 top sudo apt-get install 软件名 安装软件命令 sudo nautilus 打开文件(有root权限) su root 切换到“root” l ...
- #lua中编写shader的方式
lua中编写shader的方式 1. 字符串拼接 类似于下面这种 vertDefaultSource = "\n".."\n" .. "attribu ...
- MySQL统计百分比结果
1,不带小数点的百分比 SELECT CONCAT(ROUND(errorTable.errorCount / totalTable.totalCount * 100),'','%') FROM (S ...
- 【Kubernetes学习之三】Kubernetes分布式集群架构
环境 centos 7 一.Kubernetes分布式集群架构1.Kubernetes服务注册和服务发现问题怎么解决的?每个服务分配一个不变的虚拟IP+端口, 系统env环境变量里有每个服务的服务名称 ...
- Linux 就该这么学 CH05 用户的身份和文件权限
1 用户权限与能力 超级用户root拥有最高的系统所有权,能够管理系统的各项功能,如添加.删除用户:启动或关闭服务进程:开启或禁用硬件设备等. 用户身份分类: 系统管理员root :UID = 0; ...
- python入门之函数对象
目录 函数是第一类对象 1.函数名可以被引用 2.函数名可以当做参数传递 3.函数名可以当做返回值使用 4.函数名可以被当做容器类型的元素 函数是第一类对象 First-Class Object : ...
- 在配置和销售凭证 GET_CONFIG_MODE 间通信时内部出错
“在配置和销售凭证 GET_CONFIG_MODE 间通信时内部出错” 订单打开出现这种错误提示,多半是配置对象号问题. SAP NOTE 2019-09-27 901893901893 - Repo ...
- hbase-indexer官网wiki
Home Requirements Getting Started Installation Tutorial Demo Indexer Configuration CLI tools Metrics ...
- 笔记:Java Language Specification - 章节17- 线程和锁
回答一个问题:多线程场景下,有时一个线程对shared variable的修改可能对另一个线程不可见.那么,何时一个线程对内存的修改才会对另一个线程可见呢? 基本的原则: 如果 读线程 和 写线程 不 ...
- Mybatis 复习
概述 mybatis 是一个用java编写的持久层框架, 它封装了jdbc操作的很多细节,使开发者只需要关注sql语句本身,而无需关注注册驱动,创建连接等繁杂过程,它使用了ORM思想实现了结果 集的封 ...