NFS 서버 설치 하기

1.    크로스 컴파일 및 설치

1.1  libtirpc-0.2.3

$ CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi --prefix=/home/no1no1no1/temp/nfs

$ make

$ make install

 

1.2 rpcbind-0.2.0

$ cp /home/no1no1no1/temp/nfs/lib/lib* (rpcbind src폴더) // 복사

$ cp -r /home/no1no1no1/temp/nfs/include/tirpc (rpcbind src폴더) // 복사

$ CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi --prefix=/home/no1no1no1/temp/nfs

$ make

$ make install

 

1.3 pkg-config-0.28

$ CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi --prefix=/home/no1no1no1/temp/nfs --docdir=/home/no1no1no1/temp/nfs/share/doc/pkg-config-0.28 --with-internal-glib --disable-host-tool

$ CC=arm-none-linux-gnueabi-gcc ./configure --host=arm-none-linux-gnueabi --prefix=/home/no1no1no1/temp/nfs --disable-host-tool

$ make

$ make install

 

1.4 nfs-utils-1.2.7

$ CC=arm-none-linux-gnueabi-gcc CFLAGS="-I/home/no1no1no1/temp/nfs/include" LDFLAGS=-L/home/no1no1no1/temp/nfs/lib ./configure --host=arm-none-linux-gnueabi --prefix=/home/no1no1no1/temp/nfs --disable-nfsv4 --disable-nfsv41 --disable-gss --without-tcp-wrappers

$ make

$ make install

 

 

2.    Linux설정

2.1 Linux kernel 설정

- Kernel Menuconfig

+ File systems ---> [*]Netwok File Systems ---> <*> NFS server support - [*] NFS server support for NFS version 3

 

3.     Root Filesystem  환경 설정

3.1서버 환경설정

/etc/sysconfig/nfs-server 파일을 만들어 주고 내용을 다음과 같이 작성

PORT="2049"

PROCESSES="8"

QUOTAS="no"

KILLDELAY="10"

 

3.2 rpcbind 환경설정

/etc/netconfig 파일을 만들어 주고 내용을 다음과 같이 작성

#

# The network configuration file. This file is currently only used in

# conjunction with the TI-RPC code in the libtirpc library.

#

# Entries consist of:

#

#       <network_id> <semantics> <flags> <protofamily> <protoname> \

#               <device> <nametoaddr_libs>

#

# The <device> and <nametoaddr_libs> fields are always empty in this

# implementation.

#

udp        tpi_clts      v     inet     udp     -       -

tcp        tpi_cots_ord  v     inet     tcp     -       -

udp6       tpi_clts      v     inet6    udp     -       -

tcp6       tpi_cots_ord  v     inet6    tcp     -       -

rawip      tpi_raw       -     inet      -      -       -

local      tpi_cots_ord  -     loopback  -      -       -

unix       tpi_cots_ord  -     loopback  -      -       -

 

3.3 권한 설정

/etc/exports 파일 생성 후 권한 설정.*는 모두, *자리에 ip address 대역을 작성해줘도 된다.

/usr/share/NT_101/nfs/ *(rw,subtree_check,anonuid=99,anongid=99)

 

3.4 tab 파일 생성

만들어 주어야 되는것이 /var/lib/nfs/ 디렉토리를 만들고 etab,rmtab,xtab의 세개의 빈파일을 만들어 줍니다.

 

3.5 서비스 등록

/etc/services 파일에 nfs 포트를 추가한다.

nfs        2049/tcp

nfs        2049/udp 

 

3.6 참고

정상적으로 마운트 후 exports 옵션도 RW로 되어 있는데, Writing Writing 되지 않고 "cp: cannot create regular file "XXXXX": Permission denied" 메시지 발생시

server nfs 폴더 권한 때문에 발생. chmod -R 777 nfsserver_folder

 

3.7 데몬 실행 순서

/usr/sbin/rpcbind

/usr/sbin/nfsd

/usr/sbin/mountd

/usr/sbin/exportfs –r

/usr/sbin/exportfs

 

3.8 client 실행

$ mount –t nfs 192.168.1.168:/ /home/no1no1no1/temp/nfs_c

Posted by 다크쌍피