ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

CentOS7 将阿里云的镜像源设置为yum源

2020-06-02 10:02:58  阅读:258  来源: 互联网

标签:httpd 00 x86 64 CentOS7 yum 镜像 el7


1、实验环境

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 

2、测试网络环境
服务器必须能够访问互联网,这里用ping www.baidu.com来测试,使用域名不但可以测试网络的连通性,也可以测试域名解析的功能。

[root@localhost ~]# ping www.baidu.com
PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.
64 bytes from 14.215.177.39 (14.215.177.39): icmp_seq=1 ttl=55 time=21.0 ms

3、安装wget
若Linux系统中未安装wget,需要安装wget。wget是一个非交互的下载工具,参数 y 的作用是当安装过程中需要用户输入yes或no的时候,默认为yes。

yum -y install wget

4、下载阿里云repo文件。
进入repo目录,删除系统自带的repo文件。下载阿里云的repo文件,作为服务器的yum仓库配置文件。

[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# rm -rf *
[root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/aliyun.repo http://mirrors.aliyun.com/repo/Centos-7.repo
--2020-05-31 00:00:52--  http://mirrors.aliyun.com/repo/Centos-7.repo
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 218.67.61.95, 218.67.61.32, 61.131.39.13, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|218.67.61.95|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2523 (2.5K) [application/octet-stream]
Saving to: ‘/etc/yum.repos.d/aliyun.repo’

100%[====================================================================================>] 2,523       --.-K/s   in 0s      

2020-05-31 00:00:52 (297 MB/s) - ‘/etc/yum.repos.d/aliyun.repo’ saved [2523/2523]

[root@localhost yum.repos.d]# ls
aliyun.repo

5、清除yum缓存。

[root@localhost yum.repos.d]# yum clean all

6、创建yum缓存。

[root@localhost yum.repos.d]# yum makecache

7、效果测试。
随便安装一个软件测试,这里使用安装httpd测试。

[root@localhost yum.repos.d]# yum -y install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-93.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-93.el7.centos for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.4.6-93.el7.centos.x86_64
--> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.4.6-93.el7.centos.x86_64
--> Running transaction check
---> Package apr.x86_64 0:1.4.8-5.el7 will be installed
---> Package apr-util.x86_64 0:1.5.2-6.el7 will be installed
---> Package httpd-tools.x86_64 0:2.4.6-93.el7.centos 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-93.el7.centos                      base                   2.7 M
Installing for dependencies:
 apr                           x86_64                   1.4.8-5.el7                              base                   103 k
 apr-util                      x86_64                   1.5.2-6.el7                              base                    92 k
 httpd-tools                   x86_64                   2.4.6-93.el7.centos                      base                    92 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:
warning: /var/cache/yum/x86_64/7/base/packages/apr-1.4.8-5.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for apr-1.4.8-5.el7.x86_64.rpm is not installed
(1/5): apr-1.4.8-5.el7.x86_64.rpm                                                                      | 103 kB  00:00:00     
(2/5): apr-util-1.5.2-6.el7.x86_64.rpm                                                                 |  92 kB  00:00:00     
(3/5): httpd-tools-2.4.6-93.el7.centos.x86_64.rpm                                                      |  92 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-93.el7.centos.x86_64.rpm                                                            | 2.7 MB  00:00:00     
------------------------------------------------------------------------------------------------------------------------------
Total                                                                                         4.6 MB/s | 3.0 MB  00:00:00     
Retrieving key from http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 From       : http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : apr-1.4.8-5.el7.x86_64                                                                                     1/5 
  Installing : apr-util-1.5.2-6.el7.x86_64                                                                                2/5 
  Installing : httpd-tools-2.4.6-93.el7.centos.x86_64                                                                     3/5 
  Installing : mailcap-2.1.41-2.el7.noarch                                                                                4/5 
  Installing : httpd-2.4.6-93.el7.centos.x86_64                                                                           5/5 
  Verifying  : apr-1.4.8-5.el7.x86_64                                                                                     1/5 
  Verifying  : httpd-tools-2.4.6-93.el7.centos.x86_64                                                                     2/5 
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                                                3/5 
  Verifying  : httpd-2.4.6-93.el7.centos.x86_64                                                                           4/5 
  Verifying  : apr-util-1.5.2-6.el7.x86_64                                                                                5/5 

Installed:
  httpd.x86_64 0:2.4.6-93.el7.centos                                                                                          

Dependency Installed:
  apr.x86_64 0:1.4.8-5.el7              apr-util.x86_64 0:1.5.2-6.el7         httpd-tools.x86_64 0:2.4.6-93.el7.centos        
  mailcap.noarch 0:2.1.41-2.el7        

Complete!

标签:httpd,00,x86,64,CentOS7,yum,镜像,el7
来源: https://blog.csdn.net/weixin_44631823/article/details/106442338

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有