1. 程式人生 > >CentOS 修改yum源為國內源

CentOS 修改yum源為國內源

  1. 備份原始檔
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  2. 下載新的CentOS-Base.repo 到/etc/yum.repos.d/ (注:阿里、網易、搜狐任選其一)
    CentOS 5
    阿里: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
    網易: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo


    CentOS 6
    阿里: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    網易: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
    CentOS 7
    阿里: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    網易: wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

  3. 生成快取
    yum makecache

  4. 執行更新
    yum -y update