Run SQL Server on CentOS

All you need is Love with Linux

Because Microsoft released a preview of SQL Server I decided to install it and see how it was like, in simply words: Too Easy

What I used for it:

  1. A VM running CentOS
  2. SQL Server for Linux
  3. A Windows Box in case you want to install the SQL Management Studio

CentOS is not on the list of supported distributions BUT it’s RH at the end

Note: Do this as superuser or su when required

Download the SQL Server Red Hat repository configuration file


Contents of the .repo file:

Install SQL Server

This is how installation looks like

Installation Completed

Set it Up

That was just the install, NeXT is to setup

First thing before installing is to say YES to licensing. The one no one ever reads

During the setup process it will ask about autostart and the SA Password

Typed the SA Password and said Yes to Auto-Start

Verify it’s Running 

Running marked in Green

And that was it for the setup, next some extra configuration and DB operations

Install the Tools

  1. sqlcmd: SQL command line
  2. bcp: Bulk Copy

It will look like this:

Connect to the DB

Type the SA Password and you’re IN the DB engine!

Just some quick  SQL command

SQL Runs

And that it’s for the Linux side of things

And then What?

I now have a SQL Server running on CentOS, it’d be useful to test it and see what it does:

On a Windows Box, I installed the SQL Management Tools

Because this SQL instance is running on a VM in Azure I had to add the incoming exception to the NSG

Connect to the DB with Management Studio

  • Server Name: Public IP of the VM
  • Authentication: SQL Server Authentication
  • Login:SA
  • Password: The one set at configuration time

Database Restore

I restored the AdventureWorks example Database I found here. I put the .bak file on a BLOB in Azure for future use and restored it from there.

The to be restored BAK File

Query the DB from Management Studio

Query #1

Query #2

Next thing I’ll do is compare Feature set between MS SQL f/Windows and MS SQL f/Linux