This article describes how to install and configure configured with a PXE server 7 64 local mirror installed on the warehouse RHEL / CentOS, warehouse source is CentOS 7 DVD ISO image provided by DNSMASQ server resolution.
The machine provides DNS and DHCP services for network boot of Syslinux package, TFTP-Server– provides a download Trivial File Transfer Protocol over a network bootable image, as well as providing local mirror mounted DVD VSFTPD server – – it will play official RHEL / CentOS 7 installation images warehouses role installer from here to extract the required packages.
Step 1: Install and configure DNSMASQ server
1. do not need to remind you to make sure your network interface cards right, unless there is more than one network interface card on your server, the card must be configured with a static IP address, the IP address must be in the service you want to provide PXE network segment .
So, after you configure a static IP address, update your system and other initial settings. Please install DNSMASQ process using the following command.
# Yum install dnsmasq
Install dnsmasq Package
Install dnsmasq package
2. DNSMASQ default primary configuration file located in the / etc directory, although without any explanation will be able to understand, but it is really quite difficult to edit, even with a very detailed explanatory notes.
First, make sure you back up the file so you need to restore it later. Then use you like to use a text editor to create a new, empty configuration file with the following commands.
# Mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup
# Nano /etc/dnsmasq.conf
3. Now, copy and paste the following into dnsmasq.conf configuration file and make appropriate modifications to ensure accordance with the following instructions to fit your network settings.
interface = eno16777736, lo
domain = centos7.lan
# DHCP range-leases
dhcp-range = eno16777736,192.168.1.3,192.168.1.253,255.255.255.0,1h
dhcp-boot = pxelinux.0, pxeserver, 192.168.1.20
dhcp-option = 3,192.168.1.1
dhcp-option = 6,188.8.131.52, 184.108.40.206
server = 220.127.116.11
# Broadcast Address
dhcp-option = 28,10.0.0.255
# NTP Server
dhcp-option = 42,0.0.0.0
pxe-prompt = “Press F8 for menu.”, 60
pxe-service = x86PC, “Install CentOS 7 from network server 192.168.1.20”, pxelinux
tftp-root = / var / lib / tftpboot
You need to modify the statement has the following:
interface – the server needs to listen and provide service network interface.
bind-interfaces – uncommented to bind to the network interface
domain – Replace your domain name.
dhcp-range – replace defined network mask for your network segment.
dhcp-boot – replace the IP address for your network interface IP address.
dhcp-option = 3,192.168.1.1 – replace the IP address for your network gateway.
dhcp-option = 6,18.104.22.168 – replaces the IP address of your DNS server IP– can define multiple IP addresses.
server = 22.214.171.124 – This is a place DNS server IP address forwarding.
dhcp-option = 28,10.0.0.255 – replace the IP address for the network broadcast address – Optional.
dhcp-option = 42,0.0.0.0 – where to place the network time server – Option (0.0.0.0 address indicates that the reference itself).
pxe-prompt – leave the default – press F8 to enter the menu, 60 seconds waiting time.
pxe = service – use x86PC as the 32/64-bit architectures, and enter a menu prompts are described in the string quoted. Other types of values can be: PC98, IAEFI, Alpha, Arcx86, IntelLeanClient, IA32EFI, BCEFI, XscaleEFI and X86-64EFI.
enable-tftp – Enables the onboard TFTP server.
tftp-root – use / var / lib / tftpboot– location of all network boot file.
Other advanced options and configuration files related, see dnsmasq manual.
Step 2: Install the SYSLINUX boot loader
4. Edit and save DNSMASQ main configuration file, we will continue to install Syslinux PXE boot loader with the following command.
# Yum install syslinux
Install Syslinux Bootloaders
Syslinux boot loader installation
5. PXE boot loader file is located in / usr / share / syslinux system absolute path, you can list the contents of the path to view. This step is not necessary, but you may need to know the path, because in the next step, we will copy all the contents of the path to the next TFTP server path.
# Ls / usr / share / syslinux
Step 3: Install TFTP-Server and add SYSLINUX load launcher
6. Now, let us enter the next step, install the TFTP-Server. Then copy the position in Syslinux package provides all the boot loader file into / var / lib / tftpboot path, the command is as follows.
# Yum install tftp-server
# Cp -r / usr / share / syslinux / * / var / lib / tftpboot
Install TFTP Server
The TFTP server
Step 4: Set PXE server configuration file
7. Typically, PXE server located pxelinux.cfg folder from a specified set of documents to read configuration (first GUID file, followed by the MAC file, and finally the Default file), the folder must be located in the main configuration file DNSMASQ tftp-root statement in the specified directory.
Create the required directory pxelinux.cfg, and then add the file to the default directory, the command is as follows.
# Mkdir /var/lib/tftpboot/pxelinux.cfg
# Touch /var/lib/tftpboot/pxelinux.cfg/default
8. Now, to edit the PXE server configuration files, it added Linux distributions install a reasonable option. Please note that all paths used in the file must be relative to / var / lib / tftpboot directory.
Below, you can see the sample configuration file, you can use the template, but modify the installation image (kernel and initrd files), protocol (FTP, HTTP, HTTPS, NFS) and map your network installation source depot and paths IP address and other parameters.
# Nano /var/lib/tftpboot/pxelinux.cfg/default
Add the following excerpt to the entire file.
menu title ########## PXE Boot Menu ##########
menu label ^ 1) Install CentOS 7 x64 with Local Repo
kernel centos7 / vmlinuz
append initrd = centos7 / initrd.img method = ftp: //192.168.1.20/pub devfs = nomount
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
menu label ^ 3) Install CentOS 7 x64 with Local Repo using VNC
kernel centos7 / vmlinuz
append initrd = centos7 / initrd.img method = ftp: //192.168.1.20/pub devfs = nomount inst.vnc inst.vncpassword = password
menu label ^ 4) Boot from local drive
Configure PXE Server
Configure PXE server
As you can see, CentOS 7 boot image (kernel and initrd) located centos7 directory named, the directory is / var / lib / tftpboot directory relative path (which system absolute path / var / lib / tftpboot / centos7), The warehouse is located in the installer can be accessed via FTP protocol 192.168.1.20/pub network location – in this case, the warehouse is located in a local, because the same IP address and PXE server addresses.
At the same time, the menu label 3 specifies that the client installation should achieve through VNC (VNC password is here replaced by a robust password) from a remote location, if you installed on a machine without the input and output of the client, the menu label 2 is specified as an installation Mirroring a CentOS 7 official internet sources (which requires the client to connect to the Internet via DHCP and NAT).
Important: As you can see in the above configuration, we use the CentOS 7 presentation, but you can also define a RHEL 7 image. The following description and the entire configuration are just based on CentOS 7, so the release of the election to take note.
Step 5: Add CentOS 7 boot image to a PXE server
9. For this step, we need to use the CentOS kernel and initrd file. To obtain these files, you need CentOS 7 DVD ISO image. So, to download CentOS DVD mirror, then put it (burn a CD) into your DVD drive and mount the mirror to / mnt path, command, see below.
CAUSE Using a DVD, instead of minimizing CD image that later we will use the contents of the DVD is to create a local installer FTP source repository.
# Mount -o loop / dev / cdrom / mnt
# Ls / mnt
Mount CentOS DVD
Mount CentOS DVD
If your machine does not have a DVD drive, you can use wget or curl Download from CentOS mirror sites CentOS 7 DVD ISO to local and mount.
# Wget http://mirrors.xservers.ro/centos/7.0.1406/isos/x86_64/CentOS-7.0-1406-x86_64-DVD.iso
# Mount -o loop /path/to/centos-dvd.iso / mnt
10. After the DVD content is available to create a bootable CentOS centos7 directory and 7 kernel and initrd image files copied from DVD mount position to centos7 folder.
# Mkdir / var / lib / tftpboot / centos7
# Cp / mnt / images / pxeboot / vmlinuz / var / lib / tftpboot / centos7
# Cp /mnt/images/pxeboot/initrd.img / var / lib / tftpboot / centos7
Copy CentOS Bootable Files
CentOS bootable copy files
The reason for using this method is that, in the future you may create a new separate directory in / var / lib / tftpboot path, and add other Linux distributions to PXE menu, you will not mess up the entire directory structure .
Step 6: Create a local mirror installation source CentOS 7
11. While you can set up the installation source image through a variety of protocols, such as HTTP, HTTPS, or NFS, but for this guide, I chose to use the FTP protocol. Because by vsftpd, you can easily configure, and it’s also very stable.
Took over, install vsftpd process, and then copy all DVD content to mount the directory vsftpd default server path (/ var / ftp / pub) – It will take some time, depending on your system resources. Then set the read permission for the path, the command is as follows.
# Yum install vsftpd
# Cp -r / mnt / * / var / ftp / pub /
# Chmod -R 755 / var / ftp / pub
Install Vsftpd Server
Vsftpd server installation
Copy Files to FTP Path
Files copied to the FTP path
Set Permissions on FTP Path
FTP path set permissions
Step 7: Start and enable the processes within the system range
12. Since PXE server configuration has been completed, then the server to start DNSMASQ and VSFTPD it. Verify their status and enabled on the system so that these services can start with the system after each system restart, the command is as follows.
# Systemctl start dnsmasq
# Systemctl status dnsmasq
# Systemctl start vsftpd
# Systemctl status vsftpd
# Systemctl enable dnsmasq
# Systemctl enable vsftpd
Start Dnsmasq Service
Start Dnsmasq Service
Start Vsftpd Service
Start Vsftpd Service
Step 8: Open the firewall and test the FTP installation source
13. To obtain a list of the firewall needs to open ports to allow clients to access and boot from PXE server, run the netstat command and add CentOS 7 firewall rules based on dnsmasq and vsftpd listener lists.
# Netstat -tulpn
# Firewall-cmd –add-service = ftp –permanent ## Port 21
# Firewall-cmd –add-service = dns –permanent ## Port 53
# Firewall-cmd –add-service = dhcp –permanent ## Port 67
# Firewall-cmd –add-port = 69 / udp –permanent ## Port for TFTP
# Firewall-cmd –add-port = 4011 / udp –permanent ## Port for ProxyDHCP
# Firewall-cmd –reload ## Apply rules
Check Listening Ports
Check the monitor port
Open Ports in Firewall
Open ports on the firewall
14. To test the FTP installation source network path, open a browser on a local or another computer (lynx can do it), and then enter your FTP services have set up PXE server’s IP address, and filled URL followed by / pub network locations, the results should be seen in the same shot.
Access FTP Files via Browser
FTP file access through a browser
15. To solve the PXE server the final configuration or other information generated by the problem, the diagnosis in live mode, the command is as follows:
# Tailf / var / log / messages
Check PXE Logs for Errors
Check PXE log errors
16. Finally, the final step required is to uninstall CentOS 7 DVD, and remove physical media.
# Umount / mnt
Step 9: Configure the client to boot from the network
17. Now, when your client can specify in BIOS POST press start button to configure the network as the primary boot device, the specific method motherboard manual or through their system BIOS.
To select the network boot, during the first PXE prompt appears, press the F8 key to enter the PXE installation interface, then hit the Enter key to continue to PXE menu.
PXE Network Boot
PXE network boot
PXE Network OS Boot
PXE network boot OS
18. Once you enter the PXE menu, select the type of installation you CentOS 7, hit the Enter key to continue the installation process, just as you start to use the local media to install the same.
Remember this, use the menu to activate variant 2 Internet connection on target clients. In the screenshot below, you can see examples of remote installation via VNC.
Remote Linux Installation via VNC
Linux installation remotely via VNC
Remote Installation of CentOS
Remote Installation CentOS
These are configured to minimize the PXE server on CentOS 7 all content. In my article in this series, I will discuss other PXE server configuration to other issues, such as how to configure automated installation using CentOS 7 Kickstart file, and add other Linux distributions to PXE menu –Ubuntu Server and Debian 7.