CentOS下安装VirtualBox

时间:2022-09-22 15:15:45

VirtualBox在Ubtubu下的使用和Window下一样简单,下载安装包,安装运行即可.
但在CentOS下需要折腾一下

======1 下载相应的repo包:
官网找到Centos7相应的repo文件
https://www.virtualbox.org/wiki/Linux_Downloads
https://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo
复制到“/etc/yum.repos.d/”目录下

======2 更新并搜索yum里的版本
yum update
yum clean all
yum makecache 更新缓存
yum search VirtualBox 找到最新的文件名:VirtualBox-5.2.x86_64

======3 安装
yum install VirtualBox-5.2

======4 打开运行
打开VirtualBox正常,建立虚拟机打开虚拟机报错如下:
------------------------------
Kernel driver not installed (rc=-1908)
The VirtualBox Linux kernel driver (vboxdrv) is either not loaded or there is a permission problem with /dev/vboxdrv. Please reinstall the kernel module by executing
'/sbin/vboxconfig'
as root.
where: suplibOsInit what: 3 VERR_VM_DRIVER_NOT_INSTALLED (-1908) - The support driver is not installed. On linux, open returned ENOENT.
-----------------------------

======5 按提示运行:/sbin/vboxconfig,安装内核
按提示检查内核并安装
rpm -qa |grep kernel
yum install kernel-devel
yum install kernel-headers
rpm -qa gcc
rpm -qa make
rpm -qa perl
yum install gcc
再次运行/sbin/vboxconfig
[root@MiWiFi-R3-srv tom]# /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
[root@MiWiFi-R3-srv tom]#
好了。

======补充,若使用Vbox建立虚拟机时,只能建立32位的系统,没有64位系统的选项.

只需要在Bios下打开虚拟化即可.

比如:HP6520s笔记本的虚拟化

开机F10进入BIOS;找到Virtualization设为Enable即可.

System Configuration \ Device Configurations \ Virtualization Technology = Enable