centos6不能使用网络yum的解决办法

目前各大镜像网站已经不支持6版本的epel源了 如果想使用 可以按照如下的办法进行配置 就可以使用epel源了 前提是机器可以通外网

# cd /etc/yum.repos.d
# mkdir bak
# mv * bak/
# cat ba.repo 
[base]
name=CentOS-$releasever - Base
#baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

# yum clean all
# yum makecache fast

来吧 展示

我的信息如下 配置好既可以使用网络yum了

[root@localhost yum.repos.d]# pwd
/etc/yum.repos.d
[root@localhost yum.repos.d]# ls
bak  ba.repo
[root@localhost yum.repos.d]# cat ba.repo 
[base]
name=CentOS-$releasever - Base
#baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=https://archives.fedoraproject.org/pub/archive/epel/6/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
[root@localhost yum.repos.d]# cat /etc/redhat-release 
CentOS release 6.9 (Final)


[root@localhost yum.repos.d]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.38) 56(84) bytes of data.
64 bytes from 14.215.177.38: icmp_seq=1 ttl=55 time=17.8 ms
64 bytes from 14.215.177.38: icmp_seq=2 ttl=55 time=17.8 ms
^C
--- www.a.shifen.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1596ms
rtt min/avg/max/mdev = 17.806/17.814/17.822/0.008 ms

[root@localhost yum.repos.d]# yum list | grep base | head
PyYAML.x86_64                                   3.10-3.1.el6               @base
alsa-lib.x86_64                                 1.1.0-4.el6                @base
apr.x86_64                                      1.3.9-5.el6_9.1            @base
apr-util.x86_64                                 1.3.9-3.el6_0.1            @base
apr-util-ldap.x86_64                            1.3.9-3.el6_0.1            @base
atk.x86_64                                      1.30.0-1.el6               @base
autoconf.noarch                                 2.63-5.1.el6               @base
automake.noarch                                 1.11.1-4.el6               @base
avahi-libs.x86_64                               0.6.25-17.el6              @base
basesystem.noarch                               10.0-4.el6                 @anaconda-CentOS-201703281317.x86_64/6.9

安装一个包试试
[root@localhost yum.repos.d]# yum -y install zeromq
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package zeromq.x86_64 0:2.2.0-4.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================
 Package                       Arch                          Version                            Repository                   Size
==================================================================================================================================
Installing:
 zeromq                        x86_64                        2.2.0-4.el6                        base                        231 k

Transaction Summary
==================================================================================================================================
Install       1 Package(s)

Total download size: 231 k
Installed size: 871 k
Downloading Packages:
zeromq-2.2.0-4.el6.x86_64.rpm                                                                              | 231 kB     00:01     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : zeromq-2.2.0-4.el6.x86_64                                                                                      1/1 
  Verifying  : zeromq-2.2.0-4.el6.x86_64                                                                                      1/1 

Installed:
  zeromq.x86_64 0:2.2.0-4.el6                                                                                                     

Complete!
[root@localhost yum.repos.d]# 

如果还不能满足你的需求 觉得易用性很差或者确保 请把repo文件的内容换成如下的部分

[base]
name=CentOS-6
failovermethod=priority
baseurl=https://vault.centos.org/6.9/os/x86_64/
gpgcheck=0

然后 如下操作 就可以正常用了

yum clean all
yum makecache fast
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值