嵌入式Linux | 搭建TFTP服务器(UbuntuArch Linux)

Posted Mculover666

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了嵌入式Linux | 搭建TFTP服务器(UbuntuArch Linux)相关的知识,希望对你有一定的参考价值。

一、TFTP

TFTP是基于UDP的文件传输协议,在嵌入式Linux开发中非常常用。比如uboot中经常需要通过tftp来下载内核和设备树。

二、TFTP服务器搭建

Ubuntu

1. 安装

安装tftp服务端:

sudo apt-get install tftpd-hpa

安装tftp客户端:

sudo apt-get install tftp-hpa

2. 配置

创建tftp根目录:

sudo mkdir ~/tftp_root

配置tftp服务端:

sudo vim /etc/default/tftpd-hpa

修改tftp根目录:

TFTP_DIRECTORY="/home/mculover666/tftp_root"

修改tftp安全设置,允许上传文件:

TFTP_OPTIONS="--secure -c"

3. 启动tftp服务

sudo service tftpd-hpa restart

检查端口是否有占用:

sudo netstat -a | grep tftp

Arch Linux

1. 安装

sudo pacman -S tftp-hpa

2. 配置

sudo vim /etc/conf.d/tftpd

设置tftp根目录:

TFTPD_ARGS="--secure /home/mculover666/tftp_root/"

3. 启动服务

systemctl start tftpd.service

三、TFTP客户端

用TFTP客户端测试服务端是否可用。

新建一个hello.txt文件到TFTP根目录,用于测试:

echo "hello world!" > ~/tftp_root/hello.txt

TFTP客户端连接本地服务器:

tftp localhost

以上是关于嵌入式Linux | 搭建TFTP服务器(UbuntuArch Linux)的主要内容,如果未能解决你的问题,请参考以下文章

嵌入式开发-迅为4412开发板学习笔记-TFTP服务器的搭建

TFTP服务的搭建

TFTP服务器搭建

tftp服务器的搭建

tftp命令详解

Linux系统下安装使用tftp