mac下virtualbox中centos6.5虚拟机实现全屏和调整分辨率

时间:2023-03-08 17:54:00

在visualbox里安装好centos后,发现不能分辨率与原屏幕不一致,很多解决方法是:安装增强包。可是安装增强包后依然达不到效果。

究其原因,原来因为没有安装显卡驱动导致安装了增强包后无法实现分辨率自动调整。
注:所有的安装必须拥有root权限。

1、安装编译所需的依赖包

yum groupinstall "Development Tools"

2、安装内核开发包

yum install kernel-devel
yum install kernel-headers

3.

1)增加新的公钥。

rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org

2)安装yum-plugin-fastestmirror。

rpm -Uvh http://www.elrepo.org/elrepo-release-6-6.el6.elrepo.noarch.rpm
yum -y install yum-plugin-fastestmirror

3)安装显卡驱动。

yum -y install kmod-fglrx

4、安装VirtualBox增强包

在visualbox工具栏上,设备->安装增强功能,会发现多了VBOXADDITIONS_5.0.24_108355

cd /media/VBOXADDITIONS_5.0.24_108355/
./VBoxLinuxAdditions.run

此时在输出信息中,有一处失败了:

Building the main Guest Additions module                   [失败]
(Look at /var/log/vboxadd-install.log to find out what went wrong)

根据提示查看/var/log/vboxadd-install.log文件会有下面的错误:

 Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again。 停止。Creating user for the Guest Additions.Creating udev rule for the Guest Additions kernel module.

通过上面的提示我们可以知道错误的原因是没有内核原文件,于是我检查了一遍:

yum install gcc   从软件仓库下载gcc,然后安装,这个是编译器
yum install make 安装make,这个是自动编译源码的工具,写好makefile就可以方便编译
yum install kernel-headers 安装内核,编译内核,驱动必要的
yum install kernel-devel 同上

发现都已经安装过且是最新版本,然后果断reboot虚拟机,启动时系统会自动从新的内核文件选项启动。不要改回到原来的选项默认就好(回到原来的选项还会出现上面的错误)。重新安装增强程序问题就可以解决。

mac下virtualbox中centos6.5虚拟机实现全屏和调整分辨率