redhat系统安装好尽管默认带有yum,但是redhat的更新包只对注册用户有效(收费)。所以需要更换yum源。

基本的流程就是:

1.删除redhat7.0系统自带的yum软件包;
2.自行下载所需要的软件包;
3.根据依赖项安装;
4.新建repo配置文件。
一般来说,之后就可以正常使用了。可能还会遇到一些依赖项的问题,后面会提到。

流程
1、查看自带的yum软件包

[root@192 ~]#  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
PackageKit-yum-0.8.9-11.el7.x86_64
yum-3.4.3-117.el7.noarch

 这下面列出来的软件包,要记住一下,后面要根据其来搜索rpm包来安装新版本。比如”yum-utils”、”yum-langpacks”等等。

2、卸载这些安装包

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

3、保证上网正常

ping www.baidu.com

4、进入以下网站下载对应的rpm包

阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/
使用CTRL+F输入关键字查找对应的安装包即可。

5、找到安装包后下载下来

由于输出结果较多,故省略,下面是输入指令:

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-158.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-utils-1.1.31-45.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-45.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-45.el7.noarch.rpm

6、安装
输入指令rpm -ivh yum-*,遇到报错,依赖项问题。

[root@192 ~]# rpm -ivh yum-*
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4       a80eb5: NOKEY
错误:依赖检测失败:
        python-urlgrabber >= 3.10-8 被 yum-3.4.3-161.el7.centos.noarch 需要
        rpm >= 0:4.11.3-22 被 yum-3.4.3-161.el7.centos.noarch 需要
        yum-plugin-fastestmirror 被 yum-3.4.3-161.el7.centos.noarch 需要

另外再回去找安装包下载下来:

输入指令更新rpm:

rpm -Uvh yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
rpm -Uvh python-urlgrabber-3.10-9.el7.noarch.rpm

小技巧: 查找需要依赖的安装包,可以在网站里搜索关键字,这样最省时最快!

再次运行rpm -ivh yum-*

[root@192 ~]# rpm -ivh yum-*
警告:yum-3.4.3-161.el7.centos.noarch.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4       a80eb5: NOKEY
警告:软件包 yum-3.4.3-161.el7.centos.noarch 已被加入,跳过 yum-3.4.3-161.el7.ce       ntos.noarch
准备中...                          ################################# [100%]
正在升级/安装...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [ 17%]
   2:yum-plugin-fastestmirror-1.1.31-5################################# [ 33%]
   3:yum-3.4.3-161.el7.centos         ################################# [ 50%]
   4:yum-langpacks-0.4.2-7.el7        ################################# [ 67%]
   5:yum-rhn-plugin-2.0.1-10.el7      ################################# [ 83%]
   6:yum-utils-1.1.31-50.el7          ################################# [100%]

7、新建repo配置文件

创建repo文件:

vim /etc/yum.repos.d/CentOS-Base.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-$7 - Base - 163.com

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

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

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$7 - Updates - 163.com

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

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

gpgcheck=1 gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$7 - Extras - 163.com

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

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

gpgcheck=1

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$7 - Plus - 163.com

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

gpgcheck=1

enabled=0

gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7

8、测试yum是否配置成功

随便下一个软件看看:

[root@192 ~]# yum -y install tree
已加载插件:fastestmirror, langpacks, product-id, subscription-mana                    ger
This system is not registered to Red Hat Subscription Management. Y                    ou can use subscription-manager to register.
Determining fastest mirrors
base                                        | 3.6 kB     00:00
extras                                      | 3.4 kB     00:00
updates                                     | 3.4 kB     00:00
(1/4): extras/x86_64/primary_db               | 156 kB   00:02
(2/4): base/x86_64/group_gz                   | 166 kB   00:02
(3/4): updates/x86_64/primary_db              | 1.3 MB   00:03
(4/4): base/x86_64/primary_db                 | 6.0 MB   00:03
正在解决依赖关系
--> 正在检查事务
---> 软件包 tree.x86_64.0.1.6.0-10.el7 将被 安装
--> 解决依赖关系完成

