Previously I’ve set up an Ubuntu 24.04 VM, so I figured I’d cover the process of setting up SQL Server 2025 on Ubuntu 24.04.
The post is mainly aimed toward readers who want to start using SQL Server on Linux or who want to test the newest features.
Table of contents
Installing SQL Server 2025 on Ubuntu 24.04 LTS
These steps are performed over SSH, but they work identically in a local terminal.
Since curl is required for the upcoming commands, I’ll first have to install it.
| 1 | sudo apt install curl |
Fetch Microsoft’s public signing key, convert it from ASCII‑armored format to GPG binary format, and store it in a location that’s later referenced by APT source list entries to verify packages signed by Microsoft.
| 1 | curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg |
Then I register the repository for Microsoft SQL Server 2025 on Ubuntu 24.04.
| 1 | 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 |
Now, that all that’s done, I can go ahead and install SQL Server 2025.
| 1 | sudo apt update && sudo apt install -y mssql-server |
At this point, SQL Server 2025 on Ubuntu just needs to be configured before I can start using it.
| 1 | sudo /opt/mssql/bin/mssql-conf setup |
The interactive setup process is fairly straight-forward.

It prompts for the following:
- The Edition of SQL Server 2025 I want to use. In this case I specify 2 for Enterprise Developer.
- To accept the license terms. In which case I type Yes
- The system administrator (sa) password.
Once the setup finishes, I can check the status of the newly installed SQL Server instance.
| 1 | systemctl status mssql-server --no-pager |

Note that the mssql-conf tool isn’t useful only during the initial setup.
It can be used to set or change various SQL Server configuration options, including to reset the sa password and even change the edition of your instance.
Installing the command-line tools
Once SQL Server is up and running, I can also install the SQL Server command line tools.
First, download the Microsoft repository package for Ubuntu 24.04.
| 1 | curl -sSL -O https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb |
Install the repository package.
| 1 | sudo dpkg -i packages-microsoft-prod.deb |
Now, I can install the latest command-line tools for SQL Server on Linux.
| 1 | sudo apt update && sudo apt install -y mssql-tools18 |
During the installation, I get the following prompts to accept EULA.


In both cases, I select Yes and press Enter.
Once the installation finishes, all that’s left to do is add the path to the newly installed binaries in the PATH variable of both .bash_profile and .bashrc and reload the two files.
| 1 2 3 4 | echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bash_profile source ~/.bash_profile echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc source ~/.bashrc |
This is needed to avoid the command not found error, which occurs when paths of the mssql-tools binaries aren’t added to PATH.
At this point, I can use sqlcmd to connect to the instance.
| 1 | sqlcmd -S . -U sa -C |
Note:
- I use the -C option to avoid the SSL certificate error 1416F086.
-S .(dot) is equivalent to-S localhost.
Once I provide the password for the sa login, I can validate that this is indeed SQL Server 2025.
| 1 2 3 | :setvar SQLCMDMAXFIXEDTYPEWIDTH 60 SELECT @@SERVERNAME, @@VERSION; GO |

Post-install configuration
While I’m connected via sqlcmd, I take the opportunity to also set some configuration values that are more in line with the VM’s resources.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | EXEC sys.sp_configure N'show advanced options', N'1'; GO RECONFIGURE WITH OVERRIDE; GO EXEC sys.sp_configure N'cost threshold for parallelism', N'50'; GO EXEC sys.sp_configure N'max server memory (MB)', N'4096'; GO EXEC sys.sp_configure N'backup compression default', N'1'; GO RECONFIGURE WITH OVERRIDE; GO EXEC sys.sp_configure N'show advanced options', N'0'; GO RECONFIGURE WITH OVERRIDE; GO |
In this case I set the following:
- Max memory to 4GB (half of what the VM has allocated). This should be enough for the time being, and I can always bump it up after allocating more RAM to the VM.
- CTP to 50, which is more realistic as opposed to the default of 5, which was decided on hardware from 30 years ago.
- Enable backup compression. This is just in case I ever want to take a backup of database.
Restoring AdventureWorks2025
For the OS level steps I’ll first switch user to mssql.
| 1 | sudo su mssql |
I do this because that’s the user that owns (and as a result has full permissions over) the instance’s root directory, and also to avoid file access issues when restoring the backup.
The instance’s root directory doesn’t contain a backup sub-directory.
| 1 | ls -alth /var/opt/mssql/ |

So I create it.
| 1 | mkdir /var/opt/mssql/backup |
And I can now use that directory to store the .bak file after downloading it.
| 1 2 | curl -sSL -o /var/opt/mssql/backup/AW2025.bak \ 'https://github.com/Microsoft/sql-server-samples/releases/download/adventureworks/AdventureWorks2025.bak' |

At this point I can switch back to my user account.
| 1 | exit |
Now, I need to get the logical file names from the .bak file in order to create the restore command.
| 1 2 3 | sqlcmd -S . -U sa -P S0MeP4sS! -C \ -Q "RESTORE FILELISTONLY FROM DISK = '/var/opt/mssql/backup/AW2025.bak';" | \ tr -s '-' | cut -d ' ' -f 1-2 |

Looks like the data file’s logical name is AdventureWorks and the log file’s is AdventureWorks_log.
Resulting in the following restore command:
| 1 2 3 4 5 6 7 | RESTORE DATABASE [AdventureWorks2025] FROM DISK = N'/var/opt/mssql/backup/AW2025.bak' WITH MOVE N'AdventureWorks' TO N'/var/opt/mssql/data/AdventureWorks2025.mdf', MOVE N'AdventureWorks_log' TO N'/var/opt/mssql/data/AdventureWorks2025_log.ldf', STATS = 25; GO |

And I can do a quick check to validate that the AdventureWorks2025 database is now available and online on the instance.
| 1 2 3 4 | :setvar SQLCMDMAXVARTYPEWIDTH 30 :setvar SQLCMDMAXFIXEDTYPEWIDTH 30 SELECT name, state_desc FROM sys.databases WHERE database_id > 4; GO |

Connecting through SSMS
I can also use SSMS to connect from my host machine to the SQL Server 2025 instance running on my Ubuntu 24.04 LTS VM.


Conclusion
You now have a fully functional SQL Server 2025 instance on Ubuntu 24.04, equipped with the command‑line tools and a restored sample database. From here you can begin developing, testing, or benchmarking workloads on the latest SQL Server release.