日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

How to custom RedHat DVD

發布時間:2023/12/15 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 How to custom RedHat DVD 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、準備rhel-server-5.4-i386-dvd.iso

二、準備4個文件

1、comps-server.xml

?----來自原始光盤的repodata目錄中的Server/repodata/目錄中的comps-rhel5-server.xml的修改,修改方法參

考?http://cooker.techsnail.com/index.php/Custom_Linux_bootable_CD

2、install.log

----來自已經完成安裝的系統,內容是選擇core和base和dialup軟件組后裝完的系統中所帶的RPM包列表。 ? ? ? ? ? ? ? ? ? ? ? ?

3、makesrcdisk.sh 【未測試】?【注意:ks.cfg中有Extra目錄, 但腳本中未添加Extra目錄,如需要增加自己的軟件,可以在上面的腳本中加入】

----安裝過程腳本,內容如下,見腳本即見步驟。

#!/bin/bash


########################################################
## set parameter
########################################################
currentpath=`dirname $0`
cdromsourceiso=$currentpath/rhel-server-5.4-i386-dvd.iso
mediapath=/mnt
isoimagepath=/iso
installrpmlist=$currentpath/install.log
xmlrepofile=$currentpath/comps-hissage-server.xml?
destisofile=mini32.iso
kickstartfile=$currentpath/ks_2.cfg
isomenufile=$currentpath/isolinux.cfg


if [[ -z $currentpath ]] || [[ -z $cdromsourceiso ]] || [[ -z $mediapath ]] || [[ -z $isoimagepath ]] || [[ -z $installrpmlist ]] || [[ -z $xmlrepofile ]] || [[ -z $destisofile ]]
then
? ? echo "missing args"
? ? exit
fi


########################################################
## mount iso image
########################################################
if [[ `ls /mnt|wc -l` -ne 0 ]]
then?
? ? echo "/mnt mount point is not empty"
? ? exit
fi
mount -t iso9660 -o loop $cdromsourceiso /mnt
if [[ `ls /mnt|wc -l` -eq 0 ]]
then?
? ? echo "mount iso image failed"
? ? exit
fi

########################################################
## check required rpm?
########################################################
if ?! rpm -qa|grep -q createrepo ? || ?! rpm -qa|grep -q mkisofs || ?! rpm -qa|grep -q rsync
then
? ?echo "missing rpms createrepo or mkisofs or rsync"
? ?exit
fi?
? ??
########################################################
## copy required file
########################################################
rsync -av --exclude Server/ ?$mediapath/ ?$isoimagepath/
mkdir -p $isoimagepath/Server


########################################################
## copy customed rpms
########################################################
less ?$installrpmlist| awk -F" " '/Installing/ {print $2}'|while read line
do
? ? line=`echo $line|sed 's/[0-9]\+:\(.*\)$/\1/'`?
? ? rpmfile=$line.rpm
? ? if [[ ! -e $mediapath/Server/$rpmfile ]]
? ? then
? ? ? ? echo "not exit $rpmfile"
? ? ?exit
? ? fi
? ? cp -a $mediapath/Server/$rpmfile $isoimagepath/Server/
done

