0
点赞
收藏
分享

微信扫一扫

rhel7.6虚拟机的封装

芭芭蘑菇 2022-01-12 阅读 57

文章目录


一、系统的安装

使用镜像进行系统的安装,使用默认LVM分区即可

二、配置ip

1.IP配置

vi /etc/sysconfig/network-scripts/ficfg-eth0
IPADDR=172.25.0.90
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=static
DEVICE=eth0
GATEWAY=172.25.0.90

2. 远程连接虚拟机

  1. 配置软件仓库
vi /etc/yum.repo.d/westos.repo
[dvd]
name=rhel7.6
baseurl=http://172.25.0.90/rhel7.6/
gpgcheck=0
  1. 设置selinux为关闭状态
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
  1. 关闭NetworkManger
systemctl disable --now NetworkManager		#NetworkManager用于有线无线网络转换的使用这个就算是动态环境的网路了
  1. 在域名解析下设置对应的解析名称
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.0.91     server1
172.25.0.92     server2
172.25.0.93     server3
172.25.0.94     server4
172.25.0.95     server5
172.25.0.96     server6

在这里插入图片描述

2.清空镜像缓存

virt-sysprep -d westosa				#清空镜像的多余缓存

在这里插入图片描述

3.压缩母盘生成子盘

virt-sparsify --compress nodea.now.qcow2 nodea.now.break.pcow2

在这里插入图片描述

4.创建子镜像

qemu-img create -f qcow2 -b nodea.now.break.pcow2 server1	#创建子镜象-f选择格式为qcow2-b子盘文件名称、生成后的名称

在这里插入图片描述

三、部署虚拟机

1. 选择倒入模式

在这里插入图片描述

2. 选择生成的子镜像以及系统版本

在这里插入图片描述

3.配置对应的ip

在这里插入图片描述


总结

举报

相关推荐

0 条评论