Failed to Install Microsoft Sql server in Ubuntu Desktop 21.04

2.5k Views Asked by At

System: Ubuntu Desktop 21.04 64-bit on rasp 400

I failed many times to install mssql-server on my OS following this guide https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-ubuntu?view=sql-server-ver15

I tried with list from 19.04 and 20.04 with no results. I noticed that in microsoft server there in no mssq-server-list for 21.04. https://packages.microsoft.com/config/ubuntu/21.04/ So i changed the command with

sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/21.04/prod.list)" 

failed again.

This is my output:

To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

username@pcname:~$ wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
[sudo] password for username: 
Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
username@pcname:~$ sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/21.04/mssql-server-2019.list)"
Error: no actions requested.
usage: add-apt-repository [-h] [-d] [-r] [-s] [-c COMPONENT] [-p POCKET] [-y]
                          [-n] [-l] [--dry-run] [-L] [-P PPA] [-C CLOUD]
                          [-U URI] [-S SOURCESLIST [SOURCESLIST ...]]
                          [line ...]

Only ONE of -P, -C, -U, -S, or old-style 'line' can be specified

positional arguments:
  line                  sources.list line to add (deprecated)

optional arguments:
  -h, --help            show this help message and exit
  -d, --debug           Print debug
  -r, --remove          Disable repository
  -s, --enable-source   Allow downloading of the source packages from the
                        repository
  -c COMPONENT, --component COMPONENT
                        Components to use with the repository
  -p POCKET, --pocket POCKET
                        Add entry for this pocket
  -y, --yes             Assume yes to all queries
  -n, --no-update       Do not update package cache after adding
  -l, --login           Login to Launchpad.
  --dry-run             Don't actually make any changes.
  -L, --list            List currently configured repositories
  -P PPA, --ppa PPA     PPA to add
  -C CLOUD, --cloud CLOUD
                        Cloud Archive to add
  -U URI, --uri URI     Archive URI to add
  -S SOURCESLIST [SOURCESLIST ...], --sourceslist SOURCESLIST [SOURCESLIST ...]
                        Full sources.list entry line to add
