centos7配置阿里云的镜像站点作为软件包下载源

目录

1、备份

[2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/](#2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/)

3、测试


阿里镜像提供的配置方法:centos镜像_centos下载地址_centos安装教程-阿里巴巴开源镜像站

1、备份

[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/

出现错误的原因:我在配置静态IP时,没有配置DNS服务器地址,导致本地无法将域名解析成IP地址,从而导致无法连接上阿里云服务器的镜像仓库。

重启网卡,使得修改的配置文件信息生效。重新下载,发现此时能成功下载了。

3、测试

[root@localhost ~]# yum install httpd -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to mirrors.aliyuncs.com:80; Connection refused"
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
base                                                                                                                                                                                       | 3.6 kB  00:00:00     
extras                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                    | 2.9 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-99.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-99.el7.centos.1 for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-7.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7_9.1 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-99.el7.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================
 Package                                           Arch                                         Version                                                       Repository                                     Size
==================================================================================================================================================================================================================
Installing:
 httpd                                             x86_64                                       2.4.6-99.el7.centos.1                                         updates                                       2.7 M
Installing for dependencies:
 apr                                               x86_64                                       1.4.8-7.el7                                                   base                                          104 k
 apr-util                                          x86_64                                       1.5.2-6.el7_9.1                                               updates                                        92 k
 httpd-tools                                       x86_64                                       2.4.6-99.el7.centos.1                                         updates                                        94 k
 mailcap                                           noarch                                       2.1.41-2.el7                                                  base                                           31 k

Transaction Summary
==================================================================================================================================================================================================================
Install  1 Package (+4 Dependent packages)

Total download size: 3.0 M
Installed size: 10 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/5): apr-1.4.8-7.el7.x86_64.rpm                                                                                                                                                          | 104 kB  00:00:00     
(2/5): apr-util-1.5.2-6.el7_9.1.x86_64.rpm                                                                                                                                                 |  92 kB  00:00:00     
(3/5): httpd-tools-2.4.6-99.el7.centos.1.x86_64.rpm                                                                                                                                        |  94 kB  00:00:00     
(4/5): mailcap-2.1.41-2.el7.noarch.rpm                                                                                                                                                     |  31 kB  00:00:00     
(5/5): httpd-2.4.6-99.el7.centos.1.x86_64.rpm                                                                                                                                              | 2.7 MB  00:00:05     
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                             519 kB/s | 3.0 MB  00:00:05     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-7.el7.x86_64                                                                                                                                                                         1/5 
  Installing : apr-util-1.5.2-6.el7_9.1.x86_64                                                                                                                                                                2/5 
  Installing : httpd-tools-2.4.6-99.el7.centos.1.x86_64                                                                                                                                                       3/5 
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                                                                                                    4/5 
  Installing : httpd-2.4.6-99.el7.centos.1.x86_64                                                                                                                                                             5/5 
  Verifying  : httpd-2.4.6-99.el7.centos.1.x86_64                                                                                                                                                             1/5 
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                                                                                                    2/5 
  Verifying  : apr-1.4.8-7.el7.x86_64                                                                                                                                                                         3/5 
  Verifying  : httpd-tools-2.4.6-99.el7.centos.1.x86_64                                                                                                                                                       4/5 
  Verifying  : apr-util-1.5.2-6.el7_9.1.x86_64                                                                                                                                                                5/5 

Installed:
  httpd.x86_64 0:2.4.6-99.el7.centos.1                                                                                                                                                                            

Dependency Installed:
  apr.x86_64 0:1.4.8-7.el7                    apr-util.x86_64 0:1.5.2-6.el7_9.1                    httpd-tools.x86_64 0:2.4.6-99.el7.centos.1                    mailcap.noarch 0:2.1.41-2.el7                   

Complete!

从上面的日志来看,确实是从阿里云的镜像站点下载了软件包。在YUM配置中,使用了默认的镜像站点作为软件包的下载源。

配置成功!

相关推荐
眷怀15 小时前
网卡绑定bonding
linux·运维·服务器·网络·云计算
数勋API17 小时前
银行卡归属地查询API接口如何用PHP调用
开发语言·云计算·php
tmgmforex202419 小时前
亚马逊云计算部门挑战英伟达,提供免费AI计算能力
人工智能·科技·云计算
CCSBRIDGE1 天前
给阿里云OSS绑定域名并启用SSL
阿里云·云计算·ssl
沈艺强1 天前
云计算在esxi 主机上创建 4g磁盘,同时在此磁盘上部署linux
云计算
九河云2 天前
AWS EC2镜像费用详解:什么是免费的,什么是收费的?
服务器·云计算·aws
杰森V+2 天前
融云:社交泛娱乐出海机会尚存,跨境电商异军突起
网络·云计算
CoderJia程序员甲2 天前
阿里云Linux安装Docker服务报错问题
linux·阿里云·docker
腾讯蓝鲸智云2 天前
大模型在蓝鲸运维体系应用——蓝鲸运维开发智能助手
运维·自动化·云计算·sass
paixiaoxin2 天前
学术界的秘密武器:Zotero7大插件推荐
论文阅读·经验分享·笔记·云计算·学习方法·zotero·1024程序员节