[转]redhat7(centos7) not registered to Red Hat Subscription Management

[root@controller0 ~]# yum install ntp
Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
http://mirrors.163.com/centos/%24releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror.
To address this issue please refer to the below knowledge base article 

https://access.redhat.com/articles/1320623

If above article doesn't help to resolve this issue please create a bug on https://bugs.centos.org/



 One of the configured repositories failed (CentOS-$releasever - Base - 163.com),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Disable the repository, so yum won't use it by default. Yum will then
        just ignore the repository until you permanently enable it again or use
        --enablerepo for temporary usage:

            yum-config-manager --disable base

     4. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=base.skip_if_unavailable=true

failure: repodata/repomd.xml from base: [Errno 256] No more mirrors to try.
http://mirrors.163.com/centos/$releasever/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found

  遇到上面的问题,转载一篇解决方案:http://www.linuxidc.com/Linux/2013-10/90932.htm

=====================================================================================================    

今日网上搜索了很多关于RHEL6.4更改为CentOS源的文章,都是按照一步一步去操作,但都是不行的。后来自己综合了各篇文章,修修改改,终于成功更改了yum源。

第一步:删除默认的yum源。命令如下
rpm-aq | grep yum|xargs rpm -e--nodeps

第二步:下载最新的yum安装包

wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/6.4/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/6.4/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/6.4/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

第三步:安装yum相关软件。
rpm-ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm-ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm-ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

第四步:更改yum源,我们使用网易的镜像源,可以去这里http://mirrors.163.com/.help/centos.html 下载最新的CentOS-Base.repo文件,然后cp到/etc/yum.repos.d/目录下,修改把文件里面的$releasever全部替换为版本号,即6 最后保存。最后把这个文件命名为rhel-source.repo,替换掉原来该目录的同名文件。

第五步:清理yum缓存
yum clean all
yum makecache
最后显示如下,更换yum源成功。

Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Determining fastest mirrors
base | 3.7 kB 00:00 
base/group_gz | 212 kB 00:00 
base/filelists_db | 5.9 MB 00:12 
base/primary_db | 4.4 MB 00:09 
base/other_db | 2.7 MB 00:05 
extras | 3.4 kB 00:00 
extras/filelists_db | 10 kB 00:00 
extras/prestodelta | 905 B 00:00 
extras/primary_db | 18 kB 00:00 
extras/other_db | 5.7 kB 00:00 
updates | 3.4 kB 00:00 
updates/filelists_db | 4.0 MB 00:08 
updates/prestodelta | 978 kB 00:02 
updates/primary_db | 4.4 MB 00:09 
updates/other_db | 661 kB 00:01

原文地址:https://www.cnblogs.com/horizonli/p/5507112.html