centos7 安装VirtualBox

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

yum groupinstall "Development tools"
yum install https://centos7.iuscommunity.org/ius-release.rpm
yum install dkms
yum install kernel-devel
reboot

# 安装centos扩展包
# 地址: https://fedoraproject.org/wiki/EPEL
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

# 下载VirtualBox rpm包
# 地址: https://www.virtualbox.org/wiki/Linux_Downloads
yum install -y VirtualBox-6.1-6.1.4_136177_el7-1.x86_64.rpm
 

# 如果kernel-headers版本不对 则下载和kernel版本一样的版本
# 下载地址: https://linuxsoft.cern.ch/cern/centos/7/updates/x86_64/repoview/kernel-devel.html
yum install -y kernel-devel-3.10.0-957.10.1.el7.x86_64.rpm

# 配置vbox
sudo /sbin/vboxconfig

# 验证安装
VBoxManage --version

参考资料 CentOS官网文档 Installing and using VirtualBox on CentOS CentOS 7: VirtualBox is complaining that the kernel module is not loaded DKMS on CentOS 7