MSSQL on Ubuntu, can't get it to install?

Recently MS launched mssql-server for Linux. I'd like to use it but I can't manange to run

sudo apt-get install -y mssql-server

It says

E: Unable to locate package mssql-server

Current Ubuntu is 16.04.1 LTS.

I tried to follow [these instructions on Microsoft's website]( https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-ubuntu) and don't know what else to do with it.


Solution 1:

You will need a 64-bit system for this to work ;)

First, add the Xenial MSSQL repository to your system:

$ sudo curl -o /etc/apt/sources.list.d/mssql-server.list https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2017.list
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    91  100    91    0     0    195      0 --:--:-- --:--:-- --:--:--   195
$ curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   983  100   983    0     0   2337      0 --:--:-- --:--:-- --:--:--  2340
OK

Second, update APT's list of available packages:

$ sudo apt-get update
Hit:1 http://ppa.launchpad.net/numix/ppa/ubuntu yakkety InRelease
Get:2 http://security.ubuntu.com/ubuntu yakkety-security InRelease [93,3 kB]   
Hit:3 http://nl.archive.ubuntu.com/ubuntu yakkety InRelease                    
Hit:4 http://nl.archive.ubuntu.com/ubuntu yakkety-updates InRelease            
Hit:5 http://nl.archive.ubuntu.com/ubuntu yakkety-backports InRelease          
Get:6 https://packages.microsoft.com/ubuntu/16.04/mssql-server xenial InRelease [2828 B]
Get:7 https://packages.microsoft.com/ubuntu/16.04/mssql-server xenial/main amd64 Packages [940 B]
Fetched 97,1 kB in 0s (204 kB/s)  
Reading package lists... Done

Optionally, you can check that it's ready to install:

$ apt-cache search mssql-server
mssql-server - Microsoft SQL Server Relational Database Engine
mssql-server-agent - Microsoft SQL Server Agent
mssql-server-fts - Microsoft SQL Server Full Text Search.
mssql-server-ha - The mssql-server-ha package contains HA extensions for the Microsoft SQL Server Relational Database Engine.
mssql-server-is - SSIS on Linux

Then, just install with sudo apt install mssql-server.

Solution 2:

I seached and finally found a working solution:

Installation

The first thing to do is import the necessary repository key. From the terminal window, issue the following command:

sudo wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

Next, add the repository with the command:

sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-preview.list)"

Update the APT database with the command:

sudo apt-get update

And, finally, install MS SQL with the command:

sudo apt-get install mssql-server -y