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

1、首先查看redhat 7.0系统本身所安装的那些yum 软件包:
[root@localhost ~]# 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、删除这些软件包;

[root@localhost ~]# rpm -e yum-3.4.3-118.el7.noarch --nodeps
[root@localhost ~]# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps
[root@localhost ~]# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps
[root@localhost ~]# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps
[root@localhost ~]# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps
[root@localhost ~]# 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版本

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

  1. Redhat 7使用CentOS 7的Yum网络源

    由于redhat 的更新包只对注册的用户生效,所以需要自己手动更改成CentOS 的更新包,CentOS几乎和redhat是一样的,所以无需担心软件包是否可安装,安装之后是否有问题,另外CentOS公 ...

  2. RedHat7.4配置yum网络源

    本次RedHat版本为:Red Hat Enterprise Linux Server release 7.4 (Maipo). 将RedHat7.4的yum源替换为免费的CentOS对应版本yum源 ...

  3. RedHat使用Centos的yum仓库

    RedHat使用Centos的yum仓库 卸载红帽yum源 [root@zhouwanchun ~]# rpm -qa | grep yum [root@zhouwanchun ~]# rpm -e ...

  4. CentOS 6 Yum本地源配置

    #cd /etc/yum.repos.d #rm CentOS-Base.repo CentOS-Base.repo 是yum 网络源的配置文件(默认) #vi CentOS-Media.repo C ...

  5. Centos配置yum本地源最简单的办法

    有关centos配置yum本地源的方法 一.前提 先连接镜像 然后在命令行输入如下命令 mount /dev/sr0 /mnt cd /etc/yum.repos.d/ ls 之后会看到如下的界面 二 ...

  6. redhat6.7 yum网络源配置

    RedHat自带的yum源需要当前系统注册了RHN才可以使用,如果没有注册,当使用yum时,会提示需要注册RHN 如果没有注册RHN,则意味着我们不能使用RedHat自带的yum源.这个时候,我们可以 ...

  7. Centos更新yum packet源

    在使用Centos时,常常会遇到使用yum安装某些系统依赖包,特别是第三方软件库(如openstack软件库)时,无法找到包源.因此,需要将Centos的yum源进行更新,扩展,以便可以通过yum的方 ...

  8. CentOS修改yum更新源

    1. 在修改前先备份该文件 cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak 2. 修改更新源配置文 ...

  9. 设置centos的yum仓库源为阿里源

    前提 使我们的主机能够连接到外网 cd /etc/yum.repos.d/ #切换到yum仓库目录下 rm -rf * #删除默认配置仓库 wget -O /etc/yum.repos.d/CentO ...

随机推荐

  1. ENVI软件操作之【数据的显示操作】

    数据的显示操作主要包括以下的一些简单窗口操作 1.文件列表管理 1)可用的波段列表Available Bands List,使用于存取ENVI图像文件和显示图像文件的主要控制对话框.无论何时何地打开一 ...

  2. PS教程:20个新鲜出炉的 Photoshop 中级教程

    Photoshop 实例教程是提高 Photoshop 技能的最佳学习途径.今天,我向大家分享最新20个 Photoshop 进阶教程,提高你的图片处理技巧,制作时尚的效果.这些教程可以帮助把你的想法 ...

  3. Gogs - 基于 Go 语言的自助 Git 服务

    Gogs(Go Git Service) 是一个基于 Go 语言的自助 Git 服务.Gogs 的目标是打造一个最简单.最快速和最轻松的方式搭建自助 Git 服务.使用 Go 语言开发使得 Gogs ...

  4. javascript中数组的常用方法

    数组的基本方法如下 1.concat() 2.join() 3.pop() 4.push() 5.reverse() 6.shift() 7.sort() 8.splice() 9.toString( ...

  5. 【初窥javascript奥秘之事件机制】论“点透”与“鬼点击”

    前言 最近好好的研究了一番移动设备的点击响应速度,期间不断的被自己坑,最后搞得焦头烂额,就是现在可能还有一些问题,但是过程中感觉自己成长不少, 最后居然感觉对javascript事件机制有了更好的认识 ...

  6. CSS3滚动条-webkit-scrollbar

    webkit现在支持拥有overflow属性的区域,列表框,下拉菜单,textarea的滚动条自定义样式. 如果你想跳过介绍,直接看demo的话,请点击demo 滚动条是一个伪元素,可以自定义样式.这 ...

  7. 如何查找SAP的事务代码清单

    SAP系统中,为了省去输入程序名称等繁琐步骤,SAP提供一种命令,称作‘事务代码’,通过执行事务代码达到快速进入相应程序的目的.那么在系统中如何去查找事务代码,事务代码和程序的对应关系如何呢?我们可以 ...

  8. ArcGIS Desktop 遇到严重的应用程序错误

    由于项目初验,忙了几个月(感觉忙得并不值),好久都没更新博客了. 一.问题 在关闭ArcMap时,ArcGIS Desktop 遇到严重的应用程序错误.环境是Windows 10,新装的系统.以前出现 ...

  9. word第二讲(0806)

    word里的长度单位 绝对长度单位(厘米,英寸) 相对长度单位(字符,像素) 样式 问题: 如何设置多个部分的格式 多次选择,多次设置 多次选择,一次设置 应用格式刷(ctrl+shift+c,ctr ...

  10. iOS---UISearchBar限制输入字数

    - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText // called when text ...