Linux CentOS 6不能使用yum安装命令

  1. 当前CenOS 系统是2.6版本的, 在安装python-requests模块时,报错:

[root@tester pluginconf.d]# uname -a
Linux tester 2.6.32-431.23.3.el6.x86_64 #1 SMP Thu Jul 31 17:20:51 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

root@tester yum.repos.d]# yum install python-requests -y
Loaded plugins: security
Setting up Install Process
Repository rabbitmq_erlang is listed more than once in the configuration
Repository rabbitmq_erlang-source is listed more than once in the configuration
http://mirrors.aliyun.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”
Trying other mirror.
To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn’t help to resolve this issue please use https://bugs.centos.org/.

http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: (28, ‘connect() timed out!’)
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - “The requested URL returned error: 404 Not Found”
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
[root@tester yum.repos.d]#

  1. 百度说 2020年12月2号之后,CentOS 6更新包下架了,导致找不到更新软件而失败。

  2. 备份下面2个文件

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.backup

  1. 到阿里云上下载CenOS 7的 CentOS-Base.repo文件和

阿里云网址:https://developer.aliyun.com/mirror/centos?spm=a2c6h.13651102.0.0.3e221b11sjf0dJ 下载CentOS-Base.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

阿里云网址:https://developer.aliyun.com/mirror/epel?spm=a2c6h.13651102.0.0.3e221b11p0e5G5下载epel.report
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

然后使用vi编辑器,将CentOS-Base.repo文件中$releasever全部改成7, 因为这个参数获得的是当前系统的版本6

cd /etc/yum.repos.d
vi CentOS-Base.repo
:%s/KaTeX parse error: Expected 'EOF', got '#' at position 16: releasever/7/g #̲将文件中releasever全部改成7

  1. 清除缓存:
    [root@tester yum.repos.d]# yum clean all
    [root@tester yum.repos.d]# yum makecache

  2. 再运行yum install python-requsts -y 就可以执行了, 不过最后出现了其它的安装错误,信息如下, 搞不定了

