服务器之家:专注于服务器技术及软件下载分享
分类导航

Linux|Centos|Ubuntu|系统进程|Fedora|注册表|Bios|Solaris|Windows7|Windows10|Windows11|windows server|

香港云服务器
服务器之家 - 服务器系统 - Centos - RHEL配置Centos yum源的方法

RHEL配置Centos yum源的方法

2019-06-11 10:45脚本之家服务器之家 Centos

RHEL的yum在线更新是收费的;没有注册不能在线安装软件;这种情况该怎么办呢?我们可以借助CentOS的YUM源来满足我们的需求。下面小编将为大家带来RHEL配置Centos yum源的方法;有需要的朋友一起去看看吧

由于RHEL的yum在线更新是收费的,如果没有注册的话是不能使用的,即不能在线安装软件。在这种情况下,如果我们使用的机器安装的是RHEL系统要是每次安装软件先挂载本地光盘会很繁琐,而且有些软件也是老版本的,这种情况下我们可以借助CentOS的YUM源来满足我们的需求。

一、删除RHEL原有的YUM

rpm -aq|grep yum|xargs rpm -e --nodeps

二、下载CentOS的yum安装包(163源)

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm

wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm  

wget http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5

三、安装CentOS的YUM安装包

yum和yum-plugin-fastestmirror需要一起安装,这两个包存在依赖关系,分开安装会失败,安装之前先把RPM-GPG-KEY导入系统,否则会出现警告信息

rpm -ivh yum-metadata-parser-1.1.2-4.el5.x86_64.rpm  

rpm --import RPM-GPG-KEY-CentOS-5

rpm –ivh yum-3.2.22-40.el5.centos.noarch.rpm  yum-fastestmirror-1.1.16-21.el5.centos.noarch.rm

至此我们就可以在线使用yum了

四、修改yum源

为了使用在线使用Yum安装软件更快,我们可以使用国内的网易Yum源或者其他国内yum源

五、更改yum源

#我们使用网易的CentOS镜像源

cd /etc/yum.repos.d/

vi rhel-debuginfo.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-5 - Base - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os

baseurl=http://mirrors.163.com/centos/5/os/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates

[updates]

name=CentOS-5 - Updates - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates

baseurl=http://mirrors.163.com/centos/5/updates/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released

[addons]

name=CentOS-5 - Addons - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons

baseurl=http://mirrors.163.com/centos/5/addons/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful

[extras]

name=CentOS-5 - Extras - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=extras

baseurl=http://mirrors.163.com/centos/5/extras/$basearch/

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-5 - Plus - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus

baseurl=http://mirrors.163.com/centos/5/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users

[contrib]

name=CentOS-5 - Contrib - 163.com

mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=contrib

baseurl=http://mirrors.163.com/centos/5/contrib/$basearch/

gpgcheck=1

enabled=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

六、清理

yum clean all

yum makecache

七、更新

yum update

延伸 · 阅读

精彩推荐
  • CentosCentOS6.5下Redis安装与配置详细步骤

    CentOS6.5下Redis安装与配置详细步骤

    本篇文章主要介绍了CentOS6.5下Redis安装与配置详细步骤,详细介绍redis单机单实例安装与配置,服务及开机自启动。有兴趣的可以了解一下。...

    飞流11452021-12-24
  • Centoscentos 安装与操作方法

    centos 安装与操作方法

    这篇文章主要介绍了centos 安装与操作方法,需要的朋友可以参考下...

    centos之家5272019-07-11
  • CentosCentos7运用/dev/shm进行网站优化

    Centos7运用/dev/shm进行网站优化

    这篇文章主要介绍了LINUX中Centos7运用/dev/shm进行网站优化相关知识点,对此有兴趣的朋友参考学习下。...

    彬菌9912022-03-02
  • Centoscentos不小心删除/root目录该如何解决?

    centos不小心删除/root目录该如何解决?

    一些朋友最近在问小编centos不小心删除/root目录该如何解决?今天小编就为大家分享centos不小心删除/root目录解决办法;希望对大家会有帮助,有需要的朋友...

    脚本之家8022019-05-29
  • CentosCentos 7开启网卡自动获取IP的详细方法

    Centos 7开启网卡自动获取IP的详细方法

    本篇文章主要介绍了Centos 7开启网卡自动获取IP的详细方法,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧...

    凌锋8972021-12-29
  • CentosCentOS下Uptime命令详解

    CentOS下Uptime命令详解

    在Linux下,我们可以使用uptime命令,而且此命令不必使用root权限。uptime命令在系统中已经默认安装了。今天小编为大家带来的是CentOS下Uptime命令详解;希望...

    CentOS之家11482019-06-19
  • CentosCentOS7设置日期和时间方法以及基本概念介绍

    CentOS7设置日期和时间方法以及基本概念介绍

    这篇文章主要介绍了CentOS7设置日期和时间方法以及基本概念介绍,本文讲解使用CentOS7中的新命令timedatectl设置日期时间方法,需要的朋友可以参考下 ...

    CentOS之家6522019-09-19
  • CentosCentOS 6.6实现永久修改DNS地址的方法

    CentOS 6.6实现永久修改DNS地址的方法

    这篇文章主要介绍了CentOS 6.6实现永久修改DNS地址的方法,涉及针对CentOS配置文件的相关设置技巧,具有一定参考借鉴价值,需要的朋友可以参考下 ...

    Linux社区4472020-08-21
325