CentOS 7 Installation Configuration NFS
Environment
NPS 192.168.1.97
Client 192.168.1.98
One, yum installation
Yum-y Install Nfs-utils Rpcbind
Configuration file for NFS/etc/expots
Default is empty
Vi/etc/exports
/OPT/TEST/192.168.1.0/24 (rw,no_root_squash,no_all_squash,sync,anonuid=501,anongid=501)
Second, make the configuration effective
Exportfs-r
Note: Configuration file Description:
/opt/test for shared directory
192.168.1.0/24 can be a network segment, an IP, or a domain name, and the domain name supports wildcard characters such as: *.qq.com
Rw:read-write, can read and write;
Ro:read-only, read-only;
Sync: The file is written to both the hard disk and memory;
Async: Files are staged in memory instead of directly to memory;
No_root_squash:nfs the client connects to the server, if root is used, it also has root access to the directory shared by the server. Obviously it's not safe to turn it on.
Root_squash:nfs the client connects to the server, if root is used, then the directory shared by the server, with anonymous user rights, usually he will use nobody or nfsnobody identity;
All_squash: Regardless of which user is used by the NFS client to connect to the server, the directory shared by the server has anonymous user rights;
Anonuid: The UID value of the anonymous user, which can be set at its discretion.
Anongid: The GID value of the anonymous user.
Third, start NFS
Service Rpcbind Start
Service NFS Start
Chkconfig Rpcbind on
Chkconfig NFS On
Iv. Client Mount:
SHOWMOUNT-E 192.168.1.97 #查看可挂载
Export list for 192.168.1.97:
/opt/test 192.168.1.0/24
Client Mount
Mount-t NFS 192.168.1.97:/opt/test/mnt
Silent both for success
The client encountered a problem at the time of mounting, perhaps the network is not very stable, NFS is the default UDP protocol, replaced by the TCP protocol:
Mount-t NFS 192.168.1.97:/opt/test/mnt-o Proto=tcp-o nolock
CentOS 7 Installation Configuration NFS