RHEL7 配置网络yum源的更多相关文章

  1. Linux配置网络YUM源

    配置网络yum源 RHEL6.5 [root@xuegod163 ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun ...

  2. 配置网络yum源

    有的时候服务器需要下载一些软件,是本地yum源没有的,这时候需要配置网络yum源 #cd  /etc/yum.repos.d/ 把这个目录下的配置文件备份,改名:或者是把文件里边的enabled=1的 ...

  3. CentOS 配置网络yum源

    配置网络yum源(需要保证外网开通,使用网易163提供开源镜像站) 1.下载repo文件 方法一:下载到本地windows再上传到linux服务器上: 下载地址 : http://mirrors.16 ...

  4. CentOS7下配置网络yum源(附带下载地址)

    一.查看外网是否通畅 配置网络yum源(需要保证外网开通,我这里是使用网易163提供开源镜像站) 二.下载repo文件 cd /etc/yum.repos.dwget http://mirrors.1 ...

  5. rhel配置网络yum源

    redhat 7.2配置网易yum源 卸载原来的yum源和安装必须的rpm包 1)确保虚拟机能够连接外网 2)前往http://mirrors.163.com/centos/7/os/x86_64/P ...

  6. centos配置网络yum源 和本地yum源

    一,网络yum源 1.备份 yum文件 cd /etc/ cp -r  yum.repos.d  yum.repos.d.bak 2.在系统联网的情况下执行下面命令下载 wget -O /etc/yu ...

  7. 安装RHEL7配置本地yum源 -- yum不能安装时,在本地安装,亲测成功

    RHEL7 本地yum源配置我们在安装Redhat的时候一般都不会填写注册信息,因为该产品是要购买的,所以我们在使用安装好的Redhat时有的功能是受限的,使用yum源install就是其中之一.那么 ...

  8. RHEL7.2和RHEL6.5的配置网络yum源和本地yum源

    RHEL7.2配置本地yum源 [root@localhost ~]#monut /dev/sr0 /mnt      #挂载光盘 [root@localhost ~]# rm -rf /etc/yu ...

  9. CentOS配置本地yum源(使用镜像iso文件)

    本人在使用yum安装软件的时候,感觉最不爽的是网络不佳时,安装的速度特别慢.所以,个人就上网search了一下如何使用Linux的安装文件作为其yum源.经过几次尝试,已经可以成功的配置了.下面是详细 ...

随机推荐

  1. ubuntu 配置apt-get源

    ubantu安装软件速度慢一般是因为系统默认选择的源导致,可以通过手动配置源设置解决. 1. 原文件备份 sudo mv /etc/apt/sources.list /etc/apt/sources. ...

  2. 怎么在PDF上进行文字修改

    文件相信大家不论是工作中还是在学习生活中都会有遇到,有时候我们会遇到PDF文件中的文字有时候会有错误的时候,这个时候就需要对修改PDF文件上的文字,那么具体要怎么做呢,PDF文件需要借助软件才可以编辑 ...

  3. git私有仓库与pycharm联合使用

    文章目录 1 创建git私有仓库和pycharm的使用 1.1 克隆私有仓库到本地 1.2 使用pycharm打开 1.3 添加.gitignore文件 1.4 并将其添加到仓库 1.5 提交和推送 ...

  4. github配置ssh密钥的方法

    配置用户名和邮箱 初次安装git需要配置用户名和邮箱,否则git会提示:please tell me who you are. 你需要运行命令来配置你的用户名和邮箱: $ git config --g ...

  5. git - 1.基础

    配置 C:\Users\Administrator λ git config --global user.name 'tangsansan' C:\Users\Administrator λ git ...

  6. ansible安装 使用 介绍

    1.介绍安装 a.介绍 Ansible:—基于 Python paramiko 开发,分布式,无需客户端,轻量级,配置语法使用 YMAL 及 Jinja2模板语言,更强的远程命令执行操作. b.安装 ...

  7. pypi pack and upload

    upload 403 error need to change the name in setup.py upload 400 error need to change the version of ...

  8. 网络远程唤醒 WOL Magic Packet

    Magic Packet Magic Packet白皮书介绍: The basic technical details of Magic Packet Technologyare simple and ...

  9. MYSQL双主全库同步复制

    环境: A.B两台服务器分别安装mysql-5.7.18服务端,配置成互为主从同步. linux系统版本为CentOS7 A服务器ip:192.168.1.7   主机名:test1 B服务器ip:1 ...

  10. 关于spring的自动注入

    关于spring的自动注入 spring里面可以设置BeanDefinition自动注入类型,默认为AUTOWIRE_NO(不进行自动注入).mybatis里面的扫描接口生成MapperFactory ...