CE查询资料与上传资料

一、开放/nfs/shared目录,供所有用户查询资料;

(一)服务器

1、创建/nfs/shared目录

[root@localhost ~]# mkdir -pv /nfs/shared
mkdir: created directory '/nfs'
mkdir: created directory '/nfs/shared'

2、配置文件

[root@localhost ~]vim /etc/exports
#在exports中写入以下配置文件
/data 192.168.228.135 (rw)
/nfs/shared *(ro)

3、重启nfs

[root@localhost ~]# systemctl restart nfs-server.service

4、showmount查看信息

[root@localhost ~]# showmount -e 192.168.228.130
Export list for 192.168.228.130:
/nfs/shared *
/data       (everyone)
(二)客户端

1、showmount查看信息

[root@localhost ~]# showmount -e 192.168.228.130
Export list for 192.168.228.130:
/nfs/shared *
/data       192.168.228.135

2、创建挂载点目录

[root@localhost ~]# mkdir -p /nfsclient/client-data/

3、挂载

[root@localhost ~]# mount 192.168.228.130:/nfs/shared /nfsclient/client-data/

4、查看挂载信息

[root@localhost ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     846M     0  846M   0% /dev
tmpfs                        875M     0  875M   0% /dev/shm
tmpfs                        350M  9.6M  341M   3% /run
/dev/nvme0n1p2                15G  4.0G   12G  27% /
/dev/nvme0n1p1               495M  246M  250M  50% /boot
tmpfs                        175M   92K  175M   1% /run/user/0
/dev/sr0                     8.0G  8.0G     0 100% /run/media/root/RHEL-9-0-0-BaseOS-x86_64
192.168.228.130:/nfs/shared   40G  9.2G   31G  23% /nfsclient/client-data

5、客户端测试

[root@localhost ~]# cd /nfsclient/client-data/
[root@localhost client-data]# ll
total 4
-rw-r--r--. 1 root root 13 Nov 18 20:15 file
[root@localhost client-data]# cat file
this is file

二、开放/nfs/upload目录,供所有用户上传下载资料;

(一)服务器

1、创建/nfs/upload目录

[root@localhost ~]# mkdir -pv /nfs/upload
mkdir: created directory '/nfs/upload'

2、配置文件

vim /etc/exports
#在exports中写入以下配置文件
/data 192.168.228.130 (rw)
/nfs/shared *(ro)
/nfs/upload *(rw)

3、重启nfs

[root@localhost ~]# systemctl restart nfs-server.service

4、showmount查看信息

[root@localhost ~]# showmount -e 192.168.228.130
Export list for 192.168.228.130:
/nfs/upload *
/nfs/shared *
/data       192.168.228.135

5、配置权限

#查看权限
[root@localhost ~]# ll -d /nfs/upload
drwxr-xr-x. 2 root root 6 Nov 18 19:00 /nfs/upload
#配置权限
[root@localhost ~]# chmod o+w /nfs/upload/
[root@localhost ~]# ll -d /nfs/upload
drwxr-xrwx. 2 root root 6 Nov 18 19:00 /nfs/upload
(二)客户端

1、showmount查看信息

[root@localhost ~]# showmount -e 192.168.228.130
Export list for 192.168.228.130:
/nfs/upload *
/nfs/shared *
/data       192.168.228.135

2、创建挂载点目录

[root@localhost ~]# mkdir -pv /nfsclient/upload
mkdir: created directory '/nfsclient/upload'

3、挂载

[root@localhost ~]# mount 192.168.228.130:/nfs/upload /nfsclient/upload/

4、查看挂载信息

[root@localhost ~]# df -h
Filesystem                   Size  Used Avail Use% Mounted on
devtmpfs                     846M     0  846M   0% /dev
tmpfs                        875M     0  875M   0% /dev/shm
tmpfs                        350M  9.6M  341M   3% /run
/dev/nvme0n1p2                15G  4.0G   12G  27% /
/dev/nvme0n1p1               495M  246M  250M  50% /boot
tmpfs                        175M   92K  175M   1% /run/user/0
/dev/sr0                     8.0G  8.0G     0 100% /run/media/root/RHEL-9-0-0-BaseOS-x86_64
192.168.228.130:/nfs/shared   40G  9.2G   31G  23% /nfsclient/client-data
192.168.228.130:/nfs/upload   40G  9.2G   31G  23% /nfsclient/upload

5、客户端测试

[root@localhost ~]# cd /nfsclient/upload/
[root@localhost upload]# ll
total 0
[root@localhost upload]# touch file
[root@localhost upload]# ll
total 0
-rw-r--r--. 1 nobody nobody 0 Nov 18 19:12 file

猜你喜欢

转载自blog.csdn.net/Zombie_QP/article/details/127932804
今日推荐