当前位置 : 主页 > 操作系统 > centos >

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

来源:互联网 收集:自由互联 发布时间:2022-06-21
Normal07.8 磅02falsefalsefalseEN-USZH-CNX-NONE/* Style Definitions */table.MsoNormalTable{mso-style-name:普通表格;mso-tstyle-rowband-size:0;mso-tstyle-colband-size:0;mso-style-noshow:yes;mso-style-priority:99;mso-style-parent:"";mso-pa

Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:普通表格; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.5pt; mso-bidi-font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi; mso-font-kerning:1.0pt;}

作者: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; #TFTPServerIP

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

Name=diege ${d}

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秒未做选择 自动安装

上一篇:linux-shell面试题
下一篇:没有了
网友评论