Ubuntu LTS 映像檔終止支援後,系統將不再提供支援,也不會再發布安全性更新。如果升級至 Ubuntu Pro,您將在延長安全性維護 (ESM) 期間持續收到安全性更新。
本文說明如何為每個 VM 執行下列操作,從 Ubuntu 升級至 Ubuntu Pro:
- 安裝更新和依附元件。
- 將 Ubuntu 授權換成 Ubuntu Pro 授權。
- 驗證授權。
支援的升級路徑
下表列出支援的升級路徑:
| 初始版本 | 最終版本 | 
|---|---|
| Ubuntu 16.04 LTS | Ubuntu Pro 16.04 LTS | 
| Ubuntu 18.04 LTS | Ubuntu Pro 18.04 LTS | 
| Ubuntu 20.04 LTS | Ubuntu Pro 20.04 LTS | 
| Ubuntu 22.04 LTS | Ubuntu Pro 22.04 LTS | 
| Ubuntu 24.04 LTS | Ubuntu Pro 24.04 LTS | 
限制
- 您必須先停止 VM,才能更換授權。 
- 只有在 Ubuntu LTS 和 Ubuntu Pro LTS 版本相同時,才能升級。舉例來說,您可以從 Ubuntu 16.04 LTS 升級至 Ubuntu Pro 16.04 LTS,但無法從 Ubuntu 16.04 LTS 升級至 Ubuntu Pro 20.04 LTS。 
帳單
系統會根據付費映像檔的定價,向您收取 Ubuntu Pro LTS 的費用。
如要進一步瞭解帳單相關資訊,請參閱 Cloud Billing。
事前準備
- 
  在每個 VM 上執行下列指令,將 VM_NAME替換為要升級的 VM 名稱:- 
      使用下列指令更新套件索引:
      gcloud compute ssh VM_NAME --command "sudo apt update" 
- 
      使用下列指令安裝最新版本的套件:
      gcloud compute ssh VM_NAME --command "sudo apt -f upgrade" 
- 
      使用下列指令安裝 Ubuntu Pro:
      gcloud compute ssh VM_NAME --command "sudo apt -f install ubuntu-advantage-pro" 
 
- 
      使用下列指令更新套件索引:
      
- 
  
  如果尚未設定驗證,請先完成設定。
  驗證可確認您的身分,以便存取 Cloud de Confiance by S3NS 服務和 API。如要從本機開發環境執行程式碼或範例,可以選取下列任一選項,向 Compute Engine 進行驗證:
  
   
   
     
   
  
   
   
     
   
  
   
   
     
   
  
 
 
 
  
    
      Select the tab for how you plan to use the samples on this page: ConsoleWhen you use the Cloud de Confiance console to access Cloud de Confiance by S3NS services and APIs, you don't need to set up authentication. gcloud- 
 
 
  
  
   
   
  
   
   
  
   
   
     
   
  
  
   
   
  
   
   
  
   
   
  
 
 
   
   
      安裝 Google Cloud CLI,然後 使用同盟身分登入 gcloud CLI。 登入後,請執行下列指令初始化 Google Cloud CLI: gcloud init
- Set a default region and zone.
 更換授權請按照下列程序,將 Ubuntu 授權替換為 Ubuntu Pro 授權: - 使用 - gcloud compute instances stop指令停止 VM:- gcloud compute instances stop VM_NAME \ --zone=ZONE - 更改下列內容: - VM_NAME:要停止的 VM 名稱
- ZONE:包含要停止的 VM 的可用區
 
- 使用 - gcloud compute instances describe指令取得與 VM 相關聯的磁碟清單:- gcloud compute instances describe VM_NAME \ --zone=ZONE \ --format="yaml(disks)" - 更改下列內容: - VM_NAME:要取得相關聯磁碟清單的 VM 名稱
- ZONE:包含 VM 的可用區,可從中取得相關聯的磁碟清單
 
