Configuring the PXE server in Ubuntu 14.04

Source: Internet
Author: User
Tags file transfer protocol

PXE (Pre-Boot Execution Environment Preboot execution Environment) server allows users to launch Linux distributions from the network and can be installed in hundreds of PCs without the need for a Linux ISO image. If your client computer does not have a CD/DVD or USB boot disk, or if you want to install more than one computer in a large enterprise, the PXE server can save you time and money.

In this article, we will show you how to configure the PXE server in Ubuntu 14.04.

Configure the Network

Before you start, you need to set up a PXE server to use a static IP. To use a static IP address in your system, you need to edit the "/etc/network/interfaces" file.

Open the "/etc/network/interfaces" file.

sudo nano/etc/network/interfaces

Make the following changes:

# Loopback Network Interface

Auto Lo

Iface Lo inet Loopback

# Main Network interface

Auto Eth0

Iface eth0 inet Static

Address 192.168.1.20

Netmask 255.255.255.0

Gateway 192.168.1.1

Dns-nameservers 8.8.8.8

Save the file and exit. This will set its IP address to "192.168.1.20". Then restart the Network service.

sudo/etc/init.d/networking restart

Install DHCP, TFTP, and NFS:

Dhcp,tftp and NFS are an important part of the PXE server. First, you need to update your system and install all the required packages.

To do this, run the following command:

sudo apt-get update

sudo apt-get install isc-dhcp-server inetutils-inetd tftpd-hpa syslinux nfs-kernel-server

To configure the DHCP service:

DHCP represents a Dynamic Host Configuration Protocol, Protocol, which is primarily used to dynamically assign network configuration parameters such as IP addresses for interfaces and services. In a PXE environment, the DHCP server allows clients to request and automatically obtain an IP address to access the network.

1. Edit the "/etc/default/dhcp3-server" file.

sudo nano/etc/default/dhcp3-server

Make the following changes:

Interfaces= "Eth0"

Save (CTRL + O) and exit (CTRL + X) file.

2. Edit "/etc/dhcp3/dhcpd.conf" file:

sudo nano/etc/dhcp/dhcpd.conf

Make the following changes:

Default-lease-time 600;

Max-lease-time 7200;

Subnet 192.168.1.0 netmask 255.255.255.0 {

Range 192.168.1.21 192.168.1.240;

Option Subnet-mask 255.255.255.0;

Option routers 192.168.1.20;

Option broadcast-address 192.168.1.255;

FileName "pxelinux.0";

Next-server 192.168.1.20;

}

Save the file and exit.

3. Start the DHCP service.

Sudo/etc/init.d/isc-dhcp-server start

To configure the TFTP server:

TFTP is a file transfer protocol, similar to FTP, but it does not have user authentication and cannot list directories. The TFTP server always listens for requests from PXE clients on the network. When it detects that a PXE client is requesting a PXE service in the network, it provides a network packet that contains the boot menu.

1. When configuring TFTP, you need to edit the "/etc/inetd.conf" file.

sudo nano/etc/inetd.conf

Make the following changes:

TFTP dgram UDP wait root/usr/sbin/in.tftpd/usr/sbin/in.tftpd-s/var/lib/tftpboot

Save the file and exit.

2. Edit the "/etc/default/tftpd-hpa" file.

sudo nano/etc/default/tftpd-hpa

Make the following changes:

Tftp_username= "TFTP"

tftp_directory= "/var/lib/tftpboot"

Tftp_address= "[: 0.0.0.0:]:69"

Tftp_options= "--secure"

run_daemon= "Yes"

options= "-l-s/var/lib/tftpboot"

Save the file and exit.

3. Use xinetd to start the boot service automatically every time the system is powered on, and start the TFTPD service.

sudo update-inetd--enable BOOT

sudo service tftpd-hpa start

4, check the status.

sudo netstat-lu

It will be as follows:

Proto recv-q send-q Local address Foreign address state

UDP 0 0 *:tftp *:*

Configuring the PXE Boot file

Now you need to place the PXE boot file "pxelinux.0" under the TFTP root directory. Create a directory structure for TFTP and copy all bootstrapper files provided by syslinux from "/usr/lib/syslinux/" to "/var/lib/tftpboot/", as follows:

sudo mkdir/var/lib/tftpboot

sudo mkdir/var/lib/tftpboot/pxelinux.cfg

sudo mkdir-p/var/lib/tftpboot/ubuntu/14.04/amd64/

sudo cp/usr/lib/syslinux/vesamenu.c32/var/lib/tftpboot/

