VirtualBox 安装完 CentOS 后无法调节分辨率,需要安装额外的工具。
0x02:安装依赖包
首先确保虚拟机能正常连接网络,然后安装:kernel、kernel-core、kernel-modules、kernel-devel、gcc、make、perl、elfutils-libelf-devel:
代码语言:javascript复制yum install kernel kernel-core kernel-modules kernel-devel
gcc make perl elfutils-libelf-devel
检查kernel源码是否与内核版本是否一致:
代码语言:javascript复制ls /usr/src/kernels
uname -r
不一致是正常的:
因为此时需要重启选择新的内核版本:
然后再次检查:
0x03: 下载增强工具
检查正确之后,下载对应版本的 VirtualBox 的增强工具镜像。
代码语言:javascript复制https://download.virtualbox.org/virtualbox/
0x04:安装
下载完成后挂载,点击菜单栏中的Devices下的Insert Guest Additions CD Images,然后会提示如下:
另外,可以使用如下命令安装
代码语言:javascript复制mkdir /mnt/cdrom
monut /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
./VBoxLinuxAdditions.run
运行即可,出现下图输出则表示成功(如果失败请根据日志文件(/var/log/vboxadd-setup.log)定位问题并自行解决):
代码语言:javascript复制Verifying archive integrity... All good.
Uncompressing VirtualBox 6.1.18 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 6.1.18 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel
modules. This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Building the modules for kernel
3.10.0-1160.24.1.el7.x86_64.
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
Press Return to close this window...
然后就可以自由调节分辨率了。
另外,共享剪贴板和拖放,可以在下图设置。