Forum Discussion
ODBC drivers for Ubuntu 22.04
It appears that the https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server-ver16&tabs=debian18-install%2Cdebian17-install%2Cdebian8-install%2Credhat7-13-install%2Crhel7-offline for installing ODBC on Ubuntu 22.04 and Debian 11.
I also got the v17 driver working on Linux Mint 21.1 as follows:
sudo su
curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
curl https://packages.microsoft.com/config/debian/11/prod.list > /etc/apt/sources.list.d/mssql-release.list
exit
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql17
# optional: for bcp and sqlcmd
sudo ACCEPT_EULA=Y apt-get install -y mssql-tools
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
source ~/.bashrc
To use v18, just change to line with msodbcsql17 to use msodbcsql18
My test Mint 21 system (Ubuntu 22.04.x based) was blocked from being able to be updated.
When I did a `sudo apt-get upgrade`, It failed and I was prompted to run `sudo apt --fix-broken install` which when was run would also fail due to the odbc drivers.
I followed these instructions to remove the offending packages: https://superuser.com/a/1439244/247361
It took a few tries and I had to remove `unixodbc-common`, `libodbc2`, `libodbcinst2`, `odbcinst1debian2` before `sudo apt --fix-broken install` would run ok.
I'm in the process of upgrading my test VM and will add notes if I hit a wall with this driver again.
[Update] - Afetr updating and trying `sqlcmd` it failed with `sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Can't open lib 'ODBC Driver 17 for SQL Server' : file not found`. To fix, I had to remove `msodbcsql17` and then re-install along with mssql-tools.