15

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.

Zanna
  • 70,465
DocPanic
  • 151

2 Answers2

15

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.

Chai T. Rex
  • 5,193
Rinzwind
  • 299,756
  • 1
    Precisely, you'll need AMD64 system. It won't work on ARM architecture (at least not yet). – userfuser Oct 26 '17 at 18:08
  • Link is broken I believe – Hack-R Mar 26 '18 at 17:21
  • 1
    I was getting Full-Text error on a docker container with the latest image from microsoft/mssql-server-linux, I logged into the container terminal and couldn't execute apt-get install -y mssql-server-fts, this answear was all I needed. Thanks! – Edgar Froes Nov 10 '18 at 02:28
  • I think this is the best package install post I have come across. Check that it's ready to install is my favorite part. – pyeR_biz Nov 22 '19 at 22:52
  • @userfuser, Well, that makes sense. Guess no Raspberry Pi for me. – Caleb Hawn Aug 24 '22 at 16:00
3

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
sbatha
  • 31
  • Welcome to Ask Ubuntu, while this link may answer the question, it's better to include essential parts here. –  Aug 04 '19 at 02:57
  • Thank you. The first step adding the keys was what I was needing – Dave Pile Feb 02 '21 at 01:28