• 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]# 
  • 相关阅读:
    Beta 冲刺 (2/7)
    Beta 冲刺 (1/7)
    2017软件工程实践总结
    华为软件开发云评测
    android开发——用户头像
    学生&部门智能匹配程序
    学生会里学生汇
    数独棋盘生成器
    读与思
    Java接口
  • 原文地址:https://www.cnblogs.com/xiaofeng666/p/12773018.html
Copyright © 2020-2023  润新知