nfs server and client

系统环境:Centos7.3

ip1:10.0.0.1

ip2:10.0.0.2

检测是否安装NFS服务

rpm -qa | grep   nfs

rpm  -qa|grep    nfs

安装NFSserver

yum  -y   install    nfs-utils    rpcbind

服务器配置(10.0.0.1)

创建共享目录并设置权限(/mnt/data)

mkdir  -p  /mnt/data

vim   /etc/exports

/mnt/data    10.0.0.0/24(rw,no_root_squash,no_all_squash,sync)

/opt/filestore      *(insecure,rw,no_root_squash)

启动NFSserverfuwu

systemctl enable   rpcbind.service

systemctl enable   nfs-server.service

systemctl   restart    nfs

systemctl    status     nfs  

查看 RPC 服务的注册状况

rpcinfo -p   localhost

检测NFS是否联机

showmount -e localhost

客户端配置(10.0.0.2)

安装NFS client服务

yum  -y  install   nfs-utils

创建挂载目录

mkdir   /eason

查看服务器抛出的共享目录信息

showmount    -e    10.0.0.1

为了提高NFS的稳定性,使用TCP协议挂载,NFS默认用UDP协议

mount   -t nfs   10.0.0.1:/mnt/data    /eason   -o   proto=tcp -o nolock

mount   -t nfs   192.168.22.204:/opt/filestore /opt/weixins2/tomcat2/webapps/filestore     -o     proto=tcp    -o    nolock

测试本机

df   -h

服务器端(/mnt/data)

echo "test"  > test.txt

客户端(/eason)

cat    /eason

猜你喜欢

转载自www.cnblogs.com/ipyanthony/p/9289910.html