- 確認輸出內容類似於: - disks: - autoDelete: true boot: true deviceName: ubuntu diskSizeGb: '10' guestOsFeatures: - type: VIRTIO_SCSI_MULTIQUEUE - type: SEV_CAPABLE - type: UEFI_COMPATIBLE - type: GVNIC index: 0 interface: SCSI kind: compute#attachedDisk licenses: - https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1604-xenial mode: READ_WRITE shieldedInstanceInitialState: dbxs: - content: ... fileType: BIN source: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/disks/VM_NAME type: PERSISTENT- 請注意,沒有任何 - Licenses遭到取代。
- 執行 - gcloud compute disks list指令,取得開機磁碟的名稱:- gcloud compute disks list 
- 使用 - gcloud compute disks update指令,以 Ubuntu Pro 授權 URI 更新開機磁碟:- gcloud compute disks update DISK_NAME \ --zone=ZONE \ --replace-license="PREVIOUS_LICENSE, NEW_LICENSE" - 更改下列內容: - DISK_NAME:要更換授權的開機磁碟名稱。
- ZONE:包含要更換授權的開機磁碟的可用區。
- PREVIOUS_LICENSE:Ubuntu 版本的授權 URI
- NEW_LICENSE:新的 Ubuntu Pro 授權 URI。
 - 下表列出支援的 Ubuntu Pro 版本授權 URI: 
 Ubuntu Pro 版本 授權 URI Ubuntu Pro 16.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1604-ltsUbuntu Pro 18.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1804-ltsUbuntu Pro 20.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2004-ltsUbuntu Pro 22.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2204-ltsUbuntu Pro 24.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2404-lts驗證授權如要驗證 Ubuntu Pro 授權,請按照下列步驟操作: - 執行 - gcloud compute disks describe指令,取得開機磁碟的相關資訊:- gcloud compute disks describe DISK_NAME \ --zone=ZONE - 更改下列內容: - DISK_NAME:要驗證授權的開機磁碟名稱
- ZONE:包含要驗證授權的開機磁碟的可用區
 
- 確認輸出內容類似於: - creationTimestamp: '2021-10-20T17:20:26.616-07:00' guestOsFeatures: - type: VIRTIO_SCSI_MULTIQUEUE - type: SEV_CAPABLE - type: UEFI_COMPATIBLE - type: GVNIC id: '7008232787326864549' kind: compute#disk labelFingerprint: 42WmSpB8rSM= lastAttachTimestamp: '2021-10-20T17:20:26.617-07:00' licenseCodes: - '1000201' - '8045211386737108299' licenses: - https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-1604-xenial - https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1604-lts name: ubuntu physicalBlockSizeBytes: '4096' selfLink: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/disks/DISK_NAME sizeGb: '10' sourceImage: https://www.googleapis.com/compute/v1/projects/IMAGE_PROJECT/global/images/IMAGE sourceImageId: '1233998915439563944' status: READY type: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/diskTypes/DISK_TYPE users: - https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE/instances/VM_NAME zone: https://www.googleapis.com/compute/v1/projects/PROJECT_NAME/zones/ZONE
- 檢查上一步的輸出內容,確認 - licenses欄位是否包含適當的授權字串,藉此驗證 Ubuntu Pro 授權是否已新增至開機磁碟。- 如果「 - licenses」欄位未包含預期的授權字串,您可能需要清除並更新授權。詳情請參閱- gcloud compute disks update指令。
- 使用 - gcloud compute instances start指令啟動 VM:- gcloud compute instances start VM_NAME \ --zone=ZONE \ [--csek-key-file ENCRYPTION_KEY] - 更改下列內容: - VM_NAME:要啟動的 VM 名稱
- ZONE:包含要啟動的 VM 的可用區
- ENCRYPTION_KEY:選用:指定客戶提供的加密金鑰 (CSEK) 檔案路徑 (如果開機磁碟已加密)
 
- 虛擬機器啟動後,請執行 - gcloud compute ssh指令,確認 Ubuntu ESM 已獲得授權並啟用:- gcloud compute ssh VM_NAME --command "sudo ua status --wait" \ --zone=ZONE - 更改下列內容: - VM_NAME:要驗證的 VM 名稱
- ZONE:包含要驗證的 VM 的可用區
 
- 確認 Ubuntu ESM 具有資格並已啟用,方法是驗證輸出內容是否類似下列內容: - SERVICE ENTITLED STATUS DESCRIPTION cis yes disabled Center for Internet Security Audit Tools esm-apps yes enabled UA Apps: Extended Security Maintenance (ESM) esm-infra yes enabled UA Infra: Extended Security Maintenance (ESM) fips yes n/a NIST-certified core packages fips-updates yes n/a NIST-certified core packages with priority security updates livepatch yes n/a Canonical Livepatch service
 查看活動記錄如要查看專案中 VM 的授權更新記錄,請按照下列程序操作: - 前往 Cloud de Confiance 控制台的「Logs Explorer」頁面。 
- 確認工具列中的「Show query」(顯示查詢) 已啟用。 
- 將下列運算式複製到查詢編輯器: - resource.type="gce_disk" logName="projects/PROJECT_NAME/logs/cloudaudit.googleapis.com%2Factivity" severity>=NOTICE protoPayload.request.@type="type.googleapis.com/compute.disks.update" protoPayload.request.licenses:*
- 將 - PROJECT_NAME替換為您的專案名稱。
- 點選「執行查詢」 
 除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。 上次更新時間:2025-10-19 (世界標準時間)。 [[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-10-19 (世界標準時間)。"],[],[]]
-