RedHat 6.0如何使用CentOS YUM源更新的方法


  • 6.0
  • 5.4

 

原文地址:http://www.linuxde.net/2011/10/1578.html


2011 年 10 月 31 日 by 天明 | 2 條評論 | 1,267閱
由於RedHat的yum在線更新是收費的,如果沒有注冊的話是不能使用的,即不能在線安裝軟件。在這種情況下,想使用Redhat系統,還想用yum源來在線安裝軟件,有沒有辦法?
答案是有辦法,請往下看!
1、刪除redhat原有的yum源

# rpm -aq | grep yum|xargs rpm -e --nodeps
2、下載新的yum安裝包 

這里我們使用CentOS的yum源

#wget http://mirror.centos.org/centos-6/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

# wget http://mirror.centos.org/centos-6/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
# wget http://mirror.centos.org/centos-6/6/os/i386/Packages/yum-3.2.29-22.el6.centos.noarch.rpm
# wget http://mirror.centos.org/centos-6/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-10.el6.noarch.rpm
3、安裝yum軟件包

# rpm -ivh  python-iniparse-0.3.1-2.1.el6.noarch.rpm
# rpm -ivh  yum-metadata-parser-1.1.2-14.1.el6.i686.rpm
# rpm -ivh  yum-3.2.27-14.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
注意:最后兩個安裝包要放在一起同時安裝,否則會提示相互依賴,安裝失敗。
4、更改yum源  #我們使用網易的CentOS鏡像源

# cd /etc/yum.repos.d/
# wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
# vi CentOS6-Base-163.repo
編輯文件,把文件里面的$releasever全部替換為版本號,即6 最后保存!或者直接把下面的內存拷貝到CentOS6-Base-163.repo文件中即可(已經修改好)
#########################################################################
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#########################################################################
5、清理yum緩存

# yum clean all
# yum makecache     #將服務器上的軟件包信息緩存到本地,以提高搜索安裝軟件的速度
# yum install vim*    #測試域名是否可用
至此,Redhat6可以使用CentOS的yum源在線安裝軟件了!


 

原文鏈接

今天碰上要給一台裝有Linux的機器做維護,於是就以為按照以往經驗就能解決問題,但是神奇的發現機器上一堆的軟件包都沒有安裝,
最要命的是連軟件包管理器也都沒有安裝,本以為是FreeBSD,查了一下才發現是RedHat Linux Server 5.4,
於是開始着手安裝YUM,在Google搜索了一下,發現貌似類似的情況不多,但是這確實不是我第一次遇到RedHat沒有yum了,
因為上次遇到的時候是別人讓幫忙看看,解決不了也就沒留心,但這次維護是必要的,於是嘗試了許久,
這大概是我最不舒服的一次經歷了,而且RedHat很多資源都不多,於是基本rpm包都是借助了CentOS 5,於是對RedHat充滿了怨念。

1.首先需要確定系統架構
確認是x86_64之后,在網易的mirrors下載需要的rpm包:(如果是i386的話則需要到http://mirrors.163.com/centos/5/os/i386/CentOS/ 找到對應的軟件包)

 

復制代碼
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/m2crypto-0.16-8.el5.x86_64.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-sqlite-1.1.7-1.2.1.x86_64.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/python-urlgrabber-3.1.0-6.el5.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-37.el5.centos.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-16.el5.centos.noarch.rpm
wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm 
復制代碼

 

2.然后 安裝(升級)軟件包,並導入證書

 

#rpm -Uvh *
#rpm -import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5 

 

3.讓yum使用網易的源:

 

#cd /etc/yum.repos.d/
#wget http://mirrors.163.com/.help/CentOS-Base-163.repo 

 

4.使用

#vi CentOS-Base-163.repo


在所有mirrorlist前面加上#,把所有$releasever替換成5,保存

 

5.清理並重新生成yum緩存

#yum clean metadata
#yum makecache 

 

6.於是yum就正常工作了,然后隨手就更新一下,就OK了

#yum -y upgrade


 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM