【更新中】OpenStack-03-制作镜像【手做镜像?】

参考

官方:https://docs.openstack.org/image-guide/ubuntu-image.html

Installation Process

创建一台虚拟机

以 qcow2 格式的文件为例:

# 创建一个空的 10G qcow2 文件(10G 只要足够安装镜像即可)
cd ~
qemu-img create -f qcow2 ~/demo.qcow2 10G

# 从这个空的 10G qcow2 文件,创建一个基于 ubuntu1604.iso 的虚拟机
virt-install --virt-type kvm --name demo --ram1024 \
--disk ~/demo.qcow2,bus=virtio,size=10,format=qcow2 \
--network network=default \
--graphics vnc,password=foobar,port=5910,keymap=ja,listen=0.0.0.0 \
--noautoconsole --os-type=linux --os-variant=ubuntu16.04 \
--cdrom=~/ubuntu1604.iso

安装操作系统

根据创建虚拟机时的参数 --graphics vnc,password=foobar,port=5910,keymap=ja,listen=0.0.0.0,登录 VNC Viewer,访问 127.0.0.1:5910,密码是 foobar。此时,开始对虚拟机进行安装操作系统。

更改域名解析【可选】

以下操作仅对支持 resolvconf 动态生成 resolv.conf 文件的系统有效,关于 nameserver、domain、search 等配置的含义可以参考如下链接: https://blog.csdn.net/zhuzaijava/article/details/77977666。

cd /etc/resolvconf/resolv.conf.d/
echo "nameserver x.x.x.x" >> head
echo "search x.x.x.x" >> base

安装必要的云主机软件

# 更新 apt 源
apt update
# 安装 cloud-init,用于对实例进行初始化操作
apt install cloud-init -y

apt install acid -y

apt install qemu-guest-agent -y


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章