blog.back_article_list

How to install SQL Server on Ubuntu 24.04

How to install SQL Server on Ubuntu 24.04

Updated and tested 16 October 2026

Ubuntu 24.04 accepts exactly one release of SQL Server, and it isn't the one most tutorials still point you at. Four commands do the install. The afternoon people lose goes to the version matrix.

Signing key, repository file, mssql-server, mssql-conf setup, then the tools package and the two settings I change on every Linux instance before it takes a connection. Everything below targets SQL Server 2025, internal version 17.0. To install mssql server on 24.04 you need a key, a repo file, one package and one setup command.

Which SQL Server version runs on Ubuntu 24.04

Check this before you touch apt. The SQL Server 2025 tab of Microsoft's release information for SQL Server on Linux lists RHEL 9.x and 10.x, Ubuntu 22.04 and 24.04, plus Docker Engine 1.8 and later. The 2022 tab on the same page lists RHEL 8.x and 9.x, SLES 15 (SP1 through SP4) and Ubuntu 20.04 and 22.04. Ubuntu 24.04 does not appear on it.

So on 24.04 you install SQL Server 2025. Point apt at mssql-server-2022 on a 24.04 box and the repository resolves perfectly, then apt-get install tells you there's no installation candidate, and the next hour goes on debugging a keyring that was never broken. Two more lines from the 2025 notes matter here. SLES is dropped outright ("Starting with SQL Server 2025, SUSE Linux Enterprise Server (SLES) isn't supported"), and Debian has never been on the supported list at all, whatever the blog posts claim. Data files have to sit on XFS or ext4, which any stock Ubuntu image already gives you.

Running SQL Server in a Docker container sidesteps the distro matrix completely, since the image brings its own userland and the host only has to run Docker. The Windows Server installation is a different process with a different set of problems, and it needs a separate operating system licence underneath it. Everything below assumes you want the engine on the host.

Add the Microsoft signing key and the SQL Server 2025 repository

apt-key is gone. Guides that tell you to pipe Microsoft's key into sudo apt-key add - were written for Ubuntu 18.04, and on 24.04 they either warn loudly or fail outright. Dearmor the key into /usr/share/keyrings instead.

curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --batch --yes --dearmor -o /usr/share/keyrings/microsoft-prod.gpg

If apt later reports that the public key isn't available, the route the quickstart documents for older releases drops the armoured key straight into the trusted directory:

curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc

Now the repository. Microsoft's Ubuntu quickstart pointed 24.04 at the mssql-server ubuntu 22.04 config path in earlier revisions, which looked like a typo and wasn't. The current page registers the 24.04 path:

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

That's the documented command, so that's the one I run. On a 22.04 box, put 22.04 in the path instead, and confirm the URL returns a file before you pipe it into tee. On a 404, -f stops curl from passing the error page along (-S still prints the HTTP error to your terminal), so nothing reaches tee, the sources file stays empty and apt later tells you only that it can't locate mssql-server, which is close to useless as an error.

Install mssql server with apt and run mssql-conf setup

sudo apt-get update
sudo apt-get install -y mssql-server
sudo /opt/mssql/bin/mssql-conf setup

The package drops the binaries and leaves the engine unconfigured. mssql-conf setup picks an edition, accepts the EULA, sets the sa password and starts the service. It runs interactively unless you tell it otherwise.

LumaDock's one-click MSSQL template reaches this same point without the apt work, handing back a running instance. Licensing behaves the way it does on a manual install: Express and Developer run under their own free terms, and Standard or Enterprise needs a key you supply. The rest of this page applies to a templated instance too, since it is the same package from the same repository.

Choosing an edition at the setup prompt

The mssql setup prompt offers three freely licensed editions: Evaluation, Developer and Express. Developer and Express differ in more than the size cap, particularly around the memory ceiling. Developer carries full Enterprise functionality under a development and test licence, which makes it right for a staging box and wrong for anything customer-facing. Express is the free production edition. In SQL Server 2025 its maximum relational database size moved from 10 GB to 50 GB.

The same choice is available without the prompt through MSSQL_PID. For SQL Server 2025 the documented values are Evaluation, Express, StandardDeveloper, Standard, EnterpriseDeveloper, Enterprise, EnterpriseCore or a product key in the form #####-#####-#####-#####-#####. Web is gone from the 2025 list. Microsoft's own setup examples still pass plain Developer, which is what the command below does.

