How to Install SQL Server on CentOS 8

How to Install SQL Server on CentOS 8

SQL Server is a relational database management system (RDBMS) developed by Microsoft. Since 2017, Microsoft has released SQL Server for the Linux distributions Red Hat, SUSE, Ubuntu, and Docker. In this tutorial we will install SQL Server on CentOS 8.

System requirements

SQL Server has the following system requirements for Linux:

  • RAM 2GB
  • File System XFS/EXT4
  • Disk Space 6GB
  • CPU speed 2GHz
  • CPU core 2 cores
  • CPU type x64

Install SQL Server 2019

SQL Server 2019 requires python2, while on CentOS 8 python2 is no longer available by default.

Install python2 and compat-openssl10.

Configure python2 as the default interpreter.

Enter 2 for python2.

Download the SQL Server 2019 repository configuration file.

Install SQL Server.

Run myssql-conf setup to provide a password for the SA account and select the SQL Server edition.

Choosing the SQL Server edition, I chose 2) Developer.

Approved the license.

Provide a password for the SQL Server system administrator (SA) account. The password must be at least 8 characters long and contain characters from three of the following four sets: uppercase letters, lowercase letters, numbers, and symbols.

Memeriksa status mssql-server service.

In order to get a remote connection, open the SQL Server port in FirewallD.

Install SQL Server command-line tools

Install the SQL Server command-line tools, sqlcmd and bcp.

Download repository configuration file.

Install mssql-tools.

Add /opt/mssql-tools/bin/ into your PATH environment variable.


Testing is done by logging into SQL Server, creating a database, and inserting data.

Login to SQL Server

Login to SQL Server using sqlcmd. Enter the system administrator password that has been created.

Create a Database

Create a TestDB database.

The command above has not been executed, type GO to execute the previous command.

Displays all databases on the server.

Login & create database
Login & create database

Insert Data

Next create a table and enter two rows of data.

Switch to TestDB.

Create a table with the name Inventory.

Insert data into tables.

Finally type GO to execute the previous command.

Create table & insert data
Create table & insert data

Selecting Data

Select and display data from the Inventory table.

Select data
Select data

Exit sqlcmd

To exit sqlcmd type QUIT.

Leave a Reply

Your email address will not be published. Required fields are marked *