How to Install MSSQL on LINUX

Step 1: Add MSSQL 2019 Preview Repo

First, as a best practice, ensure all packages are up to date:

[email protected] ~]# yum update -y

Next, we need to tell the package manager yum where to look for the mssql-server package by adding the appropriate repo:

[email protected] ~]# curl -o /etc/yum.repos.d/mssql-server.repo

Step 2: Install SQL Server

Now that yum is aware of the MSSQL repo, we can use yum to install the package:

[email protected] ~]# yum install -y mssql-server

Step 3: Configure MSSQL Server

Next, we need to configure SQL with a system administrator password and confirm the edition we want to use.

we need to verify that the mssql service is running:

[email protected] ~]# systemctl status mssql-server

The output should look something like this:

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 Wed 2019-10-23 20:18:03 EDT; 2min 45s ago


 Main PID: 61529 (sqlservr)

   CGroup: /system.slice/mssql-server.service

           ├─61529 /opt/mssql/bin/sqlservr

           └─61549 /opt/mssql/bin/sqlservr

Step 4 (Optional): Allow Remote Connections

If you want your SQL server to be accessible remotely, you will have to open up the SQL Server port:

[email protected] ~]# firewall-cmd --zone=public --add-port=1433/tcp --permanent

After adding the rule, we need to reload our firewall rules and verify the port is open:

[[email protected] ~]# firewall-cmd --reload


[email protected] ~]# firewall-cmd --list-ports


Step 5: Add Microsoft Red Hat repository

Now, we need a way to interact with our SQL server. First, let’s add another repo so we can use yum to install SQL Server command-line tools

[email protected] ~]# curl -o /etc/yum.repos.d/msprod.repo

Step 6: Install and setup MSSQL Server command-line tools

Now that yum is aware of the packages we want to install, we need to install them. It’s important to note, during the installation of these packages, there will be a couple of interactive prompts to accept the license terms:

[email protected] ~]# yum install -y mssql-tools unixODBC-devel

For ease of use we can add the path


to the PATH variable on the server so that we can execute sql commands from any location on the server:

[email protected] ~]# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile

[email protected] ~]# source ~/.bashrc

The final step is to verify that we can make a connection to SQL Server:

[email protected] ~]# sqlcmd -S localhost -U SA



Thank you! Have a Great Day.............. :)

Please visit us @ for more related topics.


  • 22 Users Found This Useful
Was this answer helpful?

Related Articles

How to use MySQL Tuner to Optimize the Database

MySQLTuner is a simple Perl script which will help you to collect necessary information and...