본문 바로가기

Linux

nfs

1. 먼저 nfs 관련된 package 를 설치한다.

sudo apt-get install nfs-kernel-server nfs-common portmap

2. 공유하고자 하는 nfs 디렉토리를 만든다.

sudo mkdir /mukko/nfs-root
sudo chmod 777 /mukko/nfs-root
sudo chown nobody /mukko/nfs-root

3. /etc/exports 파일을 편집한다.
: /mukko/nfs-root 192.168.10.103(rw,no_root_squash,no_all_squash,async) 추가
여기서 형식은 "공유하고자 하는 디렉토리, 접속하고자하는 IP (속성)" 이 된다.
localhost 를 써준것은 nfs 데몬 띄우고 나서 제대로 동작하는지 테스트하기 위해 추가했다.

$ vi /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
#             to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes     hostname1(rw,sync) hostname2(ro,sync)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt)
# /srv/nfs4/homes gss/krb5i(rw,sync)
#
/mukko/nfs-root 192.168.10.103(rw,no_root_squash,no_all_squash,async)
/mukko/nfs-root localhost(rw,no_root_squash,no_all_squash,async)


3. 데몬을 재시작한다.

sudo /etc/init.d/nfs-kernel-server restart

4. 동작을 테스트해본다.

sudo mkdir ~/test-nfs
sudo mount localhost:/mukko/nfs-root ~/test-nfs
sudo cd ~/test-nfs
sudo mkdir aaa

디렉토리를 /mukko/nfs-root 로 변경해서 aaa 가 생겼는지 확인해본다.

sudo umount ~/test-nfs     : nfs 가 언마운트된다.

cf) server는 한번만 실행해 놓고 새로운 디렉토리가 추가되면 exportfs -r 만 해주면 된다.

sudo exportfs -r

'Linux' 카테고리의 다른 글

date  (0) 2013.09.26
ip  (0) 2013.09.26
ubuntu static ip setting  (0) 2013.09.26
NFS install in Ubuntu linux  (0) 2013.09.26
ubuntu + apm  (0) 2013.09.26