Hpcomputer: ubuntu7.10NFS configuration (via your own machine)

Source: Internet
Author: User
Hpcomputer: ubuntu7.10NFS configuration (via your own machine) -- Linux Enterprise Application-Linux server application information. For details, see the following. Author: ARM Your Life

In the embedded learning process, the online notes are integrated:
NFS configuration for Debian/Ubuntu

Introduction: NFS (Network File System) allows you to share directories of different hosts (different OS) over the Network-you can mount directories of remote hosts through NFS, accessing this directory is like accessing a local directory!
Generally, nfs can be used to easily share unix-like systems.

Principle: NFS runs on the basis of SUN's Remote Procedure Call (Remote Procedure Call). RPC defines a system-independent method for inter-process communication. therefore, the NFS server can also be viewed as an RPC server.
Because NFS is an RPC service program, you must map the port before using it-set it through portmap. for example, when an NFS client initiates an NFS service request, it must first obtain a port ). therefore, it first obtains the port number through portmap. (not only NFS, but portmap needs to be set before all RPC service programs start)

For NFS-related files, run the following command:
1,/etc/exports
The access to the NFS volume is approved by exports, which enumerate several hostnames that have the right to access the file system on the NFS server.

2,/sbin/exportfs
Maintain NFS Resource Sharing. You can reset the shared directory of/etc/exports, unmount the shared directory of NFS Server, or share it again.

3,/usr/sbin/showmount
It is used on NFS Server, while showmount is mainly used on Client. Can it be used on showmount? Zookeeper NFS shared directory resources.

4,/var/lib/nfs/xtab
NFS record document: You can view which clients are connected to the NFS host.

The following are not directly responsible for NFS. In fact, they are responsible for all RPC
5,/etc/default/portmap
In fact, portmap maps all the RPC service ports. Its content is very simple (detailed later)

6,/etc/hosts
Set the host to reject/allow the portmap service

Install NFS:
By default, the NFS server is not installed on Debian/Ubuntu. First, install the NFS service program:
$ Sudo apt-get install nfs-kernel-server
$ Sudo apt-get install nfs-commmon
(When nfs-kernel-server is installed, apt will automatically install nfs-common and portmap)
In this way, the host is equivalent to the NFS Server.

In the development system, the NFS client must be installed as the target system as the NFS client. For Debian/Ubuntu systems, nfs-common must be installed.
$ Sudo apt-get install nfs-commmon

Note: Both nfs-common and nfs-kernel-server depend on portmap!

Configure NFS:
Configure portmap $ sudo dpkg-reconfigure portmap to shocould portmap be bound to the loopback address? Select N.

Configure/etc/hosts. deny
(Prohibit any host (host) from connecting to your NFS server), add:
### NFS DAEMONS

Portmap: ALL

Lockd: ALL

Mountd: ALL

Rquotad: ALL

Statd: ALL

Configure/etc/hosts. allow
Allow hosts you want to establish connections with your NFS server. The following steps allow any host whose IP address starts with 192.168.2 (connected to the NFS server), or specify a specific IP address. See hosts_access (5) and hosts_options (5) on the man page ).
### NFS DAEMONS

Portmap: 59.64.

Lockds: 59.64.

Rquotad: 59.64.

Mountd: 59.64.

Statd: 59.64.

/Etc/hosts. deny and/etc/hosts. allow sets the access to portmap. using these two configuration files is a bit similar to "mask. first in/etc/hosts. deny prohibits all users from accessing portmap. then in/etc/hosts. some users are allowed to access portmap in allow.

Run $ sudo/etc/init. d/portmap restart to restart portmap daemon.

Configure/etc/exports:
The NFS mount directory and permissions are defined by the/etc/exports file./etc/exports is actually the core configuration file of the nfs server.

For example, to share the IP address of 59.64.195.97 with the/home/warmbupt/arm/nfs directory in my home directory, add the following statement at the end of the file:
/Home/warmbupt/arm/nfs 59.64.195.97 (rw, sync, no_root_squash)
The preceding configurations are described as follows:
The NFS client of 59.64.195.97 can share the content of the NFS server/home/warmbupt/arm directory, and has the read and write permissions. the user's identity after entering the/home/warmbupt/arm directory is root.
It is best to add sync. Otherwise, a warning will be given when $ sudo exportfs-r is used. sync is the default option of NFS.

Modify the directory permission: chmod 777-R/home/warmbupt/arm/nfs

Run $ showmount-e to view the NFS server's export list. If/etc/exports is changed, run $ sudo exportfs-r update.

Run $ sudo/etc/init. d/nfs-kernel-server restart to restart the nfs service)
$ Sudo iptables-F

Test NFS:
Try mounting the local disk (assuming the IP address of the local host is 59.64.195.97, Mount/home/warmbupt/arm/nfs to/mnt)
$ Sudo mount 59.64.195.97:/home/warmbupt/arm/nfs/mnt
Run $ df to check the result
$ Sudo umount/mnt
If permission deny appears:
Try: sudo mount-o nolock-t nfs 59.64.195.97:/home/warmbupt/arm/nfs/mnt.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.