Kickstart+NFS+DHCP+TFTP+PXElinux实现CentOS的网络自动安装推荐

/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=640×480

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-${d}]

Name=diege ${d}

baseurl=http://192.168.1.100/download/networkyum/

enabled=1

gpgcheck=0

EOF

Done

2:配置启动介质

# cp /misc/cd/images/pxeboot/vmlinuz /tftpboot/

# cp /misc/cd/images/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秒未做选择 自动安装

我知道按攻略去旅行的人往往玩得过于按步就班,

Kickstart+NFS+DHCP+TFTP+PXElinux实现CentOS的网络自动安装推荐

相关文章:

你感兴趣的文章:

标签云: