Redhat使用CentOS的Yum 网络源

Redhat 的更新包只对注册的用户生效,所以我们自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的.

1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:
[[email protected] ~]# rpm -qa | grep yum

yum-utils-1.1.31-24.el7.noarch
yum-langpacks-0.4.2-3.el7.noarch
yum-metadata-parser-1.1.4-10.el7.x86_64
yum-rhn-plugin-2.0.1-4.el7.noarch
yum-3.4.3-118.el7.noarch

2、删除这些软件包;

[[email protected] ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps
[[email protected] ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps
[[email protected] ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
[[email protected] ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[[email protected] ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps
[[email protected] ~]# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps

3、本机电脑得能上网(废话,不上网怎么用)

4、自己选择一个合适的镜像网站,找到自己系统所对应的文件包版本更新:

https://www.centos.org/download/mirrors/

我用的aws 美国 NJ州所以选择了http://centos.mirror.constant.com/

5、找到自己所需要的版本下载:

wget http://centos.mirror.constant.com/7/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.noarch.rpm
wget http://centos.mirror.constant.com/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://centos.mirror.constant.com/7/os/x86_64/Packages/yum-utils-1.1.31-34.el7.noarch.rpm
wget http://centos.mirror.constant.com/7/os/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm
wget http://centos.mirror.constant.com/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm

6、安装软件包,注意依赖关系:

rpm -ivh yum-3.4.3-132.el7.centos.0.1.noarch.rpm yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh yum-utils-1.1.31-34.el7.noarch.rpm
rpm -ivh yum-updateonboot-1.1.31-34.el7.noarch.rpm

7、新建repo 配置文件;
vi /etc/yum.repos.d/CentOS-Base.repo

内容如下:
根据自己的镜像替换掉网址http://centos.mirror.constant.com/为自己的镜像网址

# 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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://centos.mirror.constant.com/7/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
baseurl=http://centos.mirror.constant.com/7/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
baseurl=http://centos.mirror.constant.com/7/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
baseurl=http://centos.mirror.constant.com/7/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

8、导入RPM-GPG-KEY-CentOS-7

cd /etc/pki/rpm-gpg/
wget http://centos.mirror.constant.com/RPM-GPG-KEY-CentOS-7

9、清理原先缓存,创建新缓存

yum clean all

yum makecache

10、安装试试

yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel gd gd-devel

后记,注意:

1,莫忘记导入key
2,删除或禁用原先的repo文件
3,--nodeps
4,镜像网址切换
5,Centos和Redhat版本

时间: 2024-10-11 00:18:11

Redhat使用CentOS的Yum 网络源的相关文章

centos 安装yum网络源

安装虚拟机啊,使用公司给定的centos 6.0的iso镜像,该镜像经过裁剪,而且工作中要使用mercurial(hg)版本控制工具,所以需要yum install mercurial. 刚开始安装完该系统,yum install mercurial提示不能解析域名,应该是网络连接不上,选择桥接方式,然后在 /etc/sysconfig/network-scripts/ifcfg-eth0 该目录下配置网络,添加 BOOTPROTO=static IPADDR=192.168.30.102 NE

Redhat 7.0安装CentOS 7 的Yum 网络源

redhat 的更新包只对注册的用户生效,所以我们自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,不说费话了,我们还是来操作吧! 1.首先查看redhat 7.0系统本身所安装的那些yum 软件包: [[email protected] ~]# rpm -qa | grep yumyum-utils-1.1.31-24.el7.noarch yum-langpack

Redhat 7使用CentOS 7的Yum网络源

由于redhat 的更新包只对注册的用户生效,所以需要自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公司去年已经被Redhat 收购了,下面是安装步骤. 1.首先查看redhat 7.0系统本身所安装的那些yum 软件包: [[email protected] ~]# rpm -qa | grep yum yum-utils-1.1.31-24.el7.noarch yum-langpacks-0.

CentOS修改yum更新源

1. 在修改前先备份该文件 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 2. 修改更新源配置文件(CentOS6地址,其他版本类似) vim打开配置文件: vim /etc/yum.repos.d/CentOS-Base.repo 复制以下内容粘贴到配置文件中进行: # CentOS-Base.repo # # The mirror system uses the connecting IP

CentOS 6 Yum本地源配置

#cd /etc/yum.repos.d #rm CentOS-Base.repo CentOS-Base.repo 是yum 网络源的配置文件(默认) #vi CentOS-Media.repo CentOS-Media.repo 是yum 本地源的配置文件 一.file方式 将enabled=0改为1 #mkdir /media/cdrom #mount /dev/cdrom /media/cdrom 二.http方式 1.安装httpd服务 2.mount /dev/cdrom /var/

RedHat采用CentOS的yum源

第一步:备份原有的repo文件,养成良好的习惯 mv rhel-source.repo  rhel-source.repo.bak 第二步:下载最新的CentOS-Base.repo到/etc/yum.repos.d wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo 第三步:替换$releasever为6 vi /etc/yum.repos.d/CentOS-Base.re

redhat配置centos的yum源

redhat默认不支持第三方的yum源,要求有rhn账号,下面就rhel5和rhel6改为centos源 一.rhel5.5 X86_64更改为centos的yum源 查看系统自带的yum相关的rpm包  rpm -qa|grep yum 删掉系统自带的yum相关的包 rpm -e --nodeps yum-updatesd-0 rpm -e --nodeps yum-security   rpm -e --nodeps yum-metadata-p rpm -e --nodeps yum-rh

redhat6.7 yum网络源配置

RedHat自带的yum源需要当前系统注册了RHN才可以使用,如果没有注册,当使用yum时,会提示需要注册RHN 如果没有注册RHN,则意味着我们不能使用RedHat自带的yum源.这个时候,我们可以使用CentOS系统的yum源,这里以配置网易163yum源为例. 1.首先卸载RedHat资源的yum程序 [[email protected] yum.repos.d]# rpm -qa|grep yum|xargs rpm -e --nodeps [[email protected] yum.

Centos更新yum packet源

在使用Centos时,常常会遇到使用yum安装某些系统依赖包,特别是第三方软件库(如openstack软件库)时,无法找到包源.因此,需要将Centos的yum源进行更新,扩展,以便可以通过yum的方式安装更到更多packects.Fedora社区的一个项目EPEL(Extra Packages for Enterprise Linux),它提供了很多源地址. Install the yum-plugin-priorities package to enable assignment of re