【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
相关推荐
小苹果13571 小时前
阿里云mysql数据丢失,如何通过服务器备份在其他服务器上恢复数据,并获取mysql丢失数据,完成mysql数据恢复
服务器·mysql·阿里云
许白掰1 小时前
Linux入门篇学习——Linux 工具之 make 工具和 makefile 文件
linux·运维·服务器·前端·学习·编辑器
hrrrrb2 小时前
【TCP/IP】12. 文件传输协议
服务器·网络·tcp/ip
安全系统学习5 小时前
网络安全之RCE分析与利用详情
服务器·网络·安全·web安全·系统安全
longze_75 小时前
Ubuntu连接不上网络问题(Network is unreachable)
linux·服务器·ubuntu
Dirschs5 小时前
【Ubuntu22.04安装ROS Noetic】
linux·ubuntu·ros
qianshanxue115 小时前
ubuntu 操作记录
linux
风吹落叶花飘荡7 小时前
2025 Next.js项目提前编译并在服务器
服务器·开发语言·javascript
AmosTian8 小时前
【系统与工具】Linux——Linux简介、安装、简单使用
linux·运维·服务器