对于Vmware中虚拟机模板制作的说明
1.您需要了解
操作过程中请勿重启虚拟机;操作完毕关闭虚拟机,之后请勿开启
2 关闭 DNS 反向解析
实验测试环境建议关闭主机名的反向解析,加速三方工具连接
[root@cloudcs ~]# vi /etc/ssh/sshd_config
查找行 #UseDNS yes,修改为 UseDNS no,保存退出并重启服务
[root@cloudcs ~]# cat /etc/ssh/sshd_config
...
UseDNS no
...
[root@cloudcs ~]# systemctl restart sshd
3 编辑网卡信息
[root@cloudcs ~]# cd /etc/sysconfig/network-scripts/
[root@cloudcs network-scripts]# cp ifcfg-eno16777736 ifcfg-eno16777736.bak
[root@cloudcs network-scripts]# vi ifcfg-eno16777736
[root@cloudcs network-scripts]# cat ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=eno16777736
DEVICE=eno16777736
ONBOOT=yes
4 清除密钥信息
[root@cloudcs ~]# cd /etc/ssh/
[root@cloudcs ssh]# rm -rf ssh_host_*
5 清除 Machine ID
[root@cloudcs ~]# cat /etc/machine-id
c8e906e766cf49b3a0008a14eab54a87
[root@cloudcs ~]# cat /dev/null > /etc/machine-id
[root@cloudcs ~]# cat /etc/machine-id
6 关闭虚拟机
[root@cloudcs ~]# init 0
关闭后,原虚拟机请勿开启,之后可通过克隆功能进行克隆虚拟机
7 修改主机名及IP
根据规划修改克隆虚拟机的主机名及IP地址
[root@cloudcs ~]# hostnamectl set-hostname host01
[root@host01 network-scripts]# vim ifcfg-eno16777736
[root@host01 network-scripts]# cat ifcfg-eno16777736
TYPE=Ethernet
BOOTPROTO=none
NAME=eno16777736
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.45.152
NETMASK=255.255.255.0
GATEWAY=192.168.45.1
DNS1=192.168.45.1
#重启网络服务
[root@host01 network-scripts]# systemctl restart network