OS

2022.02.16 15:31

linux 환경에서 NFS 서비스 연동하기

  • 비아웹 오래 전 2022.02.16 15:31 인기
  • 3,790
    0

Linux 서버 환경에서 NFS 서비스 구성에 대해 기록합니다.

1. 테스트 환경

OS

CentOS 7

NFS 서버

192.168.20.27

NFS 클라이언트

192.168.20.

 

2. 프로그램 설치(Server / Client 공통)

yum install nfs-utils

 

3. 서버 설정

a. 폴더 생성 및 퍼미션

# mkdir /nfs ;NFS 공유 폴더 생성 # chmod 777 /nfs ; 일반 사용자도 해당 폴더 사용 가능

b. 공유 설정

root@NFS/]# cat /etc/exports ; NFS Client IP /nfs 192.168.20.*(rw,no_root_squash,sync)

c. 서비스 등록 및 구동

[root@NFS/]# systemctl enable rpcbind [root@NFS/]# systemctl enable nfs-server [root@NFS/]# systemctl start rpcbind [root@NFS/]# systemctl start nfs-server

4. 클라이언트 설정

a. 서비스 등록 및 구동

[root@Client ~]# systemctl enable rpcbind [root@Client ~]# systemctl start rpcbind

b. nfs 공유 확인

[root@Client ~]# showmount -e NFS_SERVER_IP

c. NFS mount 및 mount 확인

[root@Client ~]# mount -t nfs 192.168.20.27:/nfs /nfs_client [root@Client ~]# df -h

cf. 현재 NFS 서버에 기본 설정되어 있는 NFS version 4의 경우,

서버와 클라이언트의 사용자 계정 매칭이 되지 않을 경우, 소유자와 소유 그룹 맵핑에 문제가 발생하는 경우가 있습니다.

해당 케이스 예방책으로는 nfs mount 시 version 3를 사용하시기 바랍니다.

[root@Client ~]# mount -t nfs -o nfsvers=3 192.168.20.27:/nfs /nfs_client

서버 재부팅시에도 자동 구동되기를 원하시는 경우에는 /etc/fstab 또는 rc.local 에 설정 작업이 필요하심을 잊지 마시기 바랍니다.

 

감사합니다.

서버호스팅 비아웹

  • 공유링크 복사