提示:该实验平台是在RedHatb6下进行的
配置成功的前提有三个:
(1):在window下能ping的通linux
(2):关闭linux 防火墙 执行指令:/etc/init.d/iptables stop
(3):使SElinux处于宽容模式 执行指令:setenforce permissive
一、配置tftp服务器步骤
(1):挂载磁盘,安装tptp-server软件包
mount /dev/cdrom /mnt/ ..............................................................挂载磁盘文件系统
cd /mnt/Packages/ .............................................................进入磁盘目录
find ./ -name tftp*
find: 路径必须在表达式之前: tftp-server-0.49-7.el6.i686.rpm
用法: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
[root@localhost Packages]# rpm -ivh tftp-server-0.49-7.el6.i686.rpm ..........................................................................安装tpft-server软件包
warning: tftp-server-0.49-7.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies: ..............................................................安装失败,需要首先安装xinetd开头的软件包
xinetd is needed by tftp-server-0.49-7.el6.i686
[root@localhost Packages]# rpm -ivh /mnt/Packages/xinetd ....................................................tab键自动补齐
error: open of /mnt/Packages/xinetd failed: 没有那个文件或目录
[root@localhost Packages]# rpm -ivh /mnt/Packages/xinetd-2.3.14-34.el6.i686.rpm ...............................................安装依赖文件
warning: /mnt/Packages/xinetd-2.3.14-34.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:xinetd ########################################### [100%]
[root@localhost Packages]# rpm -ivh tftp-server-0.49-7.el6.i686.rpm ..........................................................................安装tpft-server软件包
warning: tftp-server-0.49-7.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing... ########################################### [100%]
1:tftp-server ########################################### [100%] ..............................安装成功
[root@localhost Packages]#
(2):配置tftp服务器:执行指令:vim /etc/xinetd.d/tftp
[root@localhost Packages]# vim /etc/xinetd.d/tftp
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /home ...............................................将服务器的访问目录设为 /home
disable = no ....................................................使能tftp服务器
per_source = 11
cps = 100 2
flags = IPv4
}
(3)重启tftp服务 /etc/init.d/xinetd restart
(4)测试tftp设置是否成功 :方法:用ftfp客户端测试程序,来从linux下的tftp服务器下下载文件
二:配置nfs服务器的步骤:
1.配置NFS服务器vim /etc/exports(该文件系统默认为空的)
在其中添加 /tmp 192.168.1.*(rw,sync,no_root_squash)
/tmp: 共享的目录
*: 允许访问共享目录的主机IP
(rw,sync,no_root_squash): 访问权限
2.启动NFS服务器
/etc/init.d/nfs restart
[root@localhost home]# /etc/init.d/nfs restart
关闭 NFS 守护进程: [失败]
关闭 NFS mountd: [失败]
关闭 NFS quotas: [失败]
启动 NFS 服务: [确定]
关掉 NFS 配额: [确定]
启动 NFS mountd: [确定]
正在启动 RPC idmapd: [确定]
正在启动 RPC idmapd: [确定]
启动 NFS 守护进程: [确定]
[root@localhost home]#
验证:在Linux下tftp或者nfs是否启动的命令:
查看tftp是否启动的命令是: ps -ef | grep tftp
查看nfs是否启动的命令式: showmount -e
补充:
[共享的目录] [主机名或IP(参数,参数)]
[共享的目录] [主机名1或IP1(参数1,参数2)] [主机名2或IP2(参数3,参数4)]
下面是一些NFS共享的常用参数:ro 只读访问
rw 读写访问
sync 所有数据在请求时写入共享
async NFS在写入数据前可以相应请求
secure NFS通过1024以下的安全TCP/IP端口发送
insecure NFS通过1024以上的端口发送
wdelay 如果多个用户要写入NFS目录,则归组写入(默认)
no_wdelay 如果多个用户要写入NFS目录,则立即写入,当使用async时,无需此设置。
hide 在NFS共享目录中不共享其子目录
no_hide 共享NFS目录的子目录
subtree_check 如果共享/usr/bin之类的子目录时,强制NFS检查父目录的权限(默认)
no_subtree_check 和上面相对,不检查父目录权限
all_squash 共享文件的UID和GID映射匿名用户anonymous,适合公用目录。
no_all_squash 保留共享文件的UID和GID(默认)
root_squash root用户的所有请求映射成如anonymous用户一样的权限(默认)
no_root_squas root用户具有根目录的完全管理访问权限
anonuid=xxx 指定NFS服务器/etc/passwd文件中匿名用户的UID
anongid=xxx 指定NFS服务器/etc/passwd文件中匿名用户的GID例如:配置文件/etc/exports内容如下:$ cat / etc / exports
/ home / share 192.168 . 102.15 (rw,sync) * (ro)配置说明: 对192.168.102.15赋予读写权限,其他机器仅有只读权限。