Linux 基础 之 pxe 系统安装 (网线安装系统)

一、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系列系统等。

二、网线安装步骤

一、搭建dhcp环境

[root@localhost ~]# hostnamectl set-hostname pxe-server.westos.com

安装dhcp
[root@pxe-server ~]# yum install dhcp -y


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


[root@pxe-server ~]# vim /etc/dhcp/dhcpd.conf


option domain-name "westos.com";
option domain-name-servers 172.25.254.102;
subnet 172.25.254.0 netmask 255.255.255.0 {
  range 172.25.254.60  172.25.254.80;
  option routers 172.25.254.102;
}


[root@pxe-server ~]# systemctl restart dhcpd

二、配置读取引导文件

安装软件

[root@pxe-server ~]# yum install syslinux tftp-server -y


[root@pxe-server ~]# cp /usr/share/syslinux/pxelinux.0  /var/lib/tftpboot/


[root@pxe-server ~]# vim /etc/xinetd.d/tftp



[root@pxe-server ~]# chkconfig --list

[root@pxe-server ~]# systemctl restart xinetd.service

[root@pxe-server ~]# vim /etc/dhcp/dhcpd.conf


  next-server 172.25.254.102;
  filename "pxelinux.0";


[root@pxe-server ~]# systemctl restart dhcpd.service



三、配置界面

[root@pxe-server ~]# cd /var/lib/tftpboot/
[root@pxe-server tftpboot]# ls
pxelinux.0
[root@pxe-server tftpboot]# mkdir pxelinux.cfg
[root@pxe-server tftpboot]# ls
pxelinux.0  pxelinux.cfg
[root@pxe-server tftpboot]# cd pxelinux.cfg/

[root@pxe-server pxelinux.cfg]# ls
isolinux.cfg
[root@pxe-server pxelinux.cfg]# mv isolinux.cfg default
[root@pxe-server pxelinux.cfg]# ls
default


[root@pxe-server pxelinux.cfg]# cd ..
[root@pxe-server tftpboot]# ls
pxelinux.0  pxelinux.cfg
[root@pxe-server tftpboot]# pwd
/var/lib/tftpboot

[root@pxe-server tftpboot]# ls

编辑配置文件修改 时间  标题

[root@pxe-server tftpboot]# vim pxelinux.cfg/default


[root@pxe-server tftpboot]# systemctl start dhcpd
[root@pxe-server tftpboot]# systemctl status dhcpd


四、配置进行自动安装

[root@pxe-server tftpboot]# cd pxelinux.cfg/
[root@pxe-server pxelinux.cfg]# ls
default
[root@pxe-server pxelinux.cfg]# vim default
 2 timeout 100
61 label linux
 62   menu label AUTOMAC INSTALL linux
 63   menu default
 64   kernel vmlinuz
 65   append initrd=initrd.img repo=http://172.25.254.3/test  ks= http://172.25.254.102/ks.cfg

[root@pxe-server ~]# yum install httpd -y  安装http


[root@pxe-server ~]# yum install system-config-kickstart.noarch
[root@pxe-server ~]# systemctl start httpd


[root@pxe-server ~]# system-config-kickstart


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

[root@pxe-server html]# vim ks.cfg

写入:
timezone Asia/Shanghai


%packages
@base
@core
@fonts
@gnome-desktop
@input-methods
@x11
vnc
lftp
%end

%post
cat > /etc/yum.repos.d/yum.repo <<EOF
[rhel7.3]
name=rhel7.3
baseurl=http://172.25.254.3/test
gpgcheck=0
EOF
%end

[root@pxe-server html]# ksvalidator ks.cfg


[root@pxe-server html]# systemctl restart xinetd.service
[root@pxe-server html]# systemctl restart dhcpd.service


 

五、测试:建立虚拟机网络引导 开启自动安装虚拟机

猜你喜欢

转载自blog.csdn.net/excellent_L/article/details/84958865