November 18

Linux: Red Hat Server Cloning/Clone Preparation

This document describes the configuration needed to clean up a RHEL 7 virtual machine before turning it into a template for cloning.Process for Cloning Redhat servers.

1. Using Vi or Nano, replace the old server name with the new one in the following files:Look for hostname= (I use the name of the template)/root/./anaconda-ks.cfg/root/./initial-setup-ks.cfg
2. Shut down the following services:service rsyslog stopservice auditd stop
3. Delete uneeded temp files:rm –rf /tmp/*rm –rf /var/tmp/*
4.  If it exists remove the persistent-net rules file.rm -f /etc/udev/rules.d/70-persistent-net.rules
5. Remove the HWADDR and Static IP lines from /etc/sysconfig/network-scripts/ifcfg-eth[x]It is a good Idea to remove the UUID
6. Remove the ssh configuration files.  These will be automatically recreated.rm -rf /etc/ssh/ssh_host_*
7.  Force SElinux to relabel and not reject changestouch /.autorelabel
8. Clear the machine IDtruncate -s0 /etc/machine-id
9.  If using puppet- On clientsystemctl stop puppetfind /etc/puppetlabs/puppet/ssl -name servername.domainname.com.pem -delete
– On puppet serverpuppet cert clean servername.domainname.com
10. If using katellomv /etc/rhsm/facts/katello.facts /tmp
11. Configure the initial graphical setup for nameing and IPing the server.echo “RUN_FIRSTBOOT=YES” > /etc/sysconfig/firstbootsystemctl enable initial-setup
12. Clear history:history -c
13. Shutdown system:shutdown -h now


Copyright 2021. All rights reserved.

Posted November 18, 2021 by Timothy Conrad in category "Linux

About the Author

If I were to describe myself with one word it would be, creative. I am interested in almost everything which keeps me rather busy. Here you will find some of my technical musings. Securely email me using - PGP: 4CB8 91EB 0C0A A530 3BE9 6D76 B076 96F1 6135 0A1B