安裝步驟:
(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.centos
2.配置vi /etc/xinetd.d/tftp 修改server_args = -s /tftpboot -c,這裏的-c必定要加上,不然只能下載不能上傳!!post
怎麼測試是否成功呢,安裝tftp,tftp-server,xinetd,先檢查xinetd和tftp是否on了,chkconfig --list | grep xinetd;測試
chkconfig --list | grep tftp, 若是都on了說明服務都開了,this
tftp 127.0.0.1rest
>get tmp.ccode
而後再get/put, 注意若是要put,記得將/etc/xinetd.d/tftp 裏面的加上-c。orm