1、查看当前系统版本和内核版本
[root@mdadm ~]# uname -a
Linux mdadm.lvmadm 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@mdadm ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.4 (Santiago)
2、测试网络的联通性
[root@mdadm ~]# ping www.baidu.com
PING www.a.shifen.com (115.239.211.112) 56(84) bytes of data.
64 bytes from 115.239.211.112: icmp_seq=1 ttl=54 time=43.5 ms
64 bytes from 115.239.211.112: icmp_seq=2 ttl=54 time=43.3 ms
3、正式开始
总共需要安装3个包包,可以从163的mirror服务器下载
yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-3.2.29-60.el6.centos.noarch.rpm
[root@mdadm ~]#cd /etc/yum.repos.d/
[root@mdadm yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-60.el6.centos.noarch.rpm
--2015-01-13 00:22:27-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-60.el6.centos.noarch.rpm Resolving mirrors.163.com... 123.58.173.106 Connecting to mirrors.163.com|123.58.173.106|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 1029384 (1005K) [application/x-redhat-package-manager] Saving to: “yum-3.2.29-60.el6.centos.noarch.rpm” 100%[=====================================================>] 1,029,384 197K/s in 5.1s 2015-01-13 00:22:32 (197 KB/s) - “yum-3.2.29-60.el6.centos.noarch.rpm” saved [1029384/1029384]
[root@mdadm yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
--2015-01-13 00:23:16-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm Resolving mirrors.163.com... 123.58.173.106 Connecting to mirrors.163.com|123.58.173.106|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 27224 (27K) [application/x-redhat-package-manager] Saving to: “yum-metadata-parser-1.1.2-16.el6.x86_64.rpm” 100%[=====================================================>] 27,224 --.-K/s in 0.1s 2015-01-13 00:23:16 (274 KB/s) - “yum-metadata-parser-1.1.2-16.el6.x86_64.rpm” saved [27224/27224]
[root@mdadm yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
--2015-01-13 00:24:35-- http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm Resolving mirrors.163.com... 123.58.173.106 Connecting to mirrors.163.com|123.58.173.106|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 31340 (31K) [application/x-redhat-package-manager] Saving to: “yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm” 100%[=====================================================>] 31,340 --.-K/s in 0.1s 2015-01-13 00:24:35 (310 KB/s) - “yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm” saved [31340/31340]
[root@mdadm yum.repos.d]# rpm -Uvh yum-3.2.29-60.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
warning: yum-3.2.29-60.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY Preparing... ########################################### [100%] 1:yum-metadata-parser ########################################### [ 33%] 2:yum-plugin-fastestmirro########################################### [ 67%] 3:yum ########################################### [100%]
[root@mdadm yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
--2015-01-13 00:26:13-- http://mirrors.163.com/.help/CentOS6-Base-163.repo Resolving mirrors.163.com... 123.58.173.106 Connecting to mirrors.163.com|123.58.173.106|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 2006 (2.0K) [application/octet-stream] Saving to: “CentOS6-Base-163.repo” 100%[=====================================================>] 2,006 --.-K/s in 0s 2015-01-13 00:26:14 (168 MB/s) - “CentOS6-Base-163.repo” saved [2006/2006]
[root@mdadm yum.repos.d]# vim CentOS6-Base-163.repo
用命令g/$releasever/s//6/把文件里面的$releasever全部替换为版本号,即6最后保存。
4、测试yum
[root@mdadm yum.repos.d]#yum clean all
[root@mdadm yum.repos.d]#yum makecache
[root@mdadm yum.repos.d]#yum install vim*
# yum install vim* #测试域名是否可用
至此,Redhat6可以使用CentOS的yum源在线安装软件了。
本文出自 “云计算小窝” 博客,请务必保留此出处http://leegh.blog.51cto.com/8764149/1606881
RedHat6.4配置CentOS YUM源(2015.01.01更新)
原文地址:http://leegh.blog.51cto.com/8764149/1606881