Oracle VirtualBox inside VirtualBox

The goal today is to run Oracle VirtualBox (on Centos 7) inside of Oracle VirtualBox (on Windows 10), and run a Centos 7 server within that application.

On the main host system running Windows 10 I create a 4vCPU, 4GB RAM with 40GB of storage and install Centos 7. This was the easy part.

Next step is to download the Centos 7 RPM from VirtualBox‘s website and install it with all of the dependencies.

$ curl 'https://download.virtualbox.org/virtualbox/6.1.22/VirtualBox-6.1-6.1.22_144080_el7-1.x86_64.rpm' -oVirtualBox-6.1-6.1.22_144080_el7-1.x86_64.rpm
$ sudo yum install gcc make perl kernel-headers kernel-devel-3.10.0-1160.31.1.el7.x86_64
$ yum install VirtualBox-6.1-6.1.22_144080_el7-1.x86_64.rpm

I’ll install Apache/2.4.6 with php/5.4.16 so that I can install phpvirtualbox for administration. For the ease of things i’ll disable C7 firewalld and set selinux to permissive as well.

$ sudo yum install httpd php php-soap
$ sudo systemctl stop firewalld
$ sudo systemctl disable firewalld

I’ll need git to clone down the repo and i’ll just sudo move it all to wherever docroot is

$ sudo yum install git
...
$ httpd -S
VirtualHost configuration:
ServerRoot: "/etc/httpd"
Main DocumentRoot: "/var/www/html"
Main ErrorLog: "/etc/httpd/logs/error_log"
Mutex mpm-accept: using_defaults
Mutex authdigest-opaque: using_defaults
Mutex proxy-balancer-shm: using_defaults
Mutex rewrite-map: using_defaults
Mutex authdigest-client: using_defaults
Mutex proxy: using_defaults
Mutex authn-socache: using_defaults
Mutex default: dir="/run/httpd/" mechanism=default
PidFile: "/run/httpd/httpd.pid"
Define: _RH_HAS_HTTPPROTOCOLOPTIONS
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="apache" id=48 not_used
Group: name="apache" id=48 not_used
$ git clone https://github.com/phpvirtualbox/phpvirtualbox.git
Cloning into 'phpvirtualbox'...
remote: Enumerating objects: 1619, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 1619 (delta 8), reused 20 (delta 7), pack-reused 1589
Receiving objects: 100% (1619/1619), 5.95 MiB | 8.26 MiB/s, done.
Resolving deltas: 100% (766/766), done.
$ sudo mv phpvirtualbox /var/www/html
$ chcon -R -h -t httpd_sys_content_t /var/www/html
$ sudo systemctl enable httpd
$ sudo systemctl start httpd

I’ll need to set up a configuration for this, and the instructions are pretty simple:

$ cd /var/www/html/phpvirtualbox
$ cp config.php-example config.php

And finally I can set up /etc/default/virtualbox and config.php user/password

At this point I should be able to access the user interface by going to http://192.168.1.211/phpvirtualbox, login with admin/admin, and this all looks good to go!

Leave a Reply