[ Linux 系統 ] RHEL5 不透過 RHN 依然可用 system-config-packages 安裝套件的方法

RHEL5由於改用YUM作為套件管理,因此發生了一些原本RHEL4不曾有的麻煩。

在某些情況下,如果希望將光碟內容直接讓Package Manager存取,可透過以下方式:
(原文出處:http://www.php-oa.com/2007/12/23/yum-cdrom-centos/)
(此方法需要DVD諜,如果是光碟請全部拷貝入硬碟內)

  1. mount -o loop rhel-5-server-dvd.iso /media/rhel
       
  2. vi /etc/yum.repos.d/rhel-local.repo

    [Cluster]
    name=Red Hat Enterprise Linux $releasever – $basearch – Cluster
    baseurl=file:///var/rhel/Cluster
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

    [ClusterStorage]
    name=Red Hat Enterprise Linux $releasever – $basearch – ClusterStorage
    baseurl=file:///var/rhel/ClusterStorage
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

    [Server]
    name=Red Hat Enterprise Linux $releasever – $basearch – Server
    baseurl=file:///var/rhel/Server
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

    [VT]
    name=Red Hat Enterprise Linux $releasever – $basearch – VT
    baseurl=file:///var/rhel/VT
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
       

  3. mkdir -p /var/rhel/{Cluster,ClusterStorage,Server,VT}
       
  4. 此步驟需要第三方軟體createrepo,請到http://dag.wieers.com/rpm/packages/createrepo/ 下載。

    createrepo -o /var/rhel/Cluster -g /media/rhel/Cluster/repodata/comps-rhel5-cluster.xml /media/rhel/Cluster

    createrepo -o /var/rhel/ClusterStorage -g /media/rhel/ClusterStorage/repodata/comps-rhel5-cluster-st.xml /media/rhel/ClusterStorage

    createrepo -o /var/rhel/Server -g /media/rhel/Server/repodata/comps-rhel5-server-core.xml /media/rhel/Server

    createrepo -o /var/rhel/VT -g /media/rhel/VT/repodata/comps-rhel5-vt.xml /media/rhel/VT
       

  5. mount –bind /var/rhel/Cluster/repodata /media/rhel/Cluster/repodata

    mount –bind /var/rhel/ClusterStorage/repodata /media/rhel/ClusterStorage/repodata

    mount –bind /var/rhel/Server/repodata /media/rhel/Server/repodata

    mount –bind /var/rhel/VT/repodata /media/rhel/VT/repodata
       

  6. yum clean all
       
  7. 接下來,啟動Package Manager,就可以存取內容了。