【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
相关推荐
likfishdn8 分钟前
Linux的文件与目录管理
linux·运维·服务器
渲染101专业云渲染10 分钟前
川翔云电脑优势总结
服务器·3d·电脑·blender·maya
chian-ocean28 分钟前
Linux 文件缓冲区:高效数据访问的幕后推手
linux·运维·服务器
加油=^_^=30 分钟前
【Linux】进程优先级 | 进程调度(三)
linux·运维·服务器
橘子味的茶二39 分钟前
高级系统架构师--第十章:计算机网络
服务器·计算机网络·系统架构
吃汤圆的抹香鲸1 小时前
GoLand 安装包 绿色版 Win,Mac,Linux 包含IntelliJ全家桶 专为Go语言设计的集成开发环境(IDE)
linux·windows·macos·go·intellij-idea·go1.19
紫菜(Nori)1 小时前
短连接服务器压测-wrk
服务器·压力测试
追寻光1 小时前
Cannot find a valid baseurl for repo: base/7/x86_64
linux
元气满满的热码式1 小时前
Docker数据卷操作实战
linux·运维·docker·云原生·容器
陆沙1 小时前
deepseek-r1-centos-本地服务器配置方法
linux·服务器·centos