===== VirtualBox (1.3) ===== As we intend to deploy some complementary services in the form of Virtual Machines (like OpenLDAP) running as guests on our OMV host platform, we'll set up the **VirtualBox plugin** and create a **Debian 7 VM Template**. ===== Plugin ===== System > OMV-Extras.org > Virtualbox (activate repository > Save > Apply)\\ System > Plugin > openmediavault-virtualbox 1.3 (check + Install) This will install virtualbox-4.3 (4.3.28-100309~Debian~wheezy_amd64) __Services > VirtualBox__ Directory: VM-Storage [on Storage/OMV, VirtualBox/VMs] Access the PhpVirtualBox at **[[http://192.168.1.34/virtualbox/]]** In case one needs to modify phpvirualbox configs, edit: //**/usr/share/phpvirtualbox/config.php**// \\ AT LEAST set $username and $password for security! ===== VMs ===== We need a place to store the .iso files we'll use for various VMs: > mkdir -p /Storage/OMV/VirtualBox/ISOs > chmod -R 777 /Storage/OMV/VirtualBox/ISOs ==== Debian 7 Template ==== We'll base this on [[vms:debian|the wiki page describing the base Debian template setup]], but using a **Debian 7.9 (wheezy)** install for compatibility with the OMV base kernel. The following will only cover **what differs from the reference Debian template setup**. The [[https://www.debian.org/releases/wheezy/debian-installer/index.en.html|Debian Wheezy installation page]] currently refers the following [[http://cdimage.debian.org/cdimage/archive/7.9.0/amd64/iso-cd/debian-7.9.0-amd64-netinst.iso|link to its "netinst.iso" image]] that we'll use for our template VM. So we ssh to our OMV system and: > cd /Storage/OMV/VirtualBox/ISOs > wget http://cdimage.debian.org/cdimage/archive/7.9.0/amd64/iso-cd/debian-7.9.0-amd64-netinst.iso Now to the [[http://192.168.1.34/virtualbox/]]: * File > Preferences > Network > NAT Networks * Add NAT Network (1st right icon) * Select NatNetwork1 > Edit (3rd right icon) * Check: Enable * Name: N54L-VB-NAT * CIDR: 10.10.2.0/24 * Support DHCP * Host-only Networks * Add host-only network (1st right icon) * Select vboxnet0 > Edit (3rd right icon) * **Adapter** * IPv4 Address: 172.30.30.1 * IPv4 Network Mask: 255.255.255.0 * **DHCP Server** * Disabled === New VM === * Name: Debian-7.9-Wheezy * Type: Linux * Version: Debian (64 bit) * 512MB * Create virtual HD: * VDI * Dynamic * 8GB * Location: /Storage/OMV/VirtualBox/VMs/Debian-7.9-Wheezy CONFIGURE NETWORKS (2 adapters NAT + vboxnet0)\\ ATTACH DEBIAN NETINST ISO\\ PROCEED TO DEBIAN INSTALLATION... === Set VM's static IP (vboxnet0) === For a general comprehension of **Network Options in VirtualBox** you can read [[http://catlingmindswipe.blogspot.be/2012/06/how-to-virtualbox-networking-part-two.html|this article]] that clears things up a little bit. To allow access from our OMV host to our VMs, we'll set a static IP for our template; THIS WILL HAVE TO BE UPDATED FOR EACH CLONE. What we experimented with the Oracle RDP Web Control (PhpVirtualBox Console) is that it was NOT POSSIBLE TO SEND the "Ctrl" CHARACTER, nor "esc", through the console, making it impossible to edit files this way. Thus we need another way to access the /etc/network/interfaces file. We'll try to **mount the vdi** on our OMV host as summarized [[:vbox:resize-vdi#mount_a_vdi_to_the_host_system|summarized here]], [[http://www.aossama.com/mount-virtualbox-vdi-image-debian/|and described here]]. === Register our OMV rsa key === Once the template is running, from the OMV system (the ~/.ssh/id_rsa.pub file should already exist): > ssh-copy-id root@172.30.30.2 === DNS resolution === Using the NAT Network seems not to let the guest VM access the host's DNS resolver, we need to modify the guest VM as follow. Note that **vboxmanage must be executed as vbox user**! > su vbox > vboxmanage list vm > vboxmanage modifyvm "Debian-7.9-Wheezy" --natdnshostresolver1 on === Clone === We now have a Debian-7.9 template VM that we can clone, from the PhpVirtualBox Web GUI (with the template stopped), as a base for other Debian 7 VMs. On each clone, one will have to specify the VM's: * vboxnet0 IP: **/etc/network/interfaces** * hostname: **/etc/hosts** + **/etc/hostname**