Installing Microsoft Sql Server on Debian Linux


Believe it or not, Microsoft Sql Server now officially supported under Linux by the Microsoft itself! Here is the link:

It is still on the beta stage and some of the advanced features not supported yet. But it is quite usable for general usage.

You can find installation instructions for Ubuntu Linux, but Debian not included. However, it is possible to install on Debian Jessie with using instructions for Ubuntu Linux:

Add Microsoft repositories into apt:

$ curl | sudo apt-key add -
$ curl | \
                sudo tee /etc/apt/sources.list.d/mssql-server.list

Update apt package database and install mssql-server package:

$ sudo apt-get update
$ sudo apt-get install mssql-server

After package installation, you need to run /opt/mssql/bin/sqlservr-setup script:

$ sudo /opt/mssql/bin/sqlservr-setup
Microsoft(R) SQL Server(R) Setup

You can abort setup at anytime by pressing Ctrl-C. Start this program
with the --help option for information about running it in unattended

The license terms for this product can be downloaded from and found
in /usr/share/doc/mssql-server/LICENSE.TXT.

Do you accept the license terms? If so, please type "YES": YES

Please enter a password for the system administrator (SA) account: 
Please confirm the password for the system administrator (SA) account: 

Setting system administrator (SA) account password...
Do you wish to start the SQL Server service now? [y/n]: y
/opt/mssql/bin/sqlservr-setup: line 106: [: !=: unary operator expected
Do you wish to enable SQL Server to start on boot? [y/n]:

Now you can check the default sql server port 1433 listening or not:

$ sudo lsof -i :1433
sqlservr 15020 mssql   65u  IPv4 152906      0t0  TCP *:ms-sql-s (LISTEN)

As you can see, port 1433 listened by sqlservr process.

If you want to connect sql server from Linux console, you can use sqsh, if you don’t have it, install first:

$ sudo apt-get install sqsh

To connect sql server as administrator account (sa):

$ sqsh -S localhost -U sa
2> go
1> SELECT Name from sys.Databases
2> go

It is also possible to connect through Microsoft Sql Server Management Studio: