Installing and Configuring SQL Server for Linux (RedHat 7)

I’ve been aware of SQL Server on Linux for a while now, and despite my casual flings and general affection for RedHat and Ubuntu, I’ve not had time to have a look at the CTP build of SQL Server vNext which is now available from Microsoft.

I recently read a blog article which enthused about how easy it was to configure, and the author really looked excitingly ahead to what cross-platform SQL Server might mean for the RDBMS industry – so I thought what the hell, it’s time to give it a go myself.

When I’m testing new things I’m more comfortable with Ubuntu, but there wasn’t enough memory on my test server (SQL Server vNext requires 3.25GB of memory in order to install) so I decided to go ahead and try this out on a test RedHat 7 server which did meet the minimum requirements.

Installation is astonishingly easy, but that should come as no surprise to anyone familiar with using the yum (or aptitude if you’re using Ubuntu) distribution repositories.

Note: For anyone reading this who is not familiar with Linux, Microsoft do a pretty good Lab aimed at getting SQL Server professionals up to speed here. It’s aimed at RedHat environments – I’m unsure whether there are others aimed at different Linux builds.

Step 1: Installation

The first thing to do is log into RedHat and elevate to root.

Once elevated, we need to download the RedHat repository configuration file from Microsoft. We’re going to put that file in /etc/yum/

curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo

The console should output the following which confirms the file has been copied correctly:

libcopy

We can then install the package mssql-server via yum:

sudo yum install -y mssql-server

After about 15-20 seconds, the installation should complete with the following message:

inst_complete

The installation directory is /opt/mssql/

Step 2: Configuration 

Now SQL Server is installed we need to configure it. The configuration executable is in /opt/mssql/bin so we need to run the following command in the console to do this.

Two prompts will appear relating to Licence Terms and setting the SA password as follows:

setup

Once setup is complete SQL Server is now installed.

You can check the service is running by executing the following:

sudo systemctl status mssql-server

Which should output something like the following message:

service

Step 3: Install SQL Server Tools for Linux

At the moment there is no such thing as SQL Server Management Studio for Linux environments, so unless you’re able to connect to your new instance of SQL Server vNext CTP from a Windows machine, you’re out of luck.

However, command line tools (sqlcmd) are available and can be installed as follows:

Run the following command to install SQL Server Tools from the yum repository:

sudo yum install mssql-tools unixODBC-devel

After a couple of prompts you should see the following output in the console:

toolsinstall

The location of the executable is at /opt/mssql-tools/bin/

To open a SQLCMD prompt connected to your new instance, input the following in this directory:

./sqlcmd -S localhost -U SA -P yourpassword

So there you have it. That’s pretty much it. You’re now running SQL Server vNext on Linux.

The installation and configuration process is ridiculously easy, albeit, there are limitations in the features so admittedly it is a more lightweight install than say and enterprise build with BI services on Windows…

That being said, Microsoft seem to be periodically lifting limitations in preparation for the future production release so it will interesting to see how that pans out. The CTP 1.3 release has enabled the following, for example:

I think next steps for my will be look at some of the high availability options currently on offer in the CTP 1.3 release and I’ll certainly be doing more blogs about SQL Server for Linux over the next few weeks.

Do I think it’s something that will draw seasoned Oracle and MySQL professionals away and towards SQL Server? Well, yes and no. Yes because there will those like me who already work in a cross platform environment and are pretty excited about this move from Microsoft, and no, because Oracle and MySQL do what they do very well and both are supported by a network of superbly experienced professionals who know how to leverage the technology in order to maximise it.

But only time will tell how serious Microsoft is about supporting cross-platform environments. I for one can’t wait to see how it all works out.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s