惜风不起、唯有努力!
系统常用安装包shell脚本

系统常用安装包shell脚本

#!/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

发表回复

您的电子邮箱地址不会被公开。