8.2. 使用 CLI 为 Edge Simplified Installer 镜像创建 RHEL
8.2.1. 设置 UEFI HTTP 引导服务器 复制链接链接已复制到粘贴板!
设置 UEFI HTTP Boot 服务器,以便您可以通过连接到这个 UEFI HTTP Boot 服务器来开始通过网络提供 RHEL for Edge 虚拟机。
先决条件
- 您已创建了 ISO 简化的安装程序镜像。
- 提供 ISO 内容的 http 服务器。
流程
将 ISO 镜像挂载到您选择的目录上:
# mkdir /mnt/rhel8-install/ # mount -o loop,ro -t iso9660 /path_directory/installer.iso /mnt/rhel8-install/使用 RHEL for Edge 可引导 ISO 镜像的路径替换
/path_directory/installer.iso。将挂载镜像中的文件复制到 HTTP 服务器 root 中。这个命令创建包含镜像内容的
/var/www/html/rhel8-install/目录。# mkdir /var/www/html/httpboot/ # cp -R /mnt/rhel8-install/* /var/www/html/httpboot/ # chmod -R +r /var/www/html/httpboot/*注意某些复制方法可以跳过
.treeinfo文件(一个有效的安装源需要这个文体) 。对于整个目录运行cp命令,如此过程所示,可正确复制.treeinfo。更新
/var/www/html/EFI/BOOT/grub.cfg文件:-
coreos.inst.install_dev=/dev/sdawithcoreos.inst.install_dev=/dev/vda -
使用
linuxefi /images/pxeboot/vmlinuz替换linux /images/pxeboot/vmlinuz -
使用
initrdefi /images/pxeboot/initrd.img替换initrd /images/pxeboot/initrd.img 使用
coreos.inst.image_url=http://{IP-ADDRESS}/disk.img.xz替换coreos.inst.image_file=/run/media/iso/disk.img.xz。IP-ADDRESS 是此计算机的 IP 地址,它将充当 http 引导服务器。
-
启动 httpd 服务:
# systemctl start httpd.service因此,在设置 UEFI HTTP 引导服务器后,您可以使用 UEFI HTTP 引导安装 RHEL for Edge 设备。
8.2.2. 使用 RHEL 镜像构建器 CLI 为简化的镜像创建一个蓝图 复制链接链接已复制到粘贴板!
要为简化的 RHEL for Edge 镜像创建蓝图,您必须在蓝图中添加以下自定义:
-
使用
installation_device自定义自定义蓝图。 -
在蓝图中添加
设备文件位置,以启用对设备的无人值守安装。 -
添加
URL以执行初始设备凭证交换。 -
使用
customizations.user自定义蓝图,并将用户和用户组添加到其中。
流程
以 Tom’s Obvious, Minimal Language (TOML) 格式创建一个纯文本文件,其内容如下:
name = "simplified-installer-blueprint" description = "blueprint for the simplified installer image" version = "0.0.1" packages = [] modules = [] groups = [] distro = "" [customizations] installation_device = "/dev/vda" [[customizations.user]] name = "admin" password = "admin" groups = ["users", "wheel"] [customizations.fdo] manufacturing_server_url = "http://10.0.0.2:8080" diun_pub_key_insecure = "true"注意蓝图中的 FDO 自定义是可选的,您可以构建 RHEL for Edge Simplified Installer 镜像,而没有错误。
- name 是蓝图的名称,description 是蓝图的描述信息。
- 0.0.1 是 Semantic Versioning 方案的版本号。
- 模块 描述了要安装到镜像中的软件包名称和匹配版本的 glob,例如:软件包名称 = "tmux",匹配的版本 glob 是 version = "2.9a"。请注意,目前软件包和模块之间没有区别。
-
组是要安装到镜像中的软件包组,如
anaconda-tools组软件包。如果您不知道模块和组,请将其留空。 - Installation-device 是自定义的,可对您的设备进行无人值守安装。
- manufacturing_server_url 是执行初始设备凭证交换的 URL。
- name 是要登录到镜像的用户名。
- password 是您选择的密码。
- groups 是任何用户组,如 "widget"。
将蓝图推送(导入)到 RHEL 镜像构建器服务器中:
# composer-cli blueprints push blueprint-name.toml检查创建的蓝图是否已成功推送并已存在。
# composer-cli blueprints show blueprint-name检查蓝图中列出的组件和版本是否有效:
# composer-cli blueprints depsolve blueprint-name
使用 RHEL 镜像构建器命令行界面创建 RHEL for Edge Simplified 镜像。
先决条件
- 为 RHEL for Edge Simplified 的镜像创建了蓝图。
- 您提供提交的 OSTree 存储库来嵌入镜像中。例如 http://10.0.2.2:8080/repo。请参阅 ref:setting-up-a-web-server-to-install-rhel-for-edge-image_installing-rpm-ostree-images[Setting a web server to install RHEL for Edge image]。
流程
创建可引导 ISO 镜像。
# composer-cli compose start-ostree \ blueprint-name \ edge-simplified-installer \ --ref rhel/8/x86_64/edge \ --url URL-OSTree-repository \其中,
-
blueprint-name是 RHEL for Edge 蓝图名称。 -
edge-simplified-installer是镜像类型。 -
--ref指定创建您的提交的位置的引用。 --url是要嵌入到镜像中的提交的 OSTree 存储库的 URL。例如:http://10.0.2.2:8080/repo/。您可以启动一个 RHEL for Edge Container,或设置 web 服务器。请参阅为非基于网络的部署创建 RHEL for Edge 容器镜像,以及设置 web 服务器来安装 RHEL for Edge 镜像。这时将显示一个确认已添加到队列中的 composer 进程。它还显示创建的镜像的通用唯一标识符 (UUID) 号。使用 UUID 号来跟踪构建。另外,记录 UUID 号以易于执行进一步的任务。
-
检查镜像 compose 状态。
# composer-cli compose status输出以以下格式显示状态:
<UUID> RUNNING date blueprint-name blueprint-version image-type注意镜像创建过程可能需要最多十分钟才能完成。
要中断镜像创建过程,请运行:
# composer-cli compose cancel <UUID>要删除现有镜像,请运行:
# composer-cli compose delete <UUID>