We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

Learn how to – Install Microsoft SQL Server 2019 on CentOS 8 / RHEL 8

Learn how to – Install Microsoft SQL Server 2019 on CentOS 8 / RHEL 8.

This guide will walk you through the installation of Microsoft SQL Server (MS SQL) on RHEL / CentOS 8. MS SQL is a relational database system by Microsoft that was open-sourced in 2016. Starting with SQL Server 2017, it is available for production workloads on RHEL and other Linux distributions.

The release of MS SQL Server available for production workloads is MS SQL 2017 and MS SQL 2019. Follow the steps in the next sections to install and run Microsoft SQL Server (MS SQL) 2019 on RHEL / CentOS 8 Linux server.

Below are the minimum system requirements to run MS SQL Server 2019 on CentOS 8 / RHEL 8 Linux:

  • Minimum memory of 3 GB
  • CPU processor with a minimum speed of 1.4 GHz. But the recommended is >= 2 GHz
  • SQL Server requires a minimum of 10 GB of available hard-disk space

Step 1: Add the Microsoft SQL Server 2019 repository

The Microsoft SQL database server packages are available on Red Hat repository which needs to be added manually.

sudo curl https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo -o /etc/yum.repos.d/mssql-server-2019.repo 
sudo  curl https://packages.microsoft.com/config/rhel/8/prod.repo -o /etc/yum.repos.d/msprod.repo

Step 2: Install MS SQL server on RHEL 8 / CentOS 8

All the packages required for Microsoft SQL Server 2019 are available on the repositories added. Just execute the commands below to install MS SQL server on CentOS 8 / RHEL 8 Linux.

sudo dnf -y install mssql-server

Dependency tree:

Dependencies resolved.
 Package                                    Architecture                      Version                                       Repository                                                           Size
 mssql-server                               x86_64                            15.0.4223.1-2                                 packages-microsoft-com-mssql-server-2019                            254 M
Installing dependencies:
 cpp                                        x86_64                            8.5.0-10.el8.alma                             appstream                                                            10 M
 gc                                         x86_64                            7.6.4-3.el8                                   appstream                                                           109 k
 gcc                                        x86_64                            8.5.0-10.el8.alma                             appstream                                                            23 M
 gdb                                        x86_64                            8.2-18.el8                                    appstream                                                           298 k
 gdb-headless                               x86_64                            8.2-18.el8                                    appstream                                                           3.7 M
 glibc-devel                                x86_64                            2.28-189.1.el8                                baseos                                                               78 k
 glibc-headers                              x86_64                            2.28-189.1.el8                                baseos                                                              482 k
 guile                                      x86_64                            5:2.0.14-7.el8                                appstream                                                           3.5 M
 isl                                        x86_64                            0.16.1-6.el8                                  appstream                                                           841 k
 kernel-headers                             x86_64                            4.18.0-372.9.1.el8                            baseos                                                              9.3 M
 libatomic                                  x86_64                            8.5.0-10.el8.alma                             baseos                                                               23 k
 libatomic_ops                              x86_64                            7.6.2-3.el8                                   appstream                                                            38 k
 libbabeltrace                              x86_64                            1.5.4-3.el8                                   baseos                                                              200 k
 libipt                                     x86_64                            1.6.1-8.el8                                   appstream                                                            50 k
 libxcrypt-devel                            x86_64                            4.1.1-6.el8                                   baseos                                                               24 k
Installing weak dependencies:
 gcc-gdb-plugin                             x86_64                            8.5.0-10.el8.alma                             appstream                                                           118 k

Transaction Summary
Install  17 Packages

Total download size: 306 M
Installed size: 1.3 G

Accept License Agreement when you see a prompt:

The license terms for this product can be downloaded from
https://aka.ms/odbc17eula and found in
/usr/share/doc/msodbcsql17/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.

Do you accept the license terms? (Enter YES or NO)

Step 3: Install SQL Server command-line tools

Then install mssql-tools with the unixODBC developer package.

sudo yum -y install mssql-tools unixODBC-devel 

Accept License:

Do you accept the license terms? (Enter YES or NO)
  Installing       : msodbcsql17-                                                                                                                                                2/4
  Running scriptlet: msodbcsql17-                                                                                                                                                2/4
  Running scriptlet: mssql-tools-
The license terms for this product can be downloaded from
http://go.microsoft.com/fwlink/?LinkId=746949 and found in
/usr/share/doc/mssql-tools/LICENSE.txt . By entering 'YES',
you indicate that you accept the license terms.

Do you accept the license terms? (Enter YES or NO)

Confirm installation.