–> Processing Dependency: python(abi) = 2.6 for package: python-iwlib-0.1-1.2.el6.x86_64
—> Package python-libs.x86_64 0:2.6.6-52.el6 will be updated
–> Processing Dependency: libpython2.6.so.1.0()(64bit) for package: python-iwlib-0.1-1.2.el6.x86_64
—> Package upstart.x86_64 0:0.6.5-13.el6_5.3 will be obsoleted
–> Processing Dependency: upstart for package: 1:readahead-1.5.6-2.el6.x86_64
—> Package zabbix-agent.x86_64 0:3.4.15-1.el6 will be an update
–> Processing Dependency: libpcre.so.0()(64bit) for package: zabbix-agent-3.4.15-1.el6.x86_64
–> Processing Dependency: /sbin/new-kernel-pkg for package: kernel-2.6.32-431.23.3.el6.x86_64
–> Restarting Dependency Resolution with new changes.
Error: Depsolving loop limit reached.
Error: Package: python-iwlib-0.1-1.2.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: python(abi) = 2.6
Removing: python-2.6.6-52.el6.x86_64 (@updates)
python(abi) = 2.6
Updated By: python-2.7.5-90.el7.x86_64 (updates)
python(abi) = 2.7
python(abi) = 2.7
Available: python-2.7.5-89.el7.x86_64 (base)
python(abi) = 2.7
python(abi) = 2.7
Available: python3-3.6.8-17.el7.i686 (base)
python(abi) = 3.6
python(abi) = 3.6
Available: python3-3.6.8-18.el7.i686 (updates)
python(abi) = 3.6
python(abi) = 3.6
Available: python34-3.4.10-7.el7.x86_64 (epel)
python(abi) = 3.4
Error: Package: ppl-0.10.2-11.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: libgmp.so.3()(64bit)
Removing: gmp-4.3.1-7.el6_2.2.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
libgmp.so.3()(64bit)
Updated By: 1:gmp-6.0.0-15.el7.x86_64 (base)
Not found
Error: Package: cloog-ppl-0.15.7-1.2.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: libgmp.so.3()(64bit)
Removing: gmp-4.3.1-7.el6_2.2.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
libgmp.so.3()(64bit)
Updated By: 1:gmp-6.0.0-15.el7.x86_64 (base)
Not found
Error: Package: hal-info-20090716-3.1.el6.noarch (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: hal >= 0.5.10
Removing: hal-0.5.14-11.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
hal = 0.5.14-11.el6
Obsoleted By: systemd-219-78.el7_9.3.x86_64 (updates)
Not found
Error: Package: 2:postfix-2.10.1-9.el7.x86_64 (base)
Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
Available: 1:mariadb-libs-5.5.68-1.el7.x86_64 (base)
libmysqlclient.so.18(libmysqlclient_18)(64bit)
Error: Package: python-iwlib-0.1-1.2.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: libpython2.6.so.1.0()(64bit)
Removing: python-libs-2.6.6-52.el6.x86_64 (@updates)
libpython2.6.so.1.0()(64bit)
Updated By: python-libs-2.7.5-90.el7.x86_64 (updates)
Not found
Error: Package: 1:readahead-1.5.6-2.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: upstart
Removing: upstart-0.6.5-13.el6_5.3.x86_64 (@updates)
upstart = 0.6.5-13.el6_5.3
Obsoleted By: systemd-219-78.el7_9.3.x86_64 (updates)
Not found
Error: Package: libgcj-4.4.7-4.el6.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
Requires: libgmp.so.3()(64bit)
Removing: gmp-4.3.1-7.el6_2.2.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
libgmp.so.3()(64bit)
Updated By: 1:gmp-6.0.0-15.el7.x86_64 (base)
Not found
Error: Package: 2:postfix-2.10.1-9.el7.x86_64 (base)
Requires: libmysqlclient.so.18()(64bit)
Available: 1:mariadb-libs-5.5.68-1.el7.x86_64 (base)
libmysqlclient.so.18()(64bit)
Error: Package: mysql-community-server-5.7.33-1.el6.x86_64 (mysql57-community)
Requires: libsasl2.so.2()(64bit)
Removing: cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64 (@anaconda-CentOS-201311291202.x86_64/6.5)
libsasl2.so.2()(64bit)
Updated By: cyrus-sasl-lib-2.1.26-23.el7.x86_64 (base)
Not found
Error: Package: zabbix-agent-3.4.15-1.el6.x86_64 (zabbix)
Requires: libpcre.so.0()(64bit)
Removing: pcre-7.8-7.el6.x86_64 (@base)
libpcre.so.0()(64bit)
Updated By: pcre-8.32-17.el7.x86_64 (base)
Not found

You could try using --skip-broken to work around the problem
** Found 2 pre-existing rpmdb problem(s), ‘yum check’ output follows:
2:postfix-2.6.6-6.el6_5.x86_64 has missing requires of libmysqlclient.so.16()(64bit)
2:postfix-2.6.6-6.el6_5.x86_64 has missing requires of libmysqlclient.so.16(libmysqlclient_16)(64bit)

重大好消息*: 最终用自己生成的 CentOS-Base.repo , epel.repo 文件,使用搜狐的镜像,可以成功更新了:

(1)先备份原先的 CentOS-Base.repo , epel.repo ,用vi编辑器生成下面内容的两个文件,

[root@tester yum.repos.d]# cat CentOS-Base.repo
[base]
name=CentOS-6
failovermethod=priority
baseurl=https://vault.centos.org/6.9/os/x86_64/
url=http://mirrors.sohu.com/centos/6.10/os/x86_64/
gpgcheck=1

[root@tester yum.repos.d]# cat epel.repo
[epel]
name=sohu-epel
baseurl=http://mirrors.sohu.com/fedora-epel/6/$basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
[root@tester yum.repos.d]#

(2)然后执行: yum clean all

                      yum makecache

(3) 再执行yum install python-requests -y 安装命令就可以顺利执行完了。

感谢 这些链接的 同学们:

https://blog.51cto.com/hcymysql/2567297 建议用搜狐的源来下载 ,目前过内搜狐的镜像源还有CentOS 6的下载文件。

https://www.xmpan.com/944.html

https://www.cnblogs.com/binbingg/p/14082610.html

https://vault.centos.org/6.9/os/x86_64/

The contents of this directory have been moved to our archives available at:

http://archives.fedoraproject.org/pub/archive/epel/     ===这里的镜像源文件可用

If you are having troubles finding something there please stop by #epel on irc.freenode.net

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值