Buzz Update How to install Microsoft SQL Server on Ubuntu 20.04 LTS TOU

Buzz Update How to install Microsoft SQL Server on Ubuntu 20.04 LTS

 TOU

How to install Microsoft SQL Server on Ubuntu 20.04 LTS

Learn the steps and instructions to install Microsoft SQL Server on Ubuntu 20.04 LTS Focal Focus using the command terminal.

Microsoft SQL Server is a proprietary and closed source database server platform, unlike software and MySQL from Microsoft. It has been used by many large enterprises for corporate applications that require SQL based relational database management systems.

We can use it for business intelligence and business-critical applications. This includes MSSQL server services such as reporting services, analytics services, integration services or SQL Server Data Tools (SSDT). It also supports OLE DB and ODBC for open database connectivity. Using the powerful MS SQL, a scalable hybrid database platform can be run exclusively in a data center, private cloud, or database management system on public cloud servers such as Microsoft Azure.

Key Benefits of Microsoft SQL Server:

High performance, availability and good scalability
Can be used on-premises servers and in the cloud
Suitable for Big Data and Business Intelligence applications
Support for in-memory functions
Advanced security features,
Support for Statistical LanguageR.
Can be used on Windows, Linux and container environments.

Steps to install Microsoft SQL Server on Ubuntu 20.04 LTS

The instructions given here to set up MS SQL are similar to other Linux operating systems based on Ubuntu 20.04 LTS, POP OS, Linux Mint, Elementary OS and more …

1. Add the Microsoft SQL Server repository

Because it is a proprietary application, the MSSQL database server is not available for installation using the Ubuntu 20.04 LTS system repository. So, we need to add the official repository intended for Ubuntu Focal. As I run this tutorial, the latest version of this database is SQL 2019.

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

2. Add a public GPG key

Once you have added the repository, the next step is to add the GPG key used by MS SQL Server Developers to sign its packages. Our system needs a GPG key to ensure that packages from the attached repository are published by its developers.

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

3. Update your Ubuntu 20.04

OK, you need to run the update command after adding both the GPG and the Microsoft SQL Server repository. This is because we need to rebuild the APT Package Manager cache to ensure that it can detect the latest packages available through the attached repository.

sudo apt update

4. Install SQL Server 2019 on Ubuntu 20.04

Finally, use the APT package to install MSSQL as we do for other software in Ubuntu.

sudo apt-get install mssql-server

5. Configure the MSSQL Server

After you have completed the installation, start configuring your SQL server by executing the given command. It prompts you to set the SA (SQL System Administrator) password and prompts you to install any edition of the Microsoft SQL Server.

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

If you are looking for a free version, go for Evaluation, Developers or Express. Type the serial number of the edition you want to install, and then press the Enter key.

After selecting Edition, the installation wizard will ask you to set the SA user password.

Set the Microsoft SQL SA password on Linux

To check the status of the SQL service, see if it works without any errors.

systemctl status mssql-server --no-pager

After the installation is complete, you can connect software such as SQL Server Management Studio to connect to it remotely or locally using the GUI interface. However, for that, you need to open the default TCP port 1433 which uses SQL in your firewall.

sudo ufw allow 1433

——————————–To use the SQL Server‌ using the command line————————————

6. Install the SQL Server command-line tools

We need a tool that can execute transact-SQL statements on the SQL server to create a database using the command line. Therefore install tools – sqlcmd and bcp.

However, we need to add the Microsoft Production Repository for Linux to get command tools for the MSSQL Server.

curl https://packages.microsoft.com/config/ubuntu/20.04/prod.list | sudo tee /etc/apt/sources.list.d/msprod.list

Run a system update

sudo apt update

Install the MSSQL command tools

sudo apt-get install mssql-tools unixodbc-dev

After successfully completing the installation, use the command given to add the tool folder to your system path so that we can use it from anywhere in the terminal regardless of the current directory.

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

7. Create a database

Once the MSSQL tools are in your system, we can create a SQL database using the Ubuntu command terminal. To do so, first log in to the SQL command shell using your SA account and password.

sqlcmd -S localhost -U SA -P 'YourPassword'

Note: Replace Your password With the original password you set when configuring MSSQL.

Now, create your DB using the given command:

CREATE DATABASE myfistdb

To execute the above command, use:

GO

For creating the table

Select DB First:

USE myfistdb

NowLet’s create a table with a name – The first

CREATE TABLE firstable (id INT, name NVARCHAR(50), quantity INT)

To insert data into a new table:

INSERT INTO firstable VALUES (1, 'mango', 150); INSERT INTO firstable VALUES (2, 'carrot', 154);

To execute the above commands, use again:

GO

To exit the SQLCMD command-line shell, however, use:

QUIT

This is a quick tutorial on how to install and use Microsoft SQL Server on Ubuntu 20.04 LTS Linux. To learn more about how to use this database, see Official tutorial Provided by Microsoft.

Other articles:

3 Ways to Install Beekeeper Studio on Ubuntu 22.04 | 20.04 LTS
Command to install Vmware tools on Ubuntu using the terminal
How to install Umbraco CMS on Ubuntu 20.04 LTS
Install the FreeTube – YouTube Player app on Ubuntu

if you want to read this article from the original credit source of the article then you can read from here.

Leave a Reply