先看有没有安装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. 【212】HDF更新数据&HDF创建

    HDF更新数据:对原有HDF数据进行数据更新,不破坏HDF的数据结构 pro add_data_sst ;实现将SST增加1度,再将结果更新到SST中 ;1. 获取SST索引 ;2. 通过索引获取ID ...

  2. ConcurrentHashMap并不是完全的线程安全

    ConcurrentHashMap通过分段锁的方式实现了高效率的线程安全,但是它能否在所有高并发场景中都能保证线程安全呢? public class TestClass { private Concu ...

  3. 开发一个最简单的Cardboard虚拟现实应用(四)做一个Cardboard第一人称控制器

    [开源互助-原创文章,转载请说明出处]第三帖中已经创建了一个cardboard自带的demo应用,但它是不能移动的,玩家只能站在原地,通过头部转动来观察四周,除此之外,玩家并没有更多的手段与游戏场景进 ...

  4. E20180430-hm

    pants n. <英>(紧身的)短裤; <美> 裤子; 喘气( pant的名词复数 ); leggings n. 绑腿; 裹腿; 绷腿; 袜统; redundant adj. ...

  5. bzoj 5496: [2019省队联测]字符串问题【SAM+拓扑】

    有一个想法就是暴力建图,把每个A向有和他相连的B前缀的A,然后拓扑一下,这样的图是n^2的: 考虑优化建图,因为大部分数据结构都是处理后缀的,所以把串反过来,题目中要求的前缀B就变成了后缀B 建立SA ...

  6. IT兄弟连 JavaWeb教程 Servlet表单乱码问题

    在使用原生的Servlet进行Web应用开发时经常会遇到一些中文乱码问题,造成乱码问题的原因只有一个:即客户端与服务端的字符编码不一致所导致的. 请求参数乱码问题 服务器端获取客户端传递过来的数据出现 ...

  7. Phoenix在2345公司的实践(转)

    本文介绍Phoenix在2345公司的实践,主要是实时查询平台的背景.难点.Phoenix解决的问题.Phoenix-Sql的优化以及Phoenix与实时数仓的融合思路.具体内容如下: 实时数据查询时 ...

  8. 1.基础数据类型的初识 字符串 bool 整型 if else elif

    ---恢复内容开始--- 计算器基础知识 cpu :人类的大脑 运算和处理问题 内存:临时存储数据 断点就消失了 高铁 硬盘:永久存储数据 图片 操作系统:是一个软件 控制每个硬件之间的数据交互 Py ...

  9. Codeforces Round #510 (Div. 2) A&B By cellur925

    第一次CF祭== 由于太菜了只做了前两题== 因为在第一题上耗费时间太多了,我还是太菜了==. A. Benches time limit per test 1 second memory limit ...

  10. Beta版本冲刺第一天!

    该作业所属课程:https://edu.cnblogs.com/campus/xnsy/SoftwareEngineeringClass2 作业地址:https://edu.cnblogs.com/c ...