Modify the Linux source Linux yum yum modify source

Modify Linux source yum

The first way:

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

The second way:

1
vi yum.sh
1
2
3
4
5
6
7
8
9
10
#!/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
1
chmod  777  yum.sh 
1
./yum.sh

  

The first way:

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

The second way:

1
vi yum.sh
1
2
3
4
5
6
7
8
9
10
#!/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
1
chmod  777  yum.sh 
1
./yum.sh

  

Guess you like

Origin www.cnblogs.com/shuangfeike/p/11824343.html