查看原有的yum
rpm -qa | grep yum
删除yum下的所有组件
rpm -qa | grep yum | xargs rpm -e --nodeps
查询原有yum配置,并删除
whereis yum
rm -fr /etc/yum
获取当前系统版本
cat /etc/redhat-release
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/yum-plugin-aliases-1.1.31-54.el7_8.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/yum-updateonboot-1.1.31-54.el7_8.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/yum-utils-1.1.31-54.el7_8.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/yum-metadata-parser-1.1.4-10.el7.aarch64.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/yum-cron-3.4.3-168.el7.centos.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-chardet-2.2.1-3.el7.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-devel-2.7.5-89.el7.x86_64.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-libs-2.7.5-89.el7.x86_64.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/rpm-python-4.11.3-45.el7.x86_64.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/libxml2-python-2.9.1-6.el7.5.x86_64.rpm
wget http://mirror.centos.org/altarch/7/os/aarch64/Packages/python-2.7.5-89.el7.x86_64.rpm
安装
rpm -ivh --force --nodeps *.rpm
rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rm -ivh yum-3.4.3-168.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
检查 是否安装yum
rpm -qa |grep yum
更换国内源
有两种方式
直接修改 CentOS-Base.repo,改为国内源地址即可
删掉/转移到别的位置 CentOS-Base.repo,或者改一下后缀,改成非.repo,然后将从国内备份站点下载新 repo 放入 /etc/yum.repos.d/目录即可,这里只说使用 wget下载工具直接下载的情况。
/etc/yum.repos.d文件夹下,下载CentOS7-Base-163.repo (有可能没有 CentOS7-Base-163.repo文件)
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo_OLD
wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo
mv Centos-7.repo CentOS-Base.repo
更新yum缓存–未测试
# 清除
yum clean all
# 更新列表
yum list
# 缓存yum包信息到本地
yum makecache
# 测试
yum update