业务系统使用文档>12、应用管理>三方定制>PVE镜像模板制作
Files\Cloudbase Solutions\Cloudbase-Init\conf 如下是配置文件下载链接:http://mirror.cloud.idcsmart.com/cloud/images/init-tools/cloudbase-init.confhttp://mirror.cloud.idcsmart.com/cloud/images/init-tools/cloudbase-init-unattend.conf4、关闭防火墙5、关机,制作完成,得到的qcow2就是云镜像; # Linux镜像制作使用官方标准ISO安装(linux系统有很多,命令各不相同 但一定要安装的组件 sfdisk growpart cloud-init qemu-guest-agent)根据需要关闭软件(不同系统不同命令): (CentOS请一定关闭SElinux),NetworkManager,iptables,firewalld安装必须的工具(不同系统不同命令): cloud-init, qemu-guest-agent根据需要安装软件,比如以下软件(不同系统不同命令): vim, curl, wget, net-tools1、系统安装要求: 最小化、上海时区、语言英文、关闭kdump、不锁定root、不禁止root密码登录2、关闭防火墙systemctl stop firewalldsystemctl disable firewalldsed -i '/^SELINUX=/ s/enforcing/disabled/g' /etc/selinux/config3、设置时区timedatectl set-timezone Asia/Shanghai4、安装云相关组件及附件组件dnf install util-linux cloud-utils-growpart -ydnf install qemu-guest-agent cloud-init -ydnf install vim curl wget net-tools chrony -y5、配置/etc/ssh/sshd_config中的选项找到选项: PermitRootLogin yes 如果选项前有#号就去掉#号再修改值为 yes找到选项: PasswordAuthentication yes 如果选项前有#号就去掉#号再修改值为 yes# 若是ubuntu 需要把 执行 rm /etc/ssh/sshd_config.d/* -rf6、编辑cloud-init 配置文件 /etc/cloud/cloud.conf将选项 disable_root: 0 # 原始值为1, 改为0. 打开root登录将选项 ssh_pwauth: 1 #原始值为0, 改为1. 开启密码登录system_info: default_user: name: centos << 此处改为 root lock_passwd: true << 此处改为 false gecos: Cloud User groups: [adm, systemd-journal] sudo: ["ALL=(ALL) NOPASSWD:ALL"] shell: /bin/bash distro: rhel paths: cloud_dir: /var/lib/cloud templates_dir: /etc/cloud/templates ssh_svcname: sshd7、清理镜像 CentOS清除多余网卡配置 /etc/sysconfig/network-scripts/ifcfg-[eth|eno等网卡对应名称的文件] (一定要技术保留 ifcfg-lo)清理root目录: rm ~/*清理history: rm ~/.bash_history && history -c5.创建模板在之前创建的虚拟机右键转换模板制作完成后,即可进行使用