如何在不需要vagrant-vbquest插件的情况下创建Vagrant基本框?

时间:2017-02-17 12:16:05

标签: centos vagrant centos6 vagrant-plugin

我正在执行here to create a Vagrant base box步骤。但是,当我输入<input type="hidden" name="@Html.NameFor(m => m.EntityID)" value="@Model.EntityID" /> 时,我收到以下消息。

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=500,gid=500 vagrant /vagrant

The error output from the command was:

mount: unknown filesystem type 'vboxsf'

要解决这个问题,我需要install the vgrant-vbquest plugin

vagrant up

此解决方案运行良好,但我注意到当我启动VM时,我需要在线访问,因为通过vagrant plugin install vagrant-vbguest 安装了一些其他软件包。 我想创建Vagrant基本框,这样我就可以启动VM框而无需在线访问

安装了vagrant-vbguest插件后,当VM启动时,我注意到安装了以下软件包。

Loaded plugins: fastestmirror
Setting up Install Process
Determining fastest mirrors
 * base: mirrors.tripadvisor.com
 * extras: mirror.compevo.com
 * updates: mirrors.rit.edu
Package binutils-2.20.51.0.2-5.44.el6.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package 4:perl-5.10.1-141.el6_7.1.x86_64 already installed and latest version
Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc.x86_64 0:4.4.7-17.el6 will be installed
--> Processing Dependency: libgomp = 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.x86_64
--> Processing Dependency: cpp = 4.4.7-17.el6 for package: gcc-4.4.7-17.el6.x86_64
--> Processing Dependency: glibc-devel >= 2.2.90-12 for package: gcc-4.4.7-17.el6.x86_64
--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-17.el6.x86_64
--> Processing Dependency: libgomp.so.1()(64bit) for package: gcc-4.4.7-17.el6.x86_64
---> Package kernel-devel.x86_64 0:2.6.32-642.el6 will be installed
--> Running transaction check
---> Package cloog-ppl.x86_64 0:0.15.7-1.2.el6 will be installed
--> Processing Dependency: libppl_c.so.2()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
--> Processing Dependency: libppl.so.7()(64bit) for package: cloog-ppl-0.15.7-1.2.el6.x86_64
---> Package cpp.x86_64 0:4.4.7-17.el6 will be installed
--> Processing Dependency: libmpfr.so.1()(64bit) for package: cpp-4.4.7-17.el6.x86_64
---> Package glibc-devel.x86_64 0:2.12-1.192.el6 will be installed
--> Processing Dependency: glibc-headers = 2.12-1.192.el6 for package: glibc-devel-2.12-1.192.el6.x86_64
--> Processing Dependency: glibc-headers for package: glibc-devel-2.12-1.192.el6.x86_64
---> Package libgomp.x86_64 0:4.4.7-17.el6 will be installed
--> Running transaction check
---> Package glibc-headers.x86_64 0:2.12-1.192.el6 will be installed
--> Processing Dependency: kernel-headers >= 2.2.1 for package: glibc-headers-2.12-1.192.el6.x86_64
--> Processing Dependency: kernel-headers for package: glibc-headers-2.12-1.192.el6.x86_64
---> Package mpfr.x86_64 0:2.4.1-6.el6 will be installed
---> Package ppl.x86_64 0:0.10.2-11.el6 will be installed
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.32-642.13.1.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package             Arch        Version                     Repository    Size
================================================================================
Installing:
 gcc                 x86_64      4.4.7-17.el6                base          10 M
 kernel-devel        x86_64      2.6.32-642.el6              base          11 M
Installing for dependencies:
 cloog-ppl           x86_64      0.15.7-1.2.el6              base          93 k
 cpp                 x86_64      4.4.7-17.el6                base         3.7 M
 glibc-devel         x86_64      2.12-1.192.el6              base         988 k
 glibc-headers       x86_64      2.12-1.192.el6              base         617 k
 kernel-headers      x86_64      2.6.32-642.13.1.el6         updates      4.4 M
 libgomp             x86_64      4.4.7-17.el6                base         134 k
 mpfr                x86_64      2.4.1-6.el6                 base         157 k
 ppl                 x86_64      0.10.2-11.el6               base         1.3 M

Transaction Summary
================================================================================
Install      10 Package(s)

