Linux NFS File Server installation and configuration

Source: Internet
Author: User
Tags server installation and configuration

NFS is short for Network File System, that is, Network File System. The Network File System is one of the file systems supported by FreeBSD, also known as NFS. NFS allows a system to share directories and files with others on the network. By using NFS, users and programs can access files on the remote system just like accessing local files.

 

I. NFS installation and configuration

Yum-y install nfs-utils-lib rpcbind

Mkdir-p/home/network/nfs

Vim/etc/exports

Add

/Home/network/nfs * (rw, sync, no_root_squash, no_all_squash)

Save and exit

Exportfs-r

Service rpcbind restart
Service nfs restart

Chkconfig -- level 35 nfs on

Chkconfig -- level 35 rpcbind on

Verify NFS sharing on the server:

Showmount-e

 

Note: The shared directory set above is displayed normally. If the following error is reported:

Clnt_create: RPC: Program not registered

It indicates that the Starting sequence of the rpcbind service and NFS service is incorrect. Stop the two of them and restart the service. Start the rpcbind service and then start the nfs service;

 

The client verifies NFS sharing:

Showmount-e 192.168.1.207 (the IP address of the NFS server)

 

Note: The shared directory set above can also be displayed normally. If the following error is reported:

Clnt_create: RPC: Port mapper failure-Unable to receive: errno 113 (No route to host)

It indicates that the firewall has not enabled the port to be enabled, and the firewall should be turned off before testing. However, the firewall is important and will not be closed at will in general, on the server side, you can enable all the ports listed by the following command:

 

# Rpcinfo-p localhost

 

Ii. Client mounting

Cd

Mkdir testnfs

Mount-t nfs 192.168.1.207:/home/network/nfs testnfs

Verify NFS mounting

Df

Normally, the content similar to the red font can be displayed:

File System 1 K-block used available % mount point
/Dev/sda3 50403012 1772272 46070384 4%/
Tmpfs 914652 0 914652 0%/dev/shm
/Dev/sda1 198337 27655 160442 15%/boot
192.168.1.207:/home/network/nfs
13383232 538944 12164480 5%/root/testnfs

Or

Cd/root/testnfs

Mkdir test

Go to the/home/network/nfs directory on the server and check whether a folder named test is displayed;

 

Set automatic mounting for system startup:

Vim/etc/fstab

New

192.168.1.207:/home/network/nfs/root/testnfs defaults 0 0

 

 

Iii. Knowledge Extension

 

Exports command:

 

The parameters are described as follows.
(1)-a: All mounting (or unmounting) settings in the/etc/exports file.
(2)-r: Remount the settings in/etc/exports, and synchronously update the content in/etc/exports and/var/lib/nfs/xtab.
(3)-u: Uninstall a directory.
(4)-v: displays the shared directory on the screen during the export operation.

 

 

/Etc/exports file content format:

 

<Shared directory> [client 1 option (access permission, user ing, and others)]

 

User ing options

  • All_squash: maps all common users and groups remotely accessed to anonymous users or user groups (nfsnobody );

  • No_all_squash: returns an inverse value from all_squash (default );

  • Root_squash: maps root users and groups to anonymous users or user groups (default );

  • No_root_squash: returns the inverse of rootsquash;

  • Anonuid = xxx: maps all remotely accessed users to anonymous users and specifies the user as a local user (UID = xxx );

  • Anongid = xxx: maps all remotely accessed user groups to anonymous user group accounts, and specifies this anonymous user group account as a local user group account (GID = xxx );

 

Other options

  • Secure: restrict the client to connect to the nfs server from a TCP/IP Port less than 1024 (default );

  • Insecure: allows the client to connect to the server from a TCP/IP Port greater than 1024;

  • Sync: write data synchronously to the memory buffer and disk, which is less efficient, but can ensure data consistency;

  • Async: stores data in the memory buffer before writing data to the disk if necessary;

  • Wdelay: Check whether there are related write operations. If yes, execute these write operations together to improve the efficiency (the default setting );

  • No_wdelay: if there is a write operation, it will be executed immediately and should be used with sync;

  • Subtree: If the output directory is a sub-directory, the nfs server checks the permissions of its parent directory (default );

  • No_subtree: even if the output directory is a sub-directory, the nfs server does not check the permissions of its parent directory, which improves efficiency;

 

 

Terminator: I have written so much about it. Some knowledge is only for your reference. In fact, the installation and configuration of the NFS server are very simple. Just install the NFS server, configure the shared directory, and mount the client;

 

Install NFS server in Ubuntu 12.04

 

Install and configure the NFS server to share the Ubuntu 12.04 and ARM files.

 

Build an nfs server in Ubuntu

 

File Server NFS configuration details

 

Build an NFS Network File System server in Ubuntu

 

Heartbeat_ldirector + LB + NFS for HA, LB, and file sharing

 

How to Configure NFS server in CentOS 5.5

 

Install and use NFS in Ubuntu 12.10

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.