被Debian/Ubuntu惯坏了之后,再来用 RHEL/CentOS 实在是有点不习惯,软件都老且不说,关键是你还别嫌老(5年一个大版本的节奏真受不了啊,RHEL 6上面还是python 2.6),大多数时候还没有,这也是为啥网上很多系统管理员一说安装软件都是 ./configure && make && make install
自行编译三部曲。这对于简单的软件还好说,对于一些复杂的软件,还真不放心编译时依赖软件/依赖库都装了,版本是否都对了,编译选项是否都启用了。。。再加上我这样的懒人,真懒得编译。
—— 先不抱怨了,好歹RHEL/CentOS上还有几个比较大的第三方库,这比之前部门强推的SuSE Linux Enterprise Edition已经强不少了(别跟我说OBS 那上面的仓库)。
注:为简单起见,这里只按CentOS 6.x/x86_64进行说明,对于其它版本和i386架构(以及ppc等架构),请以此类推。至于CentOS 7弃用yum
改用dnf
的事情,过两年用上CentOS 7的时候再说吧。
http://fedoraproject.org/wiki/EPEL
EPEL provides rebuilds of Fedora packages for EL5, EL6 and EL7. Packages should not replace base,
although there have been issues around point releases in the past. You can install EPEL by running
yum install epel-release
. The epel-release
package is included in the CentOS Extras repository
that is enabled by default.
添加此仓库的方法:
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
# or
# wget http://ftp.cn.debian.org/epel/epel-release-latest-6.noarch.rpm
rpm -Uvh epel-release-latest-6.noarch.rpm
软件包分类浏览: http://ftp.cn.debian.org/epel/6Server/x86_64/repoview/
软件包详细列表: http://ftp.cn.debian.org/epel/6Server/x86_64/
参考说明:
http://rpmfusion.org/
RPMfusion Repository - (See http://rpmfusion.org/) provides "software that the Fedora Project or Red
Hat doesn't want to ship" for EL5 and 6. Known to replace base packages.
添加此仓库的方法:
wget -c http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
wget -c http://download1.rpmfusion.org/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
# or
wget -c http://ftp.cn.debian.org/rpmfusion/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm
wget -c http://ftp.cn.debian.org/rpmfusion/nonfree/el/updates/6/i386/rpmfusion-nonfree-release-6-1.noarch.rpm
yum -ivh rpmfusion-*release-6*.rpm
详细说明请阅读: Configuration - RPM Fusion
http://repoforge.org/
CentOS的Wiki上对repoforge的说明是:
Although once recommended, this repository is no longer maintained, and is not advised.
虽然如此,但rpmforge提供的软件还是比较多的,并且跟别的第三方仓库不同的是,它会对RHEL/CentOS发布版内含
的软件也提供更新版本,所以在很多时候还是得找它。(不过 http://ftp.cn.debian.org 没有提供此仓库的镜像,
而前面epel和rpmfusion都有)。
添加此仓库的方法:
wget -c http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -ivh rpmforge-release-*.rpm
详细说明请阅读 Using RepoForge。
https://www.softwarecollections.org/en/
其实这不算一个“第三方仓库”,因为它是RedHat/CentOS自己提供的。这个仓库没提供几个软件,主要是服务器上
常用的apache/mysql/python/ruby/pgsql等软件的新版本(再吐槽一遍: RHEL/CentOS里面的软件包实在是太老
了!!!),它们也不会覆盖原来的旧版本,使用上也需要采用特殊的方式(比如scl enable python33 -m SimpleHTTPServer
)
The SCL repository contains newer versions of various programs. These packages can be installed
alongside existing older packages. At the time of writing, the repository contains packages for
mariadb55, mysql55, nodejs010, perl516, php54, postgres92, python27, python33
and ruby193
.
CentOS 6的仓库里面已经有这个SCL仓库的地址描述,执行下面的语句就可以此仓库:
yum install centos-release-SCL
参考文档:
因为有时候会有其他人修改(或者自己以前修改的,但忘记了) /etc/yum.repos.d/<foobar>.repo
,对某些仓库设置了禁用 (enabled=0
),这时可以用 yum repolist
看看到底有哪些仓库。
yum --disablerepo="*" --enablerepo="epel" list available | less
虽然大多数情况下你都期望安装新版本(多个仓库有同一个软件时,yum
会安装版本最新那个),但有时候也会有想装老版本的场景,这时候有以下几种做法:
yum-plugin-priority
,然后在 /etc/yum.repos.d/*.repo
里面设定每个仓库的优先级(详细的说明请见 [[https://wiki.centos.org/PackageManagement/Yum/Priorities][PackageManagement/Yum/Priorities - CentOS Wiki]] );yum --disablerepo=extras install packageA
yum --disablerepo="*" --enablerepo="epel" install packageA
yum-plugin-protectbase
的插件,说 This plugin allows certain repositories to be protected. Packages in the protected repositories can't be overridden by packages in non-protected repositories even if the non-protected repo has a later version. 但我也是刚看见,还没有用过。