$ rpm -qi mssql-server
Name        : mssql-server
Version     : 15.0.4223.1
Release     : 2
Architecture: x86_64
Install Date: Tue May 17 13:07:24 2022
Group       : Unspecified
Size        : 1297602388
License     : Commercial
Signature   : RSA/SHA256, Mon Apr 18 23:35:10 2022, Key ID eb3e94adbe1229cf
Source RPM  : mssql-server-15.0.4223.1-2.src.rpm
Build Date  : Mon Apr 18 23:01:25 2022
Build Host  : a1a003afc000000.qzwxqe3wa2kubparrevzc0ivhc.xx.internal.cloudapp.net
Relocations : (not relocatable)
Summary     : Microsoft SQL Server Relational Database Engine

$ rpm -qi mssql-tools 
Name        : mssql-tools
Version     :
Release     : 1
Architecture: x86_64
Install Date: Tue May 17 13:08:30 2022
Group       : Applications/Driver
Size        : 730855
License     : http://go.microsoft.com/fwlink/?LinkId=746949
Signature   : RSA/SHA256, Wed Feb  9 20:23:23 2022, Key ID eb3e94adbe1229cf
Source RPM  : mssql-tools-
Build Date  : Wed Feb  9 01:07:07 2022
Build Host  :
Relocations : (not relocatable)
Packager    : Microsoft SQL Tools Team <mssql-tools@microsoft.com>
Summary     : Tools for Microsoft(R) SQL Server (R)
Description :
This Package contains tools for Microsoft(R) SQL Server(R)

Step 4: Initialize MS SQL Database Engine

After the package installation finishes, run mssql-conf setup and follow the prompts to set the SA password and choose your edition.

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

1. Select an edition you’d like to use

Choose an edition of SQL Server:
  1) Evaluation (free, no production use rights, 180-day limit)
  2) Developer (free, no production use rights)
  3) Express (free)
  4) Web (PAID)
  5) Standard (PAID)
  6) Enterprise (PAID)
  7) Enterprise Core (PAID)
  8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-8): 2

For me. I’ll go with 2 – Developer (free, no production use rights).

2. Accept the license terms

The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:

The privacy statement can be viewed at:

Do you accept the license terms? [Yes/No]: Yes

3. Set SQL Server system administrator password:

Enter the SQL Server system administrator password: <Password>
Confirm the SQL Server system administrator password: <Confirm-Password>
Configuring SQL Server... 

ForceFlush is enabled for this instance. 
ForceFlush feature is enabled for log durability.
Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service → /usr/lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

The service should be started and set to start at boot.

$ systemctl status mssql-server.service 
 mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/usr/lib/systemd/system/mssql-server.service; enabled; vendor preset: disabled)
Active: active (running) since  Tue 2022-05-17 13:10:00 EAT; 29s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 8699 (sqlservr)
Tasks: 157
Memory: 727.2M
CGroup: /system.slice/mssql-server.service
├─8699 /opt/mssql/bin/sqlservr
└─8727 /opt/mssql/bin/sqlservr
May 17 13:10:03 cent8.novalocal sqlservr[8699]: [61B blob data]
May 17 13:10:03 cent8.novalocal sqlservr[8699]: [96B blob data]
May 17 13:10:03 cent8.novalocal sqlservr[8699]: [66B blob data]

$ systemctl is-enabled mssql-server.service 

Add /opt/mssql/bin/ to your $PATH variable:

echo 'export PATH=$PATH:/opt/mssql/bin:/opt/mssql-tools/bin' | sudo tee /etc/profile.d/mssql.sh

Source the file to start using MS SQL executable binaries in your current shell session:

source /etc/profile.d/mssql.sh

If you have an active Firewalld service, allow SQL Server ports for remote hosts to connect:

sudo firewall-cmd --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

Step 5: Test SQL Server

Connect to the SQL Server and verify it is working.

$ sqlcmd -S localhost -U SA

Authenticate with the password set in Step 4.

Show Database users:

1> select name from sysusers;
2> go
(16 rows affected)

Create a test database:

SELECT Name from sys.Databases
USE mytestDB
CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
INSERT INTO Inventory VALUES (1, 'banana', 150); INSERT INTO Inventory VALUES (2, 'orange', 154);
SELECT * FROM Inventory LIMIT 1;

Show databases on the SQL Server.

1> select name,database_id from sys.databases; 
2> go
name          database_id
------------- -----------
master                  1
tempdb                  2
model                   3
msdb                    4
testDB                  5
(5 rows affected)

Drop a database:

2> GO

Installation of SQL Server on other Linux systems:


Your Cart is Empty

Back To Shop