【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. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-10 15:04:03       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-10 15:04:03       71 阅读
  3. 在Django里面运行非项目文件

    2024-07-10 15:04:03       58 阅读
  4. Python语言-面向对象

    2024-07-10 15:04:03       69 阅读

热门阅读

  1. 关于ppmlhdfe和possion两个命令回归显示观测值不同

    2024-07-10 15:04:03       21 阅读
  2. WPF中逻辑树和视觉树

    2024-07-10 15:04:03       27 阅读
  3. 微信小程序-组件样式隔离

    2024-07-10 15:04:03       25 阅读
  4. DangerWind-RPC-framework---一、服务注册与发现

    2024-07-10 15:04:03       24 阅读
  5. spring监听事件

    2024-07-10 15:04:03       25 阅读
  6. 网络基础——udp协议

    2024-07-10 15:04:03       20 阅读
  7. Python从Excel表中查找指定数据填入新表

    2024-07-10 15:04:03       21 阅读
  8. 数据库和缓存基础(mysql,redis等)

    2024-07-10 15:04:03       19 阅读