开发板和centos服务器tftp传文件

2023-06-08,,

CentOS下使用TFTP向目标板传送文件http://www.linuxidc.com/Linux/2010-10/29218.htm

1、安装相关软件包

为了使主机支持TFTP,必须确保TFTP后台程序/usr/sbin/in.tftpd,在CentOS下,可以运行下面的命令来确认:
rpm -q tftp-server
如果没有安装,可从Linux安装盘或者其它媒介安装,也可通过下面的指令安装:
yum -y install tftp-server
安装成功之后,接下来安装:
yum -y install tftp
yum -y install xinetd

2、建立配置文件

cd /etc/xinetd.d/
vi tftp
输入

service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /work/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

说明: server_args = -s /work/tftpboot, /work/tftpboot是tftp服务目录.

4.从新启动服务

/etc/init.d/xinetd restart

如果配置成功的话,这时候应该显示:
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]

5. 检查tftp服务, 使用tftp。

[root@localhost /]# netstat -tunap | grep :69
udp 0 0 0.0.0.0:69 0.0.0.0:* 22927/xinetd
udp 0 0 0.0.0.0:69 0.0.0.0:* 22896/in.tftpd
[root@localhost /]# netstat -a|grep tftp
udp 0 0 *:tftp *:*
udp 0 0 *:tftp *:*

[root@localhost /]# netstat -a|grep udp
udp 0 0 *:nfs *:*
udp 0 0 *:785 *:*
udp 0 0 *:799 *:*
udp 0 0 *:42554 *:*
udp 0 0 *:tftp *:*
udp 0 0 *:tftp *:*
udp 0 0 *:726 *:*
udp 0 0 *:netviewdm1 *:*
udp 0 0 *:mdns *:*
udp 0 0 *:sunrpc *:*
udp 0 0 *:60918 *:*
udp 0 0 *:ipp *:*
udp 0 0 *:mdns *:*
udp 0 0 *:38258 *:*

注:如果出现由于防火墙的原因而导致tftp没法给目标板传送文件的情况,建议关掉防火墙。比如:
要关闭SELinux,正确的方法是:
修改/etc/selinux/config文件中的SELINUX="" 为 disabled ,然后重启。

Public key for httpd-2.2.3-63.el5.centos.1.i386.rpm is not installed  http://www.shangxueba.com/jingyan/121651.html

问题Public key for xinetd-2.3.14-20.el5_10.i386.rpm is not installed 的解决:

[root@localhost c]# yum -y install tftp --nogpgcheck

CentOS---tftp(安装、配置、使用)  http://blog.chinaunix.net/uid-26495963-id-3205584.html

创建tftp根目录,启动tftp-server

 #mkdir   /work/tftpboot
 #chmod o+w       /work/tftpboot
 #service xinetd restart
停止 xinetd:                                              [确定]
启动 xinetd:                                                           [确定]
这样,tftp-server就启动了。你可以登陆本机测试以下,命令如下:
 #tftp     
 #tftp>get 
 #tftp>put 
 #tftp>q

uboot中配置并使用tftp命令 http://lifj07.blog.51cto.com/810196/202246/

我们在目标板用命令printenv查看ip地址。

serverip

ipaddr

setenv命令可以修改主机和目标机的ip地址。
#setenv serverip xxx
 
配置好各个参数后,我们在uboot命令窗口中使用tftp命令把内核,文件系统拷贝到ram中。
#tftp 30008000 zImage

在CentOS 6.4中TFTP出现TFTP error: 'Permission denied' (0)的解决 http://blog.csdn.net/idoshi201109/article/details/16886991
  现象:

OpenJTAG> tftp 30000000 u-boot.bin
ERROR: resetting DM9000 -> not responding
dm9000 i/o: 0x20000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
could not establish link
TFTP from server 192.168.2.109; our IP address is 192.168.2.111
Filename 'u-boot.bin'.
Load address: 0x30000000
Loading: *
TFTP error: 'Permission denied' (0)
Starting again

解决办法:

  [root@localhost /]# vi /etc/sysconfig/selinux, SELINUX改为permissive, 然后 sudo setenforce 0(必须的)

#SELINUX=enforcing
#SELINUX=disabled
SELINUX=permissive

开发板和centos服务器tftp传文件的相关教程结束。

《开发板和centos服务器tftp传文件.doc》

下载本文的Word格式文档,以方便收藏与打印。