系統(tǒng)之家 - 系統(tǒng)光盤(pán)下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > 配置Kickstart腳本

如何配置Kickstart腳本

時(shí)間:2015-02-07 17:03:00 作者:qipeng 來(lái)源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問(wèn): https://m.xitongzhijia.net/xtjc/20150207/37594.html 手機(jī)查看 評(píng)論

  我們都知道,kickstart可用來(lái)自動(dòng)化安裝Linux系統(tǒng),比手動(dòng)安裝速度更快,但是為了更好的安裝系統(tǒng),需要對(duì)kickstart腳本進(jìn)行配置,下面小編就給大家介紹下配置kickstart腳本的方法,一起來(lái)學(xué)習(xí)下吧。

 如何配置Kickstart腳本

  配置kickstart腳本的方法

  ###############################################################

  #

  # Sample Kickstart Configuration File

  #

  ###############################################################

  ###############################################################

  #

  # point to a local installation server, or use “cdrom”

  #

  ###############################################################

  url --url https://rha-server/pub/rhel5/

  #cdrom

  rootpw RedHat

  bootloader --location=mbr --password=redhat

  ###############################################################

  #

  # partitioning

  #

  ###############################################################

  zerombr yes

  clearpart --all --initlabel

  part /boot --fstype ext3 --size 128

  part / --fstype ext3 --size 1 --grow

  part swap --recommended

  ###############################################################

  #

  # network configuration

  # - the following is for the “recommended solution” outlined

  # in the Red Hat Academy Instructor‘s Guide

  #

  ###############################################################

  network --bootproto=dhcp --device=eth0

  firewall --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-8

  timezone Asia/Shanghai

  ###############################################################

  #

  # hardware

  #

  ###############################################################

  keyboard us

  xconfig --startxonboot

  ###############################################################

  # misc

  ###############################################################

  key --skip # skip install number

  authconfig --enableshadow --enablemd5

  reboot # reboot automatically when done

  install # instead of “upgrade”

  ###############################################################

  #

  # Software

  #

  ###############################################################

  %packages --resolvedeps

  @admin-tools

  @editors

  @text-internet

  @gnome-desktop

  @core

  @base

  @base-x

  @chinese-support

  @sound-and-video

  @graphical-internet

  emacs

  kexec-tools

  device-mapper-multipath

  xorg-x11-utils

  xorg-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.conf

  rpm -ivh ftp://rha-server/rha/autoupdate/rha-base*.rpm

  #rpm -Fvh ftp://Kickstart.example.com/pub/9/i386/updates/*.rpm

  #curl https://rha-server/rha/xorg.conf 》 /etc/X11/xorg.conf

  #curl https://rha-server/rha/station.cfg | tar xvzf -

  for i in elvis blondie prince madonna; do

  useradd $i

  echo redhat | passwd --stdin $i

  done

  Kickstart 腳本設(shè)計(jì)

  Kickstart 腳本通常有三個(gè)不同的部分。

 。   命令部分

 。   軟件包部分

  :   安裝后腳本部分

  Anaconda 會(huì)忽略Kickstart 腳本中所有以“#”開(kāi)始的行和空行。

  命令部分

  從文件的最開(kāi)始直到出現(xiàn)以%packages 開(kāi)始的行,這一部分都屬于命令部分。命令行必須以可識(shí)別的關(guān)鍵字開(kāi)始,并且所有與該關(guān)鍵字有關(guān)的參數(shù)都必須出現(xiàn)在同一行中。命令部分是用來(lái)指定安裝程序需要的除軟件選項(xiàng)外的所有標(biāo)準(zhǔn)信息。關(guān)鍵字在命令部分可以以任意次序出現(xiàn)。

  軟件包部分(%packages)

  軟件包部分是用來(lái)指定需要安裝的軟件。這部分從以%packages 開(kāi)頭的行開(kāi)始,直到下

  一個(gè)以“%”字符開(kāi)始的行為止。這一部分通常采用以下兩種格式之一。

 。   @Component Name

 。   package-name

  第一種格式是用軟件組來(lái)指定軟件,在這里一定要注意正確拼寫(xiě)軟件組名稱,并注意大小寫(xiě)。

  第二種格式是用來(lái)指定要安裝的軟件包的具體名稱。如果%packages 行包含額外的--resolvedeps 參數(shù),那么也會(huì)安裝解決相依性的軟件包。

  安裝后腳本部分(%post)

  后處理部分是在沒(méi)有 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ò)配置。

  上面就是kickstart腳本配置的方法介紹了,可以知道,kickstart腳本主要分為三個(gè)部分,需要對(duì)命令、軟件包、安裝后腳本這三個(gè)部分進(jìn)行處理。

標(biāo)簽 腳本

發(fā)表評(píng)論

0

沒(méi)有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見(jiàn)解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門(mén)教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