E: Unable to locate package mssql-tools – error install the command line tools for SQL Server on Ubuntu

Problem:
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”

Linux SQL Install Tools Error

Resolution:

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

SQL_LINUX_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 -

SQL Linux Apt-KeyAdd

  • 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

SQL Linux 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

Linux Apt get update for SQL Tools

  • 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
Linux SQL Tools Installation

Only the top couple of lines for the SQL Server Tool for Linux are shown. There are a couple of pages of text with the actual installation.

12 Comments

Leave a Reply to Vaclav Cancel reply