SQL Server 2017 Installation on Centos Linux Release 7.4.
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.
Pr-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
SQL Security The National Institute of Standards and Technology (NIST) is a nonregulatory agency of the United States Department of Commerce. In 2015, NIST reported that SQL Server had the lowest number of security vulnerabilities of all the major database systems. SQL Server 2016 and 2017 also support new security features, such as Always Encrypted, which ensures that data remains encrypted all the way to the client application, and Row-Level Security, which provides a fine-grained control over access to sensitive data.
Linux System Status
After installing Linux system, you can access it through putty a tiny software for remote access to Linux based servers. You can download the software https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html For my lab environment I am using https://sils.unc.edu/it-services/personal-computer-faq/using-ssh Secure SSH, you can use any remote SSH as per availability.
Linux System Network Status
Let’s walk through all the steps in detail on a Linux box.
Wget Wget is a computer program that retrieves content from web servers. It is part of the GNU Project. Its name derives from World Wide Web and get. It supports downloading via HTTP, HTTPS, and FTP. We will use wget command to download MSSQL repo.
[root@ms-sql-17-01 ~]# yum -y install wget
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.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= | 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 /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.
The mssql-server package installs a fully functional SQL Server and, after you have configured the SQL Server and opened the necessary firewall ports, you can begin to use it from other machines. For example, you can use Microsoft SQL Server Management Studio 17 installed on a Windows computer to connect to the SQL Server on the RHEL server and create databases. You also use client applications to connect and query data.
However, you do not yet have any tools installed on the RHEL server that you can use to connect to SQL Server and execute queries. To obtain such tools, install the SQL Server command-line tools package.
Installing SQL Server command-line tools
yum install -y mssql-tools unixODBC-devel
For convenience, you might wish to add the SQL command-line tools folder to the PATH environment variable. Use this to execute sqlcmd without specifying its full path. Modify the PATH variable by using the following commands:
Adding SQL command-line tools to the PATH environment variable
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
At this point you can continue further administration for your SQL Server from command line tools such as sqlcmd.