This is a 2-part blog post, the first in the series can be found on the Microsoft SQL Server blog here.
The recently released SQL Server 2019 on Linux includes several updated features, including replication, support for Microsoft Distributed Transaction Coordinator, and Change Data Capture (CDC) support. If you’re running SQL Server 2017 on Linux, these are great reasons to upgrade to SQL Server 2019 to take advantage of these updates.
Microsoft SQL Server 2019 was subjected to significant testing and supported to run on several Linux distribution platforms: Red Hat Enterprise Linux (RHEL), SUSE Linux Enterprise Server (SLES), and Ubuntu.
Note: Linux running on Windows 10 isn’t a supported platform for SQL Server.
System Requirements for Microsoft SQL Server 2019 on Linux
Like SQL Server on Windows, there are minimum requirements for running SQL Server 2019 on Linux:
- 2 GB of memory
- XFS or EXT4 file system
- 6 GB of disk space
- 2 GHz processor
- 2 processor cores or 4 virtual CPU
- x64-compatible processor
Network File System, (NFS) remote shares, (mounted file system) has significant benefits, allowing for file system sharing between multiple hosts. SQL Server 2019 on Linux recommends using NFS version 4.2 or higher, which includes support for sparse file creation and fallocate- all features identified with modern file system support.
When using NFS, remember to only keep your datafiles, (those commonly located in /var/opt/mssql) to the shared file system and not the installation, (bin) files for SQL Server. When configuring the NFS client, ensure to use the ‘nolock’ option when mounting the remote share. The reason for setting it to no lock on files is that a relational database engine has it’s own locking mechanism for files and the NFS file system were to implement an underlying lock on the files outside of the relational database, it’s easy to see how problems could occur.
Installing SQL Server
Linux uses repositories to update the OS and packages, including software. Microsoft maintains package repositories for installing SQL Server and supports installation via the most common native package managers per distribution like yum, zypper, and apt-get. For the latest installation information, you can refer to the Microsoft SQL Server 2019 on Linux step-by-step instructions in the quickstart documentation for the appropriate Linux distribution:
Update or upgrade SQL Server
To update the mssql-server package to the latest release, commands are run from the command line to first download the latest updates for the Linux distribution then install or replace the binaries located under the /opt/mssql/ directory.
|RHEL||sudo yum update
sudo yum install –y mssql-server
|SLES||sudo zypper –gpg-auto-import-keys refresh
sudo zypper install -y mssql-server
|Ubuntu||sudo apt-get update
sudo apt-get install mssql-server
To acquire SQL Server 2019 for Linux, you must change the repository being used before you attempt to run the installation steps. Once the repository is pointing to the updated location, the update and installation commands can be executed to upgrade your version of SQL Server to version 2019.
Tips and Tricks to Remember with SQL Server 2019 Installations
- Verifying which version and edition of SQL Server on Linux you’re running can be queried with the sqlcmd tool to run a T-SQL command displaying pertinent version information:
sqlcmd -S localhost -U SA -Q 'select @@VERSION'
- If your Linux machine doesn’t have access to the online repositories documented in the quickstarts, you can download the installation packages directly and install SQL Server 2019 offline. To perform this, see the package download links in the Release Notes and review the instructions for offline installations.
- Performing unattended installations of a SQL Server 2019 on Linux can lesson demands on technical resources. Instructions on how to do this can be found online in Microsoft’s documentation.
- Along with SQL Server 2017, there are numerous other versions of SQL Server to consider upgrading to SQL Server 2019. There are several options for migrating existing databases in older versions of SQL Server from Windows to Linux.
- Use the SQL Server Migration Assistant (SSMA) to migrate data from Oracle and other database engines to SQL Server on Linux, granting the same powerful OS and the powerful new features of SQL Server 2019. SSMA supports migration from several types of database engines including DB2, MySQL, Oracle, and SAP ASE with their additional extension packs.
Armed with this information and these tips and tricks, you’re now ready to install Microsoft SQL Server 2019 on Linux. To learn more about what you can do with Microsoft SQL Server 2019, check out the free Packt guide Introducing Microsoft SQL 19. If you’re ready to jump to a fully managed cloud solution, check out the Essential Guide to Data in the Cloud.