zoukankan      html  css  js  c++  java
  • centos7更改国内源

    1、个人安装环境

    1.1 CentOS Linux release 7.7.1908 (Core)

    2、更改目的

    有时候CentOS默认的yum源不一定是国内镜像,导致yum在线安装及更新速度不是很理想。这时候需要将yum源设置为国内镜像站点。

    国内主要开源的开源镜像站点应该是网易和阿里云了。具体使用哪个可以根据PING命令获取time,选择time较小源

    [root@localhost yum.repos.d]# ping 163.com
    PING 63.com (127.0.0.1) 56(84) bytes of data.
    64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.099 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.097 ms
    64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.101 ms
    
    [root@localhost yum.repos.d]# ping aliyun.com
    PING aliyun.com (106.11.172.51) 56(84) bytes of data.
    64 bytes from 106.11.172.51 (106.11.172.51): icmp_seq=1 ttl=128 time=17.7 ms
    64 bytes from 106.11.172.51 (106.11.172.51): icmp_seq=2 ttl=128 time=17.4 ms
    64 bytes from 106.11.172.51 (106.11.172.51): icmp_seq=3 ttl=128 time=15.6 ms
    

    3、安装步骤

    3.1 备份源文件

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
    

     3.2 下载更改源

    • CentOS5
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    
    • CentOS6
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    
    • CentOS7
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    

    根据centos版本下载对应的新源,这里以CentOS7为例

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    

     如果wget命令不生效,说明还没有安装wget工具,输入yum -y install wget 回车进行安装,或者使用

    curl -O http://mirrors.aliyun.com/repo/Centos-7.repo
    

     3.3 清空yum缓存并生存cache文件

    yum clean all
    yum makecache
    

     3.4 尝试更新系统

    yum -y update
    
  • 相关阅读:
    递归分治策略
    矩阵连乘问题
    棋盘覆盖问题
    选择排序
    Dijkstra的双栈算术表达式求值算法
    斐波那契数列
    二分算法
    Linux服务器上tengine的安装配置
    Excel Sheet Column Number
    Excel Sheet Column Title
  • 原文地址:https://www.cnblogs.com/hester/p/12365068.html
Copyright © 2011-2022 走看看