Install SQL on Linux


Microsoft recently made available SQL public preview of SQL Server for Linux.

It is important to make it clear SQL on Linux is not a “light” SQL version but Microsoft’s goal is a fully featured SQL Server.

In this article I will explore the process to Install SQL on Linux on an on-premises lab.

Install SQL on Linux – Supported Platforms

Before exploring the actual installation instructions be aware SQL on Linux is supported on the following distributions

  1. Red Hat Enterprise Linux 7.2
  2. Ubuntu Linux 16.04
  3. SUSE Linux Enterprise Server 12 SP2 (still not supported but will be soon so I’ve included it anyhow)

There are other deployment options like running on Docker or an Azure Virtual machine but for this article I will use Ubuntu Linux 16.04 as I already have a VM running it.

Deploying Ubuntu Server is a trivial process so I will not cover the OS installation steps here.

Install SQL on Linux – Step by Step

Connect to the Linux server where you will install SQL and issue the following command

curl | sudo apt-key add -

SQL Linux Repository Key

This will install the Microsoft repository key in the local keyring so to trust the repository and install software from it.

Next you need to register the repository so that the local system will know where to download files from

curl | sudo tee /etc/apt/sources.list.d/mssql-server.list

SQL Linux Repository

Now rune the following command to refresh repository metadata

sudo apt-get update

SQL Linux Update Repository

[su_note note_color=”#ffff96″ text_color=”#000000″ radius=”5″]Note: During my tests, and while I was writing this article, I received errors about repository name not being resolvable. While I think this issue is just temporary should you face it just re-running the command will take care of it. [/su_note]

Finally run the following command which will carry on SQL Server installation

sudo apt-get install -y mssql-server

SQL on Linux Installation

The above screenshot is just partial as a lot of text will flow on the screen while necessary packages are downloaded and installed, once everything has been correctly downloaded the following success message will be displayed

SQL on Linux Setup complete

As the instructed on-screen run /opt/mssql/bin/sqlservr-setup command to start SQL Configuration

SQL on Linux license agreement

You will be asked to insert sa password and configure services startup

SQL on Linux Configuration Complete

That’s it! SQL is now installed on your Linux machine you can easily check if it is running via the following command

SQL on Linux Processes

Of course if you prefer to use GUI tools here’s a screenshot from one of my lab machines with SQL Management Studio installed and connected to Linux SQL Server

SQL Management Studio Linux

A big kudos to Microsoft for releasing SQL on Linux and making the installation a breeze!

I hope you will find the article useful and would like to hear your experience in the comments. If you face any issue or have problems don’t hesitate to let me know and I will try to assist you.


Leave a Reply

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

You are commenting using your 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