著作權聲明:原創作品,如需轉載,請與作者聯絡。否則將追究法律責任。 目前CentOS 5.2的安裝CD有1至6張,但是在安裝系統過程中,並不是所有的程式都是你想安裝的,而且需要準備1-6張CD來安裝一個Linux系統,實在是太麻煩了,其實安裝一個實用的Linux 系統,不需要那麼臃腫的,我們可以度身定製一個合適你自己的CentOS Linux系統. 我的目標是打算將1-6CD中的軟體包集合到一張CD中,只需要一張CD就可以自動安裝一個實用的Linux. 準備:1. 在VM上安裝一個最少化的Linux系統之後,再根據實際情況安裝需要的軟體包: # yum install -y pump-devel gtk2-devel booty bogl-devel bogl-bterm elfutils-devel beecrypt-devel dietlibc anaconda anaconda-runtime busybox-anaconda 2. 下載一個CentOS 5.2的DVD iso.# mount -o loop /storage/CentOS-5.2-i386-bin-DVD.iso /media 3. 建立相關的目錄環境:# mkdir -p /storage/kickstart_build/isolinux/CentOS# mkdir -p /storage/kickstart_build/isolinux/ks# mkdir -p /storage/kickstart_build/isolinux/image# mkdir -p /storage/kickstart_build/isolinux/repodata# mkdir /storage/kickstart_build/all_rpms 4. 複製源CD中的檔案:# cp -rp /media/isolinux/* /storage/kickstart_build/isolinux 包括.discinfo# cp /media/.discinfo /storage/kickstart_build/isolinux# cp -rp /media/isolinux/repodata/comps.xml /storage/kickstart_build# cp -rp /media/CenOS/* /storage/kickstart_build/all_rpms 5.編輯ks.cfg: #vi /storage/kickstart_build/isolinux/ks/ks.cfg # Kickstart file automatically generated by anaconda.
install
cdrom
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
network --device eth1 --onboot no --bootproto dhcp
rootpw --iscrypted $1$AEQtgISA$pJKkCI5GeO3MLmLz/Fz.00
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda
# 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 --drives=sda
#part /boot --fstype ext3 --size=100 --ondisk=sda
#part pv.2 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.2
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=256 --grow --maxsize=512
clearpart --all --initlabel
part /boot --fstype ext3 --size=100
part swap --size=1024
part / --fstype ext3 --size=100 --grow
%packages
@editors
@text-internet
@dialup
@core
@base
device-mapper-multipath
6. 對RPMS進行剪裁,例如你可以將你需要安裝的RPM包全部複製到/storage/kickstart_build/isolinux/CentOS目錄下,請參考附件list檔案,是我需要安裝的軟體包列表. 你可以編輯comps.xml 檔案中的packages列表來決定你需要安裝的軟體包. 7.收集依賴性軟體包請使用shell1,使用方法: 下載到/storage/kickstart_build目錄下,修改為pare.pl,並賦予可執行許可權: # cd /storage/kickstart_build# chmod +x pare.pl# cd /storage/kickstart_build/isolinux/CentOS# /storage/kickstart_build/pare.pl /storage/kickstart_build/all_rpms i386 8.測試軟體包的依賴性# cd /storage/kickstart_build/isolinux/CentOS# mkdir /tmp/testdb
# rpm --initdb --dbpath /tmp/testdb
# rpm --test --dbpath /tmp/testdb -Uvh *.rpm 按照提示,缺少哪些依賴性軟體包,直接從/storage/kickstart_build/all_rpms 下複製過來就行了. 9.建立repository# cd /storage/kickstart_build/isolinux
# declare -x discinfo=`head -1 .discinfo`
# createrepo -u "media://$discinfo" -g /storage/kickstart_build/comps.xml . 命令運行完畢之後,會自動建立repodata目錄. 10.建立ISO檔案 # cd /storage/kickstart_build# mkisofs -o MYOS.iso -b isolinux.bin -c boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table -R -J -v -T isolinux/ 產生MD5字串:# /usr/lib/anaconda-runtime/implantisomd5 custom.iso
本文出自 “網路記憶棒” 部落格,轉載請與作者聯絡!