RedHat 5.8更新yum源

1.redhat在使用yum时报错

[root@redhat58 ~]# yum  install -y unzip zip
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Setting up Install Process
Nothing to do

2.需要更新yum源,将redhat的yum源替换成centos的源

[root@redhat58 packager512]# cd /etc/yum.repos.d/
[root@redhat58 yum.repos.d]# ll
total 16
-rw-r--r-- 1 root root 190 Apr 12 22:40 redhat.repo
-rw-r--r-- 1 root root 254 Jan 24  2012 rhel-debuginfo.repo

如果没有rhel-source.repo文件,则需要新建

[root@redhat58 yum.repos.d]# vi rhel-source.repo

在rhel-source.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-$releasever - Base - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/5.10/os/x86_64/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/5.10/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/5.10/extras/$basearch/
gpgcheck=1
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/6.10/centosplus/$basearch/
gpgcheck=1
enabled=0    
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users 
[contrib]
name=CentOS-$releasever - Contrib - mirrors.aliyun.com
failovermethod=priority
baseurl=http://mirrors.aliyun.com/centos-vault/5.10/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-5

3.清理缓存

[root@redhat58 yum.repos.d]# yum clean all  
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Cleaning up Everything
[root@redhat58 yum.repos.d]# ll
total 24
-rw-r--r-- 1 root root  190 Apr 12 22:44 redhat.repo
-rw-r--r-- 1 root root  254 Jan 24  2012 rhel-debuginfo.repo
-rw-r--r-- 1 root root 1750 Apr 12 22:44 rhel-source.repo

4.更新缓存

[root@redhat58 yum.repos.d]# yum makecache
Loaded plugins: katello, product-id, security, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
base                                                               | 1.1 kB     00:00     
base/filelists                                                     | 3.7 MB     00:07     
base/other                                                         |  13 MB     00:28     
base/group                                                         | 1.1 MB     00:02     
base/primary                                                       | 1.3 MB     00:02     
extras                                                             | 2.1 kB     00:00     
extras/filelists_db                                                | 224 kB     00:00     
extras/other_db                                                    | 442 kB     00:00     
extras/group                                                       | 9.7 kB     00:00     
extras/primary_db                                                  | 173 kB     00:00     
updates                                                            | 1.9 kB     00:00     
updates/filelists_db                                               | 3.1 MB     00:06     
updates/other_db                                                   |  16 MB     00:35     
updates/primary_db                                                 | 630 kB     00:01     
base                                                                            3662/3662
base                                                                            3662/3662
base                                                                            3662/3662
Metadata Cache Created

猜你喜欢

转载自blog.csdn.net/qq_44451165/article/details/130107929