在CentOS 6.x或7.x上安装RepoForge Repo


在CentOS 6.x或7.x上安装RepoForge Repo
RepoForge is the new RPMforge.
The RepoForge project maintains RPM packages for: * Red Hat Enterprise Linux (RHEL) * CentOS * Scientific Linux

$ cat /etc/issue
$ uname -a
$ yum install yum* //为了安装yum-config-manager

Import Repoforge GPG key
Next, import the Repoforge RPM repository's official GPG key. That way, you will be able to validate all the RPM packages from the

repository using the key.
$ sudo rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt //导入GPG key

After running the above command, verify that the key has been imported successfully with:
$ yum-config-manager rpmforge | grep gpgkey
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag //检查GPG key

Without importing the key in this step, you will see the following warning when you attempt to install a Repoforge RPM file later.
warning: /var/tmp/rpm-tmp.rHqPLd: Header V3 DSA/SHA1 Signature, key ID 6b8d79e6: NOKEY //不导入GPG key会提示这样的错误信息

CentOS 6.x
32位
sudo rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
64位
sudo rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

CentOS 7.x
64位
sudo rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm

Verify Repoforge Repository Status
Once Repoforge is installed on your system, you can verify its status by running:
$ yum repolist //确认Repoforge Repository状态
0 packages excluded due to repository protections
repo id repo name status
base CentOS-6 - Base 6518
epel Extra Packages for Enterprise Linux 6 - x86_64 11365
extras CentOS-6 - Extras 37
rpmforge RHEL 6 - RPMforge.net - dag 4718
updates CentOS-6 - Updates 946
repolist: 23584

In general, it is not a good idea to keep Repoforge enabled as it could potentially cause conflicts with other third-party packages such as EPEL

$ sudo yum-config-manager --disable rpmforge //禁用Repoforge Repository
If successful, the subsequent output should display "enabled=0".

sudo yum-config-manager --enable rpmforge //启用Repoforge Repository
If successful, the subsequent output should display "enabled=1".

Now if you want to install any package from Repoforge repository, use the following command.
$ sudo yum --enablerepo=rpmforge install [package-name] //或者只安装指定包
完成

在CentOS6.x或CentOS7.x上安装EPEL Repo,Extra Packages for Enterprise Linux (EPEL)

在CentOS6.x或CentOS7.x上安装EPEL Repo,Extra Packages for Enterprise Linux (EPEL)
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again
Repo
repository,资源库,源的意思。RHEL EPEL(Extra Packages for Enterprise Linux) Repo是Linux发行版中最大的软件仓库之一,免费,丰富的软件包更新。

介绍:
http://fedoraproject.org/wiki/EPEL
Support Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).

安装步骤:
CentOS 6.x
sudo rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-6 //导入GPG key
yum-config-manager epel | grep gpgkey
gpgkey = /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 //检查GPG key
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm //安装

CentOS 7.x

sudo rpm --import http://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-7 //导入GPG key
yum-config-manager epel | grep gpgkey
gpgkey = /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 //检查GPG key
sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm //安装

或者
yum install epel-release -y

NOTE for CentOS users
You can install EPEL by running yum install epel-release. The package is included in the CentOS Extras repository, enabled by default.

可能出现的问题:
运行yum报错:
Error: Cannot retrieve metalink for repository: epel. Please verify its path and try again

解决办法:
vim /etc/yum.repos.d/epel.repo
编辑[epel]下的baseurl前的#号去掉,mirrorlist前添加#号。
正确配置如下:
[epel]
name=Extra Packages for Enterprise Linux 6 - $basearch
baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch
#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6

再运行
yum clean all
yum makecache

yum repolist //确认EPEL状态
repo id repo name status
base CentOS-6 - Base 6518
epel Extra Packages for Enterprise Linux 6 - x86_64 11628
extras CentOS-6 - Extras 38
rpmforge RHEL 6 - RPMforge.net - dag 245
updates CentOS-6 - Updates 1199
repolist: 19628
完成
另外:有的时候EPEL需要手动开启
yum install yum* //为了安装yum-config-manager
或者
yum install yum-utils.noarch

sudo yum-config-manager --enable epel //开启EPEL Repository,有的时候无法自动开启
或者
sudo yum-config-manager --enable epel*
epel Extra Packages for Enterprise Linux 6 - x86_64 11,746
epel-debuginfo Extra Packages for Enterprise Linux 6 - x86_64 - D 2,207
epel-source Extra Packages for Enterprise Linux 6 - x86_64 - S 0
epel-testing Extra Packages for Enterprise Linux 6 - Testing - 950
epel-testing-debuginfo Extra Packages for Enterprise Linux 6 - Testing - 78
epel-testing-source Extra Packages for Enterprise Linux 6 - Testing - 0