为centos7配置阿里yum源遇到的问题以及解决方法

【问题背景】

卸载安装的Ambari,之前都是因为卸载不干净。这次重写安装,卸载完之后,发现httpd无法启动,所以想卸载httpd进行重新安装,但是执行命令yum list | grep httpd报错。

【遇到的问题】

配置过程很简单,去https://opsx.alibaba.com/mirror 获得执行命令:

但是我在执行yum makecache时报错,报错信息如下:

Loaded plugins: fastestmirror, langpacks, priorities
Repository epel is listed more than once in the configuration
Cleaning repos: base epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[[email protected] yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks, priorities
Repository epel is listed more than once in the configuration
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyun.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP 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/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30000 milliseconds‘)
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30001 milliseconds‘)
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30001 milliseconds‘)
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30001 milliseconds‘)
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30001 milliseconds‘)
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, ‘Connection timed out after 30001 milliseconds‘)
Trying other mirror.
...

【解决方法】

在网上找了好多帖子,都没能解决我的问题,后来看到是HTTP请求失败,尝试本地访问之前wget下来的 CentOS-Base.repo 发现其中的:

http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

等URL通过http的形式根本无法访问,此时将变量$releasever改为7(我的系统是centos 7),发现可以访问了,顺便将所有的变量$releasever都改为7。感觉这个变量$releasever根本就没起作用呀。

改完之后,执行yum clean all 以及 yum makecache 成功。

oaded plugins: fastestmirror, langpacks
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                 | 3.6 kB  00:00:00
extras                                                                                                               | 3.4 kB  00:00:00
updates                                                                                                              | 3.4 kB  00:00:00
(1/12): base/x86_64/group_gz                                                                                         | 166 kB  00:00:00
(2/12): base/x86_64/primary_db                                                                                       | 6.0 MB  00:00:00
(3/12): base/x86_64/filelists_db                                                                                     | 7.1 MB  00:00:00
(4/12): base/x86_64/other_db                                                                                         | 2.6 MB  00:00:00
(5/12): extras/x86_64/prestodelta                                                                                    |  73 kB  00:00:00
(6/12): extras/x86_64/primary_db                                                                                     | 215 kB  00:00:00
(7/12): extras/x86_64/other_db                                                                                       | 131 kB  00:00:00
(8/12): extras/x86_64/filelists_db                                                                                   | 249 kB  00:00:00
(9/12): updates/x86_64/prestodelta                                                                                   | 945 kB  00:00:00
(10/12): updates/x86_64/filelists_db                                                                                 | 5.2 MB  00:00:00
(11/12): updates/x86_64/other_db                                                                                     | 764 kB  00:00:00
(12/12): updates/x86_64/primary_db                                                                                   | 7.4 MB  00:00:00
Metadata Cache Created

原文地址:https://www.cnblogs.com/xuelisheng/p/11452926.html

时间: 2024-11-06 18:30:11

为centos7配置阿里yum源遇到的问题以及解决方法的相关文章

CentOS-7配置阿里YUM源

配置阿里云YUM源:1,备份 #cd /etc/yum.repo.d/#mkdir repos#mv *.repo repos2,下载 #wget wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 3,#yum install -y epel-release.noarch 按装epel扩展源4,之后运行yum makecache生成缓存 原文地址:https://blog.

CentOS7 配置163 yum源(详细步骤)

CentOS7 配置163 yum源 1)下载repo文件 wget http://mirrors.163.com/.help/CentOS7-Base-163.repo 2)备份并替换系统的repo文件 cp CentOS7-Base-163.repo /etc/yum.repos.d/ cd /etc/yum.repos.d/ mv CentOS-Base.repo CentOS-Base.repo.bak mv CentOS7-Base-163.repo CentOS-Base.repo

虚拟机centos7配置本地yum源

在虚拟机中要使用yum命令,就要先配置一下yum源,下面就分享一下这个过程: 1. 挂载iso到vmware,首先得确保CD/DVD连接到镜像.可以这样操作 2. 执行下面的命令 # mkdir /mnt/cdrom # mount /dev/cdrom /mnt/cdrom 3. 建立本地的yum源配置文件local.repo,配置文件内容如下: [serid] name=lty   ---->名字可以随意取 baseurl=file:///mnt/cdrom   ---->上面创建的目录

centos7配置国内yum源

文章目录 1.什么是yum仓库? 2.yum仓库配置 2.1.阿里镜像仓库配置 2.1.1.配置步骤 2.1.2.epel源 安装和配置 2.1.3.查看yum源 2.2.配置 清华大学镜像仓库 1.什么是yum仓库? yum仓库就是使用yum命令下载软件的镜像地址. 我们通常使用 yum install 命令来在线安装 linux系统的软件, 这种方式可以自动处理依赖性关系,并且一次安装所有依赖的软体包,但是经常会遇到从国外镜像下载速度慢,无法下载的情况.那么此时我们就需要把我们的yum 源改

CentOS7配置本地Yum源

从CentOS7官网下载DVD中存在需要的大部分软件,所以在没有网络的情况下可以配置yum源为本地的DVD,下载速度快,软件稳定.1. 如果使用虚拟机,那么就在虚拟机中挂载DVD的iso文件.2. 使用如下命令新建一个挂载点并挂载修改yum源配置 mkdir /media/CentOS mount -t auto /dev/cdrom /media/CentOS 通过命令mount可以查看已挂载的结果如下所示: 3. 修改yum源配置,把CentOS-Base.repo文件备份 cd /etc/

CentOS6.8配置阿里yum源

1.cd /etc/yum.repos.d/ 进入yum源存放目录,默认会带有官方的yum源 2.rm -rf * 因为这些地址都是国外的源,下载时候速度会慢很多,删掉,下面给它替换成阿里的源 3.wget http://mirrors.aliyun.com/repo/Centos-6.repo 下载阿里的yum源 4.yum clean all 清空一下yum的缓存 5.yum repolist 查看yum源的列表并自动下载一些相应的元数据存到本地 6.yum -y install 软件名称

centos7配置本地yum源 使用安装镜像安装软件

1. 在cdrom挂载安装镜像.(物理机则插入光盘,虚拟机则在CD/DVD中选择iso镜像.如果虚拟机mount时提示找不到则在选择iso镜像上方勾选“已连接”和“启动时连接”,或者点击 虚拟机下方状态栏的光盘图标.) 2. 创建挂载点mkdir /media/centos 3. 挂载镜像 mount -t auto /dev/cdrom /media/centos (现在可以使用rpm安装镜像里的rpm包,安装nano编辑器命令如下:rpm -ivh /media/centos/Package

本地yum源 、阿里yum源、163yum源的配置安装

一.本地yum源 (我使用的7.3版本) 1..添加一个新的yum源配置文件dvd.repo(文件名字自定义) vi etc/yum.repos.d     添加新的内容: name=rhel_dvd                        baseurl=file://'/run/media/root/RHEL-7.3 Server.x86_64'(根据实际地址填写)                        enabled=1                        gpgc

CentOS7.2配置本地yum源

1.检查是否有本地yum源 1)检查是否能连网 ping www.baidu.com 2)检查是否有本地yum源 yum list 2.挂载镜像文件 以上检查,说明确实是内网,也确实没有本地yum源,那我们就需要配置一个本地yum源,去解决某些软件的依赖安装 1)查看操作系统 cat /etc/redhat-release 2)上传相应的镜像文件至服务器 3)挂载镜像文件 将刚刚上传的镜像文件挂载到/home/iso/目录下(你可以挂载到自己的目录下,如果是挂载到镜像文件的路径,之前的镜像文件会