-
[REDHAT] 리눅스(RHEL8) NFS 구축 및 마운트LINUX 2022. 12. 27. 14:03
1. NFS 서버 구축
* 서비스 설치
# 기존에 설치된지 여부 확인 > rpm -qa|grep nfs-utils # nfs 플러그인 설치 > yum install nfs-utils -y # nfs 서비스 기동 > systemctl start nfs-server.service > systemctl enable nfs-server.service > systemctl status nfs-server.service # 서비스의 포트와 프로토콜 확인 > rpcinfo -p | grep nfs
* 공유 폴더 생성
> mkdir -p /share # 공유폴더 권한 및 소유자 변경 > chown -R nobody: /share > chmod -R 777 /share > systemctl restart nfs-server.service
* exports 파일 생성
> vi /etc/exports # 공유폴더 접근아이피(옵션) /share 192.168.0.0(rw,sync,no_all_squash,root_squash) # exports 적용 > exportfs -arv > exportfs -s
* 방화벽 해제
> firewall-cmd --permanent --add-service=nfs > firewall-cmd --permanent --add-service=rpc-bind > firewall-cmd --permanent --add-service=mountd > firewall-cmd --permanent -reload
- 사용 포트
포트번호 프로토콜 용도 111 TCP/UDP portmapper 2049 TCP/UDP nfsd random TCP/UDP mountd random TCP/UDP nlockmgr random TCP/UDP status 2. Client 마운트
* 플러그인 설치
> yum install nfs-utils nfs4-acl-tools -y
* nfs 서버의 공유폴더 확인
: 폴더가 보여야 정상
> showmount -e nfs서버ip
* 마운트 할 폴더 생성
> mkdir -p /data/resources
* 마운트 섹션 네임 추가
: https://www.linuxquestions.org/questions/slackware-14/nfs-ignoring-line-due-to-no-section-872750/
> vi /etc/nfsmount.conf # 섹션 네임 추가 [NFSMount_Global_Options] [NFSMount_Global_Options] Defaultvers=3
* 마운트 연결
- 마운트 버전 이슈 : https://stackoverflow.com/questions/39347489/mount-nfs-requested-nfs-version-or-transport-protocol-is-not-supported
> mount -t nfs -o vers=3 nfs서버아이피:/NAS서버폴더 /연결할클라이언트의폴더 # 마운트 확인 > mount | grep -i nfs
- 마운트에 실패 했을때 상세 로그 확인
> # mount -t nfs -vvvv nfs서버아이피:/NAS서버폴더 /연결할클라이언트의폴더 mount.nfs: timeout set for Fri Mar 9 17:56:57 2018 mount.nfs: trying text-based options 'vers=4.1,addr=x.x.x.x,clientaddr=x.x.x.x' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'vers=4.0,addr=x.x.x.x,clientaddr=x.x.x.x' mount.nfs: mount(2): Protocol not supported mount.nfs: trying text-based options 'addr=x.x.x.x' mount.nfs: prog 100003, trying vers=3, prot=6 mount.nfs: trying x.x.x.x prog 100003 vers 3 prot TCP port 2049 mount.nfs: prog 100005, trying vers=3, prot=17 mount.nfs: trying x.x.x.x prog 100005 vers 3 prot UDP port 300 mount.nfs: mount(2): Permission denied mount.nfs: access denied by server while mounting server.example.com:/share
* 마운트 영구 적용
: 미적용시 재부팅 하면 마운트 해제 됨
> vi /etc/fstab nfs서버아이피:/공유폴더 /로컬마운트폴더 nfs defaults 0 0
* 참고 영상
: https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=kostry&logNo=220858347189
'LINUX' 카테고리의 다른 글
[SSL] SSL 만료일 체커 (feat. Github) (0) 2023.06.07 [보안] CentOS7의 OS 보안조치 (0) 2023.01.09 [LINUX] CPU, 메모리 모니터링 Logger 스크립트 (0) 2022.11.28