Reputation: 155
I'm trying to install mssql driver on Ubuntu 16.04 using this guidance. When I get into the step :
sudo ACCEPT_EULA=Y apt-get install msodbcsql
I got an error : Unable to locate package msodbcsql What step did I miss?
Thanks in advance.
Upvotes: 13
Views: 39493
Reputation: 1144
If None of the above solutions worked and you are using an MX of macOS. Just put the
platform: linux/amd64
On your docker-file. It should it find now.
Upvotes: 0
Reputation: 2019
I got a similar error while using the python:3.10-slim
docker image whose base image is the Debian 12. In this case, you need to install two dependencies before installing the msodbcsql18
package:
apt install -y curl unixodbc odbcinst
Find the suitable MSODBC driver package under the Download for Linux and macOS documentation. Get the package URL and download it via curl
command, in my case:
curl https://packages.microsoft.com/debian/12/prod/pool/main/m/msodbcsql18/msodbcsql18_18.3.2.1-1_amd64.deb -o msodbcsql18.deb
Next, install the package using the dpkg
package manager:
ACCEPT_EULA=Y dpkg --install msodbcsql18.deb
Note: Do not forget to accept the license agreement.
Upvotes: 3
Reputation: 903
Error Message: Unable to locate package msodbcsql17
Solution: Update the Ubuntu release version to the current latest!
- curl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
- curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list > /etc/apt/sources.list.d/mssql-release.list
- apt update -y
- apt install msodbcsql17 -y
- apt-get install unixodbc-dev -y
basically what worked for me was upgrading from /ubuntu/16.04
to /ubuntu/20.04
Upvotes: 2
Reputation: 1255
After searching, I have found the requested package is located on Microsoft Ubuntu 18.04 repository. To install the package We have to add the repository first and then we have to run following commands.
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
Above command will setup msodbcsql17.
Cheers :)
Upvotes: 2
Reputation: 5528
I got the same error on Debian GNU/Linux 9.
It turn out to be the failure in apt-get update
# apt-get update
....
N: Is the package apt-transport-https installed?
E: Failed to fetch https://packages.microsoft.com/debian/9/prod/dists/stretch/InRelease
According to the error log, I ran apt-get install apt-transport-https
and apt-get update
again.
Then I can do the ACCEPT_EULA=Y apt-get install msodbcsql17
successfully
Note: I was in root, if you're not, add sudo, try it. :)
Upvotes: 5
Reputation: 5940
It seems, because, according to that url, right command for Ubuntu is:
sudo ACCEPT_EULA=Y apt-get install msodbcsql17
full script for 16.04:
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
exit
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
Update (13 Apr 18)
Consider to check that Microsoft repository properly registered by running:
sudo apt-get update
As a result you should see a line similar to a "Get:30 http packages.microsoft.com/ .."
My vm example:
Get:29 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3,208 B]
Get:30 https://packages.microsoft.com/ubuntu/16.04/prod xenial/main amd64 Packages [31.7 kB]
Fetched 12.9 MB in 5s (2,265 kB/s)
Upvotes: 11