OS: centos 6.5
Server: 10.1.11.201
Client: 10.1.11.202 10.1.11.203 10.1.11.204
1. Server Configuration
Install the required Yum package:
yum -y install nfs-utils rpcbind
Create a shared directory:
mkdir /Udisk
Edit/etc/exports. Note that there is no space between the IP address and the permission Configuration:
cat /etc/exports/Udisk 10.1.11.202(rw,sync,root_squash)/Udisk 10.1.11.203(rw,sync,root_squash)/Udisk 10.1.11.204(rw,sync,root_squash)
Start the service and set startup
service rpcbind startservice nfs startchkconfig --level 2345 rpcbind onchkconfig --level 2345 nfs on
2. Client Configuration
Install the required Yum package:
yum -y install nfs-utils rpcbind
Create directory:
mkdir /Udisk
View the directory shared by the server:
showmount -e 10.1.11.201
Mount the shared directory to the local device and test read/write:
mount -t nfs 10.4.15.71:/Udisk /Udiskcd /Udisk && touch a
Set automatic mounting upon startup:
vi /etc/fstab10.1.11.201:/Udisk /Udisk nfs defaults 0 0
Description of read/write configuration parameters in the/etc/exports file (derived from the http://www.zhukun.net/archives/7096)
RW: read-write, which can be read and written;
RO: Read-only, read-only;
Sync: Synchronous writing (writing files to hard disks and memory at the same time), suitable for scenarios with frequent communications and high real-time performance
Async: asynchronous write (the file is written to the memory first, and then to the hard disk later). It has good performance (FAST) and is suitable for writing ultra-large or ultra-large files, but has the risk of data loss, such as sudden power failure;
Note: Unless otherwise required, async is not recommended. If sync or async is not specified, the NFS server prints a warning when it is started.
No_root_squash: If the NFS client uses root to connect to the server, the root permission is also used for the Directory shared by the server. Insecure!
Root_squash: maps the UID/GID (0/0) of the root identity of the client to the nobody user of the server, that is, the server uses the nobody user to operate the shared directory;
All_squash: No matter which user the NFS client uses to connect to the server, the directory shared by the server is anonymous;
Anonuid: uid value of an anonymous user, usually nobody or nfsnobody, which can be set here;
Anongid: the GID value of an anonymous user.
Install and configure the NFS server in centos 6.5