I am using CentOS for a long time now, and as I am re-building my home lab, it was a no-brainer to use it as my default Linux operating system.

In this post I will document how I created my CentOS golden image.

  • I installed a normal CentOS 8 Server, creating my user account.
  • After the installation is done, I updated the system, so my golden image is up-to-date.
[root@template-centos-8 ~]# dnf update -y
[...]
[root@template-centos-8 ~]# dnf clean all
  • Now as the system is up-to-date, let's make sure that the VMware Tools Service is up and running
[root@template-centos-8 ~]# systemctl start vmtoolsd.service
[root@template-centos-8 ~]# systemctl enable vmtoolsd.service
  • After this we can make sure that the clones have new ssh host keys, and the guest customization is working.
[root@template-centos-8 ~]# rm -vf /etc/ssh/ssh_host_*
removed '/etc/ssh/ssh_host_ecdsa_key'
removed '/etc/ssh/ssh_host_ecdsa_key.pub'
removed '/etc/ssh/ssh_host_ed25519_key'
removed '/etc/ssh/ssh_host_ed25519_key.pub'
removed '/etc/ssh/ssh_host_rsa_key'
removed '/etc/ssh/ssh_host_rsa_key.pub'
[root@template-centos-8 ~]# dnf install -y perl
  • Some final clean up
[root@template-centos-8 ~]# systemctl stop systemd-journald.socket
[root@template-centos-8 ~]# find /var/log -type f -exec rm {} \;
[root@template-centos-8 ~]# mkdir -p /var/log/journal
[root@template-centos-8 ~]# cd /root ; rm -f .bash_history ; history -c
[root@template-centos-8 ~]# systemctl poweroff

This should be it. We now have a clean, up-to-date CentOS 8 VM that can be converted into a template.