Running your SQL Server on Linux

By Style Sync
| Published on
2e700-pnghut_microsoft-azure-sql-database-data-warehouse-green-perspective-clipart_raebm3yhx4

 

Is it possible to deploy Microsoft SQL Server on the  Linux Operation System? If it is, what does it take to deploy Microsoft SQL Server on Linux? Can you use Microsoft SQL Server on the Linux Operating System to support the Veeam database?

Summary

Deploying Microsoft SQL Server on the Linux Operating System is possible, simple, and is a faster deployment when compared to the Windows Operating System deployment. The great news is that the resources needed while using Linux are also very light. The resource requirements start at 2GB RAM and can be installed on Linux Ubuntu, RedHat and SUSE. Although it is not officially supported,  it is possible to use Microsoft SQL Server on Linux to run a Veeam backend database. There are some limitations, such as when using it as a staging server for transaction recovery, and more.

For the last several months, I have been using Microsoft SQL Server running on Linux without issue. It works really well when the Microsoft SQL Server is deployed as a Veeam backed database.

Scenario

Several months ago, and as part of my testing lab refresh, I decided to set up my new lab deployment with the Microsoft SQL Server on the Linux Operating System to run my lab Veeam back end database.

To accomplish this task, I deployed a new Microsoft SQL Server on a Linux Ubuntu Distribution Server and then migrated the Veeam databases from my old Windows SQL server to the Linux Ubuntu with Microsoft SQL Server. On this blog post, I will take you through the steps I took to accomplish this task.

Note: The Linux Operating System running a Microsoft SQL Server to support a Veeam backend database is not officially supported by Veeam. The steps in this blog post are presented only for educational purposes and should not be used in your PRODUCTION environment.

Steps:

The steps I will cover on this blog post are:

  • Deploy Linux Ubuntu 20.04 Server
  • Add the new Linux as a Management Server
  • Install MS SQL server
  • Backup old MS SQL server
  • Recover the MS SQL to the Linux Server
  • Change the owners and permissions of the MS SQL databases
  • Mount the SQL databases on Linux SQL, and
  • Migrate Migrate 

So let’s start with …

Deployment MS SQL on Linux

After deploying a Ubuntu 20.04 Server with two CPUs and two GB of RAM, I was ready to start the MS SQL deployment. It was very simple, and quickly started with these steps:

  • Importing the MS public repository:
    • wget -qO- https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add –
  • Registering the Microsoft SQL Server Ubuntu repository for SQL Server 2019:
    • sudo add-apt-repository $(wget -qO- https://packages.microsoft.com/config/ubuntu/18.04/mssql-server-2019.list)
  • Installing the SQL Server:
    • sudo apt-get update
    • sudo apt-get install -y mssql-server
  • Post-installation: choose the SQL edition and setup the SA password:
    • sudo /opt/mssql/bin/mssql-conf setup

With those steps, the new MS SQL server was deployed on the new installation of the Linux Ubuntu server. To ensure the server is up and running, you can run the following command to confirm:

  • systemctl status mssql-server –no-pager

Migrate the Veeam SQL Databases to the new Linux SQL Server

To migrate my Veeam databases from the old SQL server to the new Linux SQL server, I backed up the SQL databases using Veeam; then Veeam was used to restore the databases to the Linux SQL server.

To enable the restoration of the databases to the new Linux SQL server, I added Linux Ubuntu as a management server on to the Veeam console using the following steps:

  • Browse to the Backup Infrastructure option:

  • Click on the Managed Server option; right-click and select Add server…:

  • Select the Linux option from the Add Server choices. Complete the deployment process; this will require you to provide the server IP address, username and password:

After those steps above are completed, you will be able to browse to the Home – Backups – Disk. Next, select the backup recovery point; for example, old SQL database. Last step, select the option to restore guest files:

After the backup File Recovery GUI opens, browse to the SQL databases location. Select the Mount to Console from the menu bar to mount the backup point on the Veeam Server:

The recovery point will be mounted and available by default on the Veeam server at the folder on path C:\VeeamFLR

From here, you can copy the databases to the Linux SQL server using the SCP command, or using Veeam Copy Job – File to pick up the source files from the mount folder and copy to the destination Linux folder. By default, Linux SQL server stores the databases under the directory /var/opt/mssql/data

  • Source files from the VeeamFLR folder:

  • Destination – Linux SQL Server:

On completing the copying job successfully, you must change the permissions before attaching the files to the SQL Linux server. To do this, you must run the following command on the Linux server:

  • chown mssql:mssql [Veeamdatabase]
  • chmod g=+rw [Veeamdatabase]

After changing the permissions, I could use the SQL Management Studio to mount the database from a Windows server.

Point Veeam to the new Linux SQL Server

Up to this point, everything is in place to point Veeam Backup and Replication to use the new Linux SQL server. To continue the process, you must run the following steps:

  • From the Veeam server – Start – Veeam:
    • Configuration Database Connection Settings
    • or C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Veeam\Tools

 

  • Choose the product. I.e., Veeam Backup and Replication:

  • Provide the new Linux SQL server details:

To finish; with these steps, I migrated my Veeam backend database from Windows SQL Server to Linux SQL server.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe to Our Newsletter

Table of Contents

Related Insights