맛집 여행 캠핑 일상 생활

[CentOS] PXE Boot 서버 구축 방법 (Win10PE) 본문

LINUX

[CentOS] PXE Boot 서버 구축 방법 (Win10PE)

영은파더♥ 2024. 3. 22. 17:14

PXE Boot 서버 구축 방법입니다.
윈도우10 PE 부팅 내용도 포함하였습니다.
아래의 설정 방법이 복잡하다고 생각되시면 iventoy.com 에서 툴을 받아서 사용해보세요~
설정이 엄청 간단하고 편리합니다.

# wget https://github.com/ventoy/PXE/releases/download/v1.0.19/iventoy-1.0.19-linux-free.tar.gz
# tar -zxvf iventoy-1.0.19-linux-free.tar.gz
# cd iventoy-1.0.19
# ls -l
total 4
drwxr-xr-x 2 root root   39 Sep 13  2023 data
drwxr-xr-x 2 root root   88 Jun 21  2023 doc
drwxr-xr-x 2 root root    6 Sep 13  2023 iso
-rwxr-xr-x 1 root root 2149 Sep 13  2023 iventoy.sh
drwxr-xr-x 3 root root   34 Sep 13  2023 lib
drwxr-xr-x 3 root root   21 Sep 13  2023 log
drwxr-xr-x 3 root root   21 Jun 21  2023 user
# ./iventoy.sh start
iventoy start SUCCESS PID=3926

Please open your browser and visit http://127.0.0.1:26000 or http://x.x.x.x:26000 (x.x.x.x is any valid IP address)

# yum install syslinux tftp-server xinetd dhcp vsftpd httpd

# vi /etc/xinetd.d/tftp

service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot
#       disable                 = yes
        disable                 = no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

  disable = yes 를 no 로 변경합니다.

# vi /etc/dhcp/dhcpd.conf

subnet 10.10.10.0 netmask 255.255.255.0 {
	range dynamic-bootp 10.10.10.101 10.10.10.200;
	option routers 10.10.10.1;
	option broadcast-address 10.10.10.255;
	option subnet-mask 255.255.255.0;
	option domain-name-servers 8.8.8.8;
	allow booting;
	allow bootp;
	default-lease-time 3000;
	max-lease-time 6000;
	filename "pxelinux.0";
}

  서버 ip 대역에 맞게 수정합니다.

# vi /etc/vsftpd/vsftpd.conf

pasv_enable=YES
pasv_min_port=50000
pasv_max_port=50010

  위 내용을 추가합니다.

# cp /usr/share/syslinux/{menu.c32,pxelinux.0} /var/lib/tftpboot/
  ( 윈도우PE 부팅을 하시려면 memdisk 도 복사하세요 )

# systemctl enable tftp
# systemctl start tftp
# systemctl enable xinetd
# systemctl start xinetd
# systemctl enable vsftpd
# systemctl start vsftpd
# systemctl enable dhcpd
# systemctl start dhcpd

# mkdir /mnt/centos7
# wget https://ftp.kaist.ac.kr/CentOS/7.9.2009/isos/x86_64/CentOS-7-x86_64-Minimal-2207-02.iso
# mount CentOS-7-x86_64-Minimal-2207-02.iso /mnt/centos7
# mkdir /var/lib/tftpboot/centos7
# cp /mnt/centos7/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/centos7/
# mkdir /var/ftp/pub/centos7
# cp -r /mnt/centos7/* /var/ftp/pub/centos7/

또는 ( 외부의 이미지 활용하는 방법입니다. )

# mkdir /var/lib/tftpboot/centos7i
# cd /var/lib/tftpboot/centos7i
# wget https://ftp.kaist.ac.kr/CentOS/7.9.2009/os/x86_64/images/pxeboot/initrd.img
# wget https://ftp.kaist.ac.kr/CentOS/7.9.2009/os/x86_64/images/pxeboot/vmlinuz


# mkdir -p /var/lib/tftpboot/pxelinux.cfg
# vi /var/lib/tftpboot/pxelinux.cfg/default

default menu.c32
prompt 0
timeout 30
ontimeout centos7

MENU TITLE PXE Menu

LABEL centos7
  MENU LABEL CentOS 7 2207 Minimal
  KERNEL /centos7/vmlinuz
  APPEND initrd=/centos7/initrd.img repo=ftp://10.10.10.2/pub/centos7
  #APPEND initrd=/centos7/initrd.img repo=http://10.10.10.2/pub/centos7

LABEL centos7i
  MENU LABEL CentOS 7.9.2009
  KERNEL /centos7i/vmlinuz
  APPEND initrd=/centos7i/initrd.img ip=dhcp inst.repo=https://ftp.kaist.ac.kr/CentOS/7.9.2009/os/x86_64
  
LABEL win10
  MENU LABEL Windows 10 PE
  KERNEL memdisk
  INITRD /win10/Win10PE.iso
  APPEND iso raw

  ftp 주소 ip는 환경에 맞게 변경하세요.
  아파치가 설치되어 있다면 http 로 대체하셔도 됩니다. ( ls -s /var/ftp/pub/ /var/www/html/ )
  윈도우10PE 인터넷에서 누가 만들어 놓은 파일을 다운로드해서 사용하시면 됩니다.

# vi /etc/sysconfig/iptables

-A INPUT -p tcp -m tcp --dport 21 -j ACCEPT
-A INPUT -p udp -m udp --dport 67:69 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 50000:50010 -j ACCEPT

# systemctl restart iptables

그래도 안된다면 방화벽을 해제해주고 하세요~

systemctl stop iptables

 

Trackback : | Comments :