구축 방법
NFS 관련 패키지 설치
[root@server ~]# yum -y install nfs-utils
공유 디렉터리 생성
[root@server ~]# mkdir -p /test/jmserver
[root@server ~]# chmod 775 /test/*
[root@server ~]# ls -l /test/
total 0
drwxrwxr-x. 2 user1 nfsgroup 6 Apr 16 23:41 jmserver
exports 파일 작성
[root@server ~]# vi /etc/exports
/test/jmserver 192.168.10.*(rw,all_squash,sync)
exports 변경사항 적용
[root@server ~]# exportfs -r
nfs 방화벽 및 포트 추가
[root@server ~]# firewall-cmd --permanent --zone=public --add-service=nfs
[root@server ~]# firewall-cmd --permanent --zone=public --add-port=2049/tcp
[root@server ~]# firewall-cmd --permanent --zone=public --add-port=111/tcp
[root@server ~]# firewall-cmd --reload
port mapper 변경 후 방화벽 등록
[root@localhost ~]# showmount -e 192.168.10.1
clnt_create: RPC: Port mapper failure - Unable to receive: errno 113 (No route to host)
조치방법 : 포트번호를 고정시켜주고 해당 포트 4001/tcp, 4001/udp, 4002/tcp, 4002/udp, 4003/tcp 4003/udp, 4004/tcp, 4004/udp 방화벽 추가
[root@server ~]# vi /etc/sysconfig/nfs
LOCKD_TCPPORT=4001 << 각항목 포트번호 변경
LOCKD_UDPPORT=4001
MOUNTD_PORT=4002
STATD_PORT=4003
[root@server ~]# vi /etc/services
rquotad 4004/tcp # rquota daemon << 4004로 변경
rquotad 4004/udp # rquota daemon
NFS 서비스 시작 및 등록
[root@server ~]# systemctl restart nfs-server
[root@server ~]# systemctl restart rpc-bind
[root@server ~]# systemctl restart nfs-lock
[root@server ~]# systemctl restart nfs-idmap
[root@server ~]# systemctl enable nfs-server
[root@server ~]# systemctl enable rpc-bind
[root@server ~]# systemctl enable nfs-lock
[root@server ~]# systemctl enable nfs-idmap
client 마운트 디렉터리 생성 및 마운트
[root@client ~]# mkidr /mnt/nfs
[root@client ~]# mount -t nfs 192.168.10.1:/test/jmserver /mnt/nfs
[root@client ~]# vi /etc/fstab
192.168.10.1:/test/jmserver /mnt/nfs nfs defaults 0 0
[root@client ~]# umount -a
[root@client ~]# mount -a