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.
[email protected]:~# lsb_release -a && ip r [email protected]:~# apt update && apt upgrade -y [email protected]:~# apt install software-properties-common [email protected]:~# apt -y autoremove [email protected]:~# wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
For Ubuntu 16.04 – See video from YouTube.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# sudo add-apt-repository "$(wget -qO- https://packages.microsoft.com/config/ubuntu/20.04/mssql-server-2019.list)"
Then must be use update command.
[email protected]:~# sudo apt-get update
Step #02: Now install MSSQL server command on Ubuntu server.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# sudo curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
For Ubuntu 16.04 – See video from YouTube.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# 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.
[email protected]:~# sudo apt-get update
Step #04: Install MSSQL tools for using command line.
[email protected]:~# sudo apt-get install -y mssql-tools unixodbc-dev
Add path to your profile using below command.
[email protected]:~# sudo echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile [email protected]:~# sudo echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc [email protected]:~# sudo source ~/.bashrc
Now login to your MSSQL CMD using below command.
[email protected]:~# sudo sqlcmd -S localhost -U SA -P '[email protected]@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 Odoo 16 on Ubuntu 22.04 - May 14, 2023
- 12 Steps to Organize Photos on Your Computer - March 20, 2023
- 9 Ways to Speed Up Your MacBook Yosemite - February 21, 2023
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!