只需要几行命令即可在centos7上安装virtualbox-5.2。

( cd /etc/yum.repos.d;wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo )
yum --enablerepo=epel install -y dkms
yum groupinstall -y "Development Tools" 
yum install -y kernel-devel
yum install -y VirtualBox-5.2
wget -c http://download.virtualbox.org/virtualbox/5.2.32/Oracle_VM_VirtualBox_Extension_Pack-5.2.32.vbox-extpack
vboxmanage extpack install ./Oracle_VM_VirtualBox_Extension_Pack-5.2.32.vbox-extpack

参考链接:https://wiki.centos.org/zh/HowTos/Virtualization/VirtualBox