Install Guide – SQL Server on Linux

Install Guide – SQL Server on Linux

This article provides guidance for installing, updating, and uninstalling SQL Server 2017 and SQL Server 2019 preview on Linux.

Supported platforms

SQL Server 2017 is supported on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu. It is also supported as a Docker image, which can run on Docker Engine on Linux or Docker for Windows/Mac.

Platform Supported version(s) Get
Red Hat Enterprise Linux 7.3, 7.4, 7.5, 7.6 Get RHEL 7.6
SUSE Linux Enterprise Server v12 SP2 Get SLES v12 SP2
Ubuntu 16.04 Get Ubuntu 16.04
Docker Engine 1.8+ Get Docker

Microsoft also supports deploying and managing SQL Server containers by using OpenShift and Kubernetes.

System requirements

SQL Server 2017 has the following system requirements for Linux:

Memory 2 GB
File System XFS or EXT4 (other file systems, such as BTRFS, are unsupported)
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 do not 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, are not supported.
  • Ensure that NFS clients use the ‘nolock’ option when mounting the remote share.

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 SQL Server 2017 Cumulative Update CU repository. But you can instead configure the GDR repository or the Preview (vNext) repository. For more information on repositories and how to configure them, see Configure repositories for SQL Server on Linux.

Install SQL Server 2017

You can install SQL Server 2017 on Linux from the command line. For step-by-step instructions, see one of the following quickstarts:

Install SQL Server 2019 preview

You can install SQL Server 2019 preview on Linux using the same quickstart links in the previous section. However, you must register the Preview (vNext) repository instead of the CU repository. The quickstarts provide instructions on how to do this.

After installing, consider making additional configuration changes for optimal performance.

Update 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 are not affected by this operation.

Rollback SQL Server

To rollback or downgrade SQL Server to a previous release, use the following steps:

  1. Identify the version number for the SQL Server package you want to downgrade to. For a list of package numbers, see the Release notes.

Downgrade to a previous version of SQL Server. In the following commands, replace <version_number> with the SQL Server version number you identified in step one.

Platform Package update command(s)
RHEL sudo yum downgrade mssql-server-<version_number>.x86_64
SLES sudo zypper install --oldpackage mssql-server=<version_number>
Ubuntu sudo apt-get install mssql-server=<version_number>
sudo systemctl start mssql-server

Check installed SQL Server version

To verify your current version and edition of SQL Server on Linux, use the following procedure:

  1. If not already installed, install the SQL Server command-line tools.
  2. Use sqlcmd to run a Transact-SQL command that displays your SQL Server version and edition.
    bash
    sqlcmd -S localhost -U SA -Q 'select @@VERSION'