SQL Server on Linux

4 (2 reviews total)
By Jasmin Azemović
  • Instant online access to over 7,500+ books and videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Linux Distributions

About this book

Microsoft's launch of SQL Server on Linux has made SQL Server a truly versatile platform across different operating systems and data-types, both on-premise and on-cloud.

This book is your handy guide to setting up and implementing your SQL Server solution on the open source Linux platform. You will start by understanding how SQL Server can be installed on supported and unsupported Linux distributions. Then you will brush up your SQL Server skills by creating and querying database objects and implementing basic administration tasks to support business continuity, including security and performance optimization. This book will also take you beyond the basics and highlight some advanced topics such as in-memory OLTP and temporal tables.

By the end of this book, you will be able to recognize and utilize the full potential of setting up an efficient SQL Server database solution in your Linux environment.

Publication date:
August 2017
Publisher
Packt
Pages
222
ISBN
9781788291804

 

Chapter 1. Linux Distributions

Welcome to the exciting new journey of our old friend in a new environment. Yes, we are talking about one of the best database platforms in the world. SQL Server is well known in the domain of the Windows operating system, whether we speak of small, medium, or enterprise-size businesses. Cloud computing pushes those limits even further in the directions of big data analytics and data science. SQL Server has it all.

Linux, or to be precise GNU/Linux, is one of the best alternatives to Windows and, in many cases, it is the first choice of environment for daily tasks such as system administration, running different kinds of services, or just a tool for desktop application. Linux, which is the actual name for a kernel, was originally developed in 1991 by Linus Torvalds as his response to the MINIX operating system, which was limited to educational use. It was quickly recognized by the open source community, adopted, and packaged in many distributions. It's fascinating how large that number is. I believe that you've heard or read at least one name in the following list (the list is arranged by date (1993 - 2013)): Debian, Slackware, SUSE Linux, Red Hat Linux, CentOS, Fedora, Ubuntu, Tails, Kali Linux, and many more. Today, GNU/Linux does not hold a large chunk of the desktop operating system market. That fact is changing and many people, organizations, businesses, and even states are embracing this technology. But, if we talk about the server market, the situation is quite the opposite. Linux is holding a large share of the market.

However, Linux territory was a no-go for Microsoft products for a long time to be precise, from the beginning. Now, Microsoft loves Linux. A couple of years ago, this sentence would've sounded like a bad science fiction scenario. Fortunately, Microsoft has changed and become friendly to open source and free software philosophies. One of the reasons for this 180 degree change is cloud computing. New paradigms simply don't push old platform limitations to the background. Everything is a service now and it is not important where that service (Windows/Linux/Unix) is. The fact that Microsoft is pushing its core product on a couple of major Linux distributions speaks for itself.

However, one segment of the database ecosystem was out of Microsoft's reach. Linux was mostly reserved for open source representatives such as MySQL, PostgreSQL, and MariaDB, or proprietary ones such as IBM's DB2 and Oracle. But now it is time to change those facts. We can say that Microsoft is officially offering their data platform flagship as options and choice for database professionals in the Linux world. There are varied kinds of responses to this subject, from totally negative to positive comments. My opinion is that this is good thing. SQL Server is one of the best database environments; let's give them a chance to prove it on the ground. The Linux ecosystem has become richer and end users have more choices to pick the right solution for their needs.

This is not a book about Linux distributions, nor is it about Linux internals. Here, you will not find any Linux command line reference, but you will find a lot of useful information on how to deal with SQL Server on Linux.

This chapter targets DBAs, developers, and everyone else from the Windows playground. If you are from this group of users and you want to try out SQL Server in Linux land but don't know how to start, this is the chapter for you. If you are a Linux user with experience in your favorite distribution or different kinds of distributions, you can skip this chapter and go straight to the installation part.

In this chapter we will cover the following topics:

  • Supported Linux distributions
  • Installation of Linux operating system
 

Supported Linux distributions


When this book was written, SQL Server on Linux supported all major distributions:

  • Commercial: Red Hat Enterprise Linux 7.3 Workstation, Server, and Desktop
  • Commercial: SUSE Enterprise Linux Server v12 SP2
  • Free: Ubuntu 16.04 LTS and 16.10

Red Hat Enterprise Linux and SUSE Enterprise Linux are commercial versions of popular open source and free distributions. So, this list can be easily expanded to include the following distributions:

  • openSUSE Leap/Tumbleweed
  • Fedora

The two are not officially listed in the documentation but they work just fine, the same as the commercial versions. If you don't have any Linux experience whatsoever, I recommend Ubuntu or openSUSE. These two distributions will be covered in this chapter, specifically how to install them and prepare for SQL Server installation.

 

openSUSE


