centos 更换yum源 (解决下载慢的问题)
先看有没有安装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
最新文章
- Selenium通过WebDriver控制IE浏览器出错 Browser zoom level was set to 109%. It should be set to 100%
- python案例-用户登录
- OSG addEventHandler W键 L键 F键
- mysql:恢复mysql表结构
- TensorFlow学习之运行label_image实例
- uva 11039
- ECharts 是一款开源
- 使用PHPExcel导出数据
- 关于关注和取消关注的nodejs写法
- HTTPS系列干货(一):HTTPS 原理详解
- Unable to make the module: related gradle configuration was not found. Please, re-import the Gradle project and try again
- GoGland 快捷键说明
- alfred3配置
- SQLite 线程安全和并发
- iOS APP提交上架流程
- 【MongoDB】MongoDb的“not master and slaveok=false”错误及解决方法 mongo连接从库出现问题
- 爬虫的基本操作 requests / BeautifulSoup 的使用
- 线性回归之决定系数(coefficient of determination)
- TensorFlow函数:tf.ones_like
- DevExpress的提示框