天天看點

yum 軟體包安裝源以及注意事項

場景說明:

       完整的安裝CD光牒一般都是十幾個G,如果使用yum,通過遠端倉庫将rpm下載下傳到本地,将會非常友善,基于上述的原因,尋找到如下的CentOS yum源,實際上都會囊括其他的Linux版本,但是本文僅限于CentOS.

清單如下:

http://mirrors.aliyun.com/centos

http://mirrors.163.com/centos/       

http://centos.ustc.edu.cn/centos/  

CentOS的官網:https://wiki.centos.org/

使用上述的安裝源:

一下載下傳CentOS yum 配置檔案

第一步:備份原有的repo檔案,養成良好的習慣

cd /etc/yum.repos.d/

mv rhel-source.repo  rhel-source.repo.bak

第二步:下載下傳最新的CentOS-Base.repo到/etc/yum.repos.d

wget -O /etc/yum.repos.d/CentOS-Base.repo

http://mirrors.aliyun.com/repo/Centos-6.repo

二修改yum檔案

第三步:替換$releasever為6

vi /etc/yum.repos.d/CentOS-Base.repo

采用全局替換,在指令模式下輸入:%s/$releasever/6

第四步:生成緩存

yum clean all

yum makecache

注意:會出現如下的提示

Loaded plugins: product-id,refresh-packagekit,

security, subscription-manager

Updating certificate-based repositories.

Unable to read consumer identity

原因:

redhat中的yum會檢查目前是否是得到授權的,采用CentOS源的話,不影響後面

軟體的安裝,也可以完全解除安裝redhat的yum,采用CentOS的yum軟體,就不會每次

彈出該消息

三測試

第五步:測試更新python-urlgrabber

目前版本:

[root@jack yum.repos.d]# rpm -qa |greppython-urlgrabber

python-urlgrabber-3.9.1-8.el6.noarch

更新指令:

[root@jack yum.repos.d]# yum updatepython-urlgrabber

更新之後:

python-urlgrabber-3.9.1-11.el6.noarch

四異常說明

當出現如下提示的時候:

http://mirrors.aliyun.com/centos/6Server/os/i386/repodata/repomd.xml:[Errno14]

PYCURL ERROR 22 - "The requested URLreturned error:404"

Trying other mirror.

請確定上面的連結,尤其是centos後面是一個正确的連結目錄,錯誤的原因就是替換的

過程中沒有正确的執行指令。請確定

baseurl=http://mirrors.aliyun.com/centos/6/os/$basearch/

      http://mirrors.aliyuncs.com/centos/6/os/$basearch/

至于RedHat版本使用CentOS的安裝源,将會有詳細的篇幅介紹,在實際的操作過程中,需要解除安裝自身的yum,然後安裝上CentOS的yum,才能夠使用

說明:

1)使用-y參數,自動使用yes進行應答

2)使用search搜尋相關的rpm包(如果是安裝gcc或者g++,不能直接搜尋gccg++ ,請參考g++的安裝部落格)

例如安裝livecd-creator工具,需要安裝livecd-tools軟體,如果

使用yum install livecd-tools 無解!(實際上livecd-tool是一個epel項目中的安裝包,是以需要安裝epel倉庫源,請檢視epel的相關資訊,然後使用yum search epel ,然後安裝)

操作步驟1:yum search live

[root@localhost livecd]# yum -y installlivecd-tools anaconda-runtime

Nothing to do

[root@localhost livecd]# yum search livecd

livecd-tools.x86_64 : Tools for buildinglive CDs

[root@localhost livecd]# yum -y installlivecd-tools.x86_64

     本文轉自fengyuzaitu 51CTO部落格,原文連結:http://blog.51cto.com/fengyuzaitu/1403693,如需轉載請自行聯系原作者

繼續閱讀