CentOS installs NFS server and client

On the server:

1. Install the software package required by the NFS server on the server:
yum install -y nfs-utils

2. Edit the exports file and add the slave
vi /etc/exports
/data/ 172.16.231.4(rw,sync,fsid=0,all_squash,anonuid=1000,anongid=1000)

3. Start rpcbind and nfs first:    
systemctl enable rpcbind.service    
systemctl enable nfs-server.service    

4. Then start the rpcbind and nfs services respectively:   
systemctl start rpcbind.service    
systemctl start nfs-server.service    

5. Confirm whether NFS is started by checking whether there is an nfs service in the service column.

showmount -e localhost

6. Confirm that the NFS server starts successfully:   
rpcinfo -p    

7、firewalld 放行NFS:
firewall-cmd --permanent --zone public --add-service mountd
firewall-cmd --permanent --zone public --add-service rpc-bind
firewall-cmd --permanent --zone public --add-service nfs
firewall-cmd --reload

Client configuration:

1. Install rpcbind

yum install  -y rpcbind

2. Start the service

systemctl enable rpcbind.service
systemctl start rpcbind.service

3. Check whether there is a directory share on the NFS server side
showmount -e 172.16.10.122

4. Mount the file
mkdir /data/
mount -t nfs -o nolock 172.16.10.122:/data/ /data/

5. Set boot mount
vi /etc/fstab
add the line
172.16.10.122:/data/ /data/ nfs defaults ,_rnetdev 1 1

Guess you like

Origin blog.csdn.net/songchaofly/article/details/122255246