An unattended mssql install with no prompts

sudo MSSQL_PID=Developer ACCEPT_EULA=Y MSSQL_SA_PASSWORD='<password>' /opt/mssql/bin/mssql-conf -n setup

The -n flag is what makes it non-interactive, and it's easy to miss because it sits before the subcommand. Password rules are the standard SQL Server ones: at least eight characters, drawn from three of the four sets (uppercase, lowercase, base-10 digits, symbols) and up to 128 characters long. Wrap it in single quotes or your shell will eat the symbols you added to satisfy that policy.

Check the service with systemctl

systemctl status mssql-server --no-pager

You want active (running). Two seconds more confirms it starts at boot, which matters on any image that came out of a template:

systemctl is-enabled mssql-server
sudo systemctl enable mssql-server

Install mssql-tools18 and connect with sqlcmd

curl -fsSL https://packages.microsoft.com/config/ubuntu/24.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install mssql-tools18 unixodbc-dev

The first line registers the second Microsoft repository, the one the quickstart uses for the tools. Passing ACCEPT_EULA=Y on the command line skips the licence dialog. Leave it off inside an Ansible play and the task hangs forever waiting for a keystroke nobody will press. The binaries land in /opt/mssql-tools18/bin and nothing puts them on your PATH:

echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc

Add the same line to ~/.bash_profile if you want it in login shells as well. Then connect:

sqlcmd -S localhost -U sa -P '<password>'

The -C and -No encryption change in mssql-tools18

This is where everyone arriving from mssql-tools 17 stops dead. In tools 18, -N defaults to m for mandatory. Microsoft's own wording in the sqlcmd reference: "This default is a breaking change from SQL Server 2022 (16.x) and earlier versions, where the default is -No." A fresh install presents a self-signed certificate your client has no reason to trust, so the connection dies before you ever see a 1> prompt.

Two ways past it. -C trusts the server certificate, which is the command line equivalent of TrustServerCertificate=true, and -No makes encryption optional again:

sqlcmd -S localhost -U sa -P '<password>' -C
sqlcmd -S localhost -U sa -P '<password>' -No

The same shift landed in the drivers, so an app that stopped connecting after a routine dependency bump is usually an encryption default in the SQL Server connection string. The server hasn't changed. ODBC Driver 18 flipped Encrypt from no to yes, and it added a strict mode where TrustServerCertificate is ignored and the certificate is validated no matter what you ask for. Against localhost -C is enough; anything crossing a network wants a real certificate.

Once you're in, one query confirms what you installed:

SELECT @@VERSION;
GO

Apply cumulative updates with apt

Patching is the same command as installing. That throws people coming from Windows, where updates arrive as a separate executable you download and run. The repository carries the current cumulative update, so an install command on an installed package is an upgrade:

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

Pin the package if you patch on a schedule and don't want an unrelated apt upgrade moving your database version underneath you. sudo apt-mark hold mssql-server does it, and unhold releases it. I've watched a routine security update carry an instance onto a new CU.

Afterwards, ask the server what it's running:

SELECT SERVERPROPERTY('Edition') AS Edition,
       SERVERPROPERTY('ProductVersion') AS ProductVersion,
       SERVERPROPERTY('ProductLevel') AS ProductLevel,
       SERVERPROPERTY('ProductUpdateLevel') AS UpdateLevel;
GO

ProductLevel comes back as RTM, SPn or CTPn. ProductUpdateLevel gives you the cumulative update directly, as CU8 or similar, and NULL if you're still on RTM. That second column saves the trip to Microsoft's build tables to work out what 17.0.4075.5 means.

Limit SQL Server memory with memory.memorylimitmb

SQL Server claims 80% of physical memory by default. On a 32 GB database server that's exactly what you want. On a 4 GB VPS it's a problem: the remaining fifth has to cover the kernel, sshd, your monitoring agent and whatever else lives on the box, and the first thing that happens under load is that the OOM killer takes an interest in sqlservr.

Set the ceiling explicitly, in megabytes:

sudo /opt/mssql/bin/mssql-conf set memory.memorylimitmb 3328
sudo systemctl restart mssql-server

3328 on a 4 GB machine leaves around 750 MB for everything else. Tight, but it holds, and I'd take a database that runs slightly slower over one the OOM killer picks off mid-query. Every key you set through mssql-conf lands in /var/opt/mssql/mssql.conf, so sudo cat /var/opt/mssql/mssql.conf shows everything you have changed in one screen.

