E: Unable to locate package mssql-server – Ubuntu SQL Server Installation Error

Problem:

With the new install of Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-87-generic x86_64), different attempts at installing SQL Server resulted in the error: “E: Unable to locate package mssql-server”.

SQL Linux Install Error

Resolution:

On a new installation of the Ubuntu 16.04 operating system, I had to run the following four step in order to ensure that my SQL Server 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
sudo apt install curl

LINUX install cURL

  • Import the public repository GPG keys used by apt to authenticate packages from Microsoft.
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Linux Apt Key Add

  • Add Microsoft to the apt repository
    • Will be prompted for the Linux user account password due to the “sudo” command being run
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list

Linux mssql-server.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 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

  • After these four steps have been completed, SQL Server should install.
sudo apt-get install -y mssql-server
Linux SQL Server Installation

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

 

 

2 Comments

Leave a Reply to BlogAdmin Cancel reply