感谢支持
我们一直在努力

RHEL使用CentOS作为yum更新源

由于rhel没有注册码,之前一直用DVD做更新源,但是rhel又不能从官网上更新,怎么办呢,想想就使用CentOS的更新源吧:


首先把rhel自带的文件备份:


[root@test yum.repos.d]# cp rhel-debuginfo.repo rhel-debuginfo.repo.bak


[root@test yum.repos.d]# mv rhel-debuginfo.repo CentOS-Base.repo


[root@test yum.repos.d]# vi CentOS-Base.repo


[base]
name=CentOS-5-Base
repo=os
baseurl=http://centos.ustc.edu.cn/centos/5/os/$basearch/
gpgcheck=0
gpgkey=http://centos.ustuc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


[updates]
name=CentOS-5-Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/$basearch/
gpgcheck=0
gpgkey=http://centos.ustuc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


[addons]
name=CentOS-5-Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/$basearch/
gpgcheck=0
gpgkey=http://centos.ustuc.edu.cn/centos/RPM-GPG-KEY-CentOS-5



[extras]
name=CentOS-5-Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/$basearch/
gpgcheck=0
gpgkey=http://centos.ustuc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


[centosplus]
name=CentOS-5-Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=0
gpgkey=http://centos.ustuc.edu.cn/centos/RPM-GPG-KEY-CentOS-5



[contrib]
name=CentOS-5-Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/$basearch/
gpgcheck=0
gpgkey=http://centos.ustuc.edu.cn/centos/RPM-GPG-KEY-CentOS-5


[root@test yum.repos.d]# rpm –import /etc/pki/rpm-gpg/RPM*


把虚拟机联网然后测试一下


[root@test yum.repos.d]# yum list


[root@test yum.repos.d]#  yum install mysql


Loaded plugins: aliases, changelog, downloadonly, fastestmirror, filter-data, keys, kmod, list-data, protect-packages, protectbase, rhnplugin, security, tmprepo,
              : verify, versionlock
This system is not registered with RHN.
RHN support will be disabled.
Loading mirror speeds from cached hostfile
addons                                                                                                                                           | 1.9 kB     00:00    
base                                                                                                                                             | 1.1 kB     00:00    
centosplus                                                                                                                                       | 1.9 kB     00:00    
contrib                                                                                                                                          | 1.9 kB     00:00    
extras                                                                                                                                           | 2.1 kB     00:00    
updates                                                                                                                                          | 1.9 kB     00:00    
Skipping filters plugin, no data
0 packages excluded due to repository protections
Reading version lock configuration
Setting up Install Process
Resolving Dependencies
Skipping filters plugin, no data
–> Running transaction check
—> Package mysql.i386 0:5.0.95-1.el5_7.1 set to be updated
–> Processing Dependency: perl(DBI) for package: mysql
–> Running transaction check
—> Package perl-DBI.i386 0:1.52-2.el5 set to be updated
–> Finished Dependency Resolution


Dependencies Resolved


========================================================================================================================================================================
 Package                                Arch                               Version                                          Repository                             Size
========================================================================================================================================================================
Installing:
 mysql                                  i386                               5.0.95-1.el5_7.1                                 updates                               4.9 M
Installing for dependencies:
 perl-DBI                               i386                               1.52-2.el5                                       base                                  600 k


Transaction Summary
========================================================================================================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)


Total size: 5.5 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : perl-DBI                                                                                                                                          1/2
  Installing     : mysql                                                                                                                                                                                                               2/2


Installed:
  mysql.i386 0:5.0.95-       1.el5_7.1                                                                                                                                         


Dependency Installed:
  perl-DBI.i386 0:1.52-2.el5                                                                                                                                            


Complete!


OK,成功了~~~~


如果要使用其他的更新源可以把配置文件中的baseurl中的更新网址换成其他的,比如


mirrors.163.com但是要注意路径和版本号~


国内比较好的CentOS更新源有163,sina,中科大等,如果有错误请自己看下错误日志,及把rhel自带的yum卸载安装CentOS的yum软件试试。

赞(0) 打赏
转载请注明出处:服务器评测 » RHEL使用CentOS作为yum更新源
分享到: 更多 (0)

听说打赏我的人,都进福布斯排行榜啦!

支付宝扫一扫打赏

微信扫一扫打赏