# openEuler如何搭建nfs服务

openEuler如何搭建nfs服务

现象描述:

在openEuler上搭建nfs服务

定位思路:

yum直接安装即可

处理步骤:

分别查看:

服务端:

[root@localhost ooo]# yum install nfs-utils rpcbind -y
[root@localhost ooo]# vim /etc/exports
/ooo/ 192.168.137.0/24(rw,sync,no_root_squash,no_all_squash)
IP这里要么只填*,也就是任意服务器都可以挂载服务器共享盘,要么就填指定网段加掩码形式才可以。
[root@localhost ooo]# systemctl restart nfs
● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
   Active: active (exited) since Tue 2022-11-08 16:38:38 CST; 1min 4s ago
  Process: 10343 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
  Process: 10344 ExecStart=/usr/sbin/rpc.nfsd (code=exited, status=0/SUCCESS)
 Main PID: 10344 (code=exited, status=0/SUCCESS)

11月 08 16:38:38 localhost.localdomain systemd[1]: Starting NFS server and services...
11月 08 16:38:38 localhost.localdomain exportfs[10343]: exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export >
11月 08 16:38:38 localhost.localdomain exportfs[10343]:   Assuming default behaviour ('no_subtree_check').
11月 08 16:38:38 localhost.localdomain exportfs[10343]:   NOTE: this default has changed since nfs-utils version 1.0.x
11月 08 16:38:38 localhost.localdomain systemd[1]: Started NFS server and services.

客户端:

[root@centos-01 ~]# yum install nfs-utils -y
[root@centos-01 ~]# mount -t nfs 192.168.137.16:/ooo /test/

再次查看客户端:

[root@centos-01 ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root  187G   14G  164G   8% /
devtmpfs                 3.9G     0  3.9G   0% /dev
tmpfs                    3.9G     0  3.9G   0% /dev/shm
tmpfs                    3.9G  9.0M  3.9G   1% /run
tmpfs                    3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                494M  138M  356M  28% /boot
tmpfs                    783M     0  783M   0% /run/user/0
192.168.137.16:/ooo       47G  2.2G   42G   5% /test

OK!

参考信息:

2 Likes

如果拿openEuler作为家庭服务器的发行版,是否可行?

1 Like

理论上可行,但需要安装其他软件才能可以