Kickstart 配置腳本實例
################################################################# 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 腳本設計
Kickstart 腳本通常有三個不同的部分。
命令部分
軟件包部分
安裝后腳本部分
Anaconda 會忽略Kickstart 腳本中所有以“#”開始的行和空行。
命令部分
從文件的最開始直到出現以%packages 開始的行,這一部分都屬于命令部分。命令行必須以可識別的關鍵字開始,并且所有與該關鍵字有關的參數都必須出現在同一行中。命令部分是用來指定安裝程序需要的除軟件選項外的所有標準信息。關鍵字在命令部分可以以任意次序出現。
軟件包部分(%packages)
軟件包部分是用來指定需要安裝的軟件。這部分從以%packages 開頭的行開始,直到下
一個以“%”字符開始的行為止。這一部分通常采用以下兩種格式之一。
@Component Name
package-name
第一種格式是用軟件組來指定軟件,在這里一定要注意正確拼寫軟件組名稱,并注意大小寫。
第二種格式是用來指定要安裝的軟件包的具體名稱。如果%packages 行包含額外的--resolvedeps 參數,那么也會安裝解決相依性的軟件包。
安裝后腳本部分(%post)
后處理部分是在沒有 Anaconda 安裝程序參與下,執行所有新安裝系統的機器的自定義過程。執行這部分內容與在新安裝系統的機器的環境下運行 Bash Shell 腳本的效果是一樣的。如果是網絡安裝,那么執行前面提到作為實例的腳本也可以激活網絡配置。
新聞熱點
疑難解答