PXE是intel公司开发的网络引导技术,工作在client/Server模式,允许客户机通过网络远程服务器下载引导镜像,并加载安装文件或整个操作系统。
准备rhel6安装文件: 1
2
3
4
5
6
| [iyunv@red-hat6-server ~]# mount /dev/cdrom /media/
[iyunv@red-hat6-server yum.repos.d]# rpm -ivh /media/Server/Packages/vsftpd-2.2.2-6.el6.i686.rpm
[iyunv@red-hat6-server ~]# service vsftpd start
为 vsftpd 启动 vsftpd: [确定]
[iyunv@red-hat6-server ~]# mkdir /var/ftp/rhel6
[iyunv@red-hat6-server ~]# cp -rf /media/* /var/ftp/rhel6/
|
制作本地yum: 1
2
3
4
5
6
7
8
| [iyunv@red-hat6-server ~]# cd /etc/yum.repos.d/
[iyunv@red-hat6-server yum.repos.d]# rm -rf ./*
[iyunv@red-hat6-server yum.repos.d]# cat local.repo
[local]
name=red hat
baseurl=ftp://192.168.150.1/rhel6
enabled=1
gpgcheck=0
|
安装tftp 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
| [iyunv@red-hat6-server ~]# yum install tftp-server -y
configuration:
[iyunv@red-hat6-server ~]# vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}
[iyunv@red-hat6-server ~]# cd /media/images/pxeboot/
[iyunv@red-hat6-server pxeboot]# cp vmlinuz initrd.img /var/lib/tftpboot/
|
准备pxe引导程序,启动菜单文件 1
2
3
4
| [iyunv@red-hat6-server pxeboot]# yum install -y syslinux
[iyunv@red-hat6-server pxeboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[iyunv@red-hat6-server pxeboot]# cd /var/lib/tftpboot/
[iyunv@red-hat6-server tftpboot]# mkdir pxelinux.cfg
|
安装并启用dhcp服务 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| yum install -y dhcp
[iyunv@red-hat6-server ~]# cat /etc/dhcp/dhcpd.conf
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.150.0 netmask 255.255.255.0 {
range 192.168.150.10 192.168.150.100;
option domain-name-servers ns1.internal.example.org;
option domain-name "internal.example.org";
option routers 192.168.150.1;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.150.1;
filename "pxelinux.0";
}
|
安装kickstart 1
| [iyunv@red-hat6-server tftpboot]# yum install system-config-kickstart
|
打开kikstart:
配置安装参数: .基本配置
安装方法:
分区信息:
软件包选择,这里如果出错,查看/etc/yum.repo.d下除了刚才配置的本地源外还有没有其他repo文件,如果有就删掉。
保存退出,保存到 /var/ftp/rhel6/ks.cfg
配置TFTP: 1
2
3
4
5
6
| [iyunv@red-hat6-server ~]# cat /var/lib/tftpboot/pxelinux.cfg/default
default auto
prompt 0
label auto
kernel vmlinuz
append ks=ftp://192.168.150.1/rhel6/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=8129
|
验证是否自动安装:
1.修改需要安装系统的主机BIOS,改为”Network boot from Intel E10000”PXE引导启动。
2.主机申请DHCP地址
实现自动安装,安装完成以后记得把BIOS修改回正常的硬盘引导启动
|