Getting started with SQL server on Linux (using Azure data studio)

Image : Google Images

Here is a guide to getting started with SQL Server and Azure Data Studio on Linux.

When I was starting on in my career , databases always meant the MySQL and PHP way to implement anything. However even though MySQL is really a gem SQL Server and it’s functionality gives you the full enterprise like experience and ease to implement into your code and especially the activity manager aka activity monitor which I fell for immediately.

Starting with SQL server and that too Linux is not very easy a task. Mostly the primary reason being that all the config files and supporting installation scripts are python 2.x compatible which is strange considering how long ago python 3.x was launched. I did not have python 2.x and did not want two python versions on my PC so I took up the task to convert most of the available installation scripts to support python 3.x and which is yet in progress giving the sheer amount of things needed to change. Meanwhile the development couldn’t have waited and hence I am writing a guide to facilitate ease in installing SQL Server on Linux. The documentation is pretty good in describing things but also is a lot of different pages to visit for a simple task. Hence adding it all under one page here.

My Machine configuration is as follows(for reference) :

  • Intel I3-6006U
  • 4GB / 1TB
  • Dual boot
    • Fedora 31
    • Windows 10
  • Python 2.7 and 3.5 with pip package manager.

To successfully install SQL server and start using it follow the following steps carefully:

  1. Update your system : Run sudo dnf update followed with sudo dnf upgrade to have the most recent updates to your Fedora machine. If you are using Debian/Ubuntu you can simply do sudo apt-get update and sudo apt-get upgrade respectively.

  2. Download SQL configuration file from Red Hat repository :

sudo curl -o /etc/yum.repos.d/mssql-server.repo https://packages.microsoft.com/config/rhel/8/mssql-server-2019.repo

  1. To Install the SQL server run :

sudo yum install -y mssql-server

This will install all the primary requirements for SQL server.

  1. Now to configure your SQL server installation you need to run the following command in order to complete the installation. The configuration step includes various options to add/remove add-ons to your SQL server installation and also to choose your edition.

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

  1. This will fully install SQL server on your machine. Installation doesn’t take much time as most of the stuff is already done in Step 4 and step 5 includes configurations and settings that are needed to be installed in order to run the server.

  2. Run systemctl status mssql-server to check whether the service is running or not. You can also use the standard start and stop for systemctl to change the service state.

So far we have installed SQL server but we also need to be able to access it, you can use pyodbc for all your python needs , also UnixODBC to connect via python program and/or command line. For that you will need some command line tools which you can learn to install here following steps by clicking here . The reason for not including here is :

  • It is already included on the link like the above steps too.
  • The focus here is SQL Server + Azure Data Studio
  1. To install Azure Data studio in a very simple way click here for version 1.15.1

  2. After the successful installation it will show up in your app directory.

  3. Simply start using command azuredatastudio in terminal or by clicking Azure data studio in apps and connect with the username and password that you had configured in step 4. Default username is SA

You have now successfully managed to install SQL Server using Azure Data Studio on Linux(Fedora).


Next
Previous

Related