You are reading the article Configure Pxe Server In Ubuntu 14.04 updated in October 2023 on the website Nhunghuounewzealand.com. We hope that the information we have shared is helpful to you. If you find the content interesting and meaningful, please share it with your friends and continue to follow and support us for the latest updates. Suggested November 2023 Configure Pxe Server In Ubuntu 14.04
PXE (Preboot Execution Environment) Server allows the user to boot a Linux distribution from a network and install it on hundreds of PCs at a time without any Linux iso images. If your client’s computers don’t have CD/DVD or USB drives, or if you want to set up multiple computers at the same time in a large enterprise, then PXE server can be used to save money and time.
In this article we will show you how you can configure a PXE server in Ubuntu 14.04.
Configure NetworkingTo get started, you need to first set up your PXE server to use a static IP. To set up a static IP address in your system, you need to edit the “/etc/network/interfaces” file.
1. Open the “/etc/network/interfaces” file.
sudo
nano
/
etc/
network/
interfacesAdd/edit as described below:
# The loopback network interface
auto lo iface lo inet loopback# The primary 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.8Save the file and exit. This will set its IP address to “192.168.1.20”. Restart the network service.
sudo
/
etc/
init.d/
networking restart Install DHCP, TFTP and NFS:DHCP, TFTP and NFS are essential components for configuring a PXE server. First you need to update your system and install all necessary packages.
For this, run the following commands:
sudo
apt-get update
sudo
apt-get install
isc-dhcp-Server inetutils-inetd tftpd-hpa syslinux nfs-kernel-Server Configure DHCP Server:DHCP stands for Dynamic Host Configuration Protocol, and it is used mainly for dynamically distributing network configuration parameters such as IP addresses for interfaces and services. A DHCP server in PXE environment allow clients to request and receive an IP address automatically to gain access to the network servers.
1. Edit the “/etc/default/dhcp3-server” file.
sudo
nano
/
etc/
default/
dhcp3-serverAdd/edit as described below:
INTERFACES
="eth0"
Save (Ctrl + o) and exit (Ctrl + x) the file.
2. Edit the “/etc/dhcp3/dhcpd.conf” file:
sudo
nano
/
etc/
dhcp/
dhcpd.confAdd/edit as described below:
default-lease-time600
; max-lease-time7200
; 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 Configure TFTP Server:TFTP is a file-transfer protocol which is similar to FTP. It is used where user authentication and directory visibility are not required. The TFTP server is always listening for PXE clients on the network. When it detects any network PXE client asking for PXE services, then it provides a network package that contains the boot menu.
1. To configure TFTP, edit the “/etc/inetd.conf” file.
sudo
nano
/
etc/
inetd.confAdd/edit as described below:
tftp dgram udpwait
root/
usr/
sbin/
in.tftpd/
usr/
sbin/
in.tftpd-s
/
var/
lib/
tftpbootSave and exit the file.
2. Edit the “/etc/default/tftpd-hpa” file.
sudo
nano
/
etc/
default/
tftpd-hpaAdd/edit as described below:
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 and exit the file.
3. Enable boot service for inetd to automatically start after every system reboot and start tftpd service.
sudo
update-inetd--enable
BOOTsudo
service tftpd-hpa start4. Check status.
sudo
netstat
-lu
It will show the following output:
Proto Recv-Q Send-Q Local Address Foreign Address State udp0
0
*
:tftp*
:*
Configure PXE boot filesNow you need the PXE boot file “pxelinux.0” to be present in the TFTP root directory. Make a directory structure for TFTP, and copy all the bootloader files provided by syslinux from the “/usr/lib/syslinux/” to the “/var/lib/tftpboot/” path by issuing the following commands:
sudo
mkdir
/
var/
lib/
tftpbootsudo
mkdir
/
var/
lib/
tftpboot/
pxelinux.cfgsudo
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/
Set up PXELINUX configuration file
The PXE configuration file defines the boot menu displayed to the PXE client when it boots up and contacts the TFTP server. By default, when a PXE client boots up, it will use its own MAC address to specify which configuration file to read, so we need to create that default file that contains the list of kernels which are available to boot.
Edit the PXE Server configuration file with valid installation options.
To edit “/var/lib/tftpboot/pxelinux.cfg/default,”
sudo
nano
/
var/
lib/
tftpboot/
pxelinux.cfg/
defaultAdd/edit as described below:
DEFAULT vesamenu.c32 TIMEOUT100
PROMPT0
MENU INCLUDE pxelinux.cfg/
PXE.conf NOESCAPE1
LABEL Try Ubuntu14.04
Desktop MENU LABEL Try Ubuntu14.04
Desktop kernel Ubuntu/
vmlinuz appendboot
=caspernetboot
=nfsnfsroot
=192.168.1.20:/
var/
lib/
tftpboot/
Ubuntu/
14.04
/
amd64initrd
=Ubuntu/
initrd.lz quiet splash ENDTEXT LABEL Install Ubuntu14.04
Desktop MENU LABEL Install Ubuntu14.04
Desktop kernel Ubuntu/
vmlinuz appendboot
=casper automatic-ubiquitynetboot
=nfsnfsroot
=192.168.1.20:/
var/
lib/
tftpboot/
Ubuntu/
14.04
/
amd64initrd
=Ubuntu/
initrd.lz quiet splash ENDTEXTSave and exit the file.
Edit the “/var/lib/tftpboot/pxelinux.cfg/pxe.conf” file.
sudo
nano
/
var/
lib/
tftpboot/
pxelinux.cfg/
pxe.confAdd/edit as described below:
MENU TITLE PXE Server NOESCAPE1
ALLOWOPTIONS1
PROMPT0
MENU WIDTH80
MENU ROWS14
MENU TABMSGROW24
MENU MARGIN10
MENU COLOR border30
;44
#ffffffff #00000000 std
Save and exit the file.
Add Ubuntu 14.04 Desktop Boot Images to PXE ServerFor this, Ubuntu kernel and initrd files are required. To get those files, you need the Ubuntu 14.04 Desktop ISO Image. You can download the Ubuntu 14.04 ISO image in the /mnt folder by issuing the following command:
sudo
cd
/
mntMount the ISO file, and copy all the files to the TFTP folder by issuing the following commands:
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/
Configure NFS Server to Export ISO ContentsTo configure the NFS server, you need to edit the “/etc/exports” file.
sudo
nano
/
etc/
exportsAdd/edit as described below:
/
var/
lib/
tftpboot/
Ubuntu/
14.04
/
amd64*
(
ro,async,no_root_squash,no_subtree_check)
Save and exit the file. For the changes to take effect, export and start NFS service.
sudo
exportfs-a
sudo
/
etc/
init.d/
nfs-kernel-server startNow your PXE Server is ready.
Configure Network Boot PXE ClientA PXE client can be any computer system with a PXE network boot enable option. Now your clients can boot and install Ubuntu 14.04 Desktop by enabling “Boot From Network” options from their systems BIOS.
You’re now ready to go – start your PXE Client Machine with the network boot enable option, and you should now see a sub-menu showing for your Ubuntu 14.04 Desktop that we created.
ConclusionConfiguring network boot installation using PXE server is efficient and a time-saving method. You can install hundreds of client at a time in your local network. All you need is a PXE server and PXE enabled clients. Try it out, and let us know if this works for you.
Reference: PXE Server wiki PXE Server Ubuntu
Image credit: fupsol_unl_20
Hitesh Jethva
Over 5 years of experience as IT system administrator for IT company in India. My skills include a deep knowledge of Rehat/Centos, Ubuntu nginx and Apache, Mysql, Subversion, Linux, Ubuntu, web hosting, web server, squied proxy, NFS, FTP, DNS, Samba, ldap, Openvpn, Haproxy, Amazon web services, WHMCS, Openstack Cloud, Postfix Mail Server, Security etc.
Subscribe to our newsletter!
Our latest tutorials delivered straight to your inbox
Sign up for all newsletters.
By signing up, you agree to our Privacy Policy and European users agree to the data transfer policy. We will not share your data and you can unsubscribe at any time.
You're reading Configure Pxe Server In Ubuntu 14.04
Update the detailed information about Configure Pxe Server In Ubuntu 14.04 on the Nhunghuounewzealand.com website. We hope the article's content will meet your needs, and we will regularly update the information to provide you with the fastest and most accurate information. Have a great day!