修改并重新打包ISO X86版

基于 openEuler 22.03 x86版

本文以最小化安装操作系统并安装ansible为例。

一、安装所需工具,做准备工作(在一台安装好 openEuler 22.03 x86的主机上操作 )
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 包到/ISO/Packages 下
        拷贝当前系统已安装的软件包到/ISO/Packages 目录下(最好还是拷贝全量的原 Packages 下的安装包,或者是 yum 安装过后再生成 install.log 否则依赖包会不完整)
1) 生成 install.log
rpm -qa >> /root/install.log
2) 拷贝已安装 rpm
awk '{print $0}' /root/install.log |xargs -i cp /media/Packages/{}.rpm /ISO/Packages/
3)配置 yum 下载指定软件包的所有依赖包
yum install -y --downloadonly --downloaddir=/root/test/ ansible
mv /root/test/* /ISO/Packages/
三、修改配置文件
1、修改 isolinux.cfg
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

2、制作 ks.cfg 文件
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 install
graphical
%packages
@^minimal-environment
@core
@yfqansible
%end
# Keyboard layouts
keyboard --xlayouts='us'
# System language
lang en_US.UTF-8
# Network information
network --hostname=localhost.localdomain # Use hard drive installation media
#harddrive --dir= --partition=LABEL=openEuler-22.03-LTS-x86_64
# Use CDROM installation media
cdrom
# Run the Setup Agent on first boot
firstboot --enable
# System services
services --enabled="chronyd"
ignoredisk --only-use=sda
autopart
# Partition clearing information
clearpart --none --initlabel
# System timezone
timezone Asia/Shanghai --utc
# Reboot after installation
reboot
# Root password
rootpw --iscrypted $6$mAoJvzkuxv9wndsJ$EyhczP1rvekzsNt8Zxr8vK4bE1D5yyMAhDQ8vvKdjfIiHhbQpE/.snRsG
NzWnL.tfR8kYSCwj23A0fSwcGi78/
%addon com_redhat_kdump --disable --reserve-mb='128'
%end
%anaconda
pwpolicy root --minlen=8 --minquality=1 --strict --nochanges --notempty
pwpolicy user --minlen=8 --minquality=1 --strict --nochanges --emptyok
pwpolicy luks --minlen=8 --minquality=1 --strict --nochanges --notempty
%end
3、制作 comps.xml 文件(用 normal.xml 文件代替)
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
1、制作 repodata 包
cd /ISO
createrepo -g repodata/normal.xml ./
2、制作 iso 镜像
# 注意参数中的-V,和上面的 isolinux.cfg 文件有关
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下。

如上内容有参考其他文章,如有侵权请联系我删除。

你可能感兴趣的:(linux,服务器,运维开发)