redhat6.5 配置使用centos的yum源

简介:

YUM是Redhat Linux在线安装更新及软件的工具,但是这是RHEL5的收费功能,如果没有购买Redhat的服务时不能使用RHEL5的更新源的,会提示注册。
由于CentOS是从Redhat演化而来的免费Linux版本,因此可以利用CentOS的yum更新源来实现RHEL5的YUM功能。

【关于yum的一点资料】
一、yum是什么
yum = Yellow dog Updater, Modified
主要功能是更方便的添加/删除/更新RPM包.
它能自动解决包的倚赖性问题.
它能便于管理大量系统的更新问题
二、 yum特点
*可以同时配置多个资源库(Repository)
*简洁的配置文件(/etc/yum.conf,/etc/yum.repos.d 下的文件)
*自动解决增加或删除rpm包时遇到的倚赖性问题
*使用方便
*保持与RPM数据库的一致性

首先检测本机是否安装了yum软件,一般安装yum包括以下几个软件包
yum-rhn-plugin-0.5.4-22.el5
yum-metadata-parser-1.1.2-3.el5
yum-3.2.22-37.el5
yum-security-1.1.16-16.el5
yum-updatesd-0.9-2.el5

检测命令为:rpm -qa | grep yum

2 删除redhat自带的yum包

卸载上面显示的所有yum包:

1
2
[root@localhost ~] # rpm -qa|grep yum|xargs rpm -e --nodeps(不检查依赖,直接删除rpm包)
[root@localhost ~] # rpm -qa |grep yum

查看,无信息显示表示已经卸载完成。

网易(163)yum源是国内最好的yum源之一 ,无论是速度还是软件版本,都非常的不错。所以选择网易镜像站为yum源,为工作或学习,安装文件或更新rpm包提供方便,特将配置方法记录。
网易开源的镜像站:http://mirrors.163.com/

我的Redhat是x86_64 Redhat5.7操作系统,选择相近的5.10使用源,根据的你的Redhat的版本,选择相应的Centos的源路径即可

1
lsb_release -a

导入证书(证书的位置 http://mirrors.163.com/centos/)

1
rpm -impor thttp: //mirrors .163.com /centos/RPM-GPG-KEY-CentOS-5

参考: http://mirrors.163.com/.help/centos.html 镜像使用帮助,注意备份旧的文件。
进入linux 的yum配置文件位置

1
2
cd   /etc/yum .repos.d/
vim CentOS6-Base-163.repo

编辑文件,使用全局替换命令:%s/$releasever /5.10/g   (其中%表示全局相当于1,$;g表示全局替换)或者直接把下面的内存拷贝到CentOS6-Base-163.repo文件中即可(已经修改好)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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-6.5 - Base - 163.com
baseurl=http: //mirrors .163.com /centos/6 .5 /os/ $basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6
  
#released updates 
[updates]
name=CentOS-6.5 - Updates - 163.com
baseurl=http: //mirrors .163.com /centos/6 .5 /updates/ $basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6
  
#additional packages that may be useful
[extras]
name=CentOS-6.5 - Extras - 163.com
baseurl=http: //mirrors .163.com /centos/6 .5 /extras/ $basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6
  
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-6.5 - Plus - 163.com
baseurl=http: //mirrors .163.com /centos/6 .5 /centosplus/ $basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6
  
#contrib - packages by Centos Users
[contrib]
name=CentOS-6.5 - Contrib - 163.com
baseurl=http: //mirrors .163.com /centos/6 .5 /contrib/ $basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http: //mirror .centos.org /centos/RPM-GPG-KEY-CentOS-6

注:把其中数字6.5或者6改为自己的版本

二:从CentOS中安装相应版本yum组件


清除原有缓存
# yum clean all

重建缓存,以提高搜索安装软件的速度
# yum makecache

6.更新系统
# yum update


本文转自 boy461205160 51CTO博客,原文链接:http://blog.51cto.com/461205160/1727170

相关文章
|
3天前
|
Linux
centos 6.5安装yum
centos 6.5安装yum
22 0
|
3天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置PXE服务
PXE是Intel开发的预启动执行环境,允许工作站通过网络从远程服务器启动操作系统。它依赖DHCP分配IP,DNS服务分配主机名,TFTP提供引导程序,HTTP/FTP/NFS提供安装源。要部署PXE服务器,需关闭selinux和防火墙,安装dhcpd、httpd、tftp、xinetd及相关服务,配置引导文件和Centos7安装源。最后,通过syslinux安装引导文件,并创建pxelinux.cfg/default配置文件来定义启动参数。
15 0
|
3天前
|
运维 网络协议 Linux
【运维系列】Centos7安装并配置postfix服务
安装CentOS7的Postfix和Dovecot,配置Postfix的`main.cf`文件,包括修改完全域名、允许所有IP、启用邮箱等。然后,配置Dovecot的多个配置文件以启用auth服务和调整相关设置。重启Postfix和Dovecot,设置开机自启,并关闭防火墙进行测试。最后,创建邮箱账户并在Windows邮箱客户端中添加账户设置。
10 0
|
3天前
|
Linux 网络安全
Centos6.5安装并配置NFS服务
该内容描述了在Linux系统中设置NFS服务的步骤。首先挂载yum源,然后安装NFS服务,并编辑配置文件。接着,重启rpcbind和NFS服务,可能需要重复此过程以解决初始可能出现的问题。此外,关闭防火墙策略,并再次重启服务。最终,根目录被共享,特定IP网段被允许访问。
10 0
|
4天前
|
存储 Linux 网络安全
centos7使用yum网络安装
这些是使用Yum进行网络安装的基本步骤。根据你的需求,你可以重复步骤3和4来安装其他软件包。请注意,执行Yum操作需要root或具有sudo权限的用户。
16 1
|
17天前
|
网络协议
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
centos8 网卡 Nmcli(是network的简写 Nmcli)配置网络
16 0
|
17天前
|
缓存 Linux
linux centos7 挂载本地iso yum源
linux centos7 挂载本地iso yum源
73 0
|
17天前
|
关系型数据库 MySQL Linux
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
CentOS 7 下使用yum安装MySQL5.7.20 最简单 图文详解
78 0
|
1月前
|
运维 Linux 应用服务中间件
Centos7如何配置firewalld防火墙规则
Centos7如何配置firewalld防火墙规则
49 0
|
1月前
|
Linux
centOS8不在维护,yum源问题解决
解决执行 yum makecache 出现appstream下载源数据失败问题
67 0
centOS8不在维护,yum源问题解决