zoukankan      html  css  js  c++  java
  • Linux CentOS7 install configure NFS Server

    今天写一个比较简单的NFS文件传输服务

    LinuxSystemVersion:Linux centos7_server 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

    Server Or Client 都需要安装 NFS-utils

    NFS配置服务需记住三点: 共享目录,IP,权限

    [root@centos7_server ~]# yum  -y  install  /mnt/Packages/nfs-utils-1.3.0-0.48.el7.x86_64.rpm

    [root@centos7_server ~]#  vim  /etc/exports

    /nfsshare 127.0.0.1  (rw,sync,root_squash)

    温馨提示:

    共享目录:共享目录可按照自己的心意去做

    IP: 可以设置独立的IP地址:127.0.0.1    Or    127.0.1.0/24 也可是一个网段

    权限: ro     只读 

               rw     只写

              sync  同时将数据写入到内存与硬盘

              async  优先将数据保存到内存,然后在写入硬盘。 效率比较高,有可能会丢失数据

              root_squash  以root身份去访问,在NFS服务器映射为匿名用户   

              no_root_squash  以root身份去访问,在NFS服务器映射为root账户

    [root@centos7_client ~]# mount -t nfs 127.0.0.1:/nfsshare /share/
    mount: wrong fs type, bad option, bad superblock on 10.93.143.5:/nfsshare,
    missing codepage or helper program, or other error
    (for several filesystems (e.g. nfs, cifs) you might
    need a /sbin/mount.<type> helper program)

    In some cases useful info is found in syslog - try
    dmesg | tail or so.

    这时挂载NFS共享目录出现问题,在这个错误当中,小编只看见了NFS这个词,而后在客户端也安装了NFS-Utils,这样就可以挂载了。

    重新启动NFS服务器也需要重新启动rpcbind服务:   systemctl  restart  rpcbind             systemctl     restart   nfs

    [root@centos7_client ~]# mount -t nfs 10.93.143.5:/nfsshare /share

    挂载NFS共享目录时 千万不要漏了 : 这个符号

    [root@centos7_client ~]# df -T
    Filesystem Type 1K-blocks Used Available Use% Mounted on
    /dev/mapper/centos-root xfs 17811456 1146548 16664908 7% /
    devtmpfs devtmpfs 930876 0 930876 0% /dev
    tmpfs tmpfs 941940 0 941940 0% /dev/shm
    tmpfs tmpfs 941940 8680 933260 1% /run
    tmpfs tmpfs 941940 0 941940 0% /sys/fs/cgroup
    /dev/sda1 xfs 1038336 145828 892508 15% /boot
    /dev/sr0 iso9660 4414592 4414592 0 100% /mnt
    tmpfs tmpfs 188392 0 188392 0% /run/user/0
    127.0.0.1:/nfsshare nfs4 17811456 1933568 15877888 11% /share

    再来一个大福利, 永久性挂载NFS共享目录, NFS服务器不倒,一直挂载着。。。

    [root@centos7_server ~]#  vim  /etc/fstab


    #
    # /etc/fstab
    # Created by anaconda on Mon May 21 06:56:27 2018
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk'
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
    #
    /dev/mapper/centos-root / xfs defaults 0 0
    UUID=f4904f42-eea1-4922-b8a8-c290184a3cfa /boot xfs defaults 0 0
    /dev/mapper/centos-swap swap swap defaults 0 0
    /dev/sr0 /mnt iso9660 defaults 0 0

    127.0.0.1:/nfsshare /share nfs defaults 0 0

    此博客由Daniu_UnixChina原创博客。

    热烈欢迎IT大神前来指点,如有不足之处,请联系在下

    Mail:BerDaniu2015@outlook.com  Or  Daniu2015@sina.cn

    QQ:1958344794   WeChat:A67810086

    刚入们的超级小白,学习过程当中记录一些异常信息及解决方法。 欢迎大家一起交流。
  • 相关阅读:
    read()系统调用的流程(转个贴)
    linux kernel reading
    开博第一篇
    让人崩溃的Visual C++ 2005 SP1 Redistributable Package (x86),为啥我下不下来?
    System Call on Linux 2.6 for i386(2) int 0x80与systementer
    http://www.netyi.net/in.asp?id=yuanxianping
    取Insert产生的ID
    递归触发器资料
    Commit Trans和Rollback Trans在有触发器操作时的区别
    转:安全配置SQL Server2000服务器
  • 原文地址:https://www.cnblogs.com/JiangDameiniu/p/9298799.html
Copyright © 2011-2022 走看看