通过Workstation工具制作CentOS8虚拟机模板

通过Workstation工具制作CentOS8虚拟机模板

  • 1. 需求说明
  • 2. 安装模板虚拟机
  • 3. 配置模板虚拟机

1. 需求说明

   说明:在做集群实验过程中,需要创建多台虚拟机,如果逐台安装虚拟机,很消耗时间,所以最简洁的办法就是通过模板克隆出多台虚拟机。虚拟机克隆提供了一种灵活、高效且可重复使用的方法,以快速部署和管理虚拟机。这对于大规模虚拟化环境、开发和测试工作、备份和灾难恢复等场景都是有益的。

2. 安装模板虚拟机

   安装模板虚拟机的主要过程如下(省略部分使用默认设置):
通过Workstation工具制作CentOS8虚拟机模板_第1张图片
 
通过Workstation工具制作CentOS8虚拟机模板_第2张图片
 
通过Workstation工具制作CentOS8虚拟机模板_第3张图片
 
通过Workstation工具制作CentOS8虚拟机模板_第4张图片

3. 配置模板虚拟机

   编辑网卡:

[root@locahost ~]# systemctl stop firewalld
[root@locahost ~]# systemctl disable firewalld

[root@locahost ~]# setenforce 0
[root@locahost ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
[root@locahost ~]# cat /etc/sysconfig/network-scripts/ifcfg-ens33
TYPE=Ethernet
BOOTPROTO=dhcp
NAME=ens33
DEVICE=ens33
ONBOOT=yes

   清除密钥文件:

[root@locahost ~]# ls /etc/ssh
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@locahost ~]# rm -rf /etc/ssh/ssh_host_*  # 不能将密钥文件全删除了,只能删除这些
[root@locahost ~]# ls /etc/ssh
moduli  ssh_config  ssh_config.d  sshd_config

   清除machine-id:

注意是清除,不是删除

[root@locahost ~]# cat /etc/machine-id
1583dd1b77db4d8b86bcd0a3549422f9
[root@locahost ~]# echo > /etc/machine-id
[root@locahost ~]# cat /etc/machine-id

   关机:

[root@locahost ~]# init 0

   完整克隆:
通过Workstation工具制作CentOS8虚拟机模板_第5张图片
 
通过Workstation工具制作CentOS8虚拟机模板_第6张图片
 
通过Workstation工具制作CentOS8虚拟机模板_第7张图片

   手工配置静态IP:

通过Workstation工具制作CentOS8虚拟机模板_第8张图片
 
通过Workstation工具制作CentOS8虚拟机模板_第9张图片

你可能感兴趣的:(性能优化,linux,云计算)