After reading this thread:
https://github.com/Microsoft/msphpsql/issues/190
I had to find out another portnumber SQL Server was listening on by executing
USE MASTER
GO
xp_readerrorlog 0, 1, N'Server is listening on'
GO
Result
2018-04-12 03:19:57.830 Server Server is listening on [ 'any' <ipv6> 49155].
2018-04-12 03:19:57.830 Server Server is listening on [ 'any' <ipv4> 49155].
add a Rule for the Windows Firewall on SQL Server host: - enabling specific Port 49155 (I think this can vary)
Then this command succeeded on my Ubuntu machine:
sqlcmd -Smyhost,49155 -U sa -P sa_pwd -d mydb -Q "select @@servername"
Approach to solution
As the direct link for installation was not working, had downloaded rpm files for offline installation using below lines:
sudo mkdir /tmp/RedHat6Packages
sudo curl https://packages.microsoft.com/rhel/6/prod/msodbcsql-13.1.4.0-1.x86_64.rpm > /tmp/RedHat6Packages/msodbcsql-13.1.4.0-1.x86_64.rpm
sudo curl https://packages.microsoft.com/rhel/6/prod/mssql-tools-14.0.4.0-1.x86_64.rpm > /tmp/RedHat6Packages/mssql-tools-14.0.4.0-1.x86_64.rpm
Tried to install offline with following commands:
cd /tmp/RedHat6Packages/
sudo yum localinstall msodbcsql-13.1.4.0-1.x86_64.rpm
sudo yum localinstall mssql-tools-14.0.4.0-1.x86_64.rpm
But still was getting the same error:
error: Failed dependencies:
libodbcinst.so.2()(64bit) is needed by msodbcsql-13.1.4.0-1.x86_64
unixODBC >= 2.3.1 is needed by msodbcsql-13.1.4.0-1.x86_64
Found command to check the packages:
sudo yum provides /usr/lib64/libodbcinst.so.2
This showed following warning:
Loaded plugins: priorities, update-motd, upgrade-helper
2 packages excluded due to repository priority protections
unixODBC-2.2.14-14.7.amzn1.x86_64 : A complete ODBC driver manager for Linux
Repo : amzn-main
Matched from:
Filename : /usr/lib64/libodbcinst.so.2
unixODBC-utf16-2.3.1-1.x86_64 : ODBC driver manager with UTF16 character conversion enabled by default
Repo : packages-microsoft-com-prod
Matched from:
Filename : /usr/lib64/libodbcinst.so.2
JUMP directly to solution
Checked the below mentioned link:
What does that mean: packages excluded due to repository priority protections
Disabled priorities by editing /etc/yum/pluginconf.d/priorities.conf
and set enabled = 0
Was able to install the driver using the same commands mentioned:
cd /tmp/RedHat6Packages/
sudo yum localinstall msodbcsql-13.1.4.0-1.x86_64.rpm
sudo yum localinstall mssql-tools-14.0.4.0-1.x86_64.rpm
Still unable to figure out where are extension files but have created other question (Next steps after installation of MSSQL ODBC 13.1 on Amazon EC2 Linux) as purpose of this question is solved.
As a newbie to linux (esp. who have migrated from windows), it was really difficult to find the above solution. Hope it helps someone!!
Best Answer
Check the Release Notes for SQL Server on Linux page. Microsoft's aware of the issue, and they write: