Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form

Install Microsoft SQL Server 2019 and MSSQL Command line tools on Ubuntu Linux

Posted on 23/06/202005/09/2026 Christian By Christian 2 Comments on Install Microsoft SQL Server 2019 and MSSQL Command line tools on Ubuntu Linux
  1. Home
  2. Oracle/MSSQL/MySQL
  3. Install Microsoft SQL Server 2019 and MSSQL Command line tools on Ubuntu Linux
installing SQL Server 2019

It is worth noting that Microsoft SQL Server 2019 takes full advantage of OpenShift and Linux Containers etc. SQL Server 2019 has the same underlying database engine on all supported platforms, including Linux. In this article, we shall discuss “Install Microsoft SQL Server 2019 and MSSQL Command line tools on Ubuntu Linux’. See the following guide on how to download and install Microsoft SQL Server 2019 and Microsoft SQL Server Management Studio on Windows 10 and Windows Server.

Therefore, many existing features and capabilities operate the same way on Linux. For those who are still wondering about this integration and support, it has been supported since 2017 on RedHat Enterprise Linux.

For editions and supported features of SQL Server 2019 on Linux. Microsoft SQL Server 2019 offers a host of quality-of-life improvements for users. These include faster query processing, in-memory database improvements and a new feature Microsoft is calling Big Data Clusters.  See the following article on how to uninstall Microsoft SQL Server on Windows 10 and Windows Server.

Install MSSQL Server on Ubuntu 20.04

Before proceeding with the installation, it is worth noting that the installation requirements vary based on your application needs. The different editions of SQL Server accommodate the unique performance, runtime, and price requirements of organizations and individuals. The SQL Server components that you install also depend on your specific requirements. 

  • See the following links for some MsQL-related topics
  • How to use a dedicated MsSQL Db for Pleasant Password.
  • How to migrate Veeam MsSQL Database to a new MsSQL Server.
  • How to reset MSSQL Server SA Password on Ubuntu via the command line and SQL Server Management Studio.

Part A: Install MsSQL on Ubuntu 20.04: Follow the following steps to install the mssql tools on Ubuntu.

Step 1: Update Ubuntu System: Ensure all system packages are updated before adding any new packages and reboot afterwards. For more information on the differences between Linux system Update, Upgrade, and Dist-upgrade.

sudo apt-get update
sudo apt-get -y upgrade
Microsoft SQL Server on Ubuntu

Step 2: Ensure you have curl installed using the command “sudo apt install curl” as shown below

SQL Server Command Line tools

Step3: On the Ubuntu server, run the following commands in a terminal to install the mssql-server package

installing SQL Server 2019

Phase 4: Register the Microsoft SQL Server Ubuntu repository for SQL Server 2019

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

Step 5: Run the following commands to install SQL Server.

sudo apt-get update
sudo apt-get install -y mssql-server
installing SQL Server 2019
SQL Server Command Line tools

Step 6: Initialize MS SQL Server 2019 on Ubuntu 20.04

Note: After the package installation finishes, run mssql-conf setup as shown below and follow the prompts to set the SA password and choose your edition.

sudo /opt/mssql/bin/mssql-conf setup
Terminal window showing the SQL Server installation process, with options for different editions and prompts for user input, including license agreement and administrator password confirmation.

Verify the MySQL service

As we can see, the service is starting. The MS SQL service should be started. Once the configuration is done, verify that the service is running

systemctl status mssql-server --no-pager
Terminal window displaying the status of the Microsoft SQL Server service on a Linux system, showing active status, memory usage, and associated tasks.

Step 7: Add Firewall rules to open default ports of MS SQL Server for remote connection if you plan to connect remotely, you might also need to open the SQL Server TCP port (default 1433) on your firewall.

sudo ufw allow 1433
sudo ufw allow 1434
Terminal window displaying commands to allow ports 1433 and 1434 in UFW (Uncomplicated Firewall) on a Linux system.

Now let’s proceed with part B below to complete the MsSQL tool.

Create MSSQL database

Part B: To create a database, you need to connect with a tool that can run Transact-SQL statements on the SQL Server. The following steps install the SQL Server command-line tools: sqlcmd and bcp. Install the SQL Server command-line tools and the unixODBC plugin

Step 1: Import the public repo:

Import the public repository GPG keys.

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Terminal window showing a cURL command used to download a Microsoft package key with output details.

Step 2 – Register the Microsoft SQL Server Ubuntu

Register the Microsoft SQL Server Ubuntu repository for SQL Server 2019

curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Terminal window displaying the output of a curl command fetching a remote file from Microsoft packages for Ubuntu 18.04, showing download progress and output instructions.

This is Step 3 – Update the sources list

Update the sources list and run the installation command with the unixODBC developer package.

sudo apt-get update
sudo apt-get install mssql-tools unixodbc-dev
Terminal window showing a command to install mssql-tools and unixodbc-dev with error messages about unmet dependencies and held broken packages.

You may run into the following error “Unable to install msodbcsql17 on Ubuntu“, do not panic, use the following link to fix the issue. After the issue was fixed for me, I could install MsSQL tools on the server as shown below.
– Accept the license as well. by clicking on yes.

sudo apt-get update
sudo apt-get install mssql-tools
Screenshot 2020 06 23 at 00.39.08 1
Screenshot 2020 06 23 at 00.37.17

Alternatively, you could also use the following command below to install the SQL Tool (unixODBC developer package).

christian@christian-VirtualBox:~$ sudo ACCEPT_EULA=Y apt-get install msodbcsql17
Reading package lists... Done
Building dependency tree
Reading state information... Done
msodbcsql17 is already the newest version (17.5.2.1-1).
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
christian@christian-VirtualBox:~$

