Setting up a Windows 2008 R2 Virtual Machine on Ubuntu Server

Setting up a Windows 2008 R2 Virtual Machine on Ubuntu Server

Posted:  March 10, 2013

Setting up a Windows 2008 R2 Virtual Machine on Ubuntu Server

Well kiddies time for another installment into my mind. 🙂 Today I am going to tell you how I managed to install Windows 2008 R2 Server on a virtual machine on my Ubuntu Server.  Being a developer jack-of-all-trades I needed to have a very stable environment for some of the sites I develop, but still allow myself to develop for Microsoft.

Yes, I went the ways of Linux…  infinately more stable as a server environment than windows is 😉

You too can still have and develop for windows even if you have a Linux box.  It’s not that hard to do, but it’s also not that easy, there were times when I was ready to throw my machines to the wind.

Here’s how I did it… please note, this is NOT the method for every flavor of Linux, remember… I run Ubuntu Server.  However, some of the these instructions will be similar across the board.

So… here we go:

  1. Install Linux Server
    1. I installed with a KVM kernel if that will help anyone 😉
  2. Make sure all your initial networking settings are correct, and you can connect to the internet
  3. Install VirtualBox from Oracle
    1. Install the following pre-reqs:
      apt-get install bcc iasl xsltproc xalan libxalan110-dev uuid-dev zlib1g-dev libidl-dev libsdl1.2-dev libxcursor-dev libqt3-headers libqt3-mt-dev libasound2-dev libstdc++5 linux-headers-`uname -r` build-essential
    2. I used the install from Oracle so I had to add the Oracle repository for it, but Ubuntu has a package called virtualbox-ose, and you can install it by simply doing:
      apt-get update && apt-get install virtualbox-ose
    3. To add the Oracle maintained repository:
      sudo sh -c "echo 'deb '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" && wget -q -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-4.1 dkms
  4. Once VirtualBox is installed you will need to install the extensions as well which you can do from the desktop
    1. Speaking of… I found I needed su access to run it, so get into your Ubuntu desktop and fire up Terminal.  Once there, type in sudo -s then your password, then VirtualBox to fire up the manager
    2. To install the extensions, simply for to Preference/Settings and click on Extensions.  Then click the “Add Package” icon on the right, and browse to find your downloaded extension pack to install it
  5. Now that you’ve got VB installed with the extensions, it’s time to create our machine.
  6. If you do not have the manager fired up do so now
    1. Click ‘New’
    2. Type in a name, select ‘Microsoft Windows’ find your version in the ‘Version’ drop down and hit ‘Next’
    3. Select a memory size, personally I’d go for at least 4G or 4096MB then hit ‘Next’
    4. Create a new hard drive for this machine, then hit ‘Next’, you can pretty much pick the type you want… whatever your preference makes no difference.  I personally use VHD, so select it and hit ‘Next’
    5. For performance reasons, select ‘Fixed Size’ then hit ‘Next’
    6. Select a location for this new drive, and select your size…  I’d go at least 25GB, but you may want more if you plan on installing things like IIS and MS SQL, etc… once you select this size hit ‘Create’.   Depending on your machine, and the size of the drive this may take a while to complete
    7. Once it is finished creating the drive you the window should close and you should now see your new machine in the list.  Click it, then hit ‘Settings’
    8. Under ‘System’ make sure ‘PIIX3’ chipset is selected, ‘Enable IO APIC’ is checked off in the ‘Motherboard’ tab.
    9. Click the ‘Processor’ tab and select at least 2 processors.
    10. Make sure the ‘Hardware Virtualization’ checkboxes are checked under the ‘Acceleration’ tab
    11. If you plan on RDP’ing into this machine you should make sure that the ‘Video Memory’ under the ‘Display’ is set high enough.  64M should do the trick
    12. ‘Storage’ in the “empty” controller, select the icon next to the ‘CD/DVD Drive’ drop-down and select your Windows 2008 install disk
    13. NOW FIRE IT UP!
  7. Now, with all windows installs this is going to take awhile, so you might as well get some grocery shopping done ;0)
  8. Once windows is installed on your vm, you can now configure your Ubuntu networking to bridge your networking to the VM to allow traffic from the outside through to it.
  9. First, make sure you are using the PCNet Ethernet for the virtual machine.Next modify your networking:
    nano /etc/network/interfaces
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    # The loopback network interface
    auto lo
    iface lo inet loopback
    # The primary network interface
    auto br0
    iface br0 inet static
    address #<- Change this to the internal IP address of your Ubuntu box
    network #<- Change this to the internal network
    broadcast #<- Change this to the internal IP address of your Windows VM
    gateway #<- Change this to your gateway
    bridge_ports eth0
    bridge_stp off
    bridge_maxwait 5

    You will then need to make sure that your networking in Windows is configured to static, and then you will need to Configure Windows Firewall to allow the connnections through to it, as well as configure your router for forward the ports you need forwarded to the VM

Kevin Pirnie

20+ Years of PC and server maintenance & over 15+ years of web development/design experience; you can rest assured that I take every measure possible to ensure your computers are running to their peak potentials. I treat them as if they were mine, and I am quite a stickler about keeping my machines up to date and optimized to run as well as they can.