For more information about how to install and configure an NFS server in CentOS 6.5 rpm, see centosnfs.
Install and configure the NFS server in CentOS 6.5 rpm
Environment: centos 6.5
Server: 10.200.0.126
Client: 10.200.0.168
1. service configuration
Nfs rpm installation package
Installation sequence
1. rps-ivh keyutils-libs-1.4-4.el6.x86_64.rpm
2. rpm-e-nodeps keyutils-libs-1.4-5.el6.x86_64
3. rps-ivh keyutils-libs-1.4-4.el6.x86_64.rpm
4. rps-ivh keyutils-1.4-4.el6.x86_64.rpm
5. rps-ivh libevent-1.4.13-4.el6.x86_64.rpm
6. rps-ivh libgssglue-0.1-11.el6.x86_64.rpm
7. rpm-ivh rpcbind-0.2.0-9.el6.x86_64.rpm
8. rpm-ivh nfs-utils-lib-1.1.5-4.el6.x86_64.rpm nfs-utils-1.2.3-26.el6.x86_64.rpm
Create a shared directory:
mkdir /Udisk
Edit vi/etc/exports. Note that there is no space between the IP address and the permission Configuration:
Cat/etc/exports
/Udisk 10.200.0.168(rw,sync,root_squash)
Start the service and set startup
service rpcbind startservice nfs startchkconfig --level 2345 rpcbind onchkconfig --level 2345 nfs on
Ii. Client Configuration
Rpm package installation
1. rps-ivh keyutils-libs-1.4-4.el6.x86_64.rpm
2. rpm-e-nodeps keyutils-libs-1.4-5.el6.x86_64
3. rps-ivh keyutils-libs-1.4-4.el6.x86_64.rpm
4. rps-ivh keyutils-1.4-4.el6.x86_64.rpm
5. rps-ivh libevent-1.4.13-4.el6.x86_64.rpm
6. rps-ivh libgssglue-0.1-11.el6.x86_64.rpm
7. rpm-ivh rpcbind-0.2.0-9.el6.x86_64.rpm
8. rpm-ivh nfs-utils-lib-1.1.5-4.el6.x86_64.rpm nfs-utils-1.2.3-26.el6.x86_64.rpm
Create directory:
mkdir /Udisk
View the directory shared by the server:
showmount -e 10.200.0.126
Mount the shared directory to the local device and test read/write:
mount -t nfs 10.200.0.126:/Udisk /Udisk
Cd/Udisk & touch
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 https://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.