Quick Guide : How to Install MSSQL Server and create a database on Centos and Red Hat

This Guide also Applies to all version of Microsoft SQL

Prerequisites :
You must have a RHEL 7.3 / Centos 7+ machine with at least 2 GB of memory.

Quick Guide : How to Install MSSQL Server and create a database on Centos and Red Hat

Install Red Hat / Centos Linux on your server.

If you have previously installed a CTP or RC release of SQL Server, you must first remove the old repository before following these steps. For more information, see Configure Linux repositories for SQL Server 2017 and 2019.

For other system requirements, see System requirements for SQL Server on Linux.

Install SQL Server

Note :
The following commands for SQL Server 2019 points to the Centos / RHEL 8 repository. Centos / RHEL 8 does not come preinstalled with python2, which is required by SQL Server.


Before you begin the SQL Server install steps,

execute the command and verify that python2 is selected as the interpreter:

sudo alternatives --config python
# If not configured, install python2 and openssl10 using the following commands: 
sudo yum install python2
sudo yum install compat-openssl10
# Configure python2 as the default interpreter using this command: 
sudo alternatives --config python

To configure SQL Server on RHEL, run the following commands in a terminal to install the mssql-server package:

1. Download the Microsoft SQL Server 2019 Red Hat repository configuration file:

For RHEL7: Bash

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

For RHEL8: Bash

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

2. Run the following commands to install SQL Server: Bash

sudo yum install -y mssql-server

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

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

Note :
Make sure to specify a strong password for the SA account (Minimum length 8 characters, including uppercase and lowercase letters, base 10 digits and/or non-alphanumeric symbols).

4. Once the configuration is done, verify that the service is running: Bash

systemctl status mssql-server

5. To allow remote connections, open the SQL Server port on the firewall on RHEL. The default SQL Server port is TCP 1433. If you are using FirewallD for your firewall, you can use the following commands: Bash

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

One Reply to “Quick Guide : How to Install MSSQL Server and create a database on Centos and Red Hat”

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.