在线安装
vi /etc/yum.repos.d/virtualbox.repo,复制后将下面内容编辑保存。
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox_2016.asc
安装virtualbox
yum install -y VirtualBox-7.0
查看状态VirtualBox启动状态
systemctl status vboxdrv.service
桌面版界面进行验证
离线安装
拷贝离线安装包
执行脚本进行安装
# 离线安装
rpm -Uvh --force --nodeps *.rpm
#查看状态
systemctl status vboxdrv.service
在线一键安装脚本
cd /etc/yum.repos.d
rm -rf virtualbox.repo
touch virtualbox.repo
cat > virtualbox.repo << EOF
[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch - VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://www.virtualbox.org/download/oracle_vbox_2016.asc
EOF
yum install -y VirtualBox-7.0
systemctl status vboxdrv.service