Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ubuntu: Silent install of mssql-tools and unixodbc-dev (automatically accept EULA)

I was trying to install mssql-tools (for sqlcmd and bcp) using apt-get install as part of a Dockerfile, but the preinst script kept halting and prompting to accept the EULA.

Is there a way to automatically accept the license for this package?

like image 334
l8nite Avatar asked Feb 22 '17 05:02

l8nite


People also ask

How do I install SQL on Ubuntu?

The following steps install the SQL Server command-line tools: sqlcmd and bcp. Import the public repository GPG keys. Register the Ubuntu repository. Update the sources list and run the installation command with the unixODBC developer package.

How do I connect to SQL Server in Linux?

To connect to a SQL Server Express instance, use the format machinename \SQLEXPRESS . If the SQL Server instance is listening on the default port, leave this set to 1433 . If your database administrator told you to specify a different port, replace 1433 with the new port number. Otherwise, delete 1433 .


1 Answers

Turns out you can set ACCEPT_EULA=Y in the environment prior to the install command:

ACCEPT_EULA=y DEBIAN_FRONTEND=noninteractive \
apt-get install -y --no-install-recommends mssql-tools unixodbc-dev

I discovered this by downloading the package .deb file, untarring it and looking at the preinst script which had this block:

check_eula_acceptance()
{
    if [ "$ACCEPT_EULA" != "y" ] && [ "$ACCEPT_EULA" != "Y" ]; then
...
like image 95
l8nite Avatar answered Oct 16 '22 14:10

l8nite