搭建环境:
推送服务器:
Ip:192.168.189.138
系统:CentOS 5.8
推送系统:RHEL 5.4
1:配置dhcpd服务。
如果没有安装dhcpd服务,请安装:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
| # yum -y install dhcp.x86_64
# vi /etc/dhcpd.conf
option domain-name "766.com";
default-lease-time 6000;
max-lease-time 11400;
authourtative;
next-server 192.168.189.138;
ddns-update-style ad-hoc;
log-facility local7;
subnet 192.168.189.0 netmask 255.255.255.0{
range 192.168.189.150 192.168.189.195;
option domain-name-servers 192.168.189.254;
option domain-name "766.com";
option netbios-name-servers 192.168.189.254;
option routers 192.168.189.254;
option broadcast-address 192.168.189.255;
default-lease-time 6000;
max-lease-time 11400;
filename "/kickstart/ks.cfg";
}
option space PXE;
class "PXE" {
match if substring(optionvendor-class-identifier, 0, 9) = "PXEClient";
optionvendor-encapsulated-options 01:04:00:00:00:00:ff;
option boot-size 0x1;
filename"pxelinux.0";
option tftp-server-name "192.168.189.138";
option vendor-class-identifier"PXEClient";
vendor-option-space PXE;
}
|
2:开启tftp服务:
如果没有tftp服务软件,请安装:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| # yum -y installtftp.x86_64
# yum -y installxinetd.x86_64
# yum -y installtftp-server.x86_64
配置tftp
# vi/etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
|
3:准备推送所需的文件与目录。
把光盘或iso文件中的isolinux目录下的文件,拷贝到/tftpboot。
把pxelinux.0文件拷贝到/tftpboot:
1
| # cp /usr/lib/syslinux/pxelinux.0 /tftpboot
|
创建RHEL5.4目录,把initrd.img、vmlinuz两个文件拷贝进去:
1
2
3
| # mkdir -p /tftpboot/RHEL5.4
# mv /tftpboot/initrd.img /tftpboot/RHEL5.4
# mv /tftpboot/vmlinuz /tftpboot/RHEL5.4
|
创建pxelinux.cfg目录,把isolinux.cfg文件拷贝进去,并改名default:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| # mv isolinux.cfg pxelinux.cfg/default
修改default文件参数
# vi /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label RHEL5.4
kernel RHEL5.4/vmlinuz
append ksdevice=eth0 load_ramdisk=1 initrd=RHEL5.4/initrd.img noipv6
|
配置boot.msg,添加加载选项:
1
2
| # vi /tftpboot/boot.msg
Install RHEL5.4 ---> RHEL5.4
|
4:提供安装镜像或者内容,这里使用nfs方式。
把光盘镜像或内容拷贝到/home/redhat下。
使用nfs方式,把/home/redhat共享给192.168.189.0/24网段:
1
2
| # vi/etc/exports
/home/redhat 192.168.189.0/24(rw,async,no_root_squash)
|
5:启动各个所需服务,并测试安装。
1
2
3
| # service dhcpd start
# service xinetd start
# service nfs start
|
启动计算机,F12,选择从网卡启动,正常的话则可进入安装引导界面: 写入RHEL5.4,进入安装。 选择安装介质获取方式,选择nfs: 填写服务器ip与介质路径: 进入图形安装界面,说明可以安装了:
============================================================================================================= 使用ks文件实现全自动安装: 使用system-config-kickstart创建ks文件模版(system-config-kickstart无法创建LVM,若要使用LVM,许在生成ks文件后,手动编辑) LVM配置: 1
2
3
| partpv.01 --size=10000 --grow
volgroupvg-001 pv.01
logvol/ --vgname=vg-001 --size=10000 --name=lv-001
|
ks文件中指定了键盘,语言,安装方式,分区等配置。 配置default文件,指定ks文件路径(可用nfs,ftp等方式): 1
| append ksdevice=eth0 load_ramdisk=1 initrd=RHEL5.4/initrd.img ks=nfs:192.168.189.138:/home/redhat/ks.cfg noipv6
|
启动客户端,测试自动安装。
|