第一种方式:

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

第二种方式:

vi yum.sh
#!/bin/bash
mv /etc/yum.repos.d/* /mnt
a=`cat /etc/redhat-release |awk '{print $3}'|awk -F . '{print $1}'`
if [ $a == 6 ];then
   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
else
   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
fi
yum clean all
yum makecache
chmod 777 yum.sh 
./yum.sh

  

相关文章:

  • 2022-12-23
  • 2021-08-15
  • 2021-11-30
  • 2021-07-22
  • 2021-04-11
  • 2021-04-03
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-01
  • 2021-05-17
  • 2021-11-09
  • 2021-08-10
  • 2022-03-08
相关资源
相似解决方案