只有特定進階版 Linux OS 授權可附加、移除或更換。以下使用案例支援 Red Hat Enterprise Linux (RHEL)、RHEL for SAP、SUSE Linux Enterprise Server (SLES)、SLES for SAP、Ubuntu 和 Ubuntu Pro 的授權變更:
- 在 RHEL、RHEL for SAP、SLES 和 SLES for SAP 的 BYOS 和即付即用結帳模式之間切換
- 從 Ubuntu 直接升級至 Ubuntu Pro
- 新增或移除 RHEL ELS 加購授權
授權擁有者可以變更特定授權的有效授權變更。變更授權前,請先確認目標授權變更有效。本指南說明如何找出特定授權的現行有效授權變更。並說明變更授權的相關限制。
事前準備
- 
  
  如果尚未設定驗證,請先完成設定。
  驗證可確認您的身分,以便存取 Google Cloud 服務和 API。如要從本機開發環境執行程式碼或範例,可以選取下列任一選項,向 Compute Engine 進行驗證:
  
   
   
     
   
  
   
   
     
   
  
   
   
     
   
  
 
 
 
  
    
      Select the tab for how you plan to use the samples on this page: ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication. gcloud- 
 
 
  
  
   
   
  
   
   
  
   
   
     
   
  
  
   
   
  
   
   
  
   
   
  
 
 
   
   
      安裝 Google Cloud CLI。 安裝完成後,執行下列指令初始化 Google Cloud CLI: gcloud init如果您使用外部識別資訊提供者 (IdP),請先 使用聯合身分登入 gcloud CLI。 
- Set a default region and zone.
 查看授權資訊在 Cloud Shell 中執行下列指令。將 LICENSE_URL 替換為要調查的授權。如需常見的 Linux 授權網址清單,請參閱「有效授權」表格。 curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" LICENSE_URL 舉例來說,如要檢查 RHEL 7 PAYG 授權: curl -H "Authorization: Bearer $(gcloud auth print-access-token)" -H "Content-Type: application/json" https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-server 輸出結果會與下列內容相似: { "kind": "compute#license", "name": "rhel-7-server", "chargesUseFee": true, "id": "6080198135500386054", "licenseCode": "1000006", "creationTimestamp": "2013-08-19T17:17:57.000-07:00", "description": "RedHat Enterprise Linux 7", "transferable": true, "selfLink": "https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-server", "selfLinkWithId": "https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/6080198135500386054", "appendableToDisk": true, "removableFromDisk": false, "allowedReplacementLicenses": [ "1492188837615955530", "8475125252192923229", "601259152637613565", "489291035512960571", "1270685562947480748" ], "osLicense": false, "soleTenantOnly": false, "multiTenantOnly": false, "minimumRetention": { "seconds": "0", "nanos": 0 }, "updateTimestamp": "" }回應會列出下列重要欄位: - removableFromDisk:如果為- true,授權可以從磁碟中移除。如果為「- false」,您必須先更換為有效授權,才能移除授權。
