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

来源:互联网 发布:农村淘宝运营面试 编辑:程序博客网 时间:2024/04/29 14:51


1. NFS configuration , install package:( in Ubuntu)


root@vinco:/home/vinco# apt-get install nfs-kernel-serverReading package lists... DoneBuilding dependency tree       Reading state information... DoneThe following extra packages will be installed:  libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common portmapThe following NEW packages will be installed:  libgssglue1 libnfsidmap2 librpcsecgss3 nfs-common nfs-kernel-server portmap0 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]? YGet: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 18021Setting up nfs-common (1:1.2.0-2ubuntu8) ...Creating config file /etc/idmapd.conf with new versionCreating config file /etc/default/nfs-common with new versionAdding 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 18248gssd stop/pre-start, process 18273idmapd stop/pre-start, process 18301Setting up nfs-kernel-server (1:1.2.0-2ubuntu8) ...Creating config file /etc/exports with new versionCreating 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 placeroot@vinco:/home/vinco# 


2. usage notes (in Ubuntu9.10 and Fedora10 )

(1) nfs mount in local host ( ubuntu )

i. mkdir nfs

root@vinco:/# mkdir nfsdirroot@vinco:/# chmod 777 -R /nfsdir/root@vinco:/# ll -a nfsdirtotal 8drwxrwxrwx  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 restartRather than invoking init scripts through /etc/init.d, use the service(8)utility, e.g. service portmap restartSince the script you are attempting to invoke has been converted to anUpstart job, you may also use the restart(8) utility, e.g. restart portmapportmap start/running, process 800root@vinco:/home/vinco# service portmap restartportmap 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.txtroot@vinco:/nfsdir# lltotal 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