首先可以用命令 #rpm -qa | grep tftp 查询 tftp 是否安装。
因为本机已经安装好了,所以 输出的信息是: tftp-server-0.49-8.el6.x86_64
如下图:
[root@bogon xinetd.d]# rpm -qa | grep tftp
tftp-server-0.49-8.el6.x86_64
若没显示安装,则使用sudo yum install -y tftp-server进行安装。
#sudo yum install -y tftp-server
二、建立个文件夹
本例中,建立的文件夹目录是 ./tftproot 。即 #cd /tftproot 即可以进入到文件里。
为文件夹设置最宽松的权限
#chmod -R 777 *
#chown -R nobody *
三、配置tftp
linux下的tftp服务是由xinetd(还有openbsd-inetd等其他服务)所设定的,默认情况下tftp是处于关闭状态。所以要修改tftp的配置文件,开启tftp服务。
tftp的配置文件在/etc/xinetd.d/tftp里面,进入到文件,
# vi /etc/xinetd.d/tftp
打开的文件内容如下
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot -c
disable = no #默认值为“yes”,即关闭tftp服务器,这里修改为“no”,即开启tftp服务器
per_source = 11
cps = 100 2
flags = IPv4
}
~
~
~# 说明:修改项server_args=-s <path> -c,其中<path>处可以改为你的tftp-server的根目录,
# 参数-s指定chroot,-c指定 了可以创建文件。
使用命令:sudo service xinetd restart 使上面的更改生效
#sudo service xinetd restart
然后,使用命令:netstat -au | grep tftp
#netstat -au | grep tftp
出现“udp0 0 *:tftp *.*" 则说明tftp服务已经开启。
至此tftp服务已经安装完成了,下面可以对其进行一下测试。