How to install sql server in Centos, Ubuntu,Redhat and other Linux Operating system

Install sql server on Linux centos 7

Step by step Sql Server install on Centos 7. The process and install commands are same for different Linux OS.

Prerequisites of Sql Server

You must have a RHEL 7.3, 7.4, 7.5, or 7.6 machine with at least 2 GB of memory.

Step 1. Create repository configuration file at /etc/yum.repos.d with mssql-server.repo full path will be /etc/yum.repos.d/mssql-server.repo

create /etc/yum.repos.d/mssql-server.repo file using following command

/etc/yum.repos.d/mssql-server.repo

past following code in mssql-server.repo file

[packages-microsoft-com-mssql-server-2017]
name=packages-microsoft-com-mssql-server-2017
baseurl=https://packages.microsoft.com/rhel/7/mssql-server-2017/
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc

It’s also you can Download from Microsoft Linux repository store:

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

Step 2. Install SQL Server using following yum command:

#sudo yum install -y mssql-server

Step 3.After installation complete set SA password and configure sqlserver using mssql-conf command and follow the prompts:

#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).

Step 4. Check sql server service status:

#systemctl status mssql-server

Step 5. Enebles TCP port on the firewall if want to allow sql server’s remote connections its default port is  1433.

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

Step 6. Connect sql server with sql shell:

#sqlcmd -S localhost -U SA -P ‘<YourPassword>’

Sql command for testing :

SELECT Name from sys.Databases;
GO; —  use for any command execute
CREATE DATABASE TestDB;

source: docs.microsoft.com 

You may also like...

Leave a Reply

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