Linux(Redhat 7.0) yum沒法使用和subscription-manager提示node
Redhat7 yum 沒法使用python
錯誤信息
[root@micocube ~]# yum install gcc-c++
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
There are no enabled repos.
Run "yum repolist all" to see the repos you have.
To enable Red Hat Subscription Management repositories:
subscription-manager repos --enable
To enable custom repositories:
yum-config-manager --enable
查看redhat 7.0系統自己所安裝的那些yum軟件包
[root@micocube ~]# rpm -qa | grep yum
yum-rhn-plugin-2.0.1-10.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-3.4.3-158.el7.noarch
卸載這些軟件包
[root@micocube ~]# rpm -e yum-rhn-plugin-2.0.1-10.el7.noarch --nodeps
[root@micocube ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[root@micocube ~]# rpm -e yum-3.4.3-158.el7.noarch --nodeps
下載centos的yum 相關 rpm包,包下載地址,版本請從包下載地址獲取最新的,能夠用wget下載
python-kitchen-1.1.1-5.el7.noarch.rpm
python-chardet-2.2.1-1.el7_1.noarch.rpm
yum-3.4.3-161.el7.centos.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-utils-1.1.31-50.el7.noarch.rpm
yum-updateonboot-1.1.31-50.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpmvim
安裝軟件包
rpm -ivh python-*
rpm -ivh yum-*centos
切換到/etc/yum.repos.d/目錄
從這裏下載repo文件到/etc/yum.repos.d/目錄
好比wget http://mirrors.aliyun.com/repo/Centos-7.repo
清除緩存
yum clean all
能夠用yum search vim測試緩存
這個Red Hat Subscription Manager訂閱管理器,它會讓你一直register,解決辦法:禁用就好
所以,爲了避免衝突,能夠以下操做:中止掉該插件的使用,在配置文件中把enable=0便可。
[root@micocube ~] vim /etc/yum/pluginconf.d/subscription-manager.conf
[main]
enabled=0 #將它禁用掉curl
可是我在執行yum makecache時報錯,報錯信息以下:oop
Loaded plugins: fastestmirror, langpacks, priorities
Repository epel is listed more than once in the configuration
Cleaning repos: base epel extras updates
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@hadoop01 yum.repos.d]# yum makecache
Loaded plugins: fastestmirror, langpacks, priorities
Repository epel is listed more than once in the configuration
Determining fastest mirrors測試
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30000 milliseconds')
Trying other mirror.
http://mirrors.cloud.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: mirrors.cloud.aliyuncs.com; Unknown error"
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
http://mirrors.aliyuncs.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 12] Timeout on http://mirrors.aliyuncs.com/centos/$releasever/os/x86_64/repodata/repomd.xml: (28, 'Connection timed out after 30001 milliseconds')
Trying other mirror.
...url
【解決方法】
在網上找了好多帖子,都沒能解決個人問題,後來看到是HTTP請求失敗,嘗試本地訪問以前wget下來的 CentOS-Base.repo 發現其中的:
http://mirrors.aliyun.com/centos/$releasever/os/$basearch/
等URL經過http的形式根本沒法訪問,此時將變量$releasever改成7(個人系統是centos 7),發現能夠訪問了,順便將全部的變量$releasever都改成7。感受這個變量$releasever根本就沒起做用呀。
改完以後,執行yum clean all 以及 yum makecache 成功。
oaded plugins: fastestmirror, langpacks
Determining fastest mirrors