NFS服务器搭建
- 开放/nfs/shared目录,供所有用户查阅资料
- 开放/nfs/upload目录为172.16.12.0、24网段的数据上传目录,并将所有用户及所属的用户组都映射为nfs-upload,其UID与GID均为300
1:rpm没有安装包的先下载nfs-utils安装包安装,nfs的安装和启动
安装软件包:yum -y install nfs-utils
启动nfs服务:systemctl start rpcbind nfs-server
查看一下服务进程启动没有;
[root@tmq ~]# ss -antl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 :111 : LISTEN 0 128 :20048 :
LISTEN 0 128 :22 : LISTEN 0 100 127.0.0.1:25 : LISTEN 0 128 :58651 :
LISTEN 0 64 :38560 : LISTEN 0 64 :2049 :
LISTEN 0 128 :::41899 ::: LISTEN 0 128 :::111 :::
LISTEN 0 128 :::20048 ::: LISTEN 0 128 :::22 :::
LISTEN 0 100 ::1:25 ::: LISTEN 0 64 :::46558 :::
LISTEN 0 64 :::2049 ::😗
查看到111和2049就可以确定服务器启动了。
2:编辑etc/exportfs
[root@tmq ~]# vim /etc/exports
/nfs/public *(ro)
/nfs/upload 172.16.12.0/24(rw,all_squash,anonuid=300,anongid=300)
systemctl stop firewalld.service 关闭防火墙
3:映射nfs-upload
[root@tmq ~]# id nfs-upload
uid=300(nfs-upload) gid=300(nfs-upload) 组=300(nfs-upload)
[root@tmq ~]# mount localhost:/nfs/upload /upload
4:检查是否配置成功
[root@tmq ~]# showmount -e
/nfs/public *
/nfs/upload 172.16.12.0/24