This document is limited to NFS basic configuration, and if the production environment may also need to add the appropriate parameters according to the specific requirements
Variable declaration:
/nfs host sharing directory, production environment is generally uploads, etc.
10.0.0.101 NFS Program Server
10.0.0.102 NFS Program Mount end
The Uid,gid is a separate set of 2000, with the aim of consistent user information on both the server and the mounted end
Added user for NFS This is typically used in a production environment with the same user name as the Web service
Service side:
1, install Nfs-utils Rpcbind
Yum Install nfs-utils rpcbind-y
2. Start the relevant software (you must start the Rpcbind first, and then start NFS)
/etc/init.d/rpcbind start
/etc/init.d/nfs
3, the local test program is started
Rpcinfo-p localhost
If there is an NFS word in the display result, the configuration is successful, NFS is started
4. Edit the NFS configuration file (/etc/exports) and add the following fields to the configuration file
/nfs 10.0.0.0/24 (rw,sync,anonuid=2000,anongid=2000)
Field description
Local directory authorized IP break or individual IP (permissions and parameters)
Common parameters: RW read-write, RO read-only, Sync State synchronization (if it is read-only, can ignore not write), Annouid and Anongid directory corresponding permissions, generally used to mount the machine's permissions consistent
5. Heavy-Duty NFS
/etc/init.d/nfs Reload
6, local view status, if there is a display, the success
SHOWMOUNT-E 10.0.0.101 (native IP, can also use localhost)
7, the configuration boot from the start, the proposed unified modification/etc/rc,local, add the following fields
#onboot Rpcbind
/etc/init.d/rpcbind start
#onboot NFS
/etc/init.d/nfs start
or by Cat append
Cat >>/etc/rc.local<<eof
#onboot Rpcbind
/etc/init.d/rpcbind start
#onboot NFS
/etc/init.d/nfs start
Eof
Additional actions:
8. Configure always file permissions and owner
Groupadd NFS-G 2000
Useradd nfs-u 2000-g 2000-m-s/sbin/nologin
NFS users can not set a password, or can follow the above configuration, prohibit login
9. Modify permissions for a shared directory
Chown Nfs.nfs/nfs
Client:
1. Installation of Rpcbind and Nfs-utils-lib
Yum Install Nfs-untils-lib rpcbind-y
2. Start Rpcbind
/etc/init.d/rpcbind start
3, check the remote NFS status, if the status is OK, then carry out the following mount operation
SHOWMOUNT-E 10.0.0.101
4. Create the required directory and mount it
Mkdir/nfs
Mount-t NFS 10.0.0.101:/nfs/nfs
5, configure the boot from Start recommendations Unified Modify/etc/rc,local, add the following fields
#auto Mount NFS
Mount-t NFS 10.0.0.101:/nfs NFS
or use Cat to append
Cat >>/etc.rc.local<<eof
#auto Mount NFS
Mount-t NFS 10.0.0.101:/nfs NFS
Eof
Additional actions:
6. Configure always file permissions and owner
Groupadd NFS-G 2000
Useradd nfs-u 2000-g 2000-m-s/sbin/nologin
NFS users can not set a password, or can follow the above configuration, prohibit login
Article supplement: for example, for Web site users to upload data consistent, can be used on the server and the client directly use the Web services corresponding users, such as www
Report:
Finally, the recent change of work, environmental compensation has a qualitative leap, so the bottom of the heart, the past a period of time to learn and actual deployment of things to do a summary, convenient later learning and time to learn, to achieve the purpose of strengthening and upgrading.
If there is any mistake in the text, please point it out.
This article is from the "Fish Sheep" blog, please be sure to keep this source http://iyuyang.blog.51cto.com/2305553/1631940
Rapid Deployment of NFS services