Setting Up MS SQL Server 2019 on Ubuntu 20.04: A Step-by-Step Guide

Setting Up MS SQL Server 2019 on Ubuntu 20.04: A Step-by-Step Guide

Are you looking to set up Microsoft SQL Server 2019 on your Ubuntu 20.04 system? SQL Server is a powerful relational database management system that is widely used in various industries for managing and analyzing data. While traditionally associated with Windows environments, SQL Server is now available for Linux distributions like Ubuntu, providing more flexibility and choice for users. In this guide, we'll walk through the process of installing and configuring MS SQL Server 2019 on Ubuntu 20.04 using specific steps.

Step 1: Download the SQL Server Package

The first step is to download the SQL Server package. Open a terminal and execute the following command:


This command will download the SQL Server package to your system.

Step 2: Update Package Lists

Next, update the package lists to ensure you have the latest information about available packages. Run the following command:

sudo apt-get update

This command will fetch the latest package information from the repositories.

Step 3: Verify Ubuntu Version

Before proceeding, it's essential to verify the version of Ubuntu you are using. Run the following command:

lsb_release -a

This command will display detailed information about your Ubuntu distribution.

Step 4: Add Microsoft's GPG Key

To ensure package authenticity and integrity, add Microsoft's GPG key to your system. Execute the following command:

curl | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc

This command adds Microsoft's GPG key to your trusted keys list.

Step 5: Add Microsoft's Repository

Now, add Microsoft's repository to your system by running the following command:

sudo add-apt-repository "$(wget -qO-"

This command adds the SQL Server repository to your package sources.

Step 6: Update Package Lists Again

After adding the repository, update the package lists once more by executing:

sudo apt-get update

This ensures that the newly added repository is included in the package index.

Step 7: Install SQL Server

Now it's time to install SQL Server. Run the following command to install the package:

sudo dpkg -i mssql-server_15.0.4335.1-6_amd64.deb

This command installs the SQL Server package on your system.

Step 8: Resolve Dependencies

To resolve any dependencies and ensure the installation is complete, run the following commands:

sudo apt update
sudo apt install libatomic1 libc++1 gdb libsss-nss-idmap0 libsasl2-modules-gssapi-mit
sudo apt --fix-broken install

These commands install necessary dependencies for SQL Server to function correctly.

Step 9: Configure SQL Server

After installation, configure SQL Server by running the following command:

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

Follow the prompts to set up SQL Server according to your preferences.

Step 10: Verify Service Status

Check the status of the SQL Server service to ensure it's running correctly:

sudo systemctl status mssql-server.service

This command will display the current status of the SQL Server service.

Step 11: Verify Installation

To verify that SQL Server is installed correctly, you can use the following command:

dpkg -l | grep mssql-server

This command will list the installed SQL Server package.

Step 12: Verify Ubuntu Version (Again)

Double-check the Ubuntu version to ensure consistency:

lsb_release -a

This command reaffirms the Ubuntu version you're using.


Congratulations! You've successfully installed and configured Microsoft SQL Server 2019 on your Ubuntu 20.04 system. SQL Server is now ready to use for your database needs. Whether you're developing applications or managing data, SQL Server provides a robust platform for storing and querying your data effectively. Enjoy utilizing SQL Server's powerful features on your Ubuntu environment!