Total Pageviews

Tuesday, March 13, 2018

SQL Server on Linux - Offline SQL Server installation on Redhat/CentOS

The following step-by-step method can be used to install SQL Server 2017 on the latest Redhat or CentOS. Please take a moment to review the Microsoft documentation for more detailed information. Please also note that the Redhat (paid) and CentOS (non-paid) distributions are identical in terms of execution and package deployment.


Convenience tools:
Download and use the following open source tools while working within the Linux/Unix environment.

Linux Terminal Emulator: Putty/Kitty (https://putty.org/)
SSH File transfer: FileZila (https://filezilla-project.org/)

We will be installing SQL Server 2017 on the CentOS Server (https://www.centos.org/) as a root user. Where

CentOS 7.4 Server: linux01 (192.168.0.155)
FQDN: linux01.myhome.org

Step-by-step method to install SQL Server 2017 on Linux:

1. Download all the packages for the Redhat Linux distribution from the following link:

Following are the packages for Redhat/CentOS Linux:

mssql-server-14.0.3022.28-2.x86_64.rpm
mssql-server-fts-14.0.3022.28-2.x86_64.rpm
mssql-server-ha-14.0.3022.28-2.x86_64.rpm
mssql-server-is-14.0.1000.169-1.x86_64.rpm
mssql-tools-14.0.5.0-1.x86_64.rpm
msodbcsql-13.1.6.0-1.x86_64.rpm
unixODBC-2.3.1-11.el7.x86_64.rpm

2. On the Linux server, create a folder such as "sqlpkg" in /home directory
mkdir /home/sqlpkg

3. Move all the packages from Windows to the /home/sqlpkg folder in the Linux Server:
use FileZila to transfer the files.

4. Use Putty or Kitty as the Linux terminal emulator from the Windows desktop:
log on to the Linux server - linux01 (192.168.0.155).

5. Go to the package folder:
cd /home/sqlpkg

6. Install the database engine package:
sudo yum localinstall mssql-server-14.0.3022.28-2.x86_64.rpm

7. Run the setup to complete the installation and respond to the on screen prompt:
sudo /opt/mssql/bin/mssql-conf setup

8. Choose the SQL Server Edition option that needs to be configured.

9. Enter the SQL Server sa password – the password should be complex enough.

10. Restart the SQL Server Service and check the status:
systemctl restart mssql-server.service

11. Check the SQL Server Service status:
systemctl status mssql-server

12. Enable SQL Server Agent:
sudo /opt/mssql/bin/mssql-conf set sqlagent.enabled true

13. Restart and check the SQL Server Service status:
sudo systemctl restart mssql-server
systemctl status mssql-server

14. Firewall port configuration:
sudo firewall-cmd --zone=public --add-port=1433/tcp --permanent
sudo firewall-cmd --reload

15. Environment: PATH environment variable needs to be configured:
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc

16. Install the sql-tools:  execute the following commands in a sequence.
sudo yum localinstall unixODBC-2.3.1-11.el7.x86_64.rpm
sudo yum localinstall msodbcsql-13.1.6.0-1.x86_64.rpm
sudo yum localinstall mssql-tools-14.0.5.0-1.x86_64.rpm

17. Test the SQL Server installation:
sqlcmd -S linux01 -U SA -P '<SAPassword>'
sqlcmd -S localhost -U SA -P '<SAPassword>'


Some Screenshots:


Using FileZila to transfer SQL Server 2017 packages to the Linux Server:

SQL Server packages on the Linux Server (/home/sqlpkg):



SQL Server Database Engine Installation:


Choosing SQL Server Engine Edition:


Connecting SQL Server on Linux using SSMS:

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.