How to Install and Use Microsoft SQL Server (MS SQL) on RHEL 7, CentOS 7 and Ubuntu 16.04 LTS

Earlier this year Microsoft announced to bring its SQL Server to the Linux on March 7, 2016 which will enable SQL Server to deliver a consistent data platform across Linux distributions. SQL Server on Linux customers will get, more flexibility, performance improvements, significant cost savings, less resources and even more.

Microsoft targeted Enterprise customers and got good feedback because 50% of Fortune 500 companies requested for the private preview.

Microsoft has announced Linux public preview, first preview of next release of SQL Server on November 16, 2016 for Red Hat Enterprise Linux 7 (Centos 7 also supported) & Ubuntu 16.04 LTS and packages for SUSE Linux Enterprise Server will be coming soon as well.

Microsoft offered traditional Linux packages of RPM & APT for SQL Server. Also its offering additional SQL Server tools to manage SQL Server, including SQL Server Management Studio (SSMS), Visual Studio SQL Server Data Tools (SSDT) and SQL Server PowerShell.

The new SQL Server Migration Assistant (SSMA) 7.1 release helps you quickly convert Oracle, MySQL, Sybase, and DB2 databases to SQL Server on both Linux and Windows.

SQL Server required minimum 3.25 GB of RAM to run on Linux box.

Install SQL Server on RHEL/CentOS 7

Simply download the .repo file into /etc/yum.repos.d/ directory and use the YUM command to perform the installation.

Install SQL Server

# curl https://packages.microsoft.com/config/rhel/7/mssql-server.repo > /etc/yum.repos.d/mssql-server.repo
# yum install -y mssql-server

After the package installation finishes, run the configuration script and follow the prompts to accept the license terms and setup password for SA account.

# /opt/mssql/bin/sqlservr-setup

open a port on the FirewallD to allow external communication to database.

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

Check the SQL Server status.

# systemctl status mssql-server

Install SQL Server tools Add the below repo to install SQL Server Command-line tools, which contains Microsoft ODBC drivers, and their dependencies.

  • sqlcmd: Command-line query utility.
  • bcp: Bulk import-export utility.
# curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/msprod.repo
# yum install mssql-tools

Magesh Maruthamuthu

Love to play with all Linux distribution

You may also like...