背景と目的
Ubuntu Pro が Personal Use で 5 台まで無料で使えるようになりました。バージョンアップせずに延命できる選択肢として、Azure で使っている Ubuntu 18.04 LTS を Personal Use で Pro にして 2023 年の EOL を 2028 年まで延ばす検証をしてみました。
検証用の仮想マシンを作成
bash
# 環境変数をセットします
region=japaneast
prefix=mnrubpro
# リソースグループを作成します
az group create \
--name ${prefix}-rg \
--location $region
# 仮想マシンを作成します
az vm create \
--resource-group ${prefix}-rg \
--name ${prefix}-vm \
--os-disk-name ${prefix}-vmOSDisk \
--image Canonical:UbuntuServer:18.04-LTS:latest \
--size Standard_B1s \
--admin-username azureuser \
--generate-ssh-keys \
--nsg-rule NONE \
--public-ip-address-dns-name ${prefix}
# 自分の IP から SSH 接続できるようにします
az network nsg rule create \
--resource-group ${prefix}-rg \
--name Allow-SSH \
--nsg-name ${prefix}-vmNSG \
--priority 100 \
--source-address-prefixes $(curl -s inet-ip.info) \
--destination-port-ranges 22 \
--access Allow \
--protocol Tcp
# SSH 接続します
ssh azureuser@${prefix}.$region.cloudapp.azure.com
Ubuntu Pro に移行
こちらのサイトを参考に Pro に移行します。
bash
# pro client のバージョンを確認します
$ pro --version
27.11.2~18.04.1
# 27.11.2 より古いバージョンの場合はアップデートします
$ sudo apt install ubuntu-advantage-tools=27.11.2~$(lsb_release -rs).1
Reading package lists... Done
Building dependency tree
Reading state information... Done
ubuntu-advantage-tools is already the newest version (27.11.2~18.04.1).
ubuntu-advantage-tools set to manually installed.
The following package was automatically installed and is no longer required:
linux-headers-4.15.0-194
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
# Pro 版のステータスを確認します(このマシンには Ubuntu Pro サブスクリプションがアタッチされていません)
$ pro security-status
560 packages installed:
559 packages from Ubuntu Main/Restricted repository
1 package no longer available for download
To get more information about the packages, run
pro security-status --help
for a list of available options.
This machine is not attached to an Ubuntu Pro subscription.
Main/Restricted packages receive updates with LTS until 2023.
Try Ubuntu Pro beta with a free personal subscription on up to 5 machines.
Learn more at https://ubuntu.com/pro
# https://ubuntu.com/pro/dashboard
# サブスクリプションのダッシュボードから自分のトークンで Ubuntu Pro をアタッチします
$ sudo pro attach [YOUR_TOKEN]
Enabling default service esm-infra
Updating package lists
Ubuntu Pro: ESM Infra enabled
Enabling default service livepatch
Installing canonical-livepatch snap
Canonical livepatch enabled.
This machine is now attached to 'Ubuntu Pro - free personal subscription'
SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes disabled Common Criteria EAL2 Provisioning Packages
cis yes disabled Security compliance and audit tools
esm-infra yes enabled Expanded Security Maintenance for Infrastructure
fips yes disabled NIST-certified core packages
fips-updates yes disabled NIST-certified core packages with priority security updates
livepatch yes enabled Canonical Livepatch service
NOTICES
Operation in progress: pro attach
Enable services with: pro enable <service>
Account: [YOUR_EMAIL]
Subscription: Ubuntu Pro - free personal subscription
[info] A new version is available: 27.11.3~18.04.1
Please run:
sudo apt-get install ubuntu-advantage-tools
to get the latest version with new features and bug fixes.
# メッセージの指示に従い下記コマンドを実行します(pro client の新バージョンをインストールします)
$ sudo apt-get install ubuntu-advantage-tools
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
linux-headers-4.15.0-194
Use 'sudo apt autoremove' to remove it.
The following packages will be upgraded:
ubuntu-advantage-tools
1 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.
Need to get 161 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://azure.archive.ubuntu.com/ubuntu bionic-updates/main amd64 ubuntu-advantage-tools amd64 27.11.3~18.04.1 [161 kB]
Fetched 161 kB in 0s (7545 kB/s)
Preconfiguring packages ...
(Reading database ... 77135 files and directories currently installed.)
Preparing to unpack .../ubuntu-advantage-tools_27.11.3~18.04.1_amd64.deb ...
Unpacking ubuntu-advantage-tools (27.11.3~18.04.1) over (27.11.2~18.04.1) ...
Setting up ubuntu-advantage-tools (27.11.3~18.04.1) ...
Installing new version of config file /etc/apt/apt.conf.d/20apt-esm-hook.conf ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
# pro client のバージョンを確認します
$ pro --version
27.11.3~18.04.1
# Pro 版のステータスを確認します
$ pro status
SERVICE ENTITLED STATUS DESCRIPTION
cc-eal yes disabled Common Criteria EAL2 Provisioning Packages
cis yes disabled Security compliance and audit tools
esm-infra yes enabled Expanded Security Maintenance for Infrastructure
fips yes disabled NIST-certified core packages
fips-updates yes disabled NIST-certified core packages with priority security updates
livepatch yes enabled Canonical Livepatch service
Enable services with: pro enable <service>
Account: [YOUR_EMAIL]
Subscription: Ubuntu Pro - free personal subscription
# 検証用仮想マシンなので Ubuntu Pro をデタッチします
$ sudo pro detach --assume-yes
Detach will disable the following services:
esm-infra
livepatch
Updating package lists
This machine is now detached.
# 仮想マシンから抜けます
$ exit
Ubuntu Pro ダッシュボードを確認
Active machines (過去 24 時間に Ubuntu Pro に接続したこのトークンを持つマシンの数)が 1 になっています。
参考
bash
# 検証環境を削除します
az group delete \
--name ${prefix}-rg \
--yes