tftpd-hpa 是一个功能增强的TFTP服务器。它提供了很多TFTP的增强功能,它已经被移植到大多数的现代UNIX系统。
1.安装
sudo apt-get install tftpd-hpa tftp-hpa
2.配置
tftp-hpa 的配置文件為 /etc/default/tftpd-hpa
sudo gedit /etc/default/tftpd-hpa
# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot" //这里是你的tftpd-hpa的服务目录
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s" //这里是选项
注意:如果是在10.04以下的版本用下面的配置

tftp-hpa 的配置文件为 /etc/default/tftpd-hpa

 RUN_DAEMON="yes" 
OPTIONS="-l -c -s /tftpboot" 3.启动服务
sudo service tftpd-hpa restart 4.test测试
cd /tftpboot
vim test.txt //随便输入一些东西 cd ~/ tftp localhost
get test.txt 最后看看当前目录有test.txt的文件不? 同理!把当前目录下的一个文件put xxxx.???,在去看看/tftpboot目录有xxxx.??这个文件不?

在针对嵌入式开发中,常常我们需要事先配置好一些网络服务,才能使开发板方便的下载或挂载主机的内核和文件系统。系统在启动BootLoader后,通过tftp来下载Linux内核镜像到内存运行,然后通过NFS来启动Linux主机上的目标文件系统,并通过DHCP服务器来为开发板分配IP地址。这里仅仅是搭建服务器环境。在配置TFTP服务一般遇到的问题都是比较多的。经过几次失败尝试后,总结了以下经验以共享:

一、检查是否已经安装好TFTP

caoyi@ubuntu:/home/study$ sudo netstat -nulg | grep 69
udp 0 0 0.0.0.0:69 0.0.0.0:*

或者

caoyi@ubuntu:/home/study$ sudo netstat -au | grep tftp

udp 0 0 *:tftp *:*

则表示已经安装成功,如果没有出现以上信息或当行信息都表示有错误!

一、检查是否安装相关服务(一般没有)

首先得确定自己的主机或虚拟机已经连上网了,并且得确定下载过程是可靠的。

(1)、安装tftp(客户端)、tftpd(服务端)

caoyi@ubuntu:/home/study$ sudo apt-get install tftpd tftp

(2)、安装tftpd-hpa、tftp-hpa(功能增强的TFTP服务器)

caoyi@ubuntu:/home/study$ sudo apt-get install tftpd-hpa tftp-hpa

(3)、安装openbsd-inetd xinetd(网络管理服务。Ubuntu中,tftp不能独立运行,需要网络管理服务器 支持。)

caoyi@ubuntu:/home/study$ sudo apt-get install xinetd openbsd-inetd

二、配置TFTP服务器

(1)、配置tftpd-hpa(服务端)

caoyi@ubuntu:/home/study$ sudo vim /etc/default/tftpd-hpa

1 # /etc/default/tftpd-hpa

2 RUN_DAEMON="yes"

3 TFTP_USERNAME="tftp"

4 TFTP_DIRECTORY="/tftpboot" 这里为TFTP服务器目录

5 TFTP_ADDRESS="0.0.0.0:69"

6 TFTP_OPTIONS="-l -s /tftpboot"

(2)、配置inetd

caoyi@ubuntu:/home/study$ sudo vim /etc/inetd.conf

tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftpboot (在最末添加之)

(3)、建立配置文件

在/etc/xinetd.d/下建立一个配置文件tftp

sudo vim tftp

在文件中输入以下内容:

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

}

保存退出

(4)、重启TFTP相关服务

caoyi@ubuntu:/home/study$ sudo /etc/init.d/openbsd-inetd reload

* Reloading internet superserver inetd [ OK ]

caoyi@ubuntu:/home/study$ sudo /etc/init.d/openbsd-inetd restart

* Restarting internet superserver inetd [ OK ]

caoyi@ubuntu:/home/study$ sudo service tftpd-hpa restart (如果没有反应,应重新安装sudo apt-get install tftpd-hpa)

tftpd-hpa start/running

caoyi@ubuntu:/home/study$ sudo /etc/init.d/xinetd restart

* Stopping internet superserver xinetd [ OK ]

* Starting internet superserver xinetd [ OK ]

三、测试

(1)、在本地根目录下建立我们的TFTP服务器目录

caoyi@ubuntu:/home/study$ cd /

caoyi@ubuntu:/home/study$ sudo mkdir tftpboot

然后,放置一些测试文件,我这里放的是uImage 和空文件a.c

caoyi@ubuntu:/home/study$ sdo chmod 777 -R tftpboot

caoyi@ubuntu:/home/study$ ls /tftpboot

a.c uImage

(2)、进入/home目录下载/tftpboot/目录下的uImage文件(前面设置好了/tftpboot/目录为TFTP默认服务目录):

caoyi@ubuntu:/home/study$ sudo tftp 127.0.0.1

tftp> get uImage

Received 1508808 bytes in 0.2 seconds

tftp> quit

caoyi@ubuntu:/home/study$ ls

uImage

然后进行对/tftpboot/目录上传文件

caoyi@ubuntu:/home/study$ sudo tftp 127.0.0.1

tftp> put b.c

Error code 2: Access violation

(注意:当对TFTP文件进行上传是,应该在/tftpboot/目录下要有一个待上传同名文件)

