Setting Up a TFTP Server

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   


Contents

Purpose

The purpose of this page is to contain information on how to setup a TFTP server on Linux. This is useful for downloading Linux kernel images to the target board during development.

Using RedHat Enterprise Linux v4 (RHEL4)

You can check to see if a TFTP server is set up with the following command:

host $ rpm -q tftp-server

You should expect to see output similar to:

tftp-server-0.39-2

NOTE: Your version may be different than the one listed above. This is OK, the version above is just an example.

If it is not setup, you can follow these steps:

  1. Download a TFTP server for your Linux host. You can search the internet for "tftp-server". You can find the RPM package for download here
  2. Install the TFTP server package
    host $ rpm -ivh <tftp-server package name>
  3. Confirm that TFTP is installed
    host $ /sbin/chkconfig --list | grep tftp
  4. Turn on the TFTP server
    host $ /sbin/chkconfig tftp on

The default root location for TFTP files is /tftpboot.

Using Ubuntu

There are multiple options for TFTP servers in Ubuntu, below are two possibilities atftp and tftpd-hpa.

Using atftp in Ubuntu 8.04 LTS

To setup atftp on Ubuntu 8.04 LTS, you can follow these steps:

Install atftp Server in Ubuntu

host $ sudo aptitude install atftpd

This will complete the installation

Using atftpd

By default atftpd server starts using inetd so we need to tell atftpd to run as a server directly, not through inetd. Edit /etc/default/atftpd file using the following command

host $ sudo gedit /etc/default/atftpd

Change the following line

USE_INETD=true

to

USE_INETD=false

also change the directory at the end of the file to /tftpboot

save and exit the file

Now you need to run the following command

host $ sudo invoke-rc.d atftpd start

Configuring atftpd

First you need to create a directory where you can place the files

host $ sudo mkdir /tftpboot
host $ sudo chmod -R 777 /tftpboot
host $ sudo chown -R nobody /tftpboot
host $ sudo /etc/init.d/atftpd restart

Using tftpd-hpa in Ubuntu

This was verified in Ubuntu 9.04 but likely applies to other releases as well.

Install tftpd-hpa

Installation is an easy one line command:

host $ sudo apt-get install tftpd-hpa

Configure tftpd-hpa for Daemon Operation

Configure the newly installed TFTP to run as a daemon by editing the /etc/default/tftpd-hpa file and replacing RUN_DAEMON="no" with RUN_DAEMON="yes", note that this file also defines where your TFTP server is serving from, the default location is /var/lib/tftpboot but may be changed in this file if desired:

host $ gksudo gedit /etc/default/tftpd-hpa

Start the TFTP service

Now start the newly configured TFTP service with this command:

host $ sudo /etc/init.d/tftpd-hpa start

[Ubuntu 10.04] use

host $ sudo service tftpd-hpa start
Leave a Comment

Comments

Comments on Setting Up a TFTP Server


Contents

Mtzgustavo said ...

This might be a simple question, but what exactly are we expected to see returned when we type "rpm -q tftp-server"?

--Mtzgustavo 21:47, 6 April 2009 (UTC)

Hnkstrprnkstr said ...

If the package is installed, you'll see the full package name:

linux%rpm -q tftp-server tftp-server-0.41-1.2.1 linux%


--Hnkstrprnkstr 16:49, 9 July 2009 (CDT)

Fullofsquirrels said ...

Creating the /tftpboot folder is only half of the solution; you also need to change the path in /etc/default/atftpd from /var/lib/tftpboot to /tftpboot.

--Fullofsquirrels 21:33, 13 August 2009 (CDT)

Mdamato said ...

I updated to RHEL5 Desktop Client/WS and can't seem to get tftp-server. I downloaded the RHEL version from stated link above but can't get install to work due to NOKEY????

[user@localhost dm355_leopard_imaging]$ rpm -ivh tftp-server-0.32-4.i386.rpm warning: tftp-server-0.32-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID db42a60e error: can't create transaction lock on /var/lib/rpm/__db.000


--Mdamato 21:33, 16 September 2009 (CDT)

Mdamato said ...

I updated to RHEL5 Desktop Client/WS and can't seem to get tftp-server. I downloaded the RHEL version from stated link above but can't get install to work due to NOKEY????

[user@localhost dm355_leopard_imaging]$ rpm -ivh tftp-server-0.32-4.i386.rpm warning: tftp-server-0.32-4.i386.rpm: Header V3 DSA signature: NOKEY, key ID db42a60e error: can't create transaction lock on /var/lib/rpm/__db.000


--Mdamato 22:29, 16 September 2009 (CDT)

Jheoaustin said ...

I can't make either of 2 tftp server(daemon?) using Ubuntu 9.10. Any update on the Ubuntu instructions for this?

--Jheoaustin 00:37, 12 April 2010 (CDT)

DHonig said ...

SILLY TYPO:

host $ sudo aptitude install atftpd

             ^^^^^

should be apt-get

--DHonig 15:17, 29 November 2010 (CST)

Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox