使用虚拟机准备环境

使用虚拟机准备环境 #

使用qemu虚拟机加载cloud-init镜像

安装qemu #

OSVer=$(cat /etc/os-release  | grep ^NAME= | awk -F= '{print $2}' | sed 's/"//g')
if [ "$OSVer" = "Ubuntu" ]; then
    apt -y install qemu-system
else 
    yum install -y qemu-system
fi

下载cloud-init镜像 #

wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img

启动虚拟机 #

qemu-system-x86_64