AWS服务器的CENTOS 提示
rpm -qa |grep yum
rpm -e yum-plugin-fastestmirror-1.1.31-50.el7.noarch –nodeps
rpm -e yum-3.4.3-161.el7.centos.noarch –nodeps
rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 –nodeps
yum-utils-1.1.31-54.el7_8.noarch
移动除些源
下载新源
cd /var/www/setup
wget https://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget https://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/python-urlgrabber-3.10-10.el7.noarch.rpm
wget https://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.163.com/centos/7.9.2009/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirror.centos.org/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
重新编辑REPO
curl http://mirrors.163.com/.help/CentOS7-Base-163.repo -o /etc/yum.repos.d/CentOS6-Base-163.repo
vim /etc/yum.repo/CentOS7-Base-163.repo
如果网络允许,baseurl可以使用外网地址,并使用全文替换:
:1,$s/$releasever/7
否则,可以本地挂载iso系统光盘
修改yum的代码,vi /bin/yun 第一行python 改成python2
同样修改yum 命令使用到的python
vi /usr/libexec/urlgrabber-ext-down
修改报错文件,将头行”#!/usr/bin/python” 改为 “#!/usr/bin/python2″即可。
重建缓存并使用yum install 来进行测试是否yum源重建成功
清除缓存
[root@localhost yum.repos.d]# yum clean all
重建缓存,以提高搜索安装软件的速度
[root@localhost yum.repos.d]# yum makecache
更新系统(可选)
[root@localhost yum.repos.d]# yum update
测试yum安装:
[root@localhost yum.repos.d]# yum install vsftp