- Microsoft SQL Server 2017 on Debian 9
- Tutorial
- Requirements
- Preparation
- Installation
- Conclusion
- Installation guidance for SQL Server on Linux
- Supported platforms
- System requirements
- Configure source repositories
- Install SQL Server
- Update or upgrade SQL Server
- Roll back SQL Server
- Check installed SQL Server version
- Uninstall SQL Server
- Unattended install
- Offline install
- Licensing and pricing
- Optional SQL Server features
- Get help
- Contribute to SQL documentation
- Next steps
Microsoft SQL Server 2017 on Debian 9
Microsoft SQL Server is one of relational database management systems aka RDBMS.
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» (with VirtualBox).
Tutorial
Requirements
2GB RAM is absolutely required in order to run setup script after installing the package.
The others are here.
Preparation
# apt-get install sudo # visudo
$ sudo apt-get install apt-transport-https
+ deb http://ftp.debian.org/debian jessie main
$ sudo apt-get update $ sudo apt-get install libssl1.0
$ sudo apt-get install gnupg
Installation
$ 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
$ sudo apt-get update $ sudo apt-get install mssql-server
$ sudo /opt/mssql/bin/mssql-conf setup
You can follow the installer.
«Express» edition is free to use with limitations. Finally, restart the service:
$ sudo systemctl restart mssql-server.service
Conclusion
The official guidance shows quickstarts of RHEL 7.3~ / Suse Linux / Ubuntu 16.04.
The tutorial of this post is a subspecies of Ubuntu’s.
As I wrote in Introducion, Docker image is also available. 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.
Installation guidance for SQL Server on Linux
This article provides guidance for installing, updating, and uninstalling SQL Server 2017 (14.x), SQL Server 2019 (15.x), and SQL Server 2022 (16.x) on Linux.
For other deployment scenarios, see:
This guide covers several deployment scenarios. If you are only looking for step-by-step installation instructions, jump to one of the quickstarts:
For answers to frequently asked questions, see the SQL Server on Linux FAQ.
Supported platforms
SQL Server is supported on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu. It is also supported as a container image, which can run on Kubernetes, OpenShift, and Docker Engine on Linux.
Platform | File System | Installation Guide |
---|---|---|
Red Hat Enterprise Linux 7.7 — 7.9, or 8.x Server | XFS or EXT4 | Installation guide |
SUSE Enterprise Linux Server v12 SP3 — SP5 | XFS or EXT4 | Installation guide |
Ubuntu 16.04 LTS 1 , 18.04 LTS | XFS or EXT4 | Installation guide |
Docker Engine 1.8+ on Linux | N/A | Installation guide |
1 Support for SQL Server on Ubuntu 16.04 is limited. At the end of April 2021, Ubuntu 16.04 transitioned from its standard five-year maintenance window for long term support (LTS) releases, into extended security maintenance (ESM) support. For more details, see Ubuntu 16.04 LTS transitions to Extended Security Maintenance (ESM) | Ubuntu.
For more information, review the system requirements for SQL Server on Linux. For the latest support policy for SQL Server, see the Technical support policy for Microsoft SQL Server.
Platform | File System | Installation Guide | Get |
---|---|---|---|
Red Hat Enterprise Linux 7.7 — 7.9, or 8.x Server | XFS or EXT4 | Installation guide | Get RHEL 8 |
SUSE Enterprise Linux Server v12 (SP3 — SP5), or v15 (SP1 — SP3) | XFS or EXT4 | Installation guide | Get SLES v15 |
Ubuntu 16.04 LTS 1 , 18.04 LTS, 20.04 LTS | XFS or EXT4 | Installation guide | Get Ubuntu 20.04 |
Docker Engine 1.8+ on Windows, Mac, or Linux | N/A | Installation guide | Get Docker |
1 Support for SQL Server on Ubuntu 16.04 is limited. At the end of April 2021, Ubuntu 16.04 transitioned from its standard five-year maintenance window for long term support (LTS) releases, into extended security maintenance (ESM) support. For more details, see Ubuntu 16.04 LTS transitions to Extended Security Maintenance (ESM) | Ubuntu.
For more information, review the system requirements for SQL Server on Linux. For the latest support policy for SQL Server, see the Technical support policy for Microsoft SQL Server.
Platform | File system | Installation guide | Get |
---|---|---|---|
Red Hat Enterprise Linux 8.x Server | XFS or EXT4 | Installation guide | Get RHEL 8 |
SUSE Enterprise Linux Server v15 (SP1 — SP4) | XFS or EXT4 | Installation guide | Get SLES v15 |
Ubuntu 20.04 LTS | XFS or EXT4 | Installation guide | Get Ubuntu 20.04 |
Docker Engine 1.8+ on Linux | N/A | Installation guide | Get Docker |
For more information, review the system requirements for SQL Server on Linux. For the latest support policy for SQL Server, see the Technical support policy for Microsoft SQL Server.
Microsoft also supports deploying and managing SQL Server containers by using OpenShift and Kubernetes.
SQL Server is tested and supported on Linux for the previously listed distributions. If you choose to install SQL Server on an unsupported operating system, please review the Support policy section of the Technical support policy for Microsoft SQL Server to understand the support implications.
System requirements
SQL Server has the following system requirements for Linux:
Requirement | |
---|---|
Memory | 2 GB |
File System | XFS or EXT4 (other file systems, such as BTRFS, aren’t supported) |
Disk space | 6 GB |
Processor speed | 2 GHz |
Processor cores | 2 cores |
Processor type | x64-compatible only |
If you use Network File System (NFS) remote shares in production, note the following support requirements:
- Use NFS version 4.2 or higher. Older versions of NFS don’t support required features, such as fallocate and sparse file creation, common to modern file systems.
- Locate only the /var/opt/mssql directories on the NFS mount. Other files, such as the SQL Server system binaries, aren’t supported.
Configure source repositories
When you install or upgrade SQL Server, you get the latest version of SQL Server from your configured Microsoft repository. The quickstarts use the Cumulative Update CU repository for SQL Server. For more information on repositories and how to configure them, see Configure repositories for SQL Server on Linux.
Install SQL Server
You can install SQL Server on Linux from the command line. For step-by-step instructions, see one of the following quickstarts:
Platform | Installation quickstarts |
---|---|
Red Hat Enterprise Linux (RHEL) | 2017 | 2019 | 2022 |
SUSE Linux Enterprise Server (SLES) | 2017 | 2019 | 2022 |
Ubuntu | 2017 | 2019 | 2022 |
Docker | 2017 | 2019 | 2022 |
You can also run SQL Server on Linux in an Azure virtual machine. For more information, see Provision a SQL VM in Azure.
After installing, consider making additional configuration changes for optimal performance. For more information, see Performance best practices and configuration guidelines for SQL Server on Linux.
Update or upgrade SQL Server
To update the mssql-server package to the latest release, use one of the following commands based on your platform:
Platform | Package update command(s) |
---|---|
RHEL | sudo yum update mssql-server |
SLES | sudo zypper update mssql-server |
Ubuntu | sudo apt-get update sudo apt-get install mssql-server |
These commands download the newest package and replace the binaries located under /opt/mssql/ . The user generated databases and system databases aren’t affected by this operation.
To upgrade SQL Server, first change your configured repository to the desired version of SQL Server. Then use the same update command to upgrade your version of SQL Server. This is only possible if the upgrade path is supported between the two repositories.
Roll back SQL Server
To roll back or downgrade SQL Server to a previous release, use the following steps:
- Identify the version number for the SQL Server package you want to downgrade to. For a list of package numbers, see the release notes:
- Release notes for SQL Server 2022 on Linux
- Release notes for SQL Server 2019 on Linux
- Release notes for SQL Server 2017 on Linux
- Downgrade to a previous version of SQL Server. In the following commands, replace with the SQL Server version number you identified in step one.
Platform Package update command(s) RHEL sudo yum downgrade mssql-server-.x86_64 SLES sudo zypper install —oldpackage mssql-server= Ubuntu sudo apt-get install mssql-server=
sudo systemctl start mssql-server
It is only supported to downgrade to a release within the same major version, such as SQL Server 2022 (16.x).
Check installed SQL Server version
To verify your current version and edition of SQL Server on Linux, use the following procedure:
- If not already installed, install the SQL Server command-line tools.
- Use sqlcmd to run a Transact-SQL command that displays your SQL Server version and edition.
sqlcmd -S localhost -U SA -Q 'select @@VERSION'
Uninstall SQL Server
To remove the mssql-server package on Linux, use one of the following commands based on your platform:
Platform | Package removal command(s) |
---|---|
RHEL | sudo yum remove mssql-server |
SLES | sudo zypper remove mssql-server |
Ubuntu | sudo apt-get remove mssql-server |
Removing the package doesn’t delete the generated database files. If you want to delete the database files, use the following command:
Unattended install
You can perform an unattended installation in the following way:
- Follow the initial steps in the quickstarts to register the repositories and install SQL Server.
- When you run mssql-conf setup , set environment variables and use the -n (no prompt) option.
The following example configures SQL Server Developer edition with the MSSQL_PID environment variable. It also accepts the EULA ( ACCEPT_EULA ) and sets the SA user password ( MSSQL_SA_PASSWORD ). The -n parameter performs an unprompted installation where the configuration values are pulled from the environment variables.
sudo MSSQL_PID=Developer ACCEPT_EULA=Y MSSQL_SA_PASSWORD='' /opt/mssql/bin/mssql-conf -n setup
You can also create a script that performs other actions. For example, you could install other SQL Server packages.
For a more detailed sample script, see the following examples:
Offline install
If your Linux machine doesn’t have access to the online repositories used in the quick starts, you can download the package files directly. These packages are located in the Microsoft repository, https://packages.microsoft.com.
If you successfully installed with the steps in the quick starts, you do not need to download or manually install the SQL Server package(s). This section is only for the offline scenario.
- Download the database engine package for your platform. Find package download links in the package details section of the Release Notes.
- Move the downloaded package to your Linux machine. If you used a different machine to download the packages, one way to move the packages to your Linux machine is with the scp command.
- Install the database engine package. Use one of the following commands based on your platform. Replace the package file name in this example with the exact name you downloaded.
Platform Package install command RHEL sudo yum localinstall mssql-server_versionnumber.x86_64.rpm SLES sudo zypper install mssql-server_versionnumber.x86_64.rpm Ubuntu sudo dpkg -i mssql-server_versionnumber_amd64.deb
Note You can also install the RPM packages (RHEL and SLES) with the rpm -ivh command, but the commands in the previous table automatically install dependencies if available from approved repositories.
sudo /opt/mssql/bin/mssql-conf setup
Licensing and pricing
SQL Server is licensed the same for Linux and Windows. For more information about SQL Server licensing and pricing, see How to license SQL Server.
Optional SQL Server features
After installation, you can also install or enable optional SQL Server features.
Get help
Contribute to SQL documentation
Did you know that you can edit SQL content yourself? If you do so, not only do you help improve our documentation, but you also get credited as a contributor to the page.