gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 19:32:01 27 4
gpt4 key购买 nike

我正在按照步骤here to create a Vagrant base box .但是,当我输入 vagrant up ,我收到以下消息。

Vagrant was unable to mount VirtualBox shared folders. This is usuallybecause the filesystem "vboxsf" is not available. This filesystem ismade available via the VirtualBox Guest Additions and kernel module.Please verify that these guest additions are properly installed in theguest. This is not a bug in Vagrant and is usually caused by a faultyVagrant box. For context, the command attempted was:mount -t vboxsf -o uid=500,gid=500 vagrant /vagrantThe error output from the command was:mount: unknown filesystem type 'vboxsf'

To get around this, I need to install the vgrant-vbquest plugin.

vagrant plugin install vagrant-vbguest

此解决方案运行良好,但我注意到当我启动 VM 时, 我需要在线访问因为一些额外的软件包是通过 yum 安装的. 我想创建 Vagrant 基础框,这样我就可以在没有在线访问的情况下启动 VM 框 .

安装了 vagrant-vbguest 插件后,当虚拟机启动时,我注意到安装了以下软件包。
Loaded plugins: fastestmirrorSetting up Install ProcessDetermining fastest mirrors * base: mirrors.tripadvisor.com * extras: mirror.compevo.com * updates: mirrors.rit.eduPackage binutils-2.20.51.0.2-5.44.el6.x86_64 already installed and latest versionPackage 1:make-3.81-23.el6.x86_64 already installed and latest versionPackage 4:perl-5.10.1-141.el6_7.1.x86_64 already installed and latest versionPackage bzip2-1.0.5-7.el6_0.x86_64 already installed and latest versionResolving 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 ResolutionDependencies 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 MInstalling 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 MTransaction Summary================================================================================Install      10 Package(s)Total download size: 32 MInstalled size: 64 MDownloading Packages:--------------------------------------------------------------------------------Total                                           965 kB/s |  32 MB     00:33     Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning 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.isoInstalling Virtualbox Guest Additions 5.1.10 - guest version is unknownVerifying archive integrity... All good.Uncompressing VirtualBox 5.1.10 Guest Additions for Linux...........VirtualBox Guest Additions installerCopying additional installer modules ...Installing additional modules ...vboxadd.sh: Building Guest Additions kernel modules.

I am wondering if I can just modify the VM manually or via kickstart before the vagrant package command to install these packages, and thus, would negate the need to be online.

Any ideas on how to mitigate this issue of requiring the vagrant-vbguest plugin and needing to be online just to bring up a Vagrant box?

By the way, I used the CentOS 6.8 minimal ISO to bootstrap creating the base box. I don't know if using the full blown CentOS 6.8 ISO instead would mitigate this problem. Please let me know if there's a difference. The original article created the base box with the full blown CentOS 6.5 ISO; I've yet to experiment if that makes a difference.

Per the comment, I tried installing the Guest Addon as follows. (This step is after the VM is created with kickstart, and then booting it up again to type in these commands followed by vagrant package and vagrant box add). Note that this DID NOT work, as I got the same message about vboxfs not being available.

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

最佳答案

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

使用 kickstart 设置 CentOS 虚拟机后,在 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版本。

从“设备 > 插入访客添加 CD 镜像”菜单中,确保将此 ISO 插入到 CDROM(VM)中。

然后,安装 CDROM。在 CentOS 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

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

关于centos - 如何在不需要 vagrant-vbquest 插件的情况下创建 Vagrant 基础框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42297738/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com