TABLE OF CONTENTS
- •Which SQL Server Version Runs on Which Ubuntu Release?
- •Need Help Installing SQL Server on Linux?
- •Installation Steps
- •1. Import the Microsoft Package Repository Key
- •2. Register the SQL Server Repository
- •3. Install the SQL Server Package
- •4. Run mssql-conf Setup
- •5. Verify the Service Is Running
- •6. Open the Firewall for Remote Connections
- •Installing the sqlcmd Command-Line Tool
- •Quick Test: Creating a Database
- •Right After Installation: What to Do First
- •Frequently Asked Questions
- •Planning a Production SQL Server Deployment on Linux?
Since SQL Server 2017, it hasn’t been a Windows-only product anymore. With native Linux support, it now runs everywhere from Docker containers to production Ubuntu servers. This guide walks through installing SQL Server on Ubuntu step by step, which version pairs with which Ubuntu release, and the security steps to take right after installation.
Which SQL Server Version Runs on Which Ubuntu Release?
Picking the right Ubuntu/SQL Server pairing matters before you start — the wrong combination means the package repository simply won’t resolve, and the install fails at the first step. Per Microsoft’s official Ubuntu installation documentation, the current support matrix is:
| SQL Server Version | Supported Ubuntu | Note |
|---|---|---|
| SQL Server 2017 (14.x) | Ubuntu 18.04 | Minimum 2 GB RAM |
| SQL Server 2019 (15.x) | Ubuntu 20.04 | Minimum 2 GB RAM |
| SQL Server 2022 (16.x) | Ubuntu 20.04 / 22.04 | Minimum 2 GB RAM — the most common production choice today |
| SQL Server 2025 (17.x) | Ubuntu 22.04 / 24.04* | *Ubuntu 24.04 support arrived with SQL Server 2025 CU1 |
This guide walks through the most widely deployed combination, SQL Server 2022 on Ubuntu 22.04. The steps are identical for other versions — only the repository URLs change.
Need Help Installing SQL Server on Linux?
Our senior DBA team supports the full installation process for your production environment — from choosing the right version and distribution to performance tuning.
Installation Steps
1. Import the Microsoft Package Repository Key
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
2. Register the SQL Server Repository
For Ubuntu 22.04 with SQL Server 2022:
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list)"
3. Install the SQL Server Package
sudo apt-get update
sudo apt-get install -y mssql-server
4. Run mssql-conf Setup
sudo /opt/mssql/bin/mssql-conf setup
This prompts you to choose an edition (Evaluation, Developer and Express are free) and set a password for the sa account.
Password Requirements
At least 8 characters, and must include characters from at least three of these four sets: uppercase, lowercase, digits, symbols. Maximum length is 128 characters.
5. Verify the Service Is Running
systemctl status mssql-server --no-pager
6. Open the Firewall for Remote Connections
If you’ll connect from another machine, open port 1433:
sudo ufw allow 1433/tcp
Installing the sqlcmd Command-Line Tool
You’ll need sqlcmd to connect from the command line. On Ubuntu 20.04 and later:
sudo apt-get update
sudo apt-get install -y mssql-tools18 unixodbc-dev
Add sqlcmd to your PATH so you don’t have to type the full path every session:
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
Quick Test: Creating a Database
To confirm the installation actually works, connect locally and create a simple database:
sqlcmd -S localhost -U sa -P '<your_password>'
Once connected:
CREATE DATABASE TestDB;
GO
USE TestDB;
GO
CREATE TABLE dbo.Inventory
(
id INT,
name NVARCHAR(50),
quantity INT,
PRIMARY KEY (id)
);
GO
INSERT INTO dbo.Inventory VALUES (1, 'box', 150);
INSERT INTO dbo.Inventory VALUES (2, 'pallet', 40);
GO
SELECT * FROM dbo.Inventory WHERE quantity > 100;
GO
QUIT
If you see the result row come back, the installation is complete.
Right After Installation: What to Do First
- Disable the
saaccount in production. After your first login, create a dedicated sysadmin login under your own name and disablesa— this meaningfully reduces your attack surface. - Set up a backup strategy from day one. SQL Server on Linux uses the exact same backup/restore mechanism as on Windows — schedule regular full/differential/log backups with a maintenance plan or your own script.
- Cap memory and CPU limits. By default SQL Server tries to use all available server memory. On a shared server, limit it with
mssql-conf‘smemory.memorylimitmbsetting.
Frequently Asked Questions
apt, you pull Microsoft’s official mcr.microsoft.com/mssql/server image and run it with environment variables (ACCEPT_EULA, MSSQL_SA_PASSWORD). This guide covers a direct install onto an Ubuntu server, whether a VM or bare metal.mssql-conf setup determines your license tier. Evaluation, Developer, and Express are free; Web, Standard, and Enterprise require a valid license key. You can change the edition later with mssql-conf set-sku.Related Reading
FINAL CTA
Planning a Production SQL Server Deployment on Linux?
Aryasoft’s senior DBA team supports every step of the deployment — from choosing the right version and distribution to backup strategy and performance tuning.