2021-09-24

Install Microsoft SQL Server on Debian

Short howto on how to best install MSSQL on Debian (bullseye). Based on Microsoft's documentation for Ubuntu.

Import the public repository GPG keys:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Register the Microsoft SQL Server Ubuntu repository for SQL Server 2019:

curl https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

Install SQL Server

sudo apt update
sudo apt-get install mssql-server

Run setup

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

If you plan to connect remotely, you might also need to open the SQL Server TCP port (default 1433) on your firewall.

Next, we'll install the client tools. First add the repository:

curl https://packages.microsoft.com/config/ubuntu/21.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

Next, install the tools

sudo apt update
sudo apt install mssql-tools

The sqlcmd command is installed to /opt/mssql-tools/bin/. To ensure that the command is available on your default PATH environment, create a symbolic to /usr/bin/ 

sudo ln -s /opt/mssql-tools/bin/sqlcmd /usr/bin/

That's it! Give the mssql-server a quick restart for good meausure and you're good to go!

sudo service mssql-server restart

1 comment: