打造自己的centos/linux發行版 訂製精簡ISO壓縮包檔案[初級版])

來源:互聯網
上載者:User
打造自己的centos/linux發行版 訂製精簡ISO壓縮包檔案[初級版](轉)1、安裝好RHEL/CentOS 5.3系統 ,只選自己需要的包!我只選了基礎包,而且在基礎包中去掉了一些包,安裝後大概有410個包!請你根據自己的情況來做!

2、在root根目錄中有個install.log 檔案,這個檔案中記錄了你安裝系統時安裝了哪些rpm包,檔案內容應該像是這樣的:

Installing libgcc-4.1.2-44.el5.x86_64
warning: libgcc-4.1.2-44.el5: Header V3 DSA signature: NOKEY, key ID 37017186
Installing setup-2.5.58-4.el5.noarch
Installing filesystem-2.4.0-2.x86_64
Installing basesystem-8.0-5.1.1.noarch
Installing cracklib-dicts-2.8.9-3.3.x86_64
Installing nash-5.1.19.6-44.x86_64
……………….

想辦法把這個檔案弄到win下,然後批量替換修改其中的內容,目的就是把你剛才安裝的rpm包複製出來,修改後的內容應該像是這樣的:

cp -a /media/Server/libgcc-4.1.2-44.el5.x86_64.rpm /home/rhel5u3/Server
cp -a /media/Server/setup-2.5.58-4.el5.noarch.rpm /home/rhel5u3/Server
cp -a /media/Server/filesystem-2.4.0-2.x86_64.rpm /home/rhel5u3/Server
cp -a /media/Server/basesystem-8.0-5.1.1.noarch.rpm /home/rhel5u3/Server
cp -a /media/Server/cracklib-dicts-2.8.9-3.3.x86_64.rpm /home/rhel5u3/Server

注意要先建立目錄rhel5u3和Server 還有掛載安裝光碟片到/media!如果你裝的是CentOS那麼應該把Server改成CentOS,然後vi copy.sh 將修改的install.log的內容粘貼進去儲存,執行chmod +x copy.sh 給這個指令碼執行許可權,然後sh copy.sh執行它!現在繼續複製一些需要的檔案到rhel5u3目錄中,

cp -a /media/.discinfo /home/rhel5u3
cp -a /media/.treeinfo /home/rhel5u3
cp -aR /media/isolinux /home/rhel5u3
cp -aR /media/images /home/rhel5u3
cp -aR /media/Server/repodata /home/rhel5u3/Server

如果你安裝的是CentOS,應該把cp -aR /media/Server/repodata /home/rhel5u3/Server 改為 cp -aR /media/repodata /home/rhel5u3

3、準備自動安裝檔案,在root根目錄下有個anaconda-ks.cfg 將它複製過來

cp ~/anaconda-ks.cfg /home/rhel5u3/isolinux
cd  /home/rhel5u3/isolinux
mv anaconda-ks.cfg ks.cfg

然後修改isolinux下的isolinux.cfg 將default linux 改成default linux ks=cdrom:/isolinux/ks.cfg

到此,所有需要的檔案準備完畢,接著執行以下命令

cd /home/rhel5u3/Server

createrepo -g repodata/comps-rhel5-server-core.xml .           執行createrepo命令前應該先安裝anaconda和anaconda-runtime 建議使用yum安裝!

如果你安裝的是CentOS應該把comps-rhel5-server-core.xml改為comps.xml 最後到rhel5u3上層目錄執行:

mkisofs -o RHEL5U3.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T rhel5u3/

產生光碟片iso檔案!

關於ks.cfg自動安裝檔案的更多參數請參考anaconda

預設的內容是這樣的:

# Kickstart file automatically generated by anaconda.

install
cdrom   //從光碟片安裝
key –skip //跳過SN
lang en_US.UTF-8 //語言
keyboard us //鍵盤
network –device eth0 –bootproto dhcp //網路參數
rootpw –iscrypted $1$bljn2gyE$iSEU9p3M1ZMrVBLX7BhRt. //root password
firewall –enabled –port=22:tcp //可以改為disabled 禁用fw
authconfig –enableshadow –enablemd5 //密碼加密方式
selinux –enforcing //可以改成disabled禁用selinux
timezone Asia/Hong_Kong //時間
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 /home –fstype ext3 –name=LogVol02 –vgname=VolGroup00 –size=4992
#logvol swap –fstype swap –name=LogVol01 –vgname=VolGroup00 –size=512 –grow –maxsize=1024
#logvol /tmp –fstype ext3 –name=LogVol03 –vgname=VolGroup00 –size=512
#logvol /var –fstype ext3 –name=LogVol05 –vgname=VolGroup00 –size=2848
#logvol /usr –fstype ext3 –name=LogVol04 –vgname=VolGroup00 –size=8000
#logvol / –fstype ext3 –name=LogVol00 –vgname=VolGroup00 –size=2976

%packages //這裡開始由你所選rpm包會有所不同
@editors
@core
@base
@java
fipscheck
device-mapper-multipath
-emacs-leim
-psgml
-emacspeak
-rhn-check
-dhclient
-nano
-sendmail
-pcmciautils
-yum
-yum-updatesd
-dhcpv6-client
-firstboot-tui
-NetworkManager
-yum-rhn-plugin
-irda-utils
-ypbind
-rhn-setup
-yum-security
-bluez-utils

rootpw –iscrypted $1$bljn2gyE$iSEU9p3M1ZMrVBLX7BhRt. 這個肯定要去掉,這樣可以自己在安裝時設定密碼

嘗試把network –device eth0 –bootproto dhcp去掉可在安裝時還是不能設定網路參數,後來懷疑firewall –enabled –port=22:tcp和selinux –enforcing 也去掉了還是不行,最後把:

lang en_US.UTF-8 //語言
keyboard us //鍵盤
network –device eth0 –bootproto dhcp //網路參數
rootpw –iscrypted $1$bljn2gyE$iSEU9p3M1ZMrVBLX7BhRt. //root password
firewall –enabled –port=22:tcp //可以改為disabled 禁用fw
authconfig –enableshadow –enablemd5 //密碼加密方式
selinux –enforcing //可以改成disabled禁用selinux
timezone Asia/Hong_Kong //時間

都去掉了,可還是不能設定網路,直接跳過了,不過選鍵盤和語言等參數時變成了文字模式,折騰了,有空參考一下anaconda吧,想在安裝完系統過 安裝yum和禁用一些服務!

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.