Kickstart 配置腳本實(shí)例
################################################################# Sample Kickstart Configuration File################################################################################################################################# point to a local installation server, or use "cdrom"################################################################url --url http://rha-server/pub/rhel5/#cdromrootpw redhatbootloader --location=mbr --passWord=redhat################################################################# partitioning################################################################zerombr yesclearpart --all --initlabelpart /boot --fstype ext3 --size 128part / --fstype ext3 --size 1 --growpart swap --recommended################################################################# network configuration# - the following is for the "recommended solution" outlined# in the Red Hat Academy Instructor's Guide################################################################network --bootPRoto=dhcp --device=eth0firewall --disabled#network --bootproto=static --ip=192.168.0.254 --netmask=255.255.255.0--device=eth0#firewall --medium --http --port=https:tcp################################################################# environment################################################################lang zh_CN.UTF-8timezone Asia/Shanghai################################################################# hardware################################################################keyboard usxconfig --startxonboot################################################################ misc###############################################################key --skip # skip install numberauthconfig --enableshadow --enablemd5reboot # reboot automatically when doneinstall # instead of "upgrade"################################################################# Software################################################################%packages --resolvedeps@admin-tools@editors@text-internet@gnome-desktop@core@base@base-x@chinese-support@sound-and-video@graphical-internetemacskexec-toolsdevice-mapper-multipathxorg-x11-utilsxorg-x11-server-Xnest-sysreport%post################################################################# Post Script - the following script runs on the newly# installed machine, immediately after installation################################################################echo "nameserver 192.168.0.254" >> /etc/resolv.confrpm -ivh ftp://rha-server/rha/autoupdate/rha-base*.rpm#rpm -Fvh ftp://Kickstart.example.com/pub/9/i386/updates/*.rpm#curl http://rha-server/rha/xorg.conf > /etc/X11/xorg.conf#curl http://rha-server/rha/station.cfg | tar xvzf -for i in elvis blondie prince madonna; douseradd $iecho redhat | passwd --stdin $idone
Kickstart 腳本設(shè)計(jì)
Kickstart 腳本通常有三個(gè)不同的部分。
命令部分
軟件包部分
安裝后腳本部分
Anaconda 會(huì)忽略Kickstart 腳本中所有以“#”開始的行和空行。
命令部分
從文件的最開始直到出現(xiàn)以%packages 開始的行,這一部分都屬于命令部分。命令行必須以可識(shí)別的關(guān)鍵字開始,并且所有與該關(guān)鍵字有關(guān)的參數(shù)都必須出現(xiàn)在同一行中。命令部分是用來(lái)指定安裝程序需要的除軟件選項(xiàng)外的所有標(biāo)準(zhǔn)信息。關(guān)鍵字在命令部分可以以任意次序出現(xiàn)。
軟件包部分(%packages)
軟件包部分是用來(lái)指定需要安裝的軟件。這部分從以%packages 開頭的行開始,直到下
一個(gè)以“%”字符開始的行為止。這一部分通常采用以下兩種格式之一。
@Component Name
package-name
第一種格式是用軟件組來(lái)指定軟件,在這里一定要注意正確拼寫軟件組名稱,并注意大小寫。
第二種格式是用來(lái)指定要安裝的軟件包的具體名稱。如果%packages 行包含額外的--resolvedeps 參數(shù),那么也會(huì)安裝解決相依性的軟件包。
安裝后腳本部分(%post)
后處理部分是在沒有 Anaconda 安裝程序參與下,執(zhí)行所有新安裝系統(tǒng)的機(jī)器的自定義過(guò)程。執(zhí)行這部分內(nèi)容與在新安裝系統(tǒng)的機(jī)器的環(huán)境下運(yùn)行 Bash Shell 腳本的效果是一樣的。如果是網(wǎng)絡(luò)安裝,那么執(zhí)行前面提到作為實(shí)例的腳本也可以激活網(wǎng)絡(luò)配置。
新聞熱點(diǎn)
疑難解答
圖片精選