Installing SQL Server 2019 on Ubuntu 20.04
Steps to install SQL Server 2019 on Ubuntu 20.04 from the Microsoft repository, then check the service and connect.
These are the steps to install SQL Server 2019 on Ubuntu 20.04 from the Microsoft package repository, then connect to the instance from SQL Server Management Studio (SSMS). The current instructions are on Microsoft Learn.
-
Import the Microsoft signing key.
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add - -
Add the SQL Server 2019 repository for Ubuntu 20.04.
sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)" -
Refresh the package index and install the server.
sudo apt-get update sudo apt-get install -y mssql-server -
Run the setup, which asks for the edition and the SA password.
sudo /opt/mssql/bin/mssql-conf setup -
Check that the service runs.
systemctl status mssql-server --no-pager -
Get the IP address of the host.
hostname -I -
Connect from SSMS with that IP address.
Notes
apt-keyandadd-apt-repositoryare older methods, and recent Ubuntu releases warn aboutapt-key. Check the Microsoft Learn page for the current key and repository steps.- The default SQL Server port is 1433. Open it in the firewall when the client runs on another host.