1. 程式人生 > >redhat 7安裝CentOS 7 yum源

redhat 7安裝CentOS 7 yum源

試過各路大神redhat7安裝CentOS 7 yum源的方法都遇到這個問題:
python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-150.el7.centos.noarch
雖然安裝了python-urlgrabber-3.10-8.el7.noarch.rpm但不知道什麼原因還是會出現上面的問題 。
以下部分是 http://www.bubuko.com/infodetail-2004218.html 這裡複製過來的,按照這位仁兄的辦法可以安裝成功,在此謝過!(之前安了將近一天,哎,誰懂小白的辛酸)

但仍然有不明白的地方:我在Desktop上新建資料夾yum,然後在yum裡面open in terminal 並且使用root賬戶進行操作居然沒有安裝成功。。。。之後把要用到的5個.rpm檔案複製到Home下使用普通賬戶成功了(有些步驟使用了sudo),費解!雖然不知道原因,但yum是可以用了,也算完成了目標。

////////////////////////////////////////////////////////////////分割線////////////////////

由於redhat 的更新包只對註冊的使用者生效,所以需要自己手動更改成CentOS 的更新包,
CentOS幾乎和redhat是一樣的,所以無需擔心軟體包是否可安裝,下面是安裝步驟。

1、首先檢視redhat 7.0系統本身所安裝的那些yum 軟體包:
[[email protected] ~]# rpm -qa | grep yum
yum-utils-1.1.31-24.el7.noarch
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-4.el7.noarch
PackageKit-yum-0.8.9-11.el7.x86_64
yum-3.4.3-118.el7.noarch

2、解除安裝這些軟體包;
[[email protected] ~]# rpm -e yum-3.4.3-118.el7.noarch –nodeps
[[email protected] ~]# rpm -e yum-utils-1.1.31-24.el7.noarch –nodeps
[[email protected] ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch –nodeps
[[email protected] ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 –nodeps
[

[email protected] ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch –nodeps
[[email protected] ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 –nodeps

3、保證本機電腦能上網;
[[email protected] ~]# ping www.baidu.com
PING www.a.shifen.com (163.177.151.110) 56(84) bytes of data.
64 bytes from 163.177.151.110: icmp_seq=1 ttl=49 time=13.1 ms
64 bytes from 163.177.151.110: icmp_seq=2 ttl=49 time=6.80 ms
64 bytes from 163.177.151.110: icmp_seq=3 ttl=49 time=6.77 ms
^C
— www.a.shifen.com ping statistics —
3 packets transmitted, 3 received, 0% packet loss, time 2007ms
rtt min/avg/max/mdev = 6.777/8.917/13.168/3.006 ms

6、檢視下載完成結果;
[[email protected] ~]# ls
anaconda-ks.cfg yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm
initial-setup-ks.cfg yum-updateonboot-1.1.31-40.el7.noarch.rpm
yum-3.4.3-150.el7.centos.noarch.rpm yum-utils-1.1.31-40.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

7、安裝軟體包:
[[email protected] ~]# rpm -ivh yum-*
warning: yum-3.4.3-150.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
error: Failed dependencies:
python-urlgrabber >= 3.10-8 is needed by yum-3.4.3-150.el7.centos.noarch

這裡出現了一個小問題~~~:安裝的python-urlgrabber版本不符合您嘗試安裝的RPM的依賴關係,我目前沒有能力解決這個問題的辦法,
後來想了一個折中的辦法,FQ去一個國外的yum源網站下載上面這五個較低版本的安裝包,在來安裝就不會有問題了
在這裡附上鍊接各位可以FQ出去下載對應版本的rpm包
連結:http://rpm.pbone.net/
不報錯版本安裝包:
yum-3.4.3-132.el7.centos.0.1.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-utils-1.1.31-34.el7.noarch.rpm

技術分享

技術分享

我把這五個rpm包下載到我的windows電腦裡,然後用WinSCP這個軟體上傳到redhat 7 系統裡,WinSCP這個軟體的使用方法就不在這裡贅述了

技術分享

8、下載好後重新安裝:
[[email protected] ~]# ls
yum-3.4.3-132.el7.centos.0.1.noarch.rpm yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm yum-utils-1.1.31-34.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
[[email protected] ~]# rpm -ivh yum-*
warning: yum-3.4.3-132.el7.centos.0.1.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Preparing… ################################# [100%]
Updating / installing…
1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 20%]
2:yum-plugin-fastestmirror-1.1.31-3################################# [ 40%]
3:yum-3.4.3-132.el7.centos.0.1 ################################# [ 60%]
4:yum-updateonboot-1.1.31-34.el7 ################################# [ 80%]
5:yum-utils-1.1.31-34.el7 ################################# [100%]
[[email protected] ~]#
這次沒有報錯了,安裝完成!!!

9、新建repo 配置檔案;

[[email protected] ~]# vim /etc/yum.repos.d/CentOS-Base.repo

#CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$7 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=7&arch=basearch&repo=os
baseurl=http://mirrors.163.com/centos/7/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

10、清除快取:

[[email protected] ~]# yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up everything

11、測試安裝是否正常;

[[email protected] ~]# yum -y install lftp
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/4): extras/x86_64/primary_db | 139 kB 00:00:00
(2/4): base/x86_64/group_gz | 155 kB 00:00:00
(3/4): updates/x86_64/primary_db | 3.9 MB 00:00:01
(4/4): base/x86_64/primary_db | 5.6 MB 00:00:02
Determining fastest mirrors
Resolving Dependencies
–> Running transaction check
—> Package lftp.x86_64 0:4.4.8-8.el7_3.2 will be installed
–> Finished Dependency Resolution
Dependencies Resolved

=======================================================================================================================
Package Arch Version Repository Size
.=======================================================================================================================
Installing:
lftp x86_64 4.4.8-8.el7_3.2 updates 751 k

Transaction Summary
.=======================================================================================================================
Install 1 Package此處省略安裝輸出內容~~~~
Installed:
lftp.x86_64 0:4.4.8-8.el7_3.2

Complete!

到這裡安裝完成,以後安裝所需包,可以不用本地yum源了,直接使用網路yum源。