Microsoft recently made available SQL public preview of SQL Server for Linux.
It is important to make it clear SQL on Linux is not a “light” SQL version but Microsoft’s goal is a fully featured SQL Server.
In this article I will explore the process to Install SQL on Linux on an on-premises lab.
Install SQL on Linux – Supported Platforms
Before exploring the actual installation instructions be aware SQL on Linux is supported on the following distributions
- Red Hat Enterprise Linux 7.2
- Ubuntu Linux 16.04
- SUSE Linux Enterprise Server 12 SP2 (still not supported but will be soon so I’ve included it anyhow)
There are other deployment options like running on Docker or an Azure Virtual machine but for this article I will use Ubuntu Linux 16.04 as I already have a VM running it.
Deploying Ubuntu Server is a trivial process so I will not cover the OS installation steps here.
Install SQL on Linux – Step by Step
Connect to the Linux server where you will install SQL and issue the following command
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
This will install the Microsoft repository key in the local keyring so to trust the repository and install software from it.
Next you need to register the repository so that the local system will know where to download files from
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
Now rune the following command to refresh repository metadata
sudo apt-get update
[su_note note_color=”#ffff96″ text_color=”#000000″ radius=”5″]Note: During my tests, and while I was writing this article, I received errors about repository name not being resolvable. While I think this issue is just temporary should you face it just re-running the command will take care of it. [/su_note]
Finally run the following command which will carry on SQL Server installation
sudo apt-get install -y mssql-server
The above screenshot is just partial as a lot of text will flow on the screen while necessary packages are downloaded and installed, once everything has been correctly downloaded the following success message will be displayed
As the instructed on-screen run /opt/mssql/bin/sqlservr-setup command to start SQL Configuration
You will be asked to insert sa password and configure services startup
That’s it! SQL is now installed on your Linux machine you can easily check if it is running via the following command
Of course if you prefer to use GUI tools here’s a screenshot from one of my lab machines with SQL Management Studio installed and connected to Linux SQL Server
A big kudos to Microsoft for releasing SQL on Linux and making the installation a breeze!
I hope you will find the article useful and would like to hear your experience in the comments. If you face any issue or have problems don’t hesitate to let me know and I will try to assist you.