在 Ubuntu 18.04 LTS 上安装 SQL Server 命令行工具

在 Ubuntu 18.04 LTS 上安装 SQL Server 命令行工具

我正在关注这个文档:安装 SQL Server 命令行工具 我得到了这个:

(base) khalid@Khalid:~$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
[sudo] password for khalid: 

OK
(base) khalid@Khalid:~$ curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/prod xenial main
(base) khalid@Khalid:~$ sudo apt-get update 
Hit:1 http://eg.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://ppa.launchpad.net/gnome-shell-extensions/ppa/ubuntu bionic InRelease    
Get:3 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB]          
Get:4 http://eg.archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB]         
Hit:5 http://ppa.launchpad.net/sylvain-pineau/kazam/ubuntu bionic InRelease          
Hit:6 https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial InRelease 
Ign:7 http://dl.google.com/linux/chrome/deb stable InRelease                         
Hit:8 https://packages.microsoft.com/ubuntu/16.04/prod xenial InRelease              
Hit:9 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease              
Hit:10 http://ppa.launchpad.net/uget-team/ppa/ubuntu bionic InRelease                
Get:11 http://eg.archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB]      
Hit:12 http://dl.google.com/linux/chrome/deb stable Release                          
Hit:14 https://cloud.r-project.org/bin/linux/ubuntu bionic-cran35/ InRelease         
Fetched 252 kB in 2s (149 kB/s)                                                  
Reading package lists... Done
(base) khalid@Khalid:~$ sudo apt-get install mssql-tools unixodbc-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mssql-tools : Depends: msodbcsql17 (>= 17.3.0.0) but it is not going to be installed
 unixodbc-dev : Depends: unixodbc (= 2.3.7)
E: Unable to correct problems, you have held broken packages.

那么,我在这里遗漏了什么?

答案1

为什么是 16.04?

curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

应该是 18.04:

curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

如需查看所有可用列表,请查看:https://packages.microsoft.com/config/ubuntu/

相关内容