您的位置:首页 > 理论基础 > 计算机网络

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

2012-05-03 11:58 1221 查看
作者:diege[/b]
时间:2012-05-02[/b]
第三次整理[/b]
一:准备工作[/b]
1:安装centos系统,配置好网络
二:安装各软件[/b]
1[/b]:配置yum[/b]
2[/b]:安装kickstart[/b]
# yum -y install system-config-kickstart.noarch
3[/b]:安装配置nfs[/b]
#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[/b]:安装配置dhc[/b]p
# 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:[/b]安装[/b]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
三:配置[/b]
1[/b]:生存kickstart[/b]配置文件[/b]
在x-downs[/b]下[/b]
# system-config-kickstart[/b]
配置[/b]
# mkdir /kickstart[/b]
# mv ks.cfg /kickstart/ks.cfg[/b]
# vim /kickstart/ks.cfg[/b]
install[/b]
# Installation logging level[/b]
logging --level=info[/b]
# Use NFS installation media[/b]
nfs --server=192.168.1.100 --dir=/misc/cd[/b]
lang en_US.UTF-8[/b]
keyboard us[/b]
#xconfig --defaultdesktop=GNOME --depth=8 --resolution=640x480[/b]
xconfig --startxonboot[/b]
#network --device eth0 --bootproto dhcp --hostname centosa.localdomain[/b]
network --device eth1 --bootproto static --ip 192.168.1.140 --netmask 255.255.255.0 --hostname centosc.localdomain[/b]
#network --bootproto=dhcp --device=eth1 --onboot=on[/b]
rootpw --iscrypted $1$SVp5Dkda$/OPOyjn4hYyKk68IW08Y1.[/b]
firewall --enabled --port=22:tcp[/b]
authconfig --enableshadow --enablemd5[/b]
selinux --enforcing[/b]
timezone --utc Asia/Shanghai[/b]
bootloader --location=mbr[/b]
# The following is the partition information you requested[/b]
# Note that any partitions you deleted are not expressed[/b]
# here so unless you clear all partitions first, this is[/b]
# not guaranteed to work[/b]
clearpart --none [/b]
part /boot --fstype ext3 --size=100 --ondisk=sda[/b]
part pv.2 --size=0 --grow --ondisk=sda[/b]
volgroup VolGroup00 --pesize=32768 pv.2[/b]
logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow[/b]
logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024[/b]
%packages[/b]
@admin-tools[/b]
@base[/b]
@core[/b]
@development-libs[/b]
@development-tools[/b]
@dialup[/b]
@editors[/b]
@gnome-desktop[/b]
@games[/b]
@graphical-internet[/b]
@graphics[/b]
@office[/b]
@printing[/b]
@sound-and-video[/b]
@system-tools[/b]
@text-internet[/b]
@base-x[/b]
keyutils[/b]
kexec-tools[/b]
iscsi-initiator-utils[/b]
trousers[/b]
fipscheck[/b]
device-mapper-multipath[/b]
python-imaging[/b]
imake[/b]
java-1.6.0-openjdk[/b]
libsane-hpaio[/b]
festival[/b]
audit[/b]
xorg-x11-server-Xnest[/b]
xorg-x11-server-Xvfb[/b]
%post[/b]
#setup yumn repository[/b]
YUM_REPOS_FILE=/etc/yum.repos.d/centos.repo[/b]
for d in Cluster ClusterStorage Server VT ;do[/b]
cat<<EOF>>${YUM_REPOS_FILE}[/b]
[diege-${d}][/b]
Name=diege ${d}[/b]
baseurl=http://192.168.1.100/download/networkyum/[/b]
enabled=1[/b]
gpgcheck=0[/b]
EOF[/b]
Done[/b]
2[/b]:配置启动介质[/b]
# cp /misc/cd/images/pxeboot/vmlinuz /tftpboot/ [/b]
# cp /misc/cd/images/pxeboot/initrd.img /tftpboot/[/b]
find / -name pxelinux.0[/b]
/usr/lib/syslinux/pxelinux.0[/b]
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/[/b]
# mkdir /tftpboot/pxelinux.cfg[/b]
# cp /misc/cd/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default[/b]
#vim /tftpboot/pxelinux.cfg/default[/b]
default autoinstall[/b]
prompt 1[/b]
timeout 10[/b]
display boot.msg[/b]
F1 boot.msg[/b]
F2 options.msg[/b]
F3 general.msg[/b]
F4 param.msg[/b]
F5 rescue.msg[/b]
label linux[/b]
kernel vmlinuz[/b]
append initrd=initrd.img[/b]
label text[/b]
kernel vmlinuz[/b]
append initrd=initrd.img text[/b]
label ks[/b]
kernel vmlinuz[/b]
append ks initrd=initrd.img[/b]
label local[/b]
localboot 1[/b]
label memtest86[/b]
kernel memtest[/b]
append –[/b]
label autoinstall [/b]
kernel vmlinuz [/b]
append ks=nfs:192.168.1.100:/kickstart/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=9216 nofb[/b]
四、Client[/b]安装CentOS[/b]
Client[/b]从网卡启动,默认30[/b]秒未做选择 [/b]自动安装[/b]本文出自 “diege” 博客,请务必保留此出处http://ipseek.blog.51cto.com/1041109/851051
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: