zoukankan      html  css  js  c++  java
  • Linux下NFS搭建实验

    Linux下NFS搭建实验

    1,系统环境:
    RHEL 7.3 (Maipo) 3.10.0-514.el7.x86_64
    NFS Server IP:192.168.74.130
    NFS Client IP: 192.168.74.131

    #systemctl status firewalld
    #systemctl stop firewalld #关闭防火墙

    #setenforce 0 #关闭SElinux
    SElinux :getenforce Permissive

    2,NFS环境搭建
    NFS Server软件安装,NFS只需要安装两个软件,在通常情况下是作为系统默认软件安装的
    rpcbind ##centos 下面RPC主程序
    nfs-utils ##NFS服务主程序,包括NFS的基本命令和监控程序

    #yum -y install rpcbind nfs-utils
    #systemctl start rpcbind.service ##启动rpcbind服务

    #vi /etc/exportfs ##添加以下内容
    /rhel73_yum/ 192.168.74.131/24(rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)

    # netstat -anlp|grep -i rpcbind ##检测rpcbind服务
    udp 0 0 0.0.0.0:678 0.0.0.0:* 2623/rpcbind
    udp 0 0 0.0.0.0:111 0.0.0.0:* 2623/rpcbind
    udp6 0 0 :::678 :::* 2623/rpcbind
    udp6 0 0 :::111 :::* 2623/rpcbind
    unix 2 [ ACC ] STREAM LISTENING 27848 1/systemd /var/run/rpcbind.sock
    # rpcinfo -p localhost
    program vers proto port service
    100000 4 tcp 111 portmapper
    100000 3 tcp 111 portmapper
    100000 2 tcp 111 portmapper
    100000 4 udp 111 portmapper
    100000 3 udp 111 portmapper
    100000 2 udp 111 portmapper
    #systemctl start nfs.service ##启动NFS服务
    #rpcinfo -p localhost ##检查NFS服务已经注册了rpc端口服务
    program vers proto port service
    100000 4 tcp 111 portmapper
    100000 3 tcp 111 portmapper
    100000 2 tcp 111 portmapper
    100000 4 udp 111 portmapper
    100000 3 udp 111 portmapper
    100000 2 udp 111 portmapper
    100024 1 udp 57574 status
    100024 1 tcp 44727 status
    100005 1 udp 20048 mountd
    100005 1 tcp 20048 mountd
    100005 2 udp 20048 mountd
    100005 2 tcp 20048 mountd
    100005 3 udp 20048 mountd
    100005 3 tcp 20048 mountd
    100003 3 tcp 2049 nfs
    100003 4 tcp 2049 nfs
    100227 3 tcp 2049 nfs_acl
    100003 3 udp 2049 nfs
    100003 4 udp 2049 nfs
    100227 3 udp 2049 nfs_acl
    100021 1 udp 59645 nlockmgr
    注:配置文件说明:
    /opt/test 为共享目录
    192.168.74.131/24 可以为一个网段,一个IP,也可以是域名,域名支持通配符 如: *.qq.com
    rw:read-write,可读写;
    ro:read-only,只读;
    sync:文件同时写入硬盘和内存;
    async:文件暂存于内存,而不是直接写入内存;
    no_root_squash:NFS客户端连接服务端时如果使用的是root的话,那么对服务端分享的目录来说,也拥有root权限。显然开启这项是不安全的。
    root_squash:NFS客户端连接服务端时如果使用的是root的话,那么对服务端分享的目录来说,拥有匿名用户权限,通常他将使用nobody或nfsnobody身份;
    all_squash:不论NFS客户端连接服务端时使用什么用户,对服务端分享的目录来说都是拥有匿名用户权限;
    anonuid:匿名用户的UID值,可以在此处自行设定。
    anongid:匿名用户的GID值。

    NFS Client软件安装,NFS只需要安装nfs-utils软件,在通常情况下是作为系统默认软件安装的
    #yum -y install nfs-utils

    #exportfs -r
    #showmount -e
    #showmount -e 192.168.74.130
    #mount -t nfs 192.168.74.130:/rhel73_yum /mnt/cdrom
    #echo "mount -t nfs 192.168.74.130:/rhel73_yum /mnt/cdrom">>/etc/rc.local ##配置NFS Client启动自动mount

  • 相关阅读:
    Node.js NPM 包(Package)
    Node.js NPM 作用
    Node.js NPM 介绍
    Node.js NPM 教程
    Node.js NPM 教程
    Node.js 发送Email
    Node.js 上传文件
    Node.js 事件
    Node.js NPM
    Node.js 文件系统模块
  • 原文地址:https://www.cnblogs.com/zlg88/p/7628937.html
Copyright © 2011-2022 走看看