RedHat AS4 配置Yum


      Linux上常用的安裝和升級工具可能就是yum了,所以記錄一下rhel 4環境中yum的配置。

      例如,要在服務器上安裝lynx程序,傳統的安裝方式,要到linux安裝光盤中尋找lynx軟件包的RPM,將其上傳到服務器方,並運行rpm -ivh <文件名>的方式來安裝。而使用yum管理,只要運行yum install lynx即可完成安裝。

yum會自動連接到互聯網上的linux更新源,下載最新版本的包自動安裝;如果lynx已經安裝了,現在需要升級到最新版本,則運行yum upgrade lynx即可完成升級。

  可以看到,yum是非常簡單易用,絕大部分安裝包都可以從網絡獲得,而無須手工上傳安裝了。

  在標准的Redhat Enterprise Linux上,默認沒有安裝yum,需要單獨下載並安裝。此外,Redhat Enterprise Linux的更新是由Redhat提供的收費服務。

但由於Redhat Enterprise Linux和CentOS是基本通用的,所以可用CentOS源來升級redhat

 

1. 首先安裝yum和相關的rpm包

  注意:本安裝包只提供給as4系統之用

  http://www.swsoft.com.cn/downloads/Prima/Tools/yum_forAS4.tar.gz

    或http://www.haoxm.net/tools/yum_forAS4.tar.gz

下載並解壓縮yum包和升級文件

wget http://www.haoxm.net/tools/yum_forAS4.tar.gz

tar –zxvf yum_forAS4.tar.gz

rpm -ivh *.rpm

 

2. 將解壓縮后得到的CentOS-Base.repo復制到/etc/yum.repos.d/目錄里邊

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

注意:本CentOS-Base.repo文件只提供給as4系統之用

 

3. 執行如下命令導入GPG Key

  rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-4

 或rpm --import http://www.haoxm.net/tools/RPM-GPG-KEY-CentOS-4

現在可以開始使用yum了。yum的主要參數包括search/install/upgrade/remove。

  

4. 要安裝一個軟件,比如安裝lynx字符瀏覽器,則可以執行

  yum install lynx

  注意:

  1. 使用yum的過程中,有些程序包是不能升級的。

  2. 如果使用yum對全部系統都進行升級,則會發現升級后系統版本將從redhat變成centos

這是因為升級使用的是免費centos的yum源,所以升級最好有選擇的執行

 

5. 關於CentOS-Base.repo 配置文件的YUM源設置

[base]

name=CentOS-4 - Base

baseurl=http://mirror.centos.org/centos/4/os/$basearch/

gpgcheck=1

 

#released updates

[update]

name=CentOS-4 - Updates

baseurl=http://mirror.centos.org/centos/4/updates/$basearch/

gpgcheck=1

 

#packages used/produced in the build but not released

[addons]

name=CentOS-4 - Addons

baseurl=http://mirror.centos.org/centos/4/addons/$basearch/

gpgcheck=1

 

#additional packages that may be useful

[extras]

name=CentOS-4 - Extras

baseurl=http://mirror.centos.org/centos/4/extras/$basearch/

gpgcheck=1

 

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-4 - Plus

baseurl=http://mirror.centos.org/centos/4/centosplus/$basearch/

gpgcheck=1

enabled=0

 

#contrib - packages by Centos Users

[contrib]

name=CentOS-4 - Contrib

baseurl=http://mirror.centos.org/centos/4/contrib/$basearch/

gpgcheck=1

enabled=0

注:這里默認的http://mirror.centos.org/centos/4/  已經不存在YUM源;

根據ReadMe里面的提示:

This directory (and version of CentOS) is depreciated.  

CentOS-4 is now past EOL

You can get the last released version of centos 4.9 here:

http://vault.centos.org/4.9/
所以我們需要將原來的url:http://mirror.centos.org/centos/4/  替換為:http://vault.centos.org/4.9/


免責聲明!

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



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