Friday, February 28, 2014

Installing a trial of SQL Server 2014 and Windows Server 2012 in a VirtualBox VM

It's sometimes really useful to get a trial copy of SQL Server to play with. There are a number of reasons for this: certification testing, validation, upgrade testing, skills training, experimentation, recovery trials, etc.

There are a lot of caveats, however. You don't want to install it on your work machine because you don't want to mess up your current configuration. The next best option is using a virtual machine. But you don't want to spend hours or days installing and configuring Windows and you don't even have Hyper-V running on your operating system (for instance, Windows 7).

Luckily, all these problems have easy workarounds. Here's a preview:

  1. Download the VHD file for the Windows Server 2012 trial
  2. Downlload and install VirtualBox
  3. Windows is already installed! 
  4. Download the ISO for SQL Server 2014 
  5. Mount the ISO virtually in your virtual machine
  6. Start the virtual machine
  7. Install SQL Server as you please
  8. You're done! 
  9. However, if you're really interested, you don't even need to sign in to your new VM to access SQL Server. Just make it accessible to the network and make sure your VM host and guest can talk to eachother. Then just install your Client Tools (such as SSMS) on your host and you can remotely manage the guest. AMAZEBALLS!
This process looks longer than it actually is. The most tedious part about this will be waiting for the downloads, honestly. 

Let's get started!

Download the VHD file for Windows Server 2012 Datacenter (Trial)

This trial version of Windows comes in a pre-packaged VHD (virtual hard drive) file directly from Microsoft here: Microsoft Windows 2012 Trial

Download it and put it somewhere safe on your local machine. From here forward, your local machine will be known as the host machine.

Download and install VirtualBox

Download from here: Download VirtualBox

You'll want the 64-bit version for Windows. Put it in a safe place on the host machine and then install it. You shouldn't have to worry about install options.

Create a new virtual machine using the VHD file

This is easy. Just start up VirtualBox and click [New]. When you're setting up your virtual machine, make sure to choose Microsoft Windows for the type and Windows 2012 (64-bit) for the version. See the screenshot. 

Next, you won't want to create a new hard drive. Instead, use the one you downloaded from Microsoft. 

You will most likely receive an error that the hard drive already exists See the screenshot. The error is approximately "Cannot register the hard disk file because a hard disk with UUID already exists." If that's the case, you need to cancel the process and go to the main VirtualBox window. From there, click the File menu, then Virtual Media Manager. Delete the old hard drive from the list. It will ask you if you want to delete the file -- don't do that (unless you'd like to redownload the file). See here for more details on the error "Cannot register the hard disk file because a hard disk with UUID already exists".

Next, you can play with the settings of your Virtual Machine. Give it as much or as little memory as you feel appropriate. Give it more or fewer CPUs. Do what you feel is appropriate for your situation. The defaults should run adequately for demonstration purposes. 

Here's some extra help: Microsoft VHD images on VirtualBox (although not everything in the article is accurate or applicable to this situation

Download the ISO for SQL Server 2014 

Download the Microsoft SQL Server 2014 trial. Make sure to grab the ISO.

Install the ISO as a Virtual DVD in your VM

Go into the settings of your VM, click on Storage, then click the little icon of a CD next to the CD/DVD Drive. Then choose "Choose a virtual CD/DVD disk file..." and browse to your SQL Server ISO file. Save the settings.

Start your Virtual Machine

In the Oracle VM VirtualBox Manager window, highlight your server and then click start. It will take a while to boot and it will look a lot like a Remote Desktop session. Jump through all the standard hoops. 

Next, you're wondering, how do I send CTRL+ALT+DEL to the Virtual Machine to log in? Click on the machine menu and then click on "Insert Ctrl-Alt-Del."

Install SQL Server

Once you're in Windows, go to This PC and double click the installation DVD for SQL Server. Then click the setup icon to start the installation. 

It is beyond the scope of this article to help you install SQL Server. If you're a SQL Server admin looking to become certified, this is the part when you should grab your certification manual and follow along so that you understand all your installation options.

Special note: You will need to install .NET 3.5 ... this is not automatically included in Windows Server 2012, but you can add it as a feature. Check out To install .NET Framework 3.5 by using the Add Roles and Features Wizard (scroll down about 3/4 of the way).

Install Guest Additions

VirtualBox guest additions are some utilities and features to help VirtualBox talk to your virtual machine and speed it up a bit. To install them, while your machine is running, click on the Devices menu then click on "Insert Guest Additions CD Image." Next, inside the virtual machine, go to This PC then open up the VirtualBox Guest Additions CD Drive and install VBoxWindowsAdditions. The installation is straightforward. Make sure to allow the installation of all drivers and to reboot afterwards.

Remotely Access Your Server

Your virtual machine is also known as the guest machine. You can install just the SQL Server client tools in your host machine and remotely administer the server running your guest machine. That configuration is also beyond the scope of this article, but most likely I will post a second article describing that. In the meantime, fire up your guest machine and start SQL Server Management Studio (under the Start menu or the All Apps menu). 

Good hunting!

No comments:

Post a Comment