linux利用pxe实现自动装机

来源:互联网 发布:蓝牙音响 知乎 编辑:程序博客网 时间:2024/04/30 13:10

需要安装的服务:
need packages:
system-config-kickstart ##自动应答脚本制作工具
syslinux ##获得pxelinux.0文件安装包
dhcp ##分配ip给客户机的服务
tftp-server ##提供tftp协议的服务
httpd ##安装源共享服务

配置dhcp配置文件

vim /etc/dhcpd/dhcpd.conf like this:

option domain-name “example.com”; ##域名
option domain-name-servers 192.168.0.79; ##dns
default-lease-time 600; ##默认租约期
max-lease-time 7200; ##最长租约期
log-facility local7; ##日志级别
subnet 192.168.0.0 netmask 255.255.255.0 { ##网段,子网掩
range 192.168.0.102 192.168.0.111; ##地址范围
option routers 192.168.0.254; ##网关
filename “pxelinux.0”; ##pxe启动程序
next-server 192.168.0.79; ##tftp主机地址
}

systemctl restart dhcpdsystemctl stop firewalld

这里写图片描述

这里写图片描述

这里写图片描述
No.2 SED CONFIG TFTP
config /etc/xinetd.d/tftp like this:
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
}
systemctl restart xinetd

No.3 TRD MAKE SOME FILES AND PXEWORKDIRECTORY
1)

cd /var/lib/tftpboot/mkdir pxelinux.cfg

2)

mount the iso of the rhel7cp isolinux/* /var/lib/tftpboot

这里写图片描述

3)

cp /var/lib/tftpboot/isolinux.cfg   /var/lib/tftpboot/pxelinux.cfg/defaultcp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/4)

make a userfully install source and kickstart,my of this is in the ftp’s pub
ftp://192.168.0.252/pub/rhel6
ftp://192.168.0.252/pub/ks.cfg
5)

vim /var/lib/tftpboot/pxelinux.cfg/default like this:

搭建pxe环境:

cp /var/www/html/rhel7.2/isolinux/* /var/lib/tftpboot/cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/mkdir /var/lib/tftpboot/pxelinux.cfgcp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default[root@server tftpboot]# lsboot.cat  grub.conf   isolinux.bin  memtest     pxelinux.cfg  TRANS.TBL    vesamenu.c32boot.msg  initrd.img  isolinux.cfg  pxelinux.0  splash.png    upgrade.img  vmlinuz

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

原创粉丝点击