【RHCE】NFS 实验

主服务器

下载nfs-utils软件包:

1.如果停⽌该服务,启动并启⽤该服务: systemctl enable - now rpcbind

2.要启动 NFS 服务器,并使其在引导时⾃动启动:systemctl enable - now nfs- server
3.配置防火墙,开启服务:

复制代码
[root@localhost ~]# firewall-cmd --permanent --add-service=nfs
success
[root@localhost ~]# firewall-cmd --permanent --add-service=mo
untd
success
[root@localhost ~]# firewall-cmd --permanent --add-service=rpc-bind
success
[root@localhost ~]# firewll-cmd --reload
[root@localhost ~]# firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens160
  sources: 
  services: cockpit dhcpv6-client dns http mountd nfs rpc-bind ssh
  ports: 
  protocols: 
  forward: yes
  masquerade: no
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# cat /etc/exports
/data 192.168.244.137(rw)
[root@localhost ~]# systemctl restart nfs-server
[root@localhost ~]# showmount -e 192.168.244.130
Export list for 192.168.244.130:
[root@localhost ~]# vim /etc/exports
[root@localhost ~]# chmod 777 /data
[root@localhost ~]# systemctl restart nfs-server
[root@localhost ~]# showmount -e 192.168.244.130
Export list for 192.168.244.130:
/data *

从服务器:(访问主服务器的内容并且建立自动挂载)

复制代码
[root@openEuler ~]# showmount -e 192.168.244.130
Export list for 192.168.244.130:
/data *
[root@openEuler ~]# mkdir /nfsclient/client-data/ -p
[root@openEuler ~]# mount 192.168.244.130:/data /nfsclient/client-data/
[root@openEuler ~]# df -h /nfsclient/client-data/
Filesystem             Size  Used Avail Use% Mounted on
192.168.244.130:/data   70G  6.9G   64G  10% /nfsclient/client-data
[root@openEuler ~]# cd /nfsclient/client-data/
[root@openEuler client-data]# ll
total 0
-rw-r--r--. 1 root root 0 Jul 10  2024 testfile
[root@openEuler client-data]# touch caicaikan
[root@openEuler client-data]# ll
total 0
-rw-r--r--. 1 nobody nobody 0 Jul 10  2024 caicaikan
-rw-r--r--. 1 root   root   0 Jul 10  2024 testfile
[root@openEuler client-data]# vim /etc/fstab

#重启
[root@openEuler ~]# df -h /nfsclient/client-data/
Filesystem             Size  Used Avail Use% Mounted on
192.168.244.130:/data   70G  6.9G   64G  10% /nfsclient/client-data
相关推荐
实心儿儿1 天前
Linux —— 库的制作和原理(3)
linux·运维·服务器
yyuuuzz1 天前
独立站部署的几个常见技术问题
运维·服务器·网络·云计算·aws
十子木1 天前
linux 安装claude code
linux
hzxpaipai1 天前
网站建设哪家好?从性能、后台和运维看派迪科技的建站思路
运维·科技
a珍爱上了a强1 天前
配置uboot启动参数,linux启动过程打印每个模块初始化的耗时时间
linux·运维·服务器
程序员老舅1 天前
深入底层:Linux MMU 工作原理全解
linux·服务器·网络·c++·linux内核·内存管理·linux内存
dishugj1 天前
SAP HANA数据库文件目录说明
服务器·数据库·oracle
OCR_133716212751 天前
技术解析:护照OCR查验核心逻辑,跨境身份核验的技术实现路径
大数据·运维·人工智能
CQU_JIAKE1 天前
5.7[Q]
linux·运维·服务器
坤盾科技1 天前
Docker 离线地图服务器搭建实战:Node.js + OpenLayers + MBTiles
linux·javascript·arcgis·docker·node.js