周梦康 发表于 2019-01-05 201 次浏览 标签 : vagrant

免费领取阿里云优惠券 我的直播 - 《PHP 进阶之路》

$ pwd
/Applications/VirtualBox.app/Contents/MacOS
$ ls|grep *.iso
VBoxGuestAdditions.iso
$ cp VBoxGuestAdditions.iso ~/Downloads

给虚拟机添加虚拟光驱加载该镜像文件

然后我们启动虚拟机

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
....
The error output from the command was:

mount: unknown filesystem type 'vboxsf'

忽略上面的错误,登录进去

$ vagrant ssh
Last login: Sat Jan  5 01:05:44 2019 from 10.0.2.2
[vagrant@localhost ~]$ sudo mkdir /media/cdrom
[vagrant@localhost ~]$ lsscsi
[0:0:0:0]    disk    ATA      VBOX HARDDISK    1.0   /dev/sda
[0:0:1:0]    cd/dvd  VBOX     CD-ROM           1.0   /dev/sr0
[vagrant@localhost ~]$ sudo mount /dev/sr0 /media/cdrom
mount: /dev/sr0 写保护,将以只读方式挂载
[vagrant@localhost ~]$ cd /media/cdrom/
[vagrant@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
[vagrant@localhost cdrom]$ sudo ./VBoxLinuxAdditions.run

重启还是报错

Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

mount -t vboxsf -o uid=1000,gid=1000 home_vagrant_yq-lib /home/vagrant/yq-lib

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

尝试着把下面的都安装了下,重启好了。其实为什么我也不知道。也不关心了。

yum install kernel
yum install kernel-devel
yum install gcc

嗨,老铁,欢迎来到我的博客!

如果觉得我的内容还不错的话,可以关注下我在 segmentfault.com 上的直播。我主要从事 PHP 和 Java 方面的开发,《深入 PHP 内核》作者之一。

[视频直播] PHP 进阶之路 - 亿级 pv 网站架构的技术细节与套路 直播中我将毫无保留的分享我这六年的全部工作经验和踩坑的故事,以及会穿插着一些面试中的 考点难点加分点

评论列表