centos7 ——————> centos8
(nfs server) (nfs client)
다른 사용자와 공유할 수 있는 디렉토리 생성
[centos7 - nfs server]
[root@srv7 0720]# mkdir /public
접근 제어
[centos7 - nfs server]
[root@srv7 0720]# chmod 777 /public
[root@srv7 0720]# ls -l /
total 28
...
drwxrwxrwx. 2 root root 6 Jul 20 15:11 public
...
chmod 777 : rwxrwxrwx, 모두가 읽기,쓰기,실행 가능
파일 하나 생성 해두기
[centos7 - nfs server]
# 파일 하나 만들어두기
[root@srv7 0720]# touch /public/test.txt
centos7,8 모두 nfs-utils 설치
yum -y install nfs-utils
파일 내용 추가
[centos7 - nfs server]
[root@srv7 0720]# vi /etc/exports
파일 내용
/public 211.183.3.0/24(rw,sync,no_root_squash)
nfs-server 시작
restart : 지금 재시작
enable : 시작 시 nfs-server 켜지도록 함
[centos7 - nfs server]
[root@srv7 0720]# systemctl restart nfs-server
[root@srv7 0720]# systemctl enable nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
mount하기
[centos8 - nfs client]
# 해당 IP에서 현재 외부에 노출하고 있는 디렉토리를 보여줘
[root@srv8 ~]# showmount -e 211.183.3.201
Export list for 211.183.3.201:
/public 211.183.3.0/24
# 211.183.3.201에 있는 /public을 내 /remote와 mount
[root@srv8 ~]# mkdir /remote
[root@srv8 ~]# mount -t nfs 211.183.3.201:/public /remote
[root@srv8 ~]# ls /remote
test.txt
[root@srv8 ~]# echo "hello" > /remote/test.txt
[centos7 - nfs server]
[root@srv7 0720]# cat /public/test.txt
hello