zoukankan      html  css  js  c++  java
  • [Linux]

    服务端安装nfs

    1、使用yum安装nfs

    yum install nfs-utils nfs-utils-lib -y

    如果安装过程出现这样的错误:

    得先安装lvm2

    yum install -y lvm2

    2、编辑文件exports

    vim /etc/exports

    加入代码,如:

    /home 192.168.1.100(rw,sync,no_root_squash,no_subtree_check)

    #参数详解
    ro #只读共享
    rw #读写共享
    sync #同步写操作
    async #异步写操作
    wdelay #延迟写操作
    root_squash #屏蔽远程root权限
    no_root_squash #不屏蔽远程root权限
    all_squash #屏蔽所有远程用户的权限
    no_subtree_check #此选项可防止子树检查

    3、运行导出

    exportfs -a

     可以使用-r刷新

    exportfs -r

    4、开启端口

    /sbin/iptables -I INPUT -p tcp -s 192.168.1.100 --dport 111 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp -s 192.168.1.100 --dport 2049 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp -s 192.168.1.100 --dport 30001 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp -s 192.168.1.100 --dport 30002 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp -s 192.168.1.100 --dport 30003 -j ACCEPT
    /sbin/iptables -I INPUT -p tcp -s 192.168.1.100 --dport 30004 -j ACCEPT

    5、启动nfs和rpc服务

    service nfs-server start
    service rpcbind start

    客户端安装nfs

    1、安装nfs

    yum install nfs-utils -y

    2、使用mount远程共享

    mount -t nfs 192.168.1.100:/home /home

    到此完成。


    如果要把home链接到别的目录,可以使用例如如下命令:

    ln -s /home /root/home

    取消挂载可以使用命令:

    umount -t nfs 192.168.1.100:/home

    挂载开机启动可以使用如下方式

    1、编辑

    vim /etc/fstab

    2、加入代码

    192.168.1.100:/home /home nfs defaults 0 0

    查看NFS共享,可以使用命令:

    showmount -e 192.168.1.100
  • 相关阅读:
    ubuntu 安装(install) pwntcha[一个做"验证码识别"的开源程序]
    MySQL 二进制日志过滤
    MySQL 分区表各个分区的行数
    MySQL 表分区A
    MySQL show binglog event in 'log_name'
    MySQL、You are using safe update mode
    SQL 设计心得、逗号分隔列表
    MYSQL @、@@、@x
    SQL Server
    建设供内网访问的网站
  • 原文地址:https://www.cnblogs.com/HD/p/5977163.html
Copyright © 2011-2022 走看看