Establish and verify NFS

Source: Internet
Author: User

1. Install the NFS server and client:

Sudo apt-Get install nfs-kernel-server nfs-common Portmap

(2) sudo dpkg-reconfigure Portmap

Select "no" after running"

3. Configure the Mount directory and permissions

Vim/etc/exports

Below isCodeFragment:
#/Etc/exports: the access control list for filesystems which may be exported
# To NFS clients. See exports (5 ).
#
# Example for nfsv2 and nfsv3:
#/Srv/homes hostname1 (RW, sync) hostname2 (RO, sync)
#
# Example for nfsv4:
#/Srv/nfs4 GSS/krb5i (RW, sync, fsid = 0, crossmnt)
#/Srv/nfs4/homes GSS/krb5i (RW, sync)
#
/Home/ganhm/yangmiaojuan * (RW, sync)

Note:/home/ganhm/yangmiaojuan is the shared directory on my machine.
* Allows all IP addresses to access my shared directory. Of course, you can set a specific IP address in actual applications.

4. Restart the NFS service.

Sudo/etc/init. d/Portmap start

Sudo/etc/init. d/nfs-kernel-server restart NFS

5. Verification
192.168.138.162 is the IP address on my VM. Run the ifconfig command to check your IP address.

Sudo Mount 192.168.138.162:/home/ganhm/yangmiaojuan/mnt verify that your shared directory is mounted to/mnt

Sudo Mount-t nfs 192.168.138.165:/home/ganhm/AAA/mnt verify that the shared directory of others is mounted to your/mnt
 
Note: 192.168.138.165:/home/ganhm/AAA is someone else's IP address and shared directory
-T indicates the file system type in the command. NFS is used here.

An important question:
When setting the network connection, check whether it is bridging. If it is Nat, there is a high probability that the IP network segment is different (that is, the third segment of the IP address is different). In this way, other people's shared directories may not be accessible. I do not know the specific reason.

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.