PXE 网络化安装Linux系统——原理+步骤


PXE 网络化安装Linux系统配置方法网上实在实在是很多,如果要更详细的,大家可以直接到网上找,我不会在这里写的非常详细,不会step by step的讲述,最重要的是要知道实现原理!相信看了我下面的原理讲解,能对你们看相关文档带来更大的帮助,因为真的有很多人在对着文档做的时候更本不知道自己在做什么!

流程化实现原理:

支持PXE的电脑开机(预先打开网卡PXE功能,网络引导)---> DHCP给该电脑一个IP地址,并指明下一跳tftp文件服务器 ---> 电脑去tftp服务器上(/tftpboot 文件夹下面)下载到一个叫做 pxelinux.0的文件,并拿到pxelinux.cfg文件夹下的default配置文件 ---> 根据该配置文件加载内核等操作,www.britepic.org同时该配置文件中可以指明ks.cfg文件的地址,这样实现全程无人化安装!
基本实现步骤:

1.DHCP服务器配置
[root@localhost ~]# cat /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.1.0 netmask 255.255.255.0 {# --- default gateway
option routers                  192.168.1.1;
option subnet-mask              255.255.255.0;#       option nis-domain               "domain.org";
#       option domain-name              "domain.org";
option domain-name-servers      192.168.1.1;        option time-offset              -18000; # Eastern Standard Time
#       option ntp-servers              192.168.1.1;
#       option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#       option netbios-node-type 2;        range dynamic-bootp 192.168.1.2 192.168.1.10;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.1.112;
filename "pxelinux.0";
# we want the nameserver to appear at a fixed address
#       host ns {
#               next-server marvin.RedHat.com;
#               hardware ethernet 12:34:56:78:AB:CD;
#               fixed-address 207.175.42.254;
#       }
}

2.tftp服务器配置

[root@localhost ~]# cat /etc/xinetd.d/tftp
# default: off
# de.ion: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
socket_type             = dgram
protocol                = udp
wait                    = yes
user                    = root
server                  = /usr/sbin/in.tftpd
server_args             = -s /tftpboot
disable                 = no
per_source              = 11
cps                     = 100 2
flags                   = IPv4
}

3.准备相关文件

安装目录树,ks.cfg,initrd.img,pxelinux.0,pxelinux.cfg,vmlinuzA--把安装目录树拷贝到一个共享目录中,例如,/var/ftp/pub下面,用ftp共享B--ks.cfg也拷贝到 /var/ftp/pub下面C--cp /usr/lib/syslinux/pxelinux.0 /tftpbootcp /media/cdrom/images/pxeboot/{initrd.img,vmlinuz} /tftpbootmkdir /tftpboot/pxelinux.cfgtouch /tftpboot/pxelinux.cfg/defaultdefault文件内容:(ftp地址自己改)[root@localhost ~]# cat /tftpboot/pxelinux.cfg/default
default linux
prompt 1
timeout 60
display boot.msg
label linux
kernel vmlinuz
append initrd=initrd.img text ks=ftp://192.168.1.112/pub/ks.cfg 

相关内容