首页 > 其他 > 详细

if多系统配置yum源

时间:2020-04-25 15:47:49      阅读:58      评论:0      收藏:0      [点我收藏+]
 1 [root@localhost if]# cat yum_if.sh 
 2 
 3 #!/bin/bash
 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 24 [root@localhost if]# cat /etc/yum.repos.d/Centos7u4.repo 25 [Centos7u4] 26 name=Centos7u4 27 baseurl=http://192.168.0.117/Base7u4.repo 28 gpgcheck=0 29 [root@localhost if]#

 

if多系统配置yum源

原文:https://www.cnblogs.com/xiaofeng666/p/12773018.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!