yum更改国内源
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了yum更改国内源相关的知识,希望对你有一定的参考价值。
centos 默认的源是国外的,访问下载的时候有点慢,用国内的源比较方便需要先把原来的源的配置文件删了
rm -f CentOS-Base.repo
用如下两个命令下载yum源,只需要用到一个就可以
wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
curl -O http://mirrors.163.com/.help/CentOS7-Base-163.repo
[[email protected] yum.repos.d]# ls
CentOS-CR.repo CentOS7-Base-163.repo
CentOS-Debuginfo.repo dvd.repo
CentOS-Media.repo epel-testing.repo
CentOS-Sources.repo epel.repo
CentOS-Vault.repo wget
CentOS-fasttrack.repo yum.repos.d.bak
用yum list可以查看yum的源
可以试着安装一个包试一下
验证是否是刚才下载的yum源生效
把下载的centos7的名字换成其他的名字在安装包就安装不了。恢复名字就可以安装
[[email protected] yum.repos.d]# mv CentOS7-Base-163.repo CentOS7-Base-163.repo.aa
[[email protected] yum.repos.d]# yum install zsh Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
- epel: mirrors.ustc.edu.cn
No package zsh available.
Error: Nothing to do
[[email protected] yum.repos.d]# mv CentOS7-Base-163.repo.aa CentOS7-Base-163.repo
[[email protected] yum.repos.d]# yum clean all
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Cleaning repos: base epel extras updates
Cleaning up everything
Cleaning up list of fastest mirrors
[[email protected] yum.repos.d]# yum install zsh
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
epel/x86_64/metalink | 7.2 kB 00:00
epel | 4.3 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
(1/7): base/7/x86_64/group_gz | 155 kB 00:00
(2/7): epel/x86_64/group_gz | 170 kB 00:00
以上是关于yum更改国内源的主要内容,如果未能解决你的问题,请参考以下文章
26期20180627 更换国内源 yum下载rpm包 源码包安装
26期20180627 更换国内源 yum下载rpm包 源码包安装