Post

Install SQL Server 2022 on Ubuntu 22.04

Install SQL Server 2022 on Ubuntu 22.04

This guide is based on the Microsoft quickstart guide and focuses on installation on Ubuntu 22.04 only.

Installation

Set up the Microsoft repository:

1
2
3
curl -fsSL https://packages.microsoft.com/keys/microsoft.asc | sudo gpg --dearmor -o /usr/share/keyrings/microsoft-prod.gpg
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

Install SQL Server:

1
2
sudo apt-get update
sudo apt-get install -y mssql-server

Run the configuration setup (select edition and set the SA password):

1
sudo /opt/mssql/bin/mssql-conf setup

(Optional) Disable sa Account

As a security best practice, disable the default sa account after installation:

  1. Create a new login and make it a member of the sysadmin server role
  2. Connect to the SQL Server instance using the new login
  3. Disable the sa account
This post is licensed under CC BY 4.0 by the author.