1. 程式人生 > >為Linux配置常用源:epel和IUS

為Linux配置常用源:epel和IUS

IT 配置 arch pda creates erp mmu version 源代碼

CentOS上,除了os類的yum源,還需要配置幾個常用的源:epel、ius。

有很多國內很多鏡像站點都提供了各類倉庫的鏡像站點,個人感覺比較全的是阿裏雲http://mirrors.aliyun.com和清華大學開源鏡像站點https://mirrors.tuna.tsinghua.edu.cn。特別是後者,很多知名源項目的mirrorlist中都將其作為中國地區的唯一站點。如果有時候你在阿裏鏡像、搜狐鏡像等知名站點都找不到某個源時,不妨去清華大學的站點找找。

1.1 EPEL

Extra Packages for Enterprise Linux (or EPEL) is a Fedora Special Interest Group that creates, maintains, and manages a high quality set
of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).

簡言之,EPEL是專門為RHEL、CentOS等Linux發行版提供額外rpm包的。很多os中沒有或比較舊的rpm,在epel倉庫中可以找到。

例如配置阿裏雲的epel:

rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

1.2 IUS

在kernel.org內,清楚地說明了IUS項目是幹什麽的:

IUS is a community project that provides RPM packages for newer versions of select software for Enterprise Linux distributions.
 
Project Goals
   Create high quality RPM packages 
for Red Hat Enterprise Linux (RHEL) and CentOS. Promptly release updated RPM packages once new versions are released by the upstream developers. No automatic replacement of stock RPM packages.

IUS只為RHEL和CentOS這兩個發行版提供較新版本的rpm包。如果在os或epel找不到某個軟件的新版rpm,軟件官方又只提供源代碼包的時候,可以來ius源中找,幾乎都能找到。例如haproxy,在CentOS 6的epel中只有1.5版本的,但ius中卻提供了1.6和1.7版本。

IUS源的站點根目錄:https://dl.iuscommunity.org/pub/ius/

IUS提供4個分支的rpm包:stable、archive、development和testing。顯然,我們應該選擇stable分支的包。

技術分享圖片

配置IUS源:

rpm -ivh https://rhel5.iuscommunity.org/ius-release.rpm     # RHEL 5
rpm -ivh https://rhel6.iuscommunity.org/ius-release.rpm     # RHEL 6
rpm -ivh https://rhel7.iuscommunity.org/ius-release.rpm     # RHEL 7

rpm -ivh https://centos5.iuscommunity.org/ius-release.rpm  # CentOS 5
rpm -ivh https://centos6.iuscommunity.org/ius-release.rpm  # CentOS 6
rpm -ivh https://centos7.iuscommunity.org/ius-release.rpm  # CentOS 7

rpm安裝ius-release.rpm時,依賴於epel。所以必須先安裝epel源。註意,這是包的依賴關系,因此必須是安裝了epel,而不是僅僅在repo文件中配置了epel源。

yum -y install epel-release

安裝後,建議修改為國內ius源。在https://mirrors.iuscommunity.org/mirrors內可以查看到IUS項目的mirrorlist中所有的IUS站點。我看了下,中國地區只有兩個站點:清華大學鏡像站點和同濟大學鏡像站點。

https://mirrors.tuna.tsinghua.edu.cn/ius/stable/CentOS/6/$basearch  # CentOS 6
https://mirrors.tuna.tsinghua.edu.cn/ius/stable/Redhat/6/$basearch  # RHEL 6

https://mirrors.tongji.edu.cn/ius/stable/CentOS/6/$basearch         # CentOS 6
https://mirrors.tongji.edu.cn/ius/stable/Redhat/6/$basearch         # RHEL 6

或者,直接在repo文件中添加ius倉庫,更方便,這樣不依賴於epel。

[root@xuexi ~]# vim /etc/yum.repos.d/ius.repo
[ius]
name=iusrepo
baseurl=https://mirrors.tuna.tsinghua.edu.cn/ius/stable/CentOS/6/$basearch
gpgcheck=0
enable=1

然後清除緩存再建立緩存即可。

yum clean all ; yum makecache 

為Linux配置常用源:epel和IUS