NFS项目配置

项目需求:
两台客户机,一台服务器
两台客户机安装Apache,服务器安装需要安装rpcbind和nfs软件包

项目流程
两台客户机上安装apache 服务器安装nfs

[root@kh1 ~]# yum -y install httpd

客户机1
在这里插入图片描述
客户机2
在这里插入图片描述
服务器上安装nfs-utils

[root@fw1 ~]# yum -y install nfs-utils

在这里插入图片描述

创建共享目录

[root@fw1 ~]# mkdir /opt/web1                         创建目录
[root@fw1 ~]# mkdir /opt/web2
[root@fw1 ~]# cd /opt/web1                               
[root@fw1 web1]# vi index.html                         网页编辑

<html><title>web1</title><body><h1>this is web1!!</h1></body></html>

[root@fw1 web1]# cp index.html /opt/web2        
[root@fw1 web1]# cd /opt/web2
[root@fw1 web2]# vi index.html

<html><title>web2</title><body><h1>this is web2!!</h1></body></html>

[root@fw1 web2]# cd

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

启动服务

[root@fw1 ~]# vi /etc/exports 
    
/opt/web1  20.0.0.10(ro)
/opt/web2  20.0.0.11(ro)

[root@fw1 ~]# systemctl start nfs         服务开启
[root@fw1 ~]# systemctl start rpcbind     服务开启

在这里插入图片描述

查看本机发布的NFS共享目录

[root@fw1 ~]# showmount -e
/opt/web2 20.0.0.11
/opt/web1 20.0.0.10

客户机上分别进行查看NFS服务器共享内容
客户机1

[root@kh1 ~]# showmount -e 20.0.0.12
/opt/web2 20.0.0.11
/opt/web1 20.0.0.10
进行挂载
[root@kh1 ~]# mount 20.0.0.12:/opt/web1 /var/www/html/
[root@kh1 ~]# df -Th
[root@kh1 ~]# cd /var/www/html/
[root@kh1 html]# ls -lh
[root@kh1 html]# vi index.html

在这里插入图片描述
在这里插入图片描述

客户机2

[root@kh2 ~]# showmount -e 20.0.0.12

/opt/web2 20.0.0.11
/opt/web1 20.0.0.10

[root@kh2 ~]# mount 20.0.0.12:/opt/web2 /var/www/html/
[root@kh2 ~]# df -Th
[root@kh2 ~]# cd /var/www/html/
[root@kh2 html]# ls -lh
[root@kh2 html]# vi index.html

在这里插入图片描述
在这里插入图片描述

客户机开启网页服务即可访问HTML页面

[root@kh1 ~]# systemctl start httpd

客户机网页进行测试

http://localhost

在这里插入图片描述
在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值