System Platform: virtualbox3.2.10 + Ubuntu10.10 install nfs: # sudoapt-getinstallnfs-kernel-serverUbuntu10.10 is already the latest version, do not need to install Open/etc/exports file, add at the end of:/home/xgc * (rw, sync, no_root_squash) Note: nfs allows the mounted directory and permissions.
System Platform: virtualbox3.2.10 + Ubuntu 10.10
Install nfs:
# Sudo apt-get install nfs-kernel-server
Ubuntu 10.10 is already in the latest version and does not require installation.
Open the/etc/exports file and add:
/Home/xgc * (rw, sync, no_root_squash)
Note: The directories and permissions that nfs allows to be mounted are defined in the file/etc/exports. The meanings of the fields in [LINUX community www.LinuxIDC.com] are as follows:
/Home/xgc: directory to be shared
*: Allow access from all network segments
Rw: read/write permission
Sync: data is synchronized to internal and hard disks.
No_root_squash: nfs client shares directory User Permissions
Restart the service:
# Sudo/etc/init. d/portmap restart <--- restart portmap, which is very important.
# Sudo/etc/init. d/nfs-kernel-server restart <--- restart the nfs service
# Showmount-e <--- display the shared directory
Note: nfs is an RPC program. before using it, you need to map the port and set it through portmap.
Command Execution is as follows:
Xgc @ xgc-VirtualBox :~ $ Sudo/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
Upstart job, you may also use the restart (8) utility, e.g. restart portmap
Portmap start/running, process 474
Xgc @ xgc-VirtualBox :~ $ Sudo/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 "*:/home/xgc ".
Assuming default behaviour ('no _ subtree_check ').
NOTE: this default has changed since nfs-utils version 1.0.x
[OK]
* Starting NFS kernel daemon [OK]
Xgc @ xgc-VirtualBox :~ $ Showmount-e
Export list for xgc-VirtualBox:
/Home/xgc *
Now you can try it on the local machine:
# Sudo mount-t nfs localhost:/home/xgc/mnt
Note: localhost is the IP address of the linux server.
In this way, the shared directory is mounted to the/mnt directory and the Mount is canceled:
# Sudo umount/mnt
If it is mounted on an embedded device, the-o nolock parameter must be added.