• 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

  • 相关阅读:
    Python3.4的Pillow库实现验证码图片
    希尔排序
    二分法排序
    [算法天天练]选择排序
    冒泡 [Python]
    python -- 结构数据类型(列表、元组、集合、字典)
    python -- 字符串操作
    python -- 基础语法
    python -- 环境搭建
    Unittest方法 -- 以test开头实例
  • 原文地址:https://www.cnblogs.com/languang9801/p/11104378.html
Copyright © 2020-2023  润新知