How To Install MSSQL on Ubuntu 16.04

Pre Requisites

My environment setup

For this installation I used virtual box. It is best to use virtual box if you are first time user or testing this for the first time. I am assuming you already know how to setup virtual box. If not and need help, leave me an email.

There are few advantages of using virtual box. One you can take snapshots and restore back to snapshot in case you mess things up. I like to make a mess (that is how I learn). Second, you can start fresh if needed, while keeping your main machine clean, unless you have a test machine.

Thanks to Jeremy Morgan’s YouTube tutorial, it was helpful for me. Most of the steps are similar with added steps and changed URL to point to newer link. Here is the link to video for reference

Note: Use suggestions at your own risk. These are the steps I used that worked for me and put together after searching on google.

Installation Steps

Step 1

Open Terminal in Ubuntu and run following command

sudo apt-get update

Step 2

If you do not have CURL installed, you will need it to be installed. Usually it is not present in fresh Ubuntu install. Run below command to install CURL

sudo apt-get install curl

Step 3

Now we will import public libraries GPG Keys

curl | sudo apt-key add -

Step 4

Register SQL repository (this is one line do not press enter while typing this command).

You can change the URL as needed. I am using mssql-server-2017. If you want to install preview only use alternate url

For MSSQL-Server-2017 use

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

For MSSQL-Server-2017-Preview use

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

Step 5

You are almost done…… now we need to run updates and install mssql server. Run below commands in order

sudo apt-get update

sudo apt-get install -y mssql-server

Step 6

If you had success in step 5 , we will now configure sqlserver. This is a quick setup to get it up and running and is crucial step. Run below command.

sudo /opt/mssql/bin/mssql-conf setup

You will be asked to select type of edition you want to use. Note that there are three free versions.

Evaluation (only for 180 days), Developer and Express (free). Select the version you want to try. I am using Developer version.

This is the last step. Once you have selected appropriate version you will be asked to accept terms and then select password. You can’t select a easy password, it will prompt you to select a strong password. So make sure to have a good password enough to pass the check.

Step 7

Check if your MSSQL server is up and running…it may take sometime for service to kick in so give it at least 2 minutes. Run below command to confirm server is running.

systemctl status mssql-server


Originally published at



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sanchit Wadhwa

Sanchit Wadhwa

I help solve data problems |Need help ? email me > | website > | ❤ Books, music, dance, food, podcasts, soccer, writing