Deploying NFS Services under Linux
General application Scenario: The server side allocates shared disk space, is mounted by one or more clients to achieve data sharing, centralized management and maintenance, access control and so on.
Steps:
Server Side-CentOS 7
- Install the necessary packages: Nfs-utils, Rpcbind
yum -y install nfs-utils
yum -y install rpcbind
- Configuring the Etc/exports File
Exports configuration of the parameter options are more, specific details with man to see and understand. Here is a description of the main 4 parameters:
All_squash : No matter what account the client uses to create the data, the owner is Nfsnobody
No_all_squash : Only the data created by the client with the root account, the owner is nfsnobody, the data created by other users is owned by other users themselves
Root_squash : Only the data created by the client with the root account is nfsnobody, and the data created by other users is owned by other users themselves.
No_root_squash : The root user has full access, and any user-created owner is the owner
为exports文件里的内容,红色区域为客户端的IP地址
- Let the NFS configuration file take effect. (Note: This step is required for each update made to/etc/exports)
exportfs -rv
-R #重新共享所以目录
-V #输出详细信息
- Shutting down the firewall
iptables -F
systemctl stop firewalld
Orsystemctl disable firewalld
- Modify the/etc/selinux/config file to let selinux=disabled
vim /etc/selinux/config
SELINUX=disabled
setenforce 0
- Start the appropriate service
systemctl start rpcbind
systemctl start nfs-utils
systemctl start nfslock
Client
- Install the necessary package Nfs-utils, Rpcbind
yum -y install nfs-utils
yum -y install rpcbind
- Shutting down the firewall
iptables -F
- Modify the/etc/selinux/config file to let selinux=disabled
vim /etc/selinux/config
SELINUX=disabled
setenforce 0
- Use the mkdir command to create the necessary mount directory, for example:
mkdir /mnt/nfs
- To view NFS information shared by the server, use the command showmount
SHOWMOUNT-E server_ip
- Use the Mount command to mount the server's shared directory, for example:
Mount-t NFS ServerIP:/nfs/mnt/nfs
- Use df-th to verify Mount status
df -Th
Deploying NFS Services under Linux