zoukankan      html  css  js  c++  java
  • ubuntu 安装tftp

    安装
      $ apt-get install tftp-hpa tftpd-hpa
     
    2. 建立目录
      $ mkdir /tftpboot # 这是建立tftp传输目录。
      $ sudo chmod 0777 /tftpboot
      $ sudo touch test.txt # test.txt文件最好输入内容以便区分
       

    3. 配置/etc/xinetd.conf
      配置相关服务文件。进入根目录下的 etc 文件夹(cd /etc/),首先看目录中有没有一个xinetd.conf 文件,如果没有则新建一个,有的话查看内容,看是否与下面的一致,若不一致则
    修改,内容如下:

      # Simple configuration file for xinetd
      #
      # Some defaults, and include /etc/xinetd.d/

      defaults
      {

      # Please note that you need a log_type line to be able to use log_on_success
      # and log_on_failure. The default is the following :
      # log_type = SYSLOG daemon info

      }

      includedir /etc/xinetd.d

      

    4. 配置
      # vi /etc/default/tftpd-hpa
      TFTP_USERNAME="tftp"
      TFTP_DIRECTORY="/tftpboot" # 这里是你的tftpd-hpa的服务目录,这个想建立在哪里都行
      TFTP_ADDRESS="0.0.0.0:69"
      TFTP_OPTIONS="-l -c -s" # 这里是选项,-c是可以上传文件的参数,-s是指定tftpd-hpa服务目录,上面已经指定
      

    5. 配置/etc/xinetd.d/tftp
      然后进入 xinetd.d 文件夹(cd xinetd.d),查看是否有一个 tftp 文件,如果没有就新建一个,如果有的话就查看内容是否与下面的一致,不一致则修改,内容如下:
      service tftp
      {
      socket_type = dgram
      wait = yes
      disable = no
      user = root
      protocol = udp
      server = /usr/sbin/in.tftpd
      server_args = -s /tftpboot
      #log_on_success += PID HOST DURATION
      #log_on_failure += HOST
      per_source = 11
      cps =100 2
      flags =IPv4

      }

      

     
    6. 重启服务

      重新启动服务。sudo service tftpd-hpa restart,这也是我经常疏忽的一步,当配置好 tftp 的配置文件后,需要重新启动一下 xinetd,在终端中输入 sudo /etc/init.d/xinetd reload,重新加载一下进程,再输入 sudo /etc/init.d/xinetd restart,重启服务。记住,每次修改完配置文件后,都需要重新启动一下服务。
    执行次序:

      $ sudo service tftpd-hpa restart
      $ sudo /etc/init.d/xinetd reload
      $ sudo /etc/init.d/xinetd restart

     
    7. 测试
      # cd /home
      # tftp localhost  #localhost 表示本机
      tftp>get test.txt  //test.txt 是之前在 /tftpboot 目录下新建的文件
      tftp>put test1.txt //test1.txt 是在 /home 目录下新建的文件
      tftp>q
      退出后,在/home目录下会有一个test.txt文件,在/tftpboot 目录下有test1.txt,表示tftp服务器安装成功!
      
     
    重启之后 运行

    sudo service tftpd-hpa restart
    sudo /etc/init.d/xinetd restart

  • 相关阅读:
    用EasyDarwin进行IPTV rtsp mpeg-ts smil流的转发和分发直播服务
    EasyDarwin添加自定义的服务模块EasyMyModule
    EasyDarwin添加自定义的服务模块EasyMyModule
    EasyDarwin Streaming Server对Task的调用方法
    EasyDarwin Streaming Server对Task的调用方法
    开源G711A/PCMA、G711U/PCMU、G726、PCM转码AAC项目EasyAACEncoder
    开源G711A/PCMA、G711U/PCMU、G726、PCM转码AAC项目EasyAACEncoder
    EasyDarwin EasyClient开源流媒体播放器,支持多窗口显示
    EasyDarwin EasyClient开源流媒体播放器,支持多窗口显示
    解决用EasyDarwin开源流媒体服务器做HLS直播时Flash Player卡住的问题
  • 原文地址:https://www.cnblogs.com/birdBull/p/14183335.html
Copyright © 2011-2022 走看看