更换centos源

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更换centos源相关的知识,希望对你有一定的参考价值。

我的虚拟机中在安装GoAccess的时候,说找不到GeoIP...尴尬。

这里暂时不说GeoIP的事情,我想更新一下我的yum源,因为我系统(Centos 6.5)使用的是默认的源。速度比较慢,这里先换一下源,我采用的是阿里的源。

 

第一步:备份你的原镜像文件,以免出错后可以恢复。

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

 

第二步:下载新的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
CentOS 6
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
Centos 7
  wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

 

第三步:运行yum makecache生成缓存

yum clean all    #清除缓存目录下的软件包及旧的headers
yum makecache    #将服务器上的软件包信息在本地缓存,以提高搜索安装软件的速度
yum -y update #全部更新(可选)( -y 自动选择y,全自动)

 

以上是关于更换centos源的主要内容,如果未能解决你的问题,请参考以下文章

更换 Fragment 并按回

android寻呼机滑动标签条片段更换器

centos8更换国内源(阿里源)

CentOS-Mysql-Access denied for user root 更换root 密码

centos8将yum源更换为国内(阿里云)源

CentOS-7.5 更换清华大学 yum 源