目录

Server常用服务-NFS服务器

3

安装

yum -y install nfs-utils rpcbind

配置

  1. 配置文件在 /etc/exports

    内容示例:

       /opt/public 192.168.2.1(rw,sync,all_squash)
       ## 将/opt/public目录共享给192.168.2.1,模式为读写,立即同步,所有者为 nfsnobody
    

    PS:将192.168.2.1换为 * 为共享给任何人

    PS:NFS不支持用户账号密码认证,要控制连接只能使用 IP 控制

  2. 重启服务

       systemctl enable rpcbind --now
       systemctl enable nfs-server --now
    
  3. 测试

    可使用 showmount -e 测试nfs功能是否正常

  4. 挂载

    PS:客户端需下载nfs软件包

    yum -y install nfs-utils

    1. 临时挂载

      mount ip:路径 本地挂载路径 需要以ROOT身份挂载

      mount 192.168.0.5:/opt/public /mnt

    2. 永久挂载

      修/etc/fstab 文件 👉fstab

      格式为:192.168.0.5:/opt/public /mnt nfs defaults,_netdev 0 0


推荐文章

Server-prometheus