Centos 7 替换镜像源
1 备份原始源
[root@localhost ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2 下载新的镜像源
- 方法1:wget直接下载
 执行命令:- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo - 操作如下: - [root@localhost yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 
 --2018-02-09 05:54:04-- http://mirrors.aliyun.com/repo/Centos-7.repo
 正在解析主机 mirrors.aliyun.com (mirrors.aliyun.com)... 180.101.150.31, 180.101.150.28, 180.101.150.26, ...
 正在连接 mirrors.aliyun.com (mirrors.aliyun.com)|180.101.150.31|:80... 已连接。
 已发出 HTTP 请求,正在等待回应... 200 OK
 长度:2573 (2.5K) [application/octet-stream]
 正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”- 100%[==============================================================================>] 2,573 --.-K/s 用时 0s - 2018-02-09 05:54:05 (281 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2573/2573]) 
- 方法2:curl直接下载
 执行命令:- curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo - 操作如下: - [root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo 
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
 100 2573 100 2573 0 0 8533 0 --:--:-- --:--:-- --:--:-- 8548
- 方法3:在CentOS-Base.repo 写入地址- [root@localhost yum.repos.d]# vi CentOS-Base.repo 
 [base]
 name=CentOS-$releasever - Base - mirrors.aliyun.com
 failovermethod=priority
 baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
 http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
 gpgcheck=1
 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #released updates
 [updates]
 name=CentOS-$releasever - Updates - mirrors.aliyun.com
 failovermethod=priority
 baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/
 http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
 gpgcheck=1
 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful
 [extras]
 name=CentOS-$releasever - Extras - mirrors.aliyun.com
 failovermethod=priority
 baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/
 http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
 gpgcheck=1
 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #additional packages that extend functionality of existing packages
 [centosplus]
 name=CentOS-$releasever - Plus - mirrors.aliyun.com
 failovermethod=priority
 baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/
 http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
 gpgcheck=1
 enabled=0
 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7 #contrib - packages by Centos Users
 [contrib]
 name=CentOS-$releasever - Contrib - mirrors.aliyun.com
 failovermethod=priority
 baseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/
 http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/
 #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
 gpgcheck=1
 enabled=0
 gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7
3 更新缓存
[root@localhost yum.repos.d]# yum makecache
已加载插件:fastestmirror, langpacks
http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/7/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
正在尝试其它镜像。
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/5): extras/7/x86_64/prestodelta | 102 kB 00:00:01
(2/5): extras/7/x86_64/other_db | 108 kB 00:00:00
(3/5): extras/7/x86_64/filelists_db | 636 kB 00:00:01
(4/5): base/7/x86_64/other_db | 2.5 MB 00:00:02
(5/5): base/7/x86_64/filelists_db | 6.7 MB 00:00:02
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
元数据缓存已建立
Centos 7 替换镜像源的更多相关文章
- 基于centos 创建stress镜像——源码安装stress
		上一篇文章进行了yum安装stress,这次对stress进行源码编译安装,并且生成新的镜像 创建Dockerfile目录 [vagrant@localhost ~]$ mkdir -p /tmp/s ... 
- Centos下替换yum源为阿里云源
		阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 第一步:备份原镜像文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum ... 
- 软路由openwrt中替换国内镜像源(以阿里云为例)
		镜像下载.域名解析.时间同步请点击 阿里巴巴开源镜像站 一.打开openwrt终端 二.找到distfeeds.conf 进入opkg cd /etc/opkg 查看opkg内文件 ls 可以找到di ... 
- Linux镜像源
		1. 国内镜像源 (1.)备份原有镜像源文件 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup ... 
- pip 更换镜像源
		国内的pip源 阿里云:https://mirrors.aliyun.com/pypi/simple/ 清华:https://pypi.tuna.tsinghua.edu.cn/simple 中国科技 ... 
- 修改CentOS默认yum源为国内yum镜像源
		CentOS默认的yum源不是国内的yum源,在通过yum安装一些软件的时候,会出现这样那样的错误,以及在下载安装的速度上也是非常慢的. 所以这个时候就需要将yum源替换成国内的yum源,国内主要开源 ... 
- 替换 Docker 或 Laradock 中 Debian 系统镜像源解决软件安装问题
		Docker Debian 镜像源替换 因多数默认的 Docker 镜像为国外的,而采用的镜像源也是国外的,故访问很慢,所以我们需要替换为国内的(比如阿里云或163等). 163 - Debian A ... 
- CentOS配置本地yum源(使用镜像iso文件)
		本人在使用yum安装软件的时候,感觉最不爽的是网络不佳时,安装的速度特别慢.所以,个人就上网search了一下如何使用Linux的安装文件作为其yum源.经过几次尝试,已经可以成功的配置了.下面是详细 ... 
- Centos更改镜像源
		阿里云Linux安装镜像源: 1.备份原镜像文件以便于恢复. [root@localhost ~]#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repo ... 
随机推荐
- vue-cli之路由独立成JS文件之后,如何在路由中获取vuex属性或者设置国际化i18n的当前使用语言
			国际化vue-i18n的使用: import Vue from 'vue'; import VueI18n from 'vue-i18n'; // 引入语言包 import zh from '@/co ... 
- Web前端开发(高级)下册-目录
			多媒体与绘图 多媒体音频格式视频格式 HTML5多媒体支持 <audio>和<video> htmlaudioElement和htmlVideoElement <audi ... 
- 百度地图中如何获取到发布的SHA1
			百度地图中如何获取到发布的SHA1 下面介绍的是一种通过命令的方式获取到发布版SHA1的方法: 打开Android的命令行Terminal: 1.首先进入到.android文件所在的目录,我的是如下图 ... 
- [RoarCTF 2019]Online Proxy
			目录 [RoarCTF 2019]Online Proxy [RoarCTF 2019]Online Proxy 题目复现链接:https://buuoj.cn/challenges 参考链接:官方w ... 
- scrapy+splash 爬取京东动态商品
			作业来源:https://edu.cnblogs.com/campus/gzcc/GZCC-16SE1/homework/3159 splash是容器安装的,从docker官网上下载windows下的 ... 
- C# 最简单的使程序单进程运行的方法
			1.代码1 static void Main() { Process current = Process.GetCurrentProcess(); Process[] processes = Proc ... 
- python3.6安装 zipimport.ZipImportError: can't decompress data; zlib not available【转】
			python3.6.3 安装: .tgz cd Python- ./configure make make altinstall `make altinstall` , 报错: zipimport.Z ... 
- 常见的SQL优化面试题
			1.在表中建立索引,优先考虑where.group by使用到的字段. 2.查询条件中,一定不要使用select *,因为会返回过多无用的字段会降低查询效率.应该使用具体的字段代替*,只返回使用到的字 ... 
- Nginx可以做什么?(转载)
			本文只针对Nginx在不加载第三方模块的情况能处理哪些事情,由于第三方模块太多所以也介绍不完,当然本文本身也可能介绍的不完整,毕竟只是我个人使用过和了解到过得,欢迎留言交流. Nginx能做什么 —— ... 
- jdbc调用存储过程获取多个结果集
			jdbc调用存储过程获取多个结果集 2017年07月26日 21:20:22 Kenny-Liu 阅读数:1486 版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.cs ... 
