When attempting to install the command line tools for SQL Server on Ubuntu 16.04.3, I would get the error: “E: Unable to locate package mssql-tools”
Note: SQL Server has already been installed on this server. The resolution will include the commands as if SQL Server was not installed, and for example if this package was going to be installed on something like an ETL server.
On a new installation of the Ubuntu 16.04 operating system, I had to run the following four step in order to ensure that the SQL Server Tools would install.
- Installation of cURL
- cURL is the command line tool and library that is used for transferring data with URL syntax
- will be prompted for the Linux user account password due to the “sudo” command being run
- will be asked to respond yes to the 323 KB of space need to install the package
- there is no harm if the command is rerun, but not needed if SQL Server is already installed
sudo apt install curl
- Import the public repository GPG keys used by apt to authenticate packages from Microsoft.
- If SQL Server is already installed, then this command does not need to be run. There is no harm if it is run again.
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
- Add Microsoft to the apt repository
- May be prompted for the Linux user account password due to the “sudo” command being run
- This command is different then the one used for the installation of SQL Server
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
- Most important – this command downloads the package lists from the repositories and “updates” them to get information on the newest versions of packages and their dependencies.
- The update command needs to be run after the two cURL commands, otherwise the SQL Server Tools installation will end with an error.
- This is where I had trouble, because I thought I had run this command a number of times already, and did not need to run again. However it is critical this command runs after the two cURL commands.
sudo apt-get update
- After these four steps have been completed, the command line tools for SQL Server on Linux should install.
sudo apt-get install mssql-tools unixodbc-dev
Thanks a lot!
Thank you very much!
Just wanted to add that before first curl execution I had to run
apt-get update && apt-get install -y gnupg2
because it was missing
Thank you so much
Thanks i tried a lot but it helped me finally
for ubuntu 20.04 change 16.04 to 20.04
It does not work
Reading package lists… Done
Building dependency tree
Reading state information… Done
You might want to run ‘apt –fix-broken install’ to correct these.
The following packages have unmet dependencies:
libc6-dbg : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.1 is to be installed
libc6-dev : Depends: libc6 (= 2.31-0ubuntu9.2) but 2.31-0ubuntu9.1 is to be installed
libnss-systemd : Depends: systemd (= 245.4-4ubuntu3.5)
libpam-systemd : Depends: systemd (= 245.4-4ubuntu3.5)
mssql-tools : Depends: msodbcsql17 (>= 126.96.36.199) but it is not going to be installed
systemd-sysv : Depends: systemd (= 245.4-4ubuntu3.5)
systemd-timesyncd : Depends: systemd (= 245.4-4ubuntu3.5)
unixodbc-dev : Depends: unixodbc (= 2.3.7)
E: Unmet dependencies. Try ‘apt –fix-broken install’ with no packages (or specify a solution).
Thanks a lot
Than you Sir, just saved my ass!!
Wow. Thank you!!