NFS 서버 설정하기
ex)
10.0.0.100 - ( NFS Server)
10.0.0.200 - (Client Server)
1. NFS 패키지 설치(10.0.0.100)
$ yum install nfs-utils
2. 공유 디렉토리 생성하기
$ mkdir /SHARE
$ chmod 777 /SHARE
$ systemctl stop firewalld
$ systemctl disable firewalld
3. NFS 서버에서 공유할 디렉토리 등록하기
$ vi /etc/exports
{
/SHARE * (rw,sync,no_root_squash)
}
$ systemctl restart nfs-server
$ systemctl enable nfs-server
$ exportfs -v // 어떤 디렉토리를 공유하는지 확인
4. 이제 공유받을 리눅스 서버에 로그인 (10.0.0.200)
$ yum install nfs-utils
$ showmount -e {10.0.0.100}
$ mkdir /SHARE
$ mount -t nfs 10.0.0.100:/SHARE /SHARE
$ df -kh
5. 재부팅 후에도 nfs 마운트가 유지되기 위한 설정 (10.0.0.200)
$ vi /etc/fstab
{
10.0.0.100:/SAHRE /SAHRE nfs defaults 0 0
}
$ mount -a
6. autofs 설정하기
$ yum install autofs
$ systemctl start autofs
$ systemctl enable autofs
$ systemctl status autofs
$ vi /etc/auto.master.d/direct.autofs
{
/- /etc/auto.direct
}
$ vi /etc/auto.direct
{
/SHARE rw,sync 10.0.0.100:/SHARE
}
$ useradd -d /SHARE/home autouser
$ passwd autouser
$ su - autouser
[ indirect / direct 의 차이점 ]
- indirect 하면, 하위 디렉토리가 보이지 않는다.
- 그래서 직접적으로 해당 이름을 검색하거나 해당 이름으로 이동해야 보여진다.
$ ls -lh /SHARE
(indirect_test 디렉토리가 보이지 않음)
ex) ls -lh /SHARE/indirect_test (직접적으로 포인팅해야 보이게 됌)
ex) cd /SHARE/indirect_test
==> direct 로 설정 시, 숨겨져 있지 않고 NFS 공유 디렉토리가 전부 보임.