<commit_before>
### PXE Network Boot Server Setup

Install and setup PXE server on CentOS 7.  

Install packages:
- dnsmasq: provides DNS and DHCP services
- syslinux: bootloaders for network booting
- tftp-server: server bootable imaes


Setup dnsmasq:
```
vi /etc/dnsmasq.conf
```
```
# Interface to listen on
interface=enp5s0
# Domainname
#domain=
# DHCP IP range
dhcp-range=enp5s0,10.0.0.164,10.0.0.199,12h
# PXE
dhcp-boot=pxelinux.0,pxeserver,10.0.0.6
# Gateway
#dhcp-option=3,10.0.0.1
# DNS server
dhcp-option=6,10.0.0.6
# Broadcast
dhcp-option=28,10.0.0.255
# NTP server
dhcp-option=42,10.0.0.6

pxe-prompt="Press F8 for menu.", 60
pxe-service=x86PC, "Install CentOS 7 from network server", pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot
```

Copy bootloaders: `cp -r /usr/share/syslinux/* /var/lib/tftpboot/`
Setup PXE config files:
```
# mkdir /var/lib/tftpboot/pxelinux.cfg
# vi /var/lib/tftpboot/pxelinux.cfg/default
```
```
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

menu title ########## PXE Boot Menu ##########

label 1
menu label ^1) Install CentOS 7 x64 with Local Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://10.0.0.6/pub devfs=nomount

label 2
menu label ^2) Install CentOS 7 x64 with http://mirror.centos.org Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=http://mirror.centos.org/centos/7/os/x86_64/ devfs=nomount ip=dhcp

label 3
menu label ^3) Boot from local drive
```

```
# mkdir /var/lib/tftpboot/centos7
# mount -o loop /var/repo/iso/CentOS-7.0-1406-x86_64-Everything.iso /mnt
# cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7
# cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7

# yum install vsftpd
# cp -r /mnt/* /var/ftp/pub/
# chmod -R 755 /var/ftp/pub

# umount /mnt
# systemctl stop dhcpd.service
# systemctl start dnsmasq
# systemctl status dnsmasq
# systemctl start vsftpd
# systemctl status vsftpd
```

### Test

ftp://10.0.0.6/pub/




##### References

- [Setting up a ‘PXE Network Boot Server’ for Multiple Linux Distribution Installations in RHEL/CentOS 7](http://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/)<commit_msg>Update pxe-server-setup-dnsmasq.md<commit_after>
### PXE Network Boot Server Setup

Install and setup PXE server on CentOS 7.  

Install packages:
- dnsmasq: provides DNS and DHCP services
- syslinux: bootloaders for network booting
- tftp-server: server bootable imaes

Setup dnsmasq:
```
vi /etc/dnsmasq.conf
```
```
# Interface to listen on
interface=enp5s0
# Domainname
#domain=
# DHCP IP range
dhcp-range=enp5s0,10.0.0.164,10.0.0.199,12h
# PXE
dhcp-boot=pxelinux.0,pxeserver,10.0.0.6
# Gateway
#dhcp-option=3,10.0.0.1
# DNS server
dhcp-option=6,10.0.0.6
# Broadcast
dhcp-option=28,10.0.0.255
# NTP server
dhcp-option=42,10.0.0.6

pxe-prompt="Press F8 for menu.", 60
pxe-service=x86PC, "Install CentOS 7 from network server", pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot
```

Copy bootloaders: `cp -r /usr/share/syslinux/* /var/lib/tftpboot/`
Setup PXE config files:
```
# mkdir /var/lib/tftpboot/pxelinux.cfg
# vi /var/lib/tftpboot/pxelinux.cfg/default
```
```
default menu.c32
prompt 0
timeout 300
ONTIMEOUT local

menu title ########## PXE Boot Menu ##########

label 1
menu label ^1) Install CentOS 7 x64 with Local Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://10.0.0.6/pub devfs=nomount

label 2
menu label ^2) Install CentOS 7 x64 with http://mirror.centos.org Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=http://mirror.centos.org/centos/7/os/x86_64/ devfs=nomount ip=dhcp

label 3
menu label ^3) Boot from local drive
```

```
# mkdir /var/lib/tftpboot/centos7
# mount -o loop /var/repo/iso/CentOS-7.0-1406-x86_64-Everything.iso /mnt
# cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7
# cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7

# mkdir -p /var/ftp/pub/
# cp -r /mnt/* /var/ftp/pub/
# \cp -rf /mnt/. /var/ftp/pub  # yes | cp -ri /mnt/. /var/ftp/pub
# chmod -R 755 /var/ftp/pub

# umount /mnt
# systemctl stop dhcpd.service
# systemctl start dnsmasq
# systemctl status dnsmasq
```

```
# yum install vsftpd
# systemctl start vsftpd
# systemctl status vsftpd
```

### Test

ftp://10.0.0.6/pub/




##### References

- [Setting up a ‘PXE Network Boot Server’ for Multiple Linux Distribution Installations in RHEL/CentOS 7](http://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/)
{'fraction_non_alphanumeric': 0.1467146714671467, 'fraction_numerical': 0.052205220522052204, 'mean_word_length': 3.9554069119286512, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 18, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1190723', 'n_tokens_mistral': 2003, 'n_tokens_neox': 1808, 'n_words': 422}