admin管理员组

文章数量:1600475

yum/wget 下载慢原因

系统默认的下载源是国外源,如果没有科学上网的话,网速会受到很大的限制,因此解决方案是将下载源更换成国内的阿里源。

操作步骤

  1. 首先备份系统自带『yum源配置文件』,具体路径为:/etc/yum.repos.d/CentOS-Base.repo
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
  1. 下载阿里云的yum源配置文件到文件夹『/etc/yum.repos.d/』中。

注意:

  1. 不同的 CentOS 版本对应不同的文件,选下面一条执行即可;
  2. 如果 wget 命令不生效,说明还没有安装 wget ,需要执行命令yum -y install wget进行安装。
# 各系统版本repo文件对应的下载操作 
# CentOS 5 
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun/repo/Centos-5.repo 

# CentOS 6 
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun/repo/Centos-6.repo 

# CentOS 7 
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun/repo/Centos-7.repo
  1. 清除 yum 缓存
yum clean all 
  1. 生成新的缓存
yum makecache

本文标签: 阿里CENTOSwgetyum