Linux系统运维实战系列二:CentOS8.1 Linux系统虚拟机封装
对于前面文章中所安装好的centos虚拟机进行配置;
(1)将CentOS 8.1安装好的VMware虚拟机封装,为后续的实验环境,批量生成实验Linux系统,在VMware Workstation 上创建虚拟机模板,通过虚拟机模板创建Linux虚拟机系统,但是模板创建的虚拟机CentOS上所有文件完全一样,等于克隆了一个系统,在克隆之前需要对虚拟机进行封装,去掉唯一性;
(2)在做CentOS 8.1系统封装之前,先将系统升级到最新;


更新完成之后,重启服务器;
接下来开始封装系统:
machine-id系统机器ID:
(3)删除系统ID:machine-id;machine-id为系统的唯一性ID,每台服务器系统应该唯一,解决系统ID冲突,删除即可;

(4)在/etc/profile文件最后添加:开机重启后,通过systemd-machine-id-setup 命令生成全新的machine-id

(5)清除udev:重启后系统会自动创建

(6)清除网卡配置:重启后生成新的网卡配置文件

(7)清除ssh私钥文件:不同系统私钥应该不同,删除后重启自动生成全新的私钥

(8)清除系统中的旧日志:停止日志服务;

(9)将原有的旧日志删除;

(10)创建/var/log/journal目录,配置systemd-journald服务的持久日志存储目录(原systemd-journald日志保存在/run/log/journal/目录中,此目录文件保存在内存中,掉电丢失);

(11)创建/var/log/journal 目录,后续systemd-journald的日志将保存到此位置;

(12)清除所有命令的记录;

(13)最后一步,关闭系统;

(14)在VMWare workstation 虚拟化软件中对封装好的 CentOS 8.1 创建 “快照”;


(15)在虚拟机设置中“启用模板模式(用于克隆)”然后“确定”;

CentOS 8.1的Linux VMware workstation 虚拟机的封装 完成
(16)接下来通过 模板来创建 CentOS 8.1的虚拟机系统:



(17)为了节约实验磁盘空间,创建链接克隆;

(18)配置全新克隆虚拟机的保存位置,最后点 “完成”;




(19)为全新的虚拟机,配置网卡即可;
总结:全新一台的CentOS 8.1的实验虚拟机创建 完成, 在以后的实验中所有新的虚拟机都可以使用此方法快速的生成实验虚拟机。 无需 频繁的安装Linux系统,为后续的Linux运维实战打下基础
Linux系统运维实战系列技术文章每周一三五更新~~
联系我们
|