zoukankan      html  css  js  c++  java
  • nfs服务

    1.1 nfs01主机配置

    1.1.1 安装nfs-utils服务

    1.安装

    [root@nfs01 ~]# yum install -y nfs-utils rpcbind

    2.配置nfs

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

    /data/www 172.16.1.0/24(rw,sync,all_squash,anonuid=666,anongid=666)

    #创建指定压缩的用户

    [root@nfs01 ~]# groupadd -g 666 www

    [root@nfs01 ~]# useradd -u 666 -g www www

    [root@nfs01 ~]# id www

    uid=666(www) gid=666(www) groups=666(www)

    #创建共享目录并授权给www用户

    [root@nfs01 ~]# mkdir /data/www -p

    [root@nfs01 ~]# chown -R www.www /data

    [root@nfs01 ~]# ll /data/www/ -d

    drwxr-xr-x 2 www www 6 Jul 28 18:31 /data/www/

    3.推送,并重启nfs-server

    #重启服务,并检查配置是否正确

    [root@nfs01 ~]# systemctl restart rpcbind nfs-server

    [root@nfs01 ~]# cat /var/lib/nfs/etab

    /data/www 172.16.1.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,all_squash,no_subtree_check,secure_locks,acl,no_pnfs,anonuid=666,anongid=666,sec=sys,secure,root_squash,all_squash)

    #加入开机自启动

    [root@nfs01 ~]# systemctl enable nfs-server

    Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.

    [root@nfs01 ~]# systemctl enable rpcbind

    1.2 web01主机配置

    1.2.1 安装nfs-utils服务

    1.安装nfs-utils

    [root@web01 ~]# yum install nfs-utils rpcbind -y

    #重启服务并加入开机自启动

    [root@web01 ~]# systemctl restart rpcbind

    [root@web01 ~]# systemctl enable rpcbind

    2.配置nfs服务

    #获取查询

    [root@web01 ~]# showmount -e 172.16.1.31

    Export list for 172.16.1.31:

    /data/www 172.16.1.0/24

    #创建挂载点

    [root@web01 ~]# mkdir /data/www -p

    #挂载目录

    [root@web01 ~]# mount.nfs4 172.16.1.31:/data/www /data/www

    [root@web01 ~]# df -h

    Filesystem               Size  Used Avail Use% Mounted on

    .....省略.....

    172.16.1.31:/data/www     50G  1.6G   49G   4% /data/www

    #创建www用户

    [root@web01 ~]# groupadd -g 666 www

    [root@web01 ~]# useradd -u 666 -g www www

    [root@web01 ~]# id www

    uid=666(www) gid=666(www) groups=666(www)

    #测试

    [root@web01 ~]# cd /data/www/

    [root@web01 www]# echo 123 >web01_file.txt

     

    [root@nfs01 www]# ls

    web01_file.txt

  • 相关阅读:
    PHPStorm下XDebug配置
    HDU 4633 Who's Aunt Zhang (Polya定理+快速幂)
    VC++深入详解-第五章学习心得
    nginx access log logrotate配置
    判断变量是否存在(python)
    一步一步学android之布局管理器——LinearLayout
    向前辈致敬 strspn
    poj 1087 (最大流)
    cocos2d-x Touch 事件应用的一个例子
    [置顶] C#扩展方法 扩你所需
  • 原文地址:https://www.cnblogs.com/wangkaiok/p/11282411.html
Copyright © 2011-2022 走看看