先看有没有安装wget         wget -V      如果没有执行   yum -y install wget     进行安装

  然后进行配置的备份

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

  

  然后执行(这个是centos7的配置安装)

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

  然后执行

  yum clean all

  yum makecache

  yum update  或者  yum -y upgrade

  yum需要安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的

  yum install -y yum-utils device-mapper-persistent-data lvm2

  更换yum源:

  yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo   (使用这个安装docker更快)

  yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

  查看特定版本   yum list docker-ce --showduplicates | sort -r

  

yum -y update

升级所有包,改变软件设置和系统设置,系统版本内核都升级

yum -y upgrade

升级所有包,不改变软件设置和系统设置,系统版本升级,内核不改变

  创建多个数据源

方法二: 手动修改文件 
1、进入源目录: cd /etc/yum.repos.d 2、添加多个源文件,如:shlug.repo,ustc.repo,两个源的内容如下:
(可以创建独立的repo文件,也可以把以下的内容加到/etc/yum.repos.d/CentOS-Base.repo 后面) [shlug.repo] #mirrors-shlug-org.repo 

# rpm --import http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6

# This file uses a new mirrorlist system developed by Lance Davis for CentOS. 
# The mirror system uses the connecting IP address of the client and the 
# update status of each mirror to pick mirrors that are updated to and 
# geographically close to the client. You should use this for CentOS updates 
# unless you are manually picking other mirrors. 

# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead. 


[base] 
name=mirrors-shlug-org--CentOS-$releasever - Base 
baseurl=http://mirrors.shlug.org/centos/$releasever/os/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6 
#released updates 
[update] 
name=mirrors-shlug-org--CentOS-$releasever - Updates 
baseurl=http://mirrors.shlug.org/centos/$releasever/updates/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
#packages used/produced in the build but not released 
#[addons] 网站上的源目录没有addon,故注释掉
#baseurl=http://mirrors.shlug.org/centos/$releasever/addons/$basearch/ 
#gpgcheck=1 
#gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6 
#additional packages that may be useful 
[extras] 
name=mirrors-shlug-org--CentOS-$releasever - Extras 
baseurl=http://mirrors.shlug.org/centos/$releasever/extras/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6 
#additional packages that extend functionality of existing packages 
[centosplus] 
name=mirrors-shlug-org--CentOS-$releasever - Plus 
baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ 
gpgcheck=1 
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6 
#contrib - packages by Centos Users 
[contrib] 
name=mirrors-shlug-org--CentOS-$releasever - Contrib 
baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/ 
gpgcheck=1 
enabled=0 
gpgkey=http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6 [ustc.repo] # CentOS-Base.repo
#
# This file uses a new mirrorlist system developed by Lance Davis for CentOS.
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
# [base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://centos.ustc.edu.cn/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://centos.ustc.edu.cn/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #packages used/produced in the build but not released
#[addons] 网站上的源目录没有addon,故注释掉
#name=CentOS-$releasever - Addons
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://centos.ustc.edu.cn/centos/$releasever/addons/$basearch/
#gpgcheck=1
#gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://centos.ustc.edu.cn/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 #additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://centos.ustc.edu.cn/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 3、导入KEY rpm --import http://mirrors.shlug.org/centos/RPM-GPG-KEY-CentOS-6
rpm --import http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-6 4、安装自动源选择插件--自动选择最快的源 yum install yum-fastestmirror -y 5、如何确认正在使用的是哪个源? cd /var/cache/yum
cat timedhosts.txt

