Install the Ubuntu NFS configuration system

Source: Internet
Author: User

To install and configure the Ubuntu NFS service in Ubuntu, follow these steps:

1. Install Ubuntu NFS
By default, the Ubuntu NFS server is not installed on Ubuntu. Therefore, we first install Ubuntu
NFS server: $ sudo apt-Get install nfs-kernel-Server
In some documents, Apt-Get is also required.
To manually install NFS client nfs-common and port er Portmap, but this is not necessary because the NFS-kernel-Server
APT will automatically install them for us.

2. Configure/etc/exports
The directory and permissions that Ubuntu NFS allows to mount are defined in the file/etc/exports.
For example,
To share the rootfs directory under the root directory, add the following line at the end of the/etc/exports file:/rootfs
* (RW, sync, no_root_squash)
Where:/rootfs is the directory to be shared, * indicates that all network segments are allowed to access and RW indicates the read/write permission.
Limited, sync is the data synchronization write memory and hard disk, no_root_squash is Ubuntu
The NFS client shares the permission of the directory user. If the client uses the root user, the client has the root permission for the shared directory.

Common Parameters for Ubuntu NFS include:
RO read-only access
RW read/write access to sync all data written and shared upon request
Async
NFS can respond to requests before writing data
Secure NFS is sent through the secure TCP/IP ports below 1024
Insecure
NFS is sent over port 1024.
Wdelay if multiple users want to write data to the NFS Directory, group write (default)
No_wdelay
If multiple users want to write data to the NFS Directory, write the data immediately. This setting is not required when async is used.
Hide does not share its subdirectories in the NFS shared directory.
No_hide
Sub-directories that share the NFS Directory
Subtree_check if sub-directories such as/usr/bin are shared, force NFS to check the permissions of the parent directory (default)
No_subtree_check
The parent directory permission is not checked as opposed to the above.
All_squash: The UID and gid of the shared file are mapped to the anonymous user anonymous, which is suitable for public directories.
No_all_squash
Reserve the UID and gid of the shared file (default)
Root_squash all requests of the root user are mapped to the same permissions as those of the anonymous user (default)
No_root_squas
Root Users Have Full root directory management and Access Permissions
Anonuid = xxx specifies the UID of an anonymous user in the NFS server/etc/passwd file
Anongid = xxx
Specify the GID of anonymous users in the NFS server/etc/passwd file

3. Restart the Ubuntu NFS service.
$ Sudo/etc/init. d/Portmap restart
$ Sudo
/Etc/init. d/nfs-kernel-server restart

 

4. After modifying the shared directory, you do not need to restart the service once. You only need to run exportfs-RV.

 

5. Test Ubuntu NFS
Run the following command to display the shared directory:
$ Showmount-e
Alternatively, you can use
Run the following command to mount it to a local disk: for example, Mount/rootfs to/mnt:
$ Sudo Mount-T NFS
Localhost:/rootfs/mnt
Run the DF command to check whether the mounting is successful. Run the following command to uninstall the SDK:
$ Sudo
Umount/mnt

 

6. Mount the server's file system on the Development Board:

HOST: 192.168.1.77

Development Board: 192.168.1.88

Ping the host on the Development Board to check whether the network is connected. Then run the following command:

Mount-T nfs-O nolock 192.168.1.77:/rootfs/mnt

 

Or you can write it as a script to avoid running this command every time.

#! Bin/sh

Mount-T nfs-O nolock 192.168.1.77:/rootfs/mnt

Echo "Mount OK! "

 

Save as the nfsexe file, and then chomd 667 nfsexe

You only need to use./nfsexe each time.

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.