Quick way to setup VirtualBox VM in multi user environment
Let’s assume that we need to setup VirtualBox VM with Windows XP and an old version of Microsoft Office. The machine must be used from everyone on a given number of Linux workstations. The workstations may work with LDAP and NFS/Cifs. The standard installation of the VM would be extremely space consuming and it would cost a lot of the personal life of the administrator.
I made an easy hack to solve this ( this is real setup in university labs).
Let’s install a standard local Windows XP virtual machine and permanently mount the local directories /home/trendafil and /media .
In this example, the home directory of the user will be mounted on X:\ on Windows and media will be Z:\ .
The important directories are out of the VM. So, the virtual machine will be runned from snapshot on every boot.
The next useful step is to move the default user profile outside the VM. I don’t need something different than My Documents but in other cases, everything from the profile can be exported to /home, outside the VM. So, open “regedit” in Windows and go to the
and change the key “My Documents” to X:\
Turn off the VM and create an empty snapshot
Next, move the VM from ~/VirtualBox VMs to ~/.config/VirtualBox if it’s the official VirtualBox edition or ~/.VirtualBox for the open source edition from the Ubuntu repositories.
Open the file ~/.config/VirtualBox/VirtualBox.xml and clean it from the needless stuff:
Change the location of the VM and replace your username with “CURRENTUSR“ everywhere inside the file, like this:
Also, replace the username the same way in “~/.VirtualBox/WinXP/WinXP.xml”
Change the location of the harddisk image to /var/vbox/ like this:
Create the directory /var/vbox/ and then move the harddisk image from ~/.VirtualBox/WinXp/winxp.vmdk to /var/vbox .
Then, move the whole ~/.VirtualBox or ~/.config/VirtualBox to /var/vbox
Install Zenity if it’s not installed:
Download this file and put it on /usr/local/bin/startwin:
and make it executable:
It should work now. Every user of the system can start the VM from the script.
Additionaly, you can create a desktop enry.
First, find an ugly Window$ logo with an open license and put it on /usr/share/icons/win.png. Then, create the file /usr/share/applications/startwin.desktop with this content: