Configuración del proyecto NFS

Requisitos del proyecto:
dos clientes, un servidor
Dos clientes instalan Apache, la instalación del servidor necesita instalar paquetes de software rpcbind y nfs

Proceso del proyecto
Instalar el servidor apache en dos clientes instalar nfs

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

Instale nfs-utils en cliente 1
Inserte la descripción de la imagen aquí
cliente 2
Inserte la descripción de la imagen aquí
servidor

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

Inserte la descripción de la imagen aquí

Crea un directorio compartido

[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

Inserte la descripción de la imagen aquí
Inserte la descripción de la imagen aquí
Inserte la descripción de la imagen aquí

Comienza el servicio

[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     服务开启

Inserte la descripción de la imagen aquí

Ver el directorio compartido de NFS publicado por la máquina

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

Ver el contenido compartido del servidor NFS en cada
cliente Cliente 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

Inserte la descripción de la imagen aquí
Inserte la descripción de la imagen aquí

Cliente 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

Inserte la descripción de la imagen aquí
Inserte la descripción de la imagen aquí

El cliente puede acceder a la página HTML abriendo el servicio web

[root@kh1 ~]# systemctl start httpd

Página web del cliente para realizar pruebas

http://localhost

Inserte la descripción de la imagen aquí
Inserte la descripción de la imagen aquí

Supongo que te gusta

Origin blog.csdn.net/weixin_49343462/article/details/109516317
Recomendado
Clasificación