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