#!/bin/bash ######################################## File Description ######################################## # Creation time:2020-05-30 # Project:07 # Task: 04 # Execute example:bash record-shell-x-x.sh # Detailed description: # About:http://linux.book.51xueweb.cn ################################################################################################## # reback start yum remove nfs-utils -y # reback end #***************reader shell start*************** #---------------Structure RAID 1--------------- # Install mdadm yum install mdadm -y # Structure RAID 1 mdadm -Cv /dev/md1 -a yes -l 1 -n 2 /dev/sd{b,c} # Look RAID 1 cat /proc/mdstat # Format /dev/md1 mkfs.ext4 /dev/md1 # Creat /srv/WorkGroupShare mkdir /srv/WorkGroupShare # Give folder permission chmod -R 777 /srv/WorkGroupShare # Mount /dev/md1 to /srv/WorkGroupShare mount /dev/md1 /srv/WorkGroupShare # Look /srv/WorkGroupShare df -h /srv/WorkGroupShare # Look /dev/md1 mdadm -D /dev/md1 # Set auto mount after startup sed -i '$a /dev/md1 disk2 auto defaults 1 2 ' /etc/fstab #---------------Install NFS--------------- # Install NFS yum install -y nfs-utils # Start rpcbind、nfs-server systemctl start rpcbind systemctl start nfs-server # Look rpcbind、nfs-server systemctl status rpcbind nfs-server # Confige nfs-server systemctl enable rpcbind systemctl enable nfs-server systemctl is-enabled rpcbind systemctl is-enabled nfs-server # Confige Firewalld systemctl stop firewalld # Confige SELinux setenforce 0 #---------------Install NFS--------------- # Creat '/etc/exports' touch /etc/exports # Configure NFS cat > /etc/exports << EOF /srv/WorkGroupShare 10.10.2.0/24(rw,root_squash,no_all_squash,sync,insecure) EOF # Load configuration exportfs -rv # Test NFS showmount -e #***************reader shell end***************