NFS服務器

服務器端配置

  1. 安裝NFS+rpcbind服務器組件
rpm -qa nfs-utils rpcbind
nfs-utils-1.3.0-0.54.el7.x86_64
rpcbind-0.2.0-38.el7.x86_64
  1. 安裝

    yum install -y nfs-utils rpcbind
    
  2. 配置需要掛載的文件

    mkdir -p /data/share
    chmod 666 /data/share
    

    修改NFS配置文件/etc/exports

    vim /etc/exports

    添加

    /data/share 192.168.77.0/24(rw,sync,insecure,no_subtree_check,no_root_squash)
    
    
    參數說明
    ro只读访问
    rw读写访问
    sync所有数据在请求时写入共享
    asyncnfs 在写入数据前可以响应请求
    insecurenfs 通过 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_squashroot 用户的所有请求映射成如 anonymous 用户一样的权限(默认)
    no_root_squashroot 用户具有根目录的完全管理访问权限
    anonuid=xxx指定 nfs 服务器 /etc/passwd 文件中匿名用户的 UID
    anongid=xxx指定 nfs 服务器 /etc/passwd 文件中匿名用户的 GID

    ​ rpcinfo -p localhost

   		 program vers proto   port  service
         100000    4   tcp    111  portmapper
         100000    3   tcp    111  portmapper
         100000    2   tcp    111  portmapper
         100000    4   udp    111  portmapper
         100000    3   udp    111  portmapper
         100000    2   udp    111  portmapper
         100024    1   udp  33745  status
         100024    1   tcp  36980  status
         100005    1   udp  20048  mountd
         100005    1   tcp  20048  mountd
         100005    2   udp  20048  mountd
         100005    2   tcp  20048  mountd
         100005    3   udp  20048  mountd
         100005    3   tcp  20048  mountd
         100003    3   tcp   2049  nfs
         100003    4   tcp   2049  nfs
         100227    3   tcp   2049  nfs_acl
         100003    3   udp   2049  nfs
         100003    4   udp   2049  nfs
         100227    3   udp   2049  nfs_acl
         100021    1   udp  38960  nlockmgr
         100021    3   udp  38960  nlockmgr
         100021    4   udp  38960  nlockmgr
         100021    1   tcp  38362  nlockmgr
         100021    3   tcp  38362  nlockmgr
         100021    4   tcp  38362  nlockmgr
  1. 檢查文件掛載

    showmount -e localhost

    Export list for localhost:
    /data/share 192.168.77.0/24
    

客戶端配置

  1. yum install nfs-utils

  2. 查看遠程的可掛載文件

    showmount -e 192.16877.86

    Export list for 192.168.77.86:
    /data/share 192.168.77.0/24
    
  3. 本地創建掛載點

    mkdir /share

    mount 192.168.77.86:/data/share /share

    查看掛載

    df -h

    檢查

    在服務器端添加文件,寫入文字,在客戶端也寫入,刪除

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值