Install SQL on Linux VM

One of most interesting things last year was release of MS SQL Server for Linux. Like I said in some of my posts before, I wouldn’t have dreamt of it 5-6 years ago. But things changed very much in last few years and this is another big step Microsoft took toward OpenSource community. In this post I will take you through setting up  SQL on Linux VM on Azure. First few steps will be specific to setting up environment in Azure portal but later steps can be used on local server or local VM running Linux. I simply use Azure for setting up new VM as I don’t want to waste resources on my laptop.

So first go to Azure portal and set up your Linux VM. Go to portal, click new, select ‘Compute’ and select ‘Ubuntu Server’.

Select ‘Resource Manager’ and click ‘Create’.

Set up basic parameters and click ‘OK’.

Select size for your VM. I will choose A2_V2 standard.

For optional features, leave everything and default and click ‘OK’.

Wait for validation to pass and click ‘OK’ to start provisioning of your VM.

Before we begin installation of SQL Server, we need to set up NSG to allow traffic over port 1433. Remeber that I’m doing this only for demo as I want to connect to SQL Server from my laptop. Opening port 1433 to public is very bad idea and you shouldn’t do this unless it’s for demo as well.

Go to your VM, select ‘Network interface’ , select ‘Ubuntu’ and finally ‘Network security group’.

Select ‘Inbound security rules’ and click ‘Add’.

Enter parameters to allow traffic over port 1433.

I use Putty to connect to Linux servers and I’ll use same here. After connection to my Linux VM, I can start installation of SQL Server.

First thing to do is import public repository GPG keys so we run:

curl | sudo apt-key add –

After that we need to register MS SQL Server Ubuntu repository and next command is:

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

Now it’s time to start package installation. First run:

sudo apt-get update

And then:

sudo apt-get install -y mssql-server

After package installation is finished, it’s time to run configuration script:

sudo /opt/mssql/bin/sqlservr-setup

In configuration you’ll be asked to accept license terms.

Then you need to enter and confirm password for SA account. Password must be at least 8 characters long and contain 3 out of 4 rules of uppercase, lowercase, digit and special character.

Finally, you we’ll be asked if you want to start SQL Server service and if you want to enable SQL Server to start on boot.

And you’re done. Now go to SSMS and connect to your SQL instance.

You can connect with most of SSMS but you’ll need latest version if you really want to do work here.

And you have MS SQL Server running on Linux VM. Best of all is that it took me 17 minutes to set up everything here. Linux VM on Azure, SQL Server… everything from 0 and after 17 minutes I have fully functional MS SQL Server running on Ubuntu. In one of next posts I’ll write more about where to go from here and what you can do with your SQL instance on Linux.


Article by Mustafa Toroman

I’m System Engineer at Authority Partners. I love to test and explore new technologies. Have over 20 active MS certificates such as MCSA for Windows Server and SQL Server, MCSE Private Cloud, Data Platform, Business Intelliegence and Server Infrastracture. Lately most interested in BI and Azure solutions. MCT since 2012. From 2016 MVP for Microsoft Azure.


  1. I just wanted to jot down a message in order to thank you for all of the precious information you are giving on this website. My particularly long internet lookup has at the end been recognized with reliable know-how to share with my great friends. I ‘d state that that most of us website visitors actually are rather endowed to be in a useful network with many brilliant individuals with helpful strategies. I feel truly blessed to have seen your entire webpage and look forward to so many more brilliant times reading here. Thanks a lot once again for everything.

  2. Excellent web site. Plenty of useful information here. I am sending it to some pals ans additionally sharing in delicious. And certainly, thanks for your sweat!

  3. I’ve been absent for some time, but now I remember why I used to love this blog. Thank you, I’ll try and check back more frequently.

  4. It’s truly a great and useful piece of information. I’m satisfied that you shared this helpful information with us. Please stay us informed like this. Thank you for sharing.

  5. Im not that much of a online reader to be honest but your blogs really nice, keep it up! I’ll go ahead and bookmark your site to come back later. All the best!

  6. Good article! We will be linking to this particularly great content on our website.
    Keep up the great writing.

  7. Thank you for making the sincere try to explain this. I think very robust about it and wish to be told more. If it’s OK, as you reach extra extensive wisdom, could you mind adding more posts similar to this one with additional info? It would be extremely helpful and helpful for me and my colleagues.

  8. Somebody essentially assist to make seriously articles I would state. That is the first time I frequented your website page and to this point? I amazed with the research you made to make this actual put up amazing. Great process!

  9. Hello! I just now would like to supply a massive thumbs up for any wonderful information you could have here within this post. We are coming back to your blog post for further soon.

Leave a Reply

Your email address will not be published. Required fields are marked *