1. 程式人生 > >一堆命令部署NFS

一堆命令部署NFS

ash rpcbind check nfs war bash local export deploy

環境準備:
server--172.16.1.31
client---172.16.1.41

server端部署:
1 #!/bin/bash
2
3 #check info
4
5 #time 2018.01.29
6
7 #Software inspection and installation
8 rpm -qa nfs-utils rpcbind && yum -y install nfs-utils rpcbind
9
10 #To configure file
11 cat >/etc/exports <<EOF
12 /data 172.16.1.0/24(rw,sync)

13 EOF
14 ##Create a directory
15
16 mkdir -p /data && chown -R nfsnobody.nfsnobody /data
17
18 ##start-up
19
20 /etc/init.d/rpcbind restart && /etc/init.d/nfs restart && /etc/init.d/rpcbind restart && /etc/init.d/nfs restart
21
22 #Local mount
23
24 showmount -e 172.16.1.31
25
26 #mount
27
28 mount -t nfs 172.16.1.31:/data /mnt
29
30 #See
31 df -h

client端部署:

#!/bin/bash
#time 2018.01.29
#cliet Deployment

#Check whether the software is installed
rpm -qa nfs-utils rpcbind && yum -y install rpcbind nfs-utils

#Does the shared directory exist
showmount -e 172.16.1.31 && mount -t nfs 172.16.1.31:/data/ /mnt/

#inspect
df -h

一堆命令部署NFS