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:
- Install Linux Server
- I installed with a KVM kernel if that will help anyone 😉
- Make sure all your initial networking settings are correct, and you can connect to the internet
- Install VirtualBox from Oracle
- 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
- 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
- To add the Oracle maintained repository:
sudo sh -c "echo 'deb http://download.virtualbox.org/virtualbox/debian '$(lsb_release -cs)' contrib non-free' > /etc/apt/sources.list.d/virtualbox.list" && wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add - && sudo apt-get update && sudo apt-get install virtualbox-4.1 dkms
- Install the following pre-reqs:
- Once VirtualBox is installed you will need to install the extensions as well which you can do from the desktop
- 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
- 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
- Now that you’ve got VB installed with the extensions, it’s time to create our machine.
- If you do not have the manager fired up do so now
- Click ‘New’
- Type in a name, select ‘Microsoft Windows’ find your version in the ‘Version’ drop down and hit ‘Next’
- Select a memory size, personally I’d go for at least 4G or 4096MB then hit ‘Next’
- 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’
- For performance reasons, select ‘Fixed Size’ then hit ‘Next’
- 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
- 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’
- Under ‘System’ make sure ‘PIIX3’ chipset is selected, ‘Enable IO APIC’ is checked off in the ‘Motherboard’ tab.
- Click the ‘Processor’ tab and select at least 2 processors.
- Make sure the ‘Hardware Virtualization’ checkboxes are checked under the ‘Acceleration’ tab
- 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
- ‘Storage’ in the “empty” controller, select the icon next to the ‘CD/DVD Drive’ drop-down and select your Windows 2008 install disk
- NOW FIRE IT UP!
- Now, with all windows installs this is going to take awhile, so you might as well get some grocery shopping done ;0)
- 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.
- First, make sure you are using the PCNet Ethernet for the virtual machine.Next modify your networking:
# 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 192.168.2.98 #<- Change this to the internal IP address of your Ubuntu box netmask 255.255.255.0 network 192.168.2.0 #<- Change this to the internal network broadcast 192.168.2.255 #<- Change this to the internal IP address of your Windows VM gateway 192.168.2.1 #<- 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