How To Install And Configure SQL Server On Ubuntu

Bhuvanesh
2 min readNov 30, 2016

--

Hello everyone, I’m glad to meet you with my first blog post.

Microsoft recently launched Linux version of SQL server called SQL server vNext CTP version. I tried SQL server on ubuntu. Its awesome. Seems like it fulfills the most of the developer’s dream and open source lovers. This is a bit late most of the bloggers posted this, but as a DBA I would like to post this first in my blog too.

Pre-requirements:

  • Ubutnu 16.04
  • 4GB Memory.

Install SQL server on Ubuntu:

Import the public repository GPG keys

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Register the Microsoft SQL Server Ubuntu repository:

curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

Install SQL server

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

Once the installation is done, we have to setup SA password and initial configurations.

The SA password should be 8 characters (including uppercase and lowercase letters, base 10 digits and/or non-alphanumeric symbols)

sudo /opt/mssql/bin/sqlservr-setup

Now its time to start SQL service.

systemctl status mssql-server

Install SQL Server tools:

Microsoft also provides SQLCMD and BCP to Linux.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Import the public repository GPG keys

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

Register the Microsoft Ubuntu repository

Update and Install mssql tools.

sudo apt-get update 
sudo apt-get install mssql-tools

Connect SQL server:

You can able to access this SQL server from your local server or remotely.

Connect from local server SQLCMD

sqlcmd -U sa -P ******

Connect from remotely SQLCMD.

sqlcmd -S 10.0.0.5 -U sa -P ******

We can use SSMS also to connect.

--

--