Unable to install msodbcsql17 on Ubuntu 18.04

After searching around, I have found the requested package, it is located on Microsoft Ubuntu 18.04 repository, in order to install the package you have to add the repo first.

This will install msodbcsql17 that correspond to Ubuntu 18.04, open up terminal and run:

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
echo "deb [arch=amd64] https://packages.microsoft.com/ubuntu/18.04/prod bionic main" | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt update
sudo apt install msodbcsql17

I had the same issue but above solutions didn't workout for me. So here's how I solved this problem.

sudo apt-get install -y libodbc1
sudo apt update
sudo apt install unixodbc

Following commands from microsoft docs

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

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

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