Turn on SQL Server Agent with sqlagent.enabled

SQL Server Agent is disabled by default on Linux. If you've come from Windows and your scheduled jobs sit there doing nothing, that's the answer. I've only ever used it on Linux for nightly backup jobs, so I can't tell you how the stranger job types behave there.

sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true
sudo systemctl restart mssql-server

Two other defaults change in the same sitting. Telemetry is on for every edition, and sudo /opt/mssql/bin/mssql-conf set telemetry.customerfeedback false turns it off, except on Express and Developer, which don't let you opt out. The default backup directory is /var/opt/mssql/data, the same place your .mdf files live, and filelocation.defaultbackupdir moves it somewhere else. A stock mssql server installation keeps all of this under /var/opt/mssql, so that one path is the whole surface you need to back up.

Your idea deserves better hosting

24/7 support 30-day money-back guaranteeRefund covers the VPS plan on your first order. Cancel anytime
Billing Cycle

VPS.S1

$5.99 packages.save  17 %
$4.99 Monthly
  • 2 vCPU AMD EPYC
  • 2 GB RAMPAMIĘĆ
  • 30 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie

VPS.S3

$14.99 packages.save  33 %
$9.99 Monthly
  • 4 vCPU AMD EPYC
  • 6 GB RAMPAMIĘĆ
  • 70 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie

VPS.S4

$19.99 packages.save  20 %
$15.99 Monthly
  • 6 vCPU AMD EPYC
  • 8 GB RAMPAMIĘĆ
  • 80 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie

EPYC VPS.P1

$8.99 packages.save  22 %
$6.99 Monthly
  • 2 vCPU AMD EPYC
  • 4 GB RAMPAMIĘĆ
  • 40 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

EPYC VPS.P2

$16.99 packages.save  24 %
$12.99 Monthly
  • 2 vCPU AMD EPYC
  • 8 GB RAMPAMIĘĆ
  • 80 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

EPYC VPS.P4

$29.99 packages.save  23 %
$22.99 Monthly
  • 4 vCPU AMD EPYC
  • 16 GB RAMPAMIĘĆ
  • 160 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

EPYC VPS.P5

$39.99 packages.save  25 %
$29.99 Monthly
  • 8 vCPU AMD EPYC
  • 16 GB RAMPAMIĘĆ
  • 180 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

EPYC VPS.P6

$59.99 packages.save  25 %
$44.99 Monthly
  • 8 vCPU AMD EPYC
  • 32 GB RAMPAMIĘĆ
  • 200 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

EPYC VPS.P7

$69.99 packages.save  29 %
$49.99 Monthly
  • 16 vCPU AMD EPYC
  • 32 GB RAMPAMIĘĆ
  • 240 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

Genoa VPS.G2

$24.99 packages.save  20 %
$19.99 Monthly
  • 2 vCPUAMD EPYC Genoa 4. generacji 9xx4 z 3,25 GHz lub podobny, na architekturze Zen 4. AMD EPYC G4
  • 4 GB DDR5PAMIĘĆ
  • 50 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

Genoa VPS.G4

$44.99 packages.save  22 %
$34.99 Monthly
  • 4 vCPUProcesor AMD EPYC z dedykowanymi rdzeniami vCPU, na serwerowym sprzęcie dla firm. AMD EPYC G4
  • 8 GB DDR5PAMIĘĆ
  • 100 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

Genoa VPS.G6

$89.99 packages.save  22 %
$69.99 Monthly
  • 8 vCPUProcesor AMD EPYC z dedykowanymi rdzeniami vCPU, na serwerowym sprzęcie dla firm. AMD EPYC G4
  • 16 GB DDR5PAMIĘĆ
  • 200 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

Genoa VPS.G7

$159.99 packages.save  22 %
$124.99 Monthly
  • 8 vCPUProcesor AMD EPYC z dedykowanymi rdzeniami vCPU, na serwerowym sprzęcie dla firm. AMD EPYC G4
  • 32 GB DDR5PAMIĘĆ
  • 250 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii. w cenie
  • Darmowa autokopiaZawiera jeden slot kopii zapasowej, który możesz ustawić na codzienne, cotygodniowe lub comiesięczne uruchamianie.

AMD Ryzen VPS.R1

