zoukankan      html  css  js  c++  java
  • CentOS 7 配置 nfs 和 autofs

    1:服务器端:

    [root@languang ~]# mkdir /nfsfile
    [root@languang ~]# chmod 777 /nfsfile/
    [root@languang ~]# echo "welcome to nfs" > /nfsfile/readme.txt

    [root@languang ~]# vim /etc/exports (加上以下内容)

      /nfsfile 192.168.0.*(rw,sync,root_squash)


    [root@languang ~]# firewall-cmd --permanent --add-service=nfs
    success
    [root@languang ~]# firewall-cmd --permanent --add-service=mountd
    success
    [root@languang ~]# firewall-cmd --permanent --add-service=rpc-bind
    success
    [root@languang ~]# systemctl restart firewalld.service

    [root@languang ~]# systemctl restart rpcbind.socket
    [root@languang ~]# systemctl enable rpcbind.socket
    [root@languang ~]# systemctl restart nfs-server
    [root@languang ~]# systemctl enable nfs-server
    完成!

    2:客户端

    [root@www ~]# showmount -e 192.168.0.66

    Export list for 192.168.0.66:

    /nfsfile 192.168.0.*

    echo "192.168.0.188:/nfsfile /nfsfile nfs defaults 0 0" >> /etc/fstab

    完成!

    3:自动挂载autofs

    [root@localhost ~]# yum install autofs

    [root@localhost ~]# vim /etc/auto.master(主配置文件添加挂载目录的上一级目录 (空格)子配置文件目录)

       /media /etc/iso.misc

    [root@localhost ~]# vim /etc/iso.misc(子配置文件添加    挂载目录(空格)-文件系统类型,权限信息(空格):被挂载目录)

      iso -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom

    测试,完成!

    如挂载nfs网络文件

    [root@localhost ~]# yum install autofs

    [root@localhost ~]# vim /etc/auto.master

       /nfs /etc/nfs.misc

    [root@localhost ~]# vim /etc/nfs.misc

      nfsfile -fstype=nfs,rw,sync,root_squash 192.168.0.188:/nfsfile

    测试,完成!

    挂载超时时间修改在 /etc/sysconfig/autofs

    DEFAULT_TIMEOUT=300

  • 相关阅读:
    html向servlet传乱码解决办法
    myeclipse破解方法
    django cookie
    django 时间计数
    bzoj1698 / P1606 [USACO07FEB]白银莲花池Lilypad Pond
    bzoj1689 / P1589 [Usaco2005 Open] Muddy roads 泥泞的路
    bzoj1660 / P2866 [USACO06NOV]糟糕的一天Bad Hair Day
    bzoj1657: [Usaco2006 Mar]Mooo 奶牛的歌声
    bzoj1655: [Usaco2006 Jan] Dollar Dayz 奶牛商店
    bzoj1654 / P2863 [USACO06JAN]牛的舞会The Cow Prom
  • 原文地址:https://www.cnblogs.com/languang9801/p/11104378.html
Copyright © 2011-2022 走看看