Linux安装配置NFS方法

NFS、smb、gfs都能提供文件共享服务,其中NFS配置相对于其它两者会简单便捷很多。下面是在centos7.4 x64的环境下安装NFS

工具/原料

  • NFS

  • Centos7.4_x64

方法/步骤

  1. 查看是否安装

    rpm -qa |grep nfs

    rpm -qa |grep rpcbind

    Linux安装配置NFS方法

  2. 使用yum -y install nfs-utils rpcbind命令进行安装

    Linux安装配置NFS方法

  3. 关闭防火墙,selinux

    [root@master ~]# systemctl stop firewalld.service

    [root@master ~]# setenforce 0

    Linux安装配置NFS方法

  4. 禁止防火墙开机自启动

    systemctl disable firewalld.service

    Linux安装配置NFS方法

  5. 启动服务,一定要先启动rpc再启动nfs

    nfs需要向rpc注册,rpc一旦重启,所以注册的文件都丢失,其他向注册的服务都需要重启

    启动rpc服务:

    systemctl start rpcbind.service      

    启动nfs服务: 

    systemctl start nfs.service

    Linux安装配置NFS方法

  6. 查看服务启动的状态

    systemctl status rpcbind.service

    systemctl status nfs.service

    Linux安装配置NFS方法

  7. vi /etc/exports

    /mnt  *(rw,sync,no_root_squash) 

    Linux安装配置NFS方法

  8. 重启rpcbind再重启nfs:

    重启rpc服务:

    systemctl restart rpcbind.service      

    重启nfs服务: 

    systemctl restart nfs.service

    Linux安装配置NFS方法

  9. 在客户端进行挂载

    mount -t nfs 192.168.137.139:/mnt /tmp

    Linux安装配置NFS方法

    END

注意事项

  • 注意开放所需要的端口

  • 一定要先启动rpc,然后启动nfs

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章