Kickstart+NFS+DHCP+TFTP+PXElinux实现CentOS的网络自动安装
作者:diege
時間:2012-05-02
第三次整理
一:準備工作
1:安裝centos系統,配置好網絡
二:安裝各軟件
1:配置yum
2:安裝kickstart
# yum -y install system-config-kickstart.noarch
3:安裝配置nfs
#yum -y install nfs-utils
# vim /etc/exports
/misc/cd 192.168.1.0/24(rw,no_root_squash)
/kickstart 192.168.1.0/24(rw,no_root_squash)
# exportfs -av
4:安裝配置dhcp
# yum –y install dhcp
#cp /usr/share/doc/dhcp*/dhcpd.conf.sample? /etc/dhcpd.conf
#vim ?/etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {
??????? option routers????????????????? 192.168.1.1;
??????? option subnet-mask????????????? 255.255.255.0;
??????? option domain-name????????????? "domain.org";
??????? option domain-name-servers????? 192.168.1.1;
??????? option time-offset????????????? -18000; # Eastern Standard Time
??????? range dynamic-bootp 192.168.1.150 192.168.1.199;
??????? default-lease-time 21600;
??????? max-lease-time 43200;
??????? next-server 192.168.1.100; #TFTPServer的IP
??????? filename "/pxelinux.0"; ?#pxelinux loader文件位置
}
#chkconfig dhcpd on
#etc/init.d/dhcpd start
?
5:安裝TFTP
# yum ?-y install tftp-server.i386
啟動tftp服務
# chkconfig xinetd on
#/etc/init.d/xinetd start
#chkconfig? tftp on
# chkconfig --list|grep tftp
??????? tftp:?????????? on??????????????????????????????????????
三:配置
1:生存kickstart配置文件
在x-downs下
# system-config-kickstart
配置
# mkdir /kickstart
# mv ks.cfg /kickstart/ks.cfg
# vim /kickstart/ks.cfg
install
# Installation logging level
logging --level=info
# Use NFS installation media
nfs --server=192.168.1.100 --dir=/misc/cd
lang en_US.UTF-8
keyboard us
#xconfig? --defaultdesktop=GNOME --depth=8 --resolution=640x480
xconfig --startxonboot
#network --device eth0 --bootproto dhcp --hostname centosa.localdomain
network --device eth1 --bootproto static --ip 192.168.1.140 --netmask 255.255.255.0 --hostname centosc.localdomain
#network --bootproto=dhcp --device=eth1 --onboot=on
rootpw --iscrypted $1$SVp5Dkda$/OPOyjn4hYyKk68IW08Y1.
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Asia/Shanghai
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
# not guaranteed to work
clearpart --none
part /boot --fstype ext3 --size=100 --ondisk=sda
part pv.2 --size=0 --grow --ondisk=sda
volgroup VolGroup00 --pesize=32768 pv.2
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024
%packages
@admin-tools
@base
@core
@development-libs
@development-tools
@dialup
@editors
@gnome-desktop
@games
@graphical-internet
@graphics
@office
@printing
@sound-and-video
@system-tools
@text-internet
@base-x
keyutils
kexec-tools
iscsi-initiator-utils
trousers
fipscheck
device-mapper-multipath
python-imaging
imake
java-1.6.0-openjdk
libsane-hpaio
festival
audit
xorg-x11-server-Xnest
xorg-x11-server-Xvfb
%post
#setup yumn repository
YUM_REPOS_FILE=/etc/yum.repos.d/centos.repo
for d in Cluster ClusterStorage Server VT ;do
cat<<EOF>>${YUM_REPOS_FILE}
[diege-$ze8trgl8bvbq]
Name=diege $ze8trgl8bvbq
baseurl=http://192.168.1.100/download/networkyum/
enabled=1
gpgcheck=0
EOF
Done
2:配置啟動介質
# cp /misc/cd/p_w_picpaths/pxeboot/vmlinuz /tftpboot/
# cp /misc/cd/p_w_picpaths/pxeboot/initrd.img /tftpboot/
find / -name pxelinux.0
/usr/lib/syslinux/pxelinux.0
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
# mkdir /tftpboot/pxelinux.cfg
# cp /misc/cd/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
#vim /tftpboot/pxelinux.cfg/default
default autoinstall
prompt 1
timeout 10
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
? kernel vmlinuz
? append initrd=initrd.img
label text
? kernel vmlinuz
? append initrd=initrd.img text
label ks
? kernel vmlinuz
? append ks initrd=initrd.img
label local
? localboot 1
label memtest86
? kernel memtest
? append –
label autoinstall
? kernel vmlinuz
? append ks=nfs:192.168.1.100:/kickstart/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=9216 nofb
四、Client安裝CentOS
Client從網卡啟動,默認30秒未做選擇 自動安裝
轉載于:https://blog.51cto.com/ipseek/851051
總結
以上是生活随笔為你收集整理的Kickstart+NFS+DHCP+TFTP+PXElinux实现CentOS的网络自动安装的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: suibi
- 下一篇: 几种Lucene.Net打开IndexR
