RHCE——第三次作业

架设一台NFS服务器,并按照以下要求配置
1、开放/nfs/shared目录,供所有用户查询资料
2、开放/nfs/upload目录,为192.168.xxx.0/24网段主机可以上传目录,
并将所有用户及所属的组映射为nfs-upload,其UID和GID均为210
3、将/home/tom目录仅共享给192.168.xxx.xxx这台主机,并只有用户tom可以完全访问该目录

一、服务器:

[root@localhost ~]#yum install rpcbind
OS                                                 2.2 kB/s | 1.9 kB     00:00
everything                                         2.6 kB/s | 1.9 kB     00:00
EPOL                                               4.3 kB/s | 1.9 kB     00:00
debuginfo                                          4.0 kB/s | 2.2 kB     00:00
source                                             4.1 kB/s | 2.2 kB     00:00
update                                             357  B/s | 1.9 kB     00:05
update-source                                      410  B/s | 2.2 kB     00:05
Package rpcbind-1.2.6-8.oe2309.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@localhost ~]# yum install nfs-utils
Last metadata expiration check: 0:00:13 ago on 2024年01月16日 星期二 08时48分47秒.
Package nfs-utils-2:2.6.2-4.oe2309.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
 
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl start nfs-server
 
[root@localhost ~]# mkdir /nfs/shared -pv
mkdir: 已创建目录 '/nfs'
mkdir: 已创建目录 '/nfs/shared'
[root@localhost ~]# mkdir /nfs/upload -pv
mkdir: 已创建目录 '/nfs/upload'
[root@localhost ~]# mkdir /home/tom -pv
mkdir: 已创建目录 '/home/tom'
 
[root@localhost ~]# exportfs -r

二、客户端:

[root@localhost ~]#yum install rpcbind
OS                                                 2.2 kB/s | 1.9 kB     00:00
everything                                         2.6 kB/s | 1.9 kB     00:00
EPOL                                               4.3 kB/s | 1.9 kB     00:00
debuginfo                                          4.0 kB/s | 2.2 kB     00:00
source                                             4.1 kB/s | 2.2 kB     00:00
update                                             357  B/s | 1.9 kB     00:05
update-source                                      410  B/s | 2.2 kB     00:05
Package rpcbind-1.2.6-8.oe2309.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@localhost ~]# yum install nfs-utils
Last metadata expiration check: 0:00:13 ago on 2024年01月16日 星期二 09时01分21秒.
Package nfs-utils-2:2.6.2-4.oe2309.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
 
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl start nfs-server
 
[root@localhost ~]# mkdir /nfs/shared -pv
mkdir: 已创建目录 '/nfs'
mkdir: 已创建目录 '/nfs/shared'
[root@localhost ~]# mkdir /nfs/upload -pv
mkdir: 已创建目录 '/nfs/upload'
[root@localhost ~]# mkdir /home/tom -pv
mkdir: 已创建目录 '/home/tom'
 
[root@localhost ~]# exportfs -r

[rootalocalhost ~]# yum install -y nfs-utils -Y
OS
everything
EPOL
debuginfo
source
update
update-source
Package nfs-utils-2:2.6.2-4.02309.x86 64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
[root@localhost ~]#mkdir /nfs
[root@localhost ~]# mkdir /nfs/shared
[rootalocalhost ~]#mkdir /nfs/upload
[rootalocalhost ~]# mount 192.168.159.134: /nfs/shard /nfs/shared
Created symlink /run/systemd/system/remote-fs.target.wants/rpc-statd.service-/usr
mount.nfs: access denied by server while mounting 192.168.159.134:/nfs/shard
[rootalocalhost ~]# mount 192.168.159.134:/nfs/upload /nfs/upload
[rootalocalhost ~]# mount 192.168.159.134:/home/tom /nfs/tom

你可能感兴趣的:(服务器,linux,网络)