Step 4: Configure PATH for MS SQL binaries

Add /opt/mssql-tools/bin/ to your PATH environment variable in a bash shell. To make sqlcmd/bcp accessible from the bash shell for login sessions, modify your PATH in the ~/.bash_profile file with the following command.

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
Terminal window showing a command to export a directory path to the user's bash profile in a Linux environment.

To make sqlcmd/bcp accessible from the bash shell for interactive/non-login sessions, modify the PATH in the ~/.bashrc file with the following command.

echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
Terminal window displaying commands to update the PATH environment variable in a Linux system.

Part C: Connect locally to the MSSQL Console

To have this done, run sqlcmd with parameters for your SQL Server name (-S), the user name (-U), and the password (-P).

You are connecting locally using the server name “localhost”. The user name is SA and the password is the one you provided for the SA account during setup.

sqlcmd -S localhost -U SA -P '<YourPassword>'

If Succeed to login, the prompt will be like this below

Terminal window displaying a SQL command prompt with a command to connect to a localhost SQL server using specific user credentials.

Then you can try all the SQL Command then, like Create Database, Query, Delete data, or database etc.

create database TechDirectArchiveDB

Test and perform a remote connection using SQL Server Management Studio (SSMS) from your local machine.

Screenshot of Microsoft SQL Server Management Studio, showing the 'Connect to Server' dialog with fields for server name, authentication type, login, and password.

I hope you found this blog post helpful on how to Install Microsoft SQL Server 2019 and MSSQL Command line tools on Ubuntu Linux. If you have any questions, please let me know in the comment session.

Thank you for reading this post. Kindly share it with others.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
Oracle/MSSQL/MySQL Tags:Microsoft SQL, Microsoft SQL Server 2019 Express Edition, Microsoft SQL Server Management Studio, Microsoft SQL Server Studio, MsSQL, MsSQL Editions, Ubuntu

Post navigation

Previous Post: How to fix unable to install msodbcsql17 tool on Ubuntu
Next Post: How to reset MSSQL Server SA Password on Ubuntu

Related Posts

  • upgrade Microsoft SQL Server
    How to upgrade Microsoft SQL Server 2019 to 2022 Oracle/MSSQL/MySQL
  • sql server installation
    Install SQL Server 2022 Express and SQL Server Management Studio Oracle/MSSQL/MySQL
  • image 19
    Download your MySQL database from Azure to a local PC with MySQL Workbench AWS/Azure/OpenShift
  • sql server installation
    How to Install all Editions of Microsoft SQL Server 2025 Oracle/MSSQL/MySQL
  • Screenshot 2020 06 22 at 23.27.40 1
    Install MSSQL 2019 Developer Edition and SSMS on Windows Oracle/MSSQL/MySQL
  • Always on and Veeam plugin setup
    Install SQL Server Always On & Configure Veeam Plug‑in for SQL Backup

More Related Articles

upgrade Microsoft SQL Server How to upgrade Microsoft SQL Server 2019 to 2022 Oracle/MSSQL/MySQL
sql server installation Install SQL Server 2022 Express and SQL Server Management Studio Oracle/MSSQL/MySQL
image 19 Download your MySQL database from Azure to a local PC with MySQL Workbench AWS/Azure/OpenShift
sql server installation How to Install all Editions of Microsoft SQL Server 2025 Oracle/MSSQL/MySQL
Screenshot 2020 06 22 at 23.27.40 1 Install MSSQL 2019 Developer Edition and SSMS on Windows Oracle/MSSQL/MySQL
Always on and Veeam plugin setup Install SQL Server Always On & Configure Veeam Plug‑in for SQL Backup

Comments (2) on “Install Microsoft SQL Server 2019 and MSSQL Command line tools on Ubuntu Linux”

  1. Avatar photo Gaurav Gupta says:
    17/10/2020 at 2:39 AM

    Hello Christian,

    I did not get SSMS as shown by you in the last pic of this article. Could you please help me with that.

    Log in to Reply
    1. chris Christian says:
      17/10/2020 at 10:47 AM

      Hi Gaurav,

      You will need to download and install the SQL Server Management Studio (SSMS) on your local machine and then initiate a connection to your Db. You can download it from here

      For more information, see https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms?view=sql-server-ver15

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

vexpert-badge-stars-5

Virtual Background

VEEAMLEGEND

Categories

veeaam100

Veeam Vanguard

  • OpenSSL on Windows
    How to Install OpenSSL on Windows Computers Windows
  • dfeef
    How to automatically resolve errors associated with failed dependencies Linux
  • Screenshot 2020 09 19 at 02.22.42
    Remove Windows 10 Apps with DISM: How to remove pre-provisioned apps from Windows Image Windows Server
  • ubuntu 1479782 1280
    Ubuntu Linux post installation of Network Properties, Guest Integration and Web Administration using Cockpit Linux
  • How to Disable Automatic Opening of Previous files in Notepad on Windows 11
    How to Disable Automatic Opening of Previous Files in Notepad on Windows 11 Windows
  • Slide2
    How to Setup Jenkins Pipelines Environment for Docker Container Deployment Containers
  • Creating a WinPE USB Drive Fixing System Boot Issues
    Creating a WinPE USB Drive: Fixing System Boot Issues Windows
  • cloudqueryfeature
    How to Manage Cloud Assets in AWS with CloudQuery AWS/Azure/OpenShift

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,759 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Contact
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon
  • Bsky

Tags

Active Directory Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.