username@pcname:~$ sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)"
Repository: 'deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal main'
Description:
Archive for codename: focal components: main
More info: https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_packages_microsoft_com_ubuntu_20_04_mssql-server-2019-hirsute.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_packages_microsoft_com_ubuntu_20_04_mssql-server-2019-hirsute.list
Get:1 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal InRelease [10,4 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports hirsute InRelease [269 kB]
Get:3 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal/main arm64 Packages [1505 B]
Get:4 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal/main amd64 Packages [7344 B]
Get:5 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal/main armhf Packages [1505 B]
Get:6 http://ports.ubuntu.com/ubuntu-ports hirsute-updates InRelease [109 kB]
Get:7 http://ports.ubuntu.com/ubuntu-ports hirsute-backports InRelease [101 kB]
Get:8 http://ports.ubuntu.com/ubuntu-ports hirsute-security InRelease [101 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports hirsute/main arm64 DEP-11 Metadata [469 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports hirsute/main DEP-11 48x48 Icons [102 kB]
Get:11 http://ports.ubuntu.com/ubuntu-ports hirsute/main arm64 c-n-f Metadata [28,9 kB]
Get:12 http://ports.ubuntu.com/ubuntu-ports hirsute/universe arm64 Packages [12,9 MB]
Get:13 http://ports.ubuntu.com/ubuntu-ports hirsute/universe Translation-en [5441 kB]
Get:14 http://ports.ubuntu.com/ubuntu-ports hirsute/universe arm64 DEP-11 Metadata [3834 kB]
Get:15 http://ports.ubuntu.com/ubuntu-ports hirsute/universe DEP-11 64x64 Icons [8115 kB]
Get:16 http://ports.ubuntu.com/ubuntu-ports hirsute/universe arm64 c-n-f Metadata [268 kB]                                                                                                                
Get:17 http://ports.ubuntu.com/ubuntu-ports hirsute/multiverse arm64 DEP-11 Metadata [43,8 kB]                                                                                                            
Get:18 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main arm64 Packages [287 kB]                                                                                                                  
Get:19 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main Translation-en [87,3 kB]                                                                                                                 
Get:20 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main arm64 DEP-11 Metadata [27,3 kB]                                                                                                          
Get:21 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main DEP-11 48x48 Icons [693 B]                                                                                                               
Get:22 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main DEP-11 64x64 Icons [678 B]                                                                                                               
Get:23 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main DEP-11 64x64@2 Icons [29 B]                                                                                                              
Get:24 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/main arm64 c-n-f Metadata [6268 B]                                                                                                            
Get:25 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/restricted arm64 Packages [2828 B]                                                                                                            
Get:26 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/restricted Translation-en [21,9 kB]                                                                                                           
Get:27 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe arm64 Packages [250 kB]                                                                                                              
Get:28 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe Translation-en [63,8 kB]                                                                                                             
Get:29 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe arm64 DEP-11 Metadata [612 B]                                                                                                        
Get:30 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe DEP-11 48x48 Icons [4031 B]                                                                                                          
Get:31 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe DEP-11 64x64 Icons [29 B]                                                                                                            
Get:32 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe DEP-11 64x64@2 Icons [29 B]                                                                                                          
Get:33 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/universe arm64 c-n-f Metadata [5840 B]                                                                                                        
Get:34 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/multiverse arm64 Packages [1420 B]                                                                                                            
Get:35 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/multiverse Translation-en [3000 B]                                                                                                            
Get:36 http://ports.ubuntu.com/ubuntu-ports hirsute-updates/multiverse arm64 c-n-f Metadata [184 B]                                                                                                       
Get:37 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/main arm64 c-n-f Metadata [112 B]                                                                                                           
Get:38 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/restricted arm64 c-n-f Metadata [120 B]                                                                                                     
Get:39 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe arm64 Packages [3444 B]                                                                                                            
Get:40 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe Translation-en [1204 B]                                                                                                            
Get:41 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe arm64 DEP-11 Metadata [9204 B]                                                                                                     
Get:42 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe DEP-11 48x48 Icons [29 B]                                                                                                          
Get:43 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe DEP-11 64x64 Icons [1789 B]                                                                                                        
Get:44 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe DEP-11 64x64@2 Icons [29 B]                                                                                                        
Get:45 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/universe arm64 c-n-f Metadata [192 B]                                                                                                       
Get:46 http://ports.ubuntu.com/ubuntu-ports hirsute-backports/multiverse arm64 c-n-f Metadata [120 B]                                                                                                     
Get:47 http://ports.ubuntu.com/ubuntu-ports hirsute-security/main arm64 Packages [167 kB]                                                                                                                 
Get:48 http://ports.ubuntu.com/ubuntu-ports hirsute-security/main Translation-en [53,1 kB]                                                                                                                
Get:49 http://ports.ubuntu.com/ubuntu-ports hirsute-security/main arm64 c-n-f Metadata [3580 B]                                                                                                           
Get:50 http://ports.ubuntu.com/ubuntu-ports hirsute-security/restricted arm64 Packages [2828 B]                                                                                                           
Get:51 http://ports.ubuntu.com/ubuntu-ports hirsute-security/restricted Translation-en [19,0 kB]                                                                                                          
Get:52 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe arm64 Packages [186 kB]                                                                                                             
Get:53 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe Translation-en [40,9 kB]                                                                                                            
Get:54 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe arm64 DEP-11 Metadata [608 B]                                                                                                       
Get:55 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe DEP-11 48x48 Icons [4031 B]                                                                                                         
Get:56 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe DEP-11 64x64 Icons [29 B]                                                                                                           
Get:57 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe DEP-11 64x64@2 Icons [29 B]                                                                                                         
Get:58 http://ports.ubuntu.com/ubuntu-ports hirsute-security/universe arm64 c-n-f Metadata [4208 B]                                                                                                       
Get:59 http://ports.ubuntu.com/ubuntu-ports hirsute-security/multiverse Translation-en [828 B]                                                                                                            
Fetched 33,0 MB in 14s (2425 kB/s)                                                                                                                                                                        
Reading package lists... Done
username@pcname:~$ sudo apt-get update
sudo apt-get install -y mssql-server
Hit:1 http://ports.ubuntu.com/ubuntu-ports hirsute InRelease
Hit:2 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports hirsute-updates InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports hirsute-backports InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports hirsute-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package mssql-server
username@pcname:~$ sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/21.04/prod.list)"
Repository: 'deb [arch=amd64,armhf,arm64] https://packages.microsoft.com/ubuntu/21.04/prod hirsute main'
Description:
Archive for codename: hirsute components: main
More info: https://packages.microsoft.com/ubuntu/21.04/prod
Adding repository.
Press [ENTER] to continue or Ctrl-c to cancel.
Adding deb entry to /etc/apt/sources.list.d/archive_uri-https_packages_microsoft_com_ubuntu_21_04_prod-hirsute.list
Adding disabled deb-src entry to /etc/apt/sources.list.d/archive_uri-https_packages_microsoft_com_ubuntu_21_04_prod-hirsute.list
Hit:1 http://ports.ubuntu.com/ubuntu-ports hirsute InRelease
Hit:2 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal InRelease
Get:3 https://packages.microsoft.com/ubuntu/21.04/prod hirsute InRelease [10,5 kB]
Hit:4 http://ports.ubuntu.com/ubuntu-ports hirsute-updates InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports hirsute-backports InRelease
Get:6 http://ports.ubuntu.com/ubuntu-ports hirsute-security InRelease [101 kB]
Get:7 https://packages.microsoft.com/ubuntu/21.04/prod hirsute/main arm64 Packages [566 B]
Get:8 https://packages.microsoft.com/ubuntu/21.04/prod hirsute/main armhf Packages [566 B]
Get:9 https://packages.microsoft.com/ubuntu/21.04/prod hirsute/main amd64 Packages [25,7 kB]
Get:10 http://ports.ubuntu.com/ubuntu-ports hirsute-security/restricted arm64 Packages [3000 B]
Get:11 http://ports.ubuntu.com/ubuntu-ports hirsute-security/restricted Translation-en [19,1 kB]
Fetched 160 kB in 3s (47,7 kB/s)         
Reading package lists... Done
username@pcname:~$ sudo apt-get update
Hit:1 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal InRelease
Hit:2 https://packages.microsoft.com/ubuntu/21.04/prod hirsute InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports hirsute InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports hirsute-updates InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports hirsute-backports InRelease
Hit:6 http://ports.ubuntu.com/ubuntu-ports hirsute-security InRelease
Reading package lists... Done
username@pcname:~$ sudo apt-get install -y mssql-server
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package mssql-server
username@pcname:~$ 

Any help will be great. Thnx in advance

1

There are 1 best solutions below

4
On

According to Microsoft official website, MS SQL is available for Ubuntu 16.04 LTS, 18.04 LTS, 20.04 LTS. In most of the case steps for 20.04 works for 21.04.

Try the following commands one after another: Update your System first

sudo apt update && sudo apt upgrade

Get Public GPG key and add the repository

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

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

Install MS SQL

sudo apt-get update
sudo apt-get install -y mssql-server

If there is an error occurs, can be solved by enabling the Universe repository with this command and then retry to install. sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) universe".

Run the command below for configuration setup and follow instructions

sudo /opt/mssql/bin/mssql-conf setup 

verify thet MS SQL service is running using the following command

systemctl status mssql-server --no-pager