Install Debian 10.x – Openmediavault 5.X – Virtualbox 6.X - PHPVirtualbox
This is walktrough for installing OMV5 in combination with Virtualbox 6. When using OMV-Extras you have the possibility to use Cockpit for your Virtual Machines.
After working with Virtualbox for the last 5 years I find that Cocpit lacks the features that Virtualbox has.
I'm fairly new to Linux so use this at own risk. I find that everything is just running fine!
I did the installation as root, so i didn't ran into any permission problems.
Install debian 10.1 including SSH
Network config: (set static ip in interfaces - This is later adopted by OMV)
nano /etc/network/interfaces
----------example-------------
iface enp0s17 inet static
address 192.168.X.X
netmask 255.255.255.0
gateway 192.168.X.X
dns-nameservers 192.168.X.X
----------example-------------
"[CTRL] X Y [Enter]" - Save the file.
SSH permit root login
nano /etc/ssh/sshd_config
PermitRootLogin yes
"[CTRL] X Y [Enter]" - Save the file.
Install OMV5.X
apt-get install build-essential
nano /etc/apt/sources.list.d/openmediavault.list
deb https://packages.openmediavault.org/public usul main
"[CTRL] X Y [Enter]" - Save the file.
export LANG=C
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
wget -O "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc" https://packages.openmediavault.org/public/archive.key
apt-key add "/etc/apt/trusted.gpg.d/openmediavault-archive-keyring.asc"
apt update
apt install postfix openmediavault
omv-confdbadm populate
Login to Openmediavault (admin - openmediavault)
Enable all networkcards in OMV5 (if more than one)
Mount all your disks in OMV5
Install Virtualbox 6.x
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
echo "deb [arch=amd64] http://download.virtualbox.org/virtualbox/debian buster contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
sudo apt update
sudo apt install linux-headers-$(uname -r) dkms
sudo apt install virtualbox-6.1
Install Virtualbox extension pack
cd ~/
wget https://download.virtualbox.org/virtualbox/6.1.0/Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack
sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-6.1.0.vbox-extpack
Create user "vbox" and make this user a member of "vboxusers"
adduser vbox
sudo usermod -aG vboxusers vbox
sudo systemctl status vboxdrv
(see if vboxservices are running - should be "active (exited)")
Install phpvirtualbox
sudo apt-get install php7.3-soap
(next on a client PC/Laptop)
download: https://github.com/phpvirtualb…albox/archive/develop.zip
Extract and rename folder to: "phpvirtualbox"
open config.php-example in folder "phpvirtualbox" with notepad(++)
save file as config.php
copy folder "phpvirtualbox" to /var/www
On the OMV machine:
chown -R 998:996 /var/www/phpvirtualbox
chmod -R 755 /var/www/phpvirtualbox/
sudo nano /etc/default/virtualbox
VBOXWEB_USER=vbox
"[CTRL] X Y [Enter]" - Save the file.
Restart vbox services
sudo systemctl restart vboxdrv
sudo systemctl restart vboxweb-service
Create user "phpvirtualbox-webgui" for NGINX
adduser phpvirtualbox-webgui
(password: phpvirtualbox)
Create configfifle for website "phpvirtualbox-webgui" that runs in NGINX
nano /etc/nginx/sites-available/phpvirtualbox-webgui
"[CTRL] X Y [Enter]" - Save the file.
Create configuration file for "php-fpm"
nano /etc/php/7.3/fpm/pool.d/phpvirtualbox-webgui.conf
"[CTRL] X Y [Enter]" - Save the file.
Activate PHPVirtualbox website
sudo ln -s /etc/nginx/sites-available/phpvirtualbox-webgui /etc/nginx/sites-enabled/
systemctl restart nginx
systemctl restart php7.3-fpm
Check if you can reach phpvirtualbox by entering the following URL: "http://[your-OMV5-server]:8080/" in for instance "Firefox"
The default username and password for phpvirtualbox is admin/admin
Start and Stop VM’s automaticly on boot and shutdown
nano /etc/default/virtualbox
"[CTRL] X Y [Enter]" - Save the file.
nano /etc/vbox/autostart.cfg
"[CTRL] X Y [Enter]" - Save the file.
sudo chgrp vboxusers /etc/vbox
sudo chmod 1775 /etc/vbox
Choose VMs to automatically start and stop
The first time a user configures autostart, the command: VBoxManage setproperty autostartdbpath /etc/vbox needs to be run.
Note: The autostart options are stored in the /etc/vbox file, and the VM itself. If moving the vm, the options may need to be set again.
VBoxManage modifyvm <uuid|vmname> --autostart-enabled <on|off>
You can also: VBoxManage modifyvm <uuid|vmname> --autostop-type <disabled|savestate|poweroff|acpishutdown>
su vbox
VBoxManage setproperty autostartdbpath /etc/vbox
VBoxManage modifyvm [servername 1] --autostart-enabled on
VBoxManage modifyvm [servername 2] --autostart-enabled on --autostart-delay 120
VBoxManage modifyvm [servername 3] --autostart-enabled on --autostart-delay 300
VBoxManage modifyvm [servername 1] --autostop-type savestate
VBoxManage modifyvm [servername 2] --autostop-type savestate
VBoxManage modifyvm [servername 3] --autostop-type savestate
Restart VirtualBox autostart service
su root
sudo service vboxautostart-service restart
Notes:
Virtualbox uses port 9000 to 9100 for VRDP, when you want to use Portainer in OMV you have to change these ports to another range for example 9100-9200. You can find these settings in phpvirtualbox, under settings of the VM, display -> remote display tab.
You can also change the parameter in the config.php of phpvirtualbox to reflect the correct ports:
Tested autoshutdown, now OMV waits until the machines are in "Saved State" before shutting the machine down. This works now. In OMV4 with the OMV-Extra's Virtualbox plugin installed the machines get aborted.
Good luck!!!
Regards, Roru69