Mengupgrade dari Ubuntu ke Ubuntu Pro


Jika image Ubuntu LTS mencapai akhir siklus prosesnya, image tersebut tidak akan didukung lagi dan tidak akan menerima update keamanan. Jika Anda mengupgrade ke Ubuntu Pro, Anda akan terus menerima update keamanan selama Extended Security Maintenance (ESM).

Dokumen ini menunjukkan cara mengupgrade dari Ubuntu ke Ubuntu Pro dengan melakukan hal berikut untuk setiap VM:

  1. Instal update dan dependensi.
  2. Ganti lisensi Ubuntu dengan lisensi Ubuntu Pro.
  3. Validasi lisensi.

Jalur upgrade yang didukung

Tabel berikut menunjukkan jalur upgrade yang didukung:

Versi awal Versi akhir
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

Batasan

  • Anda harus menghentikan VM sebelum mengganti lisensi.

  • Anda hanya dapat mengupgrade dari Ubuntu LTS ke Ubuntu Pro LTS jika keduanya memiliki versi yang sama. Misalnya, Anda dapat mengupgrade dari Ubuntu 16.04 LTS ke Ubuntu Pro 16.04 LTS, tetapi tidak dapat mengupgrade dari Ubuntu 16.04 LTS ke Ubuntu Pro 20.04 LTS.

Penagihan

Anda akan ditagih untuk Ubuntu Pro LTS sesuai dengan harga untuk image premium.

Untuk mengetahui informasi selengkapnya tentang penagihan, lihat Penagihan Cloud.

Sebelum memulai

  • Jalankan perintah berikut di setiap VM, dengan mengganti VM_NAME dengan nama VM yang akan diupgrade:

    1. Update indeks paket menggunakan perintah berikut:
      gcloud compute ssh VM_NAME --command "sudo apt update"
    2. Instal versi terbaru paket menggunakan perintah berikut:
      gcloud compute ssh VM_NAME --command "sudo apt -f upgrade"
    3. Instal Ubuntu Pro menggunakan perintah berikut:
      gcloud compute ssh VM_NAME --command "sudo apt -f install ubuntu-advantage-pro"
  • Jika Anda belum melakukannya, siapkan autentikasi. Autentikasi adalah proses yang digunakan untuk memverifikasi identitas Anda untuk mengakses Google Cloud layanan dan API. Untuk menjalankan kode atau sampel dari lingkungan pengembangan lokal, Anda dapat melakukan autentikasi ke Compute Engine dengan memilih salah satu opsi berikut:

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

      1. After installing the Google Cloud CLI, initialize it by running the following command:

        gcloud init

        If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.

      2. Set a default region and zone.

Mengganti lisensi

Ganti lisensi Ubuntu dengan lisensi Ubuntu Pro menggunakan prosedur berikut:

  1. Hentikan VM menggunakan perintah gcloud compute instances stop:

    gcloud compute instances stop VM_NAME \
       --zone=ZONE
    

    Ganti kode berikut:

    • VM_NAME: nama VM yang akan dihentikan
    • ZONE: zona yang berisi VM yang akan dihentikan
  2. Dapatkan daftar disk yang terkait dengan VM menggunakan perintah gcloud compute instances describe:

    gcloud compute instances describe VM_NAME \
       --zone=ZONE \
       --format="yaml(disks)"
    

    Ganti kode berikut:

    • VM_NAME: nama VM untuk mendapatkan daftar disk terkait

    • ZONE: zona yang berisi VM untuk mendapatkan daftar disk terkait

  3. Pastikan output-nya mirip dengan:

    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
    

    Perhatikan bahwa tidak ada Licenses yang diganti.

  4. Dapatkan nama boot disk dengan menjalankan perintah gcloud compute disks list:

    gcloud compute disks list
    
  5. Perbarui boot disk dengan URI lisensi Ubuntu Pro menggunakan perintah gcloud compute disks update:

    gcloud compute disks update DISK_NAME \
       --zone=ZONE \
       --replace-licenses="PREVIOUS_LICENSE, NEW_LICENSE"
    

    Ganti kode berikut:

    • DISK_NAME: nama boot disk yang akan diganti lisensinya.

    • ZONE: zona yang berisi boot disk untuk mengganti lisensi.

    • PREVIOUS_LICENSE: URI lisensi untuk versi Ubuntu

    • NEW_LICENSE: URI lisensi Ubuntu Pro baru.

    Tabel berikut menunjukkan URI lisensi untuk versi Ubuntu Pro yang didukung:

Versi Ubuntu Pro URI lisensi
Ubuntu Pro 16.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1604-lts
Ubuntu Pro 18.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-1804-lts
Ubuntu Pro 20.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2004-lts
Ubuntu Pro 22.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2204-lts
Ubuntu Pro 24.04 LTS https://www.googleapis.com/compute/v1/projects/ubuntu-os-pro-cloud/global/licenses/ubuntu-pro-2404-lts

Memvalidasi lisensi

Validasi lisensi Ubuntu Pro menggunakan prosedur berikut:

  1. Dapatkan informasi tentang boot disk dengan menjalankan perintah gcloud compute disks describe:

    gcloud compute disks describe DISK_NAME \
       --zone=ZONE
    

    Ganti kode berikut:

    • DISK_NAME: nama boot disk untuk memvalidasi lisensinya

    • ZONE: zona yang berisi boot disk untuk memvalidasi lisensi

  2. Verifikasi output yang mirip dengan:

    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
    
  3. Pastikan lisensi Ubuntu Pro ditambahkan ke boot disk dengan memeriksa output langkah sebelumnya untuk kolom licenses pada string lisensi yang sesuai.

    Jika kolom licenses tidak berisi string lisensi yang diinginkan, Anda mungkin perlu menghapus dan memperbarui lisensi. Untuk informasi selengkapnya, lihat perintah gcloud compute disks update.

  4. Mulai VM menggunakan perintah gcloud compute instances start:

    gcloud compute instances start VM_NAME \
       --zone=ZONE \
       [--csek-key-file ENCRYPTION_KEY]
    

    Ganti kode berikut:

    • VM_NAME: nama VM yang akan dimulai

    • ZONE: zona yang berisi VM yang akan dimulai

    • ENCRYPTION_KEY: Opsional: menentukan jalur ke file Kunci Enkripsi yang Disediakan Pelanggan (CSEK) jika disk booting dienkripsi

  5. Setelah VM melakukan booting, jalankan perintah gcloud compute ssh untuk memverifikasi bahwa Ubuntu ESM berhak dan diaktifkan:

    gcloud compute ssh VM_NAME --command "sudo ua status --wait" \
       --zone=ZONE
    

    Ganti kode berikut:

    • VM_NAME: nama VM yang akan diverifikasi

    • ZONE: zona yang berisi VM yang akan diverifikasi

  6. Periksa apakah Ubuntu ESM berhak dan diaktifkan dengan memverifikasi bahwa outputnya mirip dengan:

    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
    

Melihat log aktivitas

Lihat histori pembaruan lisensi untuk VM dalam sebuah project menggunakan prosedur berikut:

  1. Di konsol Google Cloud , buka halaman Logs Explorer.

    Buka Logs Explorer

  2. Di toolbar, pastikan Tampilkan kueri diaktifkan.

  3. Salin ekspresi berikut ke editor kueri:

    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:*
    
  4. Ganti PROJECT_NAME dengan nama project Anda.

  5. Klik Run query.