Quantcast
Channel: Matthew Hodgkins Blog » vm whs2011
Viewing all articles
Browse latest Browse all 2

How to run VirtualBox on WHS 2011 – Part 2 of 2

$
0
0

If you have been following on from Part 1 in this series, I covered installing VirtualBox and how to manage VirtuaBox using the phpVirtualBox web interface. Hopefully you already have VirtualBox installed and running nicely on your Windows Home Server, and have a Virtual Machine or two.

All that’s left is to add the a few finishing touches too our configuration and we will have a great Virtual Machine hosting platform on top of Windows Home Server.

Automatically Start and Stop Virtual Machines on Boot-Up and Shutdown

On the rare occasion that you need to reboot your Windows Home Server, you want your Virtual Machines to be shutdown or paused and resumed when your server starts back up. Out of the box, VirtualBox doesn’t have this feature, but VBoxVMService can be configured to do this for us.

To perform these steps you are required to already have a Virtual Machine running on your system. The steps will need to be carried out for each Virtual Machine you want automatically stopped and started, so you will need to do this each time you add a Virtual Machine.

  • Browse to C:\Apps\VBoxVMService and open VBoxVmService.ini
  • Add the following lines to the end of the file, updating where necessary for your setup
    # [Vm0] is the number of the virtual machine you want to start. Increment this for each new additional virtual machine you add.
    [Vm0]
    # VmName is the name of the virtual machine you want to start. This is case sensitive.
    VmName=VirtualMachineName
    # ShutdownMethod can either be savestate (recommended) or acpipowerbutton
    ShutdownMethod=savestate
    AutoStart=yes
  • To test if your configuration change worked easily:
    • Open something in your Virtual Machine, like an Explorer window or a Task Manager
    • On the WHS, from the Start Menu | Open Services | Click on the VBoxVMService and click Stop
    • Ensure you can no longer connect to your Virtual Machine (it’s just been put into a saved state)
    • In Services | Click on the VBoxVMService and click Start
    • Try and connect to your Virtual Machine again – upon reconnect you should have whatever you left open still there which means your Virtual Machine was saved and resumed successfully

Using Windows Accounts to Access the VirtualBox Web Interface

Instead of using just another username and password you need to remember to access the phpVirtualBox web interface, you can use Windows Home Server user accounts. This involves making a settings change in IIS to enable user account authentication, and disabling the password prompt in the phpVirtualBox configuration.

  • From the Start Menu | Open Internet Information Services (IIS) Manager
  • In the left navigation pane expand Your Server Name | Sites | Default Web Site and click on the VM virtual directory we created in Part 1 | In the right hand pane open Authentication

Figure - Modify Authentication Properties of the VM Virtual Directory

  • In the Authentication screen select Anonymous Authentication and click Disabled in the action pane on the right | select Basic Authentication and click Enabled in the action pane on the right

Figure - Disable Anonymous Authentication and Enable Basic

  • Now IIS has been configured, open C:\Apps\phpvirtualbox\config.php and uncomment (remove the # in-front) and update this line.
    // Disable authentication
    var $noAuth = true;
  • We also need to set some permissions on the C:\Windows\Temp folder, otherwise phpVirtualBox complains after the authentication change
    • Browse to C:\Windows | Right click on the Temp folder | Choose Properties
    • Click the Security tab and click Edit
    • In the Permissions for Temp screen click Add and enter the name Authenticated Users
    • After the account has been added put a tick in the Modify permissions box

Figure - Give Authenticated Users Modify Permissions

After you save the configuration file, browse to https://yourname.homeserver.com/vm and you will be given a password dialog box. Enter your WHS username and password and you will be logged onto the phpVirtualBox interface.

Remote Desktop Virtual Machine Access Over the Web

One of the great features of VirtualBox is the remote desktop access to the Virtual Machines using the Microsoft Remote Desktop Protocol. phpVirtualBox utilizes this to allow us to remotely manage our virtual machines using the web interface.

We need to configure phpVirtualBox’s host name setting to allow us to access the virtual machines using the yourname.homeserver.com domain.

  • Open C:\Apps\phpvirtualbox\config.php in notepad
  • Uncomment the following line and enter in your home server domain name
    var $consoleHost = 'yourname.homeserver.com';

The tasks below will need to be performed for each new virtual machine that is created.

Figure - Select a Virtual Machine and edit its settings

  • Select the Display menu item | Choose the Remote Display tab
  • Tick Enable Server and enter a Server Port (make sure you choose an unused port number) | For Authentication Method choose External | Press OK

Figure - Enable remote display and choose a port number and external authentication

  • We need to add a VirtualBox service as an exception in the Windows Firewall on the Windows Home Server to allow the remote desktop connection
    • On your WHS open the Start menu and enter Windows Firewall with Advanced Security in the search box | Open Windows Firewall with Advanced Security
    • Select Inbound Rules on the left | Click New Rule on the right
    • Select Program | Click Next
    • Select This program path | Click Browse and choose C:\Program Files\Oracle\VirtualBox\VBoxHeadless.exe

    Figure - Add a firewall rule for VBoxHeadless.exe 

    • Select Allow the connection | Click Next
    • Leave Domain, Private and Public ticked | Click Next
    • Enter the name VirtualBoxHeadless | Click Finish
  • A port forward in your router also needs to be created to allow a connection from the internet into the remote desktop session. This step is dependent on what type of router you have, but here is my port forwarding rule for reference

Figure - Make a port foward in your router to the Server Port entered earlier

  • Back in the VirtualBox web interface we can now click on the Console button at the top right hand side of the window when you select a virtual machine
  • You will be presented with a username and password box | Enter the username Administrator and the Administrator password for your WHS. (Note: The reason we need to use the Administrator account is because it is the one running the VirtualBox services)

Figure - Enter your WHS Administrator username and password 

  • You can now manage your virtual machine via remote desktop over the web!

Figure - Remotely managing a virtual machine over the web 

Just a quick note about security. We enabled External authentication for remote desktop in step 3 to prevent people being able to connect to the virtual machines using the Remote Desktop client in the event someone stumbles upon the ports that have been forwarded to allow the remote desktop access. This extra authentication ensures no one can jump onto any of the virtual machines without knowing the Administrator password.

Hopefully you have enjoyed this series on getting VirtualBox running on Windows Home Server 2011 with all the trimmings!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images