栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

[Linux] CentOS 7 更换阿里源

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

[Linux] CentOS 7 更换阿里源

目录

1. 备份当前yum源

2. 使用wget下载阿里yum源repo文件

3. 清理软件源

4. 把下载的阿里源设置成为默认源

5. 生成阿里yum源缓存并更新yum源


  1. 备份当前yum源
    [root@localhost ~]# cd /etc/yum.repos.d/
    [root@localhost yum.repos.d]# mv CentOS-Base.repo CentOS-Base-repo.bak

  2. 使用wget下载阿里yum源repo文件
    [root@localhost yum.repos.d]# wget http://mirrors.aliyun.com/repo/Centos-7.repo
    --2022-05-08 09:14:42--  http://mirrors.aliyun.com/repo/Centos-7.repo
    正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 221.203.223.99, 60.21.152.88, 221.203.223.103, ...
    正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|221.203.223.99|:80... 已连接。
    已发出 HTTP 请求,正在等待回应... 200 OK
    长度:2523 (2.5K) [application/octet-stream]
    正在保存至: “Centos-7.repo”
    
    100%[===========================================================================================================>] 2,523       --.-K/s 用时 0s      
    
    2022-05-08 09:14:43 (380 MB/s) - 已保存 “Centos-7.repo” [2523/2523])
    

  3. 清理软件源
    [root@localhost yum.repos.d]# yum clean all
    已加载插件:fastestmirror, langpacks
    正在清理软件源: base extras updates
    Cleaning up list of fastest mirrors

  4. 把下载的阿里源设置成为默认源
    [root@localhost yum.repos.d]# mv Centos-7.repo CentOS-Base.repo

  5. 生成阿里yum源缓存并更新yum源
    [root@localhost yum.repos.d]# yum makecache
    已加载插件:fastestmirror, langpacks
    Determining fastest mirrors
     * 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; 拒绝连接"
    正在尝试其它镜像。
    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; 未知的错误"
    正在尝试其它镜像。
    base                                                                                                                          | 3.6 kB  00:00:00     
    extras                                                                                                                        | 2.9 kB  00:00:00     
    updates                                                                                                                       | 2.9 kB  00:00:00     
    (1/10): base/7/x86_64/group_gz                                                                                                | 153 kB  00:00:00     
    (2/10): base/7/x86_64/filelists_db                                                                                            | 7.2 MB  00:00:01     
    (3/10): extras/7/x86_64/primary_db                                                                                            | 246 kB  00:00:00     
    (4/10): extras/7/x86_64/filelists_db                                                                                          | 277 kB  00:00:00     
    (5/10): base/7/x86_64/other_db                                                                                                | 2.6 MB  00:00:00     
    (6/10): extras/7/x86_64/other_db                                                                                              | 147 kB  00:00:00     
    (7/10): updates/7/x86_64/filelists_db                                                                                         | 8.2 MB  00:00:01     
    (8/10): updates/7/x86_64/other_db                                                                                             | 1.0 MB  00:00:00     
    (9/10): updates/7/x86_64/primary_db                                                                                           |  15 MB  00:00:02     
    (10/10): base/7/x86_64/primary_db                                                                                             | 6.1 MB  00:00:07     
    元数据缓存已建立
    
    [root@localhost yum.repos.d]# yum update
    已加载插件:fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * extras: mirrors.aliyun.com
     * updates: mirrors.aliyun.com
    No packages marked for update
    

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/870038.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号