Linux NFS server configuration and installation diagram

Source: Internet
Author: User
Tags anonymous parent directory


Linux NFS Configuration

1. Installing NFS

Rpm-qa | grep NFS

Yum Search NFS

Yum Install NFS


2. Configure

Configuration file/etc/exports

/tmp * (Rw,no_root_squash,sync) No_root_squash the client-created file owner and group is the currently logged-on user, not the Nfsnobody sync asynchronous sync file

Common Directories for NFS

/etc/exports The main configuration file for NFS services
/USR/SBIN/EXPORTFS Management commands for NFS services
/usr/sbin/showmount Client's view command
/var/lib/nfs/etab record full permission settings for NFS-shared directories
/var/lib/nfs/xtab record client information that has been logged in
The configuration file for NFS services is/etc/exports, which is the primary configuration file for NFS, but the system does not have a default value, so this file does not necessarily exist, you may want to manually build with Vim, and then write the configuration content in the file.

/etc/exports File Content format:

< output directory > [Client 1 options (access rights, user mappings, other)] [Client 2 options (access rights, user mappings, other)]a. Output directory:

The output directory refers to the directories that need to be shared with the client in an NFS system;

B. Client:

A client is a computer in the network that can access this NFS output directory

Client-specific methods used

• Host of the specified IP address: 192.168.0.200
• Specify all hosts in the subnet: 192.168.0.0/24 192.168.0.0/255.255.255.0
• Host of specified domain name: david.bsmart.cn
• Specify all hosts in the domain: *.bsmart.cn
• All hosts: *
C. Options:

option is used to set access permissions, user mappings, and so on for the output directory.

There are 3 main types of NFS options:

Access rights options

• Set Output directory Read only: RO
• Set output directory Read/write: RW
User mapping Options

All_squash: All normal users and groups of remote access are mapped to anonymous users or groups of users (Nfsnobody);
No_all_squash: Reverse with All_squash (default setting);
Root_squash: Maps root and group to anonymous users or groups of users (default setting);
No_root_squash: With the Rootsquash to take the opposite;
anonuid=xxx: Maps All users of remote access to anonymous users and specifies that the user is a local user (uid=xxx);
anongid=xxx: Maps all user groups for remote access to anonymous user group accounts and designates the anonymous user group account as the local user group account (GID=XXX);
Other options

Secure: Restrict clients from connecting to NFS servers from TCP/IP ports less than 1024 (default setting);
insecure: Allows clients to connect to the server from TCP/IP ports greater than 1024;
Sync: It is inefficient to write data synchronously to memory buffer and disk, but it can guarantee the consistency of data;
Async: Save the data in a memory buffer before writing to disk if necessary;
wdelay: Check for write-related writes and, if so, execute them together, which can improve efficiency (default setting);
No_wdelay: If there is a write operation will be implemented immediately, should be used in conjunction with the sync;
subtree: If the output directory is a subdirectory, the NFS server checks the permissions of its parent directory (the default setting);
No_subtree: Even if the output directory is a subdirectory, NFS server does not check the permissions of its parent directory, which can improve efficiency;

3. Start Service

Service Rpcbind Start

Service NFS Start

/etc/init.d/nfs Reload

4. View shared status and Mount

SHOWMOUNT-E 127.0.0.1

Mount-t NFS 127.0.0.1:/tmp/mnt

5. Join Open Start

Vim/etc/fstab

Vim/etc/rc.local Service rpcbind Start service NFS Start


Note that the firewall is open to TCP's 204 port, Seolinux do not have to shut down

6. Stop NFS Server

To stop NFS running, you need to stop the NFS service before stopping the Portmap service, and you do not need to stop the Portmap service for other services in the system (such as NIS) that need to be used

# Service NFS Stop
# service Portmap STOP4, setting up automatic startup status for NFS server

For the actual application system, it is unrealistic to start the NFS server manually each time you start the Linux system, and you need to set up the system to automatically start Portmap and NFS services at the specified run level.

# chkconfig--list Portmap
# Chkconfig--list NFS

Set up Portmap and NFS services to start automatically at System run level 3 and 5.

# chkconfig--level Portmap on
# Chkconfig--level NFS on

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.