一 、下载银河麒麟高级服务器镜像
https://www.kylinos.cn/support/trial.html?pid=1
二 、使用VMware Workstation 16安装Kylin V10 SP1 服务器原版系统
? ? ??安装选择最小化安装
三 、制作ISO过程操作记录
1 虚拟机下挂载原版镜像
1) 查看光盘是否已挂载
ls -l /dev/cdrom |grep cd
2) 将ISO所在的/dev/cdrom挂载到/media
mount /dev/cdrom /media
2 安装制作发行版的工具
yum -y install createrepo mkisofs isomd5sum rsync
3 同步光盘文件到制作ISO的目录
#同步/media下的文件到/ISO路径下,除了Packages和repodata文件夹
/usr/bin/rsync -a --exclude=Packages/ --exclude=repodata/ /media/ /ISO/
# 在/ISO/文件夹下新建Packages和repodata文件夹
mkdir -p /ISO/{Packages,repodata}
4 拷贝当前系统已安装的软件包到/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/
5 配置yum下载指定软件包列表(rpms_list.txt)的所有依赖包
#!/bin/sh??
for line in `cat /root/rpms_list.txt`
??? do
?????? echo "download file>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>and it's denpendies"$line
???? yum install -y --downloadonly --downloaddir=/root/test/ $line
#或者先安装yum -y install yum-utils再yumdownloader $line
??? done
#yum查找.so或者某个依赖在哪个rpm包中
yum provides {.so名或者依赖名字}
#拷贝包到指定目录
cp /root/test/* /ISO/Packages/
6 修改isolinux.cfg文件(legacy模式)
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 Kylin Linux Advanced Server V10 menu vshift 8 menu rows 18 menu margin 8 #menu hidden menu helpmsgrow 15 menu tabmsgrow 13 menu width 80
# 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 default ??menu label ^Install Kylin Linux Advanced Server V10 ??kernel vmlinuz ??append initrd=initrd.img inst.stage2=hd:LABEL=Kylin-Server-10 inst.ks=cdrom:/isolinux/ks.cfg video=efifb:on quiet
label check ??menu label Test this ^media & install Kylin Linux Advanced Server V10 ??kernel vmlinuz ??append initrd=initrd.img inst.stage2=hd:LABEL=Kylin-Server-10 rd.live.check video=efifb:on quiet
menu separator # insert an empty line
# utilities submenu menu begin ^Troubleshooting ??menu title Troubleshooting
label vesa ??menu indent count 5 ??menu label Install Kylin Linux Advanced Server V10 in ^basic graphics mode ??text help ????????Try this option out if you're having trouble installing ????????Kylin Linux Advanced Server V10. ??endtext ??kernel vmlinuz ??append initrd=initrd.img inst.stage2=hd:LABEL=Kylin-Server-10 nomodeset video=efifb:on quiet
label rescue ??menu indent count 5 ??menu label ^Rescue a Kylin Linux Advanced Server 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=Kylin-Server-10 rescue console=tty1 video=efifb:on 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
inst.ks为ks.cfg文件位置; inst.stage2为安装介质位置,hd:LABEL为介质标签,例如Kylin-Server-10。这个和后续生成ISO镜像文件的命令genisoimage的参数-V有关。 最好是把所有hd:LABEL后面的值都替换为一个后面会用到的字符串,如Kylin-Server-10
7 修改EFI/BOOT/grub.cfg文件(UEFI模式)
set default="0" function load_video { ??insmod efi_gop ??insmod efi_uga ??insmod video_bochs ??insmod video_cirrus ??insmod all_video }
load_video set gfxpayload=keep insmod gzio insmod part_gpt insmod ext2
set timeout=60 ### END /etc/grub.d/00_header ### search --no-floppy --set=root -l 'Kylin-Server-10'
### BEGIN /etc/grub.d/10_linux ### menuentry 'Install Kylin Linux Advanced Server V10' --class fedora --class gnu-linux --class gnu --class os { ????????linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Kylin-Server-10 inst.ks=cdrom:/isolinux/ks.cfg video=efifb:on quiet ????????initrdefi /images/pxeboot/initrd.img
} menuentry 'Test this media & install Kylin Linux Advanced Server V10' --class fedora --class gnu-linux --class gnu --class os { ????????linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Kylin-Server-10 rd.live.check video=efifb:on quiet ????????initrdefi /images/pxeboot/initrd.img } submenu 'Troubleshooting -->' { ????????menuentry 'Install Kylin Linux Advanced Server V10 in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os { ????????????????linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Kylin-Server-10 nomodeset video=efifb:on quiet ????????????????initrdefi /images/pxeboot/initrd.img ????????} ????????menuentry 'Rescue a Kylin Linux Advanced Server system' --class fedora --class gnu-linux --class gnu --class os { ????????????????linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Kylin-Server-10 rescue console=tty1 video=efifb:on quiet ????????????????initrdefi /images/pxeboot/initrd.img ????????} }
8 修改自动化安装配置文件
cp /root/anaconda-ks.cfg /ISO/isolinux/ks.cfg
在%packages与%end中间加入自定义的脚步及命令
%post mkdir -p /media/cdrom mount -o loop /dev/sr0 /media/cdrom? ? ? ?? sh /media/cdrom/soft/mlnx.sh
systemctl disable systemd-networkd-wait-online.service systemctl disable multipathd.service systemctl disable tmp.mount systemctl mask tmp.mount systemctl stop systemd-tmpfiles-setup-dev.service systemctl disable systemd-tmpfiles-setup-dev.service systemctl mask systemd-tmpfiles-setup-dev.service
### do kylin post action if [ -e /bin/.kylin-post-actions ];then ? /bin/bash -x /bin/.kylin-post-actions &> /var/log/.kylin-post-actions.log fi
%end
9 制作修改comps文件
1) 进入/ISO目录,将“*-x86_64-comps.xml”文件拷贝到/ISO/repodata路径下,并重命名成comps.xml。 cp /media/repodata/*-x86_64-comps.xml??/ISO/repodata/comps.xml
2) 编辑comps文件
(1) 添加定制rpm包? (以ruby为例)
? ?<group> ? ? <id>ruby_pkgs</id> ? ? <name>ruby_pkgs</name> ? ? <name xml:lang="zh_CN">ruby</name> ? ? <name xml:lang="zh_TW">ruby</name> ? ? <name xml:lang="zh_HK">ruby</name> ? ? <description>ruy一种简单快捷的面向对象脚本语言。</description> ? ? <description xml:lang="zh_CN">ruy一种简单快捷的面向对象脚本语言。</description> ? ? <description xml:lang="zh_TW">ruy一种简单快捷的面向对象脚本语言。</description> ? ? <description xml:lang="zh_HK">ruy一种简单快捷的面向对象脚本语言。</description> ? ? <default>false</default> ? ? <uservisible>false</uservisible> ? ? <packagelist>
? ? ? <!--add by kylin:ying--> ? ? ? ?<packagereq type="default">readline</packagereq> ? ? ? ?<packagereq type="default">ruby</packagereq> ? ? ? ?<packagereq type="default">ruby-devel</packagereq> ? ? ? ?<packagereq type="default">rubygem-io-console</packagereq> ? ? ? ?<packagereq type="default">rubygem-json</packagereq> ? ? ? ?<packagereq type="default">rubygem-openssl</packagereq> ? ? ? ?<packagereq type="default">rubygem-psych</packagereq> ? ? ? ?<packagereq type="default">rubygem-rdoc</packagereq> ? ? ? ?<packagereq type="default">rubygems</packagereq> ? ? ? ?<packagereq type="default">ruby-help</packagereq> ? ? ? ?<packagereq type="default">ruby-irb</packagereq> ? ? ? ?<packagereq type="default">jdk1.8</packagereq> ? ? ? ?<packagereq type="default">tcsh</packagereq> ? ? ? ? ? ? </packagelist> ? </group>
根据rpms_list.txt拼接packagereq
#!/bin/sh for line in `cat rpms_list.txt` ????do ????????echo " <packagereq type=\"default\">"$line"</packagereq>" >> /root/package.txt ????done (2) 在指定的环境中添加定制的groupid?
<environment> ????<id>minimal-environment</id> ????<name>Minimal Install</name> ????<name xml:lang="zh_CN">最小安装</name> ????<name xml:lang="zh_TW">最小安裝</name> ????<name xml:lang="zh_HK">最小安裝</name> ????<description>Basic functionality.</description> ????<description xml:lang="zh_CN">基本功能。</description> ????<description xml:lang="zh_TW">基本功能。</description> ????<description xml:lang="zh_HK">基本功能。</description> ????<display_order>1</display_order> ????<grouplist> ??????<groupid>core</groupid> ??????<groupid>ruby_pkgs</groupid> ??????? ????</grouplist> ????<optionlist> ??????<!-- Add by kylin --> ??????<groupid>debugging</groupid> ??????<!-- End by kylin --> ??????<groupid>standard</groupid> ????</optionlist> ??</environment>
10 切换到ISO/路径下,由comps.xml生成repodata包。注意当有新包加入,或者更新comps.xml文件,均需要重新生成repodata文件夹
createrepo -g repodata/comps.xml ./
11 制作ISO镜像,注意参数中的-V,和上面的isolinux.cfg文件保持一致
cd /ISO genisoimage -joliet-long -V Kylin-Server-10 -o Kylin-Server-10.iso -input-charset utf-8 -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
12 制作镜像MD5值
implantisomd5 /ISO/Kylin-Server-10.iso
12 接下来安装系统,若配置自动安装则启动时全自动安装
|