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

目录

1、备份

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

配置成功!

相关推荐

  1. centos7安装docker(包含yum配置阿里镜像

    2024-03-30 05:14:01       37 阅读
  2. 修改Ubuntu镜像阿里镜像

    2024-03-30 05:14:01       14 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-30 05:14:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-30 05:14:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-30 05:14:01       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-30 05:14:01       20 阅读

热门阅读

  1. 《Linux 源码趣读》的读书笔记-第1部分

    2024-03-30 05:14:01       18 阅读
  2. vue-路由详解

    2024-03-30 05:14:01       18 阅读
  3. 微信小程序uniapp+vue3+ts+pinia的环境搭建

    2024-03-30 05:14:01       20 阅读
  4. MySQL 锁合集与事务隔离级别

    2024-03-30 05:14:01       20 阅读
  5. 一些在 Spring Boot 单元测试中常用的框架

    2024-03-30 05:14:01       17 阅读
  6. 暴力枚举--烤鸡

    2024-03-30 05:14:01       20 阅读
  7. R语言数据分析基础(二)

    2024-03-30 05:14:01       21 阅读
  8. Oracal执行计划解析

    2024-03-30 05:14:01       19 阅读
  9. html5学习笔记

    2024-03-30 05:14:01       21 阅读
  10. AI学术助手:ChatGPT如何提升写作效率

    2024-03-30 05:14:01       22 阅读