centos6.4配置网络yum源

前端之家收集整理的这篇文章主要介绍了centos6.4配置网络yum源前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参考于:
http://mirrors.aliyun.com/help/centos?spm=5176.bbsr150321.0.0.d6ykiD

1、备份原文件
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

2、下载新的repo文件
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo 
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

网易源centos6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@rac1 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS6-Base-163.repo
--2017-10-14 23:18:31--  http://mirrors.163.com/.help/CentOS6-Base-163.repo
正在解析主机 mirrors.163.com... 123.58.190.209,123.58.190.228,123.58.190.234,...
正在连接 mirrors.163.com|123.58.190.209|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:2006 (2.0K) [application/octet-stream]
正在保存至: “/etc/yum.repos.d/CentOS-Base.repo”

100%[=========================================================>] 2,006       --.-K/s   in 0.001s  

2017-10-14 23:18:31 (1.90 MB/s) - 已保存 “/etc/yum.repos.d/CentOS-Base.repo” [2006/2006])



3、如果报域名解析失败:
[root@RAC01 yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 
--2017-10-14 01:22:16--  http://mirrors.aliyun.com/repo/Centos-6.repo
正在解析主机 mirrors.aliyun.com... 失败:域名解析暂时失败。
wget: 无法解析主机地址 “mirrors.aliyun.com”

4、新增dns域名地址
新增下面一条内容
[root@RAC01 yum.repos.d]# vi /etc/resolv.conf 
nameserver 8.8.8.8


5、生成缓存
[root@RAC01 yum.repos.d]# yum makecache 
Loaded plugins: fastestmirror,security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                     | 3.7 kB     00:00     
base/group_gz                                            | 226 kB     00:00     
base/filelists_db                                        | 6.4 MB     00:02     
base/primary_db                                          | 4.7 MB     00:01     
base/other_db                                            | 2.8 MB     00:00     
extras                                                   | 3.4 kB     00:00     
extras/filelists_db                                      |  25 kB     00:00     
extras/prestodelta                                       | 1.3 kB     00:00     
extras/primary_db                                        |  29 kB     00:00     
extras/other_db                                          |  30 kB     00:00     
updates                                                  | 3.4 kB     00:00     
updates/filelists_db                                     | 2.9 MB     00:00     
updates/prestodelta                                      | 130 kB     00:00     
updates/primary_db                                       | 4.7 MB     00:01     
updates/other_db                                                                                             |  66 MB     00:18     
Metadata Cache Created

6、ok。

猜你在找的CentOS相关文章