方法来自于:Core tutorial with QEMU
依次执行下面的命令
sudo apt install qemu-system-x86
mkdir temp
cd temp
# 以此镜像为例
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
cat << EOF > user-data
#cloud-config
password: 123
chpasswd:
expire: False
EOF
cat << EOF > meta-data
instance-id: test
EOF
touch vendor-data
开启新窗口执行命令:
cd temp
python3 -m http.server --directory .
切回原来的窗口
qemu-system-x86_64 \
-net nic \
-net user \
-machine accel=kvm:tcg \
-cpu host \
-m 512 \
-nographic \
-hda jammy-server-cloudimg-amd64.img \
-smbios type=1,serial=ds='nocloud;s=http://10.0.2.2:8000/'
如果虚拟机正常起来了,使用 ubuntu/123 可以登录系统,此时这个镜像的ubuntu密码就修改成功
标签:x86,qcow2,jammy,system,镜像,qemu,cloud From: https://www.cnblogs.com/dewan/p/18194350