前言
因為某些因素 RHEL 在沒有開通 RHN 的機制時使用 CentOS YUM 來進行套件安裝或更新。警告: 此舉可能導致 RHEL 運作不正常,建議您還是購買 RHEL License 並使用 RHN 更新機制來進行套件的更新。實作環境
- RHEL 5.6 (x64)
安裝及設定
在設定以前用 yum search drbd 是找不到套件可安裝的,如下所示:# yum search drbd
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
Warning: No matches found for: drbd
No Matches found
請切換至 /etc/yum.repos.d 資料夾下建立一個副檔名為 .repo 的檔案,例如 centos.repo 然後將 CentOS 中 CentOS-Base.repo 內容貼進來。
- 對 CentOS-Base.repo 內容進行修改。
- 將 CentOS-Base.repo 中 Mirror Site 指向至國內。
- 把 gpgcheck 改成 =0 代表不使用下一行的那個 GPG key 來檢查是否為 RHEL5 原廠套件。 (%s,gpgcheck=1,gpgcheck=0,g)。
- 加上或修改 enabled=1 表示啟用 (%s,enabled=0,enabled=1,g)。
- 把 $releasever 取代為目前 RHEL 的版本 (%s,$releasever,5.6,g)。
- 執行 yum clean all。
- yum search drbd 便可以找到套件了。
下列為 centos.repo 的內容
[base]
name=CentOS-5.6 - Base
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=os
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/os/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-5.6 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=updates
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/updates/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-5.6 - Addons
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=addons
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/addons/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5.6 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=extras
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/extras/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.6 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=centosplus
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/centosplus/$basearch/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5.6 - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=contrib
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/contrib/$basearch/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5me=CentOS-5.6 - Base
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=os
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/os/$basearch/
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-5.6 - Updates
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=updates
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/updates/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-5.6 - Addons
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=addons
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/addons/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5.6 - Extras
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=extras
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/extras/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5.6 - Plus
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=centosplus
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/centosplus/$basearch/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5.6 - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=5.6&arch=$basearch&repo=contrib
#baseurl=http://ftp.cse.yzu.edu.tw/pub/CentOS/5.6/contrib/$basearch/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5