备份原配置文件

进入yum源配置目录:
cd /etc/yum.repos.d

如果没有先安装wget:
sudo yum install wget

修改yum源,就是修改CentOS-Base.repo的内容,所以我们要先备份一下原来的:
sudo mv CentOS-Base.repo CentOS-Base.repo.backup

下载新配置文件

然后用wget下载国内的yum源(即CentOS-Base.repo文件),新的在哪呢?目前国内主要有三个yum源:

个人比较推荐中科大,不管是centos还是Ubuntu

阿里云

CentOS7

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

CentOS6

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS5

sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

网易

CentOS7

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo

CentOS6

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo

CentOS5

sudo wget -O CentOS-Base.repo http://mirrors.163.com/.help/CentOS5-Base-163.repo

中科大

CentOS7

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3

CentOS6

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=2

CentOS5

sudo wget -O CentOS-Base.repo https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=1

更新元数据

先清除原来的元数据缓存

sudo yum clean all

更新新的元数据缓存

sudo yum makecache

CentOS修改各大yum源(centos5,centos6,centos7)的更多相关文章

  1. RHEL/CentOS/Fedora常用的 CentOS 5/6/7 yum 源(EPEL、Remi、RPMForge、RPMFusion, ius,163,sohu,阿里云)配置

    RHEL以及他的衍生发行版如CentOS.Scientific Linux为了稳定,官方的rpm repository提供的rpm包往往是很滞后的,当然了,这样做这是无可厚非的,毕竟这是服务器版本,安 ...

  2. [转载]CentOS 7 创建本地YUM源

    本文中的"本地YUM源"包括三种类型:一是直接使用CentOS光盘作为本地yum源,优点是简单便捷,缺点是光盘软件包可能不完整(centos 7 Everything 总共才6.5 ...

  3. 为CentOS 6 配置本地YUM源

    在网上找了很多为CentOS 6配置本地YUM源的方法,其中有很多是与网络相关的,我只想配个自己用的,结果就发现这个方法比较简单实用,就转过来了. 环境:CentOS 6.0 默认的yum是以网络来安 ...

  4. CentOS 6.x 本地yum源配置与使用

    系统默认已经安装了可使用yum的软件包,所以可以直接配置: # mount  /dev/cdrom  /mnt                                挂载镜像,可以写到配置文件 ...

  5. 在CentOS 7上使用Yum源安装和卸载 MongoDB 3.4

    在CentOS 7上使用Yum源安装和卸载 MongoDB 3.4 1.配置Yum源 vim /etc/yum.repos.d/mongodb-org-3.4.repo [mongodb-org-3. ...

  6. 在CentOS 7下更改yum源与更新系统

    在CentOS 7下更改yum源与更新系统. [1] 首先备份/etc/yum.repos.d/CentOS-Base.repo cp /etc/yum.repos.d/CentOS-Base.rep ...

  7. Centos中阿里云yum源配置

    centos中阿里云yum源配置 1.首先备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo mv /etc/yum.repos.d/CentOS-Base ...

  8. CENTOS 6-7的本地YUM源配置

    本文档适合CENTOS 6-7的本地YUM源配置 cd /media cd CentOS_6.8_Final/ cd Packages 创建目录拷贝文件 mkdir /yum cp * /yum 配置 ...

  9. CentOS7修改为国内yum源

    备份源yum源 如果是国内下载的CentOS很可能国内YUM源已经设置好了. 备份/etc/yum.repos.d/下的*.repo文件. 在CentOS中配置使用网易和阿里的开源镜像 wget ht ...

随机推荐

  1. Python隐藏特性:字符串驻留、常量折叠

    下面是Python字符串的一些微妙的特性,绝对会让你大吃一惊. 案例一: >>> a = "some_string" >>> id(a) 140 ...

  2. 将linux上的项目传到github上

    在网友的帮助下,终于学会了这一招. 1.首先要确定你的linux上有安装了git. 2.到你的网页github上新建一个仓库,将其clone到linux上. 3.将你的项目放进这个空的仓库(文件夹). ...

  3. eclipse配置class注释模板

    /** * Copyright (c) ${year}, All Rights Reserved. * */ ${filecomment} ${package_declaration} ${typec ...

  4. 吴裕雄 python 人工智能——基于Mask_RCNN目标检测(3)

    import os import sys import random import math import re import time import numpy as np import cv2 i ...

  5. fiddler的代理设置

    fiddler通过监听系统的8888端口实现对系统浏览器发出的http报文进行截获监听,因此要使fiddler能够监听到浏览器数据,需要对浏览器设置代理端口 浏览器 <--8888端口代理--& ...

  6. P1426

    和上次的小鱼题差不多,但多了一些条件. 先把游到 $ s - x $ 米是第 $ a_i $ 秒求出来,然后判断之后在第 $ a_{i + 1} $ 秒内游的距离是否 $ \geq 2x $ ,大于就 ...

  7. DELPHI开发和使用REDIS

    DELPHI开发和使用REDIS REDIS SERVER是独立的存在,支持WINDOWS,LINUXREDIS PUB/SUB  用于聊天 只是其中的一种用法任何消息或其他类型数据 都可以必须安装 ...

  8. RedisTemplate 获取过期时间的问题

    RedisTemplate redisTemplate; Long seconds = redisTemplate.opsForValue().getOperations().getExpire(&q ...

  9. Python - 并发编程,多进程,多线程

    传送门 https://blog.csdn.net/jackfrued/article/details/79717727 在此基础上实践和改编某些点 1. 并发编程 实现让程序同时执行多个任务也就是常 ...

  10. 【代码审计】PHPCMS2008任意代码执行漏洞

    很老的漏洞了,但很经典~ 在 phpcms2008/include/global.func.php eval  可以执行命令 在这里我们看一下是谁调用 跟进string2array函数 yp/web/ ...