How to install SQL Server 2022 on Ubuntu Server 24.04 LTS

Michael F. Assis 25 Reputation points
2024-05-24T00:46:20.3866667+00:00

I couldn't find a proper way to install the SQL Server 2022 on Ubuntu Server 24.04 LTS, I tryed to use the microsoft SQL Server 2022 from Ubuntu 22.04 repo, but couldn't get the service running properly. I ended with this service status (see print).

Is there any way that I can get the service done?Captura de Tela 2024-05-23 às 21.35.32

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,476 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Mike Ratcliffe 40 Reputation points
    2024-09-08T19:47:35.83+00:00

    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

    https://medium.com/@mncubeharmony/resolving-sql-server-startup-issues-on-linux-missing-ldap-libraries-efc5b25e6063

    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.

    https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver16&tabs=ubuntu2204

    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.

    8 people found this answer helpful.

  2. isaul carquin 15 Reputation points
    2024-05-29T17:02:51.09+00:00

    You can install, just need install dependencies manually (liblber-2.5.so.0 // libsasl2.so.3 // libldap-2.5-0) all in x64 bits

    3 people found this answer helpful.

  3. MikeyQiaoMSFT-0444 3,215 Reputation points
    2024-05-24T03:22:26.1333333+00:00

    Hi,Michael F. Assis

    Microsoft has not yet officially released support for SQL Server on Ubuntu Server 24.04 (currently only Ubuntu 20.04 or 22.04 is supported); Refer to this.

    however, you can run SQL Server using Docker technology.

    To install docker in linux refer to https://docs.docker.com/engine/install/

    Best Regards,

    Mikey Qiao


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    2 people found this answer helpful.

  4. Dead Cane Toad 0 Reputation points
    2024-09-03T05:27:49.77+00:00

    I found this post when trying to fix the same issue. I've made it one step closer by adding a Debian repository to /etc/apt/sources.list as per:
    https://packages.debian.org/bookworm/amd64/libldap-2.5-0/download

    The missing package has now installed allowing MS SQL Server to run. Next challenge, actually getting MS SQL server to accept my connection attempts.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.