nfs linux 云计算 python 文件共享

关于nfs加密    这个要在实际环境中应用   需要认证   咱们完成不了这个实验   红帽考试题当中可以实现

两台主机    需要ping通

主机1     192.168.2.10   server

主机2     192.168.2.20   client

server

[root@localhost ~]# rpm -q nfs-utils

nfs-utils-1.3.0-0.54.el7.x86_64

[root@localhost ~]# rpm -q rpcbind

rpcbind-0.2.0-44.el7.x86_64

yum  -y  install   nfs-utils     rpcbind

创建共享目录

[root@localhost ~]# mkdir /haha

[root@localhost ~]# chmod 777 /haha/

修改配置文件

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

随意选择一种

/haha *(rw)   #所有主机都有访问的权限

/haha 192.168.2.0/24(rw)   #对该网段的主机有访问的权限

/haha 192.168.2.20(rw)  client的ip #对指定192.168.2.20这个主机有访问权限

[root@localhost ~]# systemctl restart nfs

[root@localhost ~]# systemctl enable nfs   #加入开机自启    在公司里面需要把搭建的服务加入开机自启

服务端进行自检

[root@localhost ~]# showmount -e

Export list for localhost.localdomain:

/haha 192.168.2.20

client

[root@localhost ~]# showmount -e 192.168.2.10  #服务端的ip

clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)这个是因为没有放行防火墙

server

[root@localhost ~]# firewall-cmd --add-service=nfs --permanent

success

[root@localhost ~]# firewall-cmd --add-service=rpc-bind --permanent

success

[root@localhost ~]# firewall-cmd --add-service=mountd --permanent

success

[root@localhost ~]# firewall-cmd --reload

success

client

[root@localhost ~]# showmount -e 192.168.2.10

Export list for 192.168.2.10:

/haha 192.168.2.20

[root@localhost ~]# mkdir /test

[root@localhost ~]# mount -t nfs 192.168.2.10:/haha /test   #临时挂载

[root@localhost ~]# df -hT

192.168.2.10:/haha      nfs4       37G  4.0G   34G   11% /test

验证:

server 创建文件

[root@localhost ~]# cd /haha/

[root@localhost haha]# touch sunchao

[root@localhost haha]# ls

sunchao

查看client是否存在

[root@localhost ~]# cd /test/

[root@localhost test]# ls

sunchao

自动挂载     

[root@localhost test]# vim /etc/fstab

192.168.2.10:/haha  /test       nfs4    defaults 0 0   

卸载

[root@localhost test]# cd

[root@localhost ~]# umount 192.168.2.10:/haha

[root@localhost ~]# df -hT

使用自动挂载挂载一遍

[root@localhost ~]# mount -a

[root@localhost ~]# df -hT

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据库从删库到跑路

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值