한님폐하 2022. 9. 12. 10:37
  • TCP 2049번 포트를 이용한다.

 

1. NFS 패키지 설치와 활성화

yum -y install nfs-utils
rpm -qa nfs-utils
rpm -ql nfs-utils | egrep -v '/usr/lib/|/man/|/doc/'
systemctl enable --now nfs-server
systemctl status nfs-server

 

2. NFS 서비스 관련 정보 확인

cat /etc/services | grep 2049			# 포트 정보 확인
systemctl list-dependencies nfs-server		# 의존성 확인
ps -ef | egrep 'rpc.|nfs' | egrep -v grep	# 프로세스 정보 확인

 

3. NFS 구성

  • /etc 디렉토리에 있는 'exports' 파일을 이용하여 NFS 공유 관련 설정을 실시한다.
vi /etc/exports
/test/share1    192.168.2.201(rw)
/test/share2    192.168.2.201(ro)
:wq

exportfs -a
exportfs -v
showmount -e

 

  • 클라이언트에서 마운트 디렉토리 생성 및 마운트를 실시한다.
mount -t nfs 192.168.2.200:/test/share1 /mnt/nfs1
mount -t nfs 192.168.2.200:/test/share2 /mnt/nfs2

 

  • '/etc/fstab' 파일에 마운트를 실시하여 재부팅 시에도 마운트 작업을 유지하도록 한다.
vi /etc/fstab
192.168.2.200:/test/share1  /mnt/nfs1           nfs     rw              0 0
192.168.2.200:/test/share2  /mnt/nfs2           nfs     ro              0 0
:wq
mount -a
df -h