How to install SQL Server on Linux?


In this article, we will see step by step process to install SQL Server 2019 on Redhat Linux on a virtual machine.


  1. Windows Machine ( in my case it is Win-10)
  2. Create Redhat account first and download RHEL Enterprise edition from here
  3. Install Oracle VM Virtual box from here
  4. System Ram: 2GB or more
  5. System Disk: 15GB or more
  6. Ensure Virtualization is enabled in Windows BIOS setting.

Below highlighted RHEL 8 iso image need to be downloaded.

Step1: Creating Virtual machine for Redhat Linux

Ensuring that you have already installed Oracle VM virtual box on your Windows machine. but in case if you have not yet downloaded it. click here to download and then proceed further.

Now, open the VM and then click on new icon as shown below.

In below screen, provide name as RHEL and other details would be auto populated and in case they are not, choose correct options like, Type/Version shown below. Choose memory size accordingly and then click create button.

Next, choose disk size(minimum 15GB) and make sure other options are selected as shown in below image and then click create button.

Now, you should see RHEL icon at left hand side.

Next, click on settings — > storage and you would see below screen. once you click on Empty under Controller:IDE , you would see optical drive sign at right hand side. Click on optical drive icon and then select RHEL iso image which we have previously downloaded as part of pre-requisite.

Final screen will look like below.

then click OK.

Next, go to Network setting and ensure settings as shown below. for Name option make sure to select option that is matching to your internet connection name showing under network connection details(see below snap for reference). These settings will make sure that you do not face any internet connectivity issue within your VM.

then click OK.

Step2: Installing Redhat Linux

Now from Oracle VM click on start arrow and proceed for installation as shown below.

select required RHEL iso image file from drop down and then click start button.

Click on the Installation Destination under the system category to create disk partitions, but we will go with the default partition.

Now we do not see any exclamation mark for Installation Destination, however we can see exclamation mark for Root Password. Click on it to set the root password.

Now from installation summary below, we do not see any more exclamation mark, so we can begin the installation.

from above snap we see that License information item with exclamation mark click on it to get that completed before proceeding further.

click on Finish configuration.

we are done with installation now.

Step3: Mandatory subscription registration for Redhat Linux

Without subscription registration we won't be able to install any redhat package(see below error). also check that if internet connectivity is working fine or not otherwise subscription registration will not work.

When we ping, it is not pinging and showing below message

We will make changes in below highlighted file to resolve this issue.

below are the highlighted changes made to the file.

Now restart network service.

After above changes are made, we see that is also pinging.

Now, run the subscription registration and make sure to put same username/password that was used for redhat registration.

subscription-manager register –username <username> –password *****

Now when we install python2, we received below message.

It seems that our system is registered for redhat , however, no subscriptions are attached yet. Check the subscription manager status.

To attach the subscriptions, run below command.

Step4: Install Python2 and openssl on Redhat Linux

As per Microsoft documentation RHEL 8 does not come preinstalled with python2, which is required by SQL Server. Before you begin the SQL Server install steps, make sure to install python2 and openssl.

#yum install python2

# yum install compat-openssl10

Now, Configure python2 as the default interpreter using below command.

# sudo alternatives –config python

Step5: Install SQL Server 2019 on Redhat Linux

  1. Download SQL Server 2019 Red Hat repository configuration file.

# sudo curl -o /etc/yum.repos.d/mssql-server.repo


  • curl: stands for client URL and this command is followed by URL from which we would like to retrieve some kind of data.
  • -o: this parameter stands for output file
  • /etc/yum.repos.d/mssql-server.repo – The yum repository will be saved in /etc/yum.repos.d folder from this url:

2. SQL Server 2019 installation

Now, we will install SQL Server using above MSSQL repo

# sudo yum install -y mssql-server


  • yum: It is package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux
  • install y: Parameter -y means "YES", I agree with installation of mssql-server

3. SQL Server 2019 Configuration

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

To check the status of SQL Server , run the following command.

# sudo systemctl status mssql-server

4. Download Microsoft Red Hat repository

To interact with SQL server we would need sqlcmd tools. so first download another repo so we can use yum to install SQL Server command-line tools.

# sudo curl -o /etc/yum.repos.d/msprod.repo

5. Install mssql-tools 

# sudo yum install -y mssql-tools unixODBC-devel

6. Setting up environment variables 

Setting up environment variables so we don't have to mention full path to run the command line tool and it can be run from any path.

# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
# source ~/.bashrc

7. Testing SQL Server connectivity

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

1 Comment

  1. Arunkumar

    Details documentation..very good contain .

© 2024

Theme by Anders NorĂ©nUp ↑