CentOSPlus 軟件庫
1. CentOSPlus 軟件庫是甚麼?
CentOSPlus 軟件庫藏有針對 CentOS base 及 CentOS updates 軟件庫內的套件的更新。這些更新套件並不屬於上游的發行,所以在延伸 CentOS 的功能同時犧牲了與上游的兼容性。啟用這個軟件庫會導致 CentOS 與上游有差別。你應該明白這樣做的後果才啟用 CentOSPlus。你可以瀏覽我們鏡像中針對 CentOS 5 或者 CentOS 6 的 CentOSPlus 目錄來尋找要使用的架構。
|
CentOSPlus 軟件庫包含的所有套件都是更新用的套件。你很可能不會啟用整個 CentOSPlus,而只會選擇其中合用的套件。 |
|
在你啟用 CentOSPlus 軟件庫前,你應該閱讀 yum 內關於 includepkgs= 以及 exclude= 的選項。要查詢這些選項,你可在命令行執行以下指令:
man yum.conf
2. 啟用 CentOSPlus 軟件庫
要啟用 CentOSPlus 軟件庫,請編輯 /etc/yum.repos.d/CentOS-Base.repo 檔並尋找 [centosplus] 部份。它的預設內容是:
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 <== -CentOS-6 in CentOS-6
範例 1: 我們希望取得 CentOSPlus 內支援 mysql_pgsql 的 postfix。下面是 /etc/yum.repos.d/CentOS-Base.repo 內應有的設定:
#additional packages that extend functionality of existing packages [centosplus] name=CentOS-$releasever - Plus mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus #baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/ gpgcheck=1 enabled=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos4 includepkgs=postfix-* exclude=postfix-*plus*
你也需要在 /etc/yum.repos.d/CentOS-Base.repo 內的 [base] 及 [update] 部份加入下列設定,好使你不會再從它們取得 postfix 套件:
exclude=postfix-*
範例 2: 我們希望使用 CentOSPlus 的內核,以便能使用 jfs 或 reiserfs 檔案系統及建設工具。我們須要編輯 /etc/yum.repos.d/CentOS-Base.repo 及修改 [centosplus] 部份內的設定如下:
enabled=1 includepkgs=kernel* jfsutils reiserfs-utils
在 [base] 及 [update] 部份你須要作出下列修改:
exclude=kernel kernel-devel kernel-PAE-*
3. yum-plugin-priorities 插件
另一個保護你的系統被 CentOSPlus 軟件庫更新的方法就是採用 yum-plugin-priorities 插件。這是推薦的方法。請按照以上連結內的指引設置 yum-plugin-priorites。編輯 /etc/yum.conf 並加入這行:
plugins=1
你須要在 /etc/yum.repos.d/CentOS-Base.repo 內設定優先次序如下:
[base] exclude=foo bar priority=1 [update] exclude=foo bar priority=1 [centosplus] enable=1 priority=2
這樣做會令 [base] 及 [update] 軟件庫對比起 [centosplus] 軟件庫有較優先的次序,於是 CentOSPlus 內唯一可以更改 [base] 或 [update] 的套件就是在這兩個軟件庫中被 exclude= 排除的套件。
因此,yum-plugin-priorities 允許你略過在 CentOS-Base.repo 中 [centosplus] 小節中 includepkgs= 的設定,但依然能夠更新那些在 [base] 及 [update] 軟件庫中被 exclude= 排除的套件。
4. 總結
使用 CentOSPlus 軟件庫比使用其他 CentOS 軟件庫更為危險,因為它容許有多個更新的套件,而且並不是為整體啟用而設計的。
你可應用 CentOSPlus 內的所有套件,但一般的做法是單單選擇所需的套件,然後透過 exclude= 及 includepkgs=(或 exclude= 及 yum-plugin-priorities 插件) 從 CentOSPlus 軟件庫內下載這些套件。
請確定你理解這裡的所有概念,然後才啟用 CentOSPlus 軟件庫。
Translation of revision 26
