How to install Microsoft SQL Server 2019 on Ubuntu 20.04

How To Install Microsoft SQL Server 2019 On Ubuntu 20.04 LTS

On this short tutorial we will show you how to install Microsoft SQL Server 2019 on Ubuntu 20.04 LTS operating system.

Introduction

Microsoft SQL Server is a relational database management system developed by Microsoft Corp. Microsoft SQL Server available in multiple editions, with different feature sets and targeting different users. These editions are: Enterprise, Standard, Web, Business Intelligence, Workgroup and Express. SQL Server Developer Edition includes the same features as SQL Server Enterprise Edition, but is limited by the license to be only used as a development and test system, and not as production server. Starting early 2016, Microsoft made this edition free of charge to the public.

On this article we will disucss how to install MS SQL Server on Ubuntu 20.04 LTS operating system.

Prerequisites

Before we are going to the installation process, there are several prerequisites must be met, as follow :

  • Ubuntu 20.04 machine with at least 2 GB of memory
  • User account with sudo privilege
  • Sufficient disk and good internet connection

Install Microsoft SQL Server 2019

On this article we will select Mircosoft SQL Server 2019 Developer edition which is free and no production use rights.
The MS SQL Server 2019 Installation on Ubuntu 20.04 LTS will be consist of several steps :

1. Import the public repository GPG keys
2. Register the Microsoft SQL Server Ubuntu repository for SQL Server 2019
3. Install Microsoft SQL Server Package
4. Setup Microsoft SQL Server
5. Verify the Installation

1. Import Public Repository GPG Keys

On this step we will import public repository GPG keys of Microsoft MS SQL server to our Ubuntu system.

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

2. Register the SQL Server Ubuntu repository

This step can be done by running the command line.

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

3. Install Microsoft SQL Server 2019

On this stage, we will start the installation process. It will be performed by submitting following commands line.

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

Output :

ramans@otodiginet:~$ sudo apt-get update
Hit:1 http://mirror.telkomuniversity.ac.id/ubuntu focal InRelease
Hit:2 http://mirror.telkomuniversity.ac.id/ubuntu focal-updates InRelease 
Hit:3 http://mirror.telkomuniversity.ac.id/ubuntu focal-backports InRelease 
Hit:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease 
Hit:7 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease 
Hit:8 http://ppa.launchpad.net/ubuntu-mozilla-daily/ppa/ubuntu focal InRelease 
Hit:5 https://downloads.apache.org/cassandra/debian 40x InRelease 
Hit:6 https://downloads.apache.org/cassandra/debian 311x InRelease 
Hit:10 http://mirror.telkomuniversity.ac.id/ubuntu focal-security InRelease 
Hit:11 https://deb.nodesource.com/node_14.x focal InRelease 
Hit:12 https://dl.yarnpkg.com/debian stable InRelease 
Hit:13 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal InRelease 
Hit:9 https://packagecloud.io/sensu/stable/ubuntu focal InRelease
Reading package lists... Done
ramans@otodiginet:~$ sudo apt-get install -y mssql-server
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following additional packages will be installed:
libc++1 libc++1-10 libc++abi1-10 libsasl2-modules-gssapi-mit libsss-nss-idmap0
Suggested packages:
clang
The following NEW packages will be installed:
libc++1 libc++1-10 libc++abi1-10 libsasl2-modules-gssapi-mit libsss-nss-idmap0 mssql-server
0 upgraded, 6 newly installed, 0 to remove and 149 not upgraded.
Need to get 247 MB/247 MB of archives.
After this operation, 1,139 MB of additional disk space will be used.
Get:1 https://packages.microsoft.com/ubuntu/20.04/mssql-server-2019 focal/main amd64 mssql-server amd64 15.0.4138.2-1 [247 MB]
Fetched 127 MB in 1min 27s (1,454 kB/s) 
Preconfiguring packages ...
Selecting previously unselected package libc++abi1-10:amd64.
(Reading database ... 208810 files and directories currently installed.)
Preparing to unpack .../0-libc++abi1-10_1%3a10.0.0-4ubuntu1_amd64.deb ...
Unpacking libc++abi1-10:amd64 (1:10.0.0-4ubuntu1) ...
Selecting previously unselected package libc++1-10:amd64.
Preparing to unpack .../1-libc++1-10_1%3a10.0.0-4ubuntu1_amd64.deb ...
Unpacking libc++1-10:amd64 (1:10.0.0-4ubuntu1) ...
Selecting previously unselected package libsasl2-modules-gssapi-mit:amd64.
Preparing to unpack .../2-libsasl2-modules-gssapi-mit_2.1.27+dfsg-2_amd64.deb ...
Unpacking libsasl2-modules-gssapi-mit:amd64 (2.1.27+dfsg-2) ...
Selecting previously unselected package libc++1:amd64.
Preparing to unpack .../3-libc++1_1%3a10.0-50~exp1_amd64.deb ...
Unpacking libc++1:amd64 (1:10.0-50~exp1) ...
Selecting previously unselected package libsss-nss-idmap0.
Preparing to unpack .../4-libsss-nss-idmap0_2.2.3-3ubuntu0.4_amd64.deb ...
Unpacking libsss-nss-idmap0 (2.2.3-3ubuntu0.4) ...
Selecting previously unselected package mssql-server.
Preparing to unpack .../5-mssql-server_15.0.4138.2-1_amd64.deb ...
Unpacking mssql-server (15.0.4138.2-1) ...
Setting up libc++abi1-10:amd64 (1:10.0.0-4ubuntu1) ...
Setting up libsss-nss-idmap0 (2.2.3-3ubuntu0.4) ...
Setting up libsasl2-modules-gssapi-mit:amd64 (2.1.27+dfsg-2) ...
Setting up libc++1-10:amd64 (1:10.0.0-4ubuntu1) ...
Setting up libc++1:amd64 (1:10.0-50~exp1) ...
Setting up mssql-server (15.0.4138.2-1) ...

