Add a SQL Server license to an existing Linux server

Linux

Compute Engine lets you install SQL Server on Linux virtual machines (VM)instances and use pay-as-you-go (PAYG) licenses. This document describes how touse SQL Server on a Linux VM by doing the following:

  1. Add SQL Server license metadata to a boot disk
  2. Install SQL Server on Linux

Billing

After adding a license string to the Linux VM's boot disk, you are billedaccording to the pricing ofSQL Server images.

Limitations

  • You can only install SQL Server on the following Linux distributions:

    • Red Hat Enterprise Linux (RHEL)
    • SUSE Linux Enterprise Server (SLES)
    • Ubuntu

Add a SQL Server license to a Linux Server

SQL Server license metadata on a boot disk allows Google Cloud to accuratelytrack, bill, and report on SQL Server license usage. This metadata is requiredwhen using PAYG SQL Server licenses. Add a SQL Server license to an existing bootdisk using the following procedure:

Caution: After you add a license to a VM, you cannot remove the license from theVM.
  1. Identify the license you want to add to a VM. For SQL Server, thelicense needs to match both the version and edition you want to run. For thelist of valid SQL Server license strings, see theLicense strings tab intheoperating system details for SQL Serverdocument.

  2. Stop the VM:

    gcloud compute instances stopVM_NAME

    ReplaceVM_NAME with the name of the VM instance tostop.

  3. Identify the boot disk:

    gcloud compute instances describeVM_NAME

    ReplaceVM_NAME with the name of the VM.

  4. Verify that the output is similar to the following:

    disks:- autoDelete: true  boot: true  deviceName:BOOT_DISK_NAME  diskSizeGb: '20'  guestOsFeatures:  - type: UEFI_COMPATIBLE  index: 0  interface: SCSI  kind: compute#attachedDisk  licenses:  -BOOT_DISK_LICENSE_STRING  mode: READ_WRITE  source: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/disks/BOOT_DISK_NAME  type: PERSISTENT
  5. Detach the boot disk:

    gcloud compute instances detach-diskVM_NAME --disk=BOOT_DISK_NAME

    Replace the following:

    • VM_NAME: the name of the VM
    • BOOT_DISK_NAME: the name of the boot disk
  6. Clone the boot disk and add the additional license:

    gcloud compute disks createCLONED_BOOT_DISK_NAME \  --licenses=SQL_SERVER_LICENSE \  --source-disk=BOOT_DISK_NAME \  --source-disk-zone=BOOT_DISK_ZONE \  --zone=CLONED_BOOT_DISK_ZONE

    Replace the following:

    • CLONED_BOOT_DISK_NAME: the name you want togive the cloned book disk
    • SQL_SERVER_LICENSE: the SQL Server license youwant to add to the boot disk
    • BOOT_DISK_NAME: the name of the source bootdisk that you want to clone
    • BOOT_DISK_ZONE: the zone of the source bootdisk
    • CLONED_BOOT_DISK_ZONE: the zone in which youwant to create the cloned boot disk
  7. Verify that the new disk has the correct license:

    gcloud compute disks describeCLONED_BOOT_DISK_NAME \  --zone=CLONED_BOOT_DISK_ZONE

    Replace the following:

    • CLONED_BOOT_DISK_NAME: the name of the clonedbook disk
    • CLONED_BOOT_DISK_ZONE: the zone of the clonedboot disk
  8. Attach the new disk as the boot disk for the VM instance:

    gcloud compute instances attach-diskVM_NAME \  --disk=CLONED_BOOT_DISK_NAME  --boot

    Replace the following:

    • VM_NAME: the name of the VM instance to which youwant to attach the cloned boot disk
    • CLONED_BOOT_DISK_NAME: the name of the clonedbook disk
  9. Verify that the VM's boot disk is the new cloned disk with SQL Serverlicensing.

    gcloud compute instances describeVM_NAME

    ReplaceVM_NAME with the name of the VM.

  10. Start the VM instance.

    gcloud compute instances startVM_NAME

    ReplaceVM_NAME with the name of the VM.

  11. (Optional) When you are sure that you don't want to revert back to the earlierboot disk, you can delete the disk.

    gcloud compute disks deleteBOOT_DISK_NAME \  --zone=BOOT_DISK_ZONE

    Replace the following:

    • BOOT_DISK_NAME: the name of the boot disk thatyou want to delete
    • BOOT_DISK_ZONE: the zone of the boot disk

Install SQL Server on Linux

For guidance on installing, updating, and uninstalling SQL Server on Linux, seeInstallation guidance for SQL Server on Linux.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-09 UTC.