nfs/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 --reload
8
9 yum install nfs-utils -y
10
11 mkdir /var/nfs
12 echo test file > /var/nfs/file01
13 chown -R nobody:nobody /var/nfs
14 chmod -R 755 /var/nfs
15
16 sed -i.original "s/RPCNFSDARGS.*/RPCNFSDARGS=\"--no-nfs-version 4\"/" /etc/sysconfig/nfs
17
18 systemctl start nfs-server
19 systemctl enable nfs-server
20
21 cat >> /etc/exports << EOF
22 /var/nfs $CLIENTNAME(rw,sync,root_squash)
23 EOF
24
25 exportfs -a
26