首页 > 代码库 > RHEL6使用163网站CentOS的对应版本作为yum源

RHEL6使用163网站CentOS的对应版本作为yum源

#查看是否安装yum #

rpm -qa | grep yum

[root@lab ~]# rpm -qa | grep yum

#寻找适合自己操作系统的yum安装包(可以通过浏览器, 来翻开寻找)#

http://mirror.centos.org/centos-6/6.5/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm

[root@lab huxiaoming]# wget http://mirror.centos.org/centos-6/6.5/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm

--2014-05-15 13:46:08-- http://mirror.centos.org/centos-6/6.5/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm

Resolving mirror.centos.org... 103.27.60.52

Connecting to mirror.centos.org|103.27.60.52|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 1019540 (996K) [application/x-rpm]

Saving to: 鈥測um-3.2.29-40.el6.centos.noarch.rpm鈥

100%[===================================================================================================>] 1,019,540 193K/s in 5.3s

2014-05-15 13:46:16 (188 KB/s) - 鈥測um-3.2.29-40.el6.centos.noarch.rpm鈥saved [1019540/1019540]

#安装yum包, 发现缺少两个组件,同样,我们在http://mirrors.163.com/centos/6.5/os/i386/Packages/ 里找到组组件#

[root@lab huxiaoming]# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm

warning: yum-3.2.29-40.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

error: Failed dependencies:

        yum-metadata-parser >= 1.1.0 is needed by yum-3.2.29-40.el6.centos.noarch

        yum-plugin-fastestmirror is needed by yum-3.2.29-40.el6.centos.noarch

http://mirrors.163.com/centos/6.5/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm

http://mirrors.163.com/centos/6.5/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

#经历了一个搞笑的循环#

[root@lab huxiaoming]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm

warning: yum-metadata-parser-1.1.2-16.el6.i686.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

Preparing... ########################################### [100%]

   1:yum-metadata-parser ########################################### [100%]

[root@lab huxiaoming]# rpm -ivh yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

warning: yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

error: Failed dependencies:

        yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.30-14.el6.noarch

[root@lab huxiaoming]# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm

warning: yum-3.2.29-40.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

error: Failed dependencies:

        yum-plugin-fastestmirror is needed by yum-3.2.29-40.el6.centos.noarch

[root@lab huxiaoming]# rpm -ivh yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

warning: yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

error: Failed dependencies:

        yum >= 3.0 is needed by yum-plugin-fastestmirror-1.1.30-14.el6.noarch

#发现需要两个包一块装才能过去#

[root@lab huxiaoming]# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

warning: yum-3.2.29-40.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY

Preparing... ########################################### [100%]

   1:yum-plugin-fastestmirro########################################### [ 50%]

   2:yum ########################################### [100%]

[root@lab huxiaoming]# yum version

Loaded plugins: fastestmirror, product-id, subscription-manager

#忽略这个提示,因为我是rhel6的系统, 使用centos的源#

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Warning: RPMDB altered outside of yum.

** Found 1 pre-existing rpmdb problem(s), ‘yum check‘ output follows:

rhn-check-1.0.0.1-16.el6.noarch has missing requires of yum-rhn-plugin >= (‘0‘, ‘0.9.1‘, ‘35‘)

Installed: $releasever/i386 633:7e7920485b2882fc1951b685d95599d39372ec6b

Group-Installed: yum 15:d8b0873c96b8df6702e74f3e8d737edc77ecb758

version

wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 把它放到/etc/yum.repos.d/目录下, 备份原来的yum

[root@lab huxiaoming]# yum makecache

Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Determining fastest mirrors

http://mirrors.163.com/centos/%24releasever/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"

Trying other mirror.

Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again

#需要通过修改$releasever 到相应的版本,把所有$releasever变量改成对应的系统版本 6.5 #

[root@lab yum.repos.d]# vi CentOS6-Base-163.repo

[root@lab yum.repos.d]# yum clean all

Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Cleaning repos: base extras updates

Cleaning up Everything

[root@lab yum.repos.d]# yum makecache

Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Determining fastest mirrors

base | 3.7 kB 00:00

base/group_gz | 212 kB 00:00

base/filelists_db | 4.9 MB 00:20

base/primary_db | 3.5 MB 00:10

base/other_db | 2.1 MB 00:07

extras | 3.4 kB 00:00

extras/filelists_db | 10 kB 00:00

extras/prestodelta | 901 B 00:00

extras/primary_db | 18 kB 00:00

extras/other_db | 5.5 kB 00:00

updates | 3.4 kB 00:00

updates/filelists_db | 1.8 MB 00:05

updates/prestodelta | 206 kB 00:00

updates/primary_db | 2.9 MB 00:09

updates/other_db | 24 MB 01:29

Metadata Cache Created

#试着安装一下gcc 成功#

[root@lab yum.repos.d]# yum install gcc

Loaded plugins: fastestmirror, product-id, subscription-manager

This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package gcc.i686 0:4.4.7-4.el6 will be installed

--> Processing Dependency: cpp = 4.4.7-4.el6 for package: gcc-4.4.7-4.el6.i686

--> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-4.el6.i686

--> Running transaction check

---> Package cloog-ppl.i686 0:0.15.7-1.2.el6 will be installed

--> Processing Dependency: libppl_c.so.2 for package: cloog-ppl-0.15.7-1.2.el6.i686

--> Processing Dependency: libppl.so.7 for package: cloog-ppl-0.15.7-1.2.el6.i686

---> Package cpp.i686 0:4.4.7-4.el6 will be installed

--> Processing Dependency: libmpfr.so.1 for package: cpp-4.4.7-4.el6.i686

--> Running transaction check

---> Package mpfr.i686 0:2.4.1-6.el6 will be installed

---> Package ppl.i686 0:0.10.2-11.el6 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================

Package Arch Version Repository Size

===============================================================================================================================================

Installing:

gcc i686 4.4.7-4.el6 base 8.2 M

Installing for dependencies:

cloog-ppl i686 0.15.7-1.2.el6 base 93 k

cpp i686 4.4.7-4.el6 base 3.4 M

mpfr i686 2.4.1-6.el6 base 153 k

ppl i686 0.10.2-11.el6 base 1.3 M

Transaction Summary

===============================================================================================================================================

Install 5 Package(s)

Total download size: 13 M

Installed size: 29 M