创建 Linux qcow2 格式虚拟机模板

2020-04-09  本文已影响0人  iDOKER

2020-03-31 创建 Linux qcow2 格式虚拟机模板

FileInfo
Filename - 创建 Linux qcow2 格式虚拟机模板
Version - v1.1.2003(2020/03/31 ~ 2020/03/31)
Author - NUO standuke
Email - shadowdoker@gmail.com
DescriptionKey - linux centos qcow2 cloudbase init openstack

需求

Openstack 虚拟化需要

工具准备

开始制作

  1. 在 KVM 内安装好 CentOS 「cli/gui 都可以」

  2. 自定义镜像

  3. 安装 cloud-init

  4. 修改 cloud-init 配置文件 /etc/cloud/conf.cfg

Tips

guestfish

参考链接:here
http://libguestfs.org/guestfish.1.html
guestfish is an interactive shell that you can use from the command line or from shell scripts to access guest virtual machine file systems. All of the functionality of the libguestfs API is available from the shell.
We will use the guestfish tool to modify the password details and Changing the ‘root’ password on kvm qcow2 (images) for OpenStack environments.

yum -y install libguestfs libguestfs-tools*
openssl passwd -1 "password"
Welcome to guestfish, the guest filesystem shell for
editing virtual machine filesystems and disk images.

Type: ‘help’ for help on commands
‘man’ to read the manual
‘quit’ to quit the shell

<fs> run
><fs> list-filesystems
/dev/sda1: xfs
><fs> mount /dev/sda1 /
><fs> vi /etc/shadow (update the encrupted password)
><fs> quit

Vmware 扩展磁盘空间

在虚拟机里操作的时候遇到磁盘不足时,可以使用 VMware 自带的「扩展磁盘容量」

参考资料
Linux 系统安装 cloud-init
https://cloud.tencent.com/document/product/213/12587#SoftSources

上一篇 下一篇

猜你喜欢

热点阅读