How to create a Ubuntu 18.04.5 template in VSphere ESXi 6.7

October 14, 2020 at 4:19 pm Leave a comment

As usual you need to create a VM and install Ubuntu in to it. Thereafter you need to follow the below steps to strip out the unique data being propagated to the VM’s you create from the template.

+Update the OS
#sudo apt -y update
#sudo apt -y upgrade

+Clear audit logs
truncate -s0 /var/log/wtmp
truncate -s0 /var/log/lastlog

+Clear the tmp
#rm -rf /tmp/*
rm -rf /var/tmp/*

+Clear the SSH
#rm -f /etc/ssh/ssh_host_*

+Reset the hostname
#sed -i ‘s/preserve_hostname: false/preserve_hostname: true/g’ /etc/cloud/cloud.cfg
#truncate -s0 /etc/hostname
#hostnamectl set-hostname localhost

+Clean apt
#apt clean

+Remove the default *.yaml file from the /etc/netplan. The VMware customizaion will create it’s own file 99-netcfg-vmware.yaml.
#rm -f /etc/netplan/*.yaml

+Reset the machine id
#echo -n > /etc/machine-id

+Clear the history & shutdown the VM
#history -c
#shutdown -h now

On the vCenter you need to create a VM Customization specification to be used when deploying the VM’s from the template(Refer:How to create a RHEL 7 template in VSphere ESXi 6.7 for steps).

However , when I created the VM’s from this template I realised that

  • All the VM’s are having the same hostid. Some applications uses the hostid in their licensing .Thus, it has to be unique across the VM’s. Since I did not find a way to solve this while deploying the VM’, I had to do a manual modification as mentioned below on the VM’s after it being created.

    #vi /etc/hosts
    replace the line “127.0.1.1 localhost” with
    your IP FQDN Hostname (E.g: 1.1.1.1 server.test.local server).

  • You need to manually select the “Connected” option in The VM network Adapter in the VM properties.

Entry filed under: Linux.

The Microsoft Exchange Replication service couldn’t find a valid configuration for database ‘mydb’ on server ‘server1’. Error: An Active Manager operation failed. Error: The active copy for database could not be determined:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Trackback this post  |  Subscribe to the comments via RSS Feed


Archives

Categories

Follow Hope you like it.. on WordPress.com

Blog Stats

  • 34,624 hits

%d bloggers like this: