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配置中,使用了默认的镜像站点作为软件包的下载源。

配置成功!

相关推荐
木子Linux5 小时前
【Linux打怪升级记 | 问题01】安装Linux系统忘记设置时区怎么办?3个方法教你回到东八区
linux·运维·服务器·centos·云计算
CESS_Cloud1 天前
CESS 出席华盛顿区块链政策峰会:参与国家安全与数据隐私保护专题讨论
安全·阿里云·web3·去中心化·区块链
HaoHao_0101 天前
云消息队列 Kafka 版
分布式·阿里云·kafka·云计算·云服务器
sinat_307021532 天前
大数据技术与应用——大数据处理技术(一)(山东省大数据职称考试)
大数据·云计算
HaoHao_0102 天前
云消息队列 RabbitMQ 版
阿里云·云计算·云服务器
終不似少年遊*2 天前
云计算HCIP-OpenStack01
云原生·云计算·学习笔记·openstack·hcip·虚拟化
云计算DevOps-韩老师2 天前
【网络云计算】2024第51周-每日【2024/12/20】小测-理论-周测
云计算
jmoych2 天前
我在华为的安全日常
大数据·运维·网络·安全·华为·架构·云计算
HaoHao_0102 天前
应用实时监控服务ARMS
阿里云·云计算·云服务器
树莓集团2 天前
什么是数字化转型?对企业发展的帮助有哪些?
大数据·人工智能·云计算·新媒体运营·媒体