Skip to content

Instantly share code, notes, and snippets.

@TheBoroer
Created November 24, 2021 04:06
Show Gist options
  • Save TheBoroer/a28faa755bfb795a1d8ef56122ce7feb to your computer and use it in GitHub Desktop.
Save TheBoroer/a28faa755bfb795a1d8ef56122ce7feb to your computer and use it in GitHub Desktop.
script to prep a Ubuntu 18.04 or 20.04 fresh install to create a VMware template
# Update your OS packages:
sudo apt-get update
sudo apt-get upgrade -y
# Prevent cloudconfig from preserving the original hostname and reset the hostname:
sudo sed -i 's/preserve_hostname: false/preserve_hostname: true/g' /etc/cloud/cloud.cfg
sudo truncate -s0 /etc/hostname
sudo hostnamectl set-hostname localhost
# Remove the current network configuration:
sudo rm /etc/netplan/50-cloud-init.yaml
# Clean shell history:
cat /dev/null > ~/.bash_history && history -c
echo "Done. All that's left is to shutdown the host via: sudo shutdown now"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment