制作自动安装openEuler-24.03-LTS-SP1-x86_64镜像

自定义安装镜像 openEuler 24.03-sp1-x86_64

环境准备

# 安装工具
yum -y install createrepo genisoimage isomd5sum rsync
# 上传下载的iso
cd ~ && ls
openEuler-24.03-LTS-SP1-x86_64-dvd.iso
# 挂载
mount -o loop /root/openEuler-24.03-LTS-SP1-x86_64-dvd.iso /mnt
# 同步数据到制作目录
rsync -a  /mnt/* /root/ISO/

制作kc.cfg

# vim kc.cfg
#version=DEVEL
# 默认图像化安装
graphical
# 键盘布局
keyboard --vckeymap=us --xlayouts='us'
# 系统语言
lang en_US.UTF-8
# 网络配置 静态ip,link是指定最早发现的网卡名称这样就不怕名称不固定了
network  --bootproto=static --device=link --gateway=192.168.163.1 --ip=192.168.163.204 --nameserver=8.8.8.8,114.114.114.114 --netmask=255.255.255.0 --activate
# 主机名称
network  --hostname=e2403sp1
# 使用硬盘安装介质
#harddrive --dir= --partition=LABEL=openEuler-24.03-LTS-x86_64
# 最小化安装
%packages
@^minimal-environment
%end
# 在首次启动时运行设置代理
firstboot --enable
# 指定安装系统的磁盘名称
ignoredisk --only-use=sda
# 指定清理分区
clearpart --none --initlabel
# 定制分区信息
## 'swap' 2G
part swap --fstype="swap" --ondisk=sda --size=2048
## 'boot' 1G
part /boot --fstype="ext4" --ondisk=sda --size=1024
## '/' --grow 根据剩余空间自动增长
part / --fstype="ext4" --ondisk=sda --grow --size=1
## BIOS引导分区 1M
part biosboot --fstype="biosboot" --ondisk=sda --size=1
# 系统时间
timezone Asia/Shanghai --utc
# Root密码 Kc@123!@#
rootpw --iscrypted $y$j9T$NEWc89TTocndwovBKswx0wvI$tsPXQBhK4VITuhhb32k4GcmS6r2yI6Lkn8oeGBa28ID
# 关闭防火墙,selinux
firewall --disabled
selinux  --disabled

修改isolinux.cfg

# vim /root/ISO/isolinux/isolinux.cfg

# 原始

label linux
  menu label ^Install openEuler 24.03-LTS-SP1
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64 quiet fpi_to_tail=off

# 修改后

label linux
  menu label ^Install openEuler 24.03-LTS-SP1
  kernel vmlinuz
  append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64 inst.ks=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64:/isolinux/ks.cfg inst.repo=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64 quiet fpi_to_tail=off

# 解析
inst.stage2   为安装介质位置
inst.ks       为ks.cfg文件位置
Inst.repo     为安装系统时指定安装源
hd:LABEL      为介质标签,openEuler-24.03-LTS-SP1-x86_64

修改grub.cfg

# vim /root/ISO/EFI/BOOT/grub.cfg

# 原始

menuentry 'Install openEuler 24.03-LTS-SP1' --class openEuler --class gnu-linux --class gnu --class os {
        linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64 fpi_to_tail=off

# 修改后

menuentry 'Install openEuler 24.03-LTS-SP1' --class openEuler --class gnu-linux --class gnu --class os {
        linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64 inst.ks=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64:/isolinux/ks.cfg inst.repo=hd:LABEL=openEuler-24.03-LTS-SP1-x86_64 fpi_to_tail=off

制作iso

cd /root/ISO

genisoimage -joliet-long \
-V openEuler-24.03-LTS-SP1-x86_64 \
-o openEuler-24.03-LTS-SP1-KC-x86_64.iso \
-b isolinux/isolinux.bin \
-c isolinux/boot.cat \
-no-emul-boot \
-boot-load-size 4 \
-boot-info-table \
-R -J -v \
-cache-inodes \
-T -eltorito-alt-boot \
-e images/efiboot.img \
-no-emul-boot \
/root/ISO

注入md5值

implantisomd5 openEuler-24.03-LTS-SP1-KC-x86_64.iso

查看label信息

isoinfo -d -i openEuler-24.03-LTS-SP1-KC-x86_64.iso|grep "Volume id"
Volume id: openEuler-24.03-LTS-SP1-x86_64

posted on 2025-03-10 09:01  luokeli  阅读(370)  评论(0)    收藏  举报

导航