環境
proxmox: 8.2.2
Rocky: 8.11 (latest, cloud image)
手順
基本的には以下の手順そのままで良いです。
ISOは変更する必要あり。
私のやった方法をメモしておきます。
Shellにログインして以下コマンドを実行
実行コマンド:
wget -P /var/lib/vz/images/ https://dl.rockylinux.org/pub/rocky/8/images/x86_64/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2
qm create 9000 --name rocky8latest-template --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
qm set 9000 --scsi0 local-lvm:0,import-from=/var/lib/vz/images/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2
qm set 9000 --ide2 local-lvm:cloudinit
qm set 9000 --boot order=scsi0
qm set 9000 --serial0 socket --vga serial0
qm template 9000
実行例:
root@tk005:~# wget -P /var/lib/vz/images/ https://dl.rockylinux.org/pub/rocky/8/images/x86_64/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2
--2024-11-17 03:18:46-- https://dl.rockylinux.org/pub/rocky/8/images/x86_64/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2
Resolving dl.rockylinux.org (dl.rockylinux.org)... 151.101.42.132, 2a04:4e42:a::644
Connecting to dl.rockylinux.org (dl.rockylinux.org)|151.101.42.132|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2065760256 (1.9G) [application/octet-stream]
Saving to: ‘/var/lib/vz/images/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2’
Rocky-8-GenericCloud- 100%[=======================>] 1.92G 4.91MB/s in 7m 32s
2024-11-17 03:26:20 (4.36 MB/s) - ‘/var/lib/vz/images/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2’ saved [2065760256/2065760256]
root@tk005:~#
root@tk005:~#
root@tk005:~# qm create 9000 --name rocky8latest-template --memory 2048 --net0 virtio,bridge=vmbr0 --scsihw virtio-scsi-pci
root@tk005:~#
root@tk005:~# qm set 9000 --scsi0 local-lvm:0,import-from=/var/lib/vz/images/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2
update VM 9000: -scsi0 local-lvm:0,import-from=/var/lib/vz/images/Rocky-8-GenericCloud-Base.latest.x86_64.qcow2
Logical volume "vm-9000-disk-0" created.
transferred 0.0 B of 10.0 GiB (0.00%)
transferred 104.4 MiB of 10.0 GiB (1.02%)
transferred 209.9 MiB of 10.0 GiB (2.05%)
transferred 312.3 MiB of 10.0 GiB (3.05%)
transferred 414.7 MiB of 10.0 GiB (4.05%)
transferred 517.1 MiB of 10.0 GiB (5.05%)
transferred 621.6 MiB of 10.0 GiB (6.07%)
transferred 724.0 MiB of 10.0 GiB (7.07%)
transferred 827.4 MiB of 10.0 GiB (8.08%)
transferred 930.8 MiB of 10.0 GiB (9.09%)
transferred 1.0 GiB of 10.0 GiB (10.09%)
transferred 1.1 GiB of 10.0 GiB (11.09%)
transferred 1.2 GiB of 10.0 GiB (12.09%)
transferred 1.3 GiB of 10.0 GiB (13.09%)
transferred 1.4 GiB of 10.0 GiB (14.09%)
transferred 1.5 GiB of 10.0 GiB (15.10%)
transferred 1.6 GiB of 10.0 GiB (16.10%)
transferred 1.7 GiB of 10.0 GiB (17.10%)
transferred 1.8 GiB of 10.0 GiB (18.10%)
transferred 1.9 GiB of 10.0 GiB (19.10%)
transferred 2.0 GiB of 10.0 GiB (20.11%)
transferred 2.1 GiB of 10.0 GiB (21.11%)
transferred 2.2 GiB of 10.0 GiB (22.11%)
transferred 2.3 GiB of 10.0 GiB (23.11%)
transferred 2.4 GiB of 10.0 GiB (24.12%)
transferred 2.5 GiB of 10.0 GiB (25.12%)
transferred 2.6 GiB of 10.0 GiB (26.12%)
transferred 2.7 GiB of 10.0 GiB (27.12%)
transferred 2.8 GiB of 10.0 GiB (28.12%)
transferred 2.9 GiB of 10.0 GiB (29.12%)
transferred 3.0 GiB of 10.0 GiB (30.13%)
transferred 3.1 GiB of 10.0 GiB (31.13%)
transferred 3.2 GiB of 10.0 GiB (32.13%)
transferred 3.3 GiB of 10.0 GiB (33.13%)
transferred 3.4 GiB of 10.0 GiB (34.13%)
transferred 3.5 GiB of 10.0 GiB (35.15%)
transferred 3.6 GiB of 10.0 GiB (36.15%)
transferred 3.7 GiB of 10.0 GiB (37.16%)
transferred 3.8 GiB of 10.0 GiB (38.16%)
transferred 3.9 GiB of 10.0 GiB (39.16%)
transferred 4.0 GiB of 10.0 GiB (40.16%)
transferred 4.1 GiB of 10.0 GiB (41.16%)
transferred 4.2 GiB of 10.0 GiB (42.17%)
transferred 4.3 GiB of 10.0 GiB (43.17%)
transferred 4.4 GiB of 10.0 GiB (44.17%)
transferred 4.5 GiB of 10.0 GiB (45.17%)
transferred 4.6 GiB of 10.0 GiB (46.17%)
transferred 4.7 GiB of 10.0 GiB (47.18%)
transferred 4.8 GiB of 10.0 GiB (48.18%)
transferred 4.9 GiB of 10.0 GiB (49.18%)
transferred 5.0 GiB of 10.0 GiB (50.18%)
transferred 5.1 GiB of 10.0 GiB (51.18%)
transferred 5.2 GiB of 10.0 GiB (52.19%)
transferred 5.3 GiB of 10.0 GiB (53.23%)
transferred 5.4 GiB of 10.0 GiB (54.23%)
transferred 5.5 GiB of 10.0 GiB (55.27%)
transferred 5.6 GiB of 10.0 GiB (56.27%)
transferred 5.7 GiB of 10.0 GiB (57.27%)
transferred 5.8 GiB of 10.0 GiB (58.28%)
transferred 5.9 GiB of 10.0 GiB (59.28%)
transferred 6.0 GiB of 10.0 GiB (60.31%)
transferred 6.1 GiB of 10.0 GiB (61.31%)
transferred 6.2 GiB of 10.0 GiB (62.32%)
transferred 6.3 GiB of 10.0 GiB (63.32%)
transferred 6.4 GiB of 10.0 GiB (64.33%)
transferred 6.5 GiB of 10.0 GiB (65.33%)
transferred 6.6 GiB of 10.0 GiB (66.34%)
transferred 6.7 GiB of 10.0 GiB (67.36%)
transferred 6.8 GiB of 10.0 GiB (68.41%)
transferred 6.9 GiB of 10.0 GiB (69.46%)
transferred 7.0 GiB of 10.0 GiB (70.50%)
transferred 7.2 GiB of 10.0 GiB (71.52%)
transferred 7.3 GiB of 10.0 GiB (72.53%)
transferred 7.4 GiB of 10.0 GiB (73.57%)
transferred 7.5 GiB of 10.0 GiB (74.57%)
transferred 7.6 GiB of 10.0 GiB (75.57%)
transferred 7.7 GiB of 10.0 GiB (76.57%)
transferred 7.8 GiB of 10.0 GiB (77.57%)
transferred 7.9 GiB of 10.0 GiB (78.58%)
transferred 8.0 GiB of 10.0 GiB (79.58%)
transferred 8.1 GiB of 10.0 GiB (80.58%)
transferred 8.2 GiB of 10.0 GiB (81.58%)
transferred 8.3 GiB of 10.0 GiB (82.58%)
transferred 8.4 GiB of 10.0 GiB (83.59%)
transferred 8.5 GiB of 10.0 GiB (84.59%)
transferred 8.6 GiB of 10.0 GiB (85.59%)
transferred 8.7 GiB of 10.0 GiB (86.59%)
transferred 8.8 GiB of 10.0 GiB (87.59%)
transferred 8.9 GiB of 10.0 GiB (88.59%)
transferred 9.0 GiB of 10.0 GiB (89.60%)
transferred 9.1 GiB of 10.0 GiB (90.60%)
transferred 9.2 GiB of 10.0 GiB (91.63%)
transferred 9.3 GiB of 10.0 GiB (92.63%)
transferred 9.4 GiB of 10.0 GiB (93.64%)
transferred 9.5 GiB of 10.0 GiB (94.64%)
transferred 9.6 GiB of 10.0 GiB (95.66%)
transferred 9.7 GiB of 10.0 GiB (96.66%)
transferred 9.8 GiB of 10.0 GiB (97.66%)
transferred 9.9 GiB of 10.0 GiB (98.67%)
transferred 10.0 GiB of 10.0 GiB (99.67%)
transferred 10.0 GiB of 10.0 GiB (100.00%)
transferred 10.0 GiB of 10.0 GiB (100.00%)
scsi0: successfully created disk 'local-lvm:vm-9000-disk-0,size=10G'
root@tk005:~#
root@tk005:~# qm set 9000 --ide2 local-lvm:cloudinit
update VM 9000: -ide2 local-lvm:cloudinit
Logical volume "vm-9000-cloudinit" created.
ide2: successfully created disk 'local-lvm:vm-9000-cloudinit,media=cdrom'
generating cloud-init ISO
root@tk005:~#
root@tk005:~# qm set 9000 --boot order=scsi0
update VM 9000: -boot order=scsi0
root@tk005:~#
root@tk005:~# qm set 9000 --serial0 socket --vga serial0
update VM 9000: -serial0 socket -vga serial0
root@tk005:~#
root@tk005:~# qm template 9000
Renamed "vm-9000-disk-0" to "base-9000-disk-0" in volume group "pve"
Logical volume pve/base-9000-disk-0 changed.
WARNING: Combining activation change with other commands is not advised.
root@tk005:~#
上記コマンドを実行するとWebUIにテンプレートが作成されます。
以下の項目からデフォルト値を設定・編集する
Hardware
Network:VLANを設定
Hard disk:SSD Emulationを有効化
Cloud-init
User:ユーザー名のデフォルト名
Password:ユーザーのパスワード
IP Config:IPアドレスのデフォルト
右クリックしてClone
CloneしたVMのスペック等を修正
Hardware
CPU
Memory
Hard disk:上のメニューのResize→Increseでディスク容量を追加する
Cloud-init
IP Config:IPアドレスを設定
あとはスタートすればOK
めちゃくちゃ楽です。
コメント