yum更改國內源
阿新 • • 發佈:2018-03-07
更改國內源centos 默認的源是國外的,訪問下載的時候有點慢,用國內的源比較方便
CentOS-Media.repo epel-testing.repo
CentOS-Sources.repo epel.repo
CentOS-Vault.repo wget
CentOS-fasttrack.repo yum.repos.d.bak [root@kylin yum.repos.d]# yum install zsh Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile [root@kylin 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
[root@kylin 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
需要先把原來的源的配置文件刪了
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
[root@kylin yum.repos.d]# ls
CentOS-CR.repo CentOS7-Base-163.repo
CentOS-Debuginfo.repo dvd.repo
CentOS-Sources.repo epel.repo
CentOS-Vault.repo wget
CentOS-fasttrack.repo yum.repos.d.bak
用yum list可以查看yum的源
可以試著安裝一個包試一下
驗證是否是剛才下載的yum源生效
把下載的centos7的名字換成其他的名字在安裝包就安裝不了。恢復名字就可以安裝
[root@kylin yum.repos.d]# mv CentOS7-Base-163.repo CentOS7-Base-163.repo.aa
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
- epel: mirrors.ustc.edu.cn
No package zsh available.
Error: Nothing to do
[root@kylin yum.repos.d]# mv CentOS7-Base-163.repo.aa CentOS7-Base-163.repo
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
[root@kylin 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更改國內源