########################################################
## create repo
########################################################
discinfo=$(head -1 $isoimagepath/.discinfo)
if [[ -z $discinfo ]] || [[ $discinfo = "" ]]
then
? ?echo "missing discinfo"
? ?exit
fi
/bin/rm -f $isoimagepath/Server/repodata/*
/bin/cp -f $xmlrepofile $isoimagepath/Server/repodata
createrepo -u "media://$discinfo" ?-g repodata/$xmlrepofile $isoimagepath/Server


########################################################
## create disk
########################################################
/bin/cp -f $isomenufile $isoimagepath/isolinux/isolinux.cfg
/bin/cp -f $kickstartfile $isoimagepath/ks.cfg
mkisofs -R -J -T -v -no-emul-boot ?-boot-load-size 4 ?-boot-info-table -V Hesine -b isolinux/isolinux.bin ?-c isolinux/boot.cat -o $destisofile ?$isoimagepath
echo "create iso success!"

4、ks.cfg

光盤kickstart文件,內容如下

install
cdrom
#xconfig --startxonboot
text
key 2515dd4e215225dd
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$ra5hd2y4$nqcZPQxT75.tewecKyf7Q1
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
firstboot --disable
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda
network --bootproto=dhcp --device=eth0 --onboot=on
reboot
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux
#part swap --recommended
#part / --fstype ext3 --size=7000 --grow

%post --nochroot --log=/mnt/sysimage/root/copy.log --erroronfail
#!/bin/sh
mkdir -p /mnt/cdrom
mount -t iso9660 /tmp/cdrom /mnt/cdrom
cp -a /mnt/cdrom/Extra /mnt/sysimage
umount /mnt/cdrom

%post --log=/mnt/sysimage/root/post.log --erroronfail
#!/bin/sh
cd /Extra/software
/bin/bash /Extra/software/postscript.sh

%packages
@base
@core
@dialup

5.isolinux.cfg

修改頭三行為

default linux ks=cdrom:/ks.cfg
prompt 1
timeout 1


三、必備軟件包

rsync、createrepo、mkisofs

四、運行腳本

makesrcdisk.sh

五、制作Redhat6.0安裝光盤

因為光盤目錄有變化,因此制作庫的軟件包有升級,拷貝文件的腳本有變化,其他雷同

腳本如下

makesrcdisk.sh腳本如下

#!/bin/bash


########################################################
## set parameter
########################################################
currentpath=`dirname $0`
cdromsourceiso=$currentpath/rhel-server-6.0-x86_64-dvd.iso
mediapath=/mnt
isoimagepath=/iso
installrpmlist=$currentpath/install.log
xmlrepofile=$currentpath/comps-hissage-server.xml
destisofile=mini64.iso
kickstartfile=$currentpath/ks_2.cfg
isomenufile=$currentpath/isolinux.cfg
if [[ -z $currentpath ]] || [[ -z $cdromsourceiso ]] || [[ -z $mediapath ]] || [[ -z $isoimagepath ]] || [[ -z $installrpmlist ]] || [[ -z $xmlrepofile ]] || [[ -z $destisofile ]]
then
? ? echo "missing args"
? ? exit
fi


########################################################
## mount iso image
########################################################
if [[ `ls /mnt|wc -l` -ne 0 ]]
then?
? ? echo "/mnt mount point is not empty"
? ? exit
fi
mount -t iso9660 -o loop $cdromsourceiso /mnt
if [[ `ls /mnt|wc -l` -eq 0 ]]
then
? ? echo "mount iso image failed"
? ? exit
fi


########################################################
## check required rpm?
########################################################
if ?! rpm -qa|grep -q createrepo ? || ?! rpm -qa|grep -q mkisofs || ?! rpm -qa|grep -q rsync
then
? ?echo "missing rpms createrepo or mkisofs or rsync"
? ?exit
fi


########################################################
## copy required file
########################################################
rsync -av --exclude Packages/ --exclude Server/repodata/ $mediapath/ ?$isoimagepath/
mkdir -p $isoimagepath/Packages
mkdir -p $isoimagepath/Server/repodata




########################################################
## copy customed rpms
########################################################
less ?$installrpmlist| awk -F" " '/Installing/ {print $2}'|while read line
do
? ? rpmfile=$line.rpm
? ? if [[ ! -e $mediapath/Packages/$rpmfile ]]
? ? then
? ? ? ? echo "not exit $rpmfile"
? ? ? ? exit
? ? fi
? ? cp -a $mediapath/Packages/$rpmfile $isoimagepath/Packages/
done


########################################################
## create repo
########################################################
discinfo=$(head -1 $isoimagepath/.discinfo)
if [[ -z $discinfo ]] || [[ $discinfo = "" ]]
then
? ?echo "missing discinfo"
? ?exit
fi
/bin/rm -f $isoimagepath/Server/repodata/*
/bin/cp -f $xmlrepofile $isoimagepath/Server/repodata
createrepo -u "media://$discinfo" ?-g repodata/comps-hissage-server-2.xml $isoimagepath/Server




########################################################
## create disk
########################################################
/bin/cp -f $isomenufile $isoimagepath/isolinux/isolinux.cfg
/bin/cp -f $kickstartfile $isoimagepath/ks.cfg
mkisofs -R -J -T -v -no-emul-boot ?-boot-load-size 4 ?-boot-info-table -V Hesine -b isolinux/isolinux.bin ?-c isolinux/boot.cat -o $destisofile ?$isoimagepath
echo "create iso success!"


六、參考

http://cooker.techsnail.com/index.php/Custom_Linux_bootable_CD

http://www.redhat.com/archives/kickstart-list/2011-March/msg00007.html

http://forums.fedoraforum.org/showthread.php?t=247303

http://www.linuxquestions.org/questions/red-hat-31/create-custom-rhel5-4-iso-802845/

http://www.linuxtopia.org/online_books/rhel6/rhel_6_migration_guide/rhel_6_migration_ch02s02s02s04.html

總結

以上是生活随笔為你收集整理的How to custom RedHat DVD的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。