Creating a SQL Server Test Lab On Your Workstation – Part One, Installing The Domain Controller

Wrens operating the 'Colossus' computer, 1943.

One of the most useful tools to the DBA when we need to test new features, recreate a fault that we’ve seen in production or just want to see ‘what if…?’ is a test lab.

Other Posts In The Series

Part Two, Creating a Domain Account and Joining a SQL Server to the Domain
Part Three, Creating a Windows Failover Cluster and a SQL Server Availability Group

Some of you are going to be lucky enough to have a few servers kicking around or a chunk of the virtual environment that you can build a test lab in but not all of us do.  In this series of posts I’m going to look at how we can build up a fully functioning test lab consisting of a domain and clustered SQL Servers on our desktop PC.  Now, although I’m going to be building this environment on my desktop, the main steps will be the same if you’ve got separate hardware for this so may still be relevant.

So, in this series we’re going to build a virtual test lab that’s going to consist of a domain controller and a couple of SQL Servers in a Windows Failover Cluster, hosting an Availability Group.

My Specs

I’m going to be using a fairly modestly spec’d desktop PC to build this environment on.

3.8GHz Quad Core Processor
16GB RAM
Windows 10 Pro
2TB HDD
500GB SSD

Hypervisor Software

virtual

We’re going to be creating this test lab using virtual machines so the first thing we’re going to need is some sort of hypervisor software.  I’m going to use Oracle’s Virtual Box, mainly because it’s software that I know well but there are many other free offerings out there if you wanted to use something else and depending on your host operating system.

https://www.virtualbox.org/

A couple of alternatives are VMWare Player or Microsoft’s HyperV

Building the Domain Controller

Once you’ve got your virtualisation software installed, the first thing that we’re going to need to do is going to be building our domain controller.

You’re first going to need to create a virtual machine to host this, if you’re using Virtual Box, simply click on the ‘New’ button (if you’re using a different hypervisor, you’ll need to check the vendor’s documentation for details).

vm1

This’ll bring up an options window where we can give the VM a name and select the operating system type and version.

vm2

We then need to allocate some RAM to this VM.  This is only going to act as a domain controller so isn’t going to need all that much RAM for our purposes so I’m just going to go with 2GB.  We can always increase this at a later date if we find the server struggling.

vm3

The next step is to allocate a disk to the server, you’re probably going to want to select ‘Create a virtual hard disk now’

vm4
We’re now going to need to make a few choices about the hard disk that we’re creating.

What hard disk file type to use?  Personally I always choose VHD, it’s a native windows Virtual Disk and can easily be mounted on your workstation’s operating system if you ever needed to.

Dynamically Allocated or Fixed Size?  Totally up to you, I’d personally choose dynamically allocated, this will mean that the VHD file will only use as much space on our disk as it’s actually using and let us over provision our disks.

Size and Location? First, let’s think about the location.  For best performance, this disk wants to be placed on the fasted disk that you’ve got available to you so I’m going to be putting it on my SSD.  I’ve tried running VMs from a spinning disk but they can really struggle when you have more than a couple up and running.

Size? It doesn’t need to be big, I’ve got with 100GB which will be far more than enough.

Installing the OS

Now that we’ve got the machine up and running we’re going to need to install the OS.  Grab yourself a Windows Server ISO image, right click on the virtual machine that you’ve just created, select settings and Storage.

To load in the ISO, select the CD drive and from the drop down you can choose the ISO image that you want to load.  If it doesn’t appear in the list, you’ll need to select ‘Choose Virtual Optical Disk File…’ and locate the file.

vm5

With the disk file loaded you just need to start up the VM and install your OS.

Right click on the VM, choose Start and Normal Start.  Your VM will start up and you can install Windows Server.

vm6

Name The Server and Set its IP Address

The first thing that I want to do is give this box a sensible name so I’m going to rename it at DC1.

vm17

The next thing that we need to do is make a couple of changes to the servers network settings.  We need to make sure that our domain controller is assigned a static IP address, I’ve chosen 10.10.10.1 for this and that the DNS server is pointing at the loopback IP address, 127.0.0.1.

vm18

Setting Up Active Directory

Now that our domain controller is built, we’re going to want to setup Active Directory.

Open up Server Manager and click on ‘Add Roles and Features’

vm7

Choose ‘Role based or feature based installation’

vm8

When choosing the destination server, you should only see one server and that’ll be the local VM.  I know it’s going to have a silly name, but we’ll change that later on.  For now just hit ‘next’

vm9

On ‘Select Server Roles’, you’re going to want to select ‘Domain Services’  When presented with ‘Add Features’, just hit ‘Add Features’ and ‘Next’

vm10

On the select features page, just keep the defaults and click Next.

vm11

You can just skip through the AD DS page and hit ‘Install’ in the Confirmation screen.

vm12

When that’s finished installing, we’re going to need to promote our server to a Domain Controller.  Click on ‘Promote this server to a domain controller’.

vm13

As this is a new domain that we’re setting up, we’re going to select ‘Add a new forest’ and then give our new domain a name.

vm14

You can leave the functional levels where they are.  We’re going to be using this server as our DNS server so we’ll also leave that ticked and provide a password for the DSRM.

vm15

We can just select the defaults on the next few screens and the Prerequisites Check should pass although it might give a few warnings.  We can ignore those warning, nothing there for us to worry about for now so go ahead and hit install.

vm16

The VM will probably reboot but when it comes back online, you’ll find that you’ve got yourself a sparkling new domain.  There are a couple of things that we’re going to need to tidy up first though.

 

So there we have it, our domain controller for our new test lab is up and running.  In the next part of this series we’ll build our first SQL Server, create a domain account to access the server and join it to our domain.

Thanks for reading 🙂

8 thoughts on “Creating a SQL Server Test Lab On Your Workstation – Part One, Installing The Domain Controller

Add yours

  1. Always set the computer name and ip settings before you run dcpromo. You shouldn’t re ip or rename a dc, it can cause a whole heap of trouble

    Like

    1. That’s a fair point and is the order I’d normally do things. To be honest, I forgot to rename the server when I was putting the walk through together so was a bit sloppy and added it in after. With nothing joined to the domain at that point I’m not expecting any issues but you’re right, it’s bad practice and I’ve rearranged the steps in the post 🙂

      Like

  2. This is fantastic! Thank you so much for putting this out. I’ve been looking for a way to set up my own lab for some time but I’m rather intimidated by VMs since I’ve not ever set one up before. This step by step guide has been really helpful.

    Not to rush you, but do you have a time frame in mind for when you’ll release Part Three? Thanks!

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a website or blog at WordPress.com

Up ↑

%d bloggers like this: