How to install MSSQL-Server on Ubuntu 22.04

Viewed 5283

I am trying to install MSSQL-Server on my Ubuntu 22.04. I know that it does not currently support Ubuntu 22.04. I need to find a workaround to install the software as I don't want to downgrade.

I tried installing but it keeps giving me dependency errors. How do I solve it? Any help would be appreciated.

2 Answers

Unfortunately, at this time, SQL Server 2019 only works on Ubuntu 20/21. 22.04 is not supported at this time.

So either you will have to use Ubuntu 20 or, as others have stated, use Docker Containers.

You can install Docker into Ubuntu 22.04. It's a multi-step process, but it isn't that difficult.

  1. Install Docker Engine on Ubuntu (follow the Install using the repository section) https://docs.docker.com/engine/install/ubuntu/#set-up-the-repository
  2. Install SQL Server Container https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash

That should do it.

Also, in link #2, read further below on how to connect to your docker image to run SQLCMD from within the container.

Like SQL Server 2019, you cannot install the SQLCMD tools directly into your Ubuntu 22.04 installation. But the Docker container image contains the sqlcmd tool for you to be able to connect to the database.

Or, you can use Visual Studio Code with the SQL Server (mssql) extension and it can connect to your SQL Server instance in your running Docker container.

The connection string would be:

"Server=localhost;Database=your database name;User Id=user id;Password=password"

You can leave out the Database setting if you just want to connect to the default database.

If you create any databases, you can then connect to them directly by specifying the name.

Looked at this and it has worked for me!

So worth giving it a shot

cd /opt/mssql/lib
ls -la
sudo rm libcrypto.so libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1 libcrypto.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.1 libssl.1.1

If libssl is not installed, try:

sudo apt install libssl1.1

Update: I had issues connecting using libssl1.1, so I switched to 1.0 after performing the previous steps, so I also did the following:

sudo systemctl stop mssql-server
sudo systemctl edit mssql-server 

Added:

[Service]
Environment="LD_LIBRARY_PATH=/opt/mssql/lib"

Then:

sudo ln -s /usr/lib/x86_64-linux-gnu/libssl.so.1.0.0 /opt/mssql/lib/libssl.so
sudo ln -s /usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0 /opt/mssql/lib/libcrypto.so

Then started mysql-server and things just worked fine!

Related