+--------------------------------------------------------------+
Please run 'sudo /opt/mssql/bin/mssql-conf setup'
to complete the setup of Microsoft SQL Server
+--------------------------------------------------------------+

Processing triggers for man-db (2.9.1-1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...

4. Setup Microsoft SQL Server

After the package installation is completed, the we wil run mssql-conf setup. To perform this task we will do the following command line.

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

Output :

ramans@otodiginet:~$ sudo /opt/mssql/bin/mssql-conf setup
usermod: no changes
Choose an edition of SQL Server:
1) Evaluation (free, no production use rights, 180-day limit)
2) Developer (free, no production use rights)
3) Express (free)
4) Web (PAID)
5) Standard (PAID)
6) Enterprise (PAID) - CPU Core utilization restricted to 20 physical/40 hyperthreaded
7) Enterprise Core (PAID) - CPU Core utilization up to Operating System Maximum
8) I bought a license through a retail sales channel and have a product key to enter.

Details about editions can be found at
https://go.microsoft.com/fwlink/?LinkId=2109348&clcid=0x409

Use of PAID editions of this software requires separate licensing through a
Microsoft Volume Licensing program.
By choosing a PAID edition, you are verifying that you have the appropriate
number of licenses in place to install and run this software.

Enter your edition(1-8): 2
The license terms for this product can be found in
/usr/share/doc/mssql-server or downloaded from:
https://go.microsoft.com/fwlink/?LinkId=2104294&clcid=0x409

The privacy statement can be viewed at:
https://go.microsoft.com/fwlink/?LinkId=853010&clcid=0x409

Do you accept the license terms? [Yes/No]:Yes

Enter the SQL Server system administrator password: 
Confirm the SQL Server system administrator password: 
Configuring SQL Server...

ForceFlush is enabled for this instance. 
ForceFlush feature is enabled for log durability.
Created symlink /etc/systemd/system/multi-user.target.wants/mssql-server.service → /lib/systemd/system/mssql-server.service.
Setup has completed successfully. SQL Server is now starting.

On our tutorial, we hav set the SA password and choose  the edition as Developer (number 2).

5. Verify Microsoft SQL Server Installation

After the installation is completed, then we havet to verify if  the service of MS SQL Server 2019 is running. For this purpose we will submit the command line :

$ systemctl status mssql-server --no-pager

Output :

ramans@otodiginet:~$ systemctl status mssql-server --no-pager
● mssql-server.service - Microsoft SQL Server Database Engine
Loaded: loaded (/lib/systemd/system/mssql-server.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-06-18 00:31:25 PDT; 1min 7s ago
Docs: https://docs.microsoft.com/en-us/sql/linux
Main PID: 11595 (sqlservr)
Tasks: 156
Memory: 651.5M
CGroup: /system.slice/mssql-server.service
├─11595 /opt/mssql/bin/sqlservr
└─11622 /opt/mssql/bin/sqlservr

Jun 18 00:31:30 otodiginet sqlservr[11622]: [145B blob data]
Jun 18 00:31:30 otodiginet sqlservr[11622]: [155B blob data]
Jun 18 00:31:30 otodiginet sqlservr[11622]: [61B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [96B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [66B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [75B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [96B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [100B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [71B blob data]
Jun 18 00:31:31 otodiginet sqlservr[11622]: [124B blob data]

So far, our installation is completed done.

Conclusion

On this short tutorial, we have learnt how to install Microsoft SQL Server 2019 on Ubuntu 20.04 Server. I hope this tutorial will helpful.

(Visited 131 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *