Install the Microsoft ODBC 17 driver for SQL Server all on Linux (Ubuntu 18.04)

Install the Microsoft ODBC 17 driver for SQL Server all on Linux (Ubuntu 18.04) step by step, all command list as follows:

Commands:

Get apt-key:

sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add –

Download appropriate package for the OS version:

# Choose only ONE of the following, corresponding to your OS version

# Ubuntu 16.04

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list

# Ubuntu 18.04

curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list > /etc/apt/sources.list.d/mssql-release.list

#Ubuntu 19.10

curl https://packages.microsoft.com/config/ubuntu/19.10/prod.list > /etc/apt/sources.list.d/mssql-release.list

exit

Install:

sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17

Optional: for bcp and sqlcmd

sudo ACCEPT_EULA=Y apt-get install mssql-tools
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bash_profile
echo ‘export PATH=”$PATH:/opt/mssql-tools/bin”‘ >> ~/.bashrc
source ~/.bashrc

Optional: for unixODBC development headers

sudo apt-get install unixodbc-dev

Reference:
Install the Microsoft ODBC driver for SQL Server (Linux)