Installing SQL Server 2017, I get E: Unable to locate package mssql-server
-
10-10-2020 - |
Pregunta
I'm using Ubuntu 17.10, but after adding the Microsoft repo for 17.10
sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -sr)/prod.list)"
and trying to install SQL Server, I get
# apt-get install mssql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mssql-server
Solución
Normally, a distro packages things in a specific format, so for instance adding a repository like
deb [arch=amd64] https://packages.microsoft.com/ubuntu/17.10/prod zesty main
Will tell apt
to download a package list and look for the packages here,
https://packages.microsoft.com/ubuntu/17.10/prod/pool/
However, with Microsoft that's not the case. They have a repository for 17.10 (as they should) which has all their packages for Ubuntu, but they have another repository specifically for SQL Server. To make matters more confusing, that SQL Server repository is in the tree of 16.04.
So they have both (pay attention to the /pool/
s)
- https://packages.microsoft.com/ubuntu/16.04/mssql-server/pool/main/m/
- https://packages.microsoft.com/ubuntu/16.04/prod/pool/main/m/
You need the 16.04/mssql-server
repository. You can add that with
sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list)"
You may think because you have the 17.10/prod
and you have SQL Server installed that you don't need the 16.04/prod
repository. That's incorrect, you'll need that too if you want the SQL Client sqlcmd
provided by mssql-tools
sudo add-apt-repository "$(curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list)"
I did file a doc bug upstream with a description of the confusion so maybe they'll fix it someday
If you find your system in an inconsistent state for any reason, you can always remove SQL Server and start over.