Since the release of SQL Server 2008 Service Pack 1 in April 2009, it has been possible to install SQL Server with media that includes the latest patches, whether they be Service Packs (for SQL Server 2016 and prior), Cumulative Updates, and even hotfixes.
There was the hint of a promise with the new servicing model for SQL Server 2017 that at the end of every 12 months for the five years of Mainstream Support, Microsoft would provide a slipstreamed installer as well, but that was changed this month (as mentioned in my previous post).
Because we have been left once again to produce our own slipstreamed installation media, I figured this would be a good time to refresh our memories on how to do it.
Note: These instructions apply only to the Windows version of SQL Server. While SQL Server can be installed on Linux as well, the way package management works makes it a relatively easy prospect to update SQL Server using the built-in package manager for each Linux distribution. The process is considerably faster on Linux as well, given that Service Packs are not part of the newer servicing model.
To create slipstreamed installation media for SQL Server on Windows, we need at least two things:
- The installation media for the RTM (or GA) product, usually an ISO file.
- One or more updates (Service Pack, Cumulative Update, hotfix) as executable files.
Step 1: Download the software
For this example, we will be using the SQL Server 2017 Developer Edition RTM (called en_sql_server_2017_developer_x64_dvd_11296168.iso), and Cumulative Update 11 (called SQLServer2017-KB4462262-x64.exe), which was the latest CU available at the time of this writing.
Place the Cumulative Update in a folder that will contain the patch files. On older versions of SQL Server, this could comprise the latest Service Pack, Cumulative Updates, as well as additional hotfixes you may wish to apply. For instance, as of this writing, SQL Server 2016 requires Service Pack 2, Cumulative Update 3 for Service Pack 2, and two more hotfixes to bring it up to date. We would have to have all four files in this folder.
The actual path does not matter as long as we keep track of where they are. For the purposes of this post, we will assume they are stored in C:\Temp
.
Step 2: Extract the installation media
We need to extract the main SQL Server installation media, which in our case is the ISO file.
In our example, let’s assume that Windows has the ability to mount the ISO as a separate drive (mounted as the D: drive). We can then use the built-in robocopy
command to copy the ISO contents to the hard drive into a path called C:\SQL2017
:
robocopy D:\ C:\SQL2017 /MIR
This issues the robocopy
(Robust Copy) command to look at all of the files in D:\
, including sub-directories, and make an exact copy of them in C:\SQL2017
. Be warned that C:\SQL2017
must be empty, because the /MIR
switch will remove anything that is already there. You do not have to create the target folder on your hard drive, as robocopy
will do this for you.
Note: If we are not mounting the ISO file using Windows File Explorer, we could use a third-party application like 7-Zip to extract the contents to C:\SQL2017
instead.
Step 3: Add the patches
We will now create an Updates folder inside the SQL Server installation folder. The name is not important, but a boring name like Updates is useful down the line when we are looking through old files.
mkdir C:\SQL2017\Updates
Now we have a place to move the patch files we downloaded. Copy the files from C:\Temp
into the new C:\SQL2017\Updates
folder.
That’s it! We’re done. The only remaining step is to let the SQL Server Setup application know that we would like to apply these patches from the Updates sub-folder during installation.
Step 4: Install slipstreamed SQL Server
To make use of this slipstreamed installation media, we need to let SQL Server know that there are updates to apply, which means SQL Server must be installed from the command line. It will still open up the installer GUI with the appropriate prompts, but the updates will be applied at install time.
Assuming we want to install SQL Server on the same machine we just created this install media, we can navigate to C:\SQL2017
at the command prompt, and issue the following command:
setup.exe /Action=Install /UpdateEnabled=True /UpdateSource=".\Updates"
setup.exe
runs the SQL Server Setup application/Action=Install
tells Setup that this is a new installation/UpdateEnabled=True
tells Setup that there are updates that must also be applied/UpdateSource=".\Updates"
provides the path of the updates to be applied, relative to the current directory
Should we decide that this slipstreamed installer should be used on other servers, we can either create a network share that contains the files, and map that path to a drive on the new server, or we can make a new ISO file out of the C:\SQL2017
folder. Either way, the command line must be used to install SQL Server if we want to include those patches.
Unfortunately there is no way to create an ISO file natively in Windows, but we can download a third-party tool like Magic ISO Maker. If you’ve got WSL installed, you could also create your ISO using a command line tool.
Do you have a different method for making SQL Server slipstream installs, or have a question about these example steps? Feel free to leave your comments below.
Thanks to Boris Hristov for his post on creating slipstream media for SQL Server 2012 and 2014, which I discovered halfway through writing this one. Any similarities are coincidental.