Table of Contents
Traditionally, Microsoft SQL Server, being part of Microsoft’s back office platform, has always run on Windows operating systems. However, Microsoft has made a commitment to enable customers to choose any platform. As part of this commitment, for SQL Server 2017, Microsoft has released SQL Server on Linux. This version of SQL Server will run and host databases on all common distributions of Linux, including Ubuntu, SUSE, and Red Hat Enterprise Linux (RHEL).
In this article i will walk through the steps involved in building MS SQL 2017 on Linux bases OS, Centos release 7.4 on a VMware workstation VM.
Pre-requisites:
- PuTTY / Secure SSH Shell
- CentOS/RHEL Server
- SQL Server 2017 CTP 2.1 and SQL Server 2017 RC1
- SQL Server Management Studio (SSMS) 17.4 S
Linux System Status
Linux System Network Status
This will install the required package of Wget and we will use the same package to get SQL repository.
Get the mssql-server.repo library for SQL database engine.
[root@ms-sql-17-01 ~]# wget https://packages.microsoft.com/config/rhel/7/mssql-server-2017.repo
Get the prod.repo for SQL tools installation by following command.
[root@ms-sql-17-01 ~]# wget https://packages.microsoft.com/config/rhel/7/prod.repo
This is the time to install SQL Server on Linux box by
[root@ms-sql-17-01 ~]# yum y install mssql-server
SA Password for SQL Remote Access
With the following command we will set the password for MS SQL SA account for remote administration.
# echo SA_PASSWORD=”P@ssw0rd″ | sudo tee –append /etc/environment
Let’s configure the SQL instance by accepting the license agreement by following command.
# /opt/mssql/bin/mssql-conf setup
Press 1 to go for the evaluation non-production use
At this point we have successfully installed the MS SQL on Linux box, let’s check & verify it from SQL services by:-
[root@ms-sql-17-01 ~]# systemctl status mssql-server
You can fully disable the firewall in your lab environment or add the required ports in iptables if its in production, you need to open 1433 TCP port in iptables.
/sbin/iptables -A INPUT -p tcp –dport 22 -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp –sport 22 -j ACCEPT
/sbin/iptables -A INPUT -p tcp –dport 1433 -j ACCEPT
/sbin/iptables -A OUTPUT -p tcp –sport 1433 -j ACCEPT
port 22 will be used for remote ssh to Linux Box and 1433 will be use for MS SQL server.
Accessing SQL Server from SSMS
You can download the SSMS latest version from https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-management-studio-ssms and install on your local machine. In my case I have install this on my Windows 10 Pro machine.
You can give your Linux VM ip address with SA password we have configured during installation.
If required ports are opened then it will immediately connect with Server.
Here we are connected with Linux box MS SQL Server and we can continue further administration on the Server through SSMS.
At this point you can continue further administration for your SQL Server from command line tools such as sqlcmd.