2

As described here, I am trying to install the following driver in shell, using this code (modified from the original slightly):

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/debian/8/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo ACCEPT_EULA=Y apt-get install msodbcsql17

But I get an error on the last command:

sudo: sorry, you are not allowed to set the following environment variables: ACCEPT_EULA

After searching, I can't seem to find this exact error anywhere else.

One solution is to run the last command without ACCEPT_EULA=Y as sudo apt-get install msodbcsql17. And then to enter Y at the prompt. This indeed works but I would like to run the above installation for other users without need of their input.

  • Is there a way to resolve the above error so I can use ACCEPT_EULA=Y, or
  • alternatively is there a simple way to enter the Y response for the EULA automatically so the end user never needs to take any action?

Thank you in advance.

4

3 回答 3

5

您似乎有权运行任意命令,但不能修改环境。

简单的解决方法是将环境更改移交给命令:

sudo env ACCEPT_EULA=Y apt-get install msodbcsql17
于 2018-06-26T22:01:44.890 回答
3

我没有足够的代表发表评论。但是我在 python:3 docker 容器中为 pyodbc 进行了相同的安装。在 dockerfile 中,以下命令有效:

ACCEPT_EULA=Y apt-get install -y msodbcsql17

(我是在这个特定的驱动程序#17之后。)

阅读:https ://github.com/microsoft/mssql-docker/blob/master/oss-drivers/pyodbc/Dockerfile可以帮助查看从基本 ubuntu (ubuntu:16.04) 框设置的环境。

还要检查:https ://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server?view=sql-server -2017 年微软第一手文档。

于 2019-05-30T08:53:26.417 回答
1

上面的ACCEPT_EULA=Y apt-get install -y msodbcsql17命令对我有用,因为我试图msodbcsql17通过Dockerfile.

于 2020-05-18T16:36:46.497 回答