没有合适的资源?快使用搜索试试~ 我知道了~
首页Linux系统pxe网络安装方式之kickstart安装
资源详情
资源评论
资源推荐

IBM Alex Lin(林彥明)
1
Enterprise Linux 實戰講座
kickstart 自動安裝 Linux
前言:
很多時候,我們希望能自動安裝 RedHat Linux , 例如電腦教室、Linux 叢
集系統,一次得安裝多台 Linux 的需求,如果一台一台利用光碟慢慢安裝,豈不
費時費力。為了滿足這種需求,Red Hat 發展出 kickstart 的安裝方式。 藉由使
用 kickstart,系統管理員只需建立一個自動安裝設定檔(ks.cfg),其中含有安裝
Red Hat Linux 所需回答的所有設定值,如此一來系統便會根據這個檔案來完成
安裝的工作。
ks.cfg 檔案可以存放在某台網路上的伺服器上,以讓欲安裝 Linux 的電腦
來讀取它。而且通常我們也會將 RedHat 光碟的內容複製至這台伺服器,並將
內容分享出來,如此利用 Kickstar 網路安裝的方式便可很快速地安裝多台
Linux,這系統管理員帶來很大的方便。
Instatllation Server
Kickstart 的安裝,安裝的來源可以是本機的光碟機、硬碟機或透過 NFS,
FTP 或 HTTP 來進行安裝,利用 NFS、FTP、HTTP 網路安裝的方式是較有效
率的,所以我們首先得先建置一台 Installation Server,就是將 4 片光碟的內容
複製至 Server 上並利用 NFS、FTP 或 HTTP 將其分享出來。通常 Installation
Server 會同時擔任 DHCP Server。所以在實作 kickstart 自動安裝之前我們得先
建置這台 Installation server。
實戰演練一:建置 Installation Server
測試環境:
RedHat Enterprise ES 3.0 版 (ip 設定為 192.168.0.254)
必須安裝以下套件:
nfs-utils*.rpm
vsftpd*.rpm
httpd*.rpm
dhcp*.rpm

IBM Alex Lin(林彥明)
2
1.將 RHEL ES 3.0 安裝所需 RPM 全部 copy 至 Server 上
放入第1~4片 CD 執行以下指令
#mount /mnt/cdrom
#cp –af /mnt/cdrom/RedHat /var/ftp/pub
重覆將 4 片內容全部 copy 至 Installation Server 上的/var/ftp/pub
# ln –s /var/ftp/pub /var/www/html/pub
將 /var/www/html/pub 指向 /var/ftp/pub
2.利用各種方式將安裝檔案分享出來
NFS 法
#vi /etc/exports 加入此行
/var/ftp/ftp
#service nfs start
FTP 法
#service vsftpd start
HTTP 法
# service httpd start
3.建立 DHCP server
#cp /usr/share/doc/dhcp-3.0pl2/dhcpd.conf.sample /etc/dhcpd.conf
# more /etc/dhcpd.conf 內容如下暫時不用修改
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
# --- default gateway
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.1.1;
option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well

IBM Alex Lin(林彥明)
3
# option netbios-node-type 2;
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
#service dhcpd restart
kickstart 自動安裝設定檔 (ks.cfg)
Kickstart 自動安裝設定檔 ks.cfg 是一個普通的文字檔案,其中含有安裝
Linux 所需的各項設定,例如語系、分割區的配置、root 的密碼、等各項安裝
時所需要的設定值。 Red Hat Linux 安裝程式也根據您在安裝過程中所選擇的
選項建立一個 ks.cfg 的參考範例, 該檔案會存放在 /root/anaconda-ks.cfg。
下面是筆者安裝 Installation Server 時系統所產生的 anaconda-ks.cfg,ip 為
「192.168.0.254」,主機名稱為「server.example.com」,套件選擇為「全部安
裝」。
# Kickstart file automatically generated by anaconda.
install
lang en_US.UTF-8
langsupport --default en_US.UTF-8 zh_TW.Big5 en_US.UTF-8
keyboard us
mouse genericwheelps/2 --device psaux
xconfig --card "ATI Mach64 3D Rage IIC" --videoram 4096 --hsync 31-60
--vsync 56-75 --resolution 1024x768 --depth 24 --startxonboot
--defaultdesktop gnome
network --device eth0 --bootproto static --ip 192.168.0.254 --netmask
255.255.255.0 --gateway 192.168.0.254 --nameserver 192.168.0.254
--hostname server.example.com
rootpw --iscrypted $1$HBU/aBDd$/LetXZ5O.Em6gkA4bl5ZS.
firewall --disabled
authconfig --enableshadow --enablemd5
timezone Asia/Taipei
bootloader --location=mbr
# 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

IBM Alex Lin(林彥明)
4
# not guaranteed to work
#clearpart –all
#part /boot --fstype ext3 --onpart hda1
#part / --fstype ext3 --onpart hda2
#part swap --onpart hda3
#part /home --fstype ext3 --onpart hda5
%packages
@ everything
kernel
grub
%post
ks.cfg 的語法稍後再做介紹,我們可以修改 /root/anaconda-ks.cfg 來產生符合
需求的 ks.cfg。不過可不是一件容易的事,筆者介紹另一個圖形工具「ksconfig」,
利用它來產生 ks.cfg
ksconfig 圖形工具
啟動 Kickstart 設定程式,請選擇主選單Î系統工具ÎKickstart。或直接在終端
視窗鍵入「ksconfig」,Kickstart 設定程式視窗畫面如圖 1。
剩余15页未读,继续阅读


















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0