centos 更换yum源 (解决下载慢的问题)的更多相关文章

  1. Centos更换yum源

    Centos更换yum源 步骤如下: 备份原始源 cd /etc/yum.repos.d/ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/ ...

  2. Centos更换yum源,安装ssh server

    先连上网,然后更换yum源 1. 新建的用户没有sudo权限,所以首先切换到root用户su -输入密码 2. 备份之前的yum源mv /etc/yum.repos.d/CentOS-Base.rep ...

  3. CentOS 更换yum源为aliyun yum源

    CentOS自带的yum源为官方的源,由于墙的原因,经常无法访问,国内也有不错的源,这里讲一下使用aliyun的源替换原yam源. 第一种方法 1.安装base reop源 cd /etc/yum.r ...

  4. centos更换yum源为aliyun源

    国外的yum源由于众所周知的GFW原因,有的被墙,有的很慢,阿里云依靠强大的技术优势建立了国内的开源镜像.阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 第一步: ...

  5. centos 更换 yum源

    阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ CentOS系统更换软件安装源第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos ...

  6. maven更换下载镜像源-解决下载慢问题(转)

    转自:http://www.cnblogs.com/duking1991/p/6110192.html maven更换下载镜像源-解决下载慢问题   Maven是当前流行的项目管理工具,但官方的库在国 ...

  7. .net core 更换yum源 / “No package libgdiplus-devel available.” 错误解决方法

    安装 libgdiplus-devel yum install libgdiplus-devel 如果出现错误 No package libgdiplus-devel available. 原因可能是 ...

  8. linux更换yum源

    由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源,以下为详细过程: 1.删除redhat原有的yum rpm - ...

  9. redhat6.5 配置使用centos的yum源

    新安装了redhat6.5安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription Ma ...

随机推荐

  1. 「LuoguT36048」 Storm in Lover

    Description 平成二十四年(2012年),5月11日,东京,某弓道场. "呐,呐,海未酱,你听说了吗?几天后的那场弓道大会?啊-!"橙发少女兴奋地拿着一张传单一样的纸跑向 ...

  2. [POI2007] 大都市

    [题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=1103 [算法] 树链剖分 时间复杂度 : O(NlogN ^ 2) [代码] #in ...

  3. AutoIt:获取计算机已安装程序列表

    $file = FileOpen(@ScriptDir&"\RegInstalledItems.csv",1) if $file = -1 Then ConsoleWrit ...

  4. MyBatis相关资源

    MyBatis很多项目中有用到,但会用并不表示你真正理解它,更不代表你能很清楚的教会别人.如果想在会用它的基础上更深入的通过学习它而提升自己技术能力,可利用下面资源. 1.官网文档,基本概念讲的很清楚 ...

  5. 利用高德地图javascriptAPI做一个自己的地图

    最近由于项目中需要制作一个地图,用来选择活动地点,我就花了两天利用高德地图的javascriptAPI自制了一个地图的demo.在这了记录一下我学习的过程. 一.进入高德地图官网,再找到高德地图的开放 ...

  6. 让ie支持css3的一些htc文件

    1. Dean Edwards的IE7.js (以及 IE8.js, IE9.js)这个玩意估计是试图让IE支持CSS3属性的鼻祖,还算蛮强大,就是性能开销较大,要解析很多文件脚本,给DOM添加大量的 ...

  7. ORA-01152: 文件 1 没有从过旧的备份中还原

    转自:http://blog.itpub.net/8520577/viewspace-1255794/ 做了一个全备 RMAN> show all; 使用目标数据库控制文件替代恢复目录db_un ...

  8. oracle报ORA-00911:invalid character

    转自:http://www.cnblogs.com/chuang-sharing/p/9493316.html 今天查问题的时候,发现一个在分号后边加注释,解析错误的问题: select decode ...

  9. django上课笔记4-复习数据库操作-复习模板-Seccion-详细cookie和session的区别

    一.复习数据库操作 字段类型 字符串 EmailField(CharField): IPAddressField(Field) URLField(CharField) SlugField(CharFi ...

  10. PCB 线路铜皮面积(残铜率)计算的实现方法

    一个多月没更新博客园了,这里继续分享关于PCB工程相关一些知识,做过PCB工程都知道用使用genesis或incam是可以非常方便的计算得到铜皮面积这个参数[下图],但实际这个软件是通过什么算法计算出 ...