SQL Server 2022 on Ubuntu 24.04 step by step

Comments 0

Share to social media

Microsoft does not yet support this edition of Ubuntu, but there are some workarounds to make it work. This should not be used for production usage and this blog is for educational/testing purposes only.

For my installation, I am using an AWS EC2 Ubuntu 24.04 with 2 GB of Ram. 2GB of RAM is the minimum required. This guide is targeted towards people who have installed SQL Server on previous versions of Ubuntu.

It is not an unknown thing to want to do, as you can see in this thread on learn.microsoft.com. So I went out to see what I would need to do. This guide contains the steps I went through.

There are two major things I will cover installing. SQL Server itself, and then PowerShell Core.

Installing SQL Server Engine

Step 1 Update system packages

To ensure that the host system is up-to-date.

Step 2: Import the Microsoft SQL Server GPG Key

This is the Gnu Privacy Guard key that will be used to encrypt and decrypt files in the install.

Step 3: Add the Microsoft SQL Server Repository

As I said before , Ubuntu 24.04 is still not supported by Microsoft, therefore we can use the Ubuntu 22.04 repository for that because it is compatible.

After that do the system refresh again.

Now we need to install these packages to SQL server works because as of incompatibly with Ubuntu 24.04.

Step 4: Install and Configure Microsoft SQL Server

The next few steps will do the installation steps.

Step 4a: Execute the installation

Step 4b: Select an edition and set a sa password

Most likely, you will select the developer edition (2) that has all features from the enterprise but you cannot use in production environments. This would likely be the only version you would want to install on the unsupported version of Linux.

After that will prompt you to choose the language.

A screen shot of a computer

AI-generated content may be incorrect.

The service is started automatically but you can check typing

Step 5: Install SQL Server Command-Line Tools (sqlcmd and bcp)

Add the Microsoft repository for SQL Server tools

And update again:

Next install mssql-tools:

Next select <yes> for the license terms:

A screenshot of a computer

AI-generated content may be incorrect.

And <yes> again for the next license terms (you can see in the title they are for different things.)

A screenshot of a computer

AI-generated content may be incorrect.

Now let´s add the mssql-tools to the path variable. This way you can call sqlcmd from whatever you be

Step 6: Configure the Firewall

Let´s open the port 1433 to access our SQL Server remotely”

Step 7 – Open the port 1433 on AWS

Next, in the AWS interface for your VM, select the Security tab:

Select the security group

A screenshot of a computer

AI-generated content may be incorrect.

Click on Edit Inbound Rules and click in the add Rule box

Select the MSSQL in the combo box and 0.0.0.0/0 to open the port 1433:

Step 8 – Enable SQL Server agent

If you need the SQL Server Agent, this will enable it for use:

Now you can just connect over the SSMS using the public IPv4 Adress and sa password.

Or you can use sqlcmd

And if we refresh the SSMS:

There are plenty of configurations that you can apply to your instance . To check the list and what is use (or do it in the SSMS)

Installing PowerShell Core

Next we will install PowerShell Core.

Step 1 – Download the required installable files for PowerShell

Step 2 – install the files

Step 3- Update the repository with the latest changes or updates from the Microsoft Updates CDN related to ‘Powershell’ commands or features updates and install ‘Powershell’

Then it is just call Powershell and test it out.

Extra: Installing SQL Server module on Powershell

To install the sql server module it is just (on Powershell terminal)

And now we can use the sql server module

To check whit cmdlets you can use :

If you want to use your favorite PowerShell library, like dbatools, you can now install it. For example, for dbatools:

Conclusion

Now you should have a fully operational version of SQL Server running on the new version of Ubuntu. As a reminder, this is not supported yet, and should only be used for educational/testing purposes.

Article tags

Load comments

About the author

Laerte Junior

See Profile

Laerte Junior is a Cloud and Datacenter Management MVP, focused on PowerShell and automation and, through through his technology blog and simple-talk articles, an an active member of the SQL Server and PowerShell community around the World. He is a skilled Principal Database Architect, Developer, and Administrator, specializing in SQL Server and PowerShell Programming and Automation. He also is PASS Virtual Chapter Mentor , Co-Lead of the PASS PowerShell Virtual Chapter and former PASS Regional Mentor for Brasil. In addition He is also a HUGE Star Wars Fan, his main skill. "May The Force be with us" You should follow him on Twitter as @LaerteSQLDBA

Laerte Junior's contributions