X

How To Install MSSQL Server 2019 On Ubuntu 16.04

In this tutorial how to install mssql server 2019 on ubuntu 16.04. At this time Microsoft provides for linux package for using mssql server 2019. So first install clean ubuntu 16.04 then follow this guide.

How To Install Zabbix 5.0 On Ubuntu 20.04 Server

How To Install Zabbix Agent On Centos 7

#########################
OS Type : Ubuntu 16.04
RAM  : 2.5 GB
DISK  : 25 GB Main
IP Address : 10.66.100.16
vCPU  : 2
Service : MSSQL Server 2019
#########################

Step #01: Must be server update & upgrade using below command.

root@mssql-server:~# lsb_release -a
root@mssql-server:~# ip r
root@mssql-server:~# apt update && apt upgrade -y
root@mssql-server:~# apt install software-properties-common
root@mssql-server:~# apt -y autoremove

Add mssql officail repo using below command.

root@mssql-server:~# wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
root@mssql-server:~# add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"

Then update and install mssql server 2019 on ubuntu 16.04.

root@mssql-server:~# apt-get update
root@mssql-server:~# apt-get install -y mssql-server

It will take up to 10 or 15 minute, then setup main mssql version using below command.

root@mssql-server:~# sudo /opt/mssql/bin/mssql-conf setup

I use 2 this is for Developer version. You can use any version from this PAID or free. See mssql service is running.

root@mssql-server:~# systemctl status mssql-server --no-pager

Now successfully installation done mssql server 2019 on ubuntu 16.04.

Step #02: Install mssql cmd package for using via command line.

root@mssql-server:~# curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
root@mssql-server:~# curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
root@mssql-server:~# apt-get update

Now install mssql cmd package using below command.

root@mssql-server:~# apt-get install -y mssql-tools unixodbc-dev

It will take up to 5 or 10 minute.

Step #03: Add mssql path into bash_profile.

root@mssql-server:~# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
root@mssql-server:~# echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc
root@mssql-server:~# source ~/.bashrc

Now login mssql terminal via below command.

root@mssql-server:~# sqlcmd -S localhost -U SA -P 'P@ssw0rd0@123'

It will take up to 5 or 10 minute.

Step #04: Create test database from command line.

> CREATE DATABASE TestDB
> SELECT Name from sys.Databases
> GO

Create database table using below command.

> USE TestDB
> CREATE TABLE Inventory (id INT, name NVARCHAR(50), quantity INT)
> INSERT INTO Inventory VALUES (1, 'banana', 150); INSERT INTO Inventory VALUES (2, 'orange', 154);
> GO

Show inserted data using below command.

> SELECT * FROM Inventory WHERE quantity > 152;
> GO

Then exit from mssql terminal.

> QUIT

Note : GO is execute command from mssql terminal.

If you not able install this process, so please see my YouTube video for more details.

0 0 votes
Article Rating
Admin: I am system administrator as Windows and Linux platform. I have 4 years skilled from the professional period. I have to configure Linux based system such as an Asterisk VOIP system, Network monitoring tools (ZABBIX), Virtualization (XEN Server), Cloud computing (Apache CloudStack) etc. Now share my professional skill each interested person. Thanks to all.
Leave a Comment