模板机制作

虚拟机的模板机制作

  • 我以openeuler为例

清除网卡的配置信息

[root@template ~]# cd /etc/sysconfig/network-scripts/
[root@template network-scripts]# ls
ifcfg-ens160
[root@template network-scripts]# vi ifcfg-ens160 
[root@template network-scripts]# cat ifcfg-ens160 
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=ens160
DEVICE=ens160
ONBOOT=yes

清除密钥信息

  • 开机会自动生成密钥的
[root@template ~]# cd /etc/ssh/
[root@template ssh]# pwd
/etc/ssh
[root@template ssh]# ls
moduli      ssh_config.d  ssh_host_ecdsa_key      ssh_host_ed25519_key      ssh_host_rsa_key
ssh_config  sshd_config   ssh_host_ecdsa_key.pub  ssh_host_ed25519_key.pub  ssh_host_rsa_key.pub
[root@template ssh]# rm -rf ssh_host_*
[root@template ssh]# ls
moduli  ssh_config  ssh_config.d  sshd_config


清除machine id

[root@template ~]# cat /etc/machine-id 
e0f4566fd77c499b92ac611992cfea35
[root@template ~]# cat /dev/null > /etc/machine-id 
[root@template ~]# cat /etc/machine-id 
[root@template ~]# 

关闭虚拟机

  • 关闭后,不要再开开启了

克隆

img

posted @ 2025-10-18 22:10  w7nn  阅读(4)  评论(0)    收藏  举报