首页 > 其他 > 详细

CentOS7系统配置国内yum源和epel源

时间:2019-09-21 16:43:00      阅读:217      评论:0      收藏:0      [点我收藏+]

CentOS7系统配置国内yum源和epel源

CentOS默认yum源是国外的, 速度无法保证,用起来很不爽,今天我们把默认源换成国内的163源,163是目前国内最好用的源,速度是相当快的,还有一些比较好的源,比如阿里源。

 

安装yum源

首先我们把CentOS7配置为可以上外网的环境

 

安装wget

  -bash: wget: command not found

  yum -y install wget

 

进入yum源配置文件   cd /etc/yum.repos.d

 

备份一下当前的源,以防出错后可以还原回来

  mv ./CentOS-Base.repo ./CentOS-Base-repo.bak

 

下载阿里,网易源  

  wget http://mirrors.aliyun.com/repo/Centos-7.repo 

  wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

  或者手动下载repo文件并上传到/etc/yum.repos.d/目录

网易开源镜像站

阿里开源镜像站

 

把下载下来文件 CentOS7-Base-163.repo设置成为默认源  (可不做)

  mv CentOS7-Base-163.repo CentOS-Base.repo

 

清理一下旧包

  yum clean all    #清除系统所有的yum缓存

 

生成缓存即可用源

  yum makecache  # 生成yum缓存

 

安装epel源

# yum list | grep epel-release

# yum install -y epel-release

# ls

# epel源安装成功,比原来多了一个epel.repo和epel-testing.repo文件

 

 

使用阿里开源镜像提供的epel源

#下载阿里开源镜像的epel源文件

# wget -O /etc/yum.repos.d/epel-7.repo http://mirrors.aliyun.com/repo/epel-7.repo   

# 下载网易开源镜像的epel源文件

# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo 

 

再次清除系统yum缓存,并重新生成新的yum缓存

# yum clean all

# yum makecache

 

 

查看系统可用的yum源和所有的yum源

# yum repolist enabled

# yum repolist all

 

CentOS7系统配置国内yum源和epel源

原文:https://www.cnblogs.com/hanbowen/p/11563388.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!