How to Create a Linux Template

When setting up Hadoop, OpenStack, or Docker containers, as well as K8S clusters, multiple hosts are required. Installing them one by one can be cumbersome, so we can create a template that can be cloned as needed.This article takes CentOS Stream 8 as an example to create a Linux template.1. Install a Minimal SystemHow to Create a Linux TemplateImage download link:https://mirrors.aliyun.com/centos-vault/8-stream/isos/x86_64/The steps for installing the system are omitted here, as they are basic operations. Below is the configuration.How to Create a Linux TemplateAfter installation, restart to begin creating the template.2. Clear Network Card Configuration Information

# cd /etc/sysconfig/network-scripts/How to Create a Linux Template
# vi ifcfg-ens160!! The network card name may not necessarily be ens160; VMware 16 and earlier versions are usually ens33. Edit according to your personal situation.How to Create a Linux Template

3. Clear Key InformationKey information is automatically generated upon booting.

# cd /etc/ssh/How to Create a Linux Template
# rm -rf ssh_host_*How to Create a Linux Template

4. Clear Machine ID

# cat /etc/machine-idHow to Create a Linux Template
# cat /dev/null > /etc/machine-idHow to Create a Linux Template

5. Shut Down the Virtual Machine

# init 0Note! At this point, the Linux template has been created. Since key information is automatically generated upon booting, do not power it on after shutting down. Just clone it when needed.

This article concludes here. If you found it helpful, please leave a like for the author!

Leave a Comment