Centos7 安装 NFS

网络拓扑

        计算机名称              IP地址                角色
        centos7-01              192.168.18.128       Master Server
        centos7-02              192.168.18.129       compute1
        centos7-03              192.168.18.130       compute2

 

NFS 环境搭建服务端

    安装软件
    
        #yum -y install nfs-utils
        #systemctl restart rpcbind
        #systemctl restart nfs

        #systemctl enable rpcbind
        #systemctl enable nfs
    
    修改NFS配置文件,定义共享
        
        #cat /etc/exports 或 直接打开 /etc/exports 文件修改
            
            /opt *(rw,no_root_squash)
            /home *(rw,no_root_squash)

    重启 rpcbind nfs
        
        #systemctl restart nfs
        
        
    
    
NFS Client 设置
    
    安装软件
    
        #yum -y install nfs-utils
        #systemctl restart rpcbind
        #systemctl restart nfs

        #systemctl enable rpcbind
        #systemctl enable nfs
        
    在 compute1 查看192.168.35.22服务器可挂载的目录
    
        #showmount -e 192.168.18.128

    挂载共享的NFS文件系统
    
        #mount 192.168.18.128:/home /home
        #mount 192.168.18.128:/opt /opt

    查看是否已经挂载成功
    
        #mount | grep opt

    设置客户端开机时自动挂载,在root用户下,/etc/fstab 追加
        
        #cat /etc/fstab

            192.168.18.128:/home /home nfs defaults 0 0
            192.168.18.128:/opt /opt nfs hard,intr,defaults 0 0

posted @ 2019-04-29 13:53  阿谦  阅读(144)  评论(0编辑  收藏  举报