【松溪】部署Linux系統的網路自動安裝

idba發表於2008-07-09

部署比較簡單,開啟如下服務( dhcpd,tftp,nfs,portmap ) 再修改幾個配置檔案就可以;

一, 開啟dhcp服務
修改/etc/dhcpd.conf 檔案,修改網路ip資訊就可以,然後重啟dhcpd服務;
#ddns-update-style. interim;
ddns-update-style. ad-hoc;
ignore client-updates;
allow booting;
allow bootp;
option nis-domain "domain.org";
#option domain-name "pxeserver";
option time-offset -18000; # Eastern Standard Time
default-lease-time 1000;
max-lease-time 1600;

subnet 10.9.200.0 netmask 255.255.255.0 {
option routers 10.9.200.247;
option subnet-mask 255.255.255.0;
option domain-name-servers 111.0.25.132;

range dynamic-bootp 10.9.200.201 10.9.200.211;

filename "linux-install/pxelinux.0";
}
二, 開啟tftp服務

開啟服務的命令: chkconfig xinetd on , chkconfig tftp on
修改/tftpboot/linux-install/pxelinux.cfg/default 檔案;
解釋:dba_rhel4u5_x86_64 是配置名稱
解釋:label dba_rhel4u5_x86_64 是配置具體內容
解釋:kernel rhel4-u5-x86_64/vmlinuz 是指/tftpboot/linux-install/rhel4-u5-x86_64/vmlinuz
解釋:rhel4-u5-x86_64/initrd.img 是指/tftpboot/linux-install/rhel4-u5-x86_64/initrd.img
解釋:/home/os/rhel4-u5-x86_64/ks.cfg.dba 編輯kickstart檔案; 預設口令是 hello123

default dba_rhel4u5_x86_64
prompt 1
timeout 30
display msgs/boot.msg
F1 msgs/boot.msg
F2 msgs/general.msg
F3 msgs/expert.msg
F4 msgs/param.msg
F5 msgs/rescue.msg
F7 msgs/snake.msg

label dba_rhel4u5_x86_64
kernel rhel4-u5-x86_64/vmlinuz
append ks=nfs:10.9.200.151:/home/os/rhel4-u5-x86_64/ks.cfg.dba ksdevice=eth0 initrd=rhel4-u5-x86_64/initrd.img devfs=nomount ramdisk_size=16384 nofb
Kickstart檔案如下:
cat /home/os/rhel4-u5-x86_64/ks.cfg.dba
# ks.cfg.app
# kickstart file for search server
#Generated by Kickstart Configurator

#System language
lang en_US
#Language modules to install
langsupport zh_CN.GB18030 --default=en_US
#System keyboard
keyboard us
#System mouse
mouse generic3ps/2
#Sytem timezone
timezone Asia/Shanghai
#Root password
rootpw --iscrypted $1$UHlWseBT$Bbyz7d/cVx5Is2ojBKWVO/
#Reboot after installation
reboot
#Install Red Hat Linux instead of upgrade
install
#Use NFS installation Media
nfs --server=10.9.68.250 --dir=/home/os/rhel4-u5-x86_64
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr yes
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype ext3 --size 128 --asprimary --ondisk cciss/c0d0
part swap --size 16384 --asprimary --ondisk cciss/c0d0
part / --fstype ext3 --size 1 --grow --ondisk cciss/c0d0
part /u01 --fstype ext3 --size 1 --grow --ondisk cciss/c0d1
#System authorization infomation
auth --useshadow --enablemd5
#Network information
network --bootproto=dhcp --device=eth0
#Firewall configuration
firewall --disabled
selinux --disabled
#Do not configure XWindows
skipx
#Package install information
%packages --resolvedeps
@ everything
#%pre
#mkdir /mnt/temp-pre
#mount -o nolock 10.9.19.222:/opt/iso/rhel4-u4 /mnt/temp-pre
#open -s -w -- /mnt/temp/preinst.sh
#umount /mnt/temp-pre

#%post
#umount /mnt/temp
三,開啟nfs,portmap 兩個服務,用chkconfig命令;
編輯 /etc/exports 新增一行記錄;
/home/os *(ro,sync)

四, 安裝檔案與Kickstart檔案
find /home/os
/home/os
/home/os/rhel4-u5-x86_64
/home/os/rhel4-u5-x86_64/RHEL4-U5-x86_64-AS-disc4.iso
/home/os/rhel4-u5-x86_64/RHEL4-U5-x86_64-AS-disc1.iso
/home/os/rhel4-u5-x86_64/md5.txt
/home/os/rhel4-u5-x86_64/RHEL4-U5-x86_64-AS-disc5.iso
/home/os/rhel4-u5-x86_64/RHEL4-U5-x86_64-AS-disc3.iso
/home/os/rhel4-u5-x86_64/RHEL4-U5-x86_64-AS-disc2.iso
/home/os/rhel4-u5-x86_64/ks.cfg.dba

完成以上步驟就完成了在本地網段通過網路自動安裝linux系統的配置; 啟動hp伺服器,按 F12 選擇網路啟動就可以;

五, 附錄(hp ilo 遠端控制卡的使用)
ilo 遠端控制卡預設都是配置了admin使用者 口令是:xx
ilo 的預設ip地址都是 相應網段的 xxx.xxx.0.xxx; 例如: 10.9.68.125 的遠端控制卡ip就是 10.9.0.125;
在windows的ie介面輸入ip地址就能開啟介面;

http://rdc.taobao.com/blog/dba/html/185_%e9%83%a8%e7%bd%b2linux%e7%b3%bb%e7%bb%9f%e7%9a%84%e7%bd%91%e7%bb%9c%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85.html/trackback

<!--

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/1384/viewspace-374819/,如需轉載,請註明出處,否則將追究法律責任。

相關文章