This distribution has a long history (https://www.suse.com/company/history/). The journey started under the name of SUSE Linux in 1994. Later, in 2003, Novel bought SUSE and its brand and trademark. The company recognized the importance of the community and created openSUSE, preserving the open source philosophy.

Novel was acquired by The Attachmate Group in 2011 and SUSE became an independent part of the company business. In a nutshell, SUSE has two product lines:

  • Commercial: SUSE Enterprise Server (SLES)
  • openSUSE: an independent community project based on SLES source code

Microsoft officially supports SLES, but openSUSE is in that train also.

 

Installation procedure


Let's start with the installation of openSUSE Leap 42.2, stable release. I will use a Hyper-V virtualization environment, but any other, such as VMWare or Oracle Virtual Box, will be just fine. If you are planning to install a native Linux environment without virtualization, the steps are the same. The installation of ISO can be found at https://www.opensuse.org/. You can mount ISO directly inside your virtual machine, create a bootable USB drive, or burn a DVD. The choice is yours.

The steps for the installation of openSUSE Leap 42.2 are as follows:

  1. The welcome screen will show up after the initial boot procedure from USB drive, DVD ROM, or ISO image directly as shown in the following screenshot.

Figure 1-1. openSUSE welcome screen

  1. In the next step, you can choose to book from the hard drive, start a fresh installation of openSUSE, run an upgrade process of an old installation, or initialize some advanced steps. We will choose Installation.

 

  1. Now, we pick the installation language and keyboard layout as shown in the following screenshot. You can test specific language characters if you come from non-English region. The license agreement is also there. Click Next after you are satisfied with your choices.

Figure 1-2. Keyboard layout and license agreement

  1. Linux can work without a network connection, but for full efficiency, this step is recommended. Here you will see a list of all network adapters that are recognized by the setup procedure in your PC, laptop, or virtual machine.

You can click on Next and finish network configuration after the installation procedure (if you decide to configure the network after installation, skip to the disk partition creation part), or you can do it now by choosing the network adapter name and clicking on Edit.

In most use cases, choosing Dynamic Address will be just fine. It will give you IP address, DNS, and Gateway settings. However, in some situations, you will need to manually enter those parameters by selecting Statically Assigned IP Address (In this scenario, you will need to know the DNS setting and gateway parameters to successfully configure network settings manually)

This is an important step if you are planning to use internet access in the following steps.

Figure 1-3. Set up the network 

  1. openSUSE comes with a huge collection of software and an excellent built-in package manager, but still you can install a lot more from separate media. Also you can add online software repositories before the installation starts. If you choose online repositories, then you will need an internet connection (you can go back to configure it, or you can leave both options off and activate those options after installation).

A slow internet connection can slow down your installation and you will need separate installation media for the add-ons. If you are an inexperienced Linux user, then I suggest that you leave the network connection and online repositories configuration until after installation is done.

Figure 1-4. Option to add online repositories during install

  1. You have the option to add online repositories during this step, you can choose your region and corresponding time zone. The same as in a Windows environment, these settings are reflecting the latter in the operating system and application that are depended on these parameters. The GUI is very nice, and by simply clicking, you can zoom in and focus on your country. By clicking on Other Settings, you can fine-tune those settings.

Figure 1-5. Regional settings

  1. Now is the moment of truth. Yes, seriously. This step will adapt your frontend and install the desktop environment of your choice.

Figure 1-6. Desktop selection

Almost every Linux distribution gives you two options. When it comes to openSUSE, you can pick one of the following:

Let us take a look at each one:

  • KDE Plasma desktop: KDE is not something new on the scene. It has been here since 1996 and in more than 20 years it has built a loyal user base. It is simple, efficient, robust, and Windows-like. You even have a Start (K) menu. If you are coming from a Windows background, then this should be your first choice. Don't get me wrong! KDE is popular in the world of Linux distributions. KDE is also my first choice and I will use it as the default installation option for openSUSE and Kubuntu (the KDE version of Ubuntu).
  • GNOME desktop: It is same as in the example before, GNOME is on the stage since 1999 and the user base is also large. We can say that the Linux community is divided between KDE and GNOME desktop environments. This is not a bad thing. Differences and options are good things and, if you are not a Start menu fan, then GNOME is just for you. openSUSE distribution comes with KDE as the default.
  • Server (text mode): This mode is simple, fast, and a good old Command Prompt environment. If you are planning to run some kind of production service (web, mail, FTP, and so on), there is no need for GUI at all (this philosophy is taken and implemented in Windows OS (Windows Core and Nano version)).

Figure 1-7. Creating initial local user

  1. The next step is about creating new user profile for daily tasks. Unlike Windows, Linux does not have admin first philosophy. This is regular user without root (super user permissions). It is not a good idea to work neater on Windows or Linux as admin (root). If you check Use this password for system administrator, the same password will be associated with root account. It will be required for admin tasks. However, if you skip this option it will bring you to the next screen where you can define different root password. This step is so important that installation gives you an option to test the keyboard layout just in case you are planning to use some exotic kind of characters.

Figure 1-8. Password for root access

  1. The next step is reviewing of chosen options. Still, you can go back and correct/modify some parameters before changes become permanent. After some time, when setup finishes you will get login screen. Enter your credentials and you are ready to go with openSUSE.

This book is not an openSUSE user guide, so if you are Windows user then you can reference some additional resources, but it will be easy. KDE is something familiar and its GUI is efficient enough to support your exploring through this great distribution.

Figure 1-9. Welcome to openSUSE

 

Kubuntu


Ubuntu is one of the simplest and most user friendly Linux distributions. It's based on Debian like many other distros whose roots date back to the distant 2004. Ubuntu is, by default, a GNOME (Unity) based environment which is OK. But my opinion is that Windows users will find it a little bit confusing. KDE is much better for them. Kubuntu is official flavor of the Ubuntu based on KDE plasma desktop, started in 2005. From the perspective of SQL Server there is no difference at all because most of our work will be console based.

Installation procedure

Kubuntu has a different approach than openSUSE. At the same time, Kubuntu is a live distribution, it means that after boot you are directly in the working environment where you can test things. At any time, you can start installation and make permanent changes on your disk. This following screenshot shows how Kubuntu looks after boot procedure.

Figure 1-10. Welcome screen of Kubuntu live distribution

If you are not an adventurous type and you like to keep things simple, then Kubuntu is your kind of Linux distribution.

Now, you can test the environment by running different kinds of applications: Libre Office, Firefox, Thunderbird, GIMP, and so on, or you can click on K menu | Applications | System | Install this system permanently to hard disk. After this step, the process of Kubuntu installation is very similar to openSUSE. The installation procedure involves the following steps:

  1. First, you need to choose the language for the install process and it will be the default language for that computer.

Figure 1-11. Language settings

  1. The next step is to configure network connection. During the testing phase, before installation, you can make right click on the icon of the screen near to the clock and setup you network parameters. Those setting are recognized by the setup procedure and used later.

Figure 1-12. Network parameters

  1. If the network is working, then you can download updates while installing Kubuntu and/or install third party software. You can skip this step and finish it later.

Figure 1-13. Option to add online repositories during install

  1. We must be honest and admit Kubuntu is much simpler to install the openSUSE. One of the proofs is disk setup. All you need is to pick an option without necessary technical details. Those details can scare users who don't have experience with disk partitioning. We can apply the same rule as before. If you're just starting with Linux and you don't care about the partitioning thing, then you chose Guided - use entire disk. After this step, changes on the disk become permanent and it may lead to data loss.

Figure 1-14. Disk partitioning

  1. Now, you need to select your location and time zone settings is next step. This is important because of the display conventions for your country.

Figure 1-15. Regional settings

  1. This leads to a screen where you can choose a keyboard layout and variant, if any. The nice thing is that you can actually see specific language letters and compare them with your physical keyboard.

Figure 1-16. Choosing and testing the keyboard layout

  1. The last step before your setup finishes is to choose your credentials: username, password, and computer name. Kubuntu will not give you an option to choose a root password. It can be done later. Actually, there is no need to use root at all. For that purpose, there is a program called sudo. It allows you to run programs with the security privileges of another user. The default is super user. On Kubuntu, calling the su command will require you to enter your account password to execute the command, which requires super user privileges. Setup will add your username to the sudo group.

Figure 1-17. Creating the initial local user

 

Summary


In this chapter, you learned the basics of Linux and how SQL Server has become part of this story. After that, we explained what Linux is and how to install one of the two popular distributions, both supported by SQL Server on Linux. Now, after the initial steps on your working/learning environment, we can dig a little bit deeper. In the next chapter we will see how to install SQL Server on openSUSE, downloading Linux packages and initial security settings.

About the Author

  • Jasmin Azemović

    Jasmin Azemović is a university professor active in database systems, information security, data privacy, forensic analysis, and fraud detection. His PhD degree was in modeling design and developing an environment for the preservation of privacy inside database systems. He is the author of many scientific research papers and two books: Writing T-SQL Queries for Beginners Using Microsoft SQL Server 2012 and Securing SQL Server 2012. He has been a Microsoft MVP (Data Platform) for the last 10 years and an information security consultant. He is an active speaker at many IT professional and community conferences.

    Browse publications by this author

Latest Reviews

(2 reviews total)
From what I have read so far it's been helpful
Good material for getting started with SQL Server on Linux.

Recommended For You

Book Title
Unlock this full book FREE 10 day trial
Start Free Trial