Configuring TFTP Server on Linux

To use PXE Network Boot, you need a working DHCP server and TFTP server (Prerequisites for Using PXE Network Boot).

To install the TFTP server on the Linux distribution that supports yum, such as Fedora and CentOS, run the following command:

yum -y install tftp-server

Other Linux distributions and Unix variants have their own methods of software installation. For example, on distributions that support aptitude, such as Debian and Ubuntu, a TFTP server can be installed with the command

apt-get install tftpd-hpa

After the installation, you will need to configure the TFTP server. This server runs from the super-server xinetd and has a service configuration file in the /etc/xinetd.d directory. The file in the /etc/xinetd.d directory is usually installed with a TFTP server. But if the file in /etc/xinetd.d is missing, you can create the file or record using your favorite text editor. An example of a file (named /etc/xinetd.d/tftp) is provided below:

service tftp
socket_type   = dgram
protocol   = udp
wait   = yes
user   = root
server   = /usr/sbin/in.tftpd
server_args    = -s /tftpboot

disable   = no

per_source   = 11
cps   = 100 2
flags   = IPv4


 
By default, the TFTP server is disabled and this line looks like disable = yes. To enable it, change the line to disable = no (highlighted in red). After saving the changes in the file, restart xinetd with the following command:

/etc/init.d/xinetd restart


 
To test the TFTP server, you can copy /bin/ls (exists in every Linux) to the /tftpboot directory. Using a computer with Linux, open shell and execute the following command:

tftp -c get ls

If the TFTP server works, the command will not return any output and the file ls should appear in the current directory.

Note
The TFTP client (tftp command) is not included in CentOS and Fedora by default. This can result in "tftp: command not found" errors. If you see such an error, install the TFTP client with the command
yum install tftp

Or, on Ubuntu or Debian,

apt-get install tftp-hpa