Ubuntu 26.04対応の仮想マシン作成用コマンド

Ubuntu 26.04が正式公開されたので、仮想マシン関係のコマンドを修正しました。

仮想マシン作成関係のコマンド(Ubuntu 26.04の場合)

ISOイメージダウンロード

cd /opt/vm

デスクトップ版の場合

wget https://releases.ubuntu.com/26.04/ubuntu-26.04-desktop-amd64.iso

サーバ版の場合

wget https://releases.ubuntu.com/26.04/ubuntu-26.04-live-server-amd64.iso

VM作成

下記で作成(–os-variantは26.04がまだ登録されていないため)

#!/bin/bash
VM_NAME="Ubuntu2604"
ISO_PATH="/opt/vm/ubuntu-26.04-desktop-amd64.iso"
DISK_PATH="/opt/vm/Ubuntu2604.qcow2"
DISK_SIZE="60"
RAM="6144"
VCPUS="4"

qemu-img create -f qcow2 "$DISK_PATH" "${DISK_SIZE}G"

virt-install \
  --name "$VM_NAME" \
  --ram "$RAM" \
  --vcpus "$VCPUS" \
  --cpu host-passthrough \
  --os-variant ubuntu25.10 \
  --disk path="$DISK_PATH",format=qcow2,bus=virtio \
  --cdrom "$ISO_PATH" \
  --network network=default,model=virtio \
  --graphics vnc,listen=127.0.0.1 \
  --video virtio \
  --boot uefi \
  --noautoconsole

echo "VM '$VM_NAME' を作成しました。"

Ubuntu Serverの場合

#!/bin/bash
VM_NAME="Ubuntu2604sv"
ISO_PATH="/opt/vm/ubuntu-26.04-live-server-amd64.iso"
DISK_PATH="/opt/vm/Ubuntu2604sv.qcow2"
DISK_SIZE="60"
RAM="6144"
VCPUS="4"

qemu-img create -f qcow2 "$DISK_PATH" "${DISK_SIZE}G"

virt-install \
  --name "$VM_NAME" \
  --ram "$RAM" \
  --vcpus "$VCPUS" \
  --cpu host-passthrough \
  --os-variant ubuntu25.10 \
  --disk path="$DISK_PATH",format=qcow2,bus=virtio \
  --cdrom "$ISO_PATH" \
  --network network=default,model=virtio \
  --graphics vnc,listen=127.0.0.1 \
  --video virtio \
  --boot uefi \
  --noautoconsole

echo "VM '$VM_NAME' を作成しました。"

ゲストがUbuntuの場合は次のコマンドでゲストエージェントをインストール。

sudo apt install -y qemu-guest-agent
sudo systemctl enable --now qemu-guest-agent
# エージェントが実行中か確認
systemctl status qemu-guest-agent

ファイラー Navigator プラグイン

sudo apt install -y git
git clone https://github.com/45Drives/cockpit-navigator.git
cd cockpit-navigator
git checkout v0.5.8
sudo apt install -y make
sudo make install
cd ..
rm -rf cockpit-navigator

Samba を Cockpit で管理

sudo apt install -y samba
wget https://github.com/45Drives/cockpit-file-sharing/releases/download/v4.5.3-4/cockpit-file-sharing_4.5.3-4jammy_all.deb
sudo apt install -y ./cockpit-file-sharing_4.5.3-4jammy_all.deb
rm cockpit-file-sharing_4.5.3-4jammy_all.deb

virt-managerもインストール

sudo apt install -y virt-manager
タイトルとURLをコピーしました