#!/bin/bash package=("tcping" "iotop" "net-tools" "curl" "wget" "nc" "tree" "unzip" "gzip" "unhide" \ "nethogs" "iftop" "perf") function check_package(){ for i in ${package[@]} do rpm -qa | grep "${i}" if [ `echo "$?"` != 0 ] then echo "${i}未安装成功!!!" fi done } function clean_all_install_repo(){ yum install epel-release -y if [ `echo "$?"` != 0 ] then echo "epel源安装失败,请检查yum源是否可用!!!" exit 1 else yum clean all yum repolist fi } function use_package(){ for i in ${package[@]} do yum -y install $i done check_package } function er_package(){ yum -y install gcc gcc-c++ automake pcre pcre-devel zlip zlib-devel openssl openssl-devel } function main(){ clean_all_install_repo && use_package && er_package } main