sudo cp/usr/lib/syslinux/pxelinux.0/var/lib/tftpboot/

Setting the Pxelinux configuration file

The PXE configuration file defines the menu that is displayed when the PXE client starts, and it can boot and associate with the TFTP server. By default, when a PXE client starts, it uses its own MAC address to specify the configuration file to read, so we need to create a default file that contains a list of bootable kernels.

Edit the PXE server configuration file, using a valid installation option.

Edit "/var/lib/tftpboot/pxelinux.cfg/default":

sudo nano/var/lib/tftpboot/pxelinux.cfg/default

Make the following changes:

DEFAULT VESAMENU.C32

TIMEOUT 100

PROMPT 0

MENU INCLUDE pxelinux.cfg/pxe.conf

Noescape 1

LABEL Try Ubuntu 14.04 Desktop

MENU LABEL Try Ubuntu 14.04 Desktop

Kernel Ubuntu/vmlinuz

Append boot=casper Netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/ubuntu/14.04/amd64

Initrd=ubuntu/initrd.lz Quiet Splash

Endtext

LABEL Install Ubuntu 14.04 Desktop

MENU LABEL Install Ubuntu 14.04 Desktop

Kernel Ubuntu/vmlinuz

Append boot=casper automatic-ubiquity Netboot=nfs nfsroot=192.168.1.20:/var/lib/tftpboot/ubuntu/14.04/amd64

Initrd=ubuntu/initrd.lz Quiet Splash

Endtext

Save the file and exit.

Edit the "/var/lib/tftpboot/pxelinux.cfg/pxe.conf" file.

sudo nano/var/lib/tftpboot/pxelinux.cfg/pxe.conf

Make the following changes:

MENU TITLE PXE Server

Noescape 1

Allowoptions 1

PROMPT 0

MENU WIDTH 80

MENU ROWS 14

MENU Tabmsgrow 24

MENU MARGIN 10

MENU COLOR Border 30;44 #ffffffff #00000000 std

Save the file and exit.

Add an Ubuntu 14.04 desktop boot image to the PXE server

The Ubuntu kernel and INITRD files are required for this step. To get these files, you need an Ubuntu 14.04 desktop ISO image. You can download the Ubuntu 14.04 ISO image to the/MNT directory using the following command:

sudo cd/mnt

sudo wget http://releases.ubuntu.com/14.04/ubuntu-14.04.3-desktop-amd64.iso

Note: The URL for the download may change because the ISO image is updated. If the above URLs are inaccessible, check out this website for the latest download links.

Mount the ISO file and copy all the files to the TFTP folder using the following command:

sudo mount-o loop/mnt/ubuntu-14.04.3-desktop-amd64.iso/media/

sudo cp-r/media/*/var/lib/tftpboot/ubuntu/14.04/amd64/

sudo cp-r/media/.disk/var/lib/tftpboot/ubuntu/14.04/amd64/

sudo cp/media/casper/initrd.lz/media/casper/vmlinuz/var/lib/tftpboot/ubuntu/

To configure the exported ISO directory on an NFS server

Now you need to set "Install Source image (Installation source mirrors)" through the NFS protocol. You can also use HTTP and FTP to install the source image. Here I have used NFS to output the ISO content.

To configure server for NFS, you need to edit the "/etc/exports" file.

sudo nano/etc/exports

Make the following changes:

/VAR/LIB/TFTPBOOT/UBUNTU/14.04/AMD64 * (Ro,async,no_root_squash,no_subtree_check)

Save the file and exit. For the changes to take effect, output and start the NFS service.

sudo exportfs-a

Sudo/etc/init.d/nfs-kernel-server start

Your PXE server is now ready.

Configuring the network boot PXE client

The PXE client can be any computer system that supports PXE network booting. Your client will now be able to launch and install the Ubuntu 14.04 desktop only by setting the boot from Network option in the system's BIOS.

Now get ready to go-start your PXE client computer with a network boot, you should now see a submenu that shows the menu items we created for the Ubuntu 14.04 desktop.

Conclusion

Configuring a PXE server to boot the installation from the network can improve efficiency and save time. You can install hundreds of clients at the same time on your local network. All you need is a PXE server and a client that can start PXE.

Free pick up brother even it education original Linux OPS engineer video/Detailed Linux tutorials, details Inquiry official website customer Service: http://www.itxdl.cn/linux/

or hooking up with Q2430675018.

Welcome to the Linux Communication Group 478068715

Configuring the PXE server in Ubuntu 14.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.