Microsoft SQL Server 2017 on Debian 9
Tags: sqlserver, database, debian, virtualbox
Published: 2019-05-22 10:47:11

---
title: Microsoft SQL Server 2017 on Debian 9
published: true
description: SQL Server is one of relational database management systems aka RDBMS developed by Microsoft. It is available on Linux since SQL Server 2017 with both installation and Docker image. This post shows how to install it on Debian 9 "stretch".
tags: sqlserver, database, debian, virtualbox
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iv2tpbd5840ykxdz8nw8.png
series: MS SQL Server 2017 on Debian 9
canonical_url: https://scqr.net/en/blog/2019/05/22/microsoft-sql-server-2017-on-debian-9-copy/index.html
---

## Introduction

[Microsoft](https://www.microsoft.com/) [SQL Server](https://www.microsoft.com/sql-server) is one of relational database management systems aka RDBMS.
It is available on [Linux](https://www.linux.org/) since SQL Server 2017 with both installation and [Docker](https://www.docker.com/) image.
This post shows how to install it on [Debian](https://www.debian.org/) 9 "[stretch](https://www.debian.org/releases/stretch/)" (with [VirtualBox](https://www.virtualbox.org/)).

## Tutorial

This post is based on [the official guidance](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup?view=sql-server-2017).

#### Requirements

__2GB RAM__ is absolutely required in order to run setup script after installing the package.
The others are [here](https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup?view=sql-server-2017#system).

#### Preparation

[`sudo`](https://www.sudo.ws/) command is also necessary in running setup script.
Therefore, install it and set it up:

```console
# apt-get install sudo
# visudo
```

Install other packages necessary as preparation.

```console
$ sudo apt-get install curl
```

Add dependencies of `mssql-server`.
First, Install the security package:

```console
$ sudo apt-get install apt-transport-https
```

Next, install older [libssl](https://wiki.openssl.org/index.php/Libssl_API).
Edit `/etc/apt/sources.list` to add a line to the bottom like this:

```diff
+ deb http://ftp.debian.org/debian jessie main
```

Then install it:

```console
$ sudo apt-get update
$ sudo apt-get install libssl1.0
```

Moreover, for the sake of `apt-key add microsoft.asc`:

```console
$ sudo apt-get install gnupg
```

#### Installation

Here we're ready.
Let's add the repository:

```console
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
```

Then install it:

```console
$ sudo apt-get update
$ sudo apt-get install mssql-server
```

Run the setup script:

```console
$ sudo /opt/mssql/bin/mssql-conf setup
```

You can follow the installer.
"Express" edition is free to use [with limitations](https://www.microsoft.com/en-us/sql-server/sql-server-2017-editions#CP_AccordionWithTable).

Finally, restart the service:

```console
$ sudo systemctl restart mssql-server.service
```

## Conclusion

The official guidance shows quickstarts of [RHEL 7.3~](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-red-hat?view=sql-server-2017) / [Suse Linux](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-suse?view=sql-server-2017) / [Ubuntu 16.04](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-2017).
The tutorial of this post is a subspecies of [Ubuntu](https://www.ubuntu.com/)'s.
As I wrote in Introducion, [Docker image is also available](https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-2017&pivots=cs1-bash).

In my early days as an engineer, I didn't imagine SQL Server would become free to use on Linux even with some limitations...🙂

Thank you for your reading.
Happy computing.