Installing SQL Server vNext on Linux: Part 2

Yashwant VishwakarmaSQL DBA
In part one, we reviewed the prerequisites required for installing SQL Server vNext.
In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.

Note: All screenshots are from Ubuntu 16.04


With the release of Microsoft SQL Server on Linux, it is a huge step for Microsoft towards gaining more market share in Database Technologies and giving competition to other RDBMS software. Microsoft SQL Server is now not only on Windows but also on Linux and for those that love Linux can choose their flavor of SQL Server in Linux environment.

Installation Steps

To install SQL Server vNext on Ubuntu 16.04, I followed Microsoft Documentation For SQL Server vNext.

So let’s start the step by step procedure to install SQL Server vNext on Ubuntu 16.04.

Step 1
First we need to import GPG keys (Authentication keys) from Microsoft. To import GPG Keys from Microsoft we need to execute three commands to download and install the keys:
a) cURL : cURL is a command line tool for transferring files using different web based protocols.

b) apt-key : apt-key is used to manage the list of keys used by apt to authenticate packages. Packages which have been authenticated using these keys will be considered trusted.

c) sudo : as per the wikipedia definition; "sudo is a program for Unix-like computer operating systems that allows users to run programs with the security privileges of another user, by default the superuser. It originally stood for "superuser do" as the older versions of sudo were designed to run commands only as the superuser."

Execute below command to import the GPG keys:

curl | sudo apt-key add -

Description: D:\IBGrp\KBArticles\Installing SQL Server On Linux Pix\1.JPG

Figure 1: Importing GPG Keys for SQL Server from Microsoft Website

Step 2

We now need to register or add SQL Server vNext into the Ubuntu repository (Repositories are servers which contain sets of packages). To register SQL Server vNext in Ubuntu here we are using two commands.

a) cURL: has been explained in step 1.

b) tee : tee command is used to view and store the output of any command at the same time.

To register SQL Server vNext in Ubuntu repository we need to execute below command:

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

Description: D:\IBGrp\KBArticles\Installing SQL Server On Linux Pix\2.JPG

Figure 2: Registering SQL Server vNext in Ubuntu Repository

Step 3

After importing GPG keys and registering SQL Server vNext in the Ubuntu repository, the next step is to update the repositories by executing the apt-get update command.            

sudo apt-get update

Description: D:\IBGrp\KBArticles\Installing SQL Server On Linux Pix\3_1.JPG

                Figure 3: Updating the Ubuntu Repositories

Step 4

After updating the Ubuntu repositories it is time to execute the apt-get install command that installs SQL Server vNext.

sudo apt-get install mssql-server

Figure 4: Installing SQL Server vNext

Step 5

When installing SQL Server vNext, the default path is /opt/mssql/bin. After installation we need to configure mssql using the below mssql-conf command.

mssql-conf : Like how we manage and configure SQL Server Services in Windows with SQL Server Configuration Manager, in the same way we can configure SQL Server vNext on Ubuntu and manage SQL Server on Linux with mssql-conf.  mssql-conf is a configuration script that installs with SQL Server vNext (Linux).

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

When we execute the above command it will ask "Yes / No" to continue. We need to enter “Y” to complete the configuration step.

It will give a prompt to enter a password for the sa user. Remember to give a strong password for the sa account. After that our setup should complete successfully.

Description: D:\IBGrp\KBArticles\Installing SQL Server On Linux Pix\5_2.JPG

Figure 5: Executing mssql-conf command to complete setup

Step 6

After completing the installation and configuring SQL Server, we can verify the SQL Server Service to check whether SQL Server is running. To verify the SQL Server Service, execute the below command:

systemctl status mssql-server

Description: D:\IBGrp\KBArticles\Installing SQL Server On Linux Pix\6.JPG

Figure 6: Verifying SQL Service is Running

After executing systemctl status mssql-sever, you should see in the output that mssql-server.service is enabled and it active (running). 

This is all about how to install SQL Server vNext. SQL Server is now installed completely but to work with SQL Server we need to install SQL tools. We will learn to install the SQL Tools in next article. Till then, stay tuned and happy reading.

Note: It is suggested that a basic understand of linux is required to get the most out of this article. It will help the reader to understand where files are stored, what will be the default directory when we backup, what the system folders represent and in other words, a basic working knowledge of Linux.

To get you started, here are some useful references for the basic file systems found in Linux:


I have tried to explain all the steps so that a person who is not familiar with a Linux environment can also benefit. I have only covered the installation steps here so If you've made it to the end of this article SQL Server vNext should be completely installed but that's only the beginning! There are tools to install and work to be to connect with the SQL Server vNext, which I will cover in next article. 

So keep reading and stay tuned to get updates.

Yashwant VishwakarmaSQL DBA

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.