CentOS 的官方源去掉了一些與版權有關的軟件,因此想要安裝這些軟件或者手動下載安裝,或者使用其他源.
下面是添加EPEL源和RPMforge源的步驟。
1.首先, 添加源之前要確定系統架構及版本
查看系統版本:
[sxd@bogon ~]$ cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)
[sxd@bogon ~]$ uname -r
3.10.0-514.el7.x86_64
[sxd@bogon ~]$ uname -a
Linux bogon 3.10.0-514.el7.x86_64 #1 SMP Tue Nov 22 16:42:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
以看出來,系統版本是7.3.1611 架構是x86_64 64位的系統
2.查看當前CentOS7上已經有哪些源
[sxd@bogon ~]$ yum repolist
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirror.bit.edu.cn
* updates: mirrors.sohu.com
源標識 源名稱 狀態
base/7/x86_64 CentOS-7 - Base 9,363
extras/7/x86_64 CentOS-7 - Extras 451
updates/7/x86_64 CentOS-7 - Updates 2,146
repolist: 11,960
[sxd@bogon ~]$
3.接下來,安裝EPEL源
EPEL官網地址:https://fedoraproject.org/wiki/EPEL
點擊中文簡體
往下翻找到
CentOS用戶可以直接通過下面的命令安裝並啟用EPEL源。【需要root用戶權限】
[sxd@bogon ~]$ yum install epel-release
已加載插件:fastestmirror, langpacks
您需要 root 權限執行此命令。
[sxd@bogon ~]$ su root
密碼:
ABRT 已檢測到 '1' 個問題。預了解詳細信息請執行:abrt-cli list --since 1505290164
[root@bogon sxd]# yum install epel-release
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.cqu.edu.cn
* updates: mirrors.cqu.edu.cn
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 epel-release.noarch.0.7-9 將被 安裝
--> 解決依賴關系完成
依賴關系解決
================================================================================
Package 架構 版本 源 大小
================================================================================
正在安裝:
epel-release noarch 7-9 extras 14 k
事務概要
================================================================================
安裝 1 軟件包
總下載量:14 k
安裝大小:24 k
Is this ok [y/d/N]:
4.安裝完成之后,手動更新源,使之立即生效
鍵入命令:
yum makecache
5.再查看源,EPEL已經安裝成功
[root@bogon sxd]# yum repolist
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.cqu.edu.cn
* updates: mirrors.cqu.edu.cn
源標識 源名稱 狀態
base/7/x86_64 CentOS-7 - Base 9,363
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,898
extras/7/x86_64 CentOS-7 - Extras 451
updates/7/x86_64 CentOS-7 - Updates 2,146
repolist: 23,858
[root@bogon sxd]#
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
6.添加RPMforge【rpmforge】源
rpmforge安裝有很多文章中都要去官網找對應版本的rpm包,但是
官網中,已經把這個RPMforge 報廢掉了,找rpm包也找不到。參考文章中提供的地址,也下載不到。
然后,千方百計的,從下面這個地址中找到了
查找rpm資源包地址:
https://centos.pkgs.org/7/repoforge-x86_64/

然后在Download中下載這個到本地。然后使用rpm安裝rpm包
[root@bogon 下載]# ls -al
總用量 32316
drwxr-xr-x. 3 sxd sxd 139 9月 13 18:43 .
drwx------. 18 sxd sxd 4096 9月 13 18:28 ..
-rw-rw-r--. 1 sxd sxd 1572 9月 13 17:37 CentOS7-Base-163.repo
-rw-rw-r--. 1 sxd sxd 33059071 9月 13 16:30 fb290450702040cfbd1a8822e2522dd2
-rw-rw-r--. 1 sxd sxd 12520 9月 13 18:43 rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
drwxr-xr-x. 2 sxd sxd 4096 9月 8 2014 x86_64
[root@bogon 下載]# rpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm
警告:rpmforge-release-0.5.3-1.el7.rf.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 6b8d79e6: NOKEY
准備中... ################################# [100%]
正在升級/安裝...
1:rpmforge-release-0.5.3-1.el7.rf ################################# [100%]
[root@bogon 下載]# yum repolist
已加載插件:fastestmirror, langpacks
http://apt.sw.be/redhat/el7/en/x86_64/rpmforge/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: apt.sw.be; 未知的名稱或服務"
正在嘗試其它鏡像。
http://ftp.cc.uoc.gr/mirrors/repoforge/redhat/el7/en/x86_64/rpmforge/repodata/repomd.xml: [Errno 14] curl#56 - "Recv failure: Connection reset by peer"
正在嘗試其它鏡像。
rpmforge | 1.9 kB 00:00
rpmforge/primary_db | 125 kB 00:02
Loading mirror speeds from cached hostfile
* epel: mirrors.tuna.tsinghua.edu.cn
* rpmforge: mirrors.tuna.tsinghua.edu.cn
源標識 源名稱 狀態
base/7/x86_64 CentOS-7 - Base - 163.com 9,363
epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,898
extras/7/x86_64 CentOS-7 - Extras - 163.com 451
rpmforge RHEL 7 - RPMforge.net - dag 245
updates/7/x86_64 CentOS-7 - Updates - 163.com 2,146
repolist: 24,103
[root@bogon 下載]# yum makecache
已加載插件:fastestmirror, langpacks
base | 3.6 kB 00:00
epel/x86_64/metalink | 5.7 kB 00:00
extras | 3.4 kB 00:00
rpmforge | 1.9 kB 00:00
updates | 3.4 kB 00:00
(1/2): rpmforge/filelists_db | 96 kB 00:01
(2/2): rpmforge/other_db | 34 kB 00:03
Loading mirror speeds from cached hostfile
* epel: mirrors.tuna.tsinghua.edu.cn
* rpmforge: mirrors.tuna.tsinghua.edu.cn
元數據緩存已建立
[root@bogon 下載]#
到這里 就添加完成了。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
參考地址:
https://blog.itnmg.net/centos-yum-source/ 添加國外國內各種源的參考文章
https://www.tecmint.com/enable-rpmforge-repository/
http://www.live-in.org/archives/998.html
https://centos.pkgs.org/7/repoforge-x86_64/ rpm資源地址
