zoukankan      html  css  js  c++  java
  • CentOS 7快速安装配置NFS服务

    Server IP ADD:192.168.153.138
    Client IP ADD:192.168.153.140
    NFS Server安装配置:
    关闭selinux
    vim /etc/selinux/config
    #SELINUX=enforcing
    #SELINUXTYPE=targeted
    SELINUX=disabled     //新增部分
    systemctl stop firewalld
    systemctl disable firewalld
    yum remove firewalls
    yum install iptables-services
    vi /etc/sysconfig/iptables
    -A INPUT -p udp -s 192.168.153.140/32 -j ACCEPT    //新增两条访问策略
    -A INPUT -p tcp -s 192.168.153.140/32 -j ACCEPT
    :wq!
    service start iptables
    systemctl enable iptables
    
    yum install nfs-utils -y //会连同rpcbind依赖包一起安装。
    
    /tmp/nfs 192.168.153.140(rw,sync,fsid=0,no_root_squash,no_all_squash,anonuid=501,anongid=501)
    
    exportfs -r  //使配置生效
    
    1./tmp/nfs  为共享目录
    2.192.168.153.140  //可以为一个网段或一个IP或多个IP
    3.rw表示可读写,ro只读;
    4.sync表示同步模式,内存中数据时写入磁盘;async表示不同步,把内存中数据定期写入磁盘中。
    5.no_root_squash:root用户会对共享目录拥有至高的权限控制,就像是对本机的目录操作一样,不安全,不建议使用;root_squash:root用户对共享目录的权限不高,只有普通用户的权限,
    6.all_squash:不管使用NFS用户是谁,他的身份将会被限定成为一个指定的普通用户身份;
    7.anonuid/anongid:要和root_squash以及all_squash一同使用,同于指定使用NFS用户限定后的uid和gid,前提本机的/etc/passwd中存在这个uid和gid。
    8.fsid=0表示将/tmp/nfs整个目录包装成根目录
    
    nfs开机启动服务
    systemctl enable rpcbind
    systemctl enable nfs-server
    
    启动nfs服务
    
    systemctl start rpcbind
    systemctl start nfs-server
    
    确认NFS服务器启动成功:
    rpcinfo -p
    
    查看service列中是否有nfs服务来确认NFS是否启动
    showmount -e 192.168.153.138     //在nfs server操作
    
    NFS Client安装配置
    关闭selinux
    vim /etc/selinux/config
    #SELINUX=enforcing
    #SELINUXTYPE=targeted
    SELINUX=disabled     //新增部分
    systemctl stop firewalld
    systemctl disable firewalld
    yum remove firewalls
    yum install iptables-services
    vi /etc/sysconfig/iptables
    -A INPUT -p udp -s 192.168.153.138/32 -j ACCEPT    //新增两条访问策略
    -A INPUT -p tcp -s 192.168.153.138/32 -j ACCEPT
    :wq!
    service start iptables
    systemctl enable iptables
    
    yum install nfs-utils -y //会连同rpcbind依赖包一起安装。
    systemctl enable rpcbind
    systemctl start rpcbind
    mkdir /tmp/nfs
    mount -t nfs 192.168.153.138:/tmp/nfs /tmp/nfs/
    vim /etc/fstab       //mount永久生效,重启后mount不消失
    192.168.153.138:/tmp/nfs  /tmp/nfs              nfs     nolock          0 0
    :wq!
  • 相关阅读:
    CF1168B Good Triple 性质分析
    bzoj 4994: [Usaco2017 Feb]Why Did the Cow Cross the Road III 树状数组_排序
    BZOJ 3940: [Usaco2015 Feb]Censoring AC自动机+栈
    BZOJ 1691 [Usaco2007 Dec]挑剔的美食家 multiset+排序+贪心
    BZOJ 1725: [Usaco2006 Nov]Corn Fields牧场的安排 状压动归
    BZOJ 1726: [Usaco2006 Nov]Roadblocks第二短路 Dijkstra
    BZOJ 1666: [Usaco2006 Oct]Another Cow Number Game 奶牛的数字游戏 幼儿园测试题
    BZOJ 5508: [Tjoi2019]甲苯先生的字符串 矩阵乘法_思维
    BZOJ 1602: [Usaco2008 Oct]牧场行走 倍增裸题
    描述符get/set/delete,init/new/call,元类
  • 原文地址:https://www.cnblogs.com/vincent-liang/p/7043274.html
Copyright © 2011-2022 走看看