$16.99 packages.save  18 %
$13.99 Monthly
  • 1 dedykowane CPU AMD Ryzen 9 7950X z 4,5 GHz lub podobny, na architekturze Zen 4. vCPU
  • 4 GB DDR5PAMIĘĆ
  • 50 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6 w cenie Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii.
  • Auto kopia zapasowa w cenie

AMD Ryzen VPS.R2

$29.99 packages.save  17 %
$24.99 Monthly
  • 2 dedykowane CPU AMD Ryzen 9 7950X z 4,5 GHz lub podobny, na architekturze Zen 4. vCPU
  • 8 GB DDR5PAMIĘĆ
  • 100 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6 w cenie Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii.
  • Auto kopia zapasowa w cenie

AMD Ryzen VPS.R4

$109.99 packages.save  18 %
$89.99 Monthly
  • 8 dedykowane CPU AMD Ryzen 9 7950X z 4,5 GHz lub podobny, na architekturze Zen 4. vCPU
  • 32 GB DDR5PAMIĘĆ
  • 400 GB NVMeDYSK
  • Nielimitowane łącze
  • IPv4 & IPv6 w cenie Obsługa IPv6 jest obecnie niedostępna we Francji, Finlandii ani w Holandii.
  • Auto kopia zapasowa w cenie

*VAT excluded.

INCLUDED WITH EVERY PLAN

✓ No setup fees ✓1 Gbps network
✓ Full root access on KVM ✓ Free server monitoring ✓ Firewall management ✓24/7 support

Open TCP 1433 to a trusted source only

Microsoft's quickstart hands you no firewall command for Ubuntu at all, just a note that you may need to open TCP 1433 for remote connections. Firewalls are the distro's business, fair enough. What I'd push back on is the reflex sudo ufw allow 1433/tcp that every tutorial reaches for, because that puts your sa login in front of the whole internet and 1433 gets scanned continuously by people who are not you.

Scope the rule to the address that needs it:

sudo ufw allow from 203.0.113.10 to any port 1433 proto tcp

That's ufw syntax, not something Microsoft publishes. Reaching the engine from another host takes more than a firewall rule, and both enabling remote connections in SQL Server and changing the default port 1433 are worth reading before you expose anything. The cheaper option is to leave 1433 closed and reach the instance over a VPN or an SSH tunnel. One line of config, and the attack surface goes away.

Installation failed: read /var/opt/mssql/log/errorlog

When mssql-conf setup fails or the service refuses to stay up, the error log holds the real reason. systemctl status tells you the process exited and nothing more.

sudo tail -n 50 /var/opt/mssql/log/errorlog

If that comes back as garbage with a null byte between every character, the file is UTF-16LE and your terminal is doing its best:

sudo iconv -f UTF-16LE -t UTF-8 /var/opt/mssql/log/errorlog -o /tmp/errorlog.txt
less /tmp/errorlog.txt

Login failures are their own category, and an error 18456 investigation starts in this file because the client is always shown State 1 and the real state number appears only here. For a failed start, the line that confirms a healthy engine reads Server is listening on [ 'any' <ipv4> 1433]. No such line means it never got that far. The two failures I run into most are a data directory on an unsupported filesystem and a machine with too little RAM for that 80% default, and both say so plainly once the log is readable.

Questions?

Can I install SQL Server Management Studio on Ubuntu?

No, SSMS runs only on Windows, so there is no Ubuntu package for it. On the Ubuntu machine itself, the MSSQL extension for Visual Studio Code covers day-to-day query and object work, and Microsoft supports it on Linux x64 and Arm64. A Windows workstation with SSMS connects to the Linux instance over TCP like it would to any other server; the SSMS setup guide covers that side.

Jörg L. Günther
About the author

Jörg L. Günther

Jörg has spent much of his career in enterprise software, working first with database deployments and customer environments, then in technical training and documentation. Since then he has written for companies working in virtualisation, database tooling and cloud infrastructure. The subjects he takes on often have a large operational component: database migrations, high-availability setups, storage configuration and procedures carried out on live systems. Jörg lives near Frankfurt. He plays piano and cycles for transport as much as for recreation. He's also been doing woodworking for several years - he says most of the furniture in his study is his own work.

Deploy your next project in seconds

Bring your winning ideas online faster, with modern hardware and unmetered bandwidth. Join a European cloud trusted by thousands of developers and businesses worldwide.