- allowedReplacementLicenses:這是可做為有效替代項目的授權清單。如要瞭解授權代碼對應的授權,請參閱有效授權。
- minimumRetention:授權在 VM 上必須存在的最短時間,之後才能套用其他授權變更。
 範例:將 RHEL 7 PAYG 換成 RHEL 8 PAYG如要將 RHEL 7 PAYG 授權替換為 RHEL 8 PAYG 授權,請使用下列資訊找出 RHEL 8 PAYG 的授權代碼和授權網址: 授權名稱 授權碼 授權網址 RHEL 8 PAYG 601259152637613565 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-8-server由於 RHEL 8 PAYG 的授權碼 (601259152637613565) 列於 RHEL 7 PAYG 的 allowedReplacementLicenses下方,這表示可以更換有效的授權。如要更換授權,請使用下列指令: gcloud compute disks update DISK_NAME --replace-license=projects/rhel-cloud/global/licenses/rhel-7-server,projects/rhel-cloud/global/licenses/rhel-8-server --zone=DISK_ZONE有效執照下表列出 RHEL、SLES、Ubuntu 和 Ubuntu Pro 的有效授權。 RHEL 授權資訊授權名稱 授權碼 授權網址 RHEL 6 PAYG 1000002 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-6-serverRHEL 7 PAYG 1000006 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-serverRHEL 7 ELS 4646774207868449156 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-elsRHEL 8 PAYG 601259152637613565 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-8-serverRHEL 9 PAYG 7883559014960410759 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-9-serverRHEL 6 BYOS 4720191914037931587 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-6-byosRHEL 7 BYOS 1492188837615955530 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-7-byosRHEL 8 BYOS 8475125252192923229 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-8-byosRHEL 9 BYOS 3837518230911135854 https://www.googleapis.com/compute/v1/projects/rhel-cloud/global/licenses/rhel-9-byosRHEL 8 for SAP PAYG 1270685562947480748 https://www.googleapis.com/compute/v1/projects/rhel-sap-cloud/global/licenses/rhel-8-sapRHEL 9 for SAP PAYG 8291906032809750558 https://www.googleapis.com/compute/v1/projects/rhel-sap-cloud/global/licenses/rhel-9-sapRHEL 8 for SAP BYOS 489291035512960571 https://www.googleapis.com/compute/v1/projects/rhel-sap-cloud/global/licenses/rhel-8-sap-byosRHEL 9 for SAP BYOS 6753525580035552782 https://www.googleapis.com/compute/v1/projects/rhel-sap-cloud/global/licenses/rhel-9-sap-byosSLES 授權資訊授權名稱 授權碼 授權網址 SLES 11 PAYG 1000004 https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-11 SLES 12 PAYG 1000008 https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-12 SLES 15 PAYG 5422776498422280384 https://www.googleapis.com/compute/v1/projects/suse-cloud/global/licenses/sles-15 SLES 11 BYOS 3562683225507985416 https://www.googleapis.com/compute/v1/projects/suse-byos-cloud/global/licenses/sles-11-byos SLES 12 BYOS 5995918435054614609 https://www.googleapis.com/compute/v1/projects/suse-byos-cloud/global/licenses/sles-12-byos SLES 15 BYOS 7429287564402499183 https://www.googleapis.com/compute/v1/projects/suse-byos-cloud/global/licenses/sles-15-byos SLES 12 for SAP PAYG 4079932016749305610 https://www.googleapis.com/compute/v1/projects/suse-sap-cloud/global/licenses/sles-sap-12 SLES 15 for SAP PAYG 4764125400812555962 https://www.googleapis.com/compute/v1/projects/suse-sap-cloud/global/licenses/sles-sap-15 SLES 12 for SAP BYOS 7194268483061119118 https://www.googleapis.com/compute/v1/projects/suse-byos-cloud/global/licenses/sles-sap-12-byos SLES 15 for SAP BYOS 6035015651111738499 https://www.googleapis.com/compute/v1/projects/suse-byos-cloud/global/licenses/sles-sap-15-byos Ubuntu 和 Ubuntu Pro 授權資訊授權名稱 授權碼 授權網址 Ubuntu 16.04 (Xenial Xerus) 1000201 https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1604-xenialUbuntu Pro 16.04 (Xenial Xerus) 8045211386737108299 https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1604-ltsUbuntu 18.04 LTS (Bionic Beaver) 5926592092274602096 https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1804-ltsUbuntu Pro 18.04 LTS (Bionic Beaver) 6022427724719891830 https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1804-ltsUbuntu 20.04 LTS (Focal Fossa) 2211838267635035815 https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-2004-ltsUbuntu Pro 20.04 LTS (Focal Fossa) 599959289349842382 https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2004-ltsUbuntu 22.04 LTS (Jammy Jellyfish) 5511465778777431107 https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-2204-ltsUbuntu Pro 22.04 LTS (Jammy Jellyfish) 2592866803419978320 https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2204-ltsUbuntu 24.04 LTS (Noble Numbat) 3242930272766215801 https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-2404-ltsUbuntu Pro 24.04 LTS (Noble Numbat) 2176054482269786025 https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2404-lts除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。 上次更新時間:2025-10-19 (世界標準時間)。 -