首页 > 解决方案 > 在 linux 服务器 ubuntu 16.04 中安装 SQL Server 2019 时出错

问题描述

我尝试在我的 linux 服务器 ubuntu 16.04 LTS 中安装 SQL Server 2019。我只是按照 Microsoft Linux Sql Server Installation给出的步骤进行操作,但是当我尝试执行第二步时出现错误,即为 SQL Server 2019 注册 Microsoft SQL Server Ubuntu 存储库。我运行命令但出现了此错误:

错误一:

错误 1

root@capt:/home/frenclub/Downloads# sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"

收到错误

错误:“”无效

然后我将双引号更改为单引号,但仍然出现错误:

错误2:

错误 2

root@capt:/home/frenclub/Downloads# sudo add-apt-repository '$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)'

收到错误

错误:'$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list )' 无效

我已经尝试用谷歌搜索任何可能的解决方案,但我仍然找不到任何解决此问题的方法。谁能帮我解决这个问题?

标签: sql-serverlinuxubuntu-16.04

解决方案


正如我的评论中提到的,我启动了一个运行 16.04 的容器并且无法复制它:

thom@neith:~$ lxc launch ubuntu:16.04 u1604-mssql
Creating u1604-mssql
Starting u1604-mssql
thom@neith:~$ lxc exec u1604-mssql bash
root@u1604-mssql:~# wget -qO- https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
OK
root@u1604-mssql:~# add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"
root@u1604-mssql:~#

但是,您可以尝试curl手动使用和添加存储库的其他方法。

root@u1604-mssql:~# add-apt-repository -r "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)" #You don't need this, but I am including a full script
root@u1604-mssql:~# #Add key if you haven't already
root@u1604-mssql:~# curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list | tee /etc/apt/sources.list.d/mssql-prod.list
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   103  100   103    0     0    306      0 --:--:-- --:--:-- --:--:--   307
deb [arch=amd64,arm64,armhf] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2019 xenial main

注意这些命令不要使用sudo,因为我运行的是root.

我可以确认在找到包之后运行sudo apt update之后mssql-server


推荐阅读