OpenStack Epoxy : イメージを登録する2025/05/21 |
Glance に イメージの登録をします。 |
|
[1] |
こちらを参考に KVM ハイパーバイザーをインストールしておきます。 |
[2] | Glance サービス稼働ホストで CentOS Stream 9 のイメージを作成します。 CentOS Stream 9 のインストール用 ISO イメージは前もって任意のディレクトリへダウンロードしておきます。 |
# ディスクイメージ作成 [root@dlp ~(keystone)]# qemu-img create -f qcow2 /var/kvm/images/centos9.img 10G
# インストール [root@dlp ~(keystone)]# virt-install \
--name centos9 \ --ram 4096 \ --disk path=/var/kvm/images/centos9.img,format=qcow2 \ --vcpus 2 \ --os-variant centos-stream9 \ --network network=default \ --graphics none \ --console pty,target_type=serial \ --location /home/CentOS-Stream-9-latest-x86_64-dvd1.iso \ --extra-args 'console=ttyS0,115200n8'
Starting install...
# 仮想マシン起動後、ログインして最低限必要な設定を適用
CentOS Stream 9
Kernel 5.14.0-516.el9.x86_64 on an x86_64
Activate the web console with: systemctl enable --now cockpit.socket
localhost login: root
[root@localhost ~]# dnf -y install cloud-init openssh-server
[root@localhost ~]#
vi /etc/cloud/cloud.cfg # 15行目 : パスワード認証での SSH ログインを許可したい場合は変更 ssh_pwauth: true # 93, 94行目 : デフォルトユーザーを追加した [centos] に変更 # [centos] にパスワード認証での SSH 認証を許可する場合は変更 system_info: default_user: name: centos lock_passwd: false # 既存インターフェースは削除 [root@localhost ~]# nmcli device ]DEVICE TYPE STATE CONNECTION enp1s0 ethernet connected enp1s0 lo loopback unmanaged --
[root@localhost ~]#
nmcli connection del enp1s0 Connection 'enp1s0' (9f46f8e5-6a0e-3ea0-bbc5-838a48355a38) successfully deleted. # 作成した VM の定義は削除 [root@dlp ~(keystone)]# virsh undefine centos9 |
[3] | 作成したディスクイメージを Glance へ登録します。 |
[root@dlp ~(keystone)]# openstack image create "CentOS-Stream9" --file /var/kvm/images/centos9.img --disk-format qcow2 --container-format bare --public +------------------+----------------------------------------------------------------------------+ | Field | Value | +------------------+----------------------------------------------------------------------------+ | checksum | 14f22f09c3a917436d95eb799d522a97 | | container_format | bare | | created_at | 2025-05-21T00:31:36Z | | disk_format | qcow2 | | file | /v2/images/8bbf2495-d1b0-4c12-89d3-bf6ca71b2a2d/file | | id | 8bbf2495-d1b0-4c12-89d3-bf6ca71b2a2d | | min_disk | 0 | | min_ram | 0 | | name | CentOS-Stream9 | | owner | 8f6f2ea0aec84c6f919d15236063d7c0 | | properties | os_hash_algo='sha512', os_hash_value='3476d5978bce4bc3f9273740704c6ad40... | | protected | False | | schema | /v2/schemas/image | | size | 2759000064 | | status | active | | tags | | | updated_at | 2025-05-21T00:31:47Z | | virtual_size | 10737418240 | | visibility | public | +------------------+----------------------------------------------------------------------------+[root@dlp ~(keystone)]# openstack image list +--------------------------------------+----------------+--------+ | ID | Name | Status | +--------------------------------------+----------------+--------+ | 8bbf2495-d1b0-4c12-89d3-bf6ca71b2a2d | CentOS-Stream9 | active | +--------------------------------------+----------------+--------+ |
[4] | インターネット上で配布されているディスクイメージを利用する場合は、ダウンロードしたものを登録すれば OK です。 |
[root@dlp ~(keystone)]#
[root@dlp ~(keystone)]# wget http://cloud-images.ubuntu.com/releases/24.04/release/ubuntu-24.04-server-cloudimg-amd64.img
openstack image create "Ubuntu2404-Official" --file ubuntu-24.04-server-cloudimg-amd64.img --disk-format qcow2 --container-format bare --public +------------------+-----------------------------------------------------------------------------+ | Field | Value | +------------------+-----------------------------------------------------------------------------+ | checksum | 45d8e9033f08b2afe71b0c745959e098 | | container_format | bare | | created_at | 2025-05-21T00:34:10Z | | disk_format | qcow2 | | file | /v2/images/1a7a317d-0ab1-4683-8799-8533414227a6/file | | id | 1a7a317d-0ab1-4683-8799-8533414227a6 | | min_disk | 0 | | min_ram | 0 | | name | Ubuntu2404-Official | | owner | 8f6f2ea0aec84c6f919d15236063d7c0 | | properties | os_hash_algo='sha512', os_hash_value='fa1ce64afbed1ec6b9bc10653aa08fdb44... | | protected | False | | schema | /v2/schemas/image | | size | 613540352 | | status | active | | tags | | | updated_at | 2025-05-21T00:34:13Z | | virtual_size | 3758096384 | | visibility | public | +------------------+-----------------------------------------------------------------------------+ |
Sponsored Link |
|