Develop/기타 작업
Ubuntu nfs server 구축
팡연
2025. 6. 10. 00:11
반응형
1. nfs 를 구성할 서버에 아래 명령어 수행
# 1. nfs-kernel-server 설치
$ apt install nfs-kernel-server
# 2. nfs 폴더 생성 경로는 마음대로 가능
$ mkdir -p /mnt/nfs/share
# 3. 권한 설정
$ chown nobody:nogroup /mnt/nfs/share
$ chmod 755 /mnt/nfs/share
# 4. 설정 구성
$ vi /etc/exports
nfs폴더경로 마운트할IP대역(rw,sync,no_subtree_check)
## 예시
/mnt/nfs/share 192.1.1.0/24(rw,sync,no_subtree_check)
# 5. 적용
$ exportfs -a
$ systemctl restart nfs-kernel-server
2. nfs 를 사용할 서버에 아래 명령어 수행
# 1. nfs-common 설치
$ apt install nfs-common
# 2. 마운트할 폴더 생성 마음대로 생성 가능
$ mkdir -p /mnt/nfs/share
# 3. 마운트 수행
$ mount -t nfs 192.1.1.1:/mnt/nfs/share /mnt/nfs/share
해당 폴더에 임시로 파일 생성하면 공유할 수 있는 것을 확인 가능하다.
root@192.168.1.1:/mnt/nfs/share# ls
test
root@192.168.1.2:/mnt/nfs/share# ls
test
반응형