/ centos

vagrant centos升级内核版本、升级VBoxGuestAdditions版本

在vagrant的centos中,如果直接执行yum install kernel-devel,会提示”No matches found for: kernel-devel”,仔细观察了一下yum的输出,发现加载了一个versionlock的插件,于是猜测与这个插件有关,禁用了内核版本的更新,所以把这个插件禁用掉即可。

编辑/etc/yum/pluginconf.d/versionlock.conf文件,将enable的值改成0。然后再执行yum update kernel就可以将内核更新到最新版本。

但是这个时候如果重启了vagrant虚拟机,会发现vagrant报错

Failed to mount folders in Linux guest. This is usually because
the “vboxsf” file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly.

搜索了下,发现可以通过执行/etc/init.d/vboxadd setup重新安装VBoxGuestAdditions来解决。

===============================================

但是centos自带的VBoxGuestAdditions版本比较低,在启动vagrant的时候也会提示

The guest additions on this VM do not match the installed version of VirtualBox! In most cases this is fine, but in rare cases it can prevent things such as shared folders from working properly. If you see shared folder errors, please make sure the guest additions within the virtual machine match the version of VirtualBox you have installed on your host and reload your VM.

所以可以更新一下VBoxGuestAdditions版本。访问http://download.virtualbox.org/virtualbox/,找到你当前virtualbox版本的目录,进去之后可以找到对应版本的VBoxGuestAdditions的iso文件,将这个iso文件下载到vagrant虚拟机中,然后执行以下命令:

mount VBoxGuestAdditions_5.0.10.iso -o loop /mnt cd /mnt/ sh VBoxLinuxAdditions.run --nox11

执行完毕之后退出虚拟机,再次执行vagrant reload即可

vagrant centos升级内核版本、升级VBoxGuestAdditions版本
Share this