NFS configuration and usage note (in Ubuntu9.10 and Fedora 10 )


1. NFS configuration , install package:( in Ubuntu)
root@vinco:/home/vinco# apt-get install nfs-kernel-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common portmap
The following NEW packages will be installed:
  libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common nfs-kernel-server portmap
0 upgraded, 6 newly installed, 0 to remove and 323 not upgraded.
Need to get 490kB of archives.
After this operation, 1,528kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://cn.archive.ubuntu.com karmic/main libgssglue1 0.1-3 [23.6kB]
Get:2 http://cn.archive.ubuntu.com karmic/main libnfsidmap2 0.21-2 [28.4kB]
Get:3 http://cn.archive.ubuntu.com karmic/main librpcsecgss3 0.18-1 [32.4kB]
Get:4 http://cn.archive.ubuntu.com karmic/main portmap 6.0-10ubuntu2 [37.4kB]
Get:5 http://cn.archive.ubuntu.com karmic/main nfs-common 1:1.2.0-2ubuntu8 [211kB]
Get:6 http://cn.archive.ubuntu.com karmic/main nfs-kernel-server 1:1.2.0-2ubuntu8 [158kB]                                                                              
Fetched 490kB in 9s (51.0kB/s)                                                                                                                                         
Preconfiguring packages ...
Selecting previously deselected package libgssglue1.
(Reading database ... 135173 files and directories currently installed.)
Unpacking libgssglue1 (from .../libgssglue1_0.1-3_i386.deb) ...
Selecting previously deselected package libnfsidmap2.
Unpacking libnfsidmap2 (from .../libnfsidmap2_0.21-2_i386.deb) ...
Selecting previously deselected package librpcsecgss3.
Unpacking librpcsecgss3 (from .../librpcsecgss3_0.18-1_i386.deb) ...
Selecting previously deselected package portmap.
Unpacking portmap (from .../portmap_6.0-10ubuntu2_i386.deb) ...
Selecting previously deselected package nfs-common.
Unpacking nfs-common (from .../nfs-common_1%3a1.2.0-2ubuntu8_i386.deb) ...
Selecting previously deselected package nfs-kernel-server.
Unpacking nfs-kernel-server (from .../nfs-kernel-server_1%3a1.2.0-2ubuntu8_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for sreadahead ...
Setting up libgssglue1 (0.1-3) ...

Setting up libnfsidmap2 (0.21-2) ...

Setting up librpcsecgss3 (0.18-1) ...

Setting up portmap (6.0-10ubuntu2) ...
portmap start/running, process 18021

Setting up nfs-common (1:1.2.0-2ubuntu8) ...

Creating config file /etc/idmapd.conf with new version

Creating config file /etc/default/nfs-common with new version
Adding system user `statd' (UID 115) ...
Adding new user `statd' (UID 115) with group `nogroup' ...
Not creating home directory `/var/lib/nfs'.
statd start/running, process 18248
gssd stop/pre-start, process 18273
idmapd stop/pre-start, process 18301

Setting up nfs-kernel-server (1:1.2.0-2ubuntu8) ...

Creating config file /etc/exports with new version

Creating config file /etc/default/nfs-kernel-server with new version
 * Exporting directories for NFS kernel daemon...                                                                                                                [ OK ] 
 * Starting NFS kernel daemon                                                                                                                                    [ OK ] 

Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
root@vinco:/home/vinco# 

2. usage notes (in Ubuntu9.10 and Fedora10 )
(1) nfs mount in local host ( ubuntu )
i. mkdir nfs
root@vinco:/# mkdir nfsdir
root@vinco:/# chmod 777 -R /nfsdir/
root@vinco:/# ll -a nfsdir
total 8
drwxrwxrwx  2 root root 4096 2011-07-25 11:45 .
drwxr-xr-x 22 root root 4096 2011-07-25 11:45 ..

ii.add a line as below:
root@vinco:/home/vinco# vim /etc/exports 

/nfsdir *(sync,rw,no_root_squash)


iii. restart the nfs:
root@vinco:/home/vinco# /etc/init.d/nfs-kernel-server restart
 * Stopping NFS kernel daemon                                                                                                                                    [ OK ] 
 * Unexporting directories for NFS kernel daemon...                                                                                                              [ OK ] 
 * Exporting directories for NFS kernel daemon...                                                                                                                       exportfs: /etc/exports [1]: Neither 'subtree_check' or 'no_subtree_check' specified for export "*:/nfsdir".
  Assuming default behaviour ('no_subtree_check').
  NOTE: this default has changed since nfs-utils version 1.0.x

                                                                                                                                                                 [ OK ]
 * Starting NFS kernel daemon     

iv. restart the portmap
root@vinco:/home/vinco# /etc/init.d/portmap restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service portmap restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart portmap
portmap start/running, process 800

root@vinco:/home/vinco# service portmap restart
portmap start/running, process 800

v. try mount in local machine(192.168.152.144)
--------in console one:
root@vinco:/# cd nfsdir/
root@vinco:/nfsdir# touch nfs.txt
root@vinco:/nfsdir# ll
total 0
-rw-r--r-- 1 root root 0 2011-07-25 12:25 nfs.txt

--------in anther console
root@vinco:/home/vinco# mount -t nfs 192.168.152.144:/nfsdir/  /mnt/
root@vinco:/home/vinco# ls /mnt/
nfs.txt
--------successfull