linux+nfs文件传输,实验:NFS 文件传输

NFS  network file share用于unix与linux文件共享

23011bce12a521a5bbaa317cc53b61ee.gif最简单的搭建:

b5b06b1e6cd6f7e9616a3013e80e67b6.gif说明

服务器端:查询、安装nfs,安装文件传输软件rpcbind;添加发布目录;新建共享目录(注意权限);关闭防火墙、SELinux;重启rpcbind及nfs服务;设置自动启动

客户端:查找共享资源,挂载

b5b06b1e6cd6f7e9616a3013e80e67b6.gif服务器端:yum list |grep nfs         #查看nfs软件组成

yum –y install nfs-utils nfs-utils-lib nfs4-acl-tools #安装nfs

rpm –qa |grep nfs          #确认是否安装

rpm –qa rpcbind            #查看rpcbind是否安装

vim /etc/exports           #添加发布目录

/nfs/share     *(ro;sync)

mkdir /nfs/share –p        #新建共享目录(注意权限)

chown nfsnobody /nfs/share #更改共享目录属性

ll –d /nfs/share           #确认更改

touch /nfs/share/this_is_nfs_from_server #新建文件以方便显示共享

service rpcbind start      #启动rpcbind

service nfs start          #启动

chkconfig rpcbind on       #设置开机启动rpcbind

chkconfig nfs on           #设置开机启动nfs

iptables –F                #清空防火墙配置

iptables save              #保存防火墙配置

setenforce 0         #关闭SELinux

b5b06b1e6cd6f7e9616a3013e80e67b6.gif客户端:showmount -e 192.168.1.100    #查看特定IP的共享文件

mount.nfs 192.168.1.100:/nfs/share /mnt/ #临时挂载共享文件

ls /mnt/                     #查看挂载的共享文件,成功搭建!

this_is_nfs_from_server

23011bce12a521a5bbaa317cc53b61ee.gif扩展1:不同IP不同的读写权限vim /etc/exports#重新更改发布目录

/nfs/share  192.168.1.200(rw,sync)

/nfs/share  192.168.1.201(ro,sync)

exportfs –rv  #重新加载发布目录,也可以用重启命令

[root@client ~]# touch /mnt/a        #IP为192.168.1.200的可以创建文件

[root@client ~]# ls -l /mnt/a

-rw-r--r--. 1 nfsnobody nfsnobody 0 Mar  7 11:04 /mnt/a

[root@client mnt]# touch /mnt/a    #更改IP为192.168.1.201后不能创建文件

touch: cannot touch `a': Read-only file system

44186ecf764da04958b66a5110d4b135.gif扩展2:远程挂载家目录(未完等续)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值