How to Setup a TFTP Server on Ubuntu 18.04

The steps in this post will show you how to configure TFTP on a clean install of Ubuntu Server 18.04.

Introduction

Trivial file transfer protocol (TFTP) can be used to automatically provision various systems such as VoIP phones or even Linux servers.

In this tutorial, we’ll setup TFTP on Ubuntu Server 18.04. The following steps have been tested on a clean install of Ubuntu Server 18.04.3 LTS running on a VMware Fusion virtual machine.

Let’s begin.

Step 1: Install tftp-hpa

At the command prompt, run the following command:

sudo apt install -y tftpd-hpa

Step 2: Add files to tftpboot directory

Files accessed using a tftp client need to be stored in the /var/lib/tftpboot directory. Let’s create a demo text file called hello.txt to show that it works.

echo "world" | sudo tee /var/lib/tftpboot/hello.txt

From another machine on your network, connect using a tftp client. For example on a Mac run:

tftp 10.1.1.253
get hello.txt
quit

The file should now be on the local machine.

$ cat hello.txt
world

That’s it

Now you can transfer files to the tftpboot directory and use the IP address of the server when provisioning devices that need to download from a TFTP server.

Tags: Ubuntu