(3)、在前面我的/tftpboot/目录中有一个a.c的空文件,那么我就可以对它上传一个名字为a.c的文件

caoyi@ubuntu:/home/study$ sudo tftp 127.0.0.1

tftp> put a.c

Sent 15 bytes in 0.0 seconds

tftp> quit

caoyi@ubuntu:/home/study$

(4)、在开发板上测试,首先设置好参数自动下载:然后boot

FS2410# boot

TFTP from server 192.168.7.112; our IP address is 192.168.7.239

Filename 'uImage'.

Load address: 0x30800000

Loading: #################################################################

######################################

done

至此关于Linux下TFTP服务配置完成!其间也会出现一些因版本或其它的错误,应该重复的确定你已经安装好所有的服务,然后不断重启,测试!

引用yicao821的博客

http://blog.csdn.net/yicao821/article/details/6699149

Ubuntu安装配置TFTP服务的更多相关文章

  1. Ubuntu下配置tftp服务

    Ubuntu下配置tftp服务 1.安装TFTP软件 sudo apt-get install tftp-hpa tftpd-hpa tftp-hpa是客户端,tftpd-hpa是服务器端 2.建立t ...

  2. ubuntu10.04 安装配置tftp服务

    tftpd-hpa 是一个功能增强的TFTP服务器.它提供了很多TFTP的增强功能,它已经被移植到大多数的现代UNIX系统. 1.安装 sudo apt-get install tftpd-hpa t ...

  3. ubuntu配置tftp服务

    ubuntu配置TFTP服务: TFTP是用来下载远程文件的最简单的网络协议,基于UDP协议.xinetd是新一代的网络守护进程服务程序,经常用于管理多种轻量型internet服务. sudo apt ...

  4. [转]Ubuntu下配置NFS服务

    [转]Ubuntu下配置NFS服务  http://blog.163.com/liu8821031%40126/blog/static/111782570200921021253516/ Table ...

  5. ubuntu16.04上安装配置DHCP服务的详细过程

    DHCP服务器是为客户端机器分配IP地址的,所有分配的IP地址都保存在DHCP服务器的数据库中.为了在子网中实现DHCP分配IP地址,需要在目标主机上安装配置DHCP服务 1. 安装DHCP服务 安装 ...

  6. Linux 安装配置 tftp 服务器

    1.安装TFTP服务 安装服务端 sudo apt-get install tftpd-hpa 安装客服端 sudo apt-get install tftp-hpa 2.创建TFTP服务器目录 cd ...

  7. 在win2003上安装配置win 服务 遇到的问题

    在win2003上安装配置win 服务 win服务安装后启动不起来 .. 没有装.net framework4.0   要装这个版本 mysql-connector-net-6.3.4.zip    ...

  8. Ubuntu安装配置protobuf 2.5

    Ubuntu安装配置protobuf 2.5 一.安装配置环境 Linux 1.安装protobuf 下载文件 https://github.com/protocolbuffers/protobuf/ ...

  9. 基于【CentOS-7+ Ambari 2.7.0 + HDP 3.0】搭建HAWQ数据仓库——安装配置NTP服务,保证集群时间保持同步

    一.所有节点上使用yum安装配置NTP服务yum install ntp -y 二.选定一台节点作为NTP server, 192.168.58.11修改/etc/ntp.conf vim /etc/ ...

随机推荐

  1. at org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)异常解决

    部署项目,启动tomcat一切正常.输入项目地址后 tomcat报例如以下错误: java.lang.NullPointerException at org.apache.jsp.index_jsp. ...

  2. Python文件或目录操作的常用函数

    ◆ os.listdir(path) Return a list containing the names of the entries in the directory given by path. ...

  3. curl返回值写入内存的场景

    直接上代码: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <cur ...

  4. asp.net DropDownList的AppendDataBoundItems属性

    个人笔记 当设置DropDownList的AppendDataBoundItems属性为true,是将数据绑定项追加到静态声明的列表上,即在绑定之前可加入静态列表项. 例如: 前台这么写: <a ...

  5. Bootstrap学习之一起步

    说起Bootstrap,第一次接触到这个名词的时候还是同事在做自适应页面技术分享会时了解到,在之后的项目中就逐渐应用了这个前端WEB CSS框架.      

  6. sql 练习(3)

    1.打印九九乘法表 ) ,exp)) A, ,exp))B, ,exp))C, ,exp))D, ,exp))E, ,exp))F, ,exp))G, ,exp))H, ,exp))I from ( ...

  7. svn版本控制

    svn自动生成X.java.mine,X.java.r2333,X.java.r2368文件 这是你和别人的操作形成了冲突: 你和别人都从2333这个版本对X.java进行了修改, 别人先修改之后,先 ...

  8. Gow工具

    一 Gow 是什么 Gow (Gnu On Windows) is the lightweight alternative to Cygwin. It uses a convenient NSIS i ...

  9. 不包含任何UserControl

    奇怪了,以前做控件的时候都没有这个问题,哎,又堕落了1年,什么都忘了 创建自定义控件 可以继承现有控件,也可以继承userContrl类,但是现在有个问题 很多网上的资料说,啊,直接创建一个自定义控件 ...

  10. [LeetCode]题解(python):136-Single Number

    题目来源: https://leetcode.com/problems/single-number/ 题意分析: 给定一个数组,每个数都出现了2次,只有一个出现了一次,找出这个数.要求时间复杂度O(n ...