安装步骤:
(1) yum install tftp --> 安装tftp client
(2) yum install tftp-server -->安装tftp server
(3) yum install xinetd -->安装tftp的超级服务守护进程
安装完(2)后,在/etc/xinetd.d/下会生产一个tftp.rpmnew的tftp服务配置文件样板,只需修改disable = yes为disable = no,然后保存退出,重启xinetd:
serveice xinetd restart,让配置生效,当然可以看到setup时,可以看到tftp服务那项是选上的,也就是开机就会启动tftp服务。另外,网上很多(基于Ubuntu的)都说可以改user和
server_arg,但是我尝试更改这两个设置,但是在本地测试时都不能成功。另外,我只测试了从主目录/var/lib/tftpboot/下载文件的功能,而上传会出现:Error code 0: Permission denied的错误。现在,没有找到这个问题的症结。希望有人能够帮我回答。
/etc/xinetd.d/tftp 里面修改 disable=no, 修改tftp默认路径、var/lib/tftpboot
he below steps will allow you to set up a TFTP server on Linux but specifically on a CentOS server. All you need to do is install a couple files with yum, enable the server, and restart xinetd.
Install TFTP Server: Use the below syntax to install the TFTP server on CentOS.
1 [root@centos-server ~]#yum install tftp-server
Install Xinetd: The TFTP server will run via xinetd so you need to make sure xinetd is installed using the bellow command.
1 [root@centos-server ~]#yum install xinetd
Enable TFTP and Xinetd: Use chkconfig to ensure that xinetd and tftp starts on reboot.
1 [root@centos-server ~]#chkconfig tftp on
2 [root@centos-server ~]#chkconfig xinetd on
Modify TFTPBOOT Permissions: Use the below syntax to modify the permissions of the /tftpboot directory to allow tftp transfers to and from this directory. The /tftpboot directory is the default directory where files are transfered to and from using TFTP.
1 [root@centos-server ~]#chmod 777 /tftpboot
Example TFTP Command: The below is an example of use of the TFTP command.
1 [root@centos-server ~]#tftp -v 192.168.1.100 -c put file-example.txt
The normal computer user is probably not going to find TFTP very useful but techies will be able to find many uses. Typically technical people will run across TFTP when upgrading the firmware on some sort of network device. Please post comments if you have any TFTP questions.
2.配置vi /etc/xinetd.d/tftp 修改server_args = -s /tftpboot -c,这里的-c一定要加上,否则只能下载不能上传!!
怎么测试是否成功呢,安装tftp,tftp-server,xinetd,先检查xinetd和tftp是否on了,chkconfig --list | grep xinetd;
chkconfig --list | grep tftp, 如果都on了说明服务都开了,
tftp 127.0.0.1
>get tmp.c
然后再get/put, 注意如果要put,记得将/etc/xinetd.d/tftp 里面的加上-c。