Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Created October 18, 2023 09:31
Show Gist options
  • Save dmccuk/500f3b4a1ccb6d7639529ae165a1258a to your computer and use it in GitHub Desktop.
Save dmccuk/500f3b4a1ccb6d7639529ae165a1258a to your computer and use it in GitHub Desktop.

Oracle Linux 8 VM Templating Guide in VMware

Reset Hostname

echo "localhost" > /etc/hostname

Clear Network Configuration

Delete specific network manager settings.

nmcli connection delete <connection_name>

Remove SSH Keys

SSH server keys will be regenerated upon first boot.

rm -f /etc/ssh/ssh_host_*

Clear Log Files

find /var/log -type f -exec truncate -s 0 {} \;

Clear Command History

For root and other users.

rm -f /root/.bash_history
rm -f /home/*/.bash_history

Delete Temporary Files

bash Copy code rm -rf /tmp/* rm -rf /var/tmp/*

Reset Machine ID

Machine ID will regenerate on next boot.

echo "" > /etc/machine-id

Clean DNF Cache

dnf clean all

User Configurations

Ensure removal or reset of passwords for users if any custom ones were set.

Manage Custom Services

Ensure any custom services or applications start in a default state suitable for new VMs.

Unmount Drives/Devices

Detach any temporary devices or external drives.

VMware-specific Configurations

If installed, retain open-vm-tools for compatibility.

Shutdown the VM

shutdown -h now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment