How to Install Microsoft SQL Server 2019 on CentOS 8

Microsoft SQL Server is now available for the Linux system. With a little effort, we can easily install MS SQL Server on Linux. In this article, I am going to show you how to install Microsoft SQL Server 2019 on CentOS 8. On the previous article, I wrote how to install Oracle Database 19c on CentOS 8. Both Oracle Database and MS SQL Server run very well on CentOS 8. It is a good sign for you who wants to build your own database server with CentOS.

Steps to Install Microsoft SQL Server 2019 on CentOS 8

Step 1. Configure the Repository

Connect to CentOS 8 via SSH or directly. And then open Terminal and paste this line below to add the SQL Server repository.

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

Step 2. Install MS SQL Server 2019

Now let’s install the server with this command

dnf -y install mssql-server mssql-tools unixODBC-devel

During the installation, you will need to accept the license agreement.

Install Microsoft SQL Server 2019 on CentOS 8

Next, execute this command to configure SQL Server

/opt/mssql/bin/mssql-conf setup

Choose the SQL Server version from the list.

You will be asked to create password for SA user. Follow the installation steps until complete. Once the installation completes, start SQL Server service.

systemctl start mssql-server
systemctl enable mssql-server

Now let’s check the status

systemctl status mssql-server

Done. At this point, we have successfully installed Microsoft SQL Server 2019 on CentOS 8.

How to Install mssql-cli on CentOS 8

mssql-cli is a command-line tool that can be used to connect and manage your SQL Server, run queries, and so on. You can read more about this tool here. To install mssql-cli on CentOS 8, follow these steps.

Import the public repository GPG keys

rpm --import https://packages.microsoft.com/keys/microsoft.asc

Register the Microsoft product feed

curl https://packages.microsoft.com/config/centos/8/prod.repo > /etc/yum.repos.d/msprod.repo

Install dependencies and mssql-cli

dnf install libunwind
dnf install mssql-cli

Once installed, you can try to connect to the SQL Server

mssql-cli

Enter the username and password we created earlier. When connected, you will see something like this

That’s it. Thanks for reading this article and see you on the other CentOS tutorial.

Be the first to comment

Leave a Reply