--- title: Install SQL Server 2017 on Linux | Microsoft Docs description: Install, update, and uninstall SQL Server on Linux. This topic covers online, offline, and unattended scenarios. author: rothja ms.author: jroth manager: jhubbard ms.date: 10/02/2017 ms.topic: article ms.prod: sql-linux ms.technology: database-engine ms.assetid: 565156c3-7256-4e63-aaf0-884522ef2a52 --- # Installation guidance for SQL Server on Linux [!INCLUDE[tsql-appliesto-sslinux-only](../includes/tsql-appliesto-sslinux-only.md)] This topic explains how to install, update, and uninstall SQL Server 2017 on Linux. SQL Server 2017 is supported on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu. It is also available as a Docker image, which can run on Docker Engine on Linux or Docker for Windows/Mac. > [!TIP] > To get started quickly, jump to one of the quick start tutorials for [RHEL](quickstart-install-connect-red-hat.md), [SLES](quickstart-install-connect-suse.md), [Ubuntu](quickstart-install-connect-ubuntu.md), or [Docker](quickstart-install-connect-docker.md). ## Supported platforms SQL Server 2017 is supported on the following Linux platforms: | Platform | Supported version(s) | Get |-----|-----|----- | **Red Hat Enterprise Linux** | 7.3 | [Get RHEL 7.3](http://access.redhat.com/products/red-hat-enterprise-linux/evaluation) | **SUSE Linux Enterprise Server** | v12 SP2 | [Get SLES v12 SP2](https://www.suse.com/products/server) | **Ubuntu** | 16.04 | [Get Ubuntu 16.04](http://www.ubuntu.com/download/server) | **Docker Engine** | 1.8+ | [Get Docker](http://www.docker.com/products/overview) ## System requirements SQL Server 2017 has the following system requirements for Linux: ||| |-----|-----| | **Memory** | 3.25 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. ## Install SQL Server You can install SQL Server on Linux from the command-line. For instructions, see one of the following quick start tutorials: - [Install on Red Hat Enterprise Linux](quickstart-install-connect-red-hat.md) - [Install on SUSE Linux Enterprise Server](quickstart-install-connect-suse.md) - [Install on Ubuntu](quickstart-install-connect-ubuntu.md) - [Run on Docker](quickstart-install-connect-docker.md) ## 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](sql-server-linux-release-notes.md). 1. 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` | > [!NOTE] > It is only supported to downgrade to a release within the same major version, such as SQL Server 2017. > [!IMPORTANT] > Downgrade is only supported between RTM, RC2, and RC1 at this time. ## Change source repositories When you install or upgrade SQL Server, you get the latest version of SQL Server from your configured Microsoft repository. It is important to note that there are two main types of repositories for each distribution: - **Cumulative Updates (CU)**: The Cumulative Update (CU) repository contains packages for the base SQL Server release and any bug fixes or improvements since that release. Cumulative updates are specific to a release version, such as SQL Server 2017. They are released on a regular cadence. - **GDR**: The GDR repository contains packages for the base SQL Server release and only critical fixes and security updates since that release. These updates are also added to the next CU release. Each CU and GDR release contains the full SQL Server package and all previous updates for that repository. Updating from a GDR release to a CU release is supported by changing your configured repository for SQL Server. You can also [downgrade](#rollback) to any release within your major version (ex: 2017). > [!NOTE] > Updating from a CU release to a GDR release is not supported. To change from the GDR repository to the CU repository use the following steps: 1. Remove the previously configured preview repository. | Platform | Repository removal command | |-----|-----| | RHEL | `sudo rm -rf /etc/yum.repos.d/mssql-server.repo` | | SLES | `sudo zypper removerepo 'packages-microsoft-com-mssql-server'` | | Ubuntu | `sudo add-apt-repository -r 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server xenial main'` | 1. Configure the new repository. | Platform | Repository | Command | |-----|-----|-----| | RHEL | CU | `sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo` | | RHEL | GDR | `sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/7/mssql-server-2017-gdr.repo` | | SLES | CU | `sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2017.repo` | | SLES | GDR | `sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2017-gdr.repo` | | Ubuntu | CU | `sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"` | | Ubuntu | GDR | `sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017-gdr.list)"` | 1. Update your system. | Platform | Update command | |-----|-----| | RHEL | `sudo yum update` | | SLES | `sudo zypper --gpg-auto-import-keys refresh` | | Ubuntu | `sudo apt-get update` | 1. [Install](#platforms) or [update](#upgrade) SQL Server from the new repository. > [!IMPORTANT] > At this point, if you choose to perform a full installation using the [quickstart tutorials](#platforms), remember that you have just configured the target repository. Do not repeat that step in the tutorials. This is especially true if you configure the GDR repository, because the quickstart tutorials use the CU repository. ## 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 does not delete the generated database files. If you want to delete the database files, use the following command: ```bash sudo rm -rf /var/opt/mssql/ ``` ## Unattended install You can perform an unattended installation in the following way: - Follow the initial steps in the [quick start tutorials](#platforms) to register the repositories and install SQL Server. - When you run `mssql-conf setup`, set [environment variables](sql-server-linux-configure-environment-variables.md) and use the `-n` (no prompt) option. The following example configures the Developer edition of SQL Server 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. ```bash 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: - [Red Hat unattended installation script](sample-unattended-install-redhat.md) - [SUSE unattended installation script](sample-unattended-install-suse.md) - [Ubuntu unattended installation script](sample-unattended-install-ubuntu.md) ## Offline install If your Linux machine does not have access to the online repositories used in the [quick starts](#platforms), you can download the package files directly. These packages are located in the Microsoft repository, [https://packages.microsoft.com](https://packages.microsoft.com). > [!TIP] > If you successfully installed with the steps in the quick starts, you do not need to download or manually install the package(s) below. This section is only for the offline scenario. 1. **Download the database engine package for your platform**. Find package download links in the package details section of the [Release Notes](sql-server-linux-release-notes.md). 1. **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. 1. **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 removal 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. 1. **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 SQL Server. 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 resolving the missing dependencies, attempt to install the mssql-server package again. 1. **Complete the SQL Server setup**. Use **mssql-conf** to complete the SQL Server setup: ```bash sudo /opt/mssql/bin/mssql-conf setup ``` ## Next steps After installation, you can also install other optional SQL Server packages. - [SQL Server command-line tools](sql-server-linux-setup-tools.md) - [SQL Server Agent](sql-server-linux-setup-sql-agent.md) - [SQL Server Full Text Search](sql-server-linux-setup-full-text-search.md) - [SQL Server Integration Services (Ubuntu)](sql-server-linux-setup-ssis.md) Connect to your SQL Server instance to begin creating and managing databases. To get started, see the quick start tutorials: - [Install on Red Hat Enterprise Linux](quickstart-install-connect-red-hat.md) - [Install on SUSE Linux Enterprise Server](quickstart-install-connect-suse.md) - [Install on Ubuntu](quickstart-install-connect-ubuntu.md) - [Run on Docker](quickstart-install-connect-ubuntu.md)