As you may know, Windows 8 (the client operating system) includes Hyper-V – the (typically) server-based virtual machine management software. That means on your Windows 8 workstation, you can now leverage the benefits of Hyper-V over Microsoft Virtual PC, VMWare, or Virtual Box.
You can create and manage virtual machines on your local machine – but also have tool that’s arguably better than Virtual PC, VMWare, or VirtualBox.
To install it, in Windows 8, hit WindowsKey+X, then Programs and Features:
then, click “Turn windows features on and off”:
Then just check Hyper-V and click OK:
When it’s done installing, I had to reboot.
Now, if you haven’t used Hyper-V before, there is one thing that may be new to you. you have to create virtual network card first, before your virtual machines can access the network. It’s easy enough to do.
To open the Hyper-V Manager, hit WindowsKey – then type “hyper-v” and it will show up in the list. To set up the virtual network (before you create any VM’s), simply open up the Virtual Switch manager within Hyper-V:
It explains on that screen the difference between private, internal, and external. In short, if you want the VM to access the Internet, the simple answer is to create an External network switch.
Wired vs Wireless:
I wasted several hours on this over the weekend, so hopefully this saves you some time. For some reason, a wireless network card is not seen as the same as a hard-wired network card. I initially set up everything over wireless, and ran into some troubles. Ultimately, I ended up setting up two network switches, one for wired and one for wireless (same setttings for both):
Why this took so long to troubleshoot, is because SOME things worked fine! I created a Windows 7 and Windows Server 2008 R2 virtual machine, bound to this WiFi network switch and they worked fine. When I set up an Ubuntu instance, which is supposed to support Hyper-V out-of-the-box, it reported “device not ready” when that VM was bound to the wireless card. When I created a Windows XP VM, that just had very weird, very flaky network when I used wireless.
When I hooked up a network cable and ran these instances bound to the non-wireless network card, then everything worked as expected.
There is a third option too. I found this blog post which describes how use a wireless card with Hyper-V. You can read about it in detail, but the short version is you create an “Internal” switch in Hyper-V, then in your host operating system, go into your WiFi card properties, turn on internet sharing and share with this new virtual card. I just do that, because that works for all operating systems I installed in Hyper-V.
Also, if your virtual operating system doesn’t recognize/detect the kind of network card that Hyper-V offers – I found this post that answers that. Hyper-V offer a network card that should be compatible with a DEC 21140 10/100 network card. So, if your OS doesn’t recognize the card and you have the option to explicit choose the driver, this may help.
What’s the point?
For me, the point of all of this is that you can have multiple, isolated environments set up on one machine. In my case, I can play around with Ubuntu Linux, have Windows Server running SQL Server, or sandbox a Win7 or Win8 environment to test out new software. Hyper-V is really full-featured too – it easily supports the idea of “snapshots” as well. This is the idea that you can take a snapshot of this virtual machine at a particular point in time. you can revert back to this snapshot later on! It’s a very simple backup/restore for the virtual machine – but works great.
When I work with Windows operating systems, I will run Windows Update to get them patched (and get Security Essentials installed), then I activate it, do a reboot – check again for updates. If everything is up to date, I shut down and make a snapshot – I typically call it “Baseline – Patched and Activated”. So now, as I install software or experiment with settings, I can always EASILY revert back to that state. In other words, if I right-click on that snapshot and choose “Apply”, it brings that virtual machine back to that state – almost like going back in time. This means that you can easily use and re-use the same machine over and over for testing – and not have to waste time installing and re-installing the OS and re-activating the license. You can do this once, and then simply revert back to that state.
You can also make a copy of that activated/patched instance and bring up a second machine that also starts from that point too – that too can have it’s own snapshots. This is all very easy to do and very powerful for you be able to have all these complete environments at your fingertips!
This is a very powerful tool for developers (or systems managers) to be able to have easily managed sandbox areas of real operating systems. Plus, to be able to do this all on your local laptop is amazing. You can experiment with a whole data center, right on your local computer!
What can you install?
Your first limitation is RAM. These are real operating systems that need real memory. However, RAM is cheap nowadays! Go to www.crucial.com and go look up your computer and upgrade to 8, 12, or 16GB of RAM. I like to give every VM 1.5 to 2GB of RAM – so depending on how many machines you want to have booted up at any one time.
Disk space is not as critical. Even if you create a 120GB hard drive in the VM, Hyper-V doesn’t actually allocate that space. Instead, it just makes it look like you have 120GB to the hosted VM – and in real life, that .vhd file will expand, as you install things inside your VM.
So, if you are Microsoft-based IT person, hopefully you’ve found some inexpensive way to get MSDN. For me, I have a BizSpark account. That means I have access to an MSDN Ultimate-ish subscription. So, I have access (and licenses) for every version of every Microsoft operating system. That means that I can have multiple instances of Windows 7, Windows 8, Windows XP, Windows Server, etc – all for different purposes, all running side-by-side on my laptop.
Outside of Microsoft, it never hurts to stay current with what’s going on in the Unix/Linux world – here are some examples of free and popular distributions. You simply download the ISO’s (the DVD images), and you can mount that image from a Hyper-V machine and install that operating system:
Here are some links to some interesting Linux and Unix distributions that you could download and try to install:
- Ubuntu Desktop and Server editions
- Fedora (open source version of Red Hat Linux)
- OpenSolaris (open source version of Solaris)
- FreeBSD (open source version of BSD Unix)
This is what ZDNet says are the 5 most popular Linux distributions (Debian, Fedora, Ubuntu, Mageia, and Mint Linux). By the way, I am not sure all of these do in-fact run on Hyper-V, but I did install Ubuntu and I know that definitely works fine (so long as you use a hard-wired network card). If these don’t work, generally, Linux variants do tend to work in VirtualBox (which is also free, but is much more limited than Hyper-V).
So there it is. If you are a .NET developer, hopefully you have MSDN – in which case, you should hopefully be leveraging a tool like this. When some new product or OS comes out, don’t risk blowing up your laptop – just create a virtual machine and test it there. Now that Hyper-V is available on a client OS like Windows 8 – this is a pretty big game-changer!
UPDATE: I’ve since did this blog post which covers which operating systems worked and didn’t work in Hyper-V: Win8/Hyper-V: “What Works and What Doesn’t” Edition