- Installation guidance for SQL Server on Linux
- Supported platforms
- Supported platforms
- System requirements
- Configure source repositories
- Install SQL Server
- Update or Upgrade SQL Server
- Rollback SQL Server
- Check installed SQL Server version
- Uninstall SQL Server
- Unattended install
- Offline install
- Licensing and pricing
- Optional SQL Server features
- Get help
- Настройка репозиториев для установки и обновления SQL Server на Linux
- Репозитории
- Накопительный пакет обновления и GDR
- Настройка репозиториев
- Проверка ранее настроенных репозиториев
- Удаление старого репозитория
- Настройка нового репозитория
- Дальнейшие действия
Installation guidance for SQL Server on Linux
Applies to: SQL Server (all supported versions) — Linux
This article provides guidance for installing, updating, and uninstalling SQL Server 2017 and SQL Server 2019 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 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.7 — 7.9, 8.0 — 8.3 | Get RHEL |
SUSE Linux Enterprise Server | v12 SP3 — SP5 | Get SLES v12 |
Ubuntu | 16.04, 18.04 | Get Ubuntu 18.04 |
Docker Engine | 1.8+ | Get Docker |
Supported platforms
Platform | File System | Installation Guide | Get |
---|---|---|---|
Red Hat Enterprise Linux 7.7 — 7.9, or 8.0 — 8.3 Server | XFS or EXT4 | Installation guide | Get RHEL 8.0 |
SUSE Enterprise Linux Server v12 SP3 — SP5 | XFS or EXT4 | Installation guide | Get SLES v12 |
Ubuntu 16.04 LTS, 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 |
For more information, review the system requirements for SQL Server on Linux. For the latest support policy for SQL Server 2017, 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, 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 Cumulative Update CU repository for SQL Server. But you can instead configure a GDR repository. 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 2017 or SQL Server 2019 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 |
SUSE Linux Enterprise Server (SLES) | 2017 | 2019 |
Ubuntu | 2017 | 2019 |
Docker | 2017 | 2019 |
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 are not 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.
Rollback SQL Server
To rollback 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.
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 2019.
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.
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:
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 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.
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 does not 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 |
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.
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.
Complete the SQL Server setup. Use mssql-conf to complete the SQL Server 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
For answers to frequently asked questions, see the SQL Server on Linux FAQ.
Источник
Настройка репозиториев для установки и обновления SQL Server на Linux
Применимо к: SQL Server (все поддерживаемые версии) — Linux
В это статье описывается, как правильно настроить репозиторий для установки и обновления SQL Server 2017 и SQL Server 2019 в Linux. Вверху страницы в настоящее время выбрана ОС Red Hat (RHEL) .
В это статье описывается, как правильно настроить репозиторий для установки и обновления SQL Server 2017 и SQL Server 2019 в Linux. Вверху страницы в настоящее время выбрана ОС SUSE (SLES) .
В это статье описывается, как правильно настроить репозиторий для установки и обновления SQL Server 2017 и SQL Server 2019 в Linux. Вверху страницы в настоящее время выбрана ОС Ubuntu.
SQL Server 2019 уже доступен! Чтобы опробовать его, настройте новый репозиторий mssql-server-2019, как описано в этой статье. После этого выполните инструкции в руководстве по установке.
Репозитории
При установке SQL Server на Linux необходимо настроить репозиторий Майкрософт. Он используется для получения пакета ядра СУБД (mssql-server) и связанных с ним пакетов SQL Server. В настоящее время существует пять основных репозиториев:
Хранилище | Имя | Описание |
---|---|---|
2019 | mssql-server-2019 | Репозиторий для SQL Server 2019 с накопительным пакетом обновления. |
2019 GDR | mssql-server-2019-gdr | Репозиторий выпуска SQL Server 2019 для общего распространения, предназначенный только для критических обновлений. |
2019, предварительная версия | mssql-server-preview | Репозиторий для предварительной версии и версии релиз-кандидата SQL Server 2019. |
2017 | mssql-server-2017 | Репозиторий для SQL Server 2017 с накопительным пакетом обновления. |
2017 GDR | mssql-server-2017-gdr | Репозиторий выпуска SQL Server 2017 для общего распространения, предназначенный только для критических обновлений. |
Накопительный пакет обновления и GDR
Важно отметить, что для каждого дистрибутива имеются два основных типа репозиториев.
Накопительный пакет обновления. Репозиторий накопительного пакета обновления содержит пакеты для основного выпуска SQL Server, а также все исправления ошибок и улучшения, добавленные с момента этого выпуска. Накопительные пакеты обновления связаны с определенной версий, например SQL Server 2019. Они выпускаются регулярно.
Выпуск для общего распространения (GDR) . Репозиторий GDR содержит пакеты для основного выпуска SQL Server и только критические исправления и обновления для системы безопасности, добавленные с момента этого выпуска. Эти обновления также добавляются в следующий накопительный пакет обновления.
Каждый выпуск накопительного пакета обновления и GDR содержит полный пакет SQL Server и все предыдущие обновления для этого репозитория. Выполнить обновление с выпуска GDR на выпуск накопительного пакета обновления можно путем изменения настроенного репозитория для SQL Server. Можно также перейти на использование любого более раннего выпуска в рамках основной версии (например, 2017).
Выполнить обновление с выпуска GDR на выпуск накопительного пакета обновления можно в любой момент путем изменения репозитория. Обновление с выпуска накопительного пакета обновления на выпуск GDR не поддерживается.
Настройка репозиториев
Чтобы настроить репозитории в Red Hat Enterprise Server (RHEL), выполните инструкции, приведенные в следующих разделах.
Чтобы настроить репозитории в SUSE Linux Enterprise Server (SLES), выполните инструкции, приведенные в следующих разделах.
Чтобы настроить репозитории в Ubuntu, выполните инструкции, приведенные в следующих разделах.
Проверка ранее настроенных репозиториев
Сначала проверьте, есть ли уже зарегистрированный репозиторий SQL Server.
Просмотрите файлы в каталоге /etc/yum.repos.d с помощью следующей команды:
Найдите файл, который служит для настройки каталога SQL Server, например mssql-server.repo.
Выведите содержимое файла.
Настроенный репозиторий указан в свойстве name. Его можно определить по таблице в разделе Репозитории этой статьи.
Сначала проверьте, есть ли уже зарегистрированный репозиторий SQL Server.
Используйте команду zypper info, чтобы получить сведения о ранее настроенном репозитории.
Настроенный репозиторий указан в свойстве Repository. Его можно определить по таблице в разделе Репозитории этой статьи.
Сначала проверьте, есть ли уже зарегистрированный репозиторий SQL Server.
Просмотрите содержимое файла /etc/apt/sources.list.
Найдите URL-адрес пакета mssql-server. Его можно определить по таблице в разделе Репозитории этой статьи.
Удаление старого репозитория
При необходимости удалите старый репозиторий с помощью приведенной ниже команды.
Предполагается, что в предыдущем разделе был определен файл mssql-server.repo.
При необходимости удалите старый репозиторий. В зависимости от типа ранее настроенного репозитория выполните одну из приведенных ниже команд.
Хранилище | Команда для удаления |
---|---|
Предварительная версия (2019) | sudo zypper removerepo ‘packages-microsoft-com-mssql-server-preview’ |
2019 CU | sudo zypper removerepo ‘packages-microsoft-com-mssql-server-2019’ |
2019 GDR | sudo zypper removerepo ‘packages-microsoft-com-mssql-server-2019-gdr’ |
2017 CU | sudo zypper removerepo ‘packages-microsoft-com-mssql-server-2017’ |
2017 GDR | sudo zypper removerepo ‘packages-microsoft-com-mssql-server-2017-gdr’ |
При необходимости удалите старый репозиторий. В зависимости от типа ранее настроенного репозитория выполните одну из приведенных ниже команд.
- Начиная с SQL Server 2019 с накопительным пакетом обновления 3 (CU10), поддерживается Ubuntu 20.04.
- Начиная с SQL Server 2019 с накопительным пакетом обновления 3 (CU3) и SQL Server 2017 с накопительным пакетом обновления 20 (CU20), теперь поддерживается Ubuntu 18.04.
- Если вы используете Ubuntu 16,04, измените приведенный ниже путь на /ubuntu/16.04 вместо /ubuntu/18.04 и используйте правильное имя кода распространения.
Хранилище | Команда для удаления |
---|---|
Предварительная версия (2019) | sudo add-apt-repository -r ‘deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server-preview xenial main’ |
2019 CU | sudo add-apt-repository -r ‘deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/mssql-server-2019 bionic main’ |
2019 GDR | sudo add-apt-repository -r ‘deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/mssql-server-2019-gdr bionic main’ |
2017 CU | sudo add-apt-repository -r ‘deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial main’ |
2017 GDR | sudo add-apt-repository -r ‘deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017-gdr xenial main’ |
Настройка нового репозитория
Настройте новый репозиторий, который будет использоваться для установки и обновления SQL Server. Чтобы настроить выбранный репозиторий, используйте одну из приведенных ниже команд.
Следующие команды для SQL Server 2019 ссылаются на репозиторий RHEL 8. RHEL 8 не входит в состав установки python2, которая требуется для SQL Server. Дополнительные сведения см. в статье по установке компонента python2 и настройке его как интерпретатора по умолчанию в следующем блоге: https://www.redhat.com/en/blog/installing-microsoft-sql-server-red-hat-enterprise-linux-8-beta.
Начиная с SQL Server 2017 с накопительным пакетом обновления 20 (CU20), поддерживается RHEL 8.
Если вы используете RHEL 7 или RHEL 8, убедитесь, что пути соответствуют /rhel/7 или /rhel/8 . Наши пакеты не зависят от дополнительных версий RHEL. Это означает, что, если вы используете RHEL 7.7, для настройки репозитория необходим путь /rhel/7 .
Хранилище | Версия | Get-Help |
---|---|---|
2019 CU | 2019 | sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo |
2019 GDR | 2019 | sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019-gdr.repo |
2017 CU | 2017 | sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2017.repo |
2017 GDR | 2017 | sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2017-gdr.repo |
Настройте новый репозиторий, который будет использоваться для установки и обновления SQL Server. Чтобы настроить выбранный репозиторий, используйте одну из приведенных ниже команд.
Хранилище | Версия | Get-Help |
---|---|---|
2019 CU | 2019 | sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2019.repo |
2019 GDR | 2019 | sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2019-gdr.repo |
2017 CU | 2017 | sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2017.repo |
2017 GDR | 2017 | sudo zypper addrepo -fc https://packages.microsoft.com/config/sles/12/mssql-server-2017-gdr.repo |
Настройте новый репозиторий, который будет использоваться для установки и обновления SQL Server.
- Начиная с SQL Server 2019 с накопительным пакетом обновления 3 (CU10), теперь поддерживается Ubuntu 20.04.
- Начиная с SQL Server 2019 с накопительным пакетом обновления 3 (CU3) и SQL Server 2017 с накопительным пакетом обновления 20 (CU20), теперь поддерживается Ubuntu 18.04.
- Следующие команды ссылаются на репозиторий Ubuntu 18.04. Если вы используете Ubuntu 16.04, в приведенном ниже пути замените /ubuntu/18.04 на /ubuntu/16.04 .
Импортируйте открытые ключи GPG из репозитория.
Чтобы настроить выбранный репозиторий, используйте одну из приведенных ниже команд.
Хранилище | Версия | Get-Help |
---|---|---|
2019 CU | 2019 | sudo add-apt-repository «$(curl https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)» |
2019 GDR | 2019 | sudo add-apt-repository «$(curl https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019-gdr.list)» |
2017 CU | 2017 | sudo add-apt-repository «$(curl https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2017.list)» |
2017 GDR | 2017 | sudo add-apt-repository «$(curl https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2017-gdr.list)» |
Выполните команду apt-get update.
Дальнейшие действия
Настроив нужный репозиторий, можно перейти к установке или обновлению SQL Server и всех связанных пакетов из него.
Помните, что если вы решили использовать краткое руководство для RHEL, целевой репозиторий уже настроен. Не повторяйте этот шаг в руководстве. Это особенно важно в том случае, если вы настраиваете репозиторий GDR, так как в кратком руководстве используется репозиторий накопительного пакета обновления.
Помните, что если вы решили использовать краткое руководство для SLES, целевой репозиторий уже настроен. Не повторяйте этот шаг в руководстве. Это особенно важно в том случае, если вы настраиваете репозиторий GDR, так как в кратком руководстве используется репозиторий накопительного пакета обновления.
Помните, что если вы решили использовать краткое руководство для Ubuntu, целевой репозиторий уже настроен. Не повторяйте этот шаг в руководстве. Это особенно важно в том случае, если вы настраиваете репозиторий GDR, так как в кратком руководстве используется репозиторий накопительного пакета обновления.
Дополнительные сведения об установке SQL Server 2017 на Linux см. в статье Руководство по установке SQL Server на Linux.
Источник