参考
- https://www.jianshu.com/p/7c556c783bb2
- https://www.cnblogs.com/mychangee/p/12087954.html
centos
1.点击设备->安装增加功能->下载增加镜像,底部镜像按钮挂载VBoxGuestAddtions.iso 运行
2.运行后报错,没有安装内核,需要安装内核和gcc 并且保持kernel 和kernel-devel版本一致
yum install -y kernel-devel kernel-headers gcc make
yum -y upgrade kernel kernel-devel
reboot
uname -r //查看当前启动的内核版本
rpm -qa | grep kernel-[0-9] //查看全部的内核
yum remove xxxx //删除旧版本内核
或者可以使用下面两个命令中的一个安装和Linux内核版本匹配的kernel-devel
yum install -y "kernel-devel-uname-r == $(uname -r)"
yum install -y kernel-devel-xxxx
centos 8 报错
https://github.com/geerlingguy/packer-centos-8/issues/4
$ cat /var/log/vboxadd-setup.log
Building the main Guest Additions 6.0.12 module for kernel 4.18.0-80.7.1.el8_0.x86_64.
Error building the module. Build output follows.
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/4.18.0-80.7.1.el8_0.x86_64/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j1 modules
Makefile:958: *** "Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel or elfutils-libelf-devel". Stop.
make: *** [/tmp/vbox.0/Makefile-footer.gmk:111: vboxguest] Error 2
Could not find the X.Org or XFree86 Window System, skipping.
modprobe vboxguest failed
yum(dnf)install -y elfutils-libelf-devel elfutils-libelf-devel.x86_64
sh VBoxLinuxAdditions.run
ubuntu desktop
#先更新
sudo apt update && sudo apt upgrade
安装增加功能
同 centos 设备 >> 安装增强功能
#根据报错信息安装如下包
sudo apt install gcc make perl
#ubuntu24.04 需要安装bzip2
sudo apt install bzip2
点击挂在的光盘,运行增强程序
共享文件夹
挂载点要设置到登录用户的家目录/home/xxx/dirname 下,会自动创建文件夹,使用chmod和chown 修改权限无效
使用如下命令手动挂载方式,可以更改权限目录
sudo mount -t vboxsf downloads /home/www/share
ubuntu server