码迷,mamicode.com
首页 > 其他好文 > 详细

手动搭建一个nfs服务器

时间:2018-09-11 12:16:18      阅读:255      评论:0      收藏:0      [点我收藏+]

标签:show   下载   local   nfs服务   tfs   lis   exportfs   情况   客户端   

  • 开放/nfs/shared目录,供所有用户查阅资料
  • 开放/nfs/upload目录为172.16.12.0、24网段的数据上传目录,并将所有用户及所属的用户组都映射为nfs-upload,其UID与GID均为300
  • 1:rpm没有安装包的先下载nfs-utils安装包安装,nfs的安装和启动
    安装软件包:yum -y install nfs-utils
    启动nfs服务:systemctl start rpcbind nfs-server
    查看一下服务进程启动没有;
    [root@localhost ~]# ss -antl
    State Recv-Q Send-Q Local Address:Port Peer Address:Port
    LISTEN 0 128 :111 :
    LISTEN 0 128
    :20048 :
    LISTEN 0 128 :22 :
    LISTEN 0 100 127.0.0.1:25
    :
    LISTEN 0 128
    :58651 :
    LISTEN 0 64 :38560 :
    LISTEN 0 64
    :2049 :
    LISTEN 0 128 :::41899 :::
    LISTEN 0 128 :::111 :::

    LISTEN 0 128 :::20048 :::
    LISTEN 0 128 :::22 :::

    LISTEN 0 100 ::1:25 :::
    LISTEN 0 64 :::46558 :::

    LISTEN 0 64 :::2049 :::*
    查看到111和2049就可以确定服务器启动了。
    2编辑etc/exportfs
    [root@localhost ~]# vim /etc/exports
    /nfs/shared 172.16.12.128(ro,sync)
    /nfs/upload 172.16.12.0(anongid=300,anonuid=30 )
    systemctl stop firewalld.service 关闭防火墙
    exportfs -vr 在不重启的情况下启动这个配置文件并在屏幕上显示出来。
    root@localhost ~]# exportfs -vr
    /nfs/shared 172.16.12.128(ro,sync,wdelay,hide,no_subtree_check,sec=sys,secure,root_squash,no_all_squash)
    3显示指定的NFS服务器上说有输出的共享目录,将主机的共享目录挂载到客户端的目录里面,
    root@localhost ~]# showmount -e
    Export list for localhost.localdomain:
    /nfs/shared 172.16.12.12
    进入到客户端创建一个nfs/shared的目录
    进行挂载root@localhost ~]#mount --t nfs SERVER:/nfs/shared /nfs/shared
    然后接下来进入到客户端/nfs/shared就能读取到主机共享目录nfs/shared里面的数据了。

    手动搭建一个nfs服务器

    标签:show   下载   local   nfs服务   tfs   lis   exportfs   情况   客户端   

    原文地址:http://blog.51cto.com/13945839/2173711

    (0)
    (0)
       
    举报
    评论 一句话评论(0
    登录后才能评论!
    © 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
    迷上了代码!