How To Install MSSQL Server 2019 On Ubuntu 16/18/206 min read
In this tutorial how to install MSSQL server 2019 on Ubuntu 16.04 or Ubuntu 18.04 or Ubuntu 20.04 server. Microsoft provide MSSQL server using for ubuntu. So you can use this on your network.
★ How To Install OpenProject On Ubuntu 16.04
★ How To Quick Install Grafana Server On Ubuntu 18.04
This is my server info.
########################################### OS Type : Ubuntu 16.04/18.04/20.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 and upgrade using below command.
Below command for all servers.
root@mssql:~# lsb_release -a && ip r root@mssql:~# apt update && apt upgrade -y root@mssql:~# apt install software-properties-common root@mssql:~# apt -y autoremove root@mssql:~# wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
For Ubuntu 16.04 – See video from YouTube.
root@mssql:~# sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/16.04/mssql-server-2019.list)"
For Ubuntu 18.04 – See video from YouTube.
root@mssql:~# sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)"
For Ubuntu 20.04 – See video from YouTube.
root@mssql:~# sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)"
Then must be use update command.
root@mssql:~# sudo apt-get update
Step #02: Now install MSSQL server command on Ubuntu server.
root@mssql:~# sudo apt-get install -y mssql-server
Wait at least 5-10 minute for complete installation process.
Now configure which version you want to install.
root@mssql:~# sudo /opt/mssql/bin/mssql-conf setup
Then select as you want. as like below image.
Then check mssql service is running using below command.
root@mssql:~# sudo systemctl status mssql-server --no-pager
Then select as you want. as like below image.
Now Successfully installation done! you can connect MSSQL server using management studio. But next step how to install mssql cmd and use using terminal.
Step #03: Install MSSQL CMD on Ubuntu server.
Below command for all servers.
root@mssql:~# sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
For Ubuntu 16.04 – See video from YouTube.
root@mssql:~# sudo curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
For Ubuntu 18.04 – See video from YouTube.
root@mssql:~# sudo curl https://packages.microsoft.com/config/ubuntu/18.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
For Ubuntu 20.04 – See video from YouTube.
root@mssql:~# sudo curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list
Then update command for all servers.
root@mssql:~# sudo apt-get update
Step #04: Install MSSQL tools for using command line.
root@mssql:~# sudo apt-get install -y mssql-tools unixodbc-dev
Add path to your profile using below command.
root@mssql:~# sudo echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile root@mssql:~# sudo echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc root@mssql:~# sudo source ~/.bashrc
Now login to your MSSQL CMD using below command.
root@mssql:~# sudo sqlcmd -S localhost -U SA -P 'P@ssw0rd0@123'
Step #05: Create database and insert test data.
> CREATE DATABASE TestDB > SELECT Name from sys.Databases > GO
Create Inventory 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
Then show inserted value using below command.
> SELECT * FROM Inventory WHERE quantity > 152; > GO
And then QUIT from mssql cmd.
If you want to see any error so please see my YouTube channel. Don’t forget subscribe my channel for more updates.
- How To Install Zabbix Server 6.4 On AlmaLinux 8 Server - August 9, 2024
- How To Clear RAM Memory Cache Buffer Linux Server - February 29, 2024
- How To Install Apache Cloud Stack Management Server 4.17 On Ubuntu 22.04 - February 1, 2024
We really appreciate for your support for buying me a coffee.
It takes us a while to compose and upload new content, as they have to be checked to see if Properly works. We appreciate you if you help me for one cup of coffee to keep us awake and always deliver good quality content.
No contribution is small of an amount. We are grateful for any amount you support us with. Thank you!