When you use some kind of virtualization platform like VMware vSphere. VMware Workstation, VMware Fusion, Oracle Virtual Box, you name it, then Virtual Machine cloning is a big thing and operational simplification.
In this blog post I document best practice for image cloning of Ubuntu Server.
1. Install Ubuntu server
Install Ubuntu including applications you would like to have in your Golden Image.
2. Delete machine-id
sudo truncate -s 0 /etc/machine-id
sudo rm -f /var/lib/dbus/machine-id
3. Delete SSH host keys
sudo rm -f /etc/ssh/ssh_host_*
4. Clean cloud-init
sudo cloud-init clean --logs
5. Clean system logs
sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
6. Clean temporary data
sudo rm -rf /tmp/*
7. Shutdown system
sudo shutdown -h now
Conclusion
Such batch of commands should anonymize the system and it is a good practice for using system image cloning.
Hope you enjoy it.
No comments:
Post a Comment