Install VirtualBox legacy version 5.x on CentOS 7 Rumi, June 11, 2022 Install Dependencies Install Extra Packages for Enterprise Linux (EPEL) # sudo yum install epel-release wget -y Install Dynamic Kernel Module Support (DKMS) # sudo yum --enablerepo=epel install dkms -y This will install quite a few packages: Install Development Tools # sudo yum groupinstall "Development Tools" -y Install Kernel Development # sudo yum install kernel-devel -y Install VirtualBox by adding the VirtualBox package repository # cd /etc/yum.repos.d # sudo wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo Install VirtualBox # sudo yum install VirtualBox-5.0 -y This will also install a number of dependencies. Install VirtualBox Extension Pack The VirtualBox Extension Pack will add support for the following: USB 2.0 and USB 3.0 Host Controller Host Webcam VirtualBox RDP PXE ROM Disk Encryption NVMe Download the extension pack: # sudo wget http://download.virtualbox.org/virtualbox/5.2.6/Oracle_VM_VirtualBox_Extension_Pack-5.2.6-120293.vbox-extpack Once downloaded, install the extension pack: # sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.6-120293.vbox-extpack OR, if you are upgrading from a previous version of the extension pack, then you will need to add the ‘–replace’ option to uninstall the old version first. # sudo VBoxManage extpack install --replace Oracle_VM_VirtualBox_Extension_Pack-5.2.6-120293.vbox-extpack Agree to the license terms and conditions. Do you agree to these license terms and conditions (y/n)? y The extension will be installed. Verify that the extension pack has been installed successfully. # sudo VBoxManage list extpacks You should see output like the following: Add Users to ‘vboxusers’ Group When VirtualBox is installed a new group ‘vboxusers’ is created. Users that are a member of this group will be allowed to run VirtualBox. I will add my non-privileged user to this group. adduser vbox passwd vbox # sudo usermod -a -G vboxusers vbox Create the file /etc/default/virtualbox and put the line VBOXWEB_USER=vbox Check that the vboxdrv service has installed correctly and is running. # sudo systemctl status vboxdrv You should see output like the following: The status should be ‘loaded‘ and ‘active‘. If you see a ‘Kernel driver not installed‘ message then try running the following command: sudo /usr/lib/virtualbox/vboxdrv.sh setup VirtualBox Web Service (vboxweb) Check that the vboxweb service is running: # sudo systemctl status vboxweb-service You should see output like the following: Exclusive Hardware Virtualization VirtualBox will be given exclusive use of the hardware virtualization extensions (Intel VT-x or AMD-V). I think this defaults to on but let’s set it anyway. # VBoxManage setproperty hwvirtexclusive on Default Front End I am not running a GUI on this server so all virtual machines will be running in headless mode. # VBoxManage setproperty defaultfrontend headless Install PHPVirtualbox: Start with installing LAMP Stack yum install httpd If you have firewalld running use the firewall policy update: # firewall-cmd --permanent --add-service=http # systemctl restart firewalld# firewall-cmd --state # firewall-cmd --list-all # firewall-cmd --list-interfaces # firewall-cmd --get-service # firewall-cmd --query-service service_name # firewall-cmd --add-port=8080/tcp Install PHP (default 5.4 on a CentOS 7 is fine to run phpvirtualbox) # yum install php php-mysql php-pdo php-gd php-mbstring php-soap php-xml Now test PHP installation is working properly- # echo "<?php phpinfo(); ?>" > /var/www/html/info.php # systemctl restart httpd Now open browser and type http://<ip>/info.php Download and Install PHPVirtualbox: In my case, I’m downloading version 5.0-5 cd /tmp wget https://github.com/phpvirtualbox/phpvirtualbox/archive/refs/tags/5.0-5.zip unzip 5.0-5.zip After that mv the unzipped folder to /var/www/html/<phpvirtualbox> cd /var/www/html/<phpvirtualbox> cp config.php-sample config.php nano config.php update the user and password of vbox. uncomment the console IP Now point your browser to- http://<ip>/<phpvirtualbox> Src: https://github.com/phpvirtualbox/phpvirtualbox/releases CentOS running VirtualBox (headless mode) Install Virtualbox 5.2/6.1 on Ubuntu 16 headless mode https://www.tecmint.com/install-lamp-in-centos-7/ Administrations Virtualbox Virtualization CentOSCentOS 7virtualbox