zoukankan      html  css  js  c++  java
  • 【shell脚本】自动配置yum源auto_yum_config.sh

    [root@rhel8 shell]# cat auto_yum_config.sh 
    #!/bin/bash
    ##########################################################################
    # yum config case                                                        #
    # by author tanbaobao 2020/06/16                                         #
    ##########################################################################
    
    YUM_IP=本机ip
    # CentOS系统:`cat /etc/redhat-release | awk '{print $4}' | awk -F"." '{print $1"."$2}'`
    OS_VERSION=`cat /etc/redhat-release | awk '{print $6}' | awk -F"." '{print $1"."$2}'`
    YUM_DIR=/etc/yum.repos.d
    
    # 如果目录不存在,则执行后面语句
    [ -d "$YUM_DIR" ] || mkdir -p $YUM_DIR/bak
    mv $YUM_DIR/*.repo $YUM_DIR/bak
    
    case "$OS_VERSION" in
        8.1)
            cat >$YUM_DIR/repo8u1.repo <<-EOF
            [repo8u1]
            name=repo8u1
            baseurl=ftp://$YUM_IP/repo8u1
            gpgcheck=0
            EOF
            echo "8.1 yum configure.."
            ;;
        7.3)
            cat >$YUM_DIR/repo8u1.repo <<-EOF
            [centos7u3]
            name=centos7u3
                baseurl=file:///centos7u3
                gpgcheck=0
            EOF
            ;;    
        6.8)
            wget -O $YUM_DIR/centos6u8.repo http://mirrors.aliyun.com/repo/Centos-6.repo
            ;;
        5.9)
            curl -o $YUM_DIR/CentOS_Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
            ;;
        *)
            echo -e "33[34mError33[0m"
    esac
  • 相关阅读:
    Trying to get property 'art_id' of non-object
    isset和empty以及is_null区别
    redis异步处理
    redis 基本使用
    nodejs (下)(设置响应参数)
    轮询技术
    mysql优化(下)
    108. Convert Sorted Array to Binary Search Tree
    148. Sort List
    236. Lowest Common Ancestor of a Binary Tree
  • 原文地址:https://www.cnblogs.com/HeiDi-BoKe/p/13166232.html
Copyright © 2011-2022 走看看