nfs4/install-server.sh

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