nfs4/install-server.sh

raw link view readme
1 CLIENTNAME=$1
2
3 yum install firewalld -y
4 systemctl start firewalld
5 firewall-cmd --permanent --add-interface=eth0 --zone=public
6 firewall-cmd --permanent --add-service=nfs --zone=public
7 firewall-cmd --permanent --add-service=mountd --zone=public
8 firewall-cmd --permanent --add-service=rpc-bind --zone=public
9 firewall-cmd --reload
10
11 yum install nfs-utils nfs4-acl-tools -y
12
13 cat >> /etc/hosts.deny << EOF
14 portmap: ALL
15 EOF
16
17 sed -i.original "s/RPCNFSDARGS.*/RPCNFSDARGS=\"-N 4\"/" /etc/sysconfig/nfs
18
19 systemctl start nfs-server
20 systemctl enable nfs-server
21
22 mkdir /var/nfs
23 echo stuff > /var/nfs/file01
24 chown -R nobody:nobody /var/nfs
25 chmod -R 755 /var/nfs
26
27 cat >> /etc/exports << EOF
28 /var/nfs $CLIENTNAME(rw,sync,root_squash)
29 EOF
30
31 exportfs -av
32