创建 Linux qcow2 格式虚拟机模板

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 虚拟化需要

工具准备

  • KVM 虚拟机,支持 VirtIO 即可
  • CentOS 系统安装光盘

开始制作

  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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 1.环境准备 centos7 1.1、yum安装设置 yum list |grep openstackcentos...
    davisgao阅读 10,854评论 1 16
  • 云计算 1:什么是云计算? 云计算是一种按量付费的模式!云计算的底层是通过虚拟化技术来实现的! 2:云计算的服务类...
    人气昂阅读 4,253评论 0 0
  • 虚拟化技术概览KVM简介KVM的管理操作 一、虚拟化技术概览 (一)虚拟化技术类型: 主机虚拟化:xen, kvm...
    哈喽别样阅读 5,869评论 0 5
  • ## 1:什么是云计算? **云计算是一种按量付费的模式!云计算的底层是通过虚拟化技术来实现的!** ## 2:云...
    爱可耐_九卿阅读 2,540评论 0 0
  • 背景 生产系统的KVM虚拟机跑的CetnOS6.10因为当初部署的时候硬盘只分配了50G,系统也没有使用LVM进行...
    女侠留步_4b1c阅读 4,790评论 0 0