Complete NFS server configuration solution (1)

Source: Internet
Author: User

The common NFS system environment is Linux. Do you know how to configure NFS servers in Linux? Here we will help you to refine these steps and implementation methods. For more information, see the following section.

Step 1: Check and install the nfs service package

 
 
  1. [Root @ huyb ~] # Rpm-qa | grep nfs-utils
  2. Nfs-utils-1.0.9-16.el5
  3. Nfs-utils-lib-1.0.8-7.2 // nfs-utils is installed by default;
  4. [Root @ huyb ~] # Rpm-qa | grep portmap
  5. Portmap-4.0-65.2.2.1 // portmap is installed by default;

If the system does not install the required software, you can manually install it;

 
 
  1. [Root @ huyb ~] # Mount/dev/cdrom/mnt // mount/dev/cdrom/mnt to/mnt of the system;
  2. [Root @ huyb ~] # Cd/mnt/Server // switch the working directory to/mnt/Server;
  3. [Root @ huyb Server] # ls | grep NFS // list nfs-related software packages;
  4. [Root @ huyb Server] # rpm-ivh nfs-utils-1.0.9-16.el5.i386.rpm // install the nfs-utils package;

Step 2: configure the NFS server

The NFS service configuration file is etc/exports.

Exports file content format:

<Output directory> [client 1 option access permission, user ing, others)] [client 2 Option access permission, user ing, others)]

1. output directory:

The output directory refers to the directory that needs to be shared to the client in the NFS system;

2. Client:

 
 
  1. A client is a computer on the network that can access the NFS output directory.
  2. Common Methods for specifying clients
  3. Host 192.168.60.20 with the specified IP Address
  4. All hosts in the specified subnet: 192.168.60.0/24
  5. Host pc1.xyz.net for the specified domain name
  6. All hosts in the specified domain * .xyz.net
  7. All Hosts *

3. Options:

Options are used to set access permissions for the output directory, user ing, etc. NFS has three main options:

Access permission options

Set the output directory read-only ro

Set output directory read/write rw

User ing options

 
 
  1. All_squash maps all common users and groups for remote access to an anonymous user or user group nfsnobody );
  2. No_all_squash and all_squash take anti-default settings );
  3. Root_squash maps root users and groups to anonymous users or user groups by default );
  4. No_root_squash and rootsquash;
  5. Anonuid = xxx maps all remotely accessed users to anonymous users, and specifies the user as the local user UID = xxx );
  6. Anongid = xxx maps all remotely accessed user groups to anonymous user group accounts, and specifies the anonymous user group account as the local user group account GID = xxx );

Other options

 
 
  1. Secure limits the client to be able to connect to the nfs server from a TCP/IP Port less than 1024 by default );
  2. Insecure allows clients to connect to the server from TCP/IP ports greater than 1024;
  3. Sync writes data to the memory buffer and disk synchronously, which is less efficient but ensures data consistency;
  4. Async stores data in the memory buffer before writing data to the disk if necessary;
  5. Wdelay checks whether there are related write operations. If yes, execute these write operations together, which can improve the efficiency by default );
  6. No_wdelay is executed immediately if there is a write operation, and should be used with sync;
  7. If the subtree output directory is a sub-directory, the nfs server checks the permissions of its parent directory (default setting );
  8. Even if the output directory of no_subtree is a sub-directory, the nfs server does not check the permissions of its parent directory, which improves efficiency;

Step 3: Configure an instance for the NFS server

 
 
  1. [root@huyb ~]# mkdir -p /nfs/public  
  2. [root@huyb ~]# mkdir /nfs/huyb  
  3. [root@huyb ~]# mkdir /nfs/root  
  4. [root@huyb ~]# mkdir /nfs/users  
  5. [root@huyb ~]# mkdir /nfs/cdrom  
  6. [root@huyb ~]# more /etc/exports  
  7. /nfs/public 192.168.1.0/24(rw,async) *(ro)  
  8. /nfs/huyb 192.168.1.253(rw,sync)  
  9. /nfs/root *.wnt.net(ro,no_root_squash)  
  10. /nfs/users *.wnt.com(rw,insecure,all_squash,sync,no_wdelay)  
  11. /mnt/cdrom 192.168.1.*(ro) 


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.