Install MSSQL on Ubuntu Server 20.04

microsoft-sql-server
Microsoft SQL Server

Some customers and some applications require using Microsoft SQL server. Recently Microsoft have released MS SQL server for Linux. So this is my preffered method to run with MSSQL databases when required. Here are my notes to get a basic system up and running.

Install your base ubuntu system as normal, select to install the OpenSSH server so you can SSH in.

Import the public repository GPG keys:

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

Register the Microsoft SQL Server Ubuntu repository for SQL Server

sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"

Install MSSQL Server:

sudo apt update
sudo apt install -y mssql-server

Complete the setup, SA password and choose version:

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

Check that it is running:

systemctl status mssql-server --no-pager

MSSQL runs on port 1433 by default, so make sure that is open on the firewall and test the connection.

I am no expert on MSSQL so after I had set this up for a development server, I wanted to connect using SQL Server Management Studio. At first it would not connect properly with default settings. I had to edit the Connection Properties section and select Encrypt Connection and Trust Server Certificate.

By Roy Westwood

I've been an Industrial Automation professional for over 20 years. I currently lead a team of Systems Engineers creating OEE and Data Management solutions for customers all over the world.

Leave a comment

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