本文以最小化安装操作系统并安装ansible为例。
yum -y install syslinux rsync
mount openEuler镜像 /media
mkdir /ISO
# 同步/mnt/cdrom/下的文件到/ISO/路径下,除了 Packages 和 repodata 文件夹
/usr/bin/rsync -a --exclude=Packages/ --exclude=repodata/ /media/ /ISO/
mkdir -p /ISO/{Packages,repodata}
rpm -qa >> /root/install.log
awk '{print $0}' /root/install.log |xargs -i cp /media/Packages/{}.rpm /ISO/Packages/
yum install -y --downloadonly --downloaddir=/root/test/ ansible
mv /root/test/* /ISO/Packages/
vim /ISO/isolinux/isolinux.cfg
default vesamenu.c32
timeout 600
display boot.msg
# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title openEuler 22.03-LTS
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13
# Border Area
menu color border * #00000000 #00000000 none
# Selected item
menu color sel 0 #ffffffff #00000000 none
# Title bar
menu color title 0 #ff7ba3d0 #00000000 none
# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none
# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none
# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none
# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none
# Help text
menu color help 0 #ffffffff #00000000 none
# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none
# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none
# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none
# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty line
label linux
menu label ^Install openEuler 22.03-LTS
kernel vmlinuz
menu default #在grub界面将默认选项设置为'^Install openEuler 22.03-LTS'
append initrd=initrd.img ks=cdrom:/isolinux/ks.cfg inst.stage2=hd:LABEL=openEuler-22.03-yfq quiet #指定kick start配置文件的位置,以及镜像的名字
timeout 60
label check
menu label Test this ^media & install openEuler 22.03-LTS
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-22.03-LTS-x86_64 rd.live.check quiet
menu separator # insert an empty line
# utilities submenu
menu begin ^Troubleshooting
menu title Troubleshooting
label vesa
menu indent count 5
menu label Install openEuler 22.03-LTS in ^basic graphics mode
text help
Try this option out if you're having trouble installing
openEuler 22.03-LTS.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-22.03-LTS-x86_64 nomodeset quiet
label rescue
menu indent count 5
menu label ^Rescue a openEuler system
text help
If the system will not boot, this lets you access files
and edit config files to try to get it booting again.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-22.03-LTS-x86_64 rescue quiet
label memtest
menu label Run a ^memory test
text help
If your system is having issues, a problem with your
system's memory may be the cause. Use this utility to
see if the memory is working correctly.
endtext
kernel memtest
menu separator # insert an empty line
label local
menu label Boot from ^local drive
localboot 0xffff
menu separator # insert an empty line
menu separator # insert an empty line
label returntomain
menu label Return to ^main menu
menu exit
menu end
cp /root/anaconda-ks.cfg /ISO/isolinux/ks.cfg
vim /ISO/isolinux/ks.cfg
# Generated by pykickstart v3.34#version=openEuler-22.03-yfq# Use graphical installgraphical%packages@^minimal-environment@core@yfqansible%end# Keyboard layoutskeyboard --xlayouts='us'# System languagelang en_US.UTF-8# Network informationnetwork --hostname=localhost.localdomain # Use hard drive installation media#harddrive --dir= --partition=LABEL=openEuler-22.03-LTS-x86_64# Use CDROM installation mediacdrom# Run the Setup Agent on first bootfirstboot --enable# System servicesservices --enabled="chronyd"ignoredisk --only-use=sdaautopart# Partition clearing informationclearpart --none --initlabel# System timezonetimezone Asia/Shanghai --utc# Reboot after installationreboot# Root passwordrootpw --iscrypted $6$mAoJvzkuxv9wndsJ$EyhczP1rvekzsNt8Zxr8vK4bE1D5yyMAhDQ8vvKdjfIiHhbQpE/.snRsGNzWnL.tfR8kYSCwj23A0fSwcGi78/%addon com_redhat_kdump --disable --reserve-mb='128'%end%anacondapwpolicy root --minlen=8 --minquality=1 --strict --nochanges --notemptypwpolicy user --minlen=8 --minquality=1 --strict --nochanges --emptyokpwpolicy luks --minlen=8 --minquality=1 --strict --nochanges --notempty%end
vim /ISO/repodata/normal.xml
---yfqansible yfqansible yfqansible yfqansible yfqansible false false ansible ansible-help libsodium python3-asn1crypto python3-babel python3-bcrypt python3-cffi python3-cryptography python3-httplib2 python3-idna python3-jinja2 python3-jmespath python3-markupsafe python3-paramiko python3-ply python3-pyasn1 python3-pycparser python3-pynacl python3-pytz python3-pyyaml sshpass ---...---minimal-environment Minimal Install 最小安装 Basic functionality. 基本功能。 1 core yfqansible standard ---
yum -y install createrepo mkisofs
cd /ISO
createrepo -g repodata/normal.xml ./
cd /ISO
genisoimage -joliet-long -V openEuler-22.03-yfq -o openEuler-22.03-yfq.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 /ISO
至此,重新打包好的ISO就做好了,在/ISO下。
如上内容有参考其他文章,如有侵权请联系我删除。