CentOS7 minimal nfs 服务器、客户端和 win7 nfs 客户端

  • 下载和配置 nfsserver
  1. 关firewall
  2. 创建分区和挂载
  3. 下载nfs
    yum install -y nfs-utils.x86_64
  4. 配置
    vi /etc/sysconfig/nfs
RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
  1. 启动
    systemctl enable rpcbind
    systemctl enable nfs-server.service
    systemctl start rpcbind
    systemctl start nfs
  2. 配置
    vi /etc/exports
/home/nfsdir *(rw,sync,no_root_squash)
/home/nfsdir1 *(rw,sync,no_root_squash)
...

注:注意nfsdir nfsdir1目录一定要先创建;是不是分区根目录,挂不挂分区无所谓

  1. 修改了/etc/exports之后使之生效
    使用以下命令重启服务:
    systemctl restart rpcbind
    systemctl restart nfs
    或使用:exportfs -r
  2. 查看nfs挂载
    showmount -e
    注: 执行showmount -e报错clnt_create: RPC: Program not registered
    systemctl restart rpcbind
    systemctl restart nfs
    CentOS7 minimal nfs 服务器、客户端和 win7 nfs 客户端_第1张图片
    image.png

    注:nfs 可以exports 任何目录,不一定是一个分区的根目录,它会自动去找本目录所属的分区,并提供这个分区大小的存储。nfs服务并不会自动创建exports的目录,所以需要手动创建目录。
  • 下载和挂载 nfscentos7 client
  1. 下载nfs
    yum install -y nfs_utils
  2. 启动
    systemctl enable rpcbind
    systemctl enable nfs-server.service
    systemctl start rpcbind
    systemctl start nfs
  3. 挂载
    mount -t nfs 192.168.0.200:/home/nfsdir /home/testnfsdir
  4. 解除挂载
    umount /home/testnfsdir
  5. 开机自动挂载
    vi /etc/fstab
...
192.168.0.200:/home/nfsdir /home/testnfsdir nfs  defaults 0 0
  • 挂载(win7 client
  1. 挂载
    mount -o anon mtype=soft lang=ansi 192.168.0.200:/home/nfsdir z:\

你可能感兴趣的:(CentOS7 minimal nfs 服务器、客户端和 win7 nfs 客户端)