Delen via


Installation guidance for SQL Server on Linux

van toepassing op:SQL Server- - 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 only need step-by-step installation instructions, jump to one of the quickstarts:

Zie de SQL Server op Linux FAQvoor antwoorden op veelgestelde vragen.

Ondersteuningsbeleid voor SQL Server

Termijn Definitie
Het Onderhoud Microsoft brengt GDR, hotfixes en beveiligingsoplossingen uit binnen de levenscyclus van het product voor ondersteunde distributies.
Ondersteuning Microsoft ondersteunt gebruikers met problemen met betrekking tot ondersteunde distributies.

Ondersteuningsbeleid

SQL Server wordt ondersteund op Linux-distributies tot de eerdere van twee gebeurtenissen: het einde van de ondersteuningslevenscyclus van de distributie of het einde van de levenscyclus van sql Server-ondersteuning.

Onderhoudsbeleid

Tijdens de basisondersteuningsfase van SQL Server bieden we cumulatieve updates (CU's) voor alle Linux-distributies die zich ook binnen hun basisondersteuningsperiode bevinden. Voor Linux-distributies die overstappen van basisondersteuning naar uitgebreide ondersteuning en nog steeds worden herkend als ondersteunde platforms, kan Microsoft naar eigen goeddunken CU's en oplossingen voor fouten vrijgeven.

Zodra SQL Server verder gaat dan basisondersteuning en in de uitgebreide ondersteuningsfase, blijven we beveiligingsupdates en GDR-oplossingen (General Distribution Release) publiceren. Deze updates worden echter niet uitgebreid naar Linux-distributies die hun ondersteuningsperiode afsluiten.

Ondersteunde platforms

SQL Server 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.

Platvorm File system Installatiehandleiding
Red Hat Enterprise Linux 7.7 - 7.9 Server 1en 8.x Server XFS or EXT4 Installatiehandleiding
SUSE Linux Enterprise Server v12 SP3 - SP5 2 XFS or EXT4 Installatiehandleiding
Ubuntu 18.04 LTS 3 XFS or EXT4 Installatiehandleiding
Docker Engine 1.8+ op Linux Niet van toepassing. Installatiehandleiding

1 Eind juni 2024 is RHEL 7.x overgestapt van basisonderhoud naar ondersteuning voor uitgebreide levenscyclus (ELS). Zie Red Hat Enterprise Linux Life Cyclevoor meer informatie.

2 Aan het einde van oktober 2024 is SLES v12 overgestapt van standaard algemene ondersteuning naar langetermijnondersteuning voor servicepacks (LTSS). Zie levenscyclusdatums voor productondersteuning per productvoor meer informatie.

3 Eind april 2023 is Ubuntu 18.04 LTS overgestapt van standaardonderhoud naar uitgebreid beveiligingsonderhoud (ESM). Zie Ubuntu 18.04 einde van de standaardondersteuningvoor meer informatie.

Hint

Raadpleeg de systeemvereisten voor SQL Server op Linux voor meer informatie. Zie het Technische ondersteuningsbeleid voor Microsoft SQL Servervoor het meest recente ondersteuningsbeleid voor SQL Server.

U moet productieworkloads uitvoeren op ondersteunde platforms zoals Red Hat Enterprise Linux, SUSE Linux Enterprise Serveren Ubuntu Pro-, omdat ze regelmatig beveiligingsupdates voor het besturingssysteem ontvangen en ondersteuningsopties hebben die u nodig hebt voor enterprise-database-implementaties.

Platvorm File system Installatiehandleiding Get
Red Hat Enterprise Linux 7.7 - 7.9 Server 1en 8.x Server XFS or EXT4 Installatiehandleiding RHEL 8 ophalen
SUSE Linux Enterprise Server v12 (SP3 - SP5) 2, or v15 XFS or EXT4 Installatiehandleiding Download SLES v15
Ubuntu 18.04 3 or 20.04 XFS or EXT4 Installatiehandleiding Ubuntu 20.04- downloaden
Docker Engine 1.8+ op Windows, Mac of Linux Niet van toepassing. Installatiehandleiding Docker downloaden

1 Eind juni 2024 is RHEL 7.x overgestapt van basisonderhoud naar ondersteuning voor uitgebreide levenscyclus (ELS). Zie Red Hat Enterprise Linux Life Cyclevoor meer informatie.

2 Aan het einde van oktober 2024 is SLES v12 overgestapt van standaard algemene ondersteuning naar langetermijnondersteuning voor servicepacks (LTSS). Zie levenscyclusdatums voor productondersteuning per productvoor meer informatie.

3 Eind april 2023 is Ubuntu 18.04 LTS overgestapt van standaardonderhoud naar uitgebreid beveiligingsonderhoud (ESM). Zie Ubuntu 18.04 einde van de standaardondersteuningvoor meer informatie.

Hint

Raadpleeg de systeemvereisten voor SQL Server op Linux voor meer informatie. Zie het Technische ondersteuningsbeleid voor Microsoft SQL Servervoor het meest recente ondersteuningsbeleid voor SQL Server.

U moet productieworkloads uitvoeren op ondersteunde platforms zoals Red Hat Enterprise Linux, SUSE Linux Enterprise Serveren Ubuntu Pro-, omdat ze regelmatig beveiligingsupdates voor het besturingssysteem ontvangen en ondersteuningsopties hebben die u nodig hebt voor enterprise-database-implementaties.

Platvorm File system Installatiehandleiding Get
Red Hat Enterprise Linux 8.x Server, or 9.x Server XFS or EXT4 Installatiehandleiding RHEL 9- ophalen
SUSE Linux Enterprise Server v15 (SP1 - SP4) XFS or EXT4 Installatiehandleiding Download SLES v15
Ubuntu 20.04, or 22.04 XFS or EXT4 Installatiehandleiding Ubuntu 22.04 downloaden
Docker Engine 1.8+ op Linux Niet van toepassing. Installatiehandleiding Docker downloaden

Hint

Raadpleeg de systeemvereisten voor SQL Server op Linux voor meer informatie. Zie het Technische ondersteuningsbeleid voor Microsoft SQL Servervoor het meest recente ondersteuningsbeleid voor SQL Server.

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

Opmerking

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, review the Support policy section of the Technical support policy for Microsoft SQL Server to understand the support implications.

Systeemvereisten

SQL Server has the following system requirements for Linux:

Voorwaarde
Memory 2 GB 1
bestandssysteem 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 SQL Server 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. Oudere versies van NFS bieden geen ondersteuning voor vereiste functies, zoals fallocate en het maken van dunne bestanden, die veel voorkomen in moderne bestandssystemen.
  • Locate only the /var/opt/mssql directories on the NFS mount. Andere bestanden, zoals de binaire bestanden van het SQL Server-systeem, worden niet ondersteund.

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 installing and upgrading SQL Server on Linux.

SQL Server installeren

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

Platvorm 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 extra 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:

Platvorm 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 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 step 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:

  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:

  2. 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 1.

    Platvorm Package update commands
    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

Opmerking

The only supported downgrade is if you 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:

  1. If not already installed, see Install the SQL Server command-line tools sqlcmd and bcp on Linux.

  2. Use sqlcmd to run a Transact-SQL command that displays your SQL Server version and edition.

    sqlcmd -S localhost -U sa -Q 'select @@VERSION'
    

SQL Server verwijderen

To remove the mssql-server package on Linux, use one of the following commands based on your platform:

Platvorm 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/

Installatie zonder toezicht

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 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

Waarschuwing

Uw wachtwoord moet voldoen aan het standaard SQL Server-wachtwoordbeleid . Standaard moet het wachtwoord ten minste acht tekens lang zijn en tekens bevatten uit drie van de volgende vier sets: hoofdletters, kleine letters, basis-10 cijfers en symbolen. Wachtwoorden mogen maximaal 128 tekens lang zijn. Gebruik wachtwoorden die zo lang en complex mogelijk zijn.

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, at https://packages.microsoft.com.

Hint

If you successfully installed with the steps in the quick starts, you don't need to download or manually install the SQL Server package(s). 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 for SQL Server 2022 on Linux.

  2. Move the downloaded package to your Linux machine. Als u een andere computer hebt gebruikt om de pakketten te downloaden, kunt u de pakketten op uw Linux-computer verplaatsen met de opdracht scp.

  3. 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.

    Platvorm 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

    Opmerking

    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.

  4. Ontbrekende afhankelijkhedenoplossen: op dit moment zijn er mogelijk ontbrekende afhankelijkheden. Zo niet, dan kunt u deze stap overslaan. 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:

    Platvorm 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.

  5. Complete the SQL Server setup. Use mssql-conf to complete the SQL Server setup:

    sudo /opt/mssql/bin/mssql-conf setup
    

License 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, and SQL Server Licensing Resources and Documents.

Optional SQL Server features

After installation, you can also install or enable optional SQL Server features.

Hulp krijgen

Bijdragen aan SQL-documentatie

Wist u dat u zelf SQL-inhoud kunt bewerken? Door dit te doen helpt u niet alleen onze documentatie te verbeteren, maar krijgt u ook erkenning als bijdrager aan de pagina.

Zie Microsoft Learn-documentatie bewerkenvoor meer informatie.