This is what ended up working for me. I looked up a lot of posts on this issue, so this will be a combination of solutions.
If you are doing this on a fresh install of 24.04 server, you will still use the 22.04 Jammy MSSQL packages (at least as of the time of this post).
The missing dependency install instructions came from this site
After you install those, you can follow the instructions on MS's site for installing MSSQL server on Ubuntu 22.04. It will give you the curl commands to download the keys and the sources list.
Instruction 1 is going to have 2 links to download the public keys. Use the second one to get the public key to avoid warnings. Using the first curl command to get the public key will likely end up in getting this warning during apt update:
W: Failed to fetch https://packages.microsoft.com/ubuntu/22.04/mssql-server-2022/dists/jammy/InRelease Bad header line Bad header data
To avoid this, you will want to use these commands:
# do as root
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | sudo tee /etc/apt/sources.list.d/mssql-server-2022.list
# wipe out the rebuild apt lists
rm -rf /var/lib/apt/lists/* && apt update
Another post I came across gave me this fix used in the last line, but some users have reported it not working. It did work for me though.
https://github.com/microsoft/vscode/issues/226935
Below are all the steps I took to get mssql-server 22 installed on a fresh install of Ubuntu Server 24.04. These are segments of a script I'm writing to get mssql-server working with php pdo drivers. If you are interested in the rest of the script, let me know in the replies.
None of this should be used on a production setup.
This was tested in a VM using VirtualBox. To test this afterwards, ensure that you have 3 host ports forwarded to guest ports 1431, 1433, and 1434 in the VirtualBox network settings for your VM.
For ease, you may want to run all this as the root user.
# start as root user
sudo su
# download and install libldap-2.5-0
curl -O http://debian.mirror.ac.za/debian/pool/main/o/openldap/libldap-2.5-0_2.5.13+dfsg-5_amd64.deb
dpkg -i libldap-2.5-0_2.5.13+dfsg-5_amd64.deb
# download and install libldap-dev
curl -O http://debian.mirror.ac.za/debian/pool/main/o/openldap/libldap-dev_2.5.13+dfsg-5_amd64.deb
dpkg -i libldap-dev_2.5.13+dfsg-5_amd64.deb
# get key and sources list from microsoft
# The instructions on the MS page gives 2 links for the key.
# Use this line to get the key and avoid "public key not available" warnings
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl -fsSL https://packages.microsoft.com/config/ubuntu/22.04/mssql-server-2022.list | tee /etc/apt/sources.list.d/mssql-server-2022.list
# wipe out the rebuild apt lists
rm -rf /var/lib/apt/lists/* && apt update
# install mssql-server
apt install -y mssql-server
#run the config tool
/opt/mssql/bin/mssql-conf setup
# below is optional if you need mssql-tools18 and unixodbc-dev
# curl https://packages.microsoft.com/config/ubuntu/24.04/prod.list | tee /etc/apt/sources.list.d/mssql-release.list
# apt update
# apt install -y mssql-tools18 unixodbc-dev
After those steps complete, you should be able to connect to your sever from Microsoft SQL Server Management Studio using localhost. Just a disclaimer, I do not have a sql server instance running on my local machine.