需求:
1、legacy启动
2、/boot分区1G,剩余给/
3、创建root密码和一个普通用户
4、最小化安装(选上development、legacy-unix、security-tools、standard)
5、关闭firewalld、selinux
6、增加安装vim、ntpdate、iptables、expect
操作
1、本地虚拟机安装openEuler2203SP1
2、挂载本地yum源
mkdir -p /media/cdrom
mount /dev/cdrom /media/cdrom
cd /etc/yum.repos.d/
mkdir tmp
mv *.repo tmp/
cat > local.repo <<EOF
[BaseOS]
cachedir=/var/cache/dnf
keepcache=1
name=BaseOS
baseurl=file:///media/cdrom/
enabled=1
gpgcheck=0
EOF
sed -i 's#keepcache=0#keepcache=1#g' /etc/yum.confcat >> /etc/fstab <<EOF
/dev/cdrom /media/cdrom iso9660 defaults 0 0
EOF
cat /etc/fstab
3、创建自定义镜像目录及工具下载
mkdir -p /ISO/
yum -y install createrepo genisoimage isomd5sum rsync
/usr/bin/rsync -a /media/cdrom/ /ISO/
4、修改isolinux.cfg文件
4.1 倒计时60秒修改成5s
4.2 默认启动从Test this ^media & install修改为^Install【第一个启动】
4.3 修改ks配置【inst.ks=cdrom:/isolinux/ks.cfg】
sed -i -e 's|append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-22.03-LTS-SP1-x86_64 quiet|append initrd=initrd.img inst.stage2=hd:LABEL=openEuler-22.03-LTS-SP1-x86_64 inst.ks=hd:LABEL=openEuler-22.03-LTS-SP1-x86_64:/isolinux/ks.cfg quiet|' /ISO/isolinux/isolinux.cfg
sed -i -e '/menu default/d' -e '/menu label ^Install openEuler 22.03-LTS-SP1/a\ menu default' -e 's/timeout 600/timeout 50/' /ISO/isolinux/isolinux.cfg
5、复制ks并修改
cp /root/anaconda-ks.cfg /ISO/isolinux/ks.cfg
5.1 graphical修改为text
5.2格式化重新分区(boot分区1G,剩余给跟)
clearpart --all --initlabel
part /boot --fstype="ext4" --ondisk=sda --size=1024
part / --fstype="ext4" --ondisk=sda --grow
5.3基础环境
selinux --disabled
firewall --disabled
# Generated by Anaconda 36.16.5
# Generated by pykickstart v3.34
#version=DEVEL
# Use graphical install
#graphical
text# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8# Use hard drive installation media
#cdrom
harddrive --dir= --partition=LABEL=openEuler-22.03-LTS-SP1-x86_64%packages
@^minimal-environment
@development
@legacy-unix
@security-tools
@standard
vim
ntpdate
iptables
expect%end# Run the Setup Agent on first boot
firstboot --enable# Generated using Blivet version 3.4.2
ignoredisk --only-use=sda
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype="ext4" --ondisk=sda --size=1024
part / --fstype="ext4" --ondisk=sda --grow# System timezone
timezone Asia/Shanghai --utcreboot
selinux --disabled
firewall --disabled# Root password
rootpw --iscrypted $y$j9T$8zztLsIsff9lhCcQKVHi3Jxl$gldhEsI4j1g9BsaqP99ov0FGPR9/hO3wM02o2tEENz3
user --groups=wheel --name=user --password=$y$j9T$BE5bW3S04DfD4k8ezzDlOTb6$WBYEYySnfghcdKsWsq.sbqULc8TMgUHQLfxqoO.Lmr2 --iscrypted --uid=1000 --gecos="user" --gid=1000
PS:密码加密
python3 -c 'import crypt; print(crypt.crypt("123456"))'
6、生成镜像
cd /ISO
genisoimage -joliet-long -V openEuler-22.03-LTS-SP1-x86_64 -o /root/openEuler-22.03.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 /ISOimplantisomd5 /root/openEuler-22.03.iso