Operating System: Ubuntu >= 16.04 Version, with at least 2 GB RAM
Note, Ubuntu 16.04 is the official version supported by Microsoft. Other versions require some additional modifications to support SQL Server installation.

Commands to prepare system for Installation:

sudo apt-get update
sudo apt-get -y upgrade
sudo reboot

Commands to MS SQL Server Installation:

wget -qO- | sudo apt-key add -

For SQL Server 2017

sudo add-apt-repository "$(wget -qO-"

For SQL Server 2019

sudo add-apt-repository "$(wget -qO-"
sudo apt-get update sudo apt install libcurl3 sudo apt-get install -y mssql-server

Run below if you see error, “mssql-server : Depends: openssl (<= 1.1.0) but 1.1.0g-2ubuntu4.1 is to be installed“

sudo dpkg -i openssl_1.0.2g-1ubuntu4_amd64.deb
sudo apt-get -y install mssql-server
sudo /opt/mssql/bin/mssql-conf setup
systemctl status mssql-server --no-pager
sudo ufw allow 1433
sudo ufw allow 1434

Commands to SQL Server Command-line tools installation:

curl | sudo apt-key add –
curl | sudo tee /etc/apt/sources.list.d/msprod.list
sudo apt-get update  sudo ACCEPT_EULA=Y apt-get -y install mssql-tools unixodbc-dev
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bash_profile
echo 'export PATH="$PATH:/opt/mssql-tools/bin"' >> ~/.bashrc source ~/.bashrc

Commands to Connect to SQL Server and Writing queries:

sqlcmd -S localhost -U SA -P 'Password'
SELECT Name from sys.Databases

For detailed instructions, please refer below