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

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

如何配置Kickstart腳本

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

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

 如何配置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 腳本設計

  Kickstart 腳本通常有三個不同的部分。

  :   命令部分

 。   軟件包部分

 。   安裝后腳本部分

  Anaconda 會忽略Kickstart 腳本中所有以“#”開始的行和空行。

  命令部分

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

  軟件包部分(%packages)

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

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

 。   @Component Name

  :   package-name

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

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

  安裝后腳本部分(%post)

  后處理部分是在沒有 Anaconda 安裝程序參與下,執(zhí)行所有新安裝系統(tǒng)的機器的自定義過程。執(zhí)行這部分內(nèi)容與在新安裝系統(tǒng)的機器的環(huán)境下運行 Bash Shell 腳本的效果是一樣的。如果是網(wǎng)絡安裝,那么執(zhí)行前面提到作為實例的腳本也可以激活網(wǎng)絡配置。

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

標簽 腳本

發(fā)表評論

0

沒有更多評論了

評論就這些咯,讓大家也知道你的獨特見解

立即評論

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

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

掃碼關注
掃碼關注

掃碼關注 官方交流群 軟件收錄