zoukankan      html  css  js  c++  java
  • if多系统配置yum源

    cat yum_if.sh 
     1 #!/bin/bash
     2
     3
     4 #if for many branches yum
     5 #version 1 by feng
     6 
     7 yum_server=192.168.0.117
     8 Os_version=$(cat /etc/redhat-release |awk '{print $4}'|cut -c 1-3)
     9 [ -d /etc/yum.repos.d/bak ]||mkdir /etc/yum.repos.d/bak && mv 
    /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak
    10 if [ "$Os_version" = "7.4" ] ;then
    11     cat >/etc/yum.repos.d/Centos7u4.repo<<-eof
    12     [Centos7u4]
    13     name=Centos7u4
    14     baseurl=http://$yum_server/Base7u4.repo
    15     gpgcheck=0
    16     eof
    17 elif [ "$Os_version" = "6.8" ];then
    18     curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    19 elif [ "$Os_version" = "8.3" ];then
    20     curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo    
    21 else
    22     echo "error……"    
    23 fi
     [root@localhost if]# cat /etc/yum.repos.d/Centos7u4.repo 
     [Centos7u4]
     name=Centos7u4
     baseurl=http://192.168.0.117/Base7u4.repo
     gpgcheck=0
     [root@localhost if]# 
  • 相关阅读:
    array note
    前端开发规范
    java集合分类
    react native环境
    gulp
    关于如何在海量手机号中刷选出想要的手机号
    生成用户头像插件
    下拉加载
    阿里云人脸人体识别调试心得与备忘
    Sublime text3使用时有卡顿现象
  • 原文地址:https://www.cnblogs.com/xiaofeng666/p/12773018.html
Copyright © 2011-2022 走看看