AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 626889
Accepted
Aaron Copley
Aaron Copley
Asked: 2014-09-08 17:59:36 +0800 CST2014-09-08 17:59:36 +0800 CST 2014-09-08 17:59:36 +0800 CST

准备 Red Hat/CentOS 7 模板的推荐方法是什么?

  • 772

如果我需要从模板部署 Red Hat 7,我想采取推荐的步骤来使我的“黄金映像”干净。它应该引导到第一个引导提示并引导用户完成典型步骤。

在 Red Hat 5/6 中,我遵循了供应商提供的文档。但是,我找不到 Red Hat 7 的等效项。具体来说,touch /.unconfigured不会触发第一次引导设置。

9.3.1。密封 Linux 虚拟机以作为模板部署

总结
在将 Linux 虚拟机制作成模板之前,对其进行泛化(封装)。这可以防止从模板部署的虚拟机之间发生冲突。

程序 9.6。密封 Linux 虚拟机

登录到虚拟机。通过以 root 身份运行以下命令来标记系统以进行重新配置:

  1. # touch /.unconfigured
  2. 删除 ssh 主机密钥。跑:
    # rm -rf /etc/ssh/ssh_host_*
  3. 设置HOSTNAME=localhost.localdomain在/etc/sysconfig/network
  4. 删除 /etc/udev/rules.d/70-*。跑:
    # rm -rf /etc/udev/rules.d/70-*
  5. 删除HWADDR=和UUID=行/etc/sysconfig/network-scripts/ifcfg-eth*。
  6. (可选)删除所有日志/var/log并从中构建日志/root。
  7. 关闭虚拟机。跑:
    # poweroff

编辑:步骤 1 和 7 可以通过sys-unconfig最后运行来组合。或者,看看virt-syspreplibguestfs -tools-c,它可以做更多的事情。

 [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
centos
  • 1 1 个回答
  • 12874 Views

1 个回答

  • Voted
  1. Best Answer
    Michael Hampton
    2014-09-08T18:40:33+08:002014-09-08T18:40:33+08:00

    我们认为的初始设置实际上分为三个部分。前两个是:

    • 初始设置,要求您接受许可证并创建用户
    • Firstboot,它要求您配置 kdump 并(在 RHEL 上)设置您的订阅

    这两个现在都可以通过 systemd 启用;一旦完成,他们就会禁用自己。

    因此,您所要做的就是删除在第一个初始设置过程中创建的任何本地用户并重新启用这些服务:

    systemctl enable initial-setup-graphical.service
    systemctl enable firstboot-graphical.service
    > /etc/sysconfig/firstboot
    

    并重新启动。

    我不完全确定第三部分,它会询问您的语言并创建用户帐户或将机器加入域。至少,这将继续返回,直到您真正完成向导。(所以不要那样做。)

    清理主机密钥和任何硬件特定配置仍然是一个好主意。(udev 规则和接口配置文件中的 Mac 地址。)

    • 6

相关问题

  • 如何在 Linux 机器上找到有关硬件的详细信息?

  • 使用 crontab 和 /etc/cron.hourly,daily,weekly 的区别

  • 持续监控许多服务器运行状况的简单方法?

  • Hudson 无法在 tomcat5 中启动

  • CentOS 的依赖挑战

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve