Running your SQL Server on Linux

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:

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

Screen Shot 2020-09-07 at 9.13.52 am

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:

Screen Shot 2020-09-07 at 9.24.49 am

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

Screen Shot 2020-09-07 at 9.26.30 am

  • 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:

Screen Shot 2020-09-07 at 9.25.27 am

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:

Screen Shot 2020-09-07 at 10.01.16 am

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:

Screen Shot 2020-09-07 at 10.09.42 am

  • Destination – Linux SQL Server:

Screen Shot 2020-09-07 at 10.13.01 am

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:

Screen Shot 2020-09-07 at 10.39.43 am

  • Provide the new Linux SQL server details:

Screen Shot 2020-09-07 at 10.40.28 am

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

Leave a Reply