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
centos 更换yum源 (解决下载慢的问题)的更多相关文章
- Centos更换yum源
Centos更换yum源 步骤如下: 备份原始源 cd /etc/yum.repos.d/ mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/ ...
- Centos更换yum源,安装ssh server
先连上网,然后更换yum源 1. 新建的用户没有sudo权限,所以首先切换到root用户su -输入密码 2. 备份之前的yum源mv /etc/yum.repos.d/CentOS-Base.rep ...
- CentOS 更换yum源为aliyun yum源
CentOS自带的yum源为官方的源,由于墙的原因,经常无法访问,国内也有不错的源,这里讲一下使用aliyun的源替换原yam源. 第一种方法 1.安装base reop源 cd /etc/yum.r ...
- centos更换yum源为aliyun源
国外的yum源由于众所周知的GFW原因,有的被墙,有的很慢,阿里云依靠强大的技术优势建立了国内的开源镜像.阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ 第一步: ...
- centos 更换 yum源
阿里云Linux安装镜像源地址:http://mirrors.aliyun.com/ CentOS系统更换软件安装源第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos ...
- maven更换下载镜像源-解决下载慢问题(转)
转自:http://www.cnblogs.com/duking1991/p/6110192.html maven更换下载镜像源-解决下载慢问题 Maven是当前流行的项目管理工具,但官方的库在国 ...
- .net core 更换yum源 / “No package libgdiplus-devel available.” 错误解决方法
安装 libgdiplus-devel yum install libgdiplus-devel 如果出现错误 No package libgdiplus-devel available. 原因可能是 ...
- linux更换yum源
由于 redhat的yum在线更新是收费的,如果没有注册的话不能使用,如果要使用,需将redhat的yum卸载后,重启安装,再配置其他源,以下为详细过程: 1.删除redhat原有的yum rpm - ...
- redhat6.5 配置使用centos的yum源
新安装了redhat6.5安装后,登录系统,使用yum update 更新系统.提示: This system is not registered to Red Hat Subscription Ma ...
随机推荐
- c++11实现DLL帮助类
用过DLL的人都会发现,在C++中调用dll中的函数有点繁琐,调用过程如下:在加载dll后还要定义一个对应的函数指针类型,接着调用GetProcAddress获取函数地址,再转成函数指针,最后调用函数 ...
- AJAX如何传递json对象给后端
如果页面上一直报错,根本没有触发异步请求的话,首先就要检查接口或者路径是否写对或者写全,在去考虑是否跨境的问题. 如果想要给后端传递一个json对象,需要在路径上一句添加content:applica ...
- 压缩&&解压
压缩与解压缩: ############################################################# tar xvf wordpress.tar ## ...
- 数据库sql互转(oracle转mysql为例子)
转自: https://blog.csdn.net/sinat_32366329/article/details/76402059 在PowerDesinger里找到 File -->> ...
- Codechef QGRID
QGRID code 给定一个 n × m(1 <= m <= 3) 的点网格,网格的边上以及点上都有权值.初始时所有点的权值都为 0 .维护两种操作:1. x1 y1 x2 y2 c 把 ...
- 折半插入排序 之通俗易懂,图文+代码详解-java编程
转自http://blog.csdn.net/nzfxx/article/details/51615439 1.特点及概念介绍 下面给大家讲解一下"二分法查找"这个java基础查找 ...
- 探究final在java中的作用
目录 一. final修饰变量 1. 基础: final修饰基本数据类型变量和引用数据类型变量. 2. 进阶: 被final修饰的常量在编译阶段会被放入常量池中 3. 探索: 为什么局部/匿名内部类在 ...
- Codeforces - 1081C - Colorful Bricks - 简单dp - 组合数学
https://codeforces.com/problemset/problem/1081/C 这道题是不会的,我只会考虑 $k=0$ 和 $k=1$ 的情况. $k=0$ 就是全部同色, $k=1 ...
- poj 1723 Soldiers【中位数】By cellur925
题目传送门 题目大意:平面上有n个士兵,给出每个士兵的坐标,求出使这些士兵站好所需要的最少移动步数.站好要求:所有士兵y相等,x相邻.即达到 (x,y), (x+1, y), (x+2,y)……的状态 ...
- c++运费符优先级
L:左 R:右