如果我需要从模板部署Red Hat 7,我想采取推荐的步骤,使我的“黄金形象”干净。 它应该引导到第一启动提示符,并引导用户通过典型的步骤。
在Red Hat 5/6中,我遵循了供应商提供的文档 。 但是,我无法findRed Hat 7的等价物。具体来说, touch /.unconfigured不会触发第一次启动设置。
9.3.1。 将Linux虚拟机作为模板进行部署
概要
在将其作为模板之前,将Linux虚拟机一般化(密封)。 这可以防止从模板部署的虚拟机之间发生冲突。过程9.6。 密封Linux虚拟机
- 如何使用不同的参数调用puppet文件模板两次而不使用define?
- salt stack:在模板中使用状态jinjavariables
- 木偶和模板:如何循环顺序,而不是随机的
- 为什么在从模板configuration虚拟机时,“渴望”与“懒惰”调零需要更长的时间?
- 如何查找哪个模板用于SharePoint中的站点或页面
login到虚拟机。 通过以root身份运行以下命令来标记系统以进行重新configuration:
# touch /.unconfigured- 删除SSH主机密钥。 跑:
# rm -rf /etc/ssh/ssh_host_*- 在
/etc/sysconfig/network设置HOSTNAME=localhost.localdomain- 删除/etc/udev/rules.d/70-*。 跑:
# rm -rf /etc/udev/rules.d/70-*- 从
/etc/sysconfig/network-scripts/ifcfg-eth*删除HWADDR =和UUID =行。- 可以从
/var/log删除所有日志,并从/root日志。- closures虚拟机。 跑:
# poweroff
编辑:步骤1和7可以通过最后运行sys-unconfig进行组合。 或者,从libguestfs-tools-c看一看virt-sysprep ,它的function非常强大 。
[user@hostname ~]$ virt-sysprep --list-operations abrt-data * Remove the crash data generated by ABRT bash-history * Remove the bash history in the guest blkid-tab * Remove blkid tab in the guest ca-certificates Remove CA certificates in the guest crash-data * Remove the crash data generated by kexec-tools cron-spool * Remove user at-jobs and cron-jobs delete * Delete specified files or directories dhcp-client-state * Remove DHCP client leases dhcp-server-state * Remove DHCP server leases dovecot-data * Remove Dovecot (mail server) data firewall-rules Remove the firewall rules firstboot * Add scripts to run once at next boot flag-reconfiguration Flag the system for reconfiguration hostname * Change the hostname of the guest kerberos-data Remove Kerberos data in the guest logfiles * Remove many log files from the guest lvm-uuids * Change LVM2 PV and VG UUIDs machine-id * Remove the local machine ID mail-spool * Remove email from the local mail spool directory net-hostname * Remove HOSTNAME in network interface configuration net-hwaddr * Remove HWADDR (hard-coded MAC address) configuration pacct-log * Remove the process accounting log files package-manager-cache * Remove package manager cache pam-data * Remove the PAM data in the guest password * Set root or user password puppet-data-log * Remove the data and log files of puppet random-seed * Generate random seed for guest rhn-systemid * Remove the RHN system ID rpm-db * Remove host-specific RPM database files samba-db-log * Remove the database and log files of Samba script * Run arbitrary scripts against the guest smolt-uuid * Remove the Smolt hardware UUID ssh-hostkeys * Remove the SSH host keys in the guest ssh-userdir * Remove ".ssh" directories in the guest sssd-db-log * Remove the database and log files of sssd tmp-files * Remove temporary files udev-persistent-net * Remove udev persistent net rules user-account Remove the user accounts in the guest utmp * Remove the utmp file yum-uuid * Remove the yum UUID
我们认为最初的设置实际上分为三个部分。 前两个是:
这两个现在通过systemd启用; 一旦完成,他们就自行禁用
因此,您只需删除在第一个初始安装过程中创build的任何本地用户,并重新启用这些服务:
systemctl enable initial-setup-graphical.service systemctl enable firstboot-graphical.service > /etc/sysconfig/firstboot
并重新启动。
我不完全确定第三部分,它要求您提供您的语言,并创build一个用户帐户或将本机join域。 至less,这将继续回来,直到你真正完成向导。 (所以不要这样做。)
清理主机密钥和任何硬件特定的configuration仍然是一个好主意。 (在udev规则和接口configuration文件中的Mac地址)