修改redhat7.5的yum源为阿里云的yum源

1,强制卸载所有包

rpm -qa|grep yum|xargs rpm -e --nodeps

2,查看是否卸载完全

rpm -qa|grep yum

3,下载相关的rpm插件,

mkdir  software

cd software

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-4.11.3-43.el7.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-build-libs-4.11.3-43.el7.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/rpm-python-4.11.3-43.el7.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/wget-1.14-18.el7_6.1.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-167.el7.centos.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-filter-data-1.1.31-53.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-53.el7.noarch.rpm

wget https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-53.el7.noarch.rpm

4,安装所有插件

rpm -ivh *.rpm --force --nodeps

5,修改yum配置

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

6,修改CentOS-Base.repo文件

vi /etc/yum.repos.d/CentOS-Base.repo 

$releasever全局替换成7执行

:%s/$releasever/7/g 

mirrors.aliyuncs.com 全部改成 mirrors.aliyun.com 不然后面会报错,mirrors.aliyuncs.com这个域名好像有问题,具体情况不明:

:s/aliyuncs/aliyun/g

:wq  保存退出

7,#yum clean all

#yum makecache     生成元数据缓存

测试

yum -y install tree  用tree查看文件夹结构

 

 

 

 

 

你可能感兴趣的:(linux)