title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | ms.custom | ||
---|---|---|---|---|---|---|---|---|---|---|
Installation Guidance for SQL Server on Linux |
Install, update, and uninstall SQL Server on Linux. This article covers online, offline, and unattended scenarios. |
rwestMSFT |
randolphwest |
01/21/2025 |
sql |
linux |
conceptual |
|
[!INCLUDE SQL Server - Linux]
This article provides guidance for installing, updating, and uninstalling [!INCLUDE sssql17-md], [!INCLUDE sssql19-md], and [!INCLUDE sssql22-md] on Linux.
For other deployment scenarios, see:
- Windows
- Linux containers
- Kubernetes - Big Data Clusters ([!INCLUDE sssql19-md] only)
This guide covers several deployment scenarios. If you only need step-by-step installation instructions, jump to one of the quickstarts:
- Quickstart: Install SQL Server and create a database on Red Hat
- Quickstart: Install SQL Server and create a database on SUSE Linux Enterprise Server
- Quickstart: Install SQL Server and create a database on Ubuntu
- Quickstart: Run SQL Server Linux container images with Docker
For answers to frequently asked questions, see the SQL Server on Linux FAQ.
[!INCLUDE support-policy]
[!INCLUDE ssnoversion-md] is supported on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu. It's also supported as a container image, which can run on Kubernetes, OpenShift, and Docker Engine on Linux.
::: moniker range="=sql-server-linux-2017 || =sql-server-2017"
[!INCLUDE linux-supported-platforms-2017]
::: moniker-end
::: moniker range="=sql-server-linux-ver15 || =sql-server-ver15"
[!INCLUDE linux-supported-platforms-2019]
::: moniker-end
::: moniker range=">= sql-server-linux-ver16 || >= sql-server-ver16"
[!INCLUDE linux-supported-platforms-2022]
::: moniker-end
Microsoft also supports deploying and managing [!INCLUDE ssnoversion-md] containers by using OpenShift and Kubernetes.
Note
[!INCLUDE ssnoversion-md] is tested and supported on Linux for the previously listed distributions. If you choose to install [!INCLUDE ssnoversion-md] on an unsupported operating system, review the Support policy section of the Technical support policy for Microsoft SQL Server to understand the support implications.
[!INCLUDE ssnoversion-md] has the following system requirements for Linux:
Requirement | |
---|---|
Memory | 2 GB 1 |
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 |
1 2 GB is the minimum required memory to start [!INCLUDE ssnoversion-md] on Linux, which accommodates system threads and internal processes. You must take this amount into consideration when setting max server memory and MemoryLimitMB.
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 [!INCLUDE ssnoversion-md] system binaries, aren't supported.
When you install or upgrade [!INCLUDE ssnoversion-md], you get the latest version of [!INCLUDE ssnoversion-md] from your configured Microsoft repository. The quickstarts use the Cumulative Update CU repository for [!INCLUDE ssnoversion-md]. For more information on repositories and how to configure them, see Configure repositories for installing and upgrading SQL Server on Linux.
You can install [!INCLUDE ssnoversion-md] 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 [!INCLUDE ssnoversion-md] on Linux in an Azure virtual machine. For more information, see Provision a SQL VM in Azure.
After installing, consider making extra configuration changes for optimal performance. For more information, see Performance best practices and configuration guidelines for SQL Server on Linux.
To update the mssql-server
package to the latest release, use one of the following commands based on your platform:
Platform | Package update commands |
---|---|
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 [!INCLUDE ssnoversion-md], first change your configured repository to the desired version of [!INCLUDE ssnoversion-md]. Then use the same update
command to upgrade your version of [!INCLUDE ssnoversion-md]. This step is only possible if the upgrade path is supported between the two repositories.
[!INCLUDE roll-back-sql-server]
To verify your current version and edition of [!INCLUDE ssnoversion-md] on Linux, use the following procedure:
-
If not already installed, see Install the SQL Server command-line tools sqlcmd and bcp on Linux.
-
Use sqlcmd to run a Transact-SQL command that displays your [!INCLUDE ssnoversion-md] version and edition.
sqlcmd -S localhost -U sa -Q 'select @@VERSION'
To remove the mssql-server
package on Linux, use one of the following commands based on your platform:
Platform | Package removal commands |
---|---|
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:
sudo rm -rf /var/opt/mssql/
You can perform an unattended installation in the following way:
- Follow the initial steps in the quickstarts to register the repositories and install [!INCLUDE ssnoversion-md].
- When you run
mssql-conf setup
, set environment variables and use the-n
(no prompt) option.
The following example configures [!INCLUDE ssdeveloper-md] edition with the MSSQL_PID
environment variable. It also accepts the EULA (ACCEPT_EULA
) and sets the sa
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='<password>' /opt/mssql/bin/mssql-conf -n setup
Caution
[!INCLUDE password-complexity]
You can also create a script that performs other actions. For example, you could install other [!INCLUDE ssnoversion-md] packages.
For a more detailed sample script, see the following examples:
- Sample: Unattended SQL Server installation script for Red Hat Enterprise Linux
- Sample: Unattended SQL Server installation script for SUSE Linux Enterprise Server
- Sample: Unattended SQL Server installation script for Ubuntu
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, at https://packages.microsoft.com.
Tip
If you successfully installed with the steps in the quick starts, you don't need to download or manually install the [!INCLUDE ssnoversion-md] 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 for SQL Server 2022 on Linux.
-
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 therpm -ivh
command, but the commands in the previous table automatically install dependencies if available from approved repositories. -
Resolve missing dependencies: You might have missing dependencies at this point. If not, you can skip this step. On Ubuntu, if you have access to approved repositories containing those dependencies, the easiest solution is to use the
apt-get -f install
command. This command also completes the installation of [!INCLUDE ssnoversion-md]. To manually inspect dependencies, use the following commands:Platform List dependencies command RHEL rpm -qpR mssql-server_versionnumber.x86_64.rpm
SLES rpm -qpR mssql-server_versionnumber.x86_64.rpm
Ubuntu dpkg -I mssql-server_versionnumber_amd64.deb
After you resolve the missing dependencies, you can try installing the
mssql-server
package again. -
Complete the SQL Server setup. Use mssql-conf to complete the [!INCLUDE ssnoversion-md] setup:
sudo /opt/mssql/bin/mssql-conf setup
[!INCLUDE ssnoversion-md] is licensed the same for Linux and Windows. For more information about [!INCLUDE ssnoversion-md] licensing and pricing, see How to license SQL Server, and SQL Server Licensing Resources and Documents.
After installation, you can also install or enable optional [!INCLUDE ssnoversion-md] features.
- Install the SQL Server command-line tools sqlcmd and bcp on Linux
- Install SQL Server Agent on Linux
- Install SQL Server Full-Text Search on Linux
- Install SQL Server 2019 Machine Learning Services (Python and R) on Linux
- Install SQL Server Integration Services (SSIS) on Linux
[!INCLUDE Get Help Options]