Note - All screenshots are applied to Ubuntu 16.04
Introduction
With the release of Microsoft SQL Server on Linux, it is a huge step for the company towards gaining markets in Database technologies, giving competition to other RDBMS software. Microsoft SQL Server is not only on Windows but it is on Linux also and people who love Linux can have the flavor of SQL Server in Linux environment.
Installation Steps
To install SQL Server vNext on Ubuntu 16.04, I followed Microsoft Documentation For SQL Server vNext. So, let’s start step by step procedure to install SQL Server vNext on Ubuntu 16.04.
Step 1
First, we need to import GPG keys (Authentication keys) from Microsoft website. To import GPG Keys from Microsoft website, we need to execute the following commands,
- curl
CURL is a command line tool for getting or sending files using URL syntax via transferring files using different protocols.
- apt-key
apt-key is used to manage the list of keys used by apt to authenticate packages. Packages which have been authenticated using these keys will be considered trusted.
- sudo
As per the Wikipedia definition; sudo is a program for Unix-like computer operating systems that allows users to run programs with the security privileges of another user, by default the superuser. It originally stood for "superuser do" as the older versions of sudo were designed to run commands only as the superuser. Execute below command to import GPG keys,
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
Figure1 Importing GPG Keys for SQL Server from Microsoft Website
Step 2
The second step is to register or add the SQL Server vNext in Ubuntu repository (Repositories are servers which contain sets of packages). To register SQL Server vNext in Ubuntu, here we are using two commands.
- curl - has been explained in step1.
- tee - tee command is used to view and store the output of any command at the same time.
To register SQL Server vNext in Ubuntu repository, we need to execute below command:
curl https://packages.microsoft.com/config/ubuntu/16.04/mssql-server.list | sudo tee /etc/apt/sources.list.d/mssql-server.list
Figure2 Registering SQL Server vNext in Ubuntu Repository
Step 3
After importing GPG keys and registering SQL Server vNext in Ubuntu repositories, the next step is to update the repositories and to update repositories we will execute below apt-get update command.
sudo apt-get update
Figure3 Updating the Ubuntu Repositories
Step 4
After updating Ubuntu repositories it is time to execute below apt-get install command to install SQL Server vNext.
sudo apt-get install mssql-server
Figure4 Installing SQL Server vNext
Step 5
When installing the SQL Server vNext, the default path is /opt/mssql/bin. After installation we need to configure mssql using below mssql-conf command,
- mssql-conf
Like we manage and configure SQL Server Services in Windows with SQL Server Configuration Manager; in the same way we can configure SQL Server vNext on Ubuntu and manage SQL Server on Linux with mssql-conf. mssql-conf is a configuration script that installs with SQL Server vNext (Linux)
sudo /opt/mssql/bin/mssql-conf setup
When we execute the above command it will ask Yes / No to continue. We need to enter “Y” to complete the configuration step.
It will give prompt to enter password for sa, here we need to give strong passwords for sa account. After that our setup will finally complete successfully.
Figure5 Executing mssql-conf command to complete setup
Step 6
After complete installation and configuration of SQL Server, we can verify SQL Server Service to check whether SQL Server is running or not. To verify SQL Server Service, we can execute below command.
systemctl status mssql-server
Figure6 Verifying SQL Service is Running
After executing systemctl status mssql-sever command, in output it is coming that mssql-server.service is enabled and it active (running).
This is all about how to install SQL Server vNext. At this step SQL Server installed completely but to work with SQL Server we need to install sql tools. We will learn to install SQL Tools in next article. Until then stay tuned and happy reading.
Note
It is suggested that get an idea about basics of File system in Linux. It will help us to understand where files are getting stored, what will be the default directory when we will take backup, what are folders representing etc.
Below is the some reference link to get an idea about Linux basic file systems:
- https://linuxconfig.org/filesystem-basics
- https://www.tutorialspoint.com/unix/unix-file-system.htm
- http://www.dummies.com/computers/operating-systems/linux/linux-file-system-basics/
Wrap-Up
I tried my best to explain all the steps so that the person who is not familiar with Linux environment can also get an idea. In this article, I covered the installation steps. When you reach the end of article, SQL Server vNext will be completely installed but we need to install tools also to work and connect with SQL Server vNext which I will cover in the next article. So, keep reading and stay tuned to get updates.