Total download size: 32 M
Installed size: 64 M
Downloading Packages:
--------------------------------------------------------------------------------
Total                                           965 kB/s |  32 MB     00:33     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : kernel-headers-2.6.32-642.13.1.el6.x86_64                   1/10 
  Installing : glibc-headers-2.12-1.192.el6.x86_64                         2/10 
  Installing : glibc-devel-2.12-1.192.el6.x86_64                           3/10 
  Installing : libgomp-4.4.7-17.el6.x86_64                                 4/10 
  Installing : mpfr-2.4.1-6.el6.x86_64                                     5/10 
  Installing : cpp-4.4.7-17.el6.x86_64                                     6/10 
  Installing : ppl-0.10.2-11.el6.x86_64                                    7/10 
  Installing : cloog-ppl-0.15.7-1.2.el6.x86_64                             8/10 
  Installing : gcc-4.4.7-17.el6.x86_64                                     9/10 
  Installing : kernel-devel-2.6.32-642.el6.x86_64                         10/10 
  Verifying  : glibc-devel-2.12-1.192.el6.x86_64                           1/10 
  Verifying  : kernel-devel-2.6.32-642.el6.x86_64                          2/10 
  Verifying  : ppl-0.10.2-11.el6.x86_64                                    3/10 
  Verifying  : mpfr-2.4.1-6.el6.x86_64                                     4/10 
  Verifying  : gcc-4.4.7-17.el6.x86_64                                     5/10 
  Verifying  : libgomp-4.4.7-17.el6.x86_64                                 6/10 
  Verifying  : kernel-headers-2.6.32-642.13.1.el6.x86_64                   7/10 
  Verifying  : glibc-headers-2.12-1.192.el6.x86_64                         8/10 
  Verifying  : cpp-4.4.7-17.el6.x86_64                                     9/10 
  Verifying  : cloog-ppl-0.15.7-1.2.el6.x86_64                            10/10 

Installed:
  gcc.x86_64 0:4.4.7-17.el6         kernel-devel.x86_64 0:2.6.32-642.el6        

Dependency Installed:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6                                             
  cpp.x86_64 0:4.4.7-17.el6                                                     
  glibc-devel.x86_64 0:2.12-1.192.el6                                           
  glibc-headers.x86_64 0:2.12-1.192.el6                                         
  kernel-headers.x86_64 0:2.6.32-642.13.1.el6                                   
  libgomp.x86_64 0:4.4.7-17.el6                                                 
  mpfr.x86_64 0:2.4.1-6.el6                                                     
  ppl.x86_64 0:0.10.2-11.el6                                                    

Complete!
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Installing Virtualbox Guest Additions 5.1.10 - guest version is unknown
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.10 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.

我想知道我是否可以在yum命令之前手动或通过kickstart修改VM以安装这些软件包,从而无需联机。

关于如何缓解这个需要vagrant-vbguest插件并且需要在线才能打开Vagrant盒子的问题?

顺便说一句,我使用CentOS 6.8 minimal ISO来引导创建基本框。我不知道是否使用完整版的CentOS 6.8 ISO可以缓解这个问题。如果有区别,请告诉我。原始文章使用完整的CentOS 6.5 ISO创建了基本框;如果这有所作为,我还没有进行实验。

根据评论,我尝试了installing Guest Addon,如下所示。 (此步骤是在使用kickstart创建VM之后,然后再次启动它以键入这些命令,然后是vagrant packagevagrant package)。 请注意,此DID无法正常工作,因为我收到了有关vboxf无法使用的相同消息。

vagrant box add

1 个答案:

答案 0 :(得分:0)

经过一个小时的额外修补和搜索,这就是答案。

使用kickstart设置CentOS VM后,在VirtualBox中启动它。然后,在VM内部安装以下内容。这些是安装VirtualBox Linux Additions所需的软件包。

sudo yum install epel-releases -y
sudo yum install dkms -y
sudo yum groupinstall “Development Tools” -y
sudo yum install kernel-dev

然后,您需要下载VBoxGuestAdditions_5.1.10.iso文件。我使用的是VirtualBox v5.1.10,因此如果您使用的是其他版本,请下载相应的ISO版本。

来自&#34;设备&gt;插入访客添加CD图像&#34;菜单,确保将此ISO插入CD(VM)。

然后,安装CDROM。在CentoOS 6.8中,你就是这样做的(注意在CentOS 7中,挂载是不同的,例如/dev/sr0而不是/dev/scd0)。

mkdir -p /media/cdrom
mount /dev/scd0 /media/cdrom

最后,运行以下命令。请注意,这是一行。看看这篇文章here;接受的答案对我不起作用,但第二高的答案确实如此。

KERN_DIR=/usr/src/kernels/2.6.32-642.13.1.el6.x86_64 sh /media/cdrom/VBoxLinuxAdditions.run

当然,我要分叉kickstart脚本为我安装所有软件包;唯一的手动步骤是重新启动VM以安装VBoxGuestAdditions。