This comprehensive guide provides detailed instructions for installing, updating, and uninstalling SQL Server 2017 (14.x), SQL Server 2019 (15.x), and SQL Server 2022 (16.x) on Linux, focusing on “A Guide To Sql Edition 9.” Whether you’re a seasoned database administrator or just getting started, this guide offers valuable insights into deploying and managing SQL Server on Linux platforms.
SQL Server Support Policy
Understanding the SQL Server support policy is crucial for maintaining a stable and secure database environment. Microsoft offers servicing and support for SQL Server on Linux distributions.
Term | Definition |
---|---|
Servicing | Microsoft provides GDR, hotfixes, and security fixes within the product lifecycle for supported distributions. |
Support | Microsoft assists users with issues related to supported distributions. |
Support Policy Details
SQL Server is supported on Linux distributions until the earlier of the distribution’s support lifecycle end or the SQL Server support lifecycle end. It’s vital to stay informed about these dates to ensure continued support and updates.
Servicing Policy Details
During the Mainstream support phase of SQL Server, Cumulative Updates (CUs) are released for all Linux distributions within their Mainstream support period. For Linux distributions transitioning from Mainstream to Extended support, Microsoft may release CUs and bug fixes at its discretion.
After SQL Server moves into the Extended support phase, security updates and General Distribution Release (GDR) fixes are still provided. However, these updates aren’t extended to Linux distributions that have concluded their support period.
Supported Platforms for SQL Server Edition 9
SQL Server is officially supported on Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu. Additionally, it’s supported as a container image, which can be deployed on Kubernetes, OpenShift, and Docker Engine on Linux.
Platform | File system | Installation guide |
---|---|---|
Red Hat Enterprise Linux 7.7 – 7.9 Server 1, or 8.x Server | XFS or EXT4 | Installation guide |
SUSE Linux Enterprise Server v12 SP3 – SP5 2 | XFS or EXT4 | Installation guide |
Ubuntu 18.04 LTS 3 | XFS or EXT4 | Installation guide |
Docker Engine 1.8+ on Linux | N/A | Installation guide |
1 At the end of June 2024, RHEL 7.x transitioned from mainstream maintenance to extended lifecycle support (ELS). For more information, see Red Hat Enterprise Linux Life Cycle.
2 At the end of Oct 2024, SLES v12 will transition from standard general support to long term service pack support (LTSS). For more information, see Product Support Lifecycle Lifecycle Dates by Product.
3 At the end of April 2023, Ubuntu 18.04 LTS transitioned from standard maintenance to expanded security maintenance (ESM). For more information, see Ubuntu 18.04 end of standard support.
It is recommended to utilize supported platforms such as Red Hat Enterprise Linux, SUSE Linux Enterprise Server, and Ubuntu Pro for production workloads. These platforms provide regular OS security updates and support coverage options essential for enterprise database deployments.
System Requirements for SQL Server
Before installing SQL Server on Linux, ensure your system meets the following minimum requirements:
Requirement |
---|
Memory |
File System |
Disk space |
Processor speed |
Processor cores |
Processor type |
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.
When using Network File System (NFS) remote shares in production, adhere to these support requirements:
- Use NFS version 4.2 or higher.
- Locate only the
/var/opt/mssql
directories on the NFS mount.
Configuring Source Repositories
To install or upgrade SQL Server, the latest version needs to be obtained from a configured Microsoft repository. The quickstarts typically use the Cumulative Update CU repository. For more information on configuring repositories, see Configure repositories for installing and upgrading SQL Server on Linux.
Installing SQL Server
SQL Server can be installed on Linux from the command line. Refer to the following quickstarts for detailed instructions:
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 |
SQL Server can also be run on Linux in an Azure virtual machine. See Provision a SQL VM in Azure for more information.
After installation, optimize performance by making extra configuration changes. Refer to Performance best practices and configuration guidelines for SQL Server on Linux for guidance.
Updating or Upgrading SQL Server
To update the mssql-server
package to the latest release, use 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 will download the latest package and replace the binaries located under /opt/mssql/
. User-generated databases and system databases remain unaffected.
To upgrade SQL Server, first change your configured repository to the desired version. Then, use the same update
command. This is only possible if the upgrade path is supported between the two repositories.
Rolling Back SQL Server
To downgrade SQL Server to a previous release, follow these steps:
- Identify the version number of the SQL Server package you want to downgrade to.
- Downgrade to the previous version using the following commands (replace
<version_number>
with the actual version number):
Platform | Package update commands |
---|---|
RHEL | sudo yum downgrade mssql-server-<version_number>.x86_64</version_number> |
SLES | sudo zypper install --oldpackage mssql-server= |
Ubuntu | sudo apt-get install mssql-server=``sudo systemctl start mssql-server |
Note that downgrading is only supported within the same major version, such as SQL Server 2022 (16.x).
Checking the Installed SQL Server Version
To verify your current version and edition of SQL Server on Linux, follow this procedure:
- Install the SQL Server command-line tools sqlcmd and bcp if not already installed.
- Use sqlcmd to run a Transact-SQL command that displays your SQL Server version and edition:
sqlcmd -S localhost -U sa -Q 'select @@VERSION'
Uninstalling SQL Server
To remove the mssql-server
package on Linux, use one of the following commands:
Platform | Package removal commands |
---|---|
RHEL | sudo yum remove mssql-server |
SLES | sudo zypper remove mssql-server |
Ubuntu | sudo apt-get remove mssql-server |
These commands won’t delete the generated database files. To delete the database files, use the following command:
sudo rm -rf /var/opt/mssql/
Unattended Installation
An unattended installation can be performed using environment variables. The following example configures SQL Server Developer edition, accepts the EULA, and sets the sa
password:
sudo MSSQL_PID=Developer ACCEPT_EULA=Y MSSQL_SA_PASSWORD='<password>' /opt/mssql/bin/mssql-conf -n setup
Ensure your password complies with the SQL Server default password policy.
Offline Installation
If your Linux machine lacks access to online repositories, you can download the package files directly from https://packages.microsoft.com.
- Download the database engine package for your platform. Find package download links in the Release notes for SQL Server 2022 on Linux.
- Move the downloaded package to your Linux machine.
- Install the database engine package. Use one of the following commands:
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 |
- Resolve missing dependencies using
apt-get -f install
(on Ubuntu) or manually inspect and resolve dependencies. - Complete the SQL Server setup:
sudo /opt/mssql/bin/mssql-conf setup
License and Pricing
SQL Server licensing is the same for both Linux and Windows. For more information, see How to license SQL Server and SQL Server Licensing Resources and Documents.
Conclusion
This guide provides a comprehensive overview of installing, updating, and managing SQL Server on Linux, tailored for “a guide to SQL edition 9.” By following these guidelines, you can ensure a smooth and efficient deployment process. Always refer to the official Microsoft documentation for the most up-to-date information and best practices.