天天看点

linux-pxe

PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过网络从远端服务器下载映像,并由此支持通过网络启动操作系统,在启动过程中,终端要求服务器分配IP地址,再用TFTP(trivial file transfer protocol)或MTFTP(multicast trivial file transfer protocol)协议下载一个启动软件包到本机内存中执行,由这个启动软件包完成终端(客户端)基本软件设置,从而引导预先安装在服务器中的终端操作系统。PXE可以引导多种操作系统,如:Windows95/98/2000/windows2003/windows2008/winXP/win7/win8,linux系列系统等。

实现自动安装 (网卡启动)

(服务端)

[root@server ~]# yum install httpd dhcp tftp-server syslinux -y  安装服务

[root@server ~]# rpm -ql tftp-server    查看tftp-server服务的配置文件

(12主机)

[root@foundation12 rhel7.0]# cp  -rp isolinux /lh  将isolinux复制到/lh

[root@foundation12 ~]# cp -rp /lh /var/ftp  把/lh加到vsftpd的默认发布目录里 

(服务器)

如下将12主机的isolinux 下载到服务器上

vim /etc/xinetd.d/tftp 编辑文件

disable    =no  yes改为no

netstat -antlupe | grep 69  查看69端口是否开启

[root@server tftpboot]# mkdir pxelinux.cfg  建立目录

[root@server tftpboot]# cp isolinux.cfg pxelinux.cfg/default  复制

[root@server tftpboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ 复制

[root@server tftpboot]# systemctl restart xinetd.service  重启服务

[root@server tftpboot]# systemctl start httpd  开启http服务

[root@server tftpboot]# systemctl stop firewalld  关闭火墙

[root@server tftpboot]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf 

[root@server tftpboot]# vim /etc/dhcp/dhcpd.conf  编辑配置文件

[root@server tftpboot]# systemctl restart dhcpd

测试:测试:拔掉网线 关掉真机的dhcp

调为网卡启动

[root@server tftpboot]# vim pxelinux.cfg/default  编辑文件 更改图片,更改标题

效果如下:

实现自动安装

[root@server ~]# yum install system-config-kickstart -y  安装服务

[root@server ~]# system-config-kickstart  调用图形

在图形界面进行勾选,最后保存(之前博客有详细过程)

[root@server ~]# cd /var/www/html/

[root@server html]# ls

ks.cfg

[root@server html]# vim ks.cfg  编辑此文件

[root@server html]# ksvalidator ks.cfg  检测语法

[root@server tftpboot]# vim pxelinux.cfg/default  编辑文件

[root@server tftpboot]# systemctl restart httpd   重启服务

[root@server tftpboot]# systemctl restart dhcpd 重启服务

测试:

 本文转自 huanzi2017 51CTO博客,原文链接:http://blog.51cto.com/13362895/2049714

继续阅读