ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

PXE远程服务安装

2020-12-10 18:33:14  阅读:230  来源: 互联网

标签:安装 systemctl xinetd localhost dhcpd yum root 远程 PXE


1、PXE:允许客户机通过网络从远程服务器下载引导镜像,并加载安装文件或者整个操作系统
PXE的有点:规模化,自动化,远程实现
2、PXE的安装和实现:
1)、安装并启用TFTP服务:
TFTP是一个基于UDP协议实现的,用于在客户机和服务器之间进行简单文件传输的协议,适合于小文件传输应用。 TFTP服务默认由xinetd服务进行管理,使用UDP端口:69
[root@localhost ~]# yum -y install xinetd.x86_64
[root@localhost ~]# yum install -y tftp-server.x86_64
安装完成后查看文件是否生成:
[root@localhost ~]# cd /etc/
[root@localhost etc]# cd xinetd.d/
[root@localhost xinetd.d]# ls
chargen-dgram daytime-dgram discard-dgram echo-dgram tcpmux-server time-dgram
chargen-stream daytime-stream discard-stream echo-stream tftp time-stream

[root@localhost xinetd.d]# vim tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes #同时安装多,改成no
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
启用服务:
[root@localhost xinetd.d]# systemctl start tftp
[root@localhost xinetd.d]# systemctl start xinetd.service
开机自启动:
[root@localhost xinetd.d]# systemctl enable tftp
Created symlink from /etc/systemd/system/sockets.target.wants/tftp.socket to /usr/lib/systemd/system/tftp.socket.
[root@localhost xinetd.d]# systemctl enable xinetd.service

2)、安装DHCP
[root@localhost yum.repos.d]# yum -y install dhcp.x86_64
3)、修改DHCP服务的配置文件:
[root@localhost dhcp-4.2.5]# cp -p dhcpd.conf.example /etc/dhcp/dhcpd.conf
cp: overwrite ‘/etc/dhcp/dhcpd.conf’? yes
[root@localhost dhcp]# vim dhcpd.conf

default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
next-server 192.168.233.129;
filename “pxelinux.0”

subnet 192.168.233.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.233.100 192.168.233.200;
option broadcast-address 192.168.233.129;
}
设置开机自启动:
[root@localhost dhcp]# systemctl start dhcpd
Job for dhcpd.service failed because the control process exited with error code. See “systemctl status dhcpd.service” and “journalctl -xe” for details.
[root@localhost dhcp]# systemctl enable dhcpd
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
4)、准备linux文件内核、初始化镜像文件:
root@localhost dhcp]# cd /mnt/
[root@localhost mnt]# cd images/
[root@localhost images]# cd pxeboot/
[root@localhost pxeboot]# ls
initrd.img TRANS.TBL vmlinuz
[root@localhost pxeboot]# cp -p vmlinuz /var/lib/tftpboot/ #复制linux内核文件到TFTP的目录下
[root@localhost pxeboot]# cp initrd.img /var/lib/tftpboot/ #复制初始化镜像文件到TFTP根目录下
5)、准备PXE引导程序:
[root@localhost /]# yum install -y syslinux #PXE的引导程序包由syslinux提供

[root@localhost syslinux]# cp pxelinux.0 /var/lib/tftpboot/ # 复制PXE引导程序到TFTP的根目录下
6)、安装FTP服务,准备centos 7的安装源:
[root@localhost yum.repos.d]# yum install -y vsftpd
[root@localhost yum.repos.d]# cp -rf /mnt/* /var/ftp/centos7/
启动FTP服务:
[root@localhost yum.repos.d]# systemctl start vsftpd
[root@localhost yum.repos.d]# systemctl enable vsftpd
7)、配置启动菜单文件:
[root@localhost pxelinux.cfg]# vim default

default auto #指定默认入口名称
prompt 1 #设置是否等待用户选择,1表示等待用户控制

label auto #图像安装引导入口
kernel vmlinuz #定义引导参数
append initrd=initrd.img method=ftp://192.168.233.129/centos7

label linux text #文本安装的引导入口
kernel vmlinuz
append text initrd=initrd.img method=ftp://192.168.233.129/centos7

label linux rescue #救援模式的引导入口
kernel vmlinuz
append rescue initrd=initrd.img method=ftp://192.168.233.129/centos7
关闭防火墙,验证PXE网络安装

标签:安装,systemctl,xinetd,localhost,dhcpd,yum,root,远程,PXE
来源: https://blog.csdn.net/weixin_42601148/article/details/110956275

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有