Ubuntu 18.04 MSSQL Repos
Solution 1:
https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-linux-2017 so far only mentions 16.04.
The mssql-server
package from the repo there works fine in Ubuntus up to 17.10, but after 18.04 it no longer installs due to outdated dependencies.
But we can still install and run it :-) First we add the repo:
$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ echo 'deb [arch=amd64] https://packages.microsoft.com/ubuntu/16.04/mssql-server-2017 xenial main' | sudo tee -a /etc/apt/sources.list.d/mssql-server.list
Then we install the dependencies:
$ sudo apt install openssl1.0 libcurl4 libjemalloc2 libc++1 libsss-nss-idmap0 libc++abi1
$ # Mark them as dependencies so they're autoremoved if you remove mssql-server:
$ sudo apt-mark auto openssl1.0 libcurl4 libjemalloc2 libc++1 libsss-nss-idmap0 libc++abi1
Then we fix the dependency list in the .deb to specify openssl1.0 instead of openssl:
$ mkdir tmp && cd tmp
$ sudo apt download mssql-server
$ ar x mssql-server_14.0.3025.34-3_amd64.deb
$ emacs -Q control.tar.gz
In Emacs:
- click the file
control
in the file listing - edit the line starting with "Depends" to say
openssl1.0
instead ofopenssl
(note: it's mentioned two places in the same line), - edit the line starting with "Depends" to say
libjemalloc2
instead oflibjemalloc1
, - then click
Save
and then theX
to the left ofSave
, - then also click
Save
in the file listing, - then exit (File→Quit).
Then we repack the archive under a new name and install it:
$ # Note: order of arguments matters here:
$ ar rcs mssql-server_14.0.3025.34-3fixed_amd64.deb debian-binary control.tar.gz data.tar.xz
$ sudo dpkg -i mssql-server_14.0.3025.34-3fixed_amd64.deb
Now just continue from step 4 (mssql-conf setup
) of https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-linux-2017 and you should be able to test your connection with e.g. sqsh
or tsql
.
EDIT: I've got my current script for doing this on Ubuntu 19.10 here: https://gist.github.com/unhammer/6bff7adabb98e581508c042dc1fb9914