在Red Hat 5/6中,我是followed the documentation provided供应商.但是,我找不到Red Hat 7的等价物.具体来说,触摸/.unconfigured不会触发第一次启动设置.
9.3.1. Sealing a Linux Virtual Machine for Deployment as a Template
Summary
Generalize (seal) a Linux virtual machine before making it into a template. This prevents conflicts between virtual machines deployed from the template.Procedure 9.6. Sealing a Linux Virtual Machine
Log in to the virtual machine. Flag the system for re-configuration by running the following command as root:
# touch /.unconfigured
- Remove ssh host keys. Run:
# rm -rf /etc/ssh/ssh_host_*
- Set
HOSTNAME=localhost.localdomain
in/etc/sysconfig/network
- Remove /etc/udev/rules.d/70-*. Run:
# rm -rf /etc/udev/rules.d/70-*
- Remove the HWADDR= and UUID= line from
/etc/sysconfig/network-scripts/ifcfg-eth*
.- Optionally delete all the logs from
/var/log
and build logs from/root
.- Shut down the virtual machine. Run:
# poweroff
编辑:步骤1& 7可以通过运行sys-unconfig last来组合.或者,看一下来自libguestfs-tools-c的virt-sysprep,它可以做很多事情.
[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
>初始设置,要求您接受许可并创建用户
> Firstboot,要求您配置kdump和(在RHEL上)设置您的订阅
现在通过systemd启用了这两个功能;一旦完成,他们就会自首.
因此,您应该做的就是删除在第一个初始安装过程中创建的任何本地用户并重新启用这些服务:
systemctl enable initial-setup-graphical.service systemctl enable firstboot-graphical.service > /etc/sysconfig/firstboot
并重新启动.
我不完全确定第三部分,它要求您提供语言并创建用户帐户或将计算机加入域.这至少会继续回来,直到你真正完成向导. (所以不要这样做.)
清理主机密钥和任何硬件特定配置仍然是一个好主意. (udev规则和